http://qs1969.pair.com?node_id=522285

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)))