1

I have a perltidy-mode.el lisp file, which is being loaded - I can call it manually by M-x perltidy-mode.

What would be the proper way to run it automatically after a file is opened (or emacs is loaded)?

(defalias 'perl-mode 'cperl-mode)
(defalias 'perl-mode 'perltidy-mode)

doesn't seem to work.


It seems I've forgotten a lot of lisp/emacs

katspaugh
  • 17,449
  • 11
  • 66
  • 103
vol7ron
  • 40,809
  • 21
  • 119
  • 172

1 Answers1

1

If you would like to activate it for every opened perl file, you can add it to a hook:

(defun my-perl-hook ()
  (perltidy-mode 1))
(add-hook 'perl-mode-hook 'my-perl-hook)

Note: I know nothing about this mode, or about the different perl modes, so you might to add your function to other hooks as well.

Lindydancer
  • 25,428
  • 4
  • 49
  • 68
  • I gave it a try but no luck, even tried adding the hook to the eval-after-load, but that didn't seem to work. I might be out of luck on this – vol7ron Nov 20 '12 at 16:31
  • A made a typo (a `-hook` was missing). Also, if you are using CPerl mode, try `(add-hook 'cperl-mode-hook 'my-perl-hook)`. – Lindydancer Nov 20 '12 at 16:50