Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.04 KB

20210408090222-overriding_package_functions_in_emacs.org

File metadata and controls

28 lines (20 loc) · 1.04 KB

Overriding package functions in emacs

eval-after-load

See this StackOverflow answer.

One option is to redefine the function after the package is loaded. So, use eval-after-load.

This is how I overrode rspec-mode’s function to use spring by only checking the flag rather than all the additional PID checking it was originally doing. I did this so I could more easily use with Docker.

(eval-after-load 'rspec-mode
  '(defun rspec-spring-p () 'rspec-use-spring-when-possible)
  )

Advising Functions is more appropriate for adding callbacks to existing behavior. More about this in Emacs cheatsheet.