From df6595c6631442a152fbe781039a65bea4c5103a Mon Sep 17 00:00:00 2001 From: noa Date: Sun, 16 Feb 2025 16:15:33 +0800 Subject: Relocate precision scrolling configuration --- emacs/init.el | 97 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 44 insertions(+), 53 deletions(-) (limited to 'emacs') diff --git a/emacs/init.el b/emacs/init.el index 8e692d7..8cb4abf 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -65,6 +65,15 @@ (use-package emoji :bind ("C-." . emoji-search)) +;; Smooth-ish scrolling with the mouse, and smooth scrolling with C-v and M-v. Sadly it doesn't work with C-l. +(use-package pixel-scroll + :hook (after-init . pixel-scroll-precision-mode) + :custom + (pixel-scroll-precision-use-momentum t) + (pixel-scroll-precision-interpolate-page t) + :bind (([remap scroll-up-command] . pixel-scroll-interpolate-down) + ([remap scroll-down-command] . pixel-scroll-interpolate-up))) + ;; Update the calendar. We want weeks to start on a monday, the first day of the week. Holidays should be highlighted, and the date format should put the year first. (use-package calendar :defer t @@ -103,10 +112,6 @@ ;; Make tooltip information appear consistently in the echo area (setopt tooltip-mode nil) -;; Syntax highlighting -(setopt global-font-lock-mode t) -(setopt font-lock-maximum-decoration nil) - ;;; Further options (setopt inhibit-startup-screen t mouse-drag-and-drop-region nil @@ -121,8 +126,9 @@ ;; Nicer tables (use-package valign + :disabled t :after markdown-mode - :ensure t + ;; :ensure t :hook ((markdown-mode . valign-mode)) :custom @@ -131,7 +137,7 @@ ;; Markdown (use-package markdown-mode - :ensure t + ;; :ensure t :mode ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) :custom (markdown-disable-tooltip-prompt t) ; When inserting a link, only prompt for url and link text @@ -150,11 +156,10 @@ ;; A nicer package for spellchecking (use-package jinx - :ensure t + :disabled t + ;; :ensure t :hook (text-mode . jinx-mode) - :bind - ([remap ispell-word] . jinx-correct) ;; replaces ispell-word - ("C-M-$" . jinx-languages) + :commands (jinx-correct jinx-correct-all) :config (put 'jinx-overlay 'mouse-face '(jinx-misspelled highlight)) ;; Use standard mouse face for jinx overlays (add-to-list 'jinx-exclude-regexps '(t "\\cc")) ;; Don't check chinese characters @@ -182,7 +187,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (use-package browse-url :defer t :custom - (browse-url-browser-function 'eww-browse-url) + (browse-url-browser-function 'noa/record-url) (browse-url-secondary-browser-function 'browse-url-default-browser)) ;; I've had no use for cookies in eww @@ -199,7 +204,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (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)) + (shr-discard-aria-hidden t)) (use-package eww :defer t @@ -221,13 +226,7 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." :hook (prog-mode . flymake-mode)) ;; 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) - -;; 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) +(setopt cursor-type 'bar) (use-package dired :defer t @@ -235,17 +234,24 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." (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 + ;; 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. + (delete-by-moving-to-trash t) + + ;; -l is required by dired ;; -a to also show dotfiles - ;; -v to sort numebrs properly + ;; -v to sort numbers 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)) + :hook ((dired-mode . dired-hide-details-mode) + (dired-mode . hl-line-mode)) + ) ;; Show the recursive size of directories (use-package dired-du @@ -284,29 +290,12 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Don't override display actions when i manually initiate a buffer switch. (setopt switch-to-buffer-obey-display-actions t) -;; History -(setopt history-length 250 - kill-ring-max 25) - -(setopt savehist-file "~/.config/emacs/savehist") -(setopt 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)) -(setopt savehist-mode t) - -(setopt window-divider-mode t) -(setopt window-divider-default-right-width 1) -(setopt window-divider-default-bottom-width 1) -(setopt window-divider-default-places t) +(use-package frame + :hook (after-init . window-divider-mode) + :custom + (window-divider-default-right-width 1) + (window-divider-default-bottom-width 1) + (window-divider-default-places t)) ;; Taken from configuration for the vertico stack: ;; Add prompt indicator to `completing-read-multiple'. @@ -329,10 +318,13 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Hide commands in M-x which do not work in the current mode. (setopt read-extended-command-predicate 'command-completion-default-include-p) -(setopt recentf-max-menu-items 25 - recentf-save-file "~/.config/emacs/recentf" - recentf-mode t - bookmark-default-file "~/.config/emacs/bookmarks") +(use-package recentf + :hook (after-init . recentf-mode) + :custom + (recentf-max-menu-items 25) + (recentf-save-file "~/.config/emacs/recentf")) + +(setopt bookmark-default-file "~/.config/emacs/bookmarks") ;; My brain is not ready for advanced emacs undo (setopt undo-no-redo t) @@ -344,11 +336,11 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; 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/")) make-backup-files nil backup-by-copying t create-lockfiles nil - auto-save-mode t auto-save-interval 6 ;; every six keystrokes auto-save-timeout 5 ;; every 5 seconds auto-save-default nil @@ -358,7 +350,10 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; this will auto save to the current file auto-save-visited-mode t) +;; https://reeds.website/project-write-every-change-in-emacs-buffer-to-disk +;; See here for a solution using built-in functionality (use-package super-save + :disabled t :ensure t :custom (super-save-mode t) @@ -381,10 +376,6 @@ The misspelled word is taken from OVERLAY. WORD is the corrected word." ;; Always give me a line of text when i'm near the edges of the screen (setopt scroll-margin 1) -;; 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) - ;; Remember my position in files (setopt save-place-mode t) -- cgit 1.4.1-2-gfad0