In an answer, I noticed:
;; Align with spaces only
(defadvice align-regexp (around align-regexp-with-spaces)
"Never use tabs for alignment."
(let ((indent-tabs-mode nil))
ad-do-it))
(ad-activate 'align-regexp)
This sounds promising, but… what does it do?!
I tried eval-region on the block of code. But for me, all it does is adding the following to the align-regexp docs:
This function is advised.
Around-advice `align-regexp-with-spaces’:
Never use tabs for alignment.
I don’t seem to be able to actually use align-regexp-with-spaces, if that’s what should be the effect… What am I missing?
I used GNU Emacs version 24.0.96.1 (i386-mingw-nt6.1.7601).
While asking this question, I realized that I just didn’t get the idea of advising functions.
It became clear to me that:
align-regexp-with-spacesisn’t a function nor a variable but only a name (to enable/disable single pieces of advice)(ad-activate 'align-regexp),align-regexpjust does what I ‘advised’ it to: not to use tabsSo:
ad-activateactivates the advice, effectively changing the original function’s behavior. Great!I don’t get why this is ‘better’ than defining a function around
align-regexpthough. But then again I don’t know much about Emacs Lisp.I’m afraid the extra lines of documentation only added to the confusion…