diotalevi has asked for the wisdom of the Perl Monks concerning the following question:
Are there any pragmas, syntax, comments, or anything that would allow me to disable perltidy's reformatting in a region? Perltidy is fine most of the time but occasionally writes something utterly crapulous. I'd like to add my own whitespace in those cases.
I've instructed emacs to auto-tidy all the perl w/ the following code. I include it a bonus to anyone who reads this.
(defun cperl-save-buffer (&optional args) (interactive "p") (if (buffer-modified-p) (perltidy-buffer)) (save-buffer t)) (defun perltidy-buffer () (interactive) (save-excursion (shell-command-on-region (point-min) (point-max) "perltidy -st" nil t shell-command-default-error-buffer))) (add-to-list 'cperl-mode-hook (lambda () (substitute-key-definition 'save-buffer 'cperl-save-buffer cperl-m +ode-map global-map)))
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Disable perltidy in a region?
by ambrus (Abbot) on Jan 10, 2006 at 19:09 UTC | |
by RMGir (Prior) on Jan 10, 2006 at 21:28 UTC | |
by blazar (Canon) on Jan 11, 2006 at 08:35 UTC | |
Re: Disable perltidy in a region?
by chrestomanci (Priest) on Sep 10, 2013 at 15:21 UTC |
Back to
Seekers of Perl Wisdom