From 5e6e52c099ce4e89e52bb1b6b0d4a78e609a6f12 Mon Sep 17 00:00:00 2001 From: noa Date: Mon, 14 Oct 2024 11:11:38 +0800 Subject: Make comments more concise --- emacs/init.el | 235 +++++++++++++++++++++++++--------------------------------- 1 file changed, 99 insertions(+), 136 deletions(-) (limited to 'emacs/init.el') diff --git a/emacs/init.el b/emacs/init.el index 5a3a604..c2b13ac 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -113,7 +113,7 @@ ;; Ensure that transients look nice with a variable pitch font. (transient-align-variable-pitch t)) -;; Reading prose with long lines is a chore. Luckily there are several packages in emacs to make the windows squeeze text into a more legible sliver. Previously i used olivetti, which is a really nice package, but it's quite heavyweight and broke on me with no explanation more frequently than i appreciated. I've switched to visual-fill-column and been quite satisfied. +;; Squeeze text into a more legible sliver. (use-package visual-fill-column :ensure t :custom @@ -125,7 +125,7 @@ ) ;; (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust) -;; Adaptive wrap will indent visually wrapped text to match the indent at the start of the line, for example in lists. This works... fine. However it's adapting the prefix, it doesn't indent nicely with proportional fonts, but you can't win them all. +;; Doesn't indent nicely with proportional fonts ;; (use-package adaptive-wrap :ensure t) ;; (add-hook 'visual-fill-column-mode-hook #'visual-wrap-prefix-mode) @@ -133,10 +133,10 @@ (setopt menu-bar-mode nil tool-bar-mode nil) -;; Tooltips are little popups next to the mouse cursor. I think this information is helpful, but i like it to appear in a more consistent position, because i find it frustrating when popups cover parts of the ui that i wanted to see. By disabling tooltip-mode, the contents that would be in a popup is instead shown in the echo area. +;; Make tooltip information appear consistently in the echo area (setopt tooltip-mode nil) -;; I see no reason not to immediately show which chords in a key sequence i have already pressed. Emacs does, however, and instead of letting me set the value of echo-keystrokes to zero to wait zero seconds to show that information, it repurposes zero as a method of disabling the functionality altogether, and provides no special functionality for setting it to nil that would explain why that's not an acceptable method of disabling a feature. Instead, i have to deal with setting it to nearly zero, and luckily i can't tell the difference. +;; (Almost) immediately show which chords in a key sequence i have already pressed. (setopt echo-keystrokes 0.1) (use-package paren @@ -157,8 +157,9 @@ ;; deleting should be an explicit action delete-selection-mode nil) -;; Shift click to select region with the mouse. I had a poor workaround for this before, but found an article (https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/) which shows me how to do it more pleasantly. In the same article i also discovered the existence of mouse-drag-secondary, which i think i will not make use of but is cool nonetheless. It also showed me mouse-drag-region-rectangle, which doesn't work great with a proportional font, but could still be useful. +;; Shift click to select region with the mouse (https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/) (global-set-key (kbd "S-") #'mouse-set-mark) +;; Doesn't work great with a proportional font but could still be useful. (global-set-key (kbd "C-S-") #'mouse-drag-region-rectangle) ;; Nicer tables @@ -184,20 +185,23 @@ ;; :hook ((markdown-mode . noa/set-buffer-name-to-markdown-title)) ) -;; Abbrev mode expands one string into another string. I use it as a simple autocorrect mode. If i misspell a word, i run C-x a i g which will prompt me for what to expand the previous word into. I type the correct spelling, and whenever i make that mistake again, it will automatically be corrected. It's important to be careful not to set something that could be a typo for two words though, because otherwise it gets even more annoying. Luckily it's easy to update the abbrevs which are stored in ~/.config/emacs/abbrev_defs. M-x list-abbrevs is also a nice command which shows all the saved abbrevs and how many times they've been expanded. +;; Use abbrev as a simple autocorrect mode. M-x list-abbrevs for stats. +;; Check ~/.config/emacs/abbrev_defs to update any mistakes (use-package abbrev :hook (text-mode . abbrev-mode)) -;; Jinx is a package for spellchecking. Previously i used [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Spelling.html][flyspell]], which is built in, and [[https://codeberg.org/ideasman42/emacs-spell-fu][spell-fu]]. Flyspell is not ideal because it only checks the word under the point. Furthermore, the correction interface is not pleasant to look at with a proportional font as it uses spaces to align the candidates. Spell-fu checks all the words that are visible, thereby behaving much more like a traditional spell checker. Jinx improves on spell-fu by interacting with the spellcheck process in a more efficient way, and has a nicer interface to corrections. +;; A nicer package for spellchecking (use-package jinx :ensure t - :custom - (global-jinx-mode t) + :hook (text-mode . jinx-mode) :bind - ("M-$" . jinx-correct) - ("C-M-$" . jinx-languages)) + ("M-$" . jinx-correct) ;; replaces ispell-word + ("C-M-$" . jinx-languages) + :config + (put 'jinx-overlay 'mouse-face '(jinx-misspelled highlight)) ;; Use standard mouse face for jinx overlays + ) -;; This is a cool function i took from the jinx wiki. It automatically creates an abbrev for words i correct, so if i make the same error again, it gets fixed without me having to do anything! +;; Automatically creates an abbrev for words i correct, so i don't make the same mistake twice (defun jinx--add-to-abbrev (overlay word) "Add abbreviation to `global-abbrev-table'. The misspelled word is taken from OVERLAY. WORD is the corrected word." @@ -208,27 +212,21 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (define-abbrev global-abbrev-table abbrev word))) (advice-add 'jinx--correct-replace :before #'jinx--add-to-abbrev) -;; Almost everywhere else, the ~highlight~ face is used for interactive text on mouse over. However, jinx reuses its own ~jinx-highlight~ face, which i don't really like. This face clashes with the face i use for the active region, which means selecting text across a misspelled word can be a bit confusing. If i change the ~jinx-highlight~ face, it looks wrong when i've activated jinx to correct the word. -(put 'jinx-overlay 'mouse-face '(jinx-misspelled highlight)) - -;; I mentioned that i thought this wasn't the best default behaviour [[https://github.com/minad/jinx/discussions/184][in the jinx repository]], but Daniel seems happy with it. I appreciate that he's made it so easy to change the behaviour to something i prefer. - -;; Make it easier to close help windows (use-package help :defer t :custom - (help-window-select t) + (help-window-select t) ;; Make it easier to close help windows ;; When opening source files from a help window, use the same window (help-window-keep-selected t)) -;; I use eww, a browser more closely aligned with browsers for the terminal. Despite the name, eww is a delight to use for text-heavy websites. If a website doesn't render well in it, because it uses fancy layout tricks or lots of javascript, we can press ~&~ to open the url in firefox. +;; Despite the name, eww is a delight to use for text-heavy websites. (use-package browse-url :defer t :custom (browse-url-browser-function 'eww-browse-url) (browse-url-secondary-browser-function 'browse-url-default-browser)) -;; For the kind of sites i use eww to visit, i've not had a use for cookies. We can tell emacs that we don't trust cookies from any sites, we don't trust cookies from all sites, and frankly, we don't want to use cookies. +;; I've had no use for cookies in eww (use-package url-cookie :defer t :custom @@ -239,20 +237,16 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." :defer t :custom (shr-cookie-policy nil) - ;; Eww has rudimentary support for colours. But i don't want web pages to be able to specify their own colours, because i like the colours i already have set. - (shr-use-colors nil) - ;; Shr has the ability to break paragraphs to fit on the screen. Instead of this, we set it to not break any lines, and use visual-fill-column-mode to do this for us instead. - (shr-max-width nil) + (shr-use-colors nil) ;; I like the colours i already have set + (shr-max-width nil) ;; Don't insert hard linebreaks to wrap paragraphs (shr-bullet " • ") - (shr-discard-aria-hidden t) - ;; We can set what the maximum size of an image in a window should be. This is a fraction of the total window width or height, and if the image would be bigger than this, it'll be resized to fit. It's useful to have it smaller because emacs still sort of chokes on scrolling when there are large images in a buffer. This is the default value of this option. -(shr-max-image-proportion 0.9)) + (shr-discard-aria-hidden t)) (use-package eww :defer t :custom - ;; The default name for the eww buffer is *eww*. This is unhelpful because it makes having more than one eww buffer open a bit of a chore to navigate. We can set it to 'url, 'title, or a function. I set it to 'title because marginalia already shows me the url. However, this means that i can't search for a url name when switching buffers. See the help for this variable for an example of a function which gives the page title and the url. + ;; Better buffer naming for eww buffers. See the help for a function which gives the page title and the url. (eww-auto-rename-buffer 'title)) ;; Goto address mode makes urls and email address in a buffer clickable. I want these clickable links to look like links, because that's what they are. The two mouse face variables are what face is used on hover, which at the moment i ignore. It might also be worth setting them to 'highlight. @@ -268,36 +262,34 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." :custom (global-eldoc-mode t)) -;; Use a bar cursor and blink it and don't stop blinking it. i don't know how i feel about this yet to be honest, but it helps me know which window is active so for now i'm keeping it +;; Use a bar cursor and blink it and don't stop blinking it. (setopt cursor-type 'bar blink-cursor-mode t blink-cursor-interval 0.7) -;; By default, dired permanently deletes files. But i have quite a bit of storage and also make bad decisions regularly, so it seems fitting to make use of the wonderful invention that is the trash. People who have used systems from the last forty years or so will likely be familiar with this innovation. +;; I have quite a bit of storage and also make bad decisions regularly +;; People who have used computers in the last forty years or so will likely be familiar with this innovation. (setopt delete-by-moving-to-trash t) (use-package dired :defer t :custom -;; It's not fun to be asked every time whether we want to delete a directory recursively. It's an understandable default for safety reasons, but because we are not deleting permanently but rather just moving to the trash, it's not such a concern. - (dired-recursive-deletes 'always) - -;; Recursive copying isn't even destructive, so i definitely don't want to be asked about that. - (dired-recursive-copies 'always) - -;; After we delete some files or directories, it makes sense to get rid of any buffers which are looking at those files or directories. - (dired-clean-up-buffers-too t) - -;; With this set, if we have two dired buffers open next to one another, a rename operation in one will default to the directory shown in the other. In this way, we can pretend we are using some kind of norton commander like file browser instead of slumming it in emacs. - (dired-dwim-target t) - -;; These are some useful ls switches. We have to keep -l. To show dotfiles as well, we use -a. To sort numbers by number order instead of lumping together ones, twos, and so on, we use -v. Because we don't have colour, it's nice to have a clear indicator of what is a file and what is a directory, as well as other different things like symlinks which i never remember. By using -F, a forward slash is appended to every directory. And to get more easily understandable file sizes, we use -h, which will tell us the file size in kilobytes or megabytes rather than a huge number that means nothing to me. I won't explain the meaning of the long flag. -(dired-listing-switches "-alvFh --group-directories-first") + (dired-recursive-deletes 'always) ;; Don't ask me things + (dired-recursive-copies 'always) ;; Don't ask me things + (dired-dwim-target t) ;; Synergy between two dired windows + + ;; -l is required by dired + ;; -a to also show dotfiles + ;; -v to sort numebrs properly + ;; -F to visually distinguish different types of file + ;; -h for human readable file sizes + ;; I won't explain the meaning of the long flag. + (dired-listing-switches "-alvFh --group-directories-first") ;; By default, don't show dired details :hook (dired-mode . dired-hide-details-mode)) -;; I find it useful to see the recursive sizes of directories. This can be a little slow, so setting it as always on might not be the best idea, but the longest i've had to wait is about a second, and that's only if i run it on my home directory, so i think it's worth it at the moment. +;; Show the recursive size of directories (use-package dired-du :ensure t :after dired @@ -314,7 +306,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (tramp-verbose 3)) ;; (add-to-list 'tramp-remote-path 'tramp-own-remote-path) -;; The version control system will try each of these methods in order. Because almost everything source controlled i do uses git, i put it first in the list. But at the moment, because i don't think i actually use any of the other methods, i remove the rest of them from the list. +;; I only use git, and this apparently speeds up tramp. (use-package vc-hooks :after vc :custom @@ -330,7 +322,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; ForwardAgent yes ;; ServerAliveInterval 60 -;; There is a distinction in emacs between manual buffer switching that i initiate, and automatic buffer switching when emacs wants to show a buffer. In practice this means that any rules i write for where to display buffers get ignored if i try to show that buffer myself. This line changes that behaviour. +;; Don't override display actions when i manually initiate a buffer switch. (setopt switch-to-buffer-obey-display-actions t) ;; History @@ -388,11 +380,11 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." recentf-mode t bookmark-default-file "~/.config/emacs/bookmarks") -;; Undo is on C-/ and redo is on C-S-/. It's not standard, but these bindings are easier to remember. And with this setting, it behaves for the most part like undo in other programs, which isn't as good as i'd really want, but is something i can reason about much more easily than the default undo. +;; My brain is not ready for advanced emacs undo (setopt undo-no-redo t) ;; Saving -;; Backups are pointless in long emacs sessions imo, but autosaves are useful. +;; Backups are pointless in long emacs sessions, but autosaves are useful. (setopt remote-file-name-inhibit-auto-save t) (setopt remote-file-name-inhibit-auto-save-visited t) (setopt backup-directory-alist '(("." . "~/.config/emacs/backups/")) @@ -419,13 +411,11 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (fill-paragraph nil))) (global-set-key (kbd "M-Q") #'unfill-paragraph) -;; Better control l -;; C-l goes in order, rather than first centering the cursor. This is particularly pleasant with a ~scroll-margin~ greater than the default of zero, which serves to keep a line of context at each edge of the screen, as well as triggering a scroll when the point is that far away from the screen edge. +;; C-l from top to bottom (setopt recenter-positions '(top middle bottom)) +;; Always give me a line of text when i'm near the edges of the screen (setopt scroll-margin 1) -;; Emacs uses choppy scrolling by default. If i scoll with my trackpad, it's nice to have it move tiny amounts at the same time as my fingers, which pixel-scroll-precision-mode allows for. This also has the benefit of making scrolling over images a little bit of a nicer experience. - ;; This doesn't work well sometimes for some reason, so i've disabled it for now. ;; (setopt pixel-scroll-precision-mode t ;; pixel-scroll-precision-use-momentum t) @@ -433,7 +423,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Remember my position in files (setopt save-place-mode t) -;; The former means that when given a list of choices, we can use single character abbreviations to answer. The latter is a fancy way of defaliasing yes-or-no-p to y-or-n-p. +;; Use single character abbreviations to answer prompts. (setopt read-answer-short t) (setopt use-short-answers t) @@ -478,10 +468,9 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (setopt vc-follow-symlinks 'ask) ;; Clicking around -;; By default, clicking on a character will always put the point in front of that character. But it generally feels nicer for a click to put the point on the nearest side of the character to where the mouse clicked, to allow for slightly sloppier clicking. +;; Allow for slightly sloppier clicking. (setopt mouse-prefer-closest-glyph t) -;; Consult is a package to provide navigation commands that take advantage of completing-read. I set up a nice completing-read environment earlier with vertico. There are a lot of commands built in to consult, and it's possible to define more. But i use it very simply. (use-package consult :ensure t :bind @@ -497,45 +486,35 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (completion-in-region-function 'consult-completion-in-region)) ;; Annotations for completing-read -;; Marginalia provides us with annotations for candidates in completing read functions. This is things like docstrings for functions, file permissions in find-file, and so on. It's a small quality of life improvement. ;; (package-ensure 'marginalia) (use-package marginalia :ensure t :defer t :custom (marginalia-mode t) + (marginalia-max-relative-age most-positive-fixnum) ;; Always show the relative age of file + ) - ;; We want to always show the relative age of a file. By default, files which haven't been modified for more than two weeks will display an absolute date. - (marginalia-max-relative-age most-positive-fixnum)) - -;; My keyboard has a tab key and an i key. For legacy reasons, by default emacs converts C-i to mean the same thing as the tab key, but i don't really want that. The tab key is called and it gets translated to TAB. C-i is TAB, but i'd rather it by C-i. That's what this decode line does. +;; Completion at point on C-i (define-key input-decode-map [?\C-i] [C-i]) - -;; Now that tab and C-i are properly distinguished, i can bind C-i to completion at point. (global-set-key (kbd "") 'completion-at-point) ;; Minibuffer candidate completion -;; Vertico is a package for a nice minibuffer completion experience. It displays a vertical list of candidates. It integrates well with the emacs ecosystem and lets me use other packages that also play nicely. +;; Display completion candidates vertically (use-package vertico :ensure t :custom (vertico-mode t) + (vertico-count 12) ;; Use about half the screen to show candidates + (vertico-group-format #("%s " 0 3 (face vertico-group-title))) ;; Don't put a vertical line across group titles + (vertico-cycle t)) -;; We want vertico to take up a maximum of 12 lines on the display. My screen is quite small, so that's fine, but if i had a bigger screen, i might want to look into setting a percentage or increasing this. - (vertico-count 12) - -;; By default, vertico uses a font-face trick to put a horizontal line across group titles. It looks quite nice, but doesn't really conform to my design sensibilities, so here i redefine the group format to not have this. Because we no longer have the line, we also align the group name to the left edge. - (vertico-group-format #("%s " 0 3 (face vertico-group-title))) - -;; We also want to be able to jump to the bottom of the list by moving up from the top of the list, and the opposite. I've rarely made use of this functionality and i don't know if it's actually a best practice from an interaction perspective, but i'm going to keep it on until it causes an issue for me. - (vertico-cycle t)) - -;; And of course, i want to be able to interact with vertico with the mouse. +;; Interact with vertico with the mouse. (use-package vertico-mouse :after vertico :custom (vertico-mouse-mode t)) -;; When completing a filename, i want to be able to easily delete directories in one fell swoop, instead of character by character or word by word. Usually C- would be fine, but if directories have a hyphen or space in their name, i have to press multiple times, which is almost never desirable. +;; More comfortable directory navigation (use-package vertico-directory :after vertico :bind (:map vertico-map @@ -555,33 +534,31 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Completion styles ;; When given a prompt to select from a list of candidates, there are quite a lot of things we can tweak to improve the experience. -;; The first thing we do is to ignore case, which in these cases is rarely useful. I find that thinking about the case of a candidate is slower than just typing more to narrow down the options. I don't actually know if these make any difference when i've specified a different completion style. +;; I don't actually know if these make any difference when i've specified a different completion style. (setopt read-buffer-completion-ignore-case t) (setopt read-file-name-completion-ignore-case t) (setopt completion-ignore-case t) -;; Next, we want to set orderless and basic as the two completion style. Basic matches candidates with the same text before the point, and the text after the point as a substring. Orderless takes any number of space separated components and displays candidates that much every component in any order. We specify basic first. What this means in practice is that first we will try and complete exactly what i've input, and if that fails, widen the search with orderless to pick up more options. -;; (package-ensure 'orderless) -(setopt completion-styles '(orderless basic)) -(setopt completion-category-overrides '((file (styles basic partial-completion)))) - -;; By default, emacs overrides the completion styles for email address, but i'm happy with my configuration above. -(setopt completion-category-defaults nil) - -;; In general, my rules for inserting tabs are that the tab key should insert tabs. I personally prefer tabs to spaces, because tabs work reasonably well whatever font or tab width one chooses to set, whereas spaces are the same width for everyone, except when someone uses a proportional font in which case they are narrower than expected. Furthermore, people tend to use spaces for alignment, which looks bad when you can't rely on every character being the same width. +;; Basic matches candidates with the same text before the point, and the text after the point as a substring. +;; Orderless takes any number of space separated components and displays candidates that much every component in any order. +(use-package orderless + :ensure t + :custom + (completion-styles '(orderless basic)) + (completion-category-overrides '((file (styles basic partial-completion))))) -;; However, i'm in the minority, and fighting with the very complicated emacs indentation systems is simply not fun. That said, i refuse to use a monospaced font. Luckily the minority is more than one and someone has already done the hard work for me of writing a mode to make spaces for indentation work reasonably well with a proportional font. That mode is elastic-indent-mode, and it very simply makes leading whitespace characters the same width as the characters on the line above. It's a simple solution but most of the time it does what i want. +;; Make leading whitespace a uniform width, so indentation still works with proportional fonts (require 'elastic-indent) (add-hook 'prog-mode-hook #'elastic-indent-mode) -;; Elastic-table-mode is similar; for tab characters within lines, ensure that they change width to make subsequent lines form a table-like layout. +;; Change the width of tab characters within lines to make subsequent lines form a table-like layout. (require 'elastic-table) (add-hook 'prog-mode-hook #'elastic-table-mode) -;; We will only be trying to indent at the start of a line, and sometimes we will want to insert a standard tab character. We can also set this option to 'complete, which will run completion at point if the region is already indented. -(setopt tab-always-indent nil) +;; Use tab for completion if the region is already indented +(setopt tab-always-indent 'complete) -;; Usually, we want indentation to be done with tabs. Some modes make more sense to use spaces to indent. Lisp is a particular example, and emacs's default behaviour of converting tabs into spaces is frankly horrific. I've taken the below code from acdw to use spaces in these modes. +;; Indenting lisp with tabs is horrible. H/t acdw (defvar space-indent-modes '(emacs-lisp-mode lisp-interaction-mode lisp-mode @@ -593,7 +570,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (setq indent-tabs-mode (if (apply #'derived-mode-p space-indent-modes) nil t)))) -;; I prefer to double space sentences. But it seems that most other people do not, and the sentence navigation commands still work for my sentences with this set to nil, but don't work for other people's with it set to t. There are of course some little errors with this, like ending a title with a full stop, but for the most part it's fine. +;; Make sentence navigation commands work for people who are wrong (setopt sentence-end-double-space nil) ;; If i write a script, i will always run chmod +x after saving it. This command means i don't have to do that. @@ -607,12 +584,11 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." window-resize-pixelwise t frame-resize-pixelwise t) -;;; Keybindings ;; Zap up to char (global-set-key (kbd "M-z") 'zap-up-to-char) ;; Insert date and time at point -;; Sometimes it's useful to be able to add a timestamp. I use this for notes. Currently it's bound to as that's what notepad uses. +;; Sometimes it's useful to be able to add a timestamp. I use this for notes. Use the same binding as notepad.exe. (defun noa/insert-date-time () (interactive) (insert (format-time-string "<%Y-%m-%d>"))) @@ -644,8 +620,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; My computer has a small screen, so i find that it's more beneficial for me to split the frame into columns, so i get more context. However, splitting in this way only gives me a (window-width) of 61, so emacs will always split into vertically stacked windows. By setting this to 80, the first split should always be vertical. (setopt split-width-threshold 80) -;;; Global text search -;; Define a handy function that allows me to do a full text search of every file in my home directory. For the most part, this works well; ripgrep avoids binary files. However, in some files with embedded images, it can add a lot of junk to the output. +;; Full text search of every file in my home directory. (defun noa/consult-rg-home () (interactive) (consult-ripgrep "~/")) @@ -678,10 +653,8 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (global-set-key (kbd "C-=") #'calc) ;;; Email -;; I like to have my email offline. Of course my preference is also to have it inside of emacs for consistency with everything else. I use some external tools to fetch and send the mail. -;; Reading mail -;; I have experimented with lots of different methods of reading mail, both in and out of emacs. But i keep coming back to rmail, despite its many, many warts. +;; I keep coming back to rmail, despite its many, many warts. (use-package rmail :custom (rmail-primary-inbox-list @@ -710,35 +683,26 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (use-package message :defer t :init -(defun noa/message-default-headers () - (format "Fcc: ~/Documents/mail/outbox/%s.mbox" - (format-time-string "%Y-%m"))) - -:custom -(message-default-headers #'noa/message-default-headers) - -;; Setting this to nil stops auto-fill from being automatically enabled in message buffers. -(message-fill-column nil) - -(user-full-name "noa") -(user-mail-address "noa@noa.pub") + (defun noa/message-default-headers () + (format "Fcc: ~/Documents/mail/outbox/%s.mbox" + (format-time-string "%Y-%m"))) -;; It's nice to have a message signature. I want the signature to be loaded from a file, which is stored in my configuration directory. -(message-signature t) -(message-signature-file "~/.config/signature") - -;; Sending mail -(message-send-mail-function 'message-send-mail-with-sendmail) -(sendmail-program (executable-find "msmtpq")) - -(message-sendmail-extra-arguments '("--read-envelope-from")) -(message-sendmail-envelope-from 'header) -(message-kill-buffer-on-exit t) -(message-sendmail-f-is-evil t) -(message-forward-as-mime t) -(message-interactive t) - -(message-auto-save-directory "~/Documents/mail/drafts")) + :custom + (message-default-headers #'noa/message-default-headers) + (message-fill-column nil) ;; Don't enable auto-fill + (user-full-name "noa") + (user-mail-address "noa@noa.pub") + (message-signature t) + (message-signature-file "~/.config/signature") + (message-send-mail-function 'message-send-mail-with-sendmail) + (sendmail-program (executable-find "msmtpq")) + (message-sendmail-extra-arguments '("--read-envelope-from")) + (message-sendmail-envelope-from 'header) + (message-kill-buffer-on-exit t) + (message-sendmail-f-is-evil t) + (message-forward-as-mime t) + (message-interactive t) + (message-auto-save-directory "~/Documents/mail/drafts")) ;; Environment variables (setenv "PAGER" "cat") @@ -748,7 +712,6 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Dictionary ;; Emacs has built in support for interfacing with dictd. With dictd and some dictionaries installed on debian, this works fine out of the box. - ;; Unfortunately, dictionaries in this format tend to be hard wrapped and there isn't a lot of coverage outside of english (setopt dictionary-search-interface nil) @@ -766,7 +729,6 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;;; Howm (use-package howm :ensure t - :init (setopt howm-view-title-header "#") @@ -779,11 +741,10 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (howm-view-use-grep t) (howm-view-grep-command "ugrep") - ;; Don't show the file name - (howm-view-summary-format "") + (howm-view-summary-format "") ;; Don't show the file name - ;; Rename buffers to their title - :hook ((howm-mode . howm-mode-set-buffer-name) + + :hook ((howm-mode . howm-mode-set-buffer-name) ;; Rename buffers to their title (after-save . howm-mode-set-buffer-name)) ;; Don't clobber the help binding @@ -843,8 +804,10 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (consult-ripgrep "~/Documents/notes")) (global-set-key (kbd "C-j C-s") #'noa/consult-rg-notes) - - ;; so i can search for synonyms without using the internet (use-package wordnut - :ensure t) + :ensure t + :defer t) + +;; (profiler-stop) + -- cgit 1.4.1-2-gfad0