ENH fix when-bin and friends indentation

This commit is contained in:
Nathan Dwarshuis 2019-10-04 10:51:56 -04:00
parent c6daf14c10
commit ed5b9f9a73
1 changed files with 181 additions and 181 deletions

View File

@ -135,17 +135,20 @@ event of an error or nonlocal exit."
(defmacro nd/when-os (os &rest body) (defmacro nd/when-os (os &rest body)
"Execute BODY if the operating system is OS. "Execute BODY if the operating system is OS.
OS is one of those in `system-type'." OS is one of those in `system-type'."
(declare (indent 1))
`(if (eq system-type ,os) (progn ,@body) `(if (eq system-type ,os) (progn ,@body)
(print "Skipping OS-restricted code"))) (print "Skipping OS-restricted code")))
(defmacro nd/when-not-os (os &rest body) (defmacro nd/when-not-os (os &rest body)
"Execute BODY if the operating system is not OS. "Execute BODY if the operating system is not OS.
OS is one of those in `system-type'." OS is one of those in `system-type'."
(declare (indent 1))
`(when (not (eq system-type ,os)) (progn ,@body) `(when (not (eq system-type ,os)) (progn ,@body)
(print "Skipping OS-restricted code"))) (print "Skipping OS-restricted code")))
(defmacro nd/when-bin (bin &rest body) (defmacro nd/when-bin (bin &rest body)
"Execute BODY if the program BIN exists." "Execute BODY if the program BIN exists."
(declare (indent 1))
`(if (executable-find ,bin) (progn ,@body) `(if (executable-find ,bin) (progn ,@body)
(print (format "Executable %s not found. Skipping." ,bin)))) (print (format "Executable %s not found. Skipping." ,bin))))
@ -2874,8 +2877,7 @@ make sizes human readable
*** mu4e attachments *** mu4e attachments
By default the included gnus-dired package does not understan mu4e, so override the existing =gnus-dired-mail-buffers= function to fix. This allows going to a dired buffer, marking files, and attaching them interactively to mu4e draft buffers. By default the included gnus-dired package does not understan mu4e, so override the existing =gnus-dired-mail-buffers= function to fix. This allows going to a dired buffer, marking files, and attaching them interactively to mu4e draft buffers.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(nd/when-bin (nd/when-bin "mu"
"mu"
;; from here: ;; from here:
;; https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html#Dired ;; https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html#Dired
(require 'gnus-dired) (require 'gnus-dired)
@ -2955,8 +2957,7 @@ Filtering is useful for obvious reasons
** mu4e ** mu4e
Since mu4e is an external program, need to check that it is installed before loading anything. Since mu4e is an external program, need to check that it is installed before loading anything.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(nd/when-bin (nd/when-bin "mu"
"mu"
(require 'mu4e) (require 'mu4e)
(defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior) (defun nd/make-mu4e-context (name dir addr smtp-srv sent-behavior)
(let ((trash (format "/%s/trash" dir)) (let ((trash (format "/%s/trash" dir))
@ -3696,8 +3697,7 @@ These are for mode-specific bindings that can/should be outside of the evil maps
;; (attnum (or attnum (mu4e~view-get-attach-num "Attachment to open" msg)))) ;; (attnum (or attnum (mu4e~view-get-attach-num "Attachment to open" msg))))
;; (mu4e-view-open-attachment-emacs msg attnum))) ;; (mu4e-view-open-attachment-emacs msg attnum)))
(nd/when-bin (nd/when-bin "mu"
"mu"
(define-key mu4e-headers-mode-map (kbd "C-c C-l") 'org-store-link) (define-key mu4e-headers-mode-map (kbd "C-c C-l") 'org-store-link)
(define-key mu4e-view-mode-map (kbd "C-c C-l") 'org-store-link)) (define-key mu4e-view-mode-map (kbd "C-c C-l") 'org-store-link))
#+END_SRC #+END_SRC