added os-restriction macros

This commit is contained in:
ndwarshuis 2019-03-11 18:50:41 -04:00
parent 2324fac7d0
commit b82bdedb81
1 changed files with 10 additions and 0 deletions

View File

@ -107,6 +107,16 @@ event of an error or nonlocal exit."
,@(mapcar (lambda (adform) ,@(mapcar (lambda (adform)
`(advice-remove ,(car adform) ,(nth 2 adform))) `(advice-remove ,(car adform) ,(nth 2 adform)))
adlist)))) adlist))))
(defmacro nd/when-os (os &rest body)
"Execute BODY if the operating system is OS.
OS is one of those in `system-type'."
`(when (eq system-type os) ,@body))
(defmacro nd/when-not-os (os &rest body)
"Execute BODY if the operating system is not OS.
OS is one of those in `system-type'."
`(when (not (eq system-type os)) ,@body))
#+END_SRC #+END_SRC
** functions ** functions
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp