From 8630dfb4ca8715ee494d54a75fa4fc483fcf3885 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 7 May 2022 20:08:41 +0300 Subject: [PATCH] Add a capture template for configuration fragments --- .emacs.d/esy.org | 128 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 89 insertions(+), 39 deletions(-) diff --git a/.emacs.d/esy.org b/.emacs.d/esy.org index b6fd237..87cf5de 100644 --- a/.emacs.d/esy.org +++ b/.emacs.d/esy.org @@ -241,17 +241,23 @@ For further information about Elisp headers, see [[info:elisp#Library :END: #+begin_src emacs-lisp + (defconst esy/source-path (locate-user-emacs-file "esy.org") + "Path to the Org version of this file.") + + (defconst esy/target-path (locate-user-emacs-file "esy.el") + "Path to the Elisp version of this file.") + (defun esy/tangle-and-compile-config () "Tangle literate configuration file." (interactive) (require 'org) (require 'ob) - (let ((source (locate-user-emacs-file "esy.org")) - (target (locate-user-emacs-file "esy.el"))) - (org-babel-tangle-file source target (rx string-start - (or "emacs-lisp" "elisp") - string-end)) - (byte-compile-file target))) + (org-babel-tangle-file esy/source-path + esy/target-path + (rx string-start + (or "emacs-lisp" "elisp") + string-end)) + (byte-compile-file esy/target-path)) (add-hook 'kill-emacs-hook #'esy/tangle-and-compile-config) #+end_src @@ -477,7 +483,7 @@ For further information about Elisp headers, see [[info:elisp#Library "Prompt for a projects and capture a related task." (require 'project) (let* ((projects - (org-map-entries `(lambda () (nth 4 (org-heading-components))) + (org-map-entries (lambda () (nth 4 (org-heading-components))) (concat "+project+LEVEL=2+SCM=\"file:" (project-root (with-current-buffer (org-capture-get :original-buffer) @@ -506,6 +512,18 @@ For further information about Elisp headers, see [[info:elisp#Library :prepend t :empty-lines 1 :immediate-finish t) + ("e" "Emacs configuration fragment" entry + (file+headline esy/source-path + "Misc. settings") + "** %^{Fragment} %^g + :PROPERTIES: + :CUSTOM_ID: %^{CUSTOM_ID} + :CreatedAt: %t + :CapturedAt: %a + :CapturedAs: Emacs configuration fragment + :END:\n\n#+begin_src emacs-lisp\n %i\n#+end_src + " + :empty-lines 1) ("n" "New Project" entry (file+headline esy/inbox-path "Projects") "** %^{Name} %^g @@ -818,6 +836,61 @@ For further information about Elisp headers, see [[info:elisp#Library (add-hook 'after-init-hook #'ace-link-setup-default) #+end_src +* Applications +** Elfeed +:PROPERTIES: +:CUSTOM_ID: elfeed +:END: + +#+begin_src emacs-lisp + (defun esy/setup-elfeed () + "Setup `elfeed'." + (require 'elfeed) + (setq elfeed-feeds + '("https://lwn.net/headlines/rss" + "https://reddit.com/r/prolog/.rss" + "https://www.haskellforall.com/feeds/posts/default" + "https://cestlaz.github.io/rss.xml" + "https://xkcd.com/rss.xml" + "https://hnrss.org/newest?points=50" + "https://planet.emacslife.com/atom.xml"))) + + (add-hook 'after-init-hook #'esy/setup-elfeed) +#+end_src + +** eww +:PROPERTIES: +:CUSTOM_ID: eww +:END: + +#+begin_src emacs-lisp + (with-eval-after-load 'eww + (setq eww-auto-rename-buffer 'title + browse-url-browser-function #'eww-browse-url)) +#+end_src + +** Proced +:PROPERTIES: +:CUSTOM_ID: proced-auto-update +:CreatedAt: <2022-05-07 Sat> +:CapturedAt: [[file:~/checkouts/protfiles/emacs/.emacs.d/prot-emacs.org::#h:6b56ce11-c84c-4b6d-98c7-bc3eefbe9325][file:~/checkouts/protfiles/emacs/.emacs.d/prot-emacs.org::#h:6b56ce11-c84c-4b6d-98c7-bc3eefbe9325]] +:CapturedAs: Emacs configuration fragment +:END: + +=proced.el= is an Elisp library built into Emacs that provides a +listing of the currently running system processes. The following code +fragment hooks =proced= to set =proced-auto-update-flag= variable to +=t= on startup, making =M-x proced= behave similarly to how =top(1)= +does in the shell. + +#+begin_src emacs-lisp + (defun esy/setup-proced () + "Setup `proced-mode' specific settings." + (setq proced-auto-update-flag t)) + + (add-hook 'proced-mode-hook #'esy/setup-proced) +#+end_src + * Display weekly agenda on startup :PROPERTIES: :CUSTOM_ID: agenda-on-startup @@ -896,38 +969,6 @@ For further information about Elisp headers, see [[info:elisp#Library (add-hook 'after-init-hook #'esy/setup-completions) #+end_src -* Elfeed -:PROPERTIES: -:CUSTOM_ID: elfeed -:END: - -#+begin_src emacs-lisp - (defun esy/setup-elfeed () - "Setup `elfeed'." - (require 'elfeed) - (setq elfeed-feeds - '("https://lwn.net/headlines/rss" - "https://reddit.com/r/prolog/.rss" - "https://www.haskellforall.com/feeds/posts/default" - "https://cestlaz.github.io/rss.xml" - "https://xkcd.com/rss.xml" - "https://hnrss.org/newest?points=50" - "https://planet.emacslife.com/atom.xml"))) - - (add-hook 'after-init-hook #'esy/setup-elfeed) -#+end_src - -* eww -:PROPERTIES: -:CUSTOM_ID: eww -:END: - -#+begin_src emacs-lisp - (with-eval-after-load 'eww - (setq eww-auto-rename-buffer 'title - browse-url-browser-function #'eww-browse-url)) -#+end_src - * Async shell commands with =dtache= :PROPERTIES: :CUSTOM_ID: dtache @@ -1064,6 +1105,15 @@ For further information about Elisp headers, see [[info:elisp#Library (add-hook 'after-init-hook #'esy/ping-mode) #+end_src +** Display battery status in the modeline +:PROPERTIES: +:CUSTOM_ID: battery +:END: + +#+begin_src emacs-lisp + (add-hook 'after-init-hook #'display-battery-mode) +#+end_src + * Setup PATH from shell environment :PROPERTIES: :CUSTOM_ID: path-from-shell -- 2.39.5