]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update Emacs config
authorEshel Yaron <me@eshelyaron.com>
Tue, 11 Apr 2023 07:57:17 +0000 (10:57 +0300)
committerEshel Yaron <me@eshelyaron.com>
Tue, 11 Apr 2023 07:57:17 +0000 (10:57 +0300)
.emacs.d/init.el
.emacs.d/lisp/esy-capture.el

index 8f0e628326ebfe6fb0aff1762054dac71ae20ef5..e30b9cfdcad23922495384df01c8646d9f01e00f 100644 (file)
    org-refile-use-outline-path t
    ;; archive for Org entries
    org-archive-location "~/org/journal.org::datetree/* Finished Tasks   :ARCHIVE:"
+   ;; increase maximum number of recent files Emacs remembers
+   recentf-max-saved-items 128
    ;; enable italic text in code
    modus-themes-italic-constructs t
    ;; enable bold text in code
    eww-auto-rename-buffer 'title
    browse-url-browser-function #'eww-browse-url
    browse-url-generic-program "open"
+   global-auto-revert-non-file-buffers t
+   auto-revert-verbose nil
+   query-about-changed-file t
+   kill-do-not-save-duplicates t
+   show-trailing-whitespace t
+   read-extended-command-predicate #'command-completion-default-include-p
+   completions-format 'one-column
+   completion-auto-select nil
+   completions-detailed nil
+   completion-styles '(orderless partial-completion basic)
+   completion-show-help nil
+   completions-header-format (propertize "%s candidates:\n" 'face 'shadow)
+   completion-auto-help 'visual
+   completions-max-height 16
+   completion-auto-wrap t
+   corfu-cycle t
+   corfu-indexed-start     1
+   shell-kill-buffer-on-exit t
+   ;; allow disabling confirming before compilation via local variables
+   safe-local-variable-values '((compilation-read-command . nil))
+   TeX-view-program-selection '((output-pdf "PDF Tools"))
+   TeX-source-correlate-start-server t
+   xref-show-definitions-function #'consult-xref
+   xref-show-xrefs-function       #'consult-xref
+   xref-search-program             'ripgrep
+   ;; include CWD in shell command prompts
+   shell-command-prompt-show-cwd t
+   sqlformat-command 'pgformatter
+   sql-input-ring-file-name (expand-file-name ".sqli-history" user-emacs-directory)
+   ;; use relative line numbers
+   display-line-numbers-type 'relative
+   ;; persist Git commit message history
+   savehist-additional-variables '(log-edit-comment-ring
+                                   esy/project-name-history)
+   ;; IRC stuff
+   rcirc-default-nick "eshel"
+   rcirc-server-alist '(("irc.libera.chat"
+                         :channels ("#emacs")
+                         :port 6697
+                         :encryption tls))
+   rcirc-log-flag t
+   ;; use my custom project-prompting function
+   project-prompter #'esy/read-project-by-name
+   ;; don't use bold face for unread Elfeed entries
+   elfeed-search-face-alist '((unread (default)))
    ;; set up some feeds for Elfeed
    elfeed-feeds '(
-                  ("https://www.logicmatters.net/feed/" logic blog)
-                  ("https://thejollyteapot.com/feed.rss" tech blog)
-                  ("https://emacs.cafe/feed.xml" emacs)
-                  ("https://impaktor.gitlab.io/index.xml" emacs)
-                  ("https://avdi.codes/feed/" blog tech)
-                  ("https://snarfed.org/feed" tech)
-                  ("https://www.nirandfar.com/rss" tech blog)
-                  ("https://www.joelotter.com/posts/index.xml" indieweb)
-                  ("https://dri.es/rss.xml" indieweb)
-                  ("https://www.thisdaysportion.com/feed/index.xml" indieweb)
-                  ("http://regex.info/blog/feed" tech blog japan)
-                  ("https://eshelyaron.com/rss.xml" me)
-                  ("https://www.brautaset.org/feed.xml" blog tech)
                   ("http://node2.feed43.com/7487052648530856.xml" comics scifi)
+                  ("http://regex.info/blog/feed" tech blog japan)
+                  ("http://sawv.org/rss.xml" tech blog)
+                  ("http://www.aaronsw.com/weblog/index.xml" blog tech)
                   ("https://ajroach42.com/feed.xml")
-                  ("https://writepermission.com/rss.xml" tech blog)
                   ("https://alexschroeder.ch/wiki/feed/full/" tech)
                   ("https://amodernist.com/all.atom" emacs)
                   ("https://archive.casouri.cc/note/atom.xml")
                   ("https://arcology.garden/updates.xml")
-                  ("http://www.aaronsw.com/weblog/index.xml" blog tech)
                   ("https://atthis.link/rss.xml" tech)
-                  ("https://daily.baty.net/feed/feed.xml" blog tech)
+                  ("https://avdi.codes/feed/" blog tech)
                   ("https://baty.net/feed" tech)
                   ("https://betterappsec.com/feed")
                   ("https://bitspook.in/blog/feed.xml")
                   ("https://blog.acthompson.net/feeds/posts/default")
+                  ("https://blog.gregbrockman.com/feed" tech ai)
                   ("https://bruda.ca/feed.php")
+                  ("https://catgirl.ai/log/atom.xml" emacs blog)
                   ("https://cce.whatthefuck.computer/updates.xml")
                   ("https://cdn.jwz.org/blog/feed/" tech)
                   ("https://cestlaz.github.io/rss.xml" tech)
                   ("https://changelog.complete.org/feed")
+                  ("https://daily.baty.net/feed/feed.xml" blog tech)
                   ("https://daniel.haxx.se/blog/feed/" tech)
                   ("https://drewdevault.com/blog/index.xml")
+                  ("https://dri.es/rss.xml" indieweb)
+                  ("https://emacs.cafe/feed.xml" emacs)
                   ("https://emacs.dyerdwelling.family/index.xml")
                   ("https://emacsninja.com/feed.atom" emacs)
                   ("https://erikmcclure.com/blog/index.xml")
+                  ("https://eshelyaron.com/rss.xml" me)
                   ("https://evanhahn.com/blog/index.xml")
                   ("https://fasterthanli.me/index.xml")
                   ("https://feeds.buzzsprout.com/2134279.rss")
                   ("https://garymarcus.substack.com/feed")
                   ("https://gwern.substack.com/feed" tech blog)
                   ("https://herman.bearblog.dev/feed/")
+                  ("https://impaktor.gitlab.io/index.xml" emacs)
                   ("https://irreal.org/blog/?feed=rss2" emacs)
                   ("https://jcm.libsyn.com/rss/")
                   ("https://jnd.org/feed" tech philosophy)
                   ("https://maggieappleton.com/rss.xml" design)
                   ("https://matklad.github.io/feed.xml")
                   ("https://matt-rickard.com/rss" tech)
+                  ("https://mbork.pl?action=rss" emacs blog)
                   ("https://njoseph.me/shaarli/feed/atom?")
                   ("https://nullprogram.com/feed/" tech)
                   ("https://olddeuteronomy.github.io/index.xml")
                   ("https://reddit.com/r/prolog/.rss" prolog)
                   ("https://risky.biz/rss.xml" tech)
                   ("https://sachachua.com/blog/feed/" emacs)
+                  ("https://shivjm.blog/feed.xml" emacs blog)
+                  ("https://snarfed.org/feed" tech)
                   ("https://stephanango.com/feed.xml")
                   ("https://stppodcast.libsyn.com/rss")
                   ("https://takeonrules.com/index.atom")
+                  ("https://thejollyteapot.com/feed.rss" tech blog)
                   ("https://two-wrongs.com/feed")
                   ("https://typeclasses.substack.com/feed")
                   ("https://unixsheikh.com/feed.rss" linux)
-                  ("https://blog.gregbrockman.com/feed" tech ai)
                   ("https://usesthis.com/feed.atom")
+                  ("https://world.hey.com/dhh/feed.atom" tech blog)
+                  ("https://writepermission.com/rss.xml" tech blog)
                   ("https://writer13.neocities.org/rss.xml")
+                  ("https://www.brautaset.org/feed.xml" blog tech)
                   ("https://www.cs.uni.edu/~wallingf/blog/atom.xml")
                   ("https://www.devever.net/~hl/index.feed" tech)
                   ("https://www.draketo.de/rss-feed.xml")
                   ("https://www.evalapply.org/index.xml" emacs)
                   ("https://www.fsf.org/static/fsforg/rss/news.xml" tech)
                   ("https://www.haskellforall.com/feeds/posts/default" tech)
+                  ("https://www.joelotter.com/posts/index.xml" indieweb)
+                  ("https://www.logicmatters.net/feed/" logic blog)
                   ("https://www.murilopereira.com/index.xml")
+                  ("https://www.n16f.net/blog/index.xml" emacs blog)
+                  ("https://www.nirandfar.com/rss" tech blog)
                   ("https://www.stilldrinking.org/rss/feed.xml")
                   ("https://www.theregister.com/headlines.atom" tech)
+                  ("https://www.thisdaysportion.com/feed/index.xml" indieweb)
                   ("https://www.typetheoryforall.com/episodes.mp3.rss" podcast)
+                  ("https://www.unwoundstack.com/rss.xml" emacs blog)
                   ("https://xeiaso.net/blog.rss" tech)
                   ("https://xenodium.com/rss.xml" emacs)
                   ("https://xkcd.com/rss.xml" comics tech)
-                  ("http://sawv.org/rss.xml" tech blog)
-                  )
-   ;; don't use bold face for unread Elfeed entries
-   elfeed-search-face-alist '((unread (default)))
-   global-auto-revert-non-file-buffers t
-   auto-revert-verbose nil
-   query-about-changed-file t
-   kill-do-not-save-duplicates t
-   show-trailing-whitespace t
-   read-extended-command-predicate #'command-completion-default-include-p
-   completions-format 'one-column
-   completion-auto-select nil
-   completions-detailed nil
-   completion-styles '(orderless partial-completion basic)
-   completion-show-help nil
-   completions-header-format (propertize "%s candidates:\n" 'face 'shadow)
-   completion-auto-help 'visual
-   completions-max-height 16
-   completion-auto-wrap t
-   corfu-cycle t
-   corfu-indexed-start     1
-   shell-kill-buffer-on-exit t
-   ;; allow disabling confirming before compilation via local variables
-   safe-local-variable-values '((compilation-read-command . nil))
-   TeX-view-program-selection '((output-pdf "PDF Tools"))
-   TeX-source-correlate-start-server t
-   xref-show-definitions-function #'consult-xref
-   xref-show-xrefs-function       #'consult-xref
-   xref-search-program             'ripgrep
-   sqlformat-command 'pgformatter
-   sql-input-ring-file-name (expand-file-name ".sqli-history" user-emacs-directory)
-   ;; use relative line numbers
-   display-line-numbers-type 'relative
-   ;; persist Git commit message history
-   savehist-additional-variables '(log-edit-comment-ring)
-   ;; IRC stuff
-   rcirc-default-nick "eshel"
-   rcirc-server-alist '(("irc.libera.chat"
-                         :channels ("#emacs")
-                         :port 6697
-                         :encryption tls))
-   rcirc-log-flag t)
+                  ))
   (setq-default indent-tabs-mode nil))
 
 (esy/init-step theme
     (add-to-list 'project-switch-commands '(project-shell "Shell"))
     (when (boundp 'project-prefix-map)
       (define-key project-prefix-map "R" #'rg-project)
-      (define-key project-prefix-map "m" #'magit-project-status))))
+      (define-key project-prefix-map "m" #'magit-project-status))
+
+    (defvar esy/project-name-history nil)
+
+    (defvar esy/projects-directory "~/checkouts/")
+
+    (defun esy/project-names ()
+      "Return an alist of known project names and their root directories."
+      (mapcar (lambda (dir)
+                (cons (project-name (project-current nil dir)) dir))
+              (project-known-project-roots)))
+
+    (defun esy/read-project-by-name ()
+      "Read a known project name and return its root directory."
+      (let* ((name-dir-alist (esy/project-names))
+             (current (project-current))
+             (default (and current (project-name current)))
+             (name (completing-read (format-prompt "Project" default)
+                                    name-dir-alist
+                                    nil nil nil
+                                    'esy/project-name-history
+                                    default)))
+        (or (alist-get name name-dir-alist nil nil #'string=)
+            (let* ((dir (read-directory-name "Project root directory: "
+                                             esy/projects-directory
+                                             nil t name))
+                   (dir-project (project-current nil dir)))
+              (when dir-project
+                (project-remember-project dir-project))
+              dir))))))
 
 (esy/init-step sql
   "Configure SQL connections."
 
   (with-eval-after-load 'org-agenda
     (add-to-list 'org-agenda-custom-commands
-                 '("w" "Work TODOs" tags-todo "+work"))))
+                 '("w" "Work TODOs" tags-todo "+work"))
+    (add-to-list 'org-agenda-custom-commands
+                 '("h" "Holland TODOs" tags-todo "+holland"))))
 
 (esy/init-step email
   "Configure email via `gnus'."
   (dolist (cell '(("Dockerfile"  . dockerfile-ts-mode)
                   ("\\.ya?ml\\'" . yaml-ts-mode)
                   ("\\.json\\'"  . json-ts-mode)
+                  ("\\.ts\\'"    . typescript-ts-mode)
                   ("\\.rb\\'"    . ruby-ts-mode)
                   ("\\.rs\\'"    . rust-ts-mode)
                   ("\\.go\\'"    . go-ts-mode)
index fd61a40bd4cd2b5651eb9eef21da8de58a3ee63f..2259935072b2eb361dc7e1470c43cb33c4196882 100644 (file)
@@ -48,7 +48,7 @@
   (insert "#+TITLE:       " title                      "\n"
           "#+SUBTITLE:    " subtitle                   "\n"
           "#+DESCRIPTION: " description                "\n"
-          "#+KEYWORDS:    " (string-join keywords " ") "\n"
+          "#+KEYWORDS:    " (string-join keywords ",") "\n"
           "#+DATE:        " date                       "\n")
   (set-buffer-modified-p nil))