Can someone explain and show the right/preferred way of advising functions in Emacs these days.
Official documentation says to use
advice-add, but I've seen people using
define-advice and I checked, they are both part of
nadvice.el (which is as I understood ships with Emacs).
I'm not sure, but If I remember it right I think there were more ways to advice (some of them are now considered obsolete).
Also it's known that using lambdas to add hooks is kinda frowned upon. Is that the same for advising? Then why something like this is okay (or is it?):
(define-advice mu4e~stop (:after nil kill-mu4e-layout-after-mu4e~stop) (when mu4e-spacemacs-kill-layout-on-exit (persp-kill mu4e-spacemacs-layout-name)))
define-advice is a macro that uses
advice-add behind the scenes, but I don't see how it makes it easier to advise functions, what am I missing?
This all is very confusing.