(Emacs/config)+display-fill-column-indicator-mode

This adds a strict column marker for the fill-column, which is nicer
than whitespace-mode's purple text marker (though I have both enabled
of course).  Turn it on for only certain modes, and set the fill
column to 80 by default but 70 in text mode buffers (because that's
what I'm used to).
This commit is contained in:
2024-06-27 02:28:54 +01:00
parent 63f048bacc
commit 2a7ba982de

View File

@@ -2157,23 +2157,26 @@ limit), so set it for specific modes need the help.
"w" #'whitespace-mode) "w" #'whitespace-mode)
:hook :hook
(before-save-hook . whitespace-cleanup) (before-save-hook . whitespace-cleanup)
(c-mode-hook . whitespace-mode) ((c-mode-hook c++-mode-hook haskell-mode-hook python-mode-hook org-mode-hook text-mode-hook)
(c++-mode-hook . whitespace-mode) . whitespace-mode)
(haskell-mode-hook . whitespace-mode)
(python-mode-hook . whitespace-mode)
(org-mode-hook . whitespace-mode)
(text-mode-hook . whitespace-mode)
:init :init
(setq whitespace-style '(face empty spaces tabs newline trailing lines-char (setq whitespace-line-column nil
tab-mark) whitespace-style '(face empty spaces tabs newline trailing lines-char
whitespace-line-column 80)) tab-mark)))
#+end_src #+end_src
** Set auto-fill-mode for all text-modes ** Filling and displaying fills
Auto fill mode automatically newlines text on 80 characters, which I like different fill-columns for different modes: text modes should
looks nice and integrates well with Evil's sentence and paragraph text really use 70 fill columns while code should stick to 80.
objects.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'text-mode-hook #'auto-fill-mode) (use-package emacs
:init
(setq-default fill-column 80)
(add-hook 'text-mode-hook (proc (setq-local fill-column 70)))
:hook
(text-mode-hook . auto-fill-mode)
((c-mode-hook c++-mode-hook haskell-mode-hook python-mode-hook
org-mode-hook text-mode-hook)
. display-fill-column-indicator-mode))
#+end_src #+end_src
** Show-paren-mode ** Show-paren-mode
Show parenthesis for Emacs Show parenthesis for Emacs