Skip to content

Instantly share code, notes, and snippets.

@autarch
Created June 6, 2012 15:08
Show Gist options
  • Save autarch/2882455 to your computer and use it in GitHub Desktop.
Save autarch/2882455 to your computer and use it in GitHub Desktop.
(defun my-perltidy-command ()
(concat "my-perltidy "
(cond
((buffer-file-name) (file-truename buffer-file-name))
(t ""))))
(defun perltidy-region ()
"Run perltidy on the current region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) (my-perltidy-command) 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) (my-perltidy-command) nil t)
)
(goto-char p)
(cperl-mode)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment