From 725471b962d220ccdae0f2492b52335356add686 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 5 Apr 2020 18:59:49 +0200 Subject: Update package definitions: renamed & new in melpa --- emacs-init.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index dfb1aec..fbc0b1c 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1850,7 +1850,7 @@ Switch projects and subprojects from NEXT back to TODO" (use-package org-screenshot) (use-package org-collector) (use-package ox) -(use-package org-notmuch) +(use-package ol-notmuch) (use-package org-expiry :custom (org-expiry-handler-function 'org-expiry-archive-subtree)) @@ -1922,10 +1922,10 @@ Use imagemagick and standalone class for latex preview. *** org-roam #+begin_src emacs-lisp (use-package org-roam + :ensure t :delight :hook (after-init . org-roam-mode) - :load-path "~/git/clone/org-roam" :custom (org-roam-directory "~/git/projects/zettel/") :bind (:map org-roam-mode-map -- cgit v1.2.3 From 1ceccf375f07333d49a4de50255bd0cc037e0a77 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 5 Apr 2020 19:59:42 +0200 Subject: Update symlinks --- emacs-init.org | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index fbc0b1c..11dc6da 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -5,11 +5,11 @@ This files contains all the elisp code normally placed in the .emacs file. It and the =init.el= file are then symlinked to my =~/.emacs.d/= directory. Instead of symlinking the files could also be directly tangled to =~/.emacs.d/=. -#+BEGIN_SRC shell :results silent -ln -sf $(pwd)/emacs-init.org ~/.emacs.d/ -ln -sf $(pwd)/tangle/emacs-init.el ~/.emacs.d/ -ln -sf $(pwd)/emacs-private.el.gpg ~/.emacs.d/ -ln -sf $(pwd)/tangle/init.el ~/.emacs.d/ +#+BEGIN_SRC shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash" +ln -siv $(pwd)/emacs-init.org ~/.emacs.d/ +ln -siv $(pwd)/tangle/emacs-init.el ~/.emacs.d/ +ln -siv $(pwd)/emacs-private.el.gpg ~/.emacs.d/ +ln -siv $(pwd)/tangle/init.el ~/.emacs.d/ #+END_SRC An often seen setup is to use ~org-babel-load-file~ in =init.el= to -- cgit v1.2.3 From 131f7087e8542ed8e6a128a4f7b89e0fd199efa8 Mon Sep 17 00:00:00 2001 From: fpi Date: Thu, 9 Apr 2020 16:37:39 +0200 Subject: Add git-identity --- emacs-init.org | 14 ++++++++++++-- emacs-private.el.gpg | Bin 1030 -> 1073 bytes 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 11dc6da..5421d81 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1251,7 +1251,6 @@ of src_shell{getconf "PATH"}. See [[elisp:(describe-variable #+end_src ** Git *** Magit - #+BEGIN_SRC emacs-lisp (use-package magit :ensure t @@ -1297,6 +1296,18 @@ Add support for [[https://nvie.com/posts/a-successful-git-branching-model/][gitf :ensure t :hook (magit-mode . turn-on-magit-gitflow)) #+end_src +*** git-identity +Found it in this [[https://www.manueluberti.eu/emacs/2020/03/30/lockdown-beam-git-identity/][blog post]] from Manuel Uberti. An easy way to handle multiple git identities. + +#+begin_src emacs-lisp +(use-package git-identity + :ensure t + :custom + (git-identity-verify t) + (git-identity-list private/git-identity-list) + :config (git-identity-magit-mode 1) + :bind (:map magit-status-mode-map ("I" . git-identity-info))) +#+end_src *** diff-hl Indicates changed lines in the left fringe. The Hydra can be used to navigate and revert hunks directly from the buffer. Use =g= to open @@ -1353,7 +1364,6 @@ some safe local variable values. (add-to-list 'safe-local-variable-values '(git-auto-commit-mode . t))) #+end_src - ** Projectile #+BEGIN_SRC emacs-lisp diff --git a/emacs-private.el.gpg b/emacs-private.el.gpg index 6b46930..b997400 100644 Binary files a/emacs-private.el.gpg and b/emacs-private.el.gpg differ -- cgit v1.2.3 From 3afae2ba4fea7ba9998f9107196b4d1613485f4c Mon Sep 17 00:00:00 2001 From: fpi Date: Thu, 9 Apr 2020 16:38:34 +0200 Subject: Add some bibtex settings --- emacs-init.org | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 5421d81..4ed3f35 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2197,17 +2197,34 @@ A small function to toggle the encryption state of the current entry. (org-encrypt-entry)))))) (define-key fpi/toggle-map "e" #'fpi/org-toggle-crypt-entry)) #+end_src -*** org-ref +*** Reference management +**** Bibtex +#+begin_src emacs-lisp +(use-package bibtex + :custom + (bibtex-autokey-titlewords 3) + (bibtex-autokey-titlewords-stretch 1) + (bibtex-autokey-titleword-length 5) + :config + (bibtex-set-dialect 'BibTeX)) + +(setq bibtex-completion-bibliography "~/git/projects/zettel/Lit/bib.bib") +(setq bibtex-completion-notes-path "~/git/projects/zettel/Lit") +(setq bibtex-completion-notes-extension ".org") + +#+end_src +**** org-ref #+begin_src emacs-lisp (use-package org-ref :ensure t :custom - (org-ref-bibliography-notes "~/git/projects/personal/bib.org") + (org-ref-bibliography-notes nil) + (org-ref-notes-function 'org-ref-notes-function-many-files) + (org-ref-notes-directory "~/git/projects/zettel/Lit") (org-ref-default-bibliography '("~/git/projects/personal/bib.bib")) - (org-ref-pdf-directory "~/git/projects/personal/Lit/") - :config - (bibtex-set-dialect 'BibTeX)) + (org-ref-pdf-directory "~/git/projects/personal/Lit/")) #+end_src +***** Capturing entries I store my bibtex references in an org file together with my notes. In addition to saving the meta information in properties using the same functions as =doi-utils-doi-to-org-bibtex=, I also store them a second -- cgit v1.2.3 From bd99576d739fc2965abc3d7c6125d5e0a64d5236 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 9 May 2020 13:15:19 +0200 Subject: Change default font size --- emacs-init.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 4ed3f35..b7d2f47 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -320,7 +320,8 @@ The above macro can be used like this. :foreground ,bg-white) (:family ,sans-mono-font :background ,bg-white - :foreground ,bg-dark)) + :foreground ,bg-dark + :height 75)) (variable-pitch (:family ,sans-font) (:family ,et-font -- cgit v1.2.3 From 175361abefd56025bf8e6b4eec10424838b5c5d4 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 9 May 2020 13:16:09 +0200 Subject: Add basic org mode prettify symbols --- emacs-init.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index b7d2f47..11dfd82 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1930,6 +1930,22 @@ Use imagemagick and standalone class for latex preview. #+begin_src emacs-lisp (use-package ol-bbdb) #+end_src +*** prettify symbols +Set some prettify symbols for org mode. +#+begin_src emacs-lisp +(defun fpi/add-org-prettify-symbols () + "Beautify Org Checkbox Symbol" + (setq prettify-symbols-alist + (append prettify-symbols-alist + '(("#+BEGIN_SRC" . ?») + ("#+END_SRC" . ?«) + ("#+begin_src" . ?») + ("#+end_src" . ?«) + ("[ ]" . ?☐) + ("[X]" . ?☑ ) + ("[-]" . ?❍ ))))) +(add-hook 'org-mode-hook 'fpi/add-org-prettify-symbols) +#+end_src *** org-roam #+begin_src emacs-lisp (use-package org-roam -- cgit v1.2.3 From 2c63cd040851ede402a26fb55837fd89789f346b Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 9 May 2020 13:17:37 +0200 Subject: Show .cir mail attachments inline with spice-mode --- emacs-init.org | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 11dfd82..5296c67 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3043,7 +3043,18 @@ I use =msmtp= to send mail. (mail-specify-envelope-from t) (mail-envelope-from 'header)) #+end_src - +*** MIME +#+begin_src emacs-lisp +(use-package mm-decode + :config + (use-package spice-mode + :ensure t) + (defun mm-display-spice-inline (handle) + "Show an spice mode text from HANDLE inline." + (mm-display-inline-fontify handle 'spice-mode)) + (add-to-list 'mm-inline-media-tests '("application/x-wine-extension-cir" mm-display-spice-inline identity)) + (add-to-list 'mm-inlined-types "application/x-wine-extension-cir")) +#+end_src *** MUA/Notmuch After using =mu4e= as my mail user agent for a while I switched to -- cgit v1.2.3 From c4211fe5ce8c398c9f6df2a9c1af99d9c4260061 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 9 May 2020 13:28:11 +0200 Subject: Display bbdb window horizontally --- emacs-init.org | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs-init.org b/emacs-init.org index 5296c67..d480f21 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3165,6 +3165,7 @@ For now I use this bad code. (bbdb-initialize 'gnus 'message) (bbdb-mua-auto-update-init 'gnus 'message) +(setq bbdb-mua-pop-up 'horiz) ;; size of the bbdb popup (setq bbdb-pop-up-window-size 0.15) (setq bbdb-mua-pop-up-window-size 0.15) -- cgit v1.2.3 From 3af5ab4866bbd8baed8f8b8d4bb00593b79d1639 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 9 May 2020 13:28:38 +0200 Subject: Smarter refile target selection --- emacs-init.org | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index d480f21..091570e 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1640,7 +1640,9 @@ Hansen's]] configs. - Refile Targets :: Use the full outline path so I can distinguish headlines with the same name & disable step-wise completion as I think from the refile target backwards, not from top-level - downwards. + downwards. Also include the current file's headings as a refile + targets up to a deep level, all agenda files up to a small level and + all open org files up to an even smaller level. - Drawer for Notes :: Notes go into the =NOTES= drawer. Clocking times should stay separate in the =LOGBOOK= drawer. - Track state changes :: Notes when an entry is switched to done when @@ -1696,6 +1698,9 @@ Hansen's]] configs. ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1"))) (org-ellipsis " ") (org-refile-use-outline-path 'file) + (org-refile-targets '((nil :maxlevel . 8) + (org-agenda-files :maxlevel . 3) + (org-buffer-list :maxlevel . 2))) (org-outline-path-complete-in-steps nil) (org-log-state-notes-into-drawer "NOTES") (org-clock-into-drawer "LOGBOOK") -- cgit v1.2.3 From ce2e25063b3bae217178c38ba65a9095bfcdaa34 Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 3 Jun 2020 19:20:55 +0200 Subject: Set better colors for scheduled entries in the agenda --- emacs-init.org | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 091570e..64cc3d7 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -291,6 +291,9 @@ The above macro can be used like this. (shade-white "#efeae9") (fg-light "#655370") (dark-cyan "#008b8b") + (light-green "#4f774f") ;;#3f773f + (dark-green "#1c661c") + (dark-green2 "#002000") (region-dark "#2d2e2e") (region "#39393d") (slate "#8FA1B3") @@ -597,16 +600,16 @@ The above macro can be used like this. nil) (org-scheduled (:foreground ,gray) - nil) + (:foreground ,light-green)) (org-upcoming-deadline (:foreground ,keyword) nil) (org-scheduled-today (:foreground ,fg-white) - nil) + (:foreground ,dark-green)) (org-scheduled-previously (:foreground ,slate) - nil) + (:foreground ,dark-green2)) (org-agenda-done (:inherit nil :foreground ,doc) -- cgit v1.2.3 From 006863bebd5b0b951ec804a308450bcd17db47ab Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 3 Jun 2020 19:21:42 +0200 Subject: Disable ido-completing-read --- emacs-init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 64cc3d7..37ae657 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1022,7 +1022,7 @@ are for now mostly copied from [[https://gitlab.com/protesilaos/dotemacs/][Prote (setq-local max-mini-window-height 1)))) #+END_SRC -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (use-package ido-completing-read+ :ensure t :after ido -- cgit v1.2.3 From c68cee618df34c4ca31c682a9d5d7ecd37e49688 Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 3 Jun 2020 19:22:00 +0200 Subject: Set emacs to ask for gpg passphrases in the minibuffer --- emacs-init.org | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 37ae657..b636c0f 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1501,6 +1501,17 @@ over =windmove=, as it does not interfere with org keybindings. ("C-c " . winner-hydra/winner-undo) ("C-c " . winner-hydra/winner-redo))) #+end_src +** File encryption +=epa= handles en-/decryption with =gnupg=. Setting ~'loopback~ pinentry mode will ask for the key passphrase in the emacs minibuffer. For this the =pinentry= package is needed, as well as setting =allow-emacs-pinentry= in the =gnupg= configuration. + +#+begin_src emacs-lisp +(use-package epa + :custom (epa-pinentry-mode 'loopback)) +(use-package pinentry + :ensure t + :config (pinentry-start) + :after epa) +#+end_src * Applications and utilities ** Calendar Some basic calendar options for date format und location to provide -- cgit v1.2.3 From a02db53860b418fe56cc403bf2d116bb634d007a Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 3 Jun 2020 19:22:25 +0200 Subject: Customize org column view layout --- emacs-init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index b636c0f..5741649 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1912,6 +1912,11 @@ Use imagemagick and standalone class for latex preview. (use-package org-num :delight) #+end_src +*** Column view +#+begin_src emacs-lisp +(setq org-columns-default-format + "%50ITEM(Task) %5Effort(Effort){:} %5CLOCKSUM %3PRIORITY %20DEADLINE %20SCHEDULED %20TIMESTAMP %TODO %CATEGORY %TAGS") +#+end_src *** org-caldav #+begin_src emacs-lisp (use-package org-caldav -- cgit v1.2.3 From b6762922776f998cd9ddd662284c819c2cdb865c Mon Sep 17 00:00:00 2001 From: fpi Date: Wed, 3 Jun 2020 19:22:46 +0200 Subject: Add org-roam-bibtex package --- emacs-init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 5741649..bbe46d2 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1986,6 +1986,14 @@ Set some prettify symbols for org mode. :map org-mode-map (("C-c n i" . org-roam-insert)))) #+end_src +**** org-roam-bibtex +#+begin_src emacs-lisp :tangle no +(use-package org-roam-bibtex + :ensure t + :hook (org-roam-mode . org-roam-bibtex-mode) + :bind (:map org-mode-map + (("C-c n a" . orb-note-actions)))) +#+end_src *** Org-edna =Org-edna= is a great tool to manage =TODO= dependencies. I mainly use it to mark tasks as =NEXT= after switching another task to =DONE=. The -- cgit v1.2.3 From c611cd53bdf6a03adc3fb79bf1ef516c344a89bf Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 5 Jun 2020 16:08:51 +0200 Subject: Fix git-identity settings --- emacs-init.org | 3 ++- emacs-private.el.gpg | Bin 1085 -> 1086 bytes 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index bbe46d2..8ca8c20 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1309,8 +1309,9 @@ Found it in this [[https://www.manueluberti.eu/emacs/2020/03/30/lockdown-beam-gi :custom (git-identity-verify t) (git-identity-list private/git-identity-list) - :config (git-identity-magit-mode 1) :bind (:map magit-status-mode-map ("I" . git-identity-info))) +(use-package git-identity-magit + :config (git-identity-magit-mode 1)) #+end_src *** diff-hl Indicates changed lines in the left fringe. The Hydra can be used to diff --git a/emacs-private.el.gpg b/emacs-private.el.gpg index a94dda3..6100326 100644 Binary files a/emacs-private.el.gpg and b/emacs-private.el.gpg differ -- cgit v1.2.3 From 23228408a615cfa2f65f6bfd6d28d33231707b94 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 5 Jun 2020 16:09:25 +0200 Subject: Switch from obsolete org-pdfview to org-pdftools --- emacs-init.org | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 8ca8c20..416a5ef 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1803,8 +1803,9 @@ Switch projects and subprojects from NEXT back to TODO" :custom (org-export-with-broken-links 'match) (org-export-backends '(ascii beamer html icalendar latex man md odt org groff koma-letter))) -(use-package org-pdfview -:ensure t) +(use-package org-pdftools + :ensure t + :hook (org-load . org-pdftools-setup-link)) (use-package org-id :custom (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) (use-package org-clock -- cgit v1.2.3 From 9e835276715b46099f08c4e7e8981bef0deff004 Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 6 Jun 2020 15:38:19 +0200 Subject: Add support for ansi-colors in compilation buffer output --- emacs-init.org | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 416a5ef..6f114fd 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3217,6 +3217,19 @@ For now I use this bad code. (lambda () (define-key gnus-summary-mode-map (kbd ";") 'bbdb-mua-edit-field))) #+end_src +** Compile +Fix ansi colors in compile buffers. From [[https://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html][endlessparentheses]]. +#+begin_src emacs-lisp +(use-package compile + :config + (require 'ansi-color) + (defun endless/colorize-compilation () + "Colorize from `compilation-filter-start' to `point'." + (let ((inhibit-read-only t)) + (ansi-color-apply-on-region + compilation-filter-start (point)))) + :hook (compilation-filter . endless/colorize-compilation)) +#+END_src ** Context aware hydra :PROPERTIES: :ID: 22750e48-aaee-4f60-bdce-1d511ebe3375 -- cgit v1.2.3 From 4b7751438351671a99cf698f685ac55acd8d86a1 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 7 Jun 2020 14:17:08 +0200 Subject: Add agenda view for roam-directory & current directory Ideally the view for current-directory should be non-sticky.. --- emacs-init.org | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 6f114fd..9b8802d 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1821,11 +1821,13 @@ Switch projects and subprojects from NEXT back to TODO" (org-src-window-setup 'current-window) (org-src-fontify-natively t) (org-src-tab-acts-natively t) - (org-edit-src-content-indentation 0) -) + (org-edit-src-content-indentation 0)) +(defun fpi/collect-org-directories-recursively (dir) + "Return list of all directories which contain .org files of DIR and its subdirectories" + (delete-dups (mapcar 'file-name-directory (directory-files-recursively dir "\.org$")))) (use-package org-agenda :custom - (org-agenda-files (quote ("~/s/s.org" "~/sync" "~/.emacs.d/gcal.org" "~/.emacs.d/tr.org" "~/n.org"))) + (org-agenda-files (fpi/collect-org-directories-recursively "~/sync")) (org-deadline-warning-days 14) (org-agenda-start-on-weekday nil) (org-agenda-span 14) @@ -1847,7 +1849,7 @@ Switch projects and subprojects from NEXT back to TODO" ;; See emacs.christianbaeuerlein.com/my-org-config.html (org-agenda-block-separator 9472) (org-agenda-custom-commands - '(("n" "Agenda and all TODOs" + `(("n" "Agenda and all TODOs" ((todo "INPROGRESS" ((org-agenda-overriding-header "Inprogress Tasks"))) (agenda) @@ -1874,7 +1876,15 @@ Switch projects and subprojects from NEXT back to TODO" ((org-agenda-overriding-header "Things to Watch") (org-agenda-skip-function 'bh/skip-project-tasks) (org-agenda-sorting-strategy - '(todo-state-down effort-up)))))))) + '(todo-state-down effort-up)))))) + ("z" "Todos in org-roam-dir" + ((alltodo "" + ((org-agenda-files (fpi/collect-org-directories-recursively org-roam-directory)))))) + ("c" "Agenda and all todos in current directory" + ((agenda "" + ((org-agenda-files (fpi/collect-org-directories-recursively default-directory)))) + (alltodo "" + ((org-agenda-files (fpi/collect-org-directories-recursively default-directory)))))))) ) (use-package ob-core :custom -- cgit v1.2.3 From 58b13b80f03ceedd0d809155b4935466940375eb Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:01:10 +0200 Subject: Add function to scale height of default face --- emacs-init.org | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 9b8802d..4fa0ecd 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -830,6 +830,24 @@ Finally load the theme. #+begin_src emacs-lisp (load-theme 'spacemacs-light t) #+end_src +*** Scaling the height of the =default= face. +When switching between monitors with different resolution, scaling the +=default= face can be used to in-/decreases the size of text and UI elements +(modeline, …) to a more readable size. +#+begin_src emacs-lisp +(defun fpi/scale-default-face (&optional arg) + "Increase height of face default." + (interactive "P") + (let* ((height (face-attribute 'default :height)) + (scale (if arg -10 10)) + (new (+ height scale))) + (set-face-attribute 'default nil :height new) + (message "Default height: %s" new))) +#+end_src +#+begin_src emacs-lisp :tangle no :noweb-ref fpi-bindings +(define-key 'fpi-map (kbd "+") 'fpi/scale-default-face) +(define-key 'fpi-map (kbd "-") (lambda () (interactive) (fpi/scale-default-face t))) +#+end_src ** User info Set ~user-full-name~ and ~user-mail-address~. These are set in [[file:emacs-private.el.gpg::1][emacs-private.el.gpg]]. @@ -930,7 +948,7 @@ This was inspired from [[http://endlessparentheses.com/the-toggle-map-and-wizard (define-key fpi/toggle-map "W" #'whitespace-toggle-options) #+END_SRC *** fpi-map -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :noweb yes (define-prefix-command 'fpi-map) (unbind-key (kbd "C-z")) (global-set-key (kbd "C-z") 'fpi-map) @@ -946,6 +964,8 @@ This was inspired from [[http://endlessparentheses.com/the-toggle-map-and-wizard (define-key fpi-map (kbd "t") fpi/toggle-map) (define-key fpi-map (kbd "n") 'sauron-toggle-hide-show) (define-key fpi-map (kbd "j") (lambda () (interactive) (find-file org-journal-file))) + +<> #+END_SRC ** Base commands (simple.el) #+begin_src emacs-lisp -- cgit v1.2.3 From 69fb885bf37131f18f1601e8cc9715d1663d531c Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:01:58 +0200 Subject: Add function to join adjacent clock lines if possible --- emacs-init.org | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 4fa0ecd..37abc99 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1963,7 +1963,37 @@ Use imagemagick and standalone class for latex preview. (org-caldav-exclude-tags '(nocal)) ) #+end_src -*** org-clock-convenience +*** Clocking +**** Combine adjacent clock lines +#+begin_src emacs-lisp +(defun fpi/org-clock-join-last-clock () + "Join current clock with last one if start/end point match." + (save-mark-and-excursion + (beginning-of-line) + (let* ((eol (save-excursion (end-of-line) (point))) + (boi (progn (re-search-forward "\\[" eol t) (backward-char) (point))) + (eoi (progn (re-search-forward "\\]" eol t) (point))) + (i (buffer-substring-no-properties boi eoi)) ;; last clock-in-time + (boc (progn (re-search-forward "\\[" eol t) (backward-char) (point))) + (eoc (progn (re-search-forward "\\]" eol t) (point))) + (c (buffer-substring-no-properties boc eoc))) ;; last clock-out-time (equals org-clock-out-time if last clock) + (next-line) + (end-of-line) + (let* ((bol (save-excursion (beginning-of-line) (point))) + (eoo (progn (re-search-backward "\\]" bol t) (forward-char) (point))) + (boo (progn (re-search-backward "\\[" bol t) (point))) + (o (buffer-substring-no-properties boo eoo))) ;; last-last clock-out-time + (when (equal i o) + (delete-region boo eoo) + ;; (insert (format-time-string (org-time-stamp-format t t) org-clock-out-time)) + (insert c) + (org-evaluate-time-range) + (previous-line) + (delete-region (save-excursion (beginning-of-line) (backward-char) (point)) eol) + (message (format "Joined nearby clocks at %s" i))))))) +(add-hook 'org-clock-out-hook 'fpi/org-clock-join-last-clock) +#+end_src +**** org-clock-convenience #+begin_src emacs-lisp (use-package org-clock-convenience :ensure t -- cgit v1.2.3 From 825b390765a5203892003dda8f0b1a9462e2fda0 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:02:22 +0200 Subject: Add reply to mail and checkout capture templates --- emacs-init.org | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 37abc99..70e9d89 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2199,6 +2199,26 @@ Templates entry (id "efc97963-b714-4020-94b6-c23ad2a286ee") (function fpi/add-org-from-doi)) + ("r" "Reply" + entry + (file "~/sync/refile.org") + "* REPLY: %:from: %:subject +:PROPERTIES: +:CREATED: %U +:SOURCE: %a +:END: +%? +" + ) + ("c" "Checkout") + ("cr" ".. & read" + entry + (file "~/sync/refile.org") + "* TODO %a :READLIST: +:PROPERTIES: +:CREATED: %U +:END: +%?") ;; ("a" "Appointment" entry (file "~/sync/a.org") ;; "* %i%?%(and (org-id-get-create) nil)\n:PROPERTIES:\n:CREATED: %U%(when %a \"\n:SOURCE: %a\")\n:END:\n%^t") ;; ("t" "Soonish task" entry (file "~/sync/refile.org") @@ -2242,7 +2262,10 @@ Templates ;; :empty-lines 1 ;; :immediate-finish t) ) - ))) + ) + (org-capture-templates-contexts + '(("r" ((in-mode . "gnus-summary-mode") + (in-mode . "gnus-article-mode"))))))) #+END_SRC Setup for floating capture window. For reference see [[https://www.windley.com/archives/2010/12/capture_mode_and_emacs.shtml][here]]. #+begin_src emacs-lisp -- cgit v1.2.3 From e638683b4338d3b15346ee45a99fdeeb494dc2bf Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:02:57 +0200 Subject: Reduce noise in my agenda by viewing day only --- emacs-init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 70e9d89..15a65fa 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1850,7 +1850,7 @@ Switch projects and subprojects from NEXT back to TODO" (org-agenda-files (fpi/collect-org-directories-recursively "~/sync")) (org-deadline-warning-days 14) (org-agenda-start-on-weekday nil) - (org-agenda-span 14) + (org-agenda-span 'day) (org-agenda-start-day "+0d") (org-agenda-include-diary nil) (org-agenda-sticky t) -- cgit v1.2.3 From a1e3179d941aa00182f3decfe3fdf7f3172c40d5 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:03:31 +0200 Subject: Add hunspell spellchecker with EN+DE setup Still have to check for hunspell dictionaries with more entries --- emacs-init.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 15a65fa..645d315 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3300,6 +3300,16 @@ For now I use this bad code. (lambda () (define-key gnus-summary-mode-map (kbd ";") 'bbdb-mua-edit-field))) #+end_src +** Spellcheck +#+begin_src emacs-lisp +(use-package ispell + :config + (setq ispell-program-name "/usr/bin/hunspell") + (setq ispell-dictionary "en_US,de_DE") + (ispell-set-spellchecker-params) + (ispell-hunspell-add-multi-dic "en_US,de_DE") + ) +#+end_src ** Compile Fix ansi colors in compile buffers. From [[https://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html][endlessparentheses]]. #+begin_src emacs-lisp -- cgit v1.2.3 From a5a1d90a3763fa43a06c88c80e1b659f317a5b21 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 12 Jun 2020 15:04:17 +0200 Subject: Make relevant src blocks linkable from readme --- emacs-init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 645d315..2f5e448 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -36,6 +36,7 @@ disable ~buffer-auto-save-file-name~ for the files. I use =.org= configuration files also for my other dotfiles. To ensure they are tangled upon save I use this function. +#+NAME: tangle-hook #+BEGIN_SRC emacs-lisp (defun fpi/tangle-dotfiles () "If the current file is in '~/.dotfiles' tangle all code blocks." @@ -52,6 +53,7 @@ saved again. The latter part is not directly supported by =org=. ~org-babel-post-tangle-hook~ is executed in the created tangled files and not inside the source =.org= file. Instead I add an advice to ~org-babel-tangle~. +#+NAME: org-crypt-tangle-setup #+BEGIN_SRC emacs-lisp (defun save-without-hook () (let ((before-save-hook nil)) -- cgit v1.2.3 From 953de5b7764a96ec1ab08fd5443cbe878893fbfb Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 14 Jun 2020 14:23:33 +0200 Subject: Switch to straight.el --- emacs-init.org | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 2f5e448..ba85711 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1,4 +1,4 @@ -#+PROPERTY: header-args:emacs-lisp :tangle tangle/emacs-init.el :results silent +#+PROPERTY: header-args:emacs-lisp :tangle tangle/emacs-init.el :results silent :noweb yes * Overview ** About this document This files contains all the elisp code normally placed in the .emacs @@ -88,8 +88,10 @@ load this file here. This is the content of =init.el=. Notice the ~:tangle tangle/init.el~ header argument in the source code. #+begin_src emacs-lisp :tangle tangle/init.el -(require 'package) -(package-initialize) +<> + +;; package.el to enable use of list-packages +<> ;; (setq safe-local-variable-values (list (cons 'buffer-auto-save-file-name nil) ;; (cons 'header-line-format " "))) (setq vc-follow-symlinks t) @@ -116,22 +118,44 @@ Notable configs: - [[http://doc.norang.ca/org-mode.html][Bernt Hansen]] * Base settings -** Setup some paths +** Setup load path +Folder for additional lisp files I may want to load. #+BEGIN_SRC emacs-lisp (add-to-list 'load-path "~/.emacs.d/lisp") -(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) -(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") nil) #+END_SRC ** Meta packages Packages that don't do anything by themselves, but can be used to help with other package definition and customization. +*** package.el +=package.el= setup. While I switched to [[id:eef88cd4-f2f5-4e4b-b7bb-75faac36dcb8][straight.el]], I keep =package.el= loaded for now to be able to browse ELPA/MELPA with ~M-x list-packages~. +#+BEGIN_SRC emacs-lisp :noweb-ref package.el :tangle no +(require 'package) +;; (package-initialize) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") nil) +#+END_SRC +*** straight.el +:PROPERTIES: +:ID: eef88cd4-f2f5-4e4b-b7bb-75faac36dcb8 +:END: +[[https://github.com/raxod502/straight.el][straight.el]] is a package manager for emacs, which in contrast to =package.el= keeps track of the current package versions and supports local development on packages. See the [[https://github.com/raxod502/straight.el#comparison-to-other-package-managers][github page]] for a detailed comparison with other package managers. +#+begin_src emacs-lisp :noweb-ref straight.el :tangle no +(defvar bootstrap-version) +(let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) +#+end_src *** Use-package #+begin_src emacs-lisp -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) -(eval-when-compile - (require 'use-package)) +(straight-use-package 'use-package) #+end_src *** Hydra #+begin_src emacs-lisp -- cgit v1.2.3 From 55af7c75d1ddf8fdaccc897585d421c28d050d34 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 14 Jun 2020 14:28:06 +0200 Subject: Convert :ensure to :straight --- emacs-init.org | 112 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index ba85711..d8500ce 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -160,12 +160,12 @@ with other package definition and customization. *** Hydra #+begin_src emacs-lisp (use-package hydra - :ensure t) + :straight t) #+end_src This package allows hydra definitions in use-package. #+begin_src emacs-lisp (use-package use-package-hydra - :ensure t) + :straight t) #+end_src *** which-key In Emacs you can press =?= or =C-h= after starting a key combination @@ -174,7 +174,7 @@ small popup, which I think is more handy. #+begin_src emacs-lisp (use-package which-key :delight - :ensure t + :straight t :custom (which-key-idle-delay 0.4) :config (which-key-mode 1)) #+end_src @@ -185,7 +185,7 @@ remove it. =Try= installs packages temporarily for this emacs session only. #+begin_src emacs-lisp (use-package try - :ensure t) + :straight t) #+end_src ** GUI Interface Disable most of the user interface. @@ -207,7 +207,7 @@ leaves a gap at the bottom. This removes it. *** Remove mode line clutter #+begin_src emacs-lisp (use-package delight - :ensure t + :straight t :after use-package) #+end_src If removing mode symbols with =delight= is not enough, the mode line @@ -218,7 +218,7 @@ mode-line not being redisplayed, when turning the mode off even though it calls ~force-mode-line-update~. #+begin_src emacs-lisp (use-package hide-mode-line - :ensure t + :straight t :hook (hide-mode-line-mode . redraw-display) (help-mode . hide-mode-line-mode)) @@ -1070,7 +1070,7 @@ are for now mostly copied from [[https://gitlab.com/protesilaos/dotemacs/][Prote #+BEGIN_SRC emacs-lisp :tangle no (use-package ido-completing-read+ - :ensure t + :straight t :after ido :config (ido-ubiquitous-mode 1)) @@ -1079,7 +1079,7 @@ are for now mostly copied from [[https://gitlab.com/protesilaos/dotemacs/][Prote Ido completion for =M-x=. #+BEGIN_SRC emacs-lisp :tangle no (use-package amx - :ensure t + :straight t :after (ido ido-completing-read+) :init (setq amx-backend 'ido) @@ -1187,7 +1187,7 @@ confines of word boundaries (e.g. multiple words)." (find-name-arg "-iname")) (use-package async - :ensure t) + :straight t) (use-package dired-async :after (dired async) @@ -1197,7 +1197,7 @@ confines of word boundaries (e.g. multiple words)." *** Narrowing #+BEGIN_SRC emacs-lisp (use-package dired-narrow - :ensure t + :straight t :after dired :bind (:map dired-mode-map ("SPC" . dired-narrow-regexp))) @@ -1222,7 +1222,7 @@ behaviour while inside a regular dired buffer. #+BEGIN_SRC emacs-lisp (use-package peep-dired - :ensure t + :straight t :after dired :bind (:map dired-mode-map ("P" . peep-dired)) @@ -1259,7 +1259,7 @@ target dir). #+BEGIN_SRC emacs-lisp (use-package dired-subtree - :ensure t + :straight t :after dired :bind (:map dired-mode-map ("" . dired-subtree-toggle) @@ -1271,7 +1271,7 @@ Open a small sidebar window showing the current directory. #+BEGIN_SRC emacs-lisp (use-package dired-sidebar :bind (("C-x C-n" . dired-sidebar-toggle-sidebar)) - :ensure t + :straight t :commands (dired-sidebar-toggle-sidebar) :hook (dired-sidebar-mode . (lambda () @@ -1287,7 +1287,7 @@ Recursive directory sizes. Toggle with =C-x M-r=. This will take a while for directories with lots of nested files. #+BEGIN_SRC emacs-lisp (use-package dired-du - :ensure t + :straight t :config (setq dired-du-size-format 't)) #+END_SRC ** Tramp @@ -1303,7 +1303,7 @@ of src_shell{getconf "PATH"}. See [[elisp:(describe-variable *** Magit #+BEGIN_SRC emacs-lisp (use-package magit - :ensure t + :straight t :custom (magit-completing-read-function 'magit-ido-completing-read) :init (global-magit-file-mode)) #+END_SRC @@ -1343,7 +1343,7 @@ Only highlight the changes within a line, not the whole line. Add support for [[https://nvie.com/posts/a-successful-git-branching-model/][gitflow]]. #+begin_src emacs-lisp (use-package magit-gitflow - :ensure t + :straight t :hook (magit-mode . turn-on-magit-gitflow)) #+end_src *** git-identity @@ -1351,7 +1351,7 @@ Found it in this [[https://www.manueluberti.eu/emacs/2020/03/30/lockdown-beam-gi #+begin_src emacs-lisp (use-package git-identity - :ensure t + :straight t :custom (git-identity-verify t) (git-identity-list private/git-identity-list) @@ -1366,7 +1366,7 @@ navigate and revert hunks directly from the buffer. Use =g= to open #+begin_src emacs-lisp (use-package diff-hl - :ensure t + :straight t :defer t :bind (:map fpi-map ("g" . hydra-diff-hl/body)) :init (global-diff-hl-mode 1) @@ -1403,7 +1403,7 @@ some safe local variable values. #+begin_src emacs-lisp (use-package git-auto-commit-mode :delight - :ensure t + :straight t :custom (gac-automatically-push-p nil) :config @@ -1419,7 +1419,7 @@ some safe local variable values. #+BEGIN_SRC emacs-lisp (use-package projectile - :ensure t + :straight t :delight '(:eval (concat " " (projectile-project-name))) :init (setq projectile-project-search-path '("~/git/projects/")) @@ -1460,7 +1460,7 @@ brackets containing their path. Sort buffers in project groups using projectile. #+BEGIN_SRC emacs-lisp :tangle no (use-package ibuffer-projectile - :ensure t + :straight t :after (ibuffer projectile) :hook (ibuffer-mode . (lambda () @@ -1472,7 +1472,7 @@ Sort buffers in project groups using projectile. better performance. #+begin_src emacs-lisp (use-package ibuffer-vc - :ensure t + :straight t :custom (ibuffer-formats '((mark modified read-only vc-status-mini " " @@ -1532,7 +1532,7 @@ This is a nice package for easy window focus switching. I prefer it over =windmove=, as it does not interfere with org keybindings. #+begin_src emacs-lisp (use-package window-numbering - :ensure t + :straight t :config (window-numbering-mode 1)) #+end_src *** Winner-mode @@ -1555,7 +1555,7 @@ over =windmove=, as it does not interfere with org keybindings. (use-package epa :custom (epa-pinentry-mode 'loopback)) (use-package pinentry - :ensure t + :straight t :config (pinentry-start) :after epa) #+end_src @@ -1620,7 +1620,7 @@ make sure to compile the tex document with the option ~--synctex=1~. #+BEGIN_SRC emacs-lisp (use-package pdf-tools - :ensure t + :straight t :config (setq pdf-info-epdfinfo-program (concat user-emacs-directory "epdfinfo")) (pdf-tools-install)) @@ -1645,7 +1645,7 @@ would be better to unbind them only when in ~pdf-view-mode~. ** Latex #+begin_src emacs-lisp (use-package auctex - :ensure t) + :straight t) #+end_src =cdlatex= depends on =texmath.el=. The docstring of =cdlatex= says @@ -1653,7 +1653,7 @@ would be better to unbind them only when in ~pdf-view-mode~. does not have it. So =auctex= has to deliver this dependency instead. #+begin_src emacs-lisp (use-package cdlatex - :ensure t + :straight t :custom (cdlatex-env-alist (list '("equation*" "\\begin{equation*}\nAUTOLABEL\n?\n\\end{equation*}" nil) @@ -1666,7 +1666,7 @@ does not have it. So =auctex= has to deliver this dependency instead. needed. #+begin_src emacs-lisp (use-package sotlisp - :ensure t + :straight t :init (add-hook 'emacs-lisp-mode-hook 'speed-of-thought-mode)) #+end_src @@ -1838,7 +1838,7 @@ Switch projects and subprojects from NEXT back to TODO" #+end_src #+BEGIN_SRC emacs-lisp (use-package org-noter - :ensure t + :straight t :bind (:map org-mode-map ("C-c o" . org-noter)) :custom (org-noter-default-notes-file-names '("notes.org")) ) @@ -1850,7 +1850,7 @@ Switch projects and subprojects from NEXT back to TODO" (org-export-with-broken-links 'match) (org-export-backends '(ascii beamer html icalendar latex man md odt org groff koma-letter))) (use-package org-pdftools - :ensure t + :straight t :hook (org-load . org-pdftools-setup-link)) (use-package org-id :custom (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) @@ -1951,7 +1951,7 @@ Switch projects and subprojects from NEXT back to TODO" Here is a list of nice ones: ◉, ○, ►, •. The default ones are ~'("◉" "○" "✸" "✿")~. #+begin_src emacs-lisp (use-package org-bullets - :ensure t + :straight t :custom (org-bullets-bullet-list '("✧")) :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) #+end_src @@ -1978,7 +1978,7 @@ Use imagemagick and standalone class for latex preview. *** org-caldav #+begin_src emacs-lisp (use-package org-caldav - :ensure t + :straight t :custom (org-caldav-url private/calendar-url) (org-caldav-calendar-id private/calendar-id) @@ -2022,7 +2022,7 @@ Use imagemagick and standalone class for latex preview. **** org-clock-convenience #+begin_src emacs-lisp (use-package org-clock-convenience - :ensure t + :straight t :bind (:map org-agenda-mode-map ("" . org-clock-convenience-timestamp-up) ("" . org-clock-convenience-timestamp-down) @@ -2032,7 +2032,7 @@ Use imagemagick and standalone class for latex preview. *** ox-reveal #+BEGIN_SRC emacs-lisp (use-package ox-reveal - :ensure t) + :straight t) (use-package reveal) (setq org-reveal-root (concat "file:///home/fpi/" "reveal.js")) ;;(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/") @@ -2061,7 +2061,7 @@ Set some prettify symbols for org mode. *** org-roam #+begin_src emacs-lisp (use-package org-roam - :ensure t + :straight t :delight :hook (after-init . org-roam-mode) @@ -2077,7 +2077,7 @@ Set some prettify symbols for org mode. **** org-roam-bibtex #+begin_src emacs-lisp :tangle no (use-package org-roam-bibtex - :ensure t + :straight t :hook (org-roam-mode . org-roam-bibtex-mode) :bind (:map org-mode-map (("C-c n a" . orb-note-actions)))) @@ -2092,7 +2092,7 @@ hydra to manage the various =org-edna= properties. I call it in my explanations checkout his config. #+begin_src emacs-lisp (use-package org-edna - :ensure t + :straight t :after org :defer t :config @@ -2376,7 +2376,7 @@ A small function to toggle the encryption state of the current entry. **** org-ref #+begin_src emacs-lisp (use-package org-ref - :ensure t + :straight t :custom (org-ref-bibliography-notes nil) (org-ref-notes-function 'org-ref-notes-function-many-files) @@ -2839,7 +2839,7 @@ files about various topics. =Deft= handles searching and file creation. #+begin_src emacs-lisp (use-package deft - :ensure t + :straight t :custom ((deft-directory "~/git/projects/zettel") (deft-extensions '("org")) (deft-default-extension "org") @@ -2855,7 +2855,7 @@ custom link format. #+begin_src emacs-lisp (use-package zetteldeft - :ensure t + :straight t :bind (:map fpi-map (("d d" . deft) ("d D" . zetteldeft-deft-new-search) ("d R" . deft-refresh) @@ -2883,7 +2883,7 @@ custom link format. To open and hide a shell quickly I use =shell-pop=. #+begin_src emacs-lisp (use-package shell-pop - :ensure t + :straight t :bind (("C-!" . shell-pop)) :custom (shell-pop-shell-type (quote ("eshell" "*eshell*" (lambda nil (eshell)))))) @@ -2914,11 +2914,11 @@ bind a small function to copy a password or a field if called with a prefix to my custom keymap. #+BEGIN_SRC emacs-lisp (use-package pass - :ensure t) + :straight t) #+END_SRC #+begin_src emacs-lisp (use-package password-store - :ensure t + :straight t :commands (password-store-copy password-store-edit password-store-insert) @@ -2947,19 +2947,19 @@ user: root #+BEGIN_SRC emacs-lisp (use-package auth-source-pass - :ensure t + :straight t :config (auth-source-pass-enable)) #+END_SRC ** Ledger Here is a good [[https://www.reddit.com/r/emacs/comments/8x4xtt][reddit thread]] about using ledger #+BEGIN_SRC emacs-lisp (use-package ledger-mode - :ensure t + :straight t :init (setq ledger-clear-whole-transactions 1) :mode "\\.dat\\'" "\\.ledger\\'") ;; (use-package flycheck-ledger -;; :ensure t +;; :straight t ;; :after ledger-mode) #+END_SRC @@ -2970,7 +2970,7 @@ transactions. They are defined in [[file:emacs-private.el.gpg::4][emacs-private. #+BEGIN_SRC emacs-lisp (use-package elfeed - :ensure t + :straight t :init (setq elfeed-db-directory "~/.emacs.d/elfeed") :custom @@ -3028,7 +3028,7 @@ Load elfeed org after adding ~my/elfeed-mark-read~ to first before marking them unread based on their tag. #+BEGIN_SRC emacs-lisp (use-package elfeed-org - :ensure t + :straight t :config (elfeed-org) (setq rmh-elfeed-org-files (list "~/.emacs.d/elfeed.org"))) @@ -3116,9 +3116,9 @@ where it comes from. #+begin_src emacs-lisp (use-package gnuplot - :ensure t) + :straight t) (use-package gnuplot-mode - :ensure t) + :straight t) #+end_src ** HTML renderer =shr= is the /Simple HTML renderer/ library, which Emacs uses to @@ -3150,7 +3150,7 @@ tools. Support for HTML code blocks with proper syntax highlighting. See [[https://github.com/xuchunyang/shr-tag-pre-highlight.el][its GitHub project page]]. #+BEGIN_SRC emacs-lisp (use-package shr-tag-pre-highlight - :ensure t + :straight t :after shr :config (add-to-list 'shr-external-rendering-functions @@ -3191,7 +3191,7 @@ I use =msmtp= to send mail. (use-package mm-decode :config (use-package spice-mode - :ensure t) + :straight t) (defun mm-display-spice-inline (handle) "Show an spice mode text from HANDLE inline." (mm-display-inline-fontify handle 'spice-mode)) @@ -3213,7 +3213,7 @@ searching. - Setup format=flowed #+BEGIN_SRC emacs-lisp (use-package notmuch - :ensure t + :straight t :custom (notmuch-search-oldest-first nil) (notmuch-archive-tags '("-inbox" "-td" "+archived")) @@ -3236,7 +3236,7 @@ message initialization (signature, ...) also have this text property. For now I use this bad code. #+BEGIN_SRC emacs-lisp (use-package messages-are-flowing - :ensure t + :straight t :config (add-hook 'message-mode-hook 'messages-are-flowing-use-and-mark-hard-newlines)) (defun message-insert-signature (&optional force) (interactive) @@ -3304,7 +3304,7 @@ For now I use this bad code. ** BBDB #+begin_src emacs-lisp (use-package bbdb - :ensure t) + :straight t) (bbdb-initialize 'gnus 'message) (bbdb-mua-auto-update-init 'gnus 'message) @@ -3624,7 +3624,7 @@ temporary buffer is created. #+begin_src emacs-lisp :tangle no (use-package undo-propose - :ensure t + :straight t :bind (("C-/" . undo-propose))) #+end_src ** Electric stuff -- cgit v1.2.3 From 71e791e925cb44aac6649023d5c48e8e693e5481 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 14 Jun 2020 14:48:20 +0200 Subject: Remove :defer keywords --- emacs-init.org | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index d8500ce..913e171 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -1367,7 +1367,6 @@ navigate and revert hunks directly from the buffer. Use =g= to open #+begin_src emacs-lisp (use-package diff-hl :straight t - :defer t :bind (:map fpi-map ("g" . hydra-diff-hl/body)) :init (global-diff-hl-mode 1) :config (defhydra hydra-diff-hl (:body-pre (diff-hl-mode 1) @@ -1719,9 +1718,9 @@ Hansen's]] configs. #+begin_src emacs-lisp (use-package org - :ensure org-plus-contrib + ;; :ensure org-plus-contrib + :straight t :delight (org-cdlatex-mode) - :defer t :bind (("C-c c" . org-capture) ("C-c a" . org-agenda) @@ -2094,7 +2093,6 @@ explanations checkout his config. (use-package org-edna :straight t :after org - :defer t :config (org-edna-load) (defun org-edna-finder/link-ids (&rest ids) -- cgit v1.2.3 From 1ccd611b0639238dbd4aab21f28a745f9c6875cd Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 14 Jun 2020 14:48:30 +0200 Subject: Add relevant straight.el documentation excerpts --- emacs-init.org | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 913e171..203a182 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -153,6 +153,50 @@ with other package definition and customization. (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) #+end_src +**** straight.el documentation excerpts +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: +***** General usage +#+begin_quote +- To restore each package to its canonical state (a clean working + directory with the main branch checked out, and the remotes set + correctly), run ~M-x straight-normalize-package~ or ~M-x + straight-normalize-all~. +- To fetch from each package's configured remote, run ~M-x + straight-fetch-package-and-deps~ or ~M-x straight-fetch-all~; to + also fetch from the upstream for forked packages, supply a prefix + argument. +- To merge changes from each package's configured remote, run ~M-x + straight-merge-package-and-deps~ or ~M-x straight-merge-all~; to + also merge from the upstream for forked packages, supply a prefix + argument. +- To push all local changes to each package's configured remote, run + ~M-x straight-push-package~ or ~M-x straight-push-all~. +#+end_quote +***** Freezing package versions +#+begin_quote +To save the currently checked out revisions of all of your packages, +run ~M-x straight-freeze-versions~. The resulting file +(~~/.emacs.d/straight/versions/default.el~), together with your +init-file, perfectly define your package configuration. Keep your +version lockfile checked into version control; when you install your +Emacs configuration on another machine, the versions of packages +specified in your lockfile will automatically be checked out after the +packages are installed. You can manually revert all packages to the +revisions specified in the lockfile by running ~M-x +straight-thaw-versions~. +#+end_quote +***** =use-package= integration +#+begin_src emacs-lisp +(use-package el-patch + :straight (:host github :repo "raxod502/el-patch" + :branch "develop")) +(use-package tex-site + :straight (auctex :host github + :repo "emacsmirror/auctex" + :files (:defaults (:exclude "*.el.in")))) +#+end_src *** Use-package #+begin_src emacs-lisp (straight-use-package 'use-package) -- cgit v1.2.3 From 7436c81b662994312cf3d4078b96337538380e86 Mon Sep 17 00:00:00 2001 From: fpi Date: Mon, 15 Jun 2020 08:11:14 +0200 Subject: Update odd package specifications & reorder loading - To make sure org is loaded with straight any org-crypt stuff is moved back. - load-theme is moved to the end to ensure pdf-tools is loaded beforehand. - Fix various other warnings --- emacs-init.org | 105 ++++++++++++++++++++++++++++++++++----------------------- gnus.org | 2 +- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 203a182..5ecd5b8 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -26,18 +26,18 @@ file, [[elisp:(find-library "org-crypt")][org-crypt]] is a possible solution. Ma private information with the tag =:crypt:= and adding the following to =init.el= works as a basic setup for =org-crypt=. Also make sure to disable ~buffer-auto-save-file-name~ for the files. -#+BEGIN_SRC emacs-lisp -(require 'org) -(require 'org-crypt) -(org-crypt-use-before-save-magic) -(setq org-tags-exclude-from-inheritance (quote ("crypt"))) -(setq org-crypt-key "F1EF502F9E81D81381B1679AF973BBEA6994521B") +#+BEGIN_SRC emacs-lisp :noweb-ref org-crypt :tangle no +(use-package org-crypt + :config (org-crypt-use-before-save-magic) + :custom + (org-tags-exclude-from-inheritance (quote ("crypt"))) + (org-crypt-key "F1EF502F9E81D81381B1679AF973BBEA6994521B")) #+END_SRC I use =.org= configuration files also for my other dotfiles. To ensure they are tangled upon save I use this function. #+NAME: tangle-hook -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (defun fpi/tangle-dotfiles () "If the current file is in '~/.dotfiles' tangle all code blocks." (when (equal (file-name-directory (directory-file-name buffer-file-name)) @@ -54,7 +54,7 @@ saved again. The latter part is not directly supported by =org=. and not inside the source =.org= file. Instead I add an advice to ~org-babel-tangle~. #+NAME: org-crypt-tangle-setup -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp :tangle no (defun save-without-hook () (let ((before-save-hook nil)) (save-buffer))) @@ -153,6 +153,10 @@ with other package definition and customization. (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) #+end_src + +#+BEGIN_SRC emacs-lisp +(setq straight-profiles `((nil . ,(expand-file-name "package-versions.el" "~/git/projects/dotfiles")))) +#+END_SRC **** straight.el documentation excerpts :PROPERTIES: :header-args:emacs-lisp: :tangle no @@ -301,7 +305,12 @@ appreciate light themes more. [[https://gitlab.com/protesilaos/modus-themes][mod theme promising high color contrast. I ended up using the =spacemacs-light= and =spacemacs-dark= themes. #+begin_src emacs-lisp -(package-install 'spacemacs-theme) +(use-package spacemacs-light-theme + :no-require t + :straight (spacemacs-theme)) +(use-package spacemacs-dark-theme + :no-require t + :straight (spacemacs-theme)) #+end_src =Face-remap= is a library for basic face remapping. =Buffer-face-mode= @@ -891,13 +900,13 @@ The above macro can be used like this. #+end_src Advice =load-theme= to also update the colors for =pdf-view-midnight-mode=. -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no :noweb-ref load-theme (defadvice load-theme (after update-pdf-view-midnight-color activate) (setq pdf-view-midnight-colors `(,(face-attribute 'default :foreground) . ,(face-attribute 'default :background)))) #+end_src -Finally load the theme. -#+begin_src emacs-lisp +Finally load the theme. The code is here, but only executed at the end of the initialization after ~pdf-view-midnight-colors~, etc. are defined. +#+begin_src emacs-lisp :tangle no :noweb-ref load-theme (load-theme 'spacemacs-light t) #+end_src *** Scaling the height of the =default= face. @@ -1538,37 +1547,37 @@ better performance. =fit-window-to-buffer= automatically shrinks the current buffer based on the amount of displayed text. #+begin_src emacs-lisp -(use-package window - :custom - (fit-window-to-buffer-horizontally t) - :bind (:map fpi-map ("s" . fit-window-to-buffer))) + (use-package window + :init + <> + :custom + (fit-window-to-buffer-horizontally t) + :bind (:map fpi-map ("s" . fit-window-to-buffer)) + ) #+end_src *** Window rules -#+begin_src emacs-lisp -(use-package window - :init - (setq display-buffer-alist - '( - ("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|Messages\\)\\*" - (display-buffer-in-side-window) - (window-height . 0.16) - (side . top) - (slot . 0) - (window-parameters . ((no-other-window t)))) - (".*\\*Completions.*" - (display-buffer-in-side-window) - (window-height . 0.16) - (side . bottom) - (slot . 0)) - ("\\*Help.*" - (display-buffer-in-side-window) - (window-width . 0.2) - (side . left) - (slot . 0) - (window-parameters . ((no-other-window . t) - (mode-line-format . (" " - mode-line-buffer-identification))))) - ))) +#+begin_src emacs-lisp :noweb-ref window +(setq display-buffer-alist + '(("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|Messages\\)\\*" + (display-buffer-in-side-window) + (window-height . 0.16) + (side . top) + (slot . 0) + (window-parameters . ((no-other-window t)))) + (".*\\*Completions.*" + (display-buffer-in-side-window) + (window-height . 0.16) + (side . bottom) + (slot . 0)) + ("\\*Help.*" + (display-buffer-in-side-window) + (window-width . 0.2) + (side . left) + (slot . 0) + (window-parameters . ((no-other-window . t) + (mode-line-format . (" " + mode-line-buffer-identification))))) + )) #+end_src *** window-numbering This is a nice package for easy window focus switching. I prefer it @@ -1688,6 +1697,7 @@ would be better to unbind them only when in ~pdf-view-mode~. ** Latex #+begin_src emacs-lisp (use-package auctex + :no-require t :straight t) #+end_src @@ -1762,8 +1772,7 @@ Hansen's]] configs. #+begin_src emacs-lisp (use-package org - ;; :ensure org-plus-contrib - :straight t + :straight (org-plus-contrib) :delight (org-cdlatex-mode) :bind (("C-c c" . org-capture) @@ -1846,6 +1855,10 @@ Switch projects and subprojects from NEXT back to TODO" ((and (member (org-get-todo-state) (list "NEXT")) (bh/is-project-p)) "INPROGRESS"))))) + +<> +<> +<> #+end_src #+begin_src emacs-lisp (use-package org-indent @@ -3687,3 +3700,9 @@ temporary buffer is created. (electric-pair-mode 1) (electric-quote-mode -1)) #+end_src +* Wrapping up + +Some stuff that is run after everything else. +#+begin_src emacs-lisp +<> +#+end_src diff --git a/gnus.org b/gnus.org index 7f26fbd..7d6fe19 100644 --- a/gnus.org +++ b/gnus.org @@ -245,7 +245,7 @@ See [[info:gnus#Window Layout][info:gnus#Window Layout]]. ** nnreddit #+begin_src emacs-lisp (use-package nnreddit - :ensure t) + :straight t) (add-to-list 'gnus-secondary-select-methods '(nnreddit "")) #+end_src ** Demon -- cgit v1.2.3 From 691d1247eef78ff1ef2ebc545977464e131e696b Mon Sep 17 00:00:00 2001 From: fpi Date: Mon, 15 Jun 2020 08:13:11 +0200 Subject: Add frozen straight package-versions --- package-versions.el | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 package-versions.el diff --git a/package-versions.el b/package-versions.el new file mode 100644 index 0000000..c3b58b9 --- /dev/null +++ b/package-versions.el @@ -0,0 +1,80 @@ +(("Try" . "8831ded1784df43a2bd56c25ad3d0650cdb9df1d") + ("auctex" . "6abf890a485b2ff734d8f87f38393f9b8f6bbbf6") + ("auth-password-store" . "ff4940c647786914b3cbef69103d96a4ea334111") + ("bbdb" . "45529e315ba861f9df2914f9b88d2f7b991d5595") + ("biblio.el" . "eb9baf1d2bf6a073d24ccb717025baa693e98f3e") + ("cdlatex" . "480387b39f6ddd9cd2a9511ecee064ad8e1dd324") + ("dash.el" . "ea4a4cc7cce7c3b93862a22df8bca8b83052ccbf") + ("deft" . "fca9ea05ef4fdac825e2ad3921baa7042f6b82c8") + ("delight" . "02e73b69708e23053105866a58fe14f75c272dee") + ("diff-hl" . "176f931a9bfc6bc6fc5360c6ed7128ff96b21289") + ("dired-du" . "d6571317673ba44566ba411d26b7af74e3139ff7") + ("dired-hacks" . "f49a8bbf95f70671a74a24f7f4de453b2686be46") + ("dired-sidebar" . "6e569c851418890c21fd37d03a62f85343aa0900") + ("elfeed" . "a2cae98b4f04616c06455b6104d2ca5ff4b86867") + ("elfeed-org" . "77b6bbf222487809813de260447d31c4c59902c9") + ("emacs-async" . "86aef2c38e7d35e8509b7feeee3e989d825eba91") + ("emacs-hide-mode-line" . "88888825b5b27b300683e662fa3be88d954b1cea") + ("emacs-htmlize" . "86f22f211e9230857197c42a9823d3f05381deed") + ("emacs-which-key" . "8b49ae978cceca65967f3544c236f32964ddbed0") + ("emacsmirror-mirror" . "006fbf082e52dd33cb842c9d5fb181de12736142") + ("emacsql" . "a118b6c95af1306f0288a383d274b5dd93efbbda") + ("emacsql-sqlite3" . "1e411fd38a0137553986db209642fe93cae96060") + ("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6") + ("f.el" . "1814209e2ff43cf2e6d38c4cd476218915f550fb") + ("git-auto-commit-mode" . "dd0c2441de0f5ff8c69c8260d9450d0b607e3e55") + ("git-identity.el" . "8471e6f8ef6c502dc999e513b552d6b23974d40d") + ("gnu-elpa-mirror" . "f07e244acca36061cc03c63463246b848748e804") + ("gnuplot" . "f0001c30010b2899e36d7d89046322467e923088") + ("gnuplot-mode" . "601f6392986f0cba332c87678d31ae0d0a496ce7") + ("helm" . "3ff35503a920d8629cf5c9c07647923661f24ba2") + ("helm-bibtex" . "8a0dd9841316793aacddea744d6b8ca4a7857a35") + ("hydra" . "8a9124f80b6919ad5288172b3e9f46c5332763ca") + ("ibuffer-vc" . "1249c1e30cf11badfe032ac3b1058f24ba510ace") + ("key-chord" . "72443e9ff3c4f1c3ccaced3130236801efde3d83") + ("language-detection.el" . "54a6ecf55304fba7d215ef38a4ec96daff2f35a4") + ("ledger-mode" . "f8463744191b4feb9fea54190917663f7ba26102") + ("let-alist" . "ef3c02fa292b6e32769945bbbfb7f2e5ac574b64") + ("magit" . "c9b9afe8b6e92bee763ed1f6843766efaf87094d") + ("magit-gitflow" . "cc41b561ec6eea947fe9a176349fb4f771ed865b") + ("magit-popup" . "b8e886c4f2242d6c58f84d4549af712e86360db1") + ("melpa" . "ee055cc258692a92f727633306adf7df31267479") + ("messages-are-flowing" . "d582a564a63b7b90764ffc5c618bc5300225d0ab") + ("nadvice" . "2dfcf614dc5472fb21e48f93d0ebb4546276377f") + ("notmuch" . "963e363a234f1c8bdf1ae68956f80a2538bee7dc") + ("org" . "a8cc4f72441acd468f400aeb53549735d698f84c") + ("org-bullets" . "767f55feb58b840a5a04eabfc3fbbf0d257c4792") + ("org-caldav" . "8569941a0a5a9393ba51afc8923fd7b77b73fa7a") + ("org-clock-convenience" . "4e522706a90a504c75d377161005f9543575ea02") + ("org-edna" . "8a14af7baadb3e4021d40e2b4ebdcee66dab4783") + ("org-noter" . "9ead81d42dd4dd5074782d239b2efddf9b8b7b3d") + ("org-pdftools" . "8cc15bb8014ed1f047eecc0abd8bf447f86c0505") + ("org-ref" . "9465abc54a296b4b2f745b4bb3a28ec4dad3a0cb") + ("org-reveal" . "84039bb499290926511b04749882ecb5eda45a0c") + ("org-roam" . "87403b330ce713a892e3e35ff4174a8e2727e24d") + ("parsebib" . "3497b6068d78ae15ba1eaf94e4315d18e9ae6b00") + ("pass" . "919d8e3826d556433ab67d4ee21a509d209d1baa") + ("password-store" . "07b169ec32ad6961ed8625a0b932a663abcb01d2") + ("password-store-otp.el" . "04998c8578a060ab4a4e8f46f2ee0aafad4ab4d5") + ("pdf-tools" . "c510442ab89c8a9e9881230eeb364f4663f59e76") + ("peep-dired" . "1d410a4e48db07a942e54d3b83a85c7a7ec0aab3") + ("pinentry" . "cd942f755c38a7ac270ce858bb887ebdd59edd26") + ("pkg-info" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") + ("popup-el" . "9d104d4bbbcb37bbc9d9ce762e74d41174683f86") + ("projectile" . "33bc91e7518fb8cecd89580f16e0ac21799de2c2") + ("s.el" . "43ba8b563bee3426cead0e6d4ddc09398e1a349d") + ("shell-pop-el" . "4b4394037940a890a313d715d203d9ead2d156a6") + ("shr-tag-pre-highlight.el" . "6182f43a36b0f82ba6edcf6e423b5f69a46a814e") + ("spacemacs-theme" . "6c26717c0ec64af08ab3fd81e88ef03003543c5d") + ("speed-of-thought-lisp" . "ed2356a325c7a4a88ec1bd31381c8666e8997e97") + ("spice-mode" . "e5e0644f03f9696f56dd69e2b6979da7f30ed600") + ("straight.el" . "a7f94876b2bf96d2595706270be6630ecc94f0d3") + ("swiper" . "f8b1ab8c0ec331a4f8f6621f9021811075c71332") + ("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9") + ("transient" . "88d935c7cb9f175871c4cfea7eef2c0514d03b06") + ("use-package" . "d2640fec376a8458a669e7526e63e5870d875118") + ("use-package-hydra" . "8cd55a1128fbdf6327bb38a199d206225896d146") + ("window-numbering.el" . "10809b3993a97c7b544240bf5d7ce9b1110a1b89") + ("with-editor" . "48ca9bb49a1a7a37e85606de9d327a14030d4380") + ("zetteldeft" . "19943a39e1c5f53dae6fac107ce3a7d2e4c5f2f8")) +:alpha -- cgit v1.2.3 From 3d3eaf1bda816022f0143c59f7e7be2246c648db Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 20 Jun 2020 19:04:45 +0200 Subject: Add rainbow-mode --- emacs-init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 5ecd5b8..f29d265 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3627,6 +3627,11 @@ End sentences with single spaces. (put 'dired-find-alternate-file 'disabled nil) (put 'narrow-to-region 'disabled nil)) #+end_src +** Rainbow mode +#+begin_src emacs-lisp +(use-package rainbow-mode + :straight t) +#+end_src ** Parentheses #+begin_src emacs-lisp (use-package paren -- cgit v1.2.3 From 1fc514d94b8a96ae89ae36c7018bf9909d886e4c Mon Sep 17 00:00:00 2001 From: fpi Date: Sat, 20 Jun 2020 19:04:52 +0200 Subject: Reorder theme settings & default to modus-operandi --- emacs-init.org | 318 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 302 insertions(+), 16 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index f29d265..45eab89 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -304,7 +304,7 @@ Instead of the above code I set the font directly using appreciate light themes more. [[https://gitlab.com/protesilaos/modus-themes][modus-operandi]] is an interesting light theme promising high color contrast. I ended up using the =spacemacs-light= and =spacemacs-dark= themes. -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no (use-package spacemacs-light-theme :no-require t :straight (spacemacs-theme)) @@ -313,13 +313,26 @@ theme promising high color contrast. I ended up using the :straight (spacemacs-theme)) #+end_src -=Face-remap= is a library for basic face remapping. =Buffer-face-mode= -is enabled when using =variable-pitch-mode= to show the face defined -in =variable-pitch= instead of =default=. #+begin_src emacs-lisp -(use-package face-remap - :delight (buffer-face-mode)) +(defcustom fpi/light-theme 'modus-operandi + "My standard light theme.") +(defcustom fpi/dark-theme 'modus-vivendi + "My standard dark theme.") + +(use-package modus-operandi-theme + :straight t) +(use-package modus-vivendi-theme + :straight t) #+end_src +Load the theme. The code is here, but only executed at the end of the +initialization after ~pdf-view-midnight-colors~, etc. are defined. +#+begin_src emacs-lisp :tangle no :noweb-ref load-theme +(load-theme fpi/light-theme t) +#+end_src +*** Theme customization +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: To do some custom adjustments to it I use the following macro which adds an advice to ~load-theme~. #+begin_src emacs-lisp @@ -898,16 +911,13 @@ The above macro can be used like this. (:background nil :inherit nil)))) #+end_src -Advice =load-theme= to also update the colors for -=pdf-view-midnight-mode=. -#+begin_src emacs-lisp :tangle no :noweb-ref load-theme -(defadvice load-theme (after update-pdf-view-midnight-color activate) - (setq pdf-view-midnight-colors `(,(face-attribute 'default :foreground) . ,(face-attribute 'default :background)))) -#+end_src - -Finally load the theme. The code is here, but only executed at the end of the initialization after ~pdf-view-midnight-colors~, etc. are defined. -#+begin_src emacs-lisp :tangle no :noweb-ref load-theme -(load-theme 'spacemacs-light t) +*** Diminish buffer-face-mode +=Face-remap= is a library for basic face remapping. =Buffer-face-mode= +is enabled when using =variable-pitch-mode= to show the face defined +in =variable-pitch= instead of =default=. +#+begin_src emacs-lisp +(use-package face-remap + :delight (buffer-face-mode)) #+end_src *** Scaling the height of the =default= face. When switching between monitors with different resolution, scaling the @@ -1075,6 +1085,274 @@ Goes backward if ARG is negative; error if CHAR not found." Having used ido, ivy, icicles and helm in the past, I'm trying to settle for something simple and go back to ido. The settings below are for now mostly copied from [[https://gitlab.com/protesilaos/dotemacs/][Protesilaos Stavrou]]. +*** Minibuffer settings +#+begin_src emacs-lisp +(use-package minibuffer + :config + + ;; Super-powerful completion style for out-of-order groups of matches + ;; using a comprehensive set of matching styles. + (use-package orderless + :straight t + :config + (setq orderless-regexp-separator "[/\s_-]+") + (setq orderless-matching-styles + '(orderless-flex + orderless-strict-leading-initialism + orderless-regexp + orderless-prefixes + orderless-literal)) + + (defun prot/orderless-literal-dispatcher (pattern _index _total) + (when (string-suffix-p "=" pattern) + `(orderless-literal . ,(substring pattern 0 -1)))) + + (defun prot/orderless-initialism-dispatcher (pattern _index _total) + (when (string-suffix-p "," pattern) + `(orderless-strict-leading-initialism . ,(substring pattern 0 -1)))) + + (setq orderless-style-dispatchers '(prot/orderless-literal-dispatcher + prot/orderless-initialism-dispatcher)) + :bind (:map minibuffer-local-completion-map + ("SPC" . nil) ; space should never complete + ("?" . nil))) ; valid regexp character + + (setq completion-styles + '(orderless partial-completion)) + (setq completion-category-defaults nil) + (setq completion-cycle-threshold 3) + (setq completion-flex-nospace nil) + (setq completion-pcm-complete-word-inserts-delimiters t) + (setq completion-pcm-word-delimiters "-_./:| ") + (setq completion-show-help t) + (setq completion-ignore-case t) + (setq read-buffer-completion-ignore-case t) + (setq read-file-name-completion-ignore-case t) + (setq completions-format 'vertical) ; *Completions* buffer + (setq enable-recursive-minibuffers t) + (setq read-answer-short t) + (setq resize-mini-windows t) + + (file-name-shadow-mode 1) + (minibuffer-depth-indicate-mode 1) + (minibuffer-electric-default-mode 1) + + (defun prot/focus-minibuffer () + "Focus the active minibuffer. + +Bind this to `completion-list-mode-map' to M-v to easily jump +between the list of candidates present in the \\*Completions\\* +buffer and the minibuffer (because by default M-v switches to the +completions if invoked from inside the minibuffer." + (interactive) + (let ((mini (active-minibuffer-window))) + (when mini + (select-window mini)))) + + (defun prot/focus-minibuffer-or-completions () + "Focus the active minibuffer or the \\*Completions\\*. + +If both the minibuffer and the Completions are present, this +command will first move per invocation to the former, then the +latter, and then continue to switch between the two. + +The continuous switch is essentially the same as running +`prot/focus-minibuffer' and `switch-to-completions' in +succession." + (interactive) + (let* ((mini (active-minibuffer-window)) + ;; This could be hardened a bit, but I am okay with it. + (completions (or (get-buffer-window "*Completions*") + (get-buffer-window "*Embark Live Occur*")))) + (cond ((and mini + (not (minibufferp))) + (select-window mini nil)) + ((and completions + (not (eq (selected-window) + completions))) + (select-window completions nil))))) + + ;; Technically, this is not specific to the minibuffer, but I define + ;; it here so that you can see how it is also used from inside the + ;; "Completions" buffer + (defun prot/describe-symbol-at-point (&optional arg) + "Get help (documentation) for the symbol at point. + +With a prefix argument, switch to the *Help* window. If that is +already focused, switch to the most recently used window +instead." + (interactive "P") + (let ((symbol (symbol-at-point))) + (when symbol + (describe-symbol symbol))) + (when arg + (let ((help (get-buffer-window "*Help*"))) + (when help + (if (not (eq (selected-window) help)) + (select-window help) + (select-window (get-mru-window))))))) + + ;; This will be deprecated in favour of the `embark' package + (defun prot/completions-kill-save-symbol () + "Add symbol-at-point to the kill ring. + +Intended for use in the \\*Completions\\* buffer. Bind this to a +key in `completion-list-mode-map'." + (interactive) + (kill-new (thing-at-point 'symbol))) + + +;;;; DEPRECATED in favour of the `embark' package (see further below), +;;;; which implements the same functionality in a more efficient way. +;; (defun prot/complete-kill-or-insert-candidate (&optional arg) +;; "Place the matching candidate to the top of the `kill-ring'. +;; This will keep the minibuffer session active. +;; +;; With \\[universal-argument] insert the candidate in the most +;; recently used buffer, while keeping focus on the minibuffer. +;; +;; With \\[universal-argument] \\[universal-argument] insert the +;; candidate and immediately exit all recursive editing levels and +;; active minibuffers. +;; +;; Bind this function in `icomplete-minibuffer-map'." +;; (interactive "*P") +;; (let ((candidate (car completion-all-sorted-completions))) +;; (when (and (minibufferp) +;; (or (bound-and-true-p icomplete-mode) +;; (bound-and-true-p live-completions-mode))) ; see next section +;; (cond ((eq arg nil) +;; (kill-new candidate)) +;; ((= (prefix-numeric-value arg) 4) +;; (with-minibuffer-selected-window (insert candidate))) +;; ((= (prefix-numeric-value arg) 16) +;; (with-minibuffer-selected-window (insert candidate)) +;; (top-level)))))) + + ;; Defines, among others, aliases for common actions to Super-KEY. + ;; Normally these should go in individual package declarations, but + ;; their grouping here makes things easier to understand. + :bind (("s-f" . find-file) + ("s-F" . find-file-other-window) + ("s-d" . dired) + ("s-D" . dired-other-window) + ("s-b" . switch-to-buffer) + ("s-B" . switch-to-buffer-other-window) + ("s-h" . prot/describe-symbol-at-point) + ("s-H" . (lambda () + (interactive) + (prot/describe-symbol-at-point '(4)))) + ("s-v" . prot/focus-minibuffer-or-completions) + :map minibuffer-local-completion-map + ("" . minibuffer-force-complete-and-exit) + ("C-j" . exit-minibuffer) + ;;;; DEPRECATED in favour of the `embark' package + ;; ("M-o w" . prot/complete-kill-or-insert-candidate) + ;; ("M-o i" . (lambda () + ;; (interactive) + ;; (prot/complete-kill-or-insert-candidate '(4)))) + ;; ("M-o j" . (lambda () + ;; (interactive) + ;; (prot/complete-kill-or-insert-candidate '(16)))) + :map completion-list-mode-map + ("h" . prot/describe-symbol-at-point) + ("w" . prot/completions-kill-save-symbol) + ("n" . next-line) + ("p" . previous-line) + ("f" . next-completion) + ("b" . previous-completion) + ("M-v" . prot/focus-minibuffer))) +#+end_src +*** Icomplete +#+begin_src emacs-lisp +(use-package icomplete + :demand + :after minibuffer ; Read that section as well + :config + (setq icomplete-delay-completions-threshold 100) + (setq icomplete-max-delay-chars 2) + (setq icomplete-compute-delay 0.2) + (setq icomplete-show-matches-on-no-input t) + (setq icomplete-hide-common-prefix nil) + (setq icomplete-prospects-height 1) + ;; (setq icomplete-separator " · ") + ;; (setq icomplete-separator " │ ") + ;; (setq icomplete-separator " ┆ ") + ;; (setq icomplete-separator " ¦ ") + (setq icomplete-separator (propertize " ┆ " 'face 'shadow)) + (setq icomplete-with-completion-tables t) + (setq icomplete-in-buffer t) + (setq icomplete-tidy-shadowed-file-names nil) + + (fido-mode -1) ; Emacs 27.1 + (icomplete-mode 1) + + (defun prot/icomplete-minibuffer-truncate () + "Truncate minibuffer lines in `icomplete-mode'. + This should only affect the horizontal layout and is meant to + enforce `icomplete-prospects-height' being set to 1. + + Hook it to `icomplete-minibuffer-setup-hook'." + (when (and (minibufferp) + (bound-and-true-p icomplete-mode)) + (setq truncate-lines t))) + + ;; Note that the the syntax for `use-package' hooks is controlled by + ;; the `use-package-hook-name-suffix' variable. The "-hook" suffix is + ;; not an error of mine. + :hook (icomplete-minibuffer-setup-hook . prot/icomplete-minibuffer-truncate) + :bind (:map icomplete-minibuffer-map + ("" . icomplete-force-complete) + ("" . icomplete-force-complete-and-exit) ; exit with completion + ("C-j" . exit-minibuffer) ; force input unconditionally + ("C-n" . icomplete-forward-completions) + ("" . icomplete-forward-completions) + ("" . icomplete-forward-completions) + ("C-p" . icomplete-backward-completions) + ("" . icomplete-backward-completions) + ("" . icomplete-backward-completions) + ;; The following command is from Emacs 27.1 + ("" . icomplete-fido-backward-updir))) +#+end_src +*** Icomplete-vertical +#+begin_src emacs-lisp +(use-package icomplete-vertical + :straight t + :demand + :after (minibuffer icomplete) ; do not forget to check those as well + :config + (setq icomplete-vertical-prospects-height (/ (frame-height) 6)) + (icomplete-vertical-mode -1) + + (defun prot/kill-ring-yank-complete () + "Insert the selected `kill-ring' item directly at point. +When region is active, `delete-region'. + +Sorting of the `kill-ring' is disabled. Items appear as they +normally would when calling `yank' followed by `yank-pop'." + (interactive) + (let ((kills ; do not sort items + (lambda (string pred action) + (if (eq action 'metadata) + '(metadata (display-sort-function . identity) + (cycle-sort-function . identity)) + (complete-with-action + action kill-ring string pred))))) + (icomplete-vertical-do + (:separator 'dotted-line :height (/ (frame-height) 4)) + (when (use-region-p) + (delete-region (region-beginning) (region-end))) + (insert + (completing-read "Yank from kill ring: " kills nil t))))) + + :bind (("s-y" . prot/kill-ring-yank-complete) + :map icomplete-minibuffer-map + ("C-v" . icomplete-vertical-toggle))) +#+end_src +*** Ido +:PROPERTIES: +:header-args:emacs-lisp: :tangle no +:END: #+BEGIN_SRC emacs-lisp (use-package ido :init @@ -1694,6 +1972,13 @@ would be better to unbind them only when in ~pdf-view-mode~. :init (setq pdf-annot-minor-mode-map-prefix "a") :bind (:map pdf-annot-minor-mode-map ("a d" . pdf-annot-delete))) #+END_SRC + +Advice =load-theme= to update the colors for =pdf-view-midnight-mode= +after the theme changes. +#+begin_src emacs-lisp :tangle no :noweb-ref pre-load-theme +(defadvice load-theme (after update-pdf-view-midnight-color activate) + (setq pdf-view-midnight-colors `(,(face-attribute 'default :foreground) . ,(face-attribute 'default :background)))) +#+end_src ** Latex #+begin_src emacs-lisp (use-package auctex @@ -3709,5 +3994,6 @@ temporary buffer is created. Some stuff that is run after everything else. #+begin_src emacs-lisp +<> <> #+end_src -- cgit v1.2.3 From ed55e86c5869304ed0b38aa1d9a98d7bfebaaedc Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 21 Jun 2020 13:05:56 +0200 Subject: Add org-time-budgets & a Day agenda --- emacs-init.org | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 45eab89..8bdc0e1 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2236,7 +2236,10 @@ Switch projects and subprojects from NEXT back to TODO" ;; See emacs.christianbaeuerlein.com/my-org-config.html (org-agenda-block-separator 9472) (org-agenda-custom-commands - `(("n" "Agenda and all TODOs" + `(("d" "Day agenda" + ((agenda "" ((org-agenda-span 'day))) + (org-time-budgets-in-agenda-maybe))) + ("n" "Agenda and all TODOs" ((todo "INPROGRESS" ((org-agenda-overriding-header "Inprogress Tasks"))) (agenda) @@ -2311,6 +2314,15 @@ Use imagemagick and standalone class for latex preview. (use-package org-num :delight) #+end_src +*** Time budgets +Gives an overview of time spent on defined budgets this week. Great to track if you've worked enough hours. To use it add ~(org-time-budgets-in-agenda-maybe)~ after ~(agenda)~ in a custom agenda command. +#+begin_src emacs-lisp +(use-package org-time-budgets + :straight (:host github :repo "fpiper/org-time-budgets" + :branch "develop") + :custom + (org-time-budgets '((:title "Work" :match "+work-nowork" :budget "40:00" :block workweek)))) +#+end_src *** Column view #+begin_src emacs-lisp (setq org-columns-default-format -- cgit v1.2.3 From 5d5561cf0dc41f5b9824d6ed661fe72e3dbc79ff Mon Sep 17 00:00:00 2001 From: fpi Date: Mon, 22 Jun 2020 08:42:43 +0200 Subject: Set compilation to buffer to scroll automatically --- emacs-init.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 8bdc0e1..02da35e 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -3692,6 +3692,8 @@ For now I use this bad code. Fix ansi colors in compile buffers. From [[https://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html][endlessparentheses]]. #+begin_src emacs-lisp (use-package compile + :custom + (compilation-scroll-output t) :config (require 'ansi-color) (defun endless/colorize-compilation () -- cgit v1.2.3 From 6f3e0a0d58e18efc771c4b4422d254395c84ab36 Mon Sep 17 00:00:00 2001 From: fpi Date: Mon, 22 Jun 2020 08:43:38 +0200 Subject: Add support for matlab programming --- emacs-init.org | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs-init.org b/emacs-init.org index 02da35e..8c6d068 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2014,6 +2014,11 @@ area. (use-package eldoc :delight) #+end_src +*** Matlab +#+begin_src emacs-lisp +(use-package matlab-mode + :straight t) +#+end_src ** Org mode Org is the mode you never need to leave, if you do not want to. My org TODO and clocking setup is largely inspired by [[http://doc.rix.si/cce/cce-org.html][Ryan Rix's]] and [[http://doc.norang.ca/org-mode.html][Bernt -- cgit v1.2.3 From b7da0a3c46e0bfd9dd34e91509b15659d5f6f64c Mon Sep 17 00:00:00 2001 From: fpi Date: Mon, 22 Jun 2020 17:05:48 +0200 Subject: Remove non-file buffers from org-refile-targets --- emacs-init.org | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 8c6d068..65f7565 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2041,12 +2041,6 @@ Hansen's]] configs. - Babel languages :: Enable more languages to use in org-babel blocks. - Youtube links :: See [[http://endlessparentheses.com/embedding-youtube-videos-with-org-mode-links.html][this blog post]] for more info. - Ellipsis :: I currently use =" "= and previously used ="⚡⚡⚡"=. -- Refile Targets :: Use the full outline path so I can distinguish - headlines with the same name & disable step-wise completion as I - think from the refile target backwards, not from top-level - downwards. Also include the current file's headings as a refile - targets up to a deep level, all agenda files up to a small level and - all open org files up to an even smaller level. - Drawer for Notes :: Notes go into the =NOTES= drawer. Clocking times should stay separate in the =LOGBOOK= drawer. - Track state changes :: Notes when an entry is switched to done when @@ -2100,10 +2094,6 @@ Hansen's]] configs. ("gmap" . "http://maps.google.com/maps?q=%s") ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1"))) (org-ellipsis " ") - (org-refile-use-outline-path 'file) - (org-refile-targets '((nil :maxlevel . 8) - (org-agenda-files :maxlevel . 3) - (org-buffer-list :maxlevel . 2))) (org-outline-path-complete-in-steps nil) (org-log-state-notes-into-drawer "NOTES") (org-clock-into-drawer "LOGBOOK") @@ -2129,6 +2119,7 @@ Hansen's]] configs. (org-clock-in-switch-to-state 'bh/clock-in-to-inprogress) (org-tags-column 0) (org-image-actual-width '(400)) + <> :config (add-hook 'org-mode-hook 'turn-on-org-cdlatex) (add-to-list 'org-structure-template-alist (cons "f" "figure")) @@ -2319,6 +2310,22 @@ Use imagemagick and standalone class for latex preview. (use-package org-num :delight) #+end_src +*** Refile +Use the full outline path so I can distinguish headlines with the same name & disable step-wise completion as I think from the refile target backwards, not from top-level downwards. Also include the current file's headings as a refile targets up to a deep level, all agenda files up to a small level and all open org files up to an even smaller level. + +As refile only works on file-visiting buffers, we need to filter all other org buffers from ~(org-buffer-list)~. +#+begin_src emacs-lisp +(defun fpi/org-file-buffer-list () + "Return a list of org buffers which visit files." + (seq-filter 'buffer-file-name (org-buffer-list))) +#+end_src + +#+begin_src emacs-lisp :noweb-ref org-custom :tangle no +(org-refile-use-outline-path 'file) +(org-refile-targets '((buffer-file-name :maxlevel . 8) + (org-agenda-files :maxlevel . 3) + (fpi/org-file-buffer-list :maxlevel . 2))) +#+end_src *** Time budgets Gives an overview of time spent on defined budgets this week. Great to track if you've worked enough hours. To use it add ~(org-time-budgets-in-agenda-maybe)~ after ~(agenda)~ in a custom agenda command. #+begin_src emacs-lisp -- cgit v1.2.3 From f4e3ba2e38010feffdf66018a862cb4bc60e75d1 Mon Sep 17 00:00:00 2001 From: fpi Date: Thu, 25 Jun 2020 12:53:28 +0200 Subject: Enable org remote inline images & reorder config --- emacs-init.org | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index 65f7565..a6b15b9 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2051,8 +2051,6 @@ Hansen's]] configs. NEXT to INPROGRESS - Align tags left :: Fixes problems with line breaking on small window width. -- Inline image width :: Resize images to 400px but respect width - specifications in attribute lines. #+begin_src emacs-lisp (use-package org @@ -2118,7 +2116,6 @@ Hansen's]] configs. ("IDLE" :foreground "magenta" :weight bold))) (org-clock-in-switch-to-state 'bh/clock-in-to-inprogress) (org-tags-column 0) - (org-image-actual-width '(400)) <> :config (add-hook 'org-mode-hook 'turn-on-org-cdlatex) @@ -2171,7 +2168,7 @@ Switch projects and subprojects from NEXT back to TODO" (plantuml . t) ;; (hvm . t) (ledger . t))) - :hook (org-babel-after-execute . org-display-inline-images)) + :hook <>) #+end_src #+BEGIN_SRC emacs-lisp (use-package org-noter @@ -2310,6 +2307,20 @@ Use imagemagick and standalone class for latex preview. (use-package org-num :delight) #+end_src +*** Inline images + +Resize inline images to 400px but respect width specifications in attribute lines. +#+begin_src emacs-lisp :noweb-ref org-custom :tangle no +(org-image-actual-width '(400)) +#+end_src +Also display remote images by downloading them. +#+begin_src emacs-lisp :noweb-ref org-custom :tangle no +(org-display-remote-inline-images 'download) +#+end_src + +#+begin_src emacs-lisp :noweb-ref ob-hooks :tangle no +(org-babel-after-execute . org-display-inline-images) +#+end_src *** Refile Use the full outline path so I can distinguish headlines with the same name & disable step-wise completion as I think from the refile target backwards, not from top-level downwards. Also include the current file's headings as a refile targets up to a deep level, all agenda files up to a small level and all open org files up to an even smaller level. -- cgit v1.2.3