Delete trailing whitespace on save

This commit is contained in:
Jeremy Dormitzer 2019-10-23 16:27:19 -04:00
parent 9da5c41d4e
commit 02b3b643fa

View File

@ -1,7 +1,7 @@
#+PROPERTY: header-args :results silent
#+PROPERTY: header-args:emacs-lisp :lexical t
This init file is based on [[https://medium.com/@CBowdon/pinching-the-best-bits-from-spacemacs-869b8c793ad3][this blog post]].
This init file is based on [[https://medium.com/@CBowdon/pinching-the-best-bits-from-spacemacs-869b8c793ad3][this blog post]].
It's meant to be loaded from init.el like so:
#+BEGIN_SRC emacs-lisp :tangle no
@ -82,6 +82,11 @@ Better keybinding.
(use-package general)
#+END_SRC
Delete trailing whitespace on save:
#+BEGIN_SRC emacs-lisp
(add-hook 'before-save-hook #'delete-trailing-whitespace)
#+END_SRC
* Which-key
`which-key` makes keybindings discoverable.
#+BEGIN_SRC emacs-lisp
@ -421,7 +426,7 @@ I put lots of stuff in Dropbox, but the actual folder location differs on my dif
(expand-file-name "~/Dropbox"))
((file-exists-p (expand-file-name "~/Dropbox (Personal)"))
(expand-file-name "~/Dropbox (Personal)"))))
#+END_SRC
Load up libraries from Dropbox, if there are any:
@ -503,7 +508,7 @@ And in some modes I want to preserve the spacebar as a leader key:
(leader-def-key "fs" 'sudo-find-file)
(leader-def-key "ft" 'auto-revert-tail-mode)
#+END_SRC
** Window commands
#+BEGIN_SRC emacs-lisp
(jdormit/define-prefix "w" "window")
@ -836,10 +841,10 @@ Always show inline images:
(,(agenda-files "notes.org") :level . 1)
(,(agenda-files "todo.org") :level . 1)))
#+END_SRC
** Todo keywords
#+BEGIN_SRC emacs-lisp
(setq org-todo-keywords
(setq org-todo-keywords
'((sequence "TODO(t)" "WAITING(w)" "|" "DONE(d)" "CANCELLED(c)")))
#+END_SRC
@ -983,7 +988,7 @@ Display inline images after executing a source block:
(add-hook 'org-babel-after-execute-hook
(lambda ()
(org-display-inline-images nil t)
(org-redisplay-inline-images)))
(org-redisplay-inline-images)))
#+END_SRC
** Images
@ -1271,7 +1276,7 @@ Configure Java project sources:
(setq lsp-java--workspace-folders
(list (expand-file-name "~/src/Automation")
(expand-file-name "~/src/AutomationSharedExecution")
(expand-file-name "~/src/AutomationPlatform")))
(expand-file-name "~/src/AutomationPlatform")))
#+END_SRC
* Python
@ -1300,7 +1305,7 @@ Integrate with pyenv:
(defun eshell/deactivate ()
(pyvenv-deactivate))
#+END_SRC
#+END_SRC
Pipenv is the Python standard dependency management/virtual environment tool. pipenv.el teaches Emacs its ways:
#+BEGIN_SRC emacs-lisp
@ -1622,7 +1627,7 @@ This mode requires that [[https://github.com/ledger/ledger][ledger]] be installe
('normal nov-mode-map "<end>" 'end-of-buffer)
('normal nov-mode-map "SPC" leader-map))
#+END_SRC
** Org mode links
First, keep a reference to filename of the .epub before nov.el blows it away:
#+BEGIN_SRC emacs-lisp
@ -1962,7 +1967,7 @@ When citing (quoting) messages in a reply, wrap them in org quote blocks instead
(defun jdormit-cite-function ()
(let ((message-yank-prefix "")
(message-yank-cited-prefix "")
(message-yank-empty-prefix ""))
(message-yank-empty-prefix ""))
(save-excursion
(message-cite-original)
(goto-char (point-max))
@ -2102,9 +2107,9 @@ I want to be able to set a custom "Referer" header by setting the variable `jdor
(method url temp-file body referer content-type) r
(let ((w3m-use-cookies
(if (should-not-set-cookie-p url jdormit/w3m-no-cookie-sites)
nil
nil
w3m-use-cookies)))
(if-let ((referer (get-referer url jdormit/w3m-referers)))
(if-let ((referer (get-referer url jdormit/w3m-referers)))
(funcall w3m-header-arguments
method
url
@ -2382,7 +2387,7 @@ Key bindings:
Use evil keybindings by default:
#+BEGIN_SRC emacs-lisp
(add-to-list 'evil-normal-state-modes 'rcirc-mode)
(add-to-list 'evil-normal-state-modes 'rcirc-mode)
#+END_SRC
* dumb-jump
@ -2421,14 +2426,14 @@ It can read email:
(setq gnus-select-method '(nnnil "")
gnus-secondary-select-methods
'((nnmaildir "jeremy@dormitzer.net"
(directory "~/.mail/jeremy-dormitzer-net"))
(directory "~/.mail/jeremy-dormitzer-net"))
(nnmaildir "jeremy@getpterotype.com"
(directory "~/.mail/jeremy-getpterotype-com"))
(nnmaildir "jeremy.dormitzer@gmail.com"
(directory "~/.mail/jeremy-dormitzer-gmail-com"))
(directory "~/.mail/jeremy-dormitzer-gmail-com"))
(nnmaildir "jdormitzer@hubspot.com"
(directory "~/.mail/jdormitzer-hubspot-com")))
mm-text-html-renderer 'gnus-w3m)
mm-text-html-renderer 'gnus-w3m)
#+END_SRC
Or Gnus can read RSS feeds directly:
@ -2528,7 +2533,7 @@ The default auto-merge time is too short.
(use-package graphviz-dot-mode
:mode (("\\.dot\\'" . graphviz-dot))
:init
(add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)))
(add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)))
#+END_SRC
** Functions
@ -2582,11 +2587,11 @@ becomes:
(lambda (child)
(format "%s" (car child)))
children)
"; "))))
"; "))))
(defun graphviz-parse-graph (graph)
"Parses a graph into nodes and edges represented in the dot language.
"Parses a graph into nodes and edges represented in the dot language.
Returns an alist ((nodes (<node strings>)) (edges (<edge strings>)))"
(when graph
(let* ((id (car graph))
@ -2645,7 +2650,7 @@ becomes:
workflows
workflows-alerts
workflows-backend
workflows-yt)
workflows-yt)
:full-and-display-names t)
:general
('normal slack-info-mode-map ",u" #'slack-room-update-messages)
@ -2664,7 +2669,7 @@ becomes:
",2" 'slack-message-embed-mention
",3" 'slack-message-embed-channel
"\C-n" 'slack-buffer-goto-next-message
"\C-p" 'slack-buffer-goto-prev-message)
"\C-p" 'slack-buffer-goto-prev-message)
('normal slack-edit-message-mode-map
",k" #'slack-message-cancel-edit
",s" #'slack-message-send-from-buffer
@ -2683,7 +2688,7 @@ becomes:
#+BEGIN_SRC emacs-lisp
(use-package matrix-client
:quelpa ((matrix-client :fetcher github :repo "alphapapa/matrix-client.el"
:files (:defaults "logo.png" "matrix-client-standalone.el.sh"))))
:files (:defaults "logo.png" "matrix-client-standalone.el.sh"))))
#+END_SRC
* EMMS
@ -2839,7 +2844,7 @@ Syntax highlighting for Dockerfiles:
"Failed to upload to s3, check *aws-s3* buffer for details")))))
#+END_SRC
* Lola
Some functions to make my day job easier.
Some functions to make my day job easier.
** Backend services
#+BEGIN_SRC emacs-lisp :lexical yes