diff options
| author | Kรฉvin Le Gouguec <kevin.legouguec@gmail.com> | 2025-07-13 20:56:51 +0200 |
|---|---|---|
| committer | Kรฉvin Le Gouguec <kevin.legouguec@gmail.com> | 2025-07-13 20:56:51 +0200 |
| commit | 83e9a9a5083135cacd0a651b350d0282f1536c63 (patch) | |
| tree | 65d95ba3e430b757dd998966f02ca53f04916c00 | |
| parent | 1165856c53d605104cfe5402056af0fbbce5a681 (diff) | |
| download | dotfiles-83e9a9a5083135cacd0a651b350d0282f1536c63.tar.xz | |
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.
| -rw-r--r-- | .config/emacs/init.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 3fe49c6..1d3f1e7 100644 --- 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)) |
