I noticed this on the CPAN radar today:
perl-tidy-mode
From the docs it sounds like it runs perltidy when you save your file. That doesn't sound terrible, but I like my solution better. I have bindings so I can run perltidy on-demand, either on the whole file or on a particular region. Check it:
(defun perltidy-region () "Run perltidy on the current region." (interactive) (save-excursion (shell-command-on-region (point) (mark) "perltidy -q" nil t) (cperl-mode))) (defun perltidy-all () "Run perltidy on the current region." (interactive) (let ((p (point))) (save-excursion (shell-command-on-region (point-min) (point-max) "perltidy -q" nil t) ) (goto-char p) (cperl-mode))) (global-set-key "\M-t" `perltidy-region) (global-set-key "\M-T" `perltidy-all)
-sam
(defun perltidy ()
"Run perltidy on the current region or buffer."
(interactive)
(save-excursion
(unless mark-active (mark-defun))
(shell-command-on-region (point) (mark) "perltidy -q" nil t)))
-Dom
Re:My version.
Dom2 on 2006-07-06T17:00:47
Nope, it doesn't run over the whole file by default. I'll have to make it do that.-Dom