Hot answers tagged

3

(advice-add #'undo-tree :filter-return #'undo-tree-advice-history-save-file-name) This advises the function undo-tree, whereas the defadvice form advises undo-tree-make-history-save-file-name. The equivalent advice-add would be (advice-add 'undo-tree-make-history-save-file-name :filter-return #'undo-tree-advice-history-save-file-name)


1

As npostavs explains in a comment, the noninteractive suggestion is to do: (defun foo (&optional interactivep) (interactive "p") ... ...use `interactivep' when you want to know if the call was interactive. ...) which corresponds to (called-interactive-p 'any) or (defun foo (&optional interactivep) (interactive (list (not (or executing-...


1

I tried pp-macroexpand-last-sexp on define-advice block and it turns out that I was right, it is a macro that uses advice-add behind the scenes, but it implicitly creates a defun (since using lambdas for hooks and advising is a "no-no"), so you don't have to do it yourself. It's confusing because frankly define-advice doesn't seem to reduce the code that ...


1

Yes, it's normal. The code is byte-compiled on the fly. See nadvice.el (advice-p, for example). Because of this it can help to give a piece of advice a user-friendly name, which can kind of describe it. FWIW, you might want to take a look at the dynamic Isearch filtering available with Isearch+. It gives you easy ways to add, combine, and remove Isearch ...


1

Untested, but your (interactive) form doesn't tell Emacs how to obtain the FUNCTION argument, so that's presumably your problem.


Only top voted, non community-wiki answers of a minimum length are eligible