Browse Source

More init.el changes regarding lines

master
Taylor Bockman 9 years ago
parent
commit
837105266e
  1. 29
      dotfiles/emacs.d/init.el

29
dotfiles/emacs.d/init.el

@ -29,6 +29,31 @@
(setq inhibit-splash-screen t)
;;--------------------------------------------------------------------------------------
;; Handy editor stuff
;;--------------------------------------------------------------------------------------
(defun delete-trailing-blank-lines ()
"Deletes all blank lines at the end of the file, even the last one"
(interactive)
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(delete-blank-lines)
(let ((trailnewlines (abs (skip-chars-backward "\n\t"))))
(if (> trailnewlines 0)
(progn
(delete-char trailnewlines)))))))
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Comment this if you dont mind git diffs complaining about missing ending newlines.
(setq require-final-newline t)
;; Uncomment this if you dont mind git diffs complaining about missing ending newlines.
; (add-hook 'before-save-hook 'delete-trailing-blank-lines)
;;--------------------------------------------------------------------------------------
;; Enable MELPA
;;--------------------------------------------------------------------------------------
@ -166,6 +191,10 @@
(global-set-key (kbd "C-d s") 'delete-pair)
;; Delete word
(global-set-key (kbd "C-d d") 'delete-whole-line)
;; Git utility
(global-set-key (kbd "C-m s") 'magit-status)

Loading…
Cancel
Save