summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2024-04-26 20:46:20 +0100
committerSean Whitton <spwhitton@spwhitton.name>2024-04-26 21:02:53 +0100
commit1a59ac0d21b413529eac376e67a5ce853255497f (patch)
tree1255e7f6b785444e6f74ddca845540e50a91647a
parent6217964ca746ebf68b6caee0ac6ff91d7f425cec (diff)
downloaddotfiles-1a59ac0d21b413529eac376e67a5ce853255497f.tar.gz
use a separate custom-file again
-rw-r--r--.emacs.d/init.el607
1 files changed, 358 insertions, 249 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 2201ed4f..e2c75e37 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -23,11 +23,6 @@
;; matching ~/.emacs.d/*.el, since the "spw-" and "spw--" prefixes would be
;; for a file called "spw.el" with a defined API, providing an `spw' feature.
;;
-;; Prefer using the customise interface for variables, faces and enabling and
-;; disabling global minor modes, except when we want to associate an extended
-;; comment to a number of settings (typically we use the customise interface's
-;; facility for adding comments for only short comments).
-;;
;; Aim for compatibility with the version of Emacs included in Debian stable.
;;
;; Bind only key sequences reserved for users or which are already bound to
@@ -82,21 +77,32 @@
;;;; Customisation & appearance
-(custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
+;; The customisation system is additionally used to save safe local variable
+;; values, SSL certificate overrides etc. (cf. `customize-push-and-save').
+;; Most of these should not be committed to git: they're often host-specific,
+;; usually only relevant for a short time, and sometimes private.
+;; So we use a disposable, local custom file, and `custom-theme-set-faces',
+;; `customize-set-variable' and `custom-theme-set-variables' in this file.
+;; (Re `setopt' vs. `customize-set-variable': former is for when we're making
+;; a dynamic change that is not just host-specific but session-specific.)
+(load (setq custom-file (expand-file-name "custom" user-emacs-directory))
+ 'noerror 'nomessage 'nosuffix)
+
+(custom-theme-set-faces
+ 'user
'(default ((t (:weight medium :height 105 :foundry "SRC" :family "Hack"))))
+ '(fixed-pitch ((t (:foundry "SRC" :family "Hack"))))
+ '(variable-pitch ((t (:weight regular :height 120
+ :foundry "bitstream" :family "Bitstream Charter"))))
+ ;; We want to handle the `variable-pitch'/`variable-pitch-text' distinction
+ ;; using `spw/maybe-scale-basic-faces' instead.
+ '(variable-pitch-text ((t (:inherit variable-pitch))))
+
'(comint-highlight-prompt ((t (:inherit minibuffer-prompt :weight bold))))
'(fill-column-indicator ((t (:background "light gray"))))
- '(fixed-pitch ((t (:foundry "SRC" :family "Hack"))))
- '(org-code ((t (:inherit (shadow fixed-pitch)))))
- '(org-date ((t (:inherit fixed-pitch :foreground "Purple" :underline t))))
- '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))
- '(region ((t (:extend t :background "#EECD82"))) nil "Colour is from the Lucid build.")
- '(variable-pitch ((t (:weight regular :height 120 :foundry "bitstream" :family "Bitstream Charter"))))
- '(variable-pitch-text ((t (:inherit variable-pitch))) nil "Handled by `spw/maybe-scale-basic-faces' instead."))
+
+ ;; The colour is from the Lucid build of Emacs.
+ '(region ((t (:extend t :background "#EECD82")))))
;; Set background colour but don't touch text terminals.
(dolist (ws '(x pgtk w32 ns))
@@ -112,10 +118,10 @@
('nil "honeydew") ("gdbmacs" "linen") (_ "#FFFFF6")))))))
(defun spw/maybe-scale-basic-faces (frame)
- "Entry for `window-size-change-functions' to increase font sizes
-from those set by `custom-set-faces' for frames on wide monitors,
-except where doing so would itself prevent fitting two 80-column
-windows side-by-side in the frame."
+ "Entry for `window-size-change-functions' to increase font sizes,
+relative to those set by the call to `custom-theme-set-faces' above, for
+frames on wide monitors, except where doing so would itself prevent fitting
+two 80-column windows side-by-side in the frame."
(when (display-graphic-p frame)
(let ((wide-monitor-p (> (cadddr (assoc 'geometry
(frame-monitor-attributes frame)))
@@ -167,32 +173,17 @@ windows side-by-side in the frame."
(set-terminal-parameter nil 'background-mode 'light)))
(add-hook 'tty-setup-hook #'spw/set-tmux-background-mode)
-(custom-set-variables
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
+(custom-theme-set-variables
+ 'user
'(Man-notify-method 'aggressive)
'(after-save-hook '(executable-make-buffer-file-executable-if-script-p))
- '(appt-display-diary nil)
- '(appt-display-interval 6)
'(async-shell-command-buffer 'rename-buffer)
'(auth-source-save-behavior nil)
'(auto-save-file-name-transforms '((".*" "~/.emacs.d/auto-saves/" t)))
'(backup-by-copying-when-linked t)
'(backup-directory-alist '(("." . "~/.emacs.d/backups/")))
- '(bongo-default-directory "~/annex/music/")
- '(bongo-insert-album-covers t)
- '(bongo-insert-whole-directory-trees t)
- '(bongo-mode-line-indicator-mode nil)
- '(bongo-prefer-library-buffers nil)
'(c-default-style "linux")
'(calc-kill-line-numbering nil)
- '(calendar-date-display-form
- '((format "%s-%.2d-%.2d %.3s" year (string-to-number month)
- (string-to-number day) dayname)))
- '(calendar-date-style 'iso)
- '(calendar-week-start-day 1)
'(column-number-mode t)
'(comint-prompt-read-only t)
'(compilation-scroll-output 'first-error)
@@ -202,223 +193,60 @@ windows side-by-side in the frame."
'(copy-region-blink-delay 0)
'(copyright-names-regexp "Sean Whitton")
'(copyright-year-ranges t)
- '(cperl-close-paren-offset -4 nil nil "See `cperl-indent-parens-as-block'.")
- '(cperl-indent-level 4)
- '(cperl-indent-parens-as-block t nil nil "Makes it easier to use longer names for subroutines.")
- '(cperl-lineup-step 1)
'(cursor-type 'box)
- '(cycle-spacing-actions '(just-one-space) nil nil "Restore Emacs 28 behaviour of M-SPC.")
+
+ ;; Restore Emacs 28 behaviour of M-SPC.
+ '(cycle-spacing-actions '(just-one-space))
+
'(dabbrev-case-fold-search t)
- '(diary-file "~/doc/emacs-diary")
- '(diary-list-entries-hook '(diary-include-other-diary-files diary-sort-entries))
- '(diary-mark-entries-hook '(diary-mark-included-diary-files))
- '(dired-clean-up-buffers-too nil)
- '(dired-dwim-target t)
- '(dired-free-space 'separate)
- '(dired-isearch-filenames t)
- '(dired-listing-switches "--group-directories-first -alh")
- '(dired-omit-files "\\`[.]?#\\|\\`[.][.]?\\'\\|\\`\\.git\\'")
- '(dired-recursive-copies 'always)
'(display-fill-column-indicator-character 32)
'(ediff-split-window-function 'split-window-horizontally)
'(eldoc-minor-mode-string nil)
'(emacs-lisp-docstring-fill-column 75)
'(enable-recursive-minibuffers t)
- '(eshell-cmpl-cycle-completions nil nil nil "This makes Eshell completions a bit more like bash's.")
- '(eshell-cmpl-ignore-case t)
- '(eshell-hist-ignoredups 'erase)
- '(eshell-history-append t)
- '(eshell-history-size 5000)
- '(eshell-save-history-on-exit nil)
- '(eshell-visual-commands
- '("vi" "screen" "tmux" "top" "htop" "less" "more" "mutt" "locmaint" "gen-DSA"
- "gen-DLA" "gen-ELA"))
'(fill-column 78)
- '(font-lock-maximum-decoration '((lisp-mode . 1) (consfigurator-lisp-mode . 1) (t . t)))
+ '(font-lock-maximum-decoration
+ '((lisp-mode . 1) (consfigurator-lisp-mode . 1) (t . t)))
'(gc-cons-threshold 16777216)
'(gdb-many-windows t)
- '(gdb-show-main t nil nil "This is helpful when gdb-many-windows is turned off.")
- '(git-rebase-confirm-cancel nil)
+
+ ;; This is helpful when gdb-many-windows is turned off.
+ '(gdb-show-main t)
+
'(global-so-long-mode t)
- '(gnus-article-skip-boring t)
- '(gnus-auto-center-summary nil)
- '(gnus-auto-select-next 'slightly-quietly)
- '(gnus-buttonized-mime-types
- '("text/x-\\(?:diff\\|patch\\)" "multipart/\\(?:alternative\\|signed\\)"))
- '(gnus-directory "~/local/News/")
- '(gnus-extra-headers '(To Cc List-Id))
- '(gnus-gcc-mark-as-read t)
- '(gnus-global-score-files '("~/doc/News/"))
- '(gnus-interactive-exit 'quiet)
- '(gnus-kill-files-directory "~/src/athpriv/News/")
- '(gnus-kill-summary-on-exit t nil nil "Would prefer nil but t seems advisable for notmuch groups.")
- '(gnus-large-ephemeral-newsgroup 8000)
- '(gnus-large-newsgroup 8000)
- '(gnus-mark-article-hook '(spw/gnus-mark-article-hook))
- '(gnus-message-archive-group "sent")
- '(gnus-message-archive-method '(nnmaildir "fmail" (directory "~/.fmail/")))
- '(gnus-permanently-visible-groups "^nnmaildir\\+fmail:\\(?:notes\\|sent\\)$")
- '(gnus-read-newsrc-file nil)
- '(gnus-refer-thread-use-search '(("nnmaildir:fmail")))
- '(gnus-save-killed-list
- "^\\(?:[^n]\\|n[^n]\\|nn[^s]\\|nns[^e]\\|nnse[^l]\\|nnsel[^e]\\|nnsele[^c]\\|nnselec[^t]\\|nnselect[^:]\\)")
- '(gnus-save-newsrc-file nil)
- '(gnus-search-default-engines '((nnmaildir . notmuch)))
- '(gnus-search-notmuch-remove-prefix "~/.fmail/")
- '(gnus-secondary-select-methods '((nnmaildir "fmail" (directory "~/.fmail/"))))
- '(gnus-sum-thread-tree-false-root "")
- '(gnus-sum-thread-tree-indent " ")
- '(gnus-sum-thread-tree-leaf-with-other "├► ")
- '(gnus-sum-thread-tree-root "")
- '(gnus-sum-thread-tree-single-leaf "╰► ")
- '(gnus-sum-thread-tree-vertical "│")
- '(gnus-summary-line-format "%U%R%z %(%12&user-date; %*%-23,23f%) %B%s\12")
- '(gnus-summary-mode-line-format "Gnus: %u&summary;%g [%A] %Z")
- '(gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references)
- '(gnus-suppress-duplicates t)
- '(gnus-thread-sort-functions
- '(gnus-thread-sort-by-number gnus-thread-sort-by-total-score))
- '(gnus-topic-display-empty-topics nil)
- '(gnus-update-message-archive-method t)
- '(gnus-user-date-format-alist
- '((32042 . "%2l:%M%#p") (118823 . "Yest %2l:%M%#p") (604800 . "%a %2l:%M%#p")
- (16102447 . "%d %B") (t . "%Y-%b-%d")))
- '(haskell-indentation-layout-offset 4)
- '(haskell-indentation-left-offset 4)
'(help-window-keep-selected t)
- '(holiday-bahai-holidays nil)
- '(holiday-hebrew-holidays nil)
- '(holiday-islamic-holidays nil)
- '(howm-directory "~/doc/howm/")
- '(howm-file-name-format "%Y/%Y-%m-%d-%H%M.org")
- '(howm-keyword-file "~/doc/howm/.howm-keys")
- '(howm-view-use-grep t)
- '(icomplete-hide-common-prefix nil)
- '(icomplete-in-buffer t)
- '(icomplete-mode t)
- '(icomplete-show-matches-on-no-input t)
- '(icomplete-tidy-shadowed-file-names t)
'(imenu-auto-rescan t)
+ '(inferior-lisp-program "sbcl")
'(initial-major-mode 'spw/scratch-lisp-interaction-mode)
'(kill-read-only-ok t)
- '(log-edit-hook
- '(log-edit-insert-message-template log-edit-insert-cvs-template
- log-edit-insert-changelog
- spw/log-edit-show-diff) nil nil "Drop log-edit-show-files to avoid its window becoming most recently used for C-x o.")
- '(mail-envelope-from 'header nil nil "Bypass MTA rewriting user@localhost.")
- '(mail-specify-envelope-from t nil nil "Bypass MTA rewriting user@localhost.")
+
+ ;; Bypass MTA rewriting user@localhost.
+ '(mail-envelope-from 'header)
+ '(mail-specify-envelope-from t)
+
'(mail-user-agent 'gnus-user-agent)
'(mailscripts-detach-head-from-existing-branch 'ask)
'(mailscripts-extract-patches-branch-prefix "mail/")
'(mailscripts-project-library 'project)
- '(major-mode-remap-alist '((perl-mode . cperl-mode)) nil nil "cperl-mode doesn't try to indent lines within a POD, and usefully font locks scalars that are members of hashes and arrays.")
- '(make-pointer-invisible t nil nil "Works only for self-insert chars and undone by changes in window manager focus, but less annoying than `mouse-avoidance-mode'.")
- '(message-auto-save-directory "~/tmp/" nil nil "So locmaint will catch them.")
- '(message-citation-line-format "On %a %d %b %Y at %I:%M%p %Z, %N wrote:\12")
- '(message-citation-line-function 'message-insert-formatted-citation-line)
- '(message-forward-as-mime nil nil nil "For compatibility.")
- '(message-forward-before-signature nil nil nil "For compatibility.")
- '(message-forward-included-headers
- '("^From:" "^Subject:" "^Date:" "^To:" "^Cc:" "^Message-ID:") nil nil "For compatibility.")
- '(message-ignored-resent-headers
- "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:\\|^\\(?:X-\\)?Content-Length:\\|^X-UIDL:\\|^X-TUID:\\|^\\(?:X-\\)?Status:\\|^Lines:")
- '(message-make-forward-subject-function '(message-forward-subject-fwd) nil nil "For compatibility.")
- '(message-sendmail-envelope-from 'header nil nil "Bypass MTA rewriting user@localhost.")
- '(message-wash-forwarded-subjects t)
+
+ ;; `cperl-mode' doesn't try to indent lines within a POD, and usefully font
+ ;; locks scalars that are members of hashes and arrays.
+ '(major-mode-remap-alist '((perl-mode . cperl-mode)))
+
+ ;; Works only for self-insert chars and undone by changes in window manager
+ ;; focus, but less annoying than `mouse-avoidance-mode'.
+ '(make-pointer-invisible t)
+
'(minibuffer-follows-selected-frame nil)
- '(mm-decrypt-option 'known)
- '(mm-default-directory "~/tmp/")
- '(mm-file-name-rewrite-functions
- '(mm-file-name-delete-control mm-file-name-delete-gotchas
- mm-file-name-trim-whitespace
- mm-file-name-collapse-whitespace
- mm-file-name-replace-whitespace))
- '(mml-secure-openpgp-encrypt-to-self t nil nil "So I can read copies in my sent mail directory.")
- '(mml-secure-openpgp-sign-with-sender t)
'(mode-line-compact 'long)
'(mouse-drag-copy-region t nil nil "X primary selection-like behaviour within Emacs even when not available outside.")
'(mouse-highlight 1 nil nil "See `make-pointer-invisible'.")
'(mouse-yank-at-point t)
'(native-comp-async-jobs-number 1)
'(native-comp-async-report-warnings-errors 'silent)
- '(nnmail-extra-headers '(To Cc List-Id))
- '(notmuch-address-use-company nil)
- '(nov-text-width 78)
- '(org-adapt-indentation t nil nil "Sometimes set to nil in .dir-locals.el, e.g. in ~/doc/newpapers.")
- '(org-agenda-entry-text-maxlines 3)
- '(org-agenda-files "~/doc/emacs-org-agenda-files")
- '(org-agenda-persistent-filter t)
- '(org-agenda-remove-times-when-in-prefix 'beg)
- '(org-agenda-restore-windows-after-quit nil nil nil "Interacts badly with `tab-bar-history-mode'.")
- '(org-agenda-skip-deadline-if-done t)
- '(org-agenda-skip-deadline-prewarning-if-scheduled 3)
- '(org-agenda-skip-scheduled-if-deadline-is-shown 'not-today)
- '(org-agenda-skip-scheduled-if-done t)
- '(org-agenda-skip-timestamp-if-done t)
- '(org-agenda-start-on-weekday nil)
- '(org-agenda-sticky t)
- '(org-agenda-timegrid-use-ampm t)
- '(org-agenda-todo-ignore-scheduled 'future)
- '(org-agenda-window-setup 'current-window)
- '(org-archive-location "~/doc/archive/howm/archive.org::* From %s")
- '(org-archive-save-context-info '(time file olpath))
- '(org-archive-subtree-save-file-p t)
- '(org-blank-before-new-entry '((heading . t) (plain-list-item . auto)))
- '(org-bookmark-names-plist nil nil nil "Turn off to avoid git merge conflicts.")
- '(org-cycle-separator-lines 0)
- '(org-deadline-warning-days 60)
- '(org-default-notes-file "~/doc/howm/refile.org")
- '(org-directory "~/doc/howm/")
- '(org-enforce-todo-checkbox-dependencies t)
- '(org-enforce-todo-dependencies t)
- '(org-fold-catch-invisible-edits 'show)
- '(org-fold-show-context-detail
- '((agenda . local) (bookmark-jump . lineage) (isearch . lineage)
- (default . ancestors-full)))
- '(org-footnote-section "Notes")
- '(org-imenu-depth 4)
- '(org-list-allow-alphabetical nil nil nil "So I can start lines with \"P. 211 - \" to refer to p. 211 not start a list.")
- '(org-list-demote-modify-bullet
- '(("-" . "+") ("+" . "*") ("*" . "-") ("1." . "-") ("1)" . "-")))
- '(org-list-use-circular-motion t)
- '(org-log-done 'time)
- '(org-log-into-drawer t)
- '(org-log-repeat nil nil nil "Cluttering, and information probably in git.")
- '(org-log-states-order-reversed nil)
- '(org-outline-path-complete-in-steps nil nil nil "Desirable with `icomplete-mode'.")
- '(org-read-date-prefer-future 'time)
- '(org-refile-allow-creating-parent-nodes 'confirm)
- '(org-refile-targets '((org-agenda-files :maxlevel . 5) (nil :maxlevel . 5)))
- '(org-refile-use-outline-path 'file)
- '(org-special-ctrl-a/e t)
- '(org-special-ctrl-k t)
- '(org-startup-folded nil)
- '(org-startup-indented nil nil nil "Ensures buffer text doesn't go beyond 80 columns.")
- '(org-tags-match-list-sublevels 'indented)
- '(org-todo-keyword-faces
- '(("SOMEDAY" :foreground "#0000FF" :weight bold)
- ("NEXT" :foreground "#DD0000" :weight bold)))
- '(org-todo-keywords
- '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
- (sequence "WAITING(w@)" "SOMEDAY(s)" "|" "CANCELLED(c)")))
- '(org-treat-S-cursor-todo-selection-as-state-change nil)
- '(org-treat-insert-todo-heading-as-state-change t)
- '(org-use-fast-todo-selection 'expert)
- '(org-yank-folded-subtrees nil)
'(proced-enable-color-flag t)
'(proced-show-remote-processes t)
'(project-switch-commands 'project-prefix-or-any-command)
- '(rcirc-default-full-name "Sean Whitton [spwhitton@spwhitton.name]")
- '(rcirc-default-nick "spwhitton")
- '(rcirc-default-user-name "spwhitton")
- '(rcirc-display-server-buffer nil)
- '(rcirc-log-directory "~/local/irclogs")
- '(rcirc-log-filename-function 'spw/rcirc-generate-log-filename)
- '(rcirc-log-flag t)
- '(rcirc-time-format "%b/%d %H:%M ")
- '(rcirc-track-abbreviate-flag nil)
- '(rcirc-track-ignore-server-buffer-flag t)
- '(rcirc-track-minor-mode t)
'(read-buffer-completion-ignore-case t)
'(read-file-name-completion-ignore-case t)
'(read-mail-command 'gnus)
@@ -454,12 +282,11 @@ windows side-by-side in the frame."
'(transient-cycles-window-buffers-mode t)
'(uniquify-buffer-name-style 'forward nil (uniquify))
'(use-short-answers t)
- '(vc-deduce-backend-nonvc-modes t)
- '(vc-find-revision-no-save t)
- '(vc-follow-symlinks t)
- '(vc-git-diff-switches '("--patch-with-stat" "-M" "-C") nil nil "We might also consider -B.")
- '(vc-git-print-log-follow t)
- '(view-read-only t nil nil "Rebind otherwise useless self-insert keys, and means existing C-x C-r, C-x 4 r etc. usable for getting into mode.")
+
+ ;; Rebind otherwise useless self-insert keys, and means existing C-x C-r,
+ ;; C-x 4 r etc. usable for getting into the mode.
+ '(view-read-only t)
+
'(warning-suppress-types '((comp)))
'(window-combination-resize t)
'(x-stretch-cursor t))
@@ -523,6 +350,11 @@ available are present in the `load-path'."
for form = `(add-hook ',hook #',function)
if name collect `(with-eval-after-load ',name ,form) else collect form)))
+(defmacro spw/feature-add-to-list (list-var feature &rest elements)
+ (declare (indent 2))
+ `(with-eval-after-load ',feature
+ ,@(cl-loop for el in elements collect `(add-to-list ',list-var ,el))))
+
(cl-defmacro spw/define-skeleton
(command (mode &key abbrev key (file `',mode)
(map (intern (concat (symbol-name mode) "-map")))
@@ -1188,6 +1020,14 @@ To be used only when it seems to be necessary."
;;; Icomplete
+(custom-theme-set-variables
+ 'user
+ '(icomplete-hide-common-prefix nil)
+ '(icomplete-in-buffer t)
+ '(icomplete-mode t)
+ '(icomplete-show-matches-on-no-input t)
+ '(icomplete-tidy-shadowed-file-names t))
+
;; Possibly we could call `minibuffer-complete-word' if we know we're
;; completing the name of a Lisp symbol.
(spw/reclaim-keys-from minibuffer minibuffer-local-completion-map " " "?")
@@ -1642,6 +1482,21 @@ the non-side windows deleted by `delete-other-windows' will also reappear."
;;;; The Emacs shell
+(custom-theme-set-variables
+ 'user
+ ;; This makes Eshell completions a bit more like bash's.
+ '(eshell-cmpl-cycle-completions nil)
+
+ '(eshell-cmpl-ignore-case t)
+ '(eshell-hist-ignoredups 'erase)
+ '(eshell-history-append t)
+ '(eshell-history-size 5000)
+ '(eshell-save-history-on-exit nil))
+(spw/feature-add-to-list eshell-modules-list esh-module
+ 'eshell-elecslash 'eshell-tramp 'eshell-xtra)
+(spw/feature-add-to-list eshell-visual-commands em-term
+ "locmaint" "gen-DSA" "gen-ELA")
+
(with-eval-after-load 'esh-cmd
(add-hook 'eshell-pre-command-hook
(lambda ()
@@ -1684,11 +1539,6 @@ the non-side windows deleted by `delete-other-windows' will also reappear."
(with-eval-after-load 'esh-mode
(define-key eshell-mode-map "\C-zp" #'spw/eshell-cd-project-root))
-;; Work around Emacs bug #54977.
-(with-eval-after-load 'esh-module
- (mapc (apply-partially #'add-to-list 'eshell-modules-list)
- '(eshell-elecslash eshell-tramp eshell-xtra)))
-
(spw/define-skeleton spw/eshell-libexec
(eshell-mode :abbrev "le" :file "esh-mode")
"" "" "~/" '(eshell-electric-forward-slash) "src/dotfiles/scripts/")
@@ -2877,6 +2727,43 @@ Called by '~/src/dotfiles/bin/emacsclient --spw/update-environment'."
;;;; Composing mail
+(custom-theme-set-variables
+ 'user
+ ;; So locmaint will catch them.
+ '(message-auto-save-directory "~/tmp/")
+
+ '(message-citation-line-format "On %a %d %b %Y at %I:%M%p %Z, %N wrote:\12")
+ '(message-citation-line-function 'message-insert-formatted-citation-line)
+
+ ;; For compatibility.
+ '(message-forward-as-mime nil)
+ '(message-forward-before-signature nil)
+ '(message-forward-included-headers
+ '("^From:" "^Subject:" "^Date:" "^To:" "^Cc:" "^Message-ID:"))
+ '(message-make-forward-subject-function '(message-forward-subject-fwd))
+
+ '(message-ignored-resent-headers
+ "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:\\|^\\(?:X-\\)?Content-Length:\\|^X-UIDL:\\|^X-TUID:\\|^\\(?:X-\\)?Status:\\|^Lines:")
+
+ ;; Bypass MTA rewriting user@localhost.
+ '(message-sendmail-envelope-from 'header)
+
+ '(message-wash-forwarded-subjects t)
+ '(mm-decrypt-option 'known)
+ '(mm-default-directory "~/tmp/")
+ '(mm-file-name-rewrite-functions
+ '(mm-file-name-delete-control mm-file-name-delete-gotchas
+ mm-file-name-trim-whitespace
+ mm-file-name-collapse-whitespace
+ mm-file-name-replace-whitespace))
+
+ ;; So I can read copies in my sent mail directory.
+ '(mml-secure-openpgp-encrypt-to-self t)
+
+ '(mml-secure-openpgp-sign-with-sender t)
+ '(nnmail-extra-headers '(To Cc List-Id))
+ '(notmuch-address-use-company nil))
+
(defvar spw/debian-bts-pseudoheader-regexp
;; "^\\([A-Za-z][a-z]+: [^ ]+\\|[cC]ontrol: .+\\)$"
"^[A-Za-z][a-z]+: [^ ]+"
@@ -3077,6 +2964,16 @@ mutt's review view, after exiting EDITOR."
;;;; Dired
+(custom-theme-set-variables
+ 'user
+ '(dired-clean-up-buffers-too nil)
+ '(dired-dwim-target t)
+ '(dired-free-space 'separate)
+ '(dired-isearch-filenames t)
+ '(dired-listing-switches "--group-directories-first -alh")
+ '(dired-omit-files "\\`[.]?#\\|\\`[.][.]?\\'\\|\\`\\.git\\'")
+ '(dired-recursive-copies 'always))
+
;; this is the way you're meant to request dired-aux, not just dired-x,
;; according to (info "(dired-x) Installation")
(with-eval-after-load 'dired (require 'dired-x))
@@ -3186,6 +3083,59 @@ mutt's review view, after exiting EDITOR."
;;;; Gnus
+(custom-theme-set-variables
+ 'user
+ '(gnus-article-skip-boring t)
+ '(gnus-auto-center-summary nil)
+ '(gnus-auto-select-next 'slightly-quietly)
+ '(gnus-buttonized-mime-types
+ '("text/x-\\(?:diff\\|patch\\)" "multipart/\\(?:alternative\\|signed\\)"))
+ '(gnus-directory "~/local/News/")
+ '(gnus-extra-headers '(To Cc List-Id))
+ '(gnus-gcc-mark-as-read t)
+ '(gnus-global-score-files '("~/doc/News/"))
+ '(gnus-interactive-exit 'quiet)
+ '(gnus-kill-files-directory "~/src/athpriv/News/")
+
+ ;; Would prefer nil but t seems advisable for notmuch groups.
+ '(gnus-kill-summary-on-exit t)
+
+ '(gnus-large-ephemeral-newsgroup 8000)
+ '(gnus-large-newsgroup 8000)
+ '(gnus-mark-article-hook '(spw/gnus-mark-article-hook))
+ '(gnus-message-archive-group "sent")
+ '(gnus-message-archive-method '(nnmaildir "fmail" (directory "~/.fmail/")))
+ '(gnus-permanently-visible-groups "^nnmaildir\\+fmail:\\(?:notes\\|sent\\)$")
+ '(gnus-read-newsrc-file nil)
+ '(gnus-refer-thread-use-search '(("nnmaildir:fmail")))
+ '(gnus-save-killed-list
+ "^\\(?:[^n]\\|n[^n]\\|nn[^s]\\|nns[^e]\\|nnse[^l]\\|nnsel[^e]\\|nnsele[^c]\\|nnselec[^t]\\|nnselect[^:]\\)")
+ '(gnus-save-newsrc-file nil)
+ '(gnus-search-default-engines '((nnmaildir . notmuch)))
+ '(gnus-search-notmuch-remove-prefix "~/.fmail/")
+ '(gnus-secondary-select-methods
+ '((nnmaildir "fmail" (directory "~/.fmail/"))))
+ '(gnus-sum-thread-tree-false-root "")
+ '(gnus-sum-thread-tree-indent " ")
+ '(gnus-sum-thread-tree-leaf-with-other "├► ")
+ '(gnus-sum-thread-tree-root "")
+ '(gnus-sum-thread-tree-single-leaf "╰► ")
+ '(gnus-sum-thread-tree-vertical "│")
+ '(gnus-summary-line-format "%U%R%z %(%12&user-date; %*%-23,23f%) %B%s\12")
+ '(gnus-summary-mode-line-format "Gnus: %u&summary;%g [%A] %Z")
+ '(gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references)
+ '(gnus-suppress-duplicates t)
+ '(gnus-thread-sort-functions
+ '(gnus-thread-sort-by-number gnus-thread-sort-by-total-score))
+ '(gnus-topic-display-empty-topics nil)
+ '(gnus-update-message-archive-method t)
+ '(gnus-user-date-format-alist
+ '((32042 . "%2l:%M%#p")
+ (118823 . "Yest %2l:%M%#p")
+ (604800 . "%a %2l:%M%#p")
+ (16102447 . "%d %B")
+ (t . "%Y-%b-%d"))))
+
(with-eval-after-load 'gnus
(cond ((spw/on-host-p "chiark.greenend.org.uk")
(setq gnus-select-method
@@ -3926,6 +3876,20 @@ unread."
;;;; rcirc
+(custom-theme-set-variables
+ 'user
+ '(rcirc-default-full-name "Sean Whitton [spwhitton@spwhitton.name]")
+ '(rcirc-default-nick "spwhitton")
+ '(rcirc-default-user-name "spwhitton")
+ '(rcirc-display-server-buffer nil)
+ '(rcirc-log-directory "~/local/irclogs")
+ '(rcirc-log-filename-function 'spw/rcirc-generate-log-filename)
+ '(rcirc-log-flag t)
+ '(rcirc-time-format "%b/%d %H:%M ")
+ '(rcirc-track-abbreviate-flag nil)
+ '(rcirc-track-ignore-server-buffer-flag t)
+ '(rcirc-track-minor-mode t))
+
(defun spw/rcirc-generate-log-filename (process target)
(concat (file-name-concat (format-time-string "%Y/%m")
(process-name process) (or target "server"))
@@ -4005,6 +3969,23 @@ unread."
;;;; VC
+(custom-theme-set-variables
+ 'user
+ '(git-rebase-confirm-cancel nil)
+ '(vc-deduce-backend-nonvc-modes t)
+ '(vc-find-revision-no-save t)
+ '(vc-follow-symlinks t)
+
+ ;; We might also consider -B.
+ '(vc-git-diff-switches '("--patch-with-stat" "-M" "-C"))
+
+ '(vc-git-print-log-follow t))
+
+;; Avoid `log-edit-show-files' window becoming most recently used for C-x o.
+(with-eval-after-load 'log-edit
+ (customize-set-variable 'log-edit-hook
+ (delete 'log-edit-show-files log-edit-hook)))
+
(require 'git-commit nil t)
(spw/when-library-available mailscripts
@@ -4017,7 +3998,7 @@ unread."
"vt" notmuch-extract-thread-patches-to-project
"vw" mailscripts-extract-message-patches-to-project))
-;; Emacs 30: move into `custom-set-variables'.
+;; Emacs 30: move into `custom-theme-set-variables' call.
(when (>= emacs-major-version 30)
(setopt vc-git-log-switches '("--format=fuller" "--stat")))
@@ -4322,6 +4303,7 @@ unread."
#'org-d20-d%
#'org-d20-d20)))))
+(customize-set-variable 'nov-text-width 78)
(spw/when-library-available nov
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
@@ -4335,6 +4317,11 @@ unread."
(dolist (hook '(html-mode-hook css-mode-hook))
(add-hook hook 'rainbow-mode)))
+(custom-theme-set-variables
+ 'user
+ '(haskell-indentation-layout-offset 4)
+ '(haskell-indentation-left-offset 4))
+
(spw/feature-add-hook subword-mode haskell-mode)
;; Use a local hook to turn on an appropriate indentation mode. Use
@@ -4355,6 +4342,14 @@ unread."
(spw/feature-add-hook orgtbl-mode message)
+(custom-theme-set-variables
+ 'user
+ '(bongo-default-directory "~/annex/music/")
+ '(bongo-insert-album-covers t)
+ '(bongo-insert-whole-directory-trees t)
+ '(bongo-mode-line-indicator-mode nil)
+ '(bongo-prefer-library-buffers nil))
+
(spw/feature-add-hook (lambda ()
(dired-hide-details-mode
(if bongo-dired-library-mode 1 -1)))
@@ -4466,15 +4461,6 @@ unread."
(with-temp-buffer (call-interactively #'hyperspec-lookup)))
(global-set-key "\C-cgh" #'spw/hyperspec-lookup)
-;; `inf-lisp' says this is a defcustom and `slime' says it is a defvar, so
-;; `custom-save-variables' will print the NOW field in the corresponding
-;; argument to `custom-set-variables' as t or nil depending on whether or not
-;; `inf-lisp' and/or `slime' happen to be loaded, and possibly even depending
-;; on the order in which they were loaded. To prevent spurious changes to the
-;; NOW field randomly showing up in git diffs of init.el, set the variable
-;; without using the customisation interface.
-(setq inferior-lisp-program "sbcl")
-
(defvar spw/last-command-was-slime-async-eval nil)
(defvar spw/last-slime-async-eval-command-frame nil)
@@ -4788,6 +4774,94 @@ before uploading to NEW again." \n \n
;;;; Org-mode
+(custom-theme-set-faces
+ 'user
+ '(org-code ((t (:inherit (shadow fixed-pitch)))))
+ '(org-date ((t (:inherit fixed-pitch :foreground "Purple" :underline t))))
+ '(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
+
+(custom-theme-set-variables
+ 'user
+ ;; Sometimes set to nil in .dir-locals.el, e.g. in ~/doc/newpapers.
+ '(org-adapt-indentation t nil)
+
+ '(org-agenda-entry-text-maxlines 3)
+ '(org-agenda-files "~/doc/emacs-org-agenda-files")
+ '(org-agenda-persistent-filter t)
+ '(org-agenda-remove-times-when-in-prefix 'beg)
+
+ ;; Interacts badly with `tab-bar-history-mode'.
+ '(org-agenda-restore-windows-after-quit nil)
+
+ '(org-agenda-skip-deadline-if-done t)
+ '(org-agenda-skip-deadline-prewarning-if-scheduled 3)
+ '(org-agenda-skip-scheduled-if-deadline-is-shown 'not-today)
+ '(org-agenda-skip-scheduled-if-done t)
+ '(org-agenda-skip-timestamp-if-done t)
+ '(org-agenda-start-on-weekday nil)
+ '(org-agenda-sticky t)
+ '(org-agenda-timegrid-use-ampm t)
+ '(org-agenda-todo-ignore-scheduled 'future)
+ '(org-agenda-window-setup 'current-window)
+ '(org-archive-location "~/doc/archive/howm/archive.org::* From %s")
+ '(org-archive-save-context-info '(time file olpath))
+ '(org-archive-subtree-save-file-p t)
+ '(org-blank-before-new-entry '((heading . t) (plain-list-item . auto)))
+
+ ;; Turn off to avoid git merge conflicts.
+ '(org-bookmark-names-plist nil)
+
+ '(org-cycle-separator-lines 0)
+ '(org-deadline-warning-days 60)
+ '(org-default-notes-file "~/doc/howm/refile.org")
+ '(org-directory "~/doc/howm/")
+ '(org-enforce-todo-checkbox-dependencies t)
+ '(org-enforce-todo-dependencies t)
+ '(org-fold-catch-invisible-edits 'show)
+ '(org-fold-show-context-detail
+ '((agenda . local) (bookmark-jump . lineage) (isearch . lineage)
+ (default . ancestors-full)))
+ '(org-footnote-section "Notes")
+ '(org-imenu-depth 4)
+
+ ;; So I can start lines with \"P. 211 - \" to refer to p. 211, rather than
+ ;; starting a list.
+ '(org-list-allow-alphabetical nil)
+
+ '(org-list-demote-modify-bullet
+ '(("-" . "+") ("+" . "*") ("*" . "-") ("1." . "-") ("1)" . "-")))
+ '(org-list-use-circular-motion t)
+ '(org-log-done 'time)
+ '(org-log-into-drawer t)
+ '(org-log-repeat nil nil nil "Cluttering, and information probably in git.")
+ '(org-log-states-order-reversed nil)
+
+ ;; Desirable with `icomplete-mode'.
+ '(org-outline-path-complete-in-steps nil)
+
+ '(org-read-date-prefer-future 'time)
+ '(org-refile-allow-creating-parent-nodes 'confirm)
+ '(org-refile-targets '((org-agenda-files :maxlevel . 5) (nil :maxlevel . 5)))
+ '(org-refile-use-outline-path 'file)
+ '(org-special-ctrl-a/e t)
+ '(org-special-ctrl-k t)
+ '(org-startup-folded nil)
+
+ ;; Ensures buffer text doesn't go beyond 80 columns.
+ '(org-startup-indented nil)
+
+ '(org-tags-match-list-sublevels 'indented)
+ '(org-todo-keyword-faces
+ '(("SOMEDAY" :foreground "#0000FF" :weight bold)
+ ("NEXT" :foreground "#DD0000" :weight bold)))
+ '(org-todo-keywords
+ '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
+ (sequence "WAITING(w@)" "SOMEDAY(s)" "|" "CANCELLED(c)")))
+ '(org-treat-S-cursor-todo-selection-as-state-change nil)
+ '(org-treat-insert-todo-heading-as-state-change t)
+ '(org-use-fast-todo-selection 'expert)
+ '(org-yank-folded-subtrees nil))
+
(global-set-key "\C-coc" #'org-capture)
(global-set-key "\C-col" #'org-store-link)
(global-set-key "\C-coa" #'org-agenda)
@@ -4989,8 +5063,7 @@ Called by doccheckin script."
;; setting this means if we type C-c C-e o O then the PDF opens for inspection
(setq org-odt-preferred-output-format "pdf")
-(with-eval-after-load 'org
- (add-to-list 'org-file-apps '(system . "xdg-open %s")))
+(spw/feature-add-to-list org-file-apps org '(system . "xdg-open %s"))
;; ... but also ensure we get a .docx (would be better to make
;; `org-odt-preferred-output-format' accept a list)
@@ -5330,6 +5403,23 @@ different occasions."
;;;; Diary
+(custom-theme-set-variables
+ 'user
+ '(appt-display-diary nil)
+ '(appt-display-interval 6)
+ '(calendar-date-display-form
+ '((format "%s-%.2d-%.2d %.3s" year (string-to-number month)
+ (string-to-number day) dayname)))
+ '(calendar-date-style 'iso)
+ '(calendar-week-start-day 1)
+ '(diary-file "~/doc/emacs-diary")
+ '(diary-list-entries-hook
+ '(diary-include-other-diary-files diary-sort-entries))
+ '(diary-mark-entries-hook '(diary-mark-included-diary-files))
+ '(holiday-bahai-holidays nil)
+ '(holiday-hebrew-holidays nil)
+ '(holiday-islamic-holidays nil))
+
;; Don't bind `diary' globally as for viewing purposes we use Org agenda
;; bindings, and for editing purposes just C-x b suffices.
(global-set-key "\C-cC" #'calendar)
@@ -5424,6 +5514,13 @@ We don't use the FILES parameter in the entry for \"d\" in
;;;; Howm
+(custom-theme-set-variables
+ 'user
+ '(howm-directory "~/doc/howm/")
+ '(howm-file-name-format "%Y/%Y-%m-%d-%H%M.org")
+ '(howm-keyword-file "~/doc/howm/.howm-keys")
+ '(howm-view-use-grep t))
+
(setq howm-prefix "\C-cc"
;; Use Org-mode style because our notes are in `org-mode'.
@@ -5521,6 +5618,18 @@ We don't use the FILES parameter in the entry for \"d\" in
;;;; Perl
+(custom-theme-set-variables
+ 'user
+ ;; See `cperl-indent-parens-as-block'.
+ '(cperl-close-paren-offset -4)
+
+ '(cperl-indent-level 4)
+
+ ;; Makes it easier to use longer names for subroutines.
+ '(cperl-indent-parens-as-block t)
+
+ '(cperl-lineup-step 1))
+
(defun spw/perl-add-use (module)
(interactive "suse ")
(let ((line (concat "use " module