Browse Source

Make whitespace trimming work right with ws-butler

master
Taylor Bockman 7 years ago
parent
commit
7d48151628
  1. 28
      dotfiles/emacs.d/init.el
  2. 4
      dotfiles/emacs.d/package.el

28
dotfiles/emacs.d/init.el

@ -70,8 +70,7 @@
;; Stuff all of the org files you want under ~/org and they will be loaded automatically
;; and have their TODO items accessible by typing C-c a t
(setq org-agenda-files '("~/org"))
(
setq org-log-done t)
(setq org-log-done t)
;;--------------------------------------------------------------------------------------
;; Prefer unix style line endings
@ -117,8 +116,9 @@ setq org-log-done t)
("Text" (or (filename . ".csv")
(filename . ".tsv")
(filename . ".txt")
(filename . ".log")))
(filename . ".log")
(filename . ".json")))
("Emacs" (or (name . "^\\*scratch\\*$")
(name . "^\\*Messages\\*$")))
("Gnus" (or (mode . message-mode)
@ -148,28 +148,12 @@ setq org-log-done 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)
(add-hook 'before-save-hook 'delete-trailing-blank-lines)
(require 'ws-butler)
(ws-butler-global-mode)
;; 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)
;; Add new line if using C-n navigates to the end of the buffer
(setq next-line-add-newlines t)

4
dotfiles/emacs.d/package.el

@ -25,6 +25,10 @@
neotree
;;;;;;;;;;;;;
;; Cleanup
ws-butler
;;;;;;;;;;
;; UI
fill-column-indicator
golden-ratio

Loading…
Cancel
Save