Get rid of tabs!
After a few Gerrit changesets showed tabs, I realized that I should have Emacs remove tabs along with trailing whitespace.
This commit is contained in:
parent
537aa04aff
commit
6d7b9facd1
1 changed files with 38 additions and 26 deletions
|
@ -247,16 +247,27 @@ Let's turn off the menu and other settings:
|
||||||
(horizontal-scroll-bar-mode -1)
|
(horizontal-scroll-bar-mode -1)
|
||||||
(setq visible-bell 1))
|
(setq visible-bell 1))
|
||||||
#+end_src
|
#+end_src
|
||||||
I dislike forgetting to trim trailing white-space:
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
I like being able to enable local variables in =.dir-local.el= files:
|
I like being able to enable local variables in =.dir-local.el= files:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq enable-local-variables t)
|
(setq enable-local-variables t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** Changes on Save
|
||||||
|
Always spaces and never tabs. Note that we use =setq-default= since [[elisp:(describe-variable 'indent-tabs-mode)][indent-tabs-mode]] is a /buffer-local/ variable, meaning that if we set it with =setq=, it will only be set in /that buffer file/. We want this globally the default:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
When I push changes to my files to Gerrit and other code review, I don’t want trailing spaces or any tabs to appear, so let’s fix all files when I [[elisp:(describe-variable 'before-save-hook)][save them]]:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun ha-cleanup-buffer-file ()
|
||||||
|
"Cleanup a file, often done before a file save."
|
||||||
|
(interactive)
|
||||||
|
(untabify (point-min) (point-max)
|
||||||
|
(delete-trailing-whitespace)))
|
||||||
|
|
||||||
|
(add-hook 'before-save-hook #'ha-cleanup-buffer-file)
|
||||||
|
#+end_src
|
||||||
** Completing Read User Interface
|
** Completing Read User Interface
|
||||||
After using Ivy, I am going the route of a =completing-read= interface that extends the original Emacs API, as opposed to implementing backend-engines or complete replacements.
|
After using Ivy, I am going the route of a =completing-read= interface that extends the original Emacs API, as opposed to implementing backend-engines or complete replacements.
|
||||||
*** Vertico
|
*** Vertico
|
||||||
|
@ -1437,6 +1448,7 @@ I also need to append the following to my [[file:~/.gitconfig][~/.gitconfig]] fi
|
||||||
plus-emph-style = syntax "#009000"
|
plus-emph-style = syntax "#009000"
|
||||||
plus-empty-line-marker-style = normal "#006800"
|
plus-empty-line-marker-style = normal "#006800"
|
||||||
#+end_src
|
#+end_src
|
||||||
|
#+end_src
|
||||||
*** Time Machine
|
*** Time Machine
|
||||||
The [[https://github.com/emacsmirror/git-timemachine][git-timemachine]] project visually shows how a code file changes with each iteration:
|
The [[https://github.com/emacsmirror/git-timemachine][git-timemachine]] project visually shows how a code file changes with each iteration:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
Loading…
Reference in a new issue