Skip to main content
1 of 3
Constantine
  • 9.2k
  • 1
  • 36
  • 50

I agree that using advice is probably the way to go, but if you really, truly have to, you can use something like this. (Comments are welcome.)

(defun third-party-func ()
  (message "original"))

(setf (symbol-function 'third-party-func-original)
      (symbol-function 'third-party-func))

(defun third-party-func ()
  (message "new!")
  (third-party-func-original))

; now (third-party-func) calls the patched version;
; (third-party-func-original) calls the original version
Constantine
  • 9.2k
  • 1
  • 36
  • 50