From 0fa579e9468d96603eda3ca7ffc95feef671c9d7 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Tue, 17 May 2022 10:30:33 -0700 Subject: [PATCH] Bring hippie-expand back I can't believe that during all my migrations I forgot to bring over the hippie. While I'm at it, let's have it work with TAB! --- ha-config.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ha-config.org b/ha-config.org index 7087961..7777261 100644 --- a/ha-config.org +++ b/ha-config.org @@ -97,6 +97,18 @@ More settings: debug-on-error t) #+END_SRC +The venerable [[help:hippie-expand][hippie-expand]] function does a better job than the default, [[help:dabbrev-expand][dabbrev-expand]], so let’s swap it out (see this [[https://www.masteringemacs.org/article/text-expansion-hippie-expand][excellent essay]] by Mickey Petersen): +#+BEGIN_SRC emacs-lisp + (global-set-key [remap dabbrev-expand] 'hippie-expand) +#+END_SRC +Details? Check out its [[help:hippie-expand-try-functions-list][list of expanders]]. + +What would be /really nice/ is to have it bound to ~TAB~ instead of the default ~M-/~. Normally, ~TAB~ re-indents the line, but I find that I usually want that feature when I’m in Evil’s =normal state= and hit the ~=~ key, so changing this sounds good. But why not /have both/? +#+BEGIN_SRC emacs-lisp + (advice-add #'indent-for-tab-command :after #'hippie-expand) +#+END_SRC +Now while we’re typing along, we can hit the ~TAB~ key after partially typing a word to have it completed. + Save the file whenever I move away from Emacs (see [[https://irreal.org/blog/?p=10314][this essay]]): #+BEGIN_SRC emacs-lisp (defun save-all-buffers ()