in reply to (OT) emacs perl tweaks -- help sought w/ emacs lisp
Another possibility might be to use one of the hooks run before and after running mode-compile but after looking at the code I can't find an obvious way.
As to your second question you're probably interested in using the emacs-feature where you can pass a region or a buffer to a shell command and replace the region/buffer with the result of that command. This can also be used for sorting lines for example.
This call would look like this:
Here C-x h should mark the whole buffer, the prefix argument C-u enables the replacement of the region and finally M-| calls the function shell-command-on-region which asks for the command to use. Unfortunately I don't have perltidy at hand to test it.C-x h C-u M-| perltidy
Putting all this into a single function which can be bound to a key would be like:
And then:(defun my-perltidy () "Call perltidy on the current buffer. This replaces the current content of the buffer with the output of the perltidy programm. You must have perltidy installed. See http://perlmonks.org/?node_id=399154 for the start of this." (interactive) (when (yes-or-no-p "Really run perltidy? ") (goto-char (point-min)) (shell-command-on-region (point-min) (point-max) "perltidy" nil t)))
or something like that.(add-hook 'cperl-mode-hook '(lambda () (local-set-key '[(control c) (control t)] 'my-perltidy)))
Please note, that I use XEmacs, but this code should be usable on both emacsen, I guess
Update Thu Oct 14 14:15:41 CEST 2004: Added note on emacs-version
Regards... | Stefan |
you begin bashing the string with a +42 regexp of confusion |
|
---|