How to override functions in emacs lisp for a specific mode?

How can I override the emacs function with my own implementation for a specific mode? example / link will be great

thanks

+6
function override emacs lisp
source share
1 answer

It seems strange that you want to do it, but you could do it by recommending a function, I suppose. Example:

(defadvice * (around ultimate-answer activate) (if (and (eq major-mode 'html-mode) (equal (ad-get-args 0) '(6 9))) (setq ad-return-value 42) ad-do-it)) 

After evaluating this advice, the * function will return 42 if it is given two arguments 6 and 9, but only in html-mode.

+9
source share

All Articles