egor7
egor7

Reputation: 4941

How to apply changes to emacs .el files

How to apply changes to emacs .el files?

I've done the following:

  1. # locate buff-menu

/usr/share/emacs/22.1/lisp/buff-menu.el.gz
/usr/share/emacs/22.1/lisp/buff-menu.elc

  1. Modify /usr/share/emacs/22.1/lisp/buff-menu.el.gz - add some custom letters in Buffer-menu-select doc section.

  2. # rm /usr/share/emacs/22.1/lisp/buff-menu.elc

  3. Byte compile /usr/share/emacs/22.1/lisp/buff-menu.el.gz

Start emacs and see old description for Buffer-menu-select

Upvotes: 2

Views: 871

Answers (1)

Rémi
Rémi

Reputation: 8332

We could more easily answer you if you tell us what exactly you want to do. The fact is the correct way to customize Emacs is never to change the .el in Emacs system libraries.

  • to change a defun you can:

    • use an advice (look at the documentation of defadvice)
    • use a new defun that you will eval in an eval-after-load

      (eval-after-load 'buff-menu
         '(defun Buffer-menu-mark ()
             "do nothing"
             (interactive)))
      
  • to add a key binding you can again use eval-after-load:

        (eval-after-load 'buff-menu
           '(define-key Buffer-menu-mode-map "M" 'Buffer-menu-mark))
    

Upvotes: 8

Related Questions