Created
August 17, 2009 09:24
-
-
Save yaotti/169020 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; perl tidy | |
;; http://blog.nqou.net/2006/11/20225449.html | |
(defun perltidy-region () | |
"Run perltidy on the current region." | |
(interactive) | |
(save-excursion | |
(shell-command-on-region (point) (mark) "perltidy -q" nil t))) | |
(defun perltidy-defun () | |
"Run perltidy on the current defun." | |
(interactive) | |
(save-excursion (mark-defun) | |
(perltidy-region))) | |
(defun perltidy-whole-buffer () | |
"Run perltidy on the current buffer." | |
(interactive) | |
(save-excursion | |
(mark-whole-buffer) | |
(shell-command-on-region (point) (mark) "perltidy -q" nil t))) | |
(add-hook 'cperl-mode-hook | |
'(lambda() | |
(progn | |
(setq cperl-indent-level 4) | |
(define-key cperl-mode-map "\C-ct" 'perltidy-whole-buffer) | |
(flymake-mode t)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment