good chemistry is complicated,
and a little bit messy -LW
Re: (OT) emacs perl tweaks -- help sought w/ emacs lispby stefan k (Curate)
|on Oct 14, 2004 at 12:13 UTC||Need Help??|
first, as I posted before, although I really appreciate when someone writes code in elisp (even if it were just for the fun in it ;-) I suggest using the function cperl-check-syntax which invokes mode-compile which is quite clever. One gain would be that you can jump to errors found my that process directly. Another gain would be the customizability of mode-compile. There is one variable called mode-compile-other-frame-p which could be used to achieve your first goal in a way: simply let it use a different frame (known as "window" to all other users ;-) and hide that frame somewhere on your desktop where it won't get in your way.
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.
Putting all this into a single function which can be bound to a key would be like:
or something like that.
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