diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-17 14:29:53 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-17 14:29:53 -0500 |
| commit | bafc6bffbc0356877451409cfb71c580964dc8a3 (patch) | |
| tree | 2f21c823fc3d6f672a592e90e7412d0bdfc605fa /todo.org | |
| parent | dc7a04516b9e9581fa96911d471c9ff71a1b77e9 (diff) | |
updated tasks
Diffstat (limited to 'todo.org')
| -rw-r--r-- | todo.org | 933 |
1 files changed, 928 insertions, 5 deletions
@@ -995,12 +995,7 @@ Don't choose a revision and you'll see a blank buffer that needs to be killed ** TODO [#C] Org Keyword Discolored Until Reapplying Theme :bug: ** TODO [#B] Selecting enter on flac file in dirvish causes error cond: external-open: unsupported host environment -** TODO [#B] m4a files in playlist play in external mplayer not in EMMS -Nothing in Messages buffer - ** TODO [#B] Emacs: EMMS: Fix music info in the modeline -** TODO [#A] Call Pharmacy to activate Adderall refills -SCHEDULED: <2025-10-13 Mon> ** TODO [#B] Fill out Personal Workflow Project Actions - Rename and save any file to project/assets directory - Override archiving a task to a project archive @@ -1422,6 +1417,134 @@ reverso.el is a package of mine that provides Emacs interface for https://revers (reverso-history-mode)) #+end_src * Emacs Config Ideas/References +** Edit Indirect (Custom Code) Bugs and Improvements +*** Bugs (by Severity) + +*** High Severity + +*Race Condition in =edit-indirect--commit=* +The commit function modifies the parent buffer while iterating through hooks that may also modify the buffer. The use of markers helps, but there's still a potential race condition if hooks modify the region being replaced. The =save-match-data= approach with markers could fail if the hooks significantly alter the buffer structure between marker creation and replacement. + +*Potential Data Loss in =edit-indirect--clean-up=* +The function calls =delete-overlay= before setting =edit-indirect--overlay= to nil. If =delete-overlay= signals an error (e.g., if the overlay was already deleted), the overlay reference won't be cleared, potentially causing infinite loops in =edit-indirect--abort-on-kill-buffer=. + +*** Medium Severity + +*Missing Buffer Validation in =edit-indirect--commit=* +The function doesn't check if the parent buffer still exists before attempting to modify it. If the parent buffer was killed while the indirect buffer was being edited, this will cause an error. + +*Hook Execution Order Issue* +The =edit-indirect--rebind-save-hooks= function is added to =after-change-major-mode-hook= globally but never removed. This means it will be called for every buffer that changes major mode, not just edit-indirect buffers, causing unnecessary overhead. + +*** Low Severity + +*Inefficient Overlay Search in =edit-indirect--search-for-edit-indirect=* +The function uses =overlays-in= which returns all overlays, then filters them. For buffers with many overlays, this is inefficient. + +*Missing Error Handling in =edit-indirect--display-buffer=* +The function doesn't handle cases where =display-buffer= returns nil (which can happen if all windows are dedicated or display is inhibited). + +*** Recommended Improvements + +*** Easy Implementation + +*Add Buffer Existence Check* +Add a check in =edit-indirect--commit= to ensure the parent buffer still exists: +#+begin_src emacs-lisp +(unless (buffer-live-p (overlay-buffer edit-indirect--overlay)) + (error "Parent buffer no longer exists")) +#+end_src + +*Improve Hook Management* +Remove the global hook when not needed: +#+begin_src emacs-lisp +(defun edit-indirect--rebind-save-hooks () + (when (edit-indirect-buffer-indirect-p) + (setq buffer-offer-save t) + (add-hook 'write-contents-functions #'edit-indirect--commit-on-save nil t) + ;; Remove global hook after use + (remove-hook 'after-change-major-mode-hook #'edit-indirect--rebind-save-hooks))) +#+end_src + +*Add Safety to Clean-up* +Wrap cleanup operations in condition-case: +#+begin_src emacs-lisp +(defun edit-indirect--clean-up () + (condition-case nil + (delete-overlay edit-indirect--overlay) + (error nil)) + (setq edit-indirect--overlay nil) + ...) +#+end_src + +*Add Display Buffer Error Handling* +Check display-buffer return value: +#+begin_src emacs-lisp +(defun edit-indirect--display-buffer (buffer) + (with-current-buffer buffer + (setq-local edit-indirect--should-quit-window t)) + (let ((window (display-buffer buffer))) + (if window + (select-window window) + (switch-to-buffer buffer))) + nil) +#+end_src + +*** Medium Implementation + +*Optimize Overlay Search* +Use a more efficient search strategy: +#+begin_src emacs-lisp +(defun edit-indirect--search-for-edit-indirect (beg end) + (cl-loop for overlay in (overlays-in beg end) + when (overlay-get overlay 'edit-indirect-buffer) + return overlay)) +#+end_src + +*Add Undo Boundary Management* +Add undo boundaries to make commits atomic: +#+begin_src emacs-lisp +(defun edit-indirect--commit () + (undo-boundary) + ;; ... rest of commit logic ... + (undo-boundary)) +#+end_src + +*Improve Buffer Naming* +Make buffer names more informative: +#+begin_src emacs-lisp +(defun edit-indirect--create-indirect-buffer (beg end overlay) + (let* ((mode-name (symbol-name major-mode)) + (buffer-name (format "*edit-indirect %s [%s]*" + (buffer-name) + (replace-regexp-in-string "-mode$" "" mode-name)))) + ...)) +#+end_src + +*** Hard Implementation + +*Add Support for Nested Indirect Edits* +Allow editing a region within an already indirect buffer by tracking parent chain. + +*Implement Diff Preview* +Add a command to show differences between the indirect buffer and parent region before committing: +#+begin_src emacs-lisp +(defun edit-indirect-diff-preview () + "Show differences between indirect buffer and parent region." + (interactive) + ;; Implementation using diff-mode + ) +#+end_src + +*Add Persistent Session Support* +Save and restore indirect editing sessions across Emacs restarts using desktop.el integration. + +*Implement Conflict Resolution* +Handle cases where the parent buffer was modified while editing in the indirect buffer, similar to version control merge conflicts. + +*Add Support for Multiple Regions* +Allow editing multiple non-contiguous regions in a single indirect buffer, useful for refactoring similar code blocks simultaneously. + ** config.org · master · jdm204 / dotfiles · GitLab #+BEGIN_QUOTE It’s nice for magit to display in-tree TODOs in the status buffer: @@ -4824,3 +4947,803 @@ And that's it! Finally, here's a screenshot showing how it looks like: Screenshot of Magit showing a difftastic diff +** Can I display org-mode attachments as inline images in my document? - Emacs Stack Exchange +[[https://emacs.stackexchange.com/questions/18404/can-i-display-org-mode-attachments-as-inline-images-in-my-document][Can I display org-mode attachments as inline images in my document? - Emacs Stack Exchange]] +Captured On: [2025-10-16 Thu 02:20] +** rougier/relative-date: Emacs package for formatting relative dates (dates difference) +[[https://github.com/rougier/relative-date][rougier/relative-date: Emacs package for formatting relative dates (dates difference)]] +Captured On: [2025-10-17 Fri 14:23] +** rougier/pdf-drop-mode: Get DOI from PDF files dropped onto a Emacs buffer +[[https://github.com/rougier/pdf-drop-mode][rougier/pdf-drop-mode: Get DOI from PDF files dropped onto a Emacs buffer]] +Captured On: [2025-10-17 Fri 14:23] +** rougier/emacs-svg-icon: An emacs library to create SVG icons on the fly +[[https://github.com/rougier/emacs-svg-icon][rougier/emacs-svg-icon: An emacs library to create SVG icons on the fly]] +Captured On: [2025-10-17 Fri 13:44] +** rougier/org-agenda-conflict: Mark conflicting items in the org-agenda +[[https://github.com/rougier/org-agenda-conflict][rougier/org-agenda-conflict: Mark conflicting items in the org-agenda]] +Captured On: [2025-10-17 Fri 13:38] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Holidays +(require 'cal-iso) +(require 'holidays) + +(defvar french-holidays nil + "French holidays") + +(setq french-holidays + `((holiday-fixed 1 1 "New year's Day") + (holiday-fixed 5 1 "Labour Day") + (holiday-fixed 5 8 "Victory in Europe Day") + (holiday-fixed 7 14 "Bastille day") + (holiday-fixed 8 15 "Assumption of Mary") + (holiday-fixed 11 11 "Armistice 1918") + (holiday-fixed 11 1 "All Saints' Day") + (holiday-fixed 12 25 "Christmas Day") + (holiday-easter-etc 0 "Easter Sunday") + (holiday-easter-etc 1 "Easter Monday") + (holiday-easter-etc 39 "Ascension Day") + (holiday-easter-etc 50 "Whit Monday") + (holiday-sexp + '(if (equal + (holiday-easter-etc 49) + (holiday-float 5 0 -1 nil)) + (car (car (holiday-float 6 0 1 nil))) + (car (car (holiday-float 5 0 -1 nil)))) + "Mother's Day"))) + +(setq calendar-holidays french-holidays ; French holidays + calendar-week-start-day 1 ; Week starts on Monday + calendar-mark-diary-entries-flag nil) ; Do not show diary entries + +; Mark today in calendar +(add-hook 'calendar-today-visible-hook #'calendar-mark-today) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:34] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Sorting strategy + +(setq org-agenda-sorting-strategy + '((agenda deadline-down scheduled-down todo-state-up time-up + habit-down priority-down category-keep) + (todo priority-down category-keep) + (tags timestamp-up priority-down category-keep) + (search category-keep))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:33] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Babel +(setq-default org-src-fontify-natively t ; Fontify code in code blocks. + org-adapt-indentation nil ; Adaptive indentation + org-src-tab-acts-natively t ; Tab acts as in source editing + org-confirm-babel-evaluate nil ; No confirmation before executing code + org-edit-src-content-indentation 0 ; No relative indentation for code blocks + org-fontify-whole-block-delimiter-line t) ; Fontify whole block +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:32] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Dashboard +Provide a mu4e-dashboard command that opens the mu4e dashboard on the left side. + +(require 'mu4e-dashboard) +(require 'svg-lib) + +(setq mu4e-dashboard-propagate-keymap nil) + +(defun mu4e-dashboard () + "Open the mu4e dashboard on the left side." + + (interactive) + (with-selected-window + (split-window (selected-window) -34 'left) + + (find-file (expand-file-name "mu4e-dashboard.org" user-emacs-directory)) + (mu4e-dashboard-mode) + (hl-line-mode) + (set-window-dedicated-p nil t) + (defvar svg-font-lock-keywords + `(("\\!\\([\\ 0-9]+\\)\\!" + (0 (list 'face nil 'display (svg-font-lock-tag (match-string 1))))))) + (defun svg-font-lock-tag (label) + (svg-lib-tag label nil + :stroke 0 :margin 1 :font-weight 'bold + :padding (max 0 (- 3 (length label))) + :foreground (face-foreground 'nano-popout-i) + :background (face-background 'nano-popout-i))) + (push 'display font-lock-extra-managed-props) + (font-lock-add-keywords nil svg-font-lock-keywords) + (font-lock-flush (point-min) (point-max)))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:32] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Colorization of recent emails +(defun my/mu4e-headers-colorize (item msg) + "Colorize item depending on whe msg was received" + + (let* ((recent (* 5 60)) ;; 5 minutes + (now (current-time)) + (unread (mu4e-message-field msg :unread)) + (date (mu4e-message-field msg :date)) + (delta (float-time (time-subtract now date)))) + (if (and (< delta recent) unread) + (propertize item 'face 'nano-salient) + item))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:31] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Bookmarks +(setq mu4e-bookmarks + '((:name "Unread" + :key ?u + :show-unread t + :query "flag:unread AND NOT flag:trashed") + + (:name "Inbox" + :key ?i + :show-unread t + :query "m:/inria/inbox or m:/univ/inbox or m:/gmail/inbox") + + (:name "Today" + :key ?t + :show-unread t + :query "date:today..now") + + (:name "Yesterday" + :key ?y + :show-unread t + :query "date:2d..today and not date:today..now") + + (:name "Last week" + :key ?w + :hide-unread t + :query "date:7d..now") + + (:name "Flagged" + :key ?f + :show-unread t + :query "flag:flagged") + + (:name "Sent" + :key ?s + :hide-unread t + :query "from:Nicolas.Rougier") + + (:name "Drafts" + :key ?d + :hide-unread t + :query "flag:draft"))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:30] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Write +See www.gnu.org/software/emacs/manual/html_node/message/Insertion-Variables.html + +(setq message-send-mail-function 'smtpmail-send-it + message-cite-reply-position 'below + message-citation-line-format "%N [%Y-%m-%d at %R] wrote:" + message-citation-line-function 'message-insert-formatted-citation-line + message-yank-prefix "> " + message-yank-cited-prefix "> " + message-yank-empty-prefix "> " + message-indentation-spaces 1 + message-kill-buffer-on-exit t + + mu4e-compose-format-flowed t + mu4e-compose-complete-only-personal t + mu4e-compose-complete-only-after "2021-01-01" ; Limite address auto-completion + mu4e-compose-dont-reply-to-self t + mu4e-compose-crypto-reply-policy 'sign-and-encrypt) + +Multi-language flyspell in compose mode + +(require 'flyspell) +(require 'guess-language) +(require 'flyspell-correct-popup) + +;; (bind-key "C-;" #'flyspell-popup-wrapper flyspell-mode-map) +(bind-key "C-;" #'flyspell-popup-correct flyspell-mode-map) + +;; Automatically detect language for Flyspell +(with-eval-after-load 'guess-language + (add-hook 'text-mode-hook #'guess-language-mode) + (setq guess-language-langcodes '((en . ("en_GB" "English")) + (fr . ("fr_FR" "French"))) + guess-language-languages '(en fr) + guess-language-min-paragraph-length 45)) + +(setq flyspell-generic-check-word-predicate 'mail-mode-flyspell-verify) +(defun my/mu4e-compose-hook () + "Settings for message composition." + + (auto-save-mode -1) + (turn-off-auto-fill) + (set-fill-column 79) + (setq flyspell-generic-check-word-predicate + 'mail-mode-flyspell-verify) + (flyspell-mode)) + +(add-hook 'mu4e-compose-mode-hook #'my/mu4e-compose-hook) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:30] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Encryption +See https://www.djcbsoftware.nl/code/mu/mu4e/Reading-messages.html + +(require 'epg-config) + +(setq epg-gpg-program "/usr/local/bin/gpg" ; What gpg program to use + epg-user-id "gpg_key_id" ; GnuPG ID of your default identity + mml2015-use 'epg ; The package used for PGP/MIME. + mml2015-encrypt-to-self t ; Add our own key ID to recipient list + mml2015-sign-with-sender t) ; Use message sender to find a key to sign with. + +;;(setq epa-file-cache-passphrase-for-symmetric-encryption nil) +;;(require 'epa-file) +;;(epa-file-enable) +;;(setq epa-file-select-keys nil) +(setq epa-pinentry-mode 'loopback) +(pinentry-start) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:29] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Vertico +Vertico provides a performant and minimalistic vertical completion UI based on the default completion system but aims to be highly flexible, extensible and modular. + +(require 'vertico) + +;; (setq completion-styles '(basic substring partial-completion flex)) + +(setq vertico-resize nil ; How to resize the Vertico minibuffer window. + vertico-count 8 ; Maximal number of candidates to show. + vertico-count-format nil) ; No prefix with number of entries + +(vertico-mode) +Tweaking settings + +(setq vertico-grid-separator + #(" | " 2 3 (display (space :width (1)) + face (:background "#ECEFF1"))) + + vertico-group-format + (concat #(" " 0 1 (face vertico-group-title)) + #(" " 0 1 (face vertico-group-separator)) + #(" %s " 0 4 (face vertico-group-title)) + #(" " 0 1 (face vertico-group-separator + display (space :align-to (- right (-1 . right-margin) (- +1))))))) + +(set-face-attribute 'vertico-group-separator nil + :strike-through t) +(set-face-attribute 'vertico-current nil + :inherit '(nano-strong nano-subtle)) +(set-face-attribute 'completions-first-difference nil + :inherit '(nano-default)) +Bind shift-tab for completion + +(bind-key "<backtab>" #'minibuffer-complete vertico-map) +Completion-at-point and completion-in-region (see https://github.com/minad/vertico#completion-at-point-and-completion-in-region) + +(setq completion-in-region-function + (lambda (&rest args) + (apply (if vertico-mode + #'consult-completion-in-region + #'completion--in-region) + args))) +Prefix the current candidate (See https://github.com/minad/vertico/wiki#prefix-current-candidate-with-arrow) + +(defun minibuffer-format-candidate (orig cand prefix suffix index _start) + (let ((prefix (if (= vertico--index index) + " " + " "))) + (funcall orig cand prefix suffix index _start))) + +(advice-add #'vertico--format-candidate + :around #'minibuffer-format-candidate) +See https://kristofferbalintona.me/posts/vertico-marginalia-all-the-icons-completion-and-orderless/#vertico + +(defun vertico--prompt-selection () + "Highlight the prompt" + + (let ((inhibit-modification-hooks t)) + (set-text-properties (minibuffer-prompt-end) (point-max) + '(face (nano-strong nano-salient))))) +See minad/vertico#145 + + +(defun minibuffer-vertico-setup () + + (setq truncate-lines t) + (setq completion-in-region-function + (if vertico-mode + #'consult-completion-in-region + #'completion--in-region))) + +(add-hook 'vertico-mode-hook #'minibuffer-vertico-setup) +(add-hook 'minibuffer-setup-hook #'minibuffer-vertico-setup) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:25] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Vertico +Vertico provides a performant and minimalistic vertical completion UI based on the default completion system but aims to be highly flexible, extensible and modular. + +(require 'vertico) + +;; (setq completion-styles '(basic substring partial-completion flex)) + +(setq vertico-resize nil ; How to resize the Vertico minibuffer window. + vertico-count 8 ; Maximal number of candidates to show. + vertico-count-format nil) ; No prefix with number of entries + +(vertico-mode) +Tweaking settings + +(setq vertico-grid-separator + #(" | " 2 3 (display (space :width (1)) + face (:background "#ECEFF1"))) + + vertico-group-format + (concat #(" " 0 1 (face vertico-group-title)) + #(" " 0 1 (face vertico-group-separator)) + #(" %s " 0 4 (face vertico-group-title)) + #(" " 0 1 (face vertico-group-separator + display (space :align-to (- right (-1 . right-margin) (- +1))))))) + +(set-face-attribute 'vertico-group-separator nil + :strike-through t) +(set-face-attribute 'vertico-current nil + :inherit '(nano-strong nano-subtle)) +(set-face-attribute 'completions-first-difference nil + :inherit '(nano-default)) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:25] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Consult +We replace some of emacs functions with their consult equivalent + +(require 'consult) + +(setq consult-preview-key nil) ; No live preview + +(bind-key "C-x C-r" #'consult-recent-file) +(bind-key "C-x h" #'consult-outline) +(bind-key "C-x b" #'consult-buffer) +(bind-key "C-c h" #'consult-history) +;; (bind-key "M-:" #'consult-complex-command) +For the consult-goto-line and consult-line commands, we define our owns with live preview (independently of the consult-preview-key) + +(defun my/consult-line () + "Consult line with live preview" + + (interactive) + (let ((consult-preview-key 'any) + (mini-frame-resize 'grow-only)) ;; !! Important + (consult-line))) + +(bind-key "C-s" #'my/consult-line) +(defun my/consult-goto-line () + "Consult goto line with live preview" + + (interactive) + (let ((consult-preview-key 'any)) + (consult-goto-line))) + +(bind-key "M-g g" #'my/consult-goto-line) +(bind-key "M-g M-g" #'my/consult-goto-line) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:25] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Corfu +Corfu enhances completion at point with a small completion popup. + +(require 'corfu) + +(setq corfu-cycle t ; Enable cycling for `corfu-next/previous' + corfu-auto t ; Enable auto completion + corfu-auto-delay 60.0 ; Delay before auto-completion shows up + corfu-separator ?\s ; Orderless field separator + corfu-quit-at-boundary nil ; Never quit at completion boundary + corfu-quit-no-match t ; Quit when no match + corfu-preview-current nil ; Disable current candidate preview + corfu-preselect-first nil ; Disable candidate preselection + corfu-on-exact-match nil ; Configure handling of exact matches + corfu-echo-documentation nil ; Disable documentation in the echo area + corfu-scroll-margin 5) ; Use scroll margin + +(global-corfu-mode) +A few more useful configurations… + +;; TAB cycle if there are only few candidates +(setq completion-cycle-threshold 3) + +;; Emacs 28: Hide commands in M-x which do not apply to the current mode. +;; Corfu commands are hidden, since they are not supposed to be used via M-x. +(setq read-extended-command-predicate + #'command-completion-default-include-p) + +;; Enable indentation+completion using the TAB key. +;; completion-at-point is often bound to M-TAB. +(setq tab-always-indent 'complete) + +;; Completion in source blocks +(require 'cape) + +(add-to-list 'completion-at-point-functions 'cape-elisp-symbol) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:24] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Parenthesis +Paren mode for highlighting matcing paranthesis + +(require 'paren) +;; (setq show-paren-style 'expression) +(setq show-paren-style 'parenthesis) +(setq show-paren-when-point-in-periphery t) +(setq show-paren-when-point-inside-paren nil) +(show-paren-mode) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:23] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Tabulations +No tabulation, ever. + +(setq-default indent-tabs-mode nil ; Stop using tabs to indent + tab-always-indent 'complete ; Indent first then try completions + tab-width 4) ; Smaller width for tab characters +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:23] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Clipboard +Allows system and Emacs clipboard to communicate smoothly (both ways) + +(setq-default select-enable-clipboard t) ; Merge system's and Emacs' clipboard +Make sure clipboard works properly in tty mode on OSX. + +(defun my/paste-from-osx () + (shell-command-to-string "pbpaste")) + +(defun my/copy-to-osx (text &optional push) + (let ((process-connection-type nil)) + (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy"))) + (process-send-string proc text) + (process-send-eof proc)))) + +(when (and (not (display-graphic-p)) + (eq system-type 'darwin)) + (setq interprogram-cut-function #'my/copy-to-osx + interprogram-paste-function #'my/paste-from-osx)) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:21] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Scroll +Smoother scrolling. + +(setq-default scroll-conservatively 101 ; Avoid recentering when scrolling far + scroll-margin 2 ; Add a margin when scrolling vertically + recenter-positions '(5 bottom)) ; Set re-centering positions +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:21] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Mouse +Mouse behavior can be finely controlled using the mouse-avoidance-mode. + +(setq-default mouse-yank-at-point t) ; Yank at point rather than pointer +(mouse-avoidance-mode 'exile) ; Avoid collision of mouse with point +Mouse active in tty mode. + +(unless (display-graphic-p) + (xterm-mouse-mode 1) + (global-set-key (kbd "<mouse-4>") #'scroll-down-line) + (global-set-key (kbd "<mouse-5>") #'scroll-up-line)) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:21] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +A smarter fill/unfill command + +(defun my/fill-unfill () + "Like `fill-paragraph', but unfill if used twice." + + (interactive) + (let ((fill-column + (if (eq last-command #'my/fill-unfill) + (progn (setq this-command nil) + (point-max)) + fill-column))) + (call-interactively #'fill-paragraph))) + +(bind-key "M-q" #'my/fill-unfill) +;; (bind-key [remap fill-paragraph] #'my/fill-unfill) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:20] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +(setq-default use-short-answers t ; Replace yes/no prompts with y/n + confirm-nonexistent-file-or-buffer nil) ; Ok to visit non existent files +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:20] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Date related +A set of date related functions, mostly used for mail display. + +(defun my/date-day (date) + "Return DATE day of month (1-31)." + + (nth 3 (decode-time date))) +(defun my/date-month (date) + "Return DATE month number (1-12)." + + (nth 4 (decode-time date))) +(defun my/date-year (date) + "Return DATE year." + + (nth 5 (decode-time date))) +(defun my/date-equal (date1 date2) + "Check if DATE1 is equal to DATE2." + + (and (eq (my/date-day date1) + (my/date-day date2)) + (eq (my/date-month date1) + (my/date-month date2)) + (eq (my/date-year date1) + (my/date-year date2)))) +(defun my/date-inc (date &optional days months years) + "Return DATE + DAYS day & MONTH months & YEARS years" + + (let ((days (or days 0)) + (months (or months 0)) + (years (or years 0)) + (day (my/date-day date)) + (month (my/date-month date)) + (year (my/date-year date))) + (encode-time 0 0 0 (+ day days) (+ month months) (+ year years)))) +(defun my/date-dec (date &optional days months years) + "Return DATE - DAYS day & MONTH months & YEARS years" + + (let ((days (or days 0)) + (months (or months 0)) + (years (or years 0))) + (my/date-inc date (- days) (- months) (- years)))) +(defun my/date-today () + "Return today date." + + (current-time)) +(defun my/date-is-today (date) + "Check if DATE is today." + + (my/date-equal (current-time) date)) +(defun my/date-is-yesterday (date) + "Check if DATE is yesterday." + + (my/date-equal (my/date-dec (my/date-today) 1) date)) +(defun my/date-relative (date) + "Return a string with a relative date format." + + (let* ((now (current-time)) + (delta (float-time (time-subtract now date))) + (days (ceiling (/ (float-time (time-subtract now date)) (* 60 60 24))))) + (cond ((< delta (* 3 60)) "now") + ((< delta (* 60 60)) (format "%d minutes ago" (/ delta 60))) + ;; ((< delta (* 6 60 60)) (format "%d hours ago" (/ delta 3600))) + ((my/date-is-today date) (format-time-string "%H:%M" date)) + ((my/date-is-yesterday date) (format "Yesterday")) + ((< delta (* 4 24 60 60)) (format "%d days ago" (+ days 1))) + (t (format-time-string "%d %b %Y" date))))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:12] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +History +Remove text properties for kill ring entries (see https://emacs.stackexchange.com/questions/4187). This saves a lot of time when loading it. + +(defun unpropertize-kill-ring () + (setq kill-ring (mapcar 'substring-no-properties kill-ring))) + +(add-hook 'kill-emacs-hook 'unpropertize-kill-ring) +We save every possible history we can think of. + +(require 'savehist) + +(setq kill-ring-max 50 + history-length 50) + +(setq savehist-additional-variables + '(kill-ring + command-history + set-variable-value-history + custom-variable-history + query-replace-history + read-expression-history + minibuffer-history + read-char-history + face-name-history + bookmark-history + file-name-history)) + + (put 'minibuffer-history 'history-length 50) + (put 'file-name-history 'history-length 50) + (put 'set-variable-value-history 'history-length 25) + (put 'custom-variable-history 'history-length 25) + (put 'query-replace-history 'history-length 25) + (put 'read-expression-history 'history-length 25) + (put 'read-char-history 'history-length 25) + (put 'face-name-history 'history-length 25) + (put 'bookmark-history 'history-length 25) +No duplicates in history + +(setq history-delete-duplicates t) +Start history mode. + +(let (message-log-max) + (savehist-mode)) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:09] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +History +Remove text properties for kill ring entries (see https://emacs.stackexchange.com/questions/4187). This saves a lot of time when loading it. + +(defun unpropertize-kill-ring () + (setq kill-ring (mapcar 'substring-no-properties kill-ring))) + +(add-hook 'kill-emacs-hook 'unpropertize-kill-ring) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:09] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Recent files +50 Recents files with some exclusion (regex patterns). + +(require 'recentf) + +(setq recentf-max-menu-items 10 + recentf-max-saved-items 100 + recentf-exclude '("/Users/rougier/Documents/Mail.+" + "/Users/rougier/Documents/Notes.+" + )) + +(let (message-log-max) + (recentf-mode 1)) +History +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:09] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Recovery +If Emacs or the computer crashes, you can recover the files you were editing at the time of the crash from their auto-save files. To do this, start Emacs again and type the command M-x recover-session. Here, we parameterize how files are saved in the background. + +(setq auto-save-list-file-prefix ; Prefix for generating auto-save-list-file-name + (expand-file-name ".auto-save-list/.saves-" user-emacs-directory) + auto-save-default t ; Auto-save every buffer that visits a file + auto-save-timeout 20 ; Number of seconds between auto-save + auto-save-interval 200) ; Number of keystrokes between auto-saves +Backups +Emacs carefully copies the old contents to another file, called the “backup” file, before actually saving. Emacs makes a backup for a file only the first time the file is saved from a buffer. No matter how many times you subsequently save the file, its backup remains unchanged. However, if you kill the buffer and then visit the file again, a new backup file will be made. Here, we activate backup and parameterize the number of backups to keep. + +(setq backup-directory-alist ; File name patterns and backup directory names. + `(("." . ,(expand-file-name "backups" user-emacs-directory))) + make-backup-files t ; Backup of a file the first time it is saved. + vc-make-backup-files t ; No backup of files under version contr + backup-by-copying t ; Don't clobber symlinks + version-control t ; Version numbers for backup files + delete-old-versions t ; Delete excess backup files silently + kept-old-versions 6 ; Number of old versions to keep + kept-new-versions 9 ; Number of new versions to keep + delete-by-moving-to-trash t) ; Delete files to trash + +;; Back +(require 'vc-backup) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:08] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Path +Extending executable for recollq program + +(setenv "PATH" (concat (getenv "PATH") ":" "/Users/rougier/Applications/recoll.app/Contents/MacOS")) +(setq exec-path (append exec-path '("/Users/rougier/Applications/recoll.app/Contents/MacOS"))) + +(setenv "PATH" (concat (getenv "PATH") ":" "/Users/rougier/bin")) +(setq exec-path (append exec-path '("/Users/rougier/bin"))) +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:08] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE +Encoding +We tell emacs to use UTF-8 encoding as much as possible. + +(set-default-coding-systems 'utf-8) ; Default to utf-8 encoding +(prefer-coding-system 'utf-8) ; Add utf-8 at the front for automatic detection. +(set-terminal-coding-system 'utf-8) ; Set coding system of terminal output +(set-keyboard-coding-system 'utf-8) ; Set coding system for keyboard input on TERMINAL +(set-language-environment "English") ; Set up multilingual environment +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 13:07] +** dotemacs/dotemacs.org at master · rougier/dotemacs +#+BEGIN_QUOTE + inhibit-startup-echo-area-message t ; Disable initial echo message +#+END_QUOTE +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 12:58] +** rougier/reviewer-manifesto: A pledge for reviewers +[[https://github.com/rougier/reviewer-manifesto][rougier/reviewer-manifesto: A pledge for reviewers]] +Captured On: [2025-10-17 Fri 12:54] +** rougier/nano-calendar: An alternative calendar for Emacs +[[https://github.com/rougier/nano-calendar][rougier/nano-calendar: An alternative calendar for Emacs]] +Captured On: [2025-10-17 Fri 12:53] +** dotemacs/dotemacs.org at master · rougier/dotemacs +[[https://github.com/rougier/dotemacs/blob/master/dotemacs.org][dotemacs/dotemacs.org at master · rougier/dotemacs]] +Captured On: [2025-10-17 Fri 12:53] +** rougier/nano-tools: A set of tools for emacs that are not worth to be packaged. +[[https://github.com/rougier/nano-tools][rougier/nano-tools: A set of tools for emacs that are not worth to be packaged.]] +Captured On: [2025-10-17 Fri 12:52] +** rougier/nano-mu4e: Alternative layour for mu4e +[[https://github.com/rougier/nano-mu4e][rougier/nano-mu4e: Alternative layour for mu4e]] +Captured On: [2025-10-17 Fri 12:51] +** rougier/nano-theme: GNU Emacs / N Λ N O Theme +[[https://github.com/rougier/nano-theme][rougier/nano-theme: GNU Emacs / N Λ N O Theme]] +Captured On: [2025-10-17 Fri 12:51] +** rougier/nano-emacs: GNU Emacs / N Λ N O - Emacs made simple +#+BEGIN_QUOTE +GNU Emacs / N Λ N O is a set of configuration files for GNU Emacs such as to provide a nice and consistent look and feel as shown below. It is based on design principles I described in the article "On the design of text Editors" that is available on arXiv. The light theme is based on Material colors and the dark theme is based on Nord colors. + +The philosophy of nano emacs is to stick as much as possible to vanilla emacs without introducing too much dependencies (or none if possible) and to keep it modular enough. The idea is for users to copy the part they are interested in such as to include them in their own configuration. +#+END_QUOTE +[[https://github.com/rougier/nano-emacs][rougier/nano-emacs: GNU Emacs / N Λ N O - Emacs made simple]] +Captured On: [2025-10-17 Fri 11:59] +** rougier/mu4e-dashboard: A dashboard for mu4e (mu for emacs) +#+BEGIN_QUOTE +mu4e dashboard provides a new mu4e org link type that allows to execute various mu4e queries when clicked. Such links can be organised into a dashboard, by simply writing an org file as shown below: +#+END_QUOTE +[[https://github.com/rougier/mu4e-dashboard][rougier/mu4e-dashboard: A dashboard for mu4e (mu for emacs)]] +Captured On: [2025-10-17 Fri 11:56] +** rougier/mu4e-thread-folding: Functions for folding threads in mu4e headers view +#+BEGIN_QUOTE +mu4e-thread-folding.el is a small library to enable threads folding in mu4e. This works by using overlays with an invisible property and setting hooks at the right place. It is possible to configure colors to better highlight a thread and also to have a prefix string indicating if a thread is folded or not. Note that when a thread is folded, any unread child remains visible. +#+END_QUOTE +[[https://github.com/rougier/mu4e-thread-folding][rougier/mu4e-thread-folding: Functions for folding threads in mu4e headers view]] +Captured On: [2025-10-17 Fri 11:55] +** rougier/mu4e-dashboard: A dashboard for mu4e (mu for emacs) +[[https://github.com/rougier/mu4e-dashboard][rougier/mu4e-dashboard: A dashboard for mu4e (mu for emacs)]] +Captured On: [2025-10-17 Fri 11:48] |
