[Misc] Introduce variable ‘on-windows’

to increase readability
This commit is contained in:
Daniel - 2017-11-11 09:06:41 +01:00
parent 1318b74c61
commit 139862d66d
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
3 changed files with 12 additions and 9 deletions

13
init.el
View File

@ -262,7 +262,7 @@ _h_ _l_ _o_k _y_ank
;; Environment Variables
(unless (memq system-type '(windows-nt cygwin))
(unless on-windows
(ignore-errors
(exec-path-from-shell-copy-envs '("SSH_AUTH_SOCK"
"SSH_AGENT_PID"
@ -281,7 +281,7 @@ _h_ _l_ _o_k _y_ank
;; Start Server when on Windows
(when (memq system-type '(windows-nt cygwin))
(when on-windows
(server-start))
t)
@ -307,6 +307,9 @@ _h_ _l_ _o_k _y_ank
:group 'help
:tag "Personal settings")
(defconst on-windows (memq system-type '(windows-nt cygwin))
"Non-nil if and only if this instance of Emacs runs on Windows.")
;; * Builtin Variables
@ -360,7 +363,7 @@ _h_ _l_ _o_k _y_ank
x-underline-at-descent-line t
search-whitespace-regexp "[ \t\r\n]+")
(when (memq system-type '(windows-nt cygwin))
(when on-windows
;; treat memory for display time ... but hey, this is Windows, memory doesnt
;; matter!
(setq inhibit-compacting-font-caches t))
@ -714,7 +717,7 @@ Certificates are assumed to be of the form *.crt."
(dolist (extension '(".out" ".synctex.gz" ".thm"))
(add-to-list 'dired-latex-unclean-extensions extension))
(if (memq system-type '(windows-nt cygwin))
(if on-windows
(setq dired-guess-shell-alist-user
'(("\\.pdf\\'" "cmd /c")
("\\.docx\\'" "cmd /c")
@ -766,7 +769,7 @@ Certificates are assumed to be of the form *.crt."
(error "No more than 2 files should be marked"))))
(require 'dired-quick-sort)
(when (eq system-type 'windows-nt)
(when on-windows
(setq ls-lisp-use-insert-directory-program t))
(dired-quick-sort-setup)

View File

@ -105,7 +105,7 @@ that we also follow symbolic links."
(point-max))
"\n"))))
(unless (memq system-type '(windows-nt ms-dos))
(unless on-windows
(setq emms-source-file-directory-tree-function
#'db/emms-source-file-directory-tree-find))

View File

@ -329,9 +329,9 @@ path."
(defun db/system-open (path)
"Open PATH with default program as defined by the underlying system."
(ecase system-type
((windows-nt cygwin) (w32-shell-execute "open" path))
((gnu/linux) (start-process "" nil "xdg-open" path))))
(if on-windows
(w32-shell-execute "open" path)
(start-process "" nil "xdg-open" path)))
(defvar db/helm-source-important-documents
'((name . "Important files")