From: rush Date: Wed, 24 Jun 2026 16:18:36 +0000 (-0400) Subject: Junk whitespace commit due to changing org-indent X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=6881a7cb214497df236759af3cda5827ccdb7e1d;p=emacsinit.git Junk whitespace commit due to changing org-indent --- diff --git a/config.org b/config.org index 05d8b80..8bd75a4 100644 --- a/config.org +++ b/config.org @@ -100,7 +100,7 @@ Be sure to run =pdf-tools-install= before first run TeX-source-correlate-start-server t) (add-hook 'TeX-after-compilation-finished-functions - #'TeX-revert-document-buffer) + #'TeX-revert-document-buffer) #+END_SRC ** CSV Mode #+BEGIN_SRC emacs-lisp @@ -140,25 +140,25 @@ Make markdown act more like org when I'm forced to use it (sly-connect "localhost" 4004)) (setq inferior-lisp-program "sbcl" - sly-net-coding-system 'utf-8-unix - sly-command-switch-to-existing-lisp 'always) + sly-net-coding-system 'utf-8-unix + sly-command-switch-to-existing-lisp 'always) (let ((core (expand-file-name "~/sbcl.core-for-sly"))) - (when (file-exists-p core) - (setq sly-lisp-implementations (list `(sbcl ("sbcl" "--core" ,core)))))) + (when (file-exists-p core) + (setq sly-lisp-implementations (list `(sbcl ("sbcl" "--core" ,core)))))) (with-eval-after-load 'sly-mrepl - (keymap-set sly-mrepl-mode-map ")" (re/send-on-close-paren #'sly-mrepl-return)) - (keymap-set sly-mrepl-mode-map "]" (re/balance-and-eval-sexp #'sly-mrepl-return)) - (keymap-set sly-mrepl-mode-map "C-c q" #'re/sly-quit-current-lisp)) + (keymap-set sly-mrepl-mode-map ")" (re/send-on-close-paren #'sly-mrepl-return)) + (keymap-set sly-mrepl-mode-map "]" (re/balance-and-eval-sexp #'sly-mrepl-return)) + (keymap-set sly-mrepl-mode-map "C-c q" #'re/sly-quit-current-lisp)) #+END_SRC *** Eldoc settings Sly really doesn't play well with elodc in the minibuffer, so here are some settings to make it better. #+BEGIN_SRC emacs-lisp (add-to-list 'display-buffer-alist - '("^\\*eldoc" display-buffer-in-direction - (direction . 'down) - (window-height . 4))) + '("^\\*eldoc" display-buffer-in-direction + (direction . 'down) + (window-height . 4))) (keymap-global-set "C-c d" #'eldoc) ; force eldoc to show in minibuffer (keymap-global-set "C-c D" #'eldoc-doc-buffer) ; open eldoc buffer when it's getting spammed #+END_SRC @@ -238,39 +238,39 @@ Sly really doesn't play well with elodc in the minibuffer, so here are some sett **** Agenda settings #+BEGIN_SRC emacs-lisp (setq org-agenda-files (append '("~/org/") - (file-expand-wildcards "~/projects/*/") - (file-expand-wildcards "~/.emacs.d/config.org")) + (file-expand-wildcards "~/projects/*/") + (file-expand-wildcards "~/.emacs.d/config.org")) org-refile-targets '((nil :maxlevel . 9) - (org-agenda-files :maxlevel . 9)) + (org-agenda-files :maxlevel . 9)) org-refile-use-outline-path 'file org-refile-allow-creating-parent-nodes 'confirm org-tag-alist '((:startgroup) - ("call" . ?c) - ("net" . ?n) - (:endgroup) - (:startgroup) - ("home" . ?h) - ("office" . ?o) - ("errand" . ?e) - ("vps" . ?v) - (:endgroup)) + ("call" . ?c) + ("net" . ?n) + (:endgroup) + (:startgroup) + ("home" . ?h) + ("office" . ?o) + ("errand" . ?e) + ("vps" . ?v) + (:endgroup)) org-todo-keywords '((sequence "TODO(t)" "WAITING(w@)" "|" "DONE(d)" "BELAYED(b@)" "GIVEN(g@)") - (sequence "MEETING(m)" "|" "MET(M)")) + (sequence "MEETING(m)" "|" "MET(M)")) org-todo-keyword-faces '(("WAITING" :foreground "#e85400" :weight bold) ; alert orange - ("MEETING" :foreground "#315e9a" :weight bold)) ; precaution blue + ("MEETING" :foreground "#315e9a" :weight bold)) ; precaution blue org-agenda-restore-windows-after-quit t org-agenda-start-on-weekday nil org-agenda-span 'day org-deadline-warning-days 30 org-agenda-window-setup 'current-window org-agenda-time-grid '((daily today remove-match) - (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000) - " -----" - "") + (800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000) + " -----" + "") org-agenda-prefix-format '((agenda . " %?-12t% s") - (todo . " ") - (tags . " ") - (search . " ")) + (todo . " ") + (tags . " ") + (search . " ")) org-agenda-scheduled-leaders '("Booked: " "Booked %dd. ago: ") org-agenda-deadline-leaders '("Deadline: " "In %dd.: " "Died %dd. ago: ") org-read-date-prefer-future 'time @@ -290,47 +290,47 @@ Sly really doesn't play well with elodc in the minibuffer, so here are some sett (defvar *re/org-agenda-undertakings* '(tags "CATEGORY=\"undertakings\"" ((org-agenda-skip-function - '(org-agenda-skip-entry-if 'notregexp "^\\* ")) - (org-agenda-overriding-header "UNDERTAKIŊS:")))) + '(org-agenda-skip-entry-if 'notregexp "^\\* ")) + (org-agenda-overriding-header "UNDERTAKIŊS:")))) (defvar *re/org-agenda-waiting* '(todo "WAITING" ((org-agenda-overriding-header "WAITIŊ:")))) (setq org-agenda-custom-commands `(("i" "Inbox" ,@*re/org-agenda-inbox*) - ("n" "Next Actions" ,@*re/org-agenda-todo*) - ("u" "Undertakings" ,@*re/org-agenda-undertakings*) - ("w" "Waiting" ,@*re/org-agenda-waiting*) - ("o" "Overview" (,*re/org-agenda-inbox* - ,,*re/org-agenda-todo* - ,,*re/org-agenda-waiting* - ,,*re/org-agenda-undertakings*)))) + ("n" "Next Actions" ,@*re/org-agenda-todo*) + ("u" "Undertakings" ,@*re/org-agenda-undertakings*) + ("w" "Waiting" ,@*re/org-agenda-waiting*) + ("o" "Overview" (,*re/org-agenda-inbox* + ,,*re/org-agenda-todo* + ,,*re/org-agenda-waiting* + ,,*re/org-agenda-undertakings*)))) #+END_SRC **** Capture Templates #+BEGIN_SRC emacs-lisp (setq org-capture-templates '(("i" "Inbox" entry - (file "inbox.org") - "* %^{Description}\n%U\n%?" - :prepend t) - ("n" "Next Action" entry - (file "next.org") - "* TODO %^{Description}\n%U\n%?" - :prepend t) - ("u" "Undertaking" entry - (file "undertakings.org") - "* %^{Description}\n%U\n%?" - :prepend t) - ("m" "Meeting" entry - (file "meetings.org") - "* MEETING %^{Description}\n%^{Scheduled:}T\n%?" - :prepend t) - ("p" "Phone Call" entry - (file "meetings.org") - "* %^{Description} :call:\n%U\n%?" - :prepend t) - ("t" "Note" entry - (file "notes.org") - "* %^{Description}\n%U\n%?" - :prepend t))) + (file "inbox.org") + "* %^{Description}\n%U\n%?" + :prepend t) + ("n" "Next Action" entry + (file "next.org") + "* TODO %^{Description}\n%U\n%?" + :prepend t) + ("u" "Undertaking" entry + (file "undertakings.org") + "* %^{Description}\n%U\n%?" + :prepend t) + ("m" "Meeting" entry + (file "meetings.org") + "* MEETING %^{Description}\n%^{Scheduled:}T\n%?" + :prepend t) + ("p" "Phone Call" entry + (file "meetings.org") + "* %^{Description} :call:\n%U\n%?" + :prepend t) + ("t" "Note" entry + (file "notes.org") + "* %^{Description}\n%U\n%?" + :prepend t))) #+END_SRC *** IDs #+BEGIN_SRC emacs-lisp @@ -338,15 +338,15 @@ Sly really doesn't play well with elodc in the minibuffer, so here are some sett org-id-method 'ts org-clone-delete-id t org-attach-id-to-path-function-list '(org-attach-id-ts-folder-format - org-attach-id-uuid-folder-format)) + org-attach-id-uuid-folder-format)) (defun re/org-save-all () "Save all `org-agenda-files' without user confirmation." (interactive) (message "Saving all org-agenda-files buffers...") (save-some-buffers t - (lambda () - (when (member (buffer-file-name) org-agenda-files) t))) + (lambda () + (when (member (buffer-file-name) org-agenda-files) t))) (message "Saving all org-agenda-files buffers... done")) (advice-add 'org-refile :after (lambda (&rest _) (re/org-save-all))) @@ -384,42 +384,42 @@ installed." Shows the trash file as a dired buffer #+BEGIN_SRC emacs-lisp (setq trashed-action-confirmer 'y-or-n-p - trashed-use-header-line t - trashed-sort-key '("Date deleted" . t) - trashed-date-format "%Y-%m-%d %H:%M:%S") + trashed-use-header-line t + trashed-sort-key '("Date deleted" . t) + trashed-date-format "%Y-%m-%d %H:%M:%S") #+END_SRC ** Use mu4e on my home pcs #+BEGIN_SRC emacs-lisp (when (eq system-type 'gnu/linux) (with-eval-after-load 'mu4e (setq mail-user-agent 'message-user-agent - message-send-mail-function 'smtpmail-send-it - message-citation-line-format "Quoth %f :\n" - smtpmail-default-smtp-server "mail.earman.xyz" - smtpmail-smtp-server "mail.earman.xyz" - smtpmail-smtp-service 587 - smtpmail-stream-type 'starttls - smtpmail-local-domain "earman.xyz" - smtpmail-queue-mail nil - smtpmail-queue-dir "~/mail/Outbox/cur" - user-mail-address "iv@earman.xyz" - user-full-name "Rush N. Earman IV" - message-signature "Rush Earman IV, PE" - message-kill-buffer-on-exit t - mu4e-get-mail-command "mbsync -a" - mu4e-update-interval (* 10 60) - mu4e-change-filenames-when-moving t - mu4e-use-fancy-chars t - mu4e-attachment-dir "~/downloads" - mu4e-compose-reply-to-address "iv@earman.xyz" - mu4e-maildir "~/mail" - mu4e-drafts-folder "/Drafts" - mu4e-sent-folder "/Sent" - mu4e-trash-folder "/Trash" - mu4e-maildir-shortcuts '((:maildir "/Inbox" :key ?i) - (:maildir "/Sent" :key ?s) - (:maildir "/Trash" :key ?t) - (:maildir "/Drafts" :key ?d))))) + message-send-mail-function 'smtpmail-send-it + message-citation-line-format "Quoth %f :\n" + smtpmail-default-smtp-server "mail.earman.xyz" + smtpmail-smtp-server "mail.earman.xyz" + smtpmail-smtp-service 587 + smtpmail-stream-type 'starttls + smtpmail-local-domain "earman.xyz" + smtpmail-queue-mail nil + smtpmail-queue-dir "~/mail/Outbox/cur" + user-mail-address "iv@earman.xyz" + user-full-name "Rush N. Earman IV" + message-signature "Rush Earman IV, PE" + message-kill-buffer-on-exit t + mu4e-get-mail-command "mbsync -a" + mu4e-update-interval (* 10 60) + mu4e-change-filenames-when-moving t + mu4e-use-fancy-chars t + mu4e-attachment-dir "~/downloads" + mu4e-compose-reply-to-address "iv@earman.xyz" + mu4e-maildir "~/mail" + mu4e-drafts-folder "/Drafts" + mu4e-sent-folder "/Sent" + mu4e-trash-folder "/Trash" + mu4e-maildir-shortcuts '((:maildir "/Inbox" :key ?i) + (:maildir "/Sent" :key ?s) + (:maildir "/Trash" :key ?t) + (:maildir "/Drafts" :key ?d))))) #+END_SRC ** Minions Remove all minor modes from the mode-line, and show /all/ of them in the minor mode menu @@ -493,7 +493,7 @@ Libraries Not from the package manager Return to initial position after. Arg works on `mark-defun'." (interactive "P") (save-excursion (mark-defun arg) - (comment-region (region-beginning) (region-end)))) + (comment-region (region-beginning) (region-end)))) (keymap-global-set "C-M-;" #'re/comment-defun) @@ -523,14 +523,14 @@ I want *TABS*, not spaces, dammit. Globally overwrite the tab key to insert the #+BEGIN_SRC emacs-lisp ;; Tabs (setq-default indent-tabs-mode t - tab-width 8 - backward-delete-char-untabify-method nil) + tab-width 8 + backward-delete-char-untabify-method nil) (advice-add 'indent-to :around - (lambda (orig-fun column &rest args) - (when indent-tabs-mode - (setq column (* tab-width (round column tab-width)))) - (apply orig-fun column args))) + (lambda (orig-fun column &rest args) + (when indent-tabs-mode + (setq column (* tab-width (round column tab-width)))) + (apply orig-fun column args))) (dolist (indent-level '(c-basic-offset cperl-indent-level LaTeX-indent-level)) (defvaralias indent-level 'tab-width)) @@ -545,8 +545,8 @@ I want *TABS*, not spaces, dammit. Globally overwrite the tab key to insert the * Buffer dealiŋ #+BEGIN_SRC emacs-lisp (setq-default indicate-empty-lines t - truncate-lines t - fill-column 78) + truncate-lines t + fill-column 78) (dolist (hook '(text-mode-hook LaTeX-mode-hook)) (add-hook hook #'visual-line-mode)) @@ -631,15 +631,15 @@ If in org-mode, call `org-beginning-of-line' first." (interactive "^") (let ((oldpos (point))) (if (equal major-mode 'org-mode) - (org-beginning-of-line) + (org-beginning-of-line) (progn - (when visual-line-mode (beginning-of-visual-line 1)) - (skip-syntax-forward " " (line-end-position)) - (backward-prefix-chars))) + (when visual-line-mode (beginning-of-visual-line 1)) + (skip-syntax-forward " " (line-end-position)) + (backward-prefix-chars))) (and (= oldpos (point)) - (let ((newpos (point))) - (back-to-indentation) - (and (= newpos (point)) (beginning-of-line)))))) + (let ((newpos (point))) + (back-to-indentation) + (and (= newpos (point)) (beginning-of-line)))))) (keymap-global-set " " #'re/smart-beginning-of-line) (keymap-set visual-line-mode-map "C-a" #'re/smart-beginning-of-line) @@ -651,9 +651,9 @@ If in org-mode, call `org-end-of-line' first." (interactive "^") (let ((oldpos (point))) (if (equal major-mode 'org-mode) - (org-end-of-line) + (org-end-of-line) (when visual-line-mode - (end-of-visual-line 1))) + (end-of-visual-line 1))) (and (= oldpos (point)) (move-end-of-line nil)))) (keymap-global-set " " #'re/smart-end-of-line) @@ -693,7 +693,7 @@ I only care about line numbers when I want to jump, so only show them then (defun re/add-region-to-search-ring () (when (use-region-p) (add-to-history 'search-ring - (buffer-substring (region-beginning) (region-end))) + (buffer-substring (region-beginning) (region-end))) (deactivate-mark))) (defun re/isearch-forward-use-region () @@ -717,8 +717,8 @@ I only care about line numbers when I want to jump, so only show them then Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transient-mark-mode" (interactive "P") (exchange-point-and-mark (if (and transient-mark-mode (not mark-active)) - (not arg) - arg))) + (not arg) + arg))) (keymap-global-set " " #'re/exchange-point-and-mark-maybe-activate) @@ -735,7 +735,7 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien (midnight-mode t) (setq clean-buffer-list-delay-general 1) (dolist (never-re '("\\` \\*tramp/.*\\'" - "\\` \\*eshell.*\\'")) + "\\` \\*eshell.*\\'")) (add-to-list 'clean-buffer-list-kill-never-regexps never-re)) (save-place-mode 1) (recentf-mode 1) @@ -746,44 +746,44 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien "Renames the current buffer and the file it is visiting." (interactive) (let ((name (buffer-name)) - (filename (buffer-file-name))) + (filename (buffer-file-name))) (if (not (and filename (file-exists-p filename))) - (error "Buffer '%s' is not visiting a file!" name) + (error "Buffer '%s' is not visiting a file!" name) (let ((new-name (read-file-name "New name: " filename))) - (if (get-buffer new-name) - (error "A buffer named '%s' already exists!" new-name) - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" - name - (file-name-nondirectory new-name))))))) + (if (get-buffer new-name) + (error "A buffer named '%s' already exists!" new-name) + (rename-file filename new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" + name + (file-name-nondirectory new-name))))))) (keymap-global-set "C-x C-r" #'re/rename-current-buffer-file) (defun re/get-file-modified-time (filepath) (interactive) (format-time-string "%Y-%m-%d-%H%M" - (file-attribute-modification-time (file-attributes filepath)))) + (file-attribute-modification-time (file-attributes filepath)))) (defun re/filename-inject-mod-time (filepath) (interactive) (concat (file-name-sans-extension filepath) - "_" - (re/get-file-modified-time filepath) - (file-name-extension filepath t))) + "_" + (re/get-file-modified-time filepath) + (file-name-extension filepath t))) (defun re/copy-with-mod-time (&optional filepath) (interactive) (let ((filepath (if (eq major-mode 'dired-mode) - (dired-get-filename t) - (when (null filepath) - (read-file-name "File to copy with datestring: " - default-directory - nil - t - nil))))) + (dired-get-filename t) + (when (null filepath) + (read-file-name "File to copy with datestring: " + default-directory + nil + t + nil))))) (copy-file filepath (re/filename-inject-mod-time filepath ) nil t t t))) #+END_SRC * Dired @@ -792,14 +792,14 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien "In dired mode, visit the file at the cursor in the right/below/left/above window." (interactive) (let* ((file-or-dir (dired-get-file-for-visit)) ;; get the file at cursor - (buffer (find-file-noselect file-or-dir))) ;; load the file into a buffer + (buffer (find-file-noselect file-or-dir))) ;; load the file into a buffer (let ((window ;; figure out the window to use - (cond ((get-buffer-window buffer (selected-frame))) - ((window-in-direction 'right)) ;; try window in each direction - ((window-in-direction 'below)) ;; and default to right - ((window-in-direction 'left)) ;; if no window found. - ((window-in-direction 'above)) - (t (split-window-sensibly (selected-window)))))) + (cond ((get-buffer-window buffer (selected-frame))) + ((window-in-direction 'right)) ;; try window in each direction + ((window-in-direction 'below)) ;; and default to right + ((window-in-direction 'left)) ;; if no window found. + ((window-in-direction 'above)) + (t (split-window-sensibly (selected-window)))))) (window--display-buffer buffer window 'window nil) window))) @@ -807,7 +807,7 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien "Open dired in a new frame." (interactive) (re/open-with-new-frame "DIRED" - #'(lambda () (interactive) (dired default-directory)))) + #'(lambda () (interactive) (dired default-directory)))) (keymap-global-set "" #'re/dired-new-frame) @@ -820,18 +820,18 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien "Change sort order of dired dir." (interactive) (let ((smenu '(("name" . "-Ahl") - ("mdate" . "-Ahlt") - ("adate" . "-Ahltu") - ("size" . "-AhlS") - ("dir" . "-Ahl --group-directories-first"))) - ssortBy) + ("mdate" . "-Ahlt") + ("adate" . "-Ahltu") + ("size" . "-AhlS") + ("dir" . "-Ahl --group-directories-first"))) + ssortBy) (setq ssortBy (completing-read "Sort by (default name):" - smenu - nil - t - nil - nil - (caar smenu))) + smenu + nil + t + nil + nil + (caar smenu))) (dired-sort-other (cdr (assoc ssortBy smenu))))) (defun re/open-file-external (file) @@ -839,11 +839,11 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien (interactive) (let ((process-connection-type nil)) (cond ((eq system-type 'windows-nt) - (w32-shell-execute "open" - (replace-regexp-in-string "/" "\\\\" file t t))) - ((eq system-type 'gnu/linux) - (start-process "" nil "xdg-open" file)) - (t (error "Unable to automatically open this file"))))) + (w32-shell-execute "open" + (replace-regexp-in-string "/" "\\\\" file t t))) + ((eq system-type 'gnu/linux) + (start-process "" nil "xdg-open" file)) + (t (error "Unable to automatically open this file"))))) (defun re/dired-open-externally () "Open the file at point in an external program." @@ -862,19 +862,19 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien dired-kill-when-opening-new-dired-buffer t) (add-hook 'dired-mode-hook - (lambda () - (keymap-set dired-mode-map "o" #'re/dired-display-direction) - (keymap-set dired-mode-map "z" #'dired-do-compress-to) - (keymap-set dired-mode-map "c" #'dired-do-chmod) - (keymap-set dired-mode-map "r" #'dired-do-rename) - (keymap-set dired-mode-map "M" #'dired-do-rename) - (keymap-set dired-mode-map "s" #'re/dired-sort) - (keymap-set dired-mode-map "F" #'re/dired-find-marked-files) - (keymap-set dired-mode-map "M-C" #'re/copy-with-mod-time) - (keymap-set dired-mode-map "b" #'re/dired-open-externally) - (keymap-set dired-mode-map "B" #'re/dired-open-marked-externally) - (dired-hide-details-mode t) - (hl-line-mode))) + (lambda () + (keymap-set dired-mode-map "o" #'re/dired-display-direction) + (keymap-set dired-mode-map "z" #'dired-do-compress-to) + (keymap-set dired-mode-map "c" #'dired-do-chmod) + (keymap-set dired-mode-map "r" #'dired-do-rename) + (keymap-set dired-mode-map "M" #'dired-do-rename) + (keymap-set dired-mode-map "s" #'re/dired-sort) + (keymap-set dired-mode-map "F" #'re/dired-find-marked-files) + (keymap-set dired-mode-map "M-C" #'re/copy-with-mod-time) + (keymap-set dired-mode-map "b" #'re/dired-open-externally) + (keymap-set dired-mode-map "B" #'re/dired-open-marked-externally) + (dired-hide-details-mode t) + (hl-line-mode))) #+END_SRC * Bookmarks #+BEGIN_SRC emacs-lisp @@ -891,11 +891,11 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien (setq touch-screen-display-keyboard t) (set-frame-parameter nil 'tool-bar-position 'bottom) (define-key key-translation-map - (kbd "") - (kbd "C-i")) + (kbd "") + (kbd "C-i")) (define-key key-translation-map - (kbd "") - 'event-apply-meta-modifier) + (kbd "") + 'event-apply-meta-modifier) (modifier-bar-mode 1) (tool-bar-mode 1)) (progn @@ -910,32 +910,32 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien mouse-autoselect-window -0.25) (setq-default cursor-type 'hbar - cursor-in-non-selected-windows nil - mode-line-format '("%e" - (:eval (propertize " " - 'face - (when (buffer-modified-p) - 'mode-line-highlight))) - " " - (:eval (if buffer-file-name - (abbreviate-file-name buffer-file-name) - "%b")) - ":%l,%C" - (:eval (propertize "%n " 'face (when (buffer-narrowed-p) - 'mode-line-highlight))) - mode-line-format-right-align - (vc-mode vc-mode) - " " - mode-line-modes - (:eval (number-to-string (line-number-at-pos (point-max)))) - " Lines | %Ib ")) + cursor-in-non-selected-windows nil + mode-line-format '("%e" + (:eval (propertize " " + 'face + (when (buffer-modified-p) + 'mode-line-highlight))) + " " + (:eval (if buffer-file-name + (abbreviate-file-name buffer-file-name) + "%b")) + ":%l,%C" + (:eval (propertize "%n " 'face (when (buffer-narrowed-p) + 'mode-line-highlight))) + mode-line-format-right-align + (vc-mode vc-mode) + " " + mode-line-modes + (:eval (number-to-string (line-number-at-pos (point-max)))) + " Lines | %Ib ")) (setq prettify-symbols-alist '(("lambda" . 955) - ("delta" . 120517) - ("epsilon" . 120518) - ("->" . 8594) - ("<=" . 8804) - (">=" . 8805))) + ("delta" . 120517) + ("epsilon" . 120518) + ("->" . 8594) + ("<=" . 8804) + (">=" . 8805))) (global-prettify-symbols-mode t) #+END_SRC @@ -946,10 +946,10 @@ Must be set after loading any theme show-paren-style 'expression) (setq electric-pair-pairs '((?\" . ?\") - (?\‘ . ?\’) - (?\“ . ?\”) - (?\{ . ?\}) - (?\< . ?\>))) + (?\‘ . ?\’) + (?\“ . ?\”) + (?\{ . ?\}) + (?\< . ?\>))) #+END_SRC * Help #+BEGIN_SRC emacs-lisp @@ -967,10 +967,10 @@ Must be set after loading any theme (interactive) (save-excursion (replace-regexp "^\n+" - "\n" - nil - (point-min) - (point-max)))) + "\n" + nil + (point-min) + (point-max)))) (setq require-final-newline t) (add-hook 'before-save-hook #'re/flush-extra-lines) @@ -982,9 +982,9 @@ Must be set after loading any theme #+BEGIN_SRC emacs-lisp (defconst *alphanumerics* (mapcar #'char-to-string - (append (number-sequence ?a ?z) - (number-sequence ?A ?Z) - (number-sequence ?0 ?9))) + (append (number-sequence ?a ?z) + (number-sequence ?A ?Z) + (number-sequence ?0 ?9))) "List of strings of the upper/lower-case English alphabet, and the single-digit numbers.") (defconst *special-characters* @@ -997,16 +997,16 @@ Must be set after loading any theme "Select a single character at random to be used in a password. If `no-special-chars' is t, use only alpha-numeric characters." (let ((selected-charset (append *alphanumerics* - (when (null no-special-chars) - ,*special-characters*)))) + (when (null no-special-chars) + ,*special-characters*)))) (elt selected-charset (random (length selected-charset))))) (defun pw-get-chars (password-length &optional no-special-chars) "Generate a list of characters as strings to be made into a password. If `no-special-chars' is t, use only alpha-numeric characters." (append (list (pw-get-char no-special-chars)) - (when (> password-length 1) - (pw-get-chars (- password-length 1) no-special-chars)))) + (when (> password-length 1) + (pw-get-chars (- password-length 1) no-special-chars)))) (defun generate-password (password-length &optional no-special-chars) "Combine a list of randomly-selected characters into a single string of length given. @@ -1018,9 +1018,9 @@ calls `pw-get-chars'. If `no-special-chars' is `t', use only alpha-numeric char Negative password-length (or negative arg) sets `no-special-chars' for `generate-password'." (interactive "p") (let ((len (if (or (null password-length) (= 1 (abs password-length))) - 16 - (abs password-length))) - (no-special-p (and (numberp password-length) (< password-length 0)))) + 16 + (abs password-length))) + (no-special-p (and (numberp password-length) (< password-length 0)))) (insert (generate-password len no-special-p)))) #+END_SRC ** Get a password from a pass(1) entry @@ -1032,12 +1032,12 @@ Start from bottom if given a negative line number." (with-temp-buffer (insert-file-contents file-path) (if (< line-number 0) - (progn - (goto-char (point-max)) - (forward-line line-number)) + (progn + (goto-char (point-max)) + (forward-line line-number)) (progn - (goto-char (point-min)) - (forward-line (1- line-number)))) + (goto-char (point-min)) + (forward-line (1- line-number)))) (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) (defun get-password (&optional filename) @@ -1059,39 +1059,39 @@ Generate TOTP tokens, generate the codes, put them on the clipboard. Assumes th (defun totp--hex-decode-string (string) "Hex-decode STRING and return the result as a unibyte string." (apply #'unibyte-string - (seq-map (lambda (s) (hexl-htoi (aref s 0) (aref s 1))) - (seq-partition string 2)))) + (seq-map (lambda (s) (hexl-htoi (aref s 0) (aref s 1))) + (seq-partition string 2)))) (defun totp (string &optional time digits) "Return a TOTP token using the secret hex STRING and current time. TIME is used as counter value instead of current time, if non-nil. DIGITS is the number of pin digits and defaults to 6." (let* ((key-bytes (totp--hex-decode-string (upcase string))) - (counter (truncate (/ (or time (time-to-seconds)) 30))) - (digits (or digits 6)) - (format-string (format "%%0%dd" digits)) - ;; we have to manually split the 64 bit number (u64 not supported in Emacs 27.2) - (counter-bytes (bindat-pack '((:high u32) (:low u32)) - `((:high . ,(ash counter -32)) (:low . ,(logand counter #xffffffff))))) - (mac (gnutls-hash-mac 'SHA1 key-bytes counter-bytes)) - (offset (logand (bindat-get-field (bindat-unpack '((:offset u8)) mac 19) :offset) #xf))) + (counter (truncate (/ (or time (time-to-seconds)) 30))) + (digits (or digits 6)) + (format-string (format "%%0%dd" digits)) + ;; we have to manually split the 64 bit number (u64 not supported in Emacs 27.2) + (counter-bytes (bindat-pack '((:high u32) (:low u32)) + `((:high . ,(ash counter -32)) (:low . ,(logand counter #xffffffff))))) + (mac (gnutls-hash-mac 'SHA1 key-bytes counter-bytes)) + (offset (logand (bindat-get-field (bindat-unpack '((:offset u8)) mac 19) :offset) #xf))) (format format-string - (mod - (logand (bindat-get-field (bindat-unpack '((:totp-pin u32)) mac offset) :totp-pin) - #x7fffffff) - (expt 10 digits))))) + (mod + (logand (bindat-get-field (bindat-unpack '((:totp-pin u32)) mac offset) :totp-pin) + #x7fffffff) + (expt 10 digits))))) (defconst base32-alphabet (let ((tbl (make-char-table nil))) (dolist (mapping '(("A" . 0) ("B" . 1) ("C" . 2) ("D" . 3) - ("E" . 4) ("F" . 5) ("G" . 6) - ("H" . 7) ("I" . 8) ("J" . 9) ("K" . 10) - ("L" . 11) ("M" . 12) ("N" . 13) - ("O" . 14) ("P" . 15) ("Q" . 16) ("R" . 17) - ("S" . 18) ("T" . 19) ("U" . 20) - ("V" . 21) ("W" . 22) ("X" . 23) ("Y" . 24) - ("Z" . 25) ("2" . 26) ("3" . 27) - ("4" . 28) ("5" . 29) ("6" . 30) ("7" . 31))) + ("E" . 4) ("F" . 5) ("G" . 6) + ("H" . 7) ("I" . 8) ("J" . 9) ("K" . 10) + ("L" . 11) ("M" . 12) ("N" . 13) + ("O" . 14) ("P" . 15) ("Q" . 16) ("R" . 17) + ("S" . 18) ("T" . 19) ("U" . 20) + ("V" . 21) ("W" . 22) ("X" . 23) ("Y" . 24) + ("Z" . 25) ("2" . 26) ("3" . 27) + ("4" . 28) ("5" . 29) ("6" . 30) ("7" . 31))) (aset tbl (string-to-char (car mapping)) (cdr mapping))) tbl) "Base-32 mapping table, as defined in RFC 4648.") @@ -1109,19 +1109,19 @@ required for HMAC-TOTP." (setq string (upcase string)) (let ((trimmed-array (append (string-trim-right string "=+") nil))) (format "%X" (seq-reduce - (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char))) - trimmed-array 0)))) + (lambda (acc char) (+ (ash acc 5) (aref base32-alphabet char))) + trimmed-array 0)))) (defun keyfile-string (filename) "Return a string which is the filepath to a `pass(1)' file." (let ((directory "~/.password-store/")) (if (null filename) - (read-file-name "Select a password: " directory nil t nil) + (read-file-name "Select a password: " directory nil t nil) (concat directory - (if (stringp filename) - filename - (symbol-name filename)) - ".gpg")))) + (if (stringp filename) + filename + (symbol-name filename)) + ".gpg")))) (defun get-totp (&optional filename) "Generate a totp code given a file with the secret hex string. @@ -1162,8 +1162,8 @@ Stolen from emacsredux.com." (interactive) (if (active-minibuffer-window) (if (minibufferp) - (minibuffer-keyboard-quit) - (abort-recursive-edit)) + (minibuffer-keyboard-quit) + (abort-recursive-edit)) (keyboard-quit))) (keymap-global-set " " #'re/keyboard-quit) ; Make C-g better @@ -1177,7 +1177,7 @@ Stolen from emacsredux.com." Prompt for url and local dir." (interactive) (let* ((url (read-string "Repository URL: ")) - (dir (read-string "Local Dir: " (file-name-base url)))) + (dir (read-string "Local Dir: " (file-name-base url)))) (vc-git-clone url dir nil))) (keymap-global-set "C-x v C" #'re/vc-clone) @@ -1187,14 +1187,14 @@ Prompt for url and local dir." Remotes as well when arg." (interactive "P") (let ((default-directory (if (boundp 'vc-dir-directory) - vc-dir-directory - default-directory))) + vc-dir-directory + default-directory))) (vc-git-command "*git-branches*" - nil - nil - "branch" - "--verbose" - (when arg "--remotes")) + nil + nil + "branch" + "--verbose" + (when arg "--remotes")) (pop-to-buffer "*git-branches*") (goto-char (point-min)) (special-mode))) @@ -1207,16 +1207,16 @@ Allows separate fetch in addition to pull. Only care about git. With arg, ask for remote, otherwise fetch all." (interactive "P") (let* ((default-directory (if (boundp 'vc-dir-directory) - vc-dir-directory - default-directory))) + vc-dir-directory + default-directory))) (vc-git-command "*vc-fetch*" - nil - nil - "fetch" - (if arg - (read-string "Fetch From: " "origin") - "--all") - "--verbose") + nil + nil + "fetch" + (if arg + (read-string "Fetch From: " "origin") + "--all") + "--verbose") (pop-to-buffer "*vc-fetch*") (goto-char (point-min)) (special-mode))) @@ -1224,10 +1224,10 @@ With arg, ask for remote, otherwise fetch all." (keymap-global-set "C-x v f" #'re/vc-fetch) (add-hook 'vc-dir-mode-hook - (lambda () - (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches) - (keymap-set vc-dir-mode-map "f" #'re/vc-fetch) - (keymap-set vc-dir-mode-map "k" #'vc-revert))) + (lambda () + (keymap-set vc-dir-mode-map "b b" #'re/vc-show-branches) + (keymap-set vc-dir-mode-map "f" #'re/vc-fetch) + (keymap-set vc-dir-mode-map "k" #'vc-revert))) (setq vc-make-backup-files nil vc-handled-backends '(jj Git) @@ -1272,13 +1272,13 @@ With arg, ask for remote, otherwise fetch all." Either delete, move forward, or add as many ')' as needed." (let ((distance (re/sexp-unbalanced-count))) (cond ((re/sexp-need-paren-p) - (if (looking-at ")") - (progn - (forward-char) - (re/balance-sexp)) - (insert-char 41 distance))) - ((re/sexp-drop-paren-p) - (backward-delete-char distance))))) + (if (looking-at ")") + (progn + (forward-char) + (re/balance-sexp)) + (insert-char 41 distance))) + ((re/sexp-drop-paren-p) + (backward-delete-char distance))))) (defmacro re/balance-and-eval-sexp (executor) "Balance the sexp before point, then call `executor'. @@ -1298,35 +1298,35 @@ For a non-repl, use `newline' or similar." (dolist (hook *re/lisp-mode-hooks*) (add-hook hook - (lambda () - (when (bound-and-true-p acme-mouse-mode) (acme-mouse-mode -1)) - (sedit-mouse-mode 1) - (keymap-set lisp-mode-shared-map "C-M-z" #'eval-region) - (keymap-set lisp-mode-shared-map - "C-M-S-q" - #'sedit-auto-prettify-sexp) - (keymap-set lisp-mode-shared-map - "]" - (re/balance-and-eval-sexp #'sedit-auto-prettify-sexp)) - (keymap-set lisp-interaction-mode-map - "]" - (re/balance-and-eval-sexp #'eval-print-last-sexp))))) + (lambda () + (when (bound-and-true-p acme-mouse-mode) (acme-mouse-mode -1)) + (sedit-mouse-mode 1) + (keymap-set lisp-mode-shared-map "C-M-z" #'eval-region) + (keymap-set lisp-mode-shared-map + "C-M-S-q" + #'sedit-auto-prettify-sexp) + (keymap-set lisp-mode-shared-map + "]" + (re/balance-and-eval-sexp #'sedit-auto-prettify-sexp)) + (keymap-set lisp-interaction-mode-map + "]" + (re/balance-and-eval-sexp #'eval-print-last-sexp))))) #+END_SRC * IELM Rarely used, but nice to have when I want it. #+BEGIN_SRC emacs-lisp (add-hook 'ielm-mode-hook - (lambda () - (keymap-set inferior-emacs-lisp-mode-map - "C-l" - #'comint-clear-buffer) - (let ((eval-function #'ielm-send-input)) - (keymap-set inferior-emacs-lisp-mode-map - ")" - (re/send-on-close-paren eval-function)) - (keymap-set inferior-emacs-lisp-mode-map - "]" - (re/balance-and-eval-sexp eval-function))))) + (lambda () + (keymap-set inferior-emacs-lisp-mode-map + "C-l" + #'comint-clear-buffer) + (let ((eval-function #'ielm-send-input)) + (keymap-set inferior-emacs-lisp-mode-map + ")" + (re/send-on-close-paren eval-function)) + (keymap-set inferior-emacs-lisp-mode-map + "]" + (re/balance-and-eval-sexp eval-function))))) #+END_SRC * Eshell #+BEGIN_SRC emacs-lisp @@ -1341,15 +1341,15 @@ Stolen from https://depp.brause.cc/dotemacs" (delete-char arg))) (add-hook 'eshell-mode-hook - (lambda () - (keymap-set eshell-mode-map "C-d" #'eshell-quit-or-delete-char) - (let ((eval-function #'eshell-send-input)) - (keymap-set eshell-mode-map - ")" - (re/send-on-close-paren eval-function)) - (keymap-set eshell-mode-map - "]" - (re/balance-and-eval-sexp eval-function))))) + (lambda () + (keymap-set eshell-mode-map "C-d" #'eshell-quit-or-delete-char) + (let ((eval-function #'eshell-send-input)) + (keymap-set eshell-mode-map + ")" + (re/send-on-close-paren eval-function)) + (keymap-set eshell-mode-map + "]" + (re/balance-and-eval-sexp eval-function))))) #+END_SRC * C-mode #+BEGIN_SRC emacs-lisp @@ -1360,23 +1360,23 @@ Stolen from https://depp.brause.cc/dotemacs" "Line up argument lists by tabs, not spaces. Stolen from https://kernel.org/doc/html/v4.10/process/coding-style.html" (let* ((anchor (c-langelem-pos c-syntactic-element)) - (column (c-langelem-2nd-pos c-syntactic-element)) - (offset (- (1+ column) anchor)) - (steps (floor offset c-basic-offset))) + (column (c-langelem-2nd-pos c-syntactic-element)) + (offset (- (1+ column) anchor)) + (steps (floor offset c-basic-offset))) (* (max steps 1) c-basic-offset))) (add-hook 'c-mode-common-hook - (lambda () - (c-add-style "linux-tabs-only" - '("linux" (c-offsets-alist - (arglist-cont-nonempty - c-lineup-gcc-asm-reg - re/c-lineup-arglist-tabs-only)))))) + (lambda () + (c-add-style "linux-tabs-only" + '("linux" (c-offsets-alist + (arglist-cont-nonempty + c-lineup-gcc-asm-reg + re/c-lineup-arglist-tabs-only)))))) (add-hook 'c-mode-hook - (lambda () - (setq c-backspace-function 'backward-delete-char) - (c-set-style "linux-tabs-only"))) + (lambda () + (setq c-backspace-function 'backward-delete-char) + (c-set-style "linux-tabs-only"))) #+END_SRC * Auto-Revert #+BEGIN_SRC emacs-lisp