-;; Time-stamp: <2017-02-14 16:26:19 kmodi>
+;; Time-stamp: <2017-02-21 15:57:21 kmodi>
 
 ;; Functions related to editing text in the buffer
 ;; Contents:

        ;; Also set the value of modi/org-capture-buffer-file-name back to nil
        ;; to prevent false executions of this `when' form.
        (setq modi/org-capture-buffer-file-name nil)))
    (delete-trailing-whitespace (point-min) (line-beginning-position))
    ;; Below, the END argument is left nil so that trailing empty lines are
    ;; also deleted if `delete-trailing-lines' is non-nil.
    (delete-trailing-whitespace (line-end-position))))
(add-hook 'before-save-hook #'modi/delete-trailing-whitespace-buffer)

;;; Untabify


;; http://stackoverflow.com/a/35781486/1219634
(defun modi/delete-trailing-whitespace-buffer ()
  "Delete trailing whitespace in the whole buffer.

If the major-mode is org-mode, and if the point is after a heading or list
marker, do that in the whole buffer *except* on the current line. The reason is
that if I am about to type a heading (\"* |\"), and if I save the file, I do not
want my cursor to move back (\"*|\").

Do not do anything if `do-not-delete-trailing-whitespace' is non-nil."
  (interactive)
