From 76ac2d34a4ff36bb6dec929869d533c0de2038de Mon Sep 17 00:00:00 2001 From: noa@gaiwan.org Date: Sun, 23 Jun 2024 18:00:05 +0000 Subject: Add configuration for elastic-table-mode --- config.org | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'config.org') diff --git a/config.org b/config.org index d92b969..2944ce8 100644 --- a/config.org +++ b/config.org @@ -935,7 +935,6 @@ I find it useful to see the recursive sizes of directories. This can be a littl #+end_src ** Indentation: tabs and whitespace settings - In general, my rules for inserting tabs are that the tab key should insert tabs. I personally prefer tabs to spaces, because tabs work reasonably well whatever font or tab width one chooses to set, whereas spaces are the same width for everyone, except when someone uses a proportional font in which case they are narrower than expected. Furthermore, people tend to use spaces for alignment, which looks bad when you can't rely on every character being the same width. However, i'm in the minority, and fighting with the very complicated emacs indentation systems is simply not fun. That said, i refuse to use a monospaced font. Luckily the minority is more than one and someone has already done the hard work for me of writing a mode to make spaces for indentation work reasonably well with a proportional font. That mode is elastic-indent-mode, and it very simply makes leading whitespace characters the same width as the characters on the line above. It's a simple solution but most of the time it does what i want. @@ -945,6 +944,13 @@ However, i'm in the minority, and fighting with the very complicated emacs inden (add-hook 'prog-mode-hook #'elastic-indent-mode) #+end_src +Elastic-table-mode is similar; for tab characters within lines, ensure that they change width to make subsequent lines form a table-like layout. + +#+begin_src elisp + (require 'elastic-table) + (add-hook 'prog-mode-hook #'elastic-table-mode) +#+end_src + Previously i used a function to naïvely copy the whitespace from the line above. This is the way that vi, nano, and acme all implement auto-indentation. However, for now i'm experimenting with using the built-in indentation functions again. I'm leaving this defun here for posterity. #+begin_src elisp :tangle no -- cgit 1.4.1-2-gfad0