diff options
author | Case Duckworth | 2021-02-03 12:49:09 -0600 |
---|---|---|
committer | Case Duckworth | 2021-02-03 12:49:09 -0600 |
commit | 773255857f68f2870c9a1dd1de1584d972022356 (patch) | |
tree | 243ee6a66b9fe854431b141748494636713babf4 | |
parent | Change elfeed entry pane position (diff) | |
download | emacs-773255857f68f2870c9a1dd1de1584d972022356.tar.gz emacs-773255857f68f2870c9a1dd1de1584d972022356.zip |
Change visual-fill-column and visual-line modes
-rw-r--r-- | config.org | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/config.org b/config.org index 21120c6..41eec49 100644 --- a/config.org +++ b/config.org | |||
@@ -210,26 +210,6 @@ This is extremely fiddly and I'd love another option. | |||
210 | (define-key acdw/map (kbd "M-o") #'crux-other-window-or-switch-buffer) | 210 | (define-key acdw/map (kbd "M-o") #'crux-other-window-or-switch-buffer) |
211 | #+end_src | 211 | #+end_src |
212 | 212 | ||
213 | *** Visual fill column mode | ||
214 | |||
215 | In reading-intensive views, this mode keeps the text from getting too | ||
216 | wide. | ||
217 | |||
218 | #+begin_src emacs-lisp :noweb-ref packages | ||
219 | (straight-use-package 'visual-fill-column) | ||
220 | #+end_src | ||
221 | |||
222 | #+begin_src emacs-lisp :noweb-ref settings | ||
223 | (setq-default visual-fill-column-center-text t) | ||
224 | #+end_src | ||
225 | |||
226 | #+begin_src emacs-lisp :noweb-ref hooks | ||
227 | (add-hook 'visual-line-mode-hook #'visual-fill-column-mode) | ||
228 | |||
229 | (with-eval-after-load 'visual-fill-column | ||
230 | (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) | ||
231 | #+end_src | ||
232 | |||
233 | *** The *Help* window | 213 | *** The *Help* window |
234 | 214 | ||
235 | I want to select the *Help* window by default, so I can easily quit it. | 215 | I want to select the *Help* window by default, so I can easily quit it. |
@@ -1270,30 +1250,13 @@ that's the only time I accidentally call it, anyway. | |||
1270 | 1250 | ||
1271 | *** Auto-fill vs. Visual-line | 1251 | *** Auto-fill vs. Visual-line |
1272 | 1252 | ||
1273 | I've mostly been using visual-line mode, and it's been pretty good. | 1253 | 1. Enable =auto-fill-mode= with text modes. |
1274 | There are some times, however, when lines are just ... really long, | ||
1275 | and they wrap weird or whatever. Not to mention, in Org mode, | ||
1276 | =visual-line-mode= screws up the bindings for line movement. So | ||
1277 | here's what I'm going to do. | ||
1278 | |||
1279 | 1. Enable =visual-line-mode= with =text-mode=, but /not/ with | ||
1280 | =org-mode=. | ||
1281 | |||
1282 | #+begin_src emacs-lisp :noweb-ref hooks | ||
1283 | (defun hook--visual-line-mode () | ||
1284 | (unless (eq major-mode 'org-mode) | ||
1285 | (visual-line-mode +1))) | ||
1286 | |||
1287 | (add-hook 'text-mode-hook #'hook--visual-line-mode) | ||
1288 | #+end_src | ||
1289 | |||
1290 | 2. Enable =auto-fill-mode= with text modes. | ||
1291 | 1254 | ||
1292 | #+begin_src emacs-lisp :noweb-ref hooks | 1255 | #+begin_src emacs-lisp :noweb-ref hooks |
1293 | (add-hook 'text-mode-hook #'auto-fill-mode) | 1256 | (add-hook 'text-mode-hook #'auto-fill-mode) |
1294 | #+end_src | 1257 | #+end_src |
1295 | 1258 | ||
1296 | 3. /Just/ in case ... let's "fix" =visual-line-mode= if we're in =org-mode=. | 1259 | 2. /Just/ in case ... let's "fix" =visual-line-mode= if we're in =org-mode=. |
1297 | 1260 | ||
1298 | #+begin_src emacs-lisp :noweb-ref hooks | 1261 | #+begin_src emacs-lisp :noweb-ref hooks |
1299 | (defun hook--visual-line-fix-org-keys () | 1262 | (defun hook--visual-line-fix-org-keys () |
@@ -1310,6 +1273,26 @@ I think that'll work -- I only care about line aesthetics with text. | |||
1310 | Programming modes should be /allowed/ to have long lines, regardless | 1273 | Programming modes should be /allowed/ to have long lines, regardless |
1311 | of how /terrible/ it is to have them. | 1274 | of how /terrible/ it is to have them. |
1312 | 1275 | ||
1276 | *** Visual fill column mode | ||
1277 | |||
1278 | In reading-intensive views, this mode keeps the text from getting too | ||
1279 | wide. | ||
1280 | |||
1281 | #+begin_src emacs-lisp :noweb-ref packages | ||
1282 | (straight-use-package 'visual-fill-column) | ||
1283 | #+end_src | ||
1284 | |||
1285 | #+begin_src emacs-lisp :noweb-ref settings | ||
1286 | (setq-default visual-fill-column-center-text t) | ||
1287 | #+end_src | ||
1288 | |||
1289 | #+begin_src emacs-lisp :noweb-ref hooks | ||
1290 | (add-hook 'visual-fill-column-mode-hook #'visual-line-mode) | ||
1291 | |||
1292 | (with-eval-after-load 'visual-fill-column | ||
1293 | (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) | ||
1294 | #+end_src | ||
1295 | |||
1313 | *** Stay snappy with long-lined files | 1296 | *** Stay snappy with long-lined files |
1314 | 1297 | ||
1315 | #+begin_src emacs-lisp :noweb-ref modes | 1298 | #+begin_src emacs-lisp :noweb-ref modes |