Skip to content

Instantly share code, notes, and snippets.

@ocharles
Created April 1, 2010 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ocharles/351889 to your computer and use it in GitHub Desktop.
Save ocharles/351889 to your computer and use it in GitHub Desktop.
(require 'cperl-mode)
(require 'magit)
(require 'uniquify)
(define-key global-map (kbd "C-C a") 'align-regexp)
;; Nice little hack I found in jrockway's .emacs
(defun delete-trailing-whitespace-nothere ()
"Delete trailing whitespace, except on the current line if it is all whitespace."
(interactive)
(let (current-whitespace)
(when (save-excursion
(beginning-of-line)
(looking-at "\\([[:space:]]+\\)$"))
(setq current-whitespace (match-string 0)))
(delete-trailing-whitespace)
(save-excursion
(beginning-of-line)
(when current-whitespace
(insert current-whitespace)))
(when current-whitespace
(end-of-line))))
(add-hook 'before-save-hook 'delete-trailing-whitespace-nothere)
(defalias 'perl-mode 'cperl-mode)
(add-to-list 'auto-mode-alist '("\\.t$" . cperl-mode))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(backward-delete-char-untabify-method (quote hungry))
'(cperl-auto-newline t)
'(cperl-brace-offset -4)
'(cperl-close-paren-offset -4)
'(cperl-continued-statement-offset 4)
'(cperl-indent-level 4)
'(cperl-indent-parens-as-block t)
'(cperl-under-as-char t)
'(indent-tabs-mode nil))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment