dotfiles

🎜 Clone'em, tweak'em, stick'em in your $HOME 🎝
git clone https://git.kevinlegouguec.net/dotfiles
Log | Files | Refs | README

commit 83e9a9a5083135cacd0a651b350d0282f1536c63
parent 1165856c53d605104cfe5402056af0fbbce5a681
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sun, 13 Jul 2025 20:56:51 +0200

Add function to cycle through auto-hscroll-mode settings

And set it to current-line by default; when I only have the odd line
poking out of the window, I prefer not jerking the whole buffer
horizontally.

Should make C-c d h repeatable, someday.

Diffstat:
M.config/emacs/init.el | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/.config/emacs/init.el b/.config/emacs/init.el @@ -158,6 +158,20 @@ left-margin))) (set-window-margins window left-margin right-margin)))) +(defun my/auto-hscroll-toggle () + (interactive) + ;; Use indices to avoid confusing `if-let*' with nil. + (if-let* ((values '(nil t current-line)) + (prev (seq-position values auto-hscroll-mode)) + (next (% (1+ prev) (length values)))) + (progn + (message (concat + (propertize (format "%s" (nth prev values)) 'face 'shadow) + " β†’ " + (propertize (format "%s" (nth next values)) 'face 'bold))) + (setopt auto-hscroll-mode (nth next values))) + (error "Unknown value for auto-hscroll-mode: %s" auto-hscroll-mode))) + (defun my/kill (stuff) (kill-new stuff) (message "%s" stuff)) @@ -280,6 +294,7 @@ list and require no escaping." (my/define-prefix-command my/display-map "Keymap for display-related commands." '(("c" my/centered-mode) + ("h" my/auto-hscroll-toggle) ("l" hl-line-mode) ("n" display-line-numbers-mode) ("t" toggle-truncate-lines) @@ -751,6 +766,10 @@ UPSTREAMS is a list of fetch URLs." (my/setopt-update-list package-archives '(("melpa" . "https://melpa.org/packages/")))) +(use-package emacs + :custom + (auto-hscroll-mode 'current-line)) + (use-package calendar :custom (calendar-intermonth-text '(my/calendar-iso-week year month day))