From 29993796077d71ea60f0d7e1675af3587f61b787 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 1 Jul 2022 20:22:12 -0400 Subject: [PATCH] Setup org-protocol-capture-html --- applications/emacs.nix | 27 +++++++++++++++++++++++++++ doom.d/config.el | 18 +++++++++++++----- doom.d/config.org | 26 ++++++++++++++++++++------ doom.d/init.el | 2 +- doom.d/packages.el | 2 ++ 5 files changed, 63 insertions(+), 12 deletions(-) diff --git a/applications/emacs.nix b/applications/emacs.nix index 0a9d6a2..69f97ef 100644 --- a/applications/emacs.nix +++ b/applications/emacs.nix @@ -7,6 +7,8 @@ # For graph generation graphviz sqlite + # For latex editing + texlive.combined.scheme-medium ]; # Utilize home-manager @@ -17,8 +19,33 @@ programs.doom-emacs = { enable = true; doomPrivateDir = ../doom.d; + emacsPackagesOverlay = self: super: { + org-protocol-capture-html = self.trivialBuild { + pname = "org-protocol-capture-html"; + ename = "org-protocol-capture-html"; + version = "0.0.0"; + buildInputs = [ self.s ]; + src = pkgs.fetchFromGitHub { + owner = "alphapapa"; + repo = "org-protocol-capture-html"; + rev = "3359ce9a2f3b48df26329adaee0c4710b1024250"; + hash = "sha256-ueEHJCS+aHYCnd4Lm3NKgqg+m921nl5XijE9ZnSRQXI="; + }; + }; + }; emacsPackage = pkgs.emacsPgtkNativeComp; }; + # Configure org protocol handler + home.packages = (with pkgs; [ + (makeDesktopItem { + name = "org-protocol"; + exec = "emacsclient %u"; + comment = "Org protocol"; + desktopName = "org-protocol"; + type = "Application"; + mimeTypes = [ "x-scheme-handler/org-protocol" ]; + }) + ]); # Startup service services.emacs = { enable = pkgs.stdenv.isLinux; diff --git a/doom.d/config.el b/doom.d/config.el index ce0af5a..b4fc045 100644 --- a/doom.d/config.el +++ b/doom.d/config.el @@ -144,11 +144,10 @@ (setq org-hide-emphasis-markers t org-pretty-entities t) -(font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - 0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))) - ("^ *\\([+]\\) " - 0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))) +(use-package! org-superstar + :hook (org-mode . org-superstar-mode) + :config + (setq org-superstart-special-todo-items t)) (defvar nm/org-agenda-files-timer nil "Timer for automatically updating the org-agenda files") @@ -251,6 +250,15 @@ work if it thinks it needs to." '(("d" "default" entry "* %<%I:%M %p>: %?" :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))) +(use-package! org-protocol-capture-html) + +(after! org + (push + '("w" "Web site" entry + (file "") + "* %a :website:\n\n%U %?\n\n%:initial") + org-capture-templates)) + (use-package! magit-todos :hook (magit-mode . magit-todos-mode)) diff --git a/doom.d/config.org b/doom.d/config.org index 1c67777..e28e958 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -218,14 +218,13 @@ Setup some basic cosmetic improvements org-pretty-entities t) #+end_src - Setup font lock for normal (non-heading) list items, to make things a bit more pleasnt to look at +Setup org-superstar-mode, to make lists and bullets pretty #+begin_src emacs-lisp -(font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - 0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))) - ("^ *\\([+]\\) " - 0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))) +(use-package! org-superstar + :hook (org-mode . org-superstar-mode) + :config + (setq org-superstart-special-todo-items t)) #+end_src Automatically add all files in the org dir to the agenda. This performs some filtering of the files returned from ~directory-files~ to exclude some things that would confuse org-agenda. @@ -352,6 +351,21 @@ Here we: '(("d" "default" entry "* %<%I:%M %p>: %?" :if-new (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>\n"))))) #+end_src +** org-protocol-capture-html +[[https://github.com/alphapapa/org-protocol-capture-html][Capture webpages]] really nice like +#+begin_src emacs-lisp +(use-package! org-protocol-capture-html) +#+end_src +** Capture Templates +The default template for org-protocol-capture-html +#+begin_src emacs-lisp +(after! org + (push + '("w" "Web site" entry + (file "") + "* %a :website:\n\n%U %?\n\n%:initial") + org-capture-templates)) +#+end_src * General Modes ** Magit Further configuration for magit diff --git a/doom.d/init.el b/doom.d/init.el index aabfa7f..8d47dd5 100644 --- a/doom.d/init.el +++ b/doom.d/init.el @@ -81,7 +81,7 @@ (latex +fold) ; writing papers in Emacs has never been so fun markdown ; writing docs for people to ignore nix ; I hereby declare "nix geht mehr!" - (org +pandoc +present +pretty +roam2 +pomodoro) ; organize your plain life in plain text + (org +pandoc +present +roam2 +pomodoro) ; organize your plain life in plain text raku ; the artist formerly known as perl6 rest ; Emacs as a REST client (rust +lsp) diff --git a/doom.d/packages.el b/doom.d/packages.el index 983f723..84d3d3e 100644 --- a/doom.d/packages.el +++ b/doom.d/packages.el @@ -60,3 +60,5 @@ (package! deadgrep) (package! multi-vterm) (package! grip-mode) +(package! org-protocol-capture-html) +(package! org-superstar)