refactor!: deprecate IS-* OS constants
BREAKING CHANGE: This deprecates the IS-(MAC|WINDOWS|LINUX|BSD) family of global constants in favor of a native `featurep` check: IS-MAC -> (featurep :system 'macos) IS-WINDOWS -> (featurep :system 'windows) IS-LINUX -> (featurep :system 'linux) IS-BSD -> (featurep :system 'bsd) The constants will stick around until the v3 release so folks can still use it -- and there are still some modules that use it, but I'll phase those uses out gradually. Fix: #7479
This commit is contained in:
parent
d38787edf4
commit
659f7bfc71
52 changed files with 150 additions and 120 deletions
|
@ -379,7 +379,7 @@ Or to create aliases for functions that behave differently:
|
|||
"C-x C-r" 'a-global-keybind
|
||||
:g "C-x C-r" 'another-global-keybind ; same as above
|
||||
|
||||
(:when IS-MAC
|
||||
(:when (featurep :system 'macos)
|
||||
:n "M-s" 'some-fn
|
||||
:i "M-o" (cmd! (message "Hi"))))
|
||||
|
||||
|
@ -604,7 +604,7 @@ These are side-by-side comparisons, showing how to bind keys with and without
|
|||
;;helm
|
||||
|
||||
:tools
|
||||
(:if IS-MAC macos)
|
||||
(:if (featurep :system 'macos) macos)
|
||||
docker
|
||||
lsp
|
||||
|
||||
|
@ -617,7 +617,7 @@ These are side-by-side comparisons, showing how to bind keys with and without
|
|||
((string= system-name "writing-pc")
|
||||
(org +dragndrop)
|
||||
ruby))
|
||||
(:if IS-LINUX
|
||||
(:if (featurep :system 'linux)
|
||||
(web +lsp)
|
||||
web)
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ declaration) or dependency thereof that hasn't already been."
|
|||
;; variables entry is missing the suffix" errors when
|
||||
;; installing them (see hlissner/doom-emacs#2637), so
|
||||
;; have git handle conversion by force.
|
||||
(when (and IS-WINDOWS (stringp local-repo))
|
||||
(when (and doom--system-windows-p (stringp local-repo))
|
||||
(let ((default-directory (straight--repos-dir local-repo)))
|
||||
(when (file-in-directory-p default-directory straight-base-dir)
|
||||
(straight--process-run "git" "config" "core.autocrlf" "true")))))
|
||||
|
|
|
@ -30,7 +30,7 @@ and Emacs states, and for non-evil users.")
|
|||
;;; Global keybind settings
|
||||
|
||||
(cond
|
||||
(IS-MAC
|
||||
(doom--system-macos-p
|
||||
;; mac-* variables are used by the special emacs-mac build of Emacs by
|
||||
;; Yamamoto Mitsuharu, while other builds use ns-*.
|
||||
(setq mac-command-modifier 'super
|
||||
|
@ -40,7 +40,7 @@ and Emacs states, and for non-evil users.")
|
|||
;; Free up the right option for character composition
|
||||
mac-right-option-modifier 'none
|
||||
ns-right-option-modifier 'none))
|
||||
(IS-WINDOWS
|
||||
(doom--system-windows-p
|
||||
(setq w32-lwindow-modifier 'super
|
||||
w32-rwindow-modifier 'super)))
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ c) are not valid projectile projects."
|
|||
(projectile-serialize-cache))))
|
||||
|
||||
;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it.
|
||||
(when IS-WINDOWS
|
||||
(when doom--system-windows-p
|
||||
(setenv "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash
|
||||
(setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2
|
||||
|
||||
|
@ -192,11 +192,11 @@ And if it's a function, evaluate it."
|
|||
(concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git %s"
|
||||
bin (if (version< version "8.3.0")
|
||||
"" "--strip-cwd-prefix"))
|
||||
(if IS-WINDOWS " --path-separator=/"))))
|
||||
(if doom--system-windows-p " --path-separator=/"))))
|
||||
;; Otherwise, resort to ripgrep, which is also faster than find
|
||||
((executable-find "rg" t)
|
||||
(concat "rg -0 --files --follow --color=never --hidden -g!.git"
|
||||
(if IS-WINDOWS " --path-separator=/")))
|
||||
(if doom--system-windows-p " --path-separator=/")))
|
||||
("find . -type f -print0"))))
|
||||
|
||||
(defadvice! doom--projectile-default-generic-command-a (fn &rest args)
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
;; focus when it is started, among other things, so enable the menu-bar for
|
||||
;; GUI frames, but keep it disabled in terminal frames because there it
|
||||
;; activates an ugly, in-frame menu bar.
|
||||
(eval-when! IS-MAC
|
||||
(eval-when! doom--system-macos-p
|
||||
(add-hook! '(window-setup-hook after-make-frame-functions)
|
||||
(defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
|
||||
(when-let (frame (or frame (selected-frame)))
|
||||
|
@ -137,7 +137,7 @@
|
|||
(setq default-input-method nil)
|
||||
;; ...And the clipboard on Windows could be in a wider encoding (UTF-16), so
|
||||
;; leave Emacs to its own devices.
|
||||
(eval-when! IS-WINDOWS
|
||||
(eval-when! (not doom--system-windows-p)
|
||||
(setq selection-coding-system 'utf-8))
|
||||
|
||||
|
||||
|
|
72
lisp/doom.el
72
lisp/doom.el
|
@ -107,7 +107,30 @@
|
|||
"recompile it.")
|
||||
emacs-version old-version)))
|
||||
|
||||
;;; Custom features
|
||||
;;; Custom features & global constants
|
||||
;; Doom has its own features that its modules, CLI, and user extensions can
|
||||
;; announce, and don't belong in `features', so they are stored here, which can
|
||||
;; include information about the external system environment.
|
||||
(defconst doom-features
|
||||
(pcase system-type
|
||||
('darwin '(macos bsd))
|
||||
((or 'cygwin 'windows-nt 'ms-dos) '(windows))
|
||||
((or 'gnu 'gnu/linux) '(linux))
|
||||
((or 'gnu/kfreebsd 'berkeley-unix) '(linux bsd)))
|
||||
"A list of symbols denoting available features in the active Doom profile.")
|
||||
|
||||
;; Convenience aliases for internal use only (may be removed later).
|
||||
(defconst doom-system (car doom-features))
|
||||
(defconst doom--system-windows-p (eq 'windows doom-system))
|
||||
(defconst doom--system-macos-p (eq 'macos doom-system))
|
||||
(defconst doom--system-linux-p (eq 'linux doom-system))
|
||||
|
||||
;; `system-type' is esoteric, so I create a pseudo feature as a stable and
|
||||
;; consistent alternative, and all while using the same `featurep' interface
|
||||
;; we're already familiar with.
|
||||
(push :system features)
|
||||
(put :system 'subfeatures doom-features)
|
||||
|
||||
;; Emacs needs a more consistent way to detect build features, and the docs
|
||||
;; claim `system-configuration-features' is not da way. Some features (that
|
||||
;; don't represent packages) can be found in `features' (which `featurep'
|
||||
|
@ -126,25 +149,30 @@
|
|||
(if (not (native-comp-available-p))
|
||||
(delq 'native-compile features)))
|
||||
|
||||
;;; Global constants
|
||||
;; DEPRECATED remove in v3
|
||||
(defconst IS-MAC (eq system-type 'darwin))
|
||||
(defconst IS-LINUX (memq system-type '(gnu gnu/linux gnu/kfreebsd berkeley-unix)))
|
||||
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
|
||||
(defconst IS-BSD (memq system-type '(darwin berkeley-unix gnu/kfreebsd)))
|
||||
(defconst EMACS28+ (> emacs-major-version 27))
|
||||
(defconst EMACS29+ (> emacs-major-version 28))
|
||||
(defconst MODULES (featurep 'dynamic-modules))
|
||||
(defconst NATIVECOMP (featurep 'native-compile))
|
||||
(with-no-warnings
|
||||
(defconst IS-MAC doom--system-macos-p)
|
||||
(defconst IS-LINUX doom--system-linux-p)
|
||||
(defconst IS-WINDOWS doom--system-windows-p)
|
||||
(defconst IS-BSD (memq 'bsd doom-features))
|
||||
(defconst EMACS28+ (> emacs-major-version 27))
|
||||
(defconst EMACS29+ (> emacs-major-version 28))
|
||||
(defconst MODULES (featurep 'dynamic-modules))
|
||||
(defconst NATIVECOMP (featurep 'native-compile))
|
||||
|
||||
(make-obsolete-variable 'IS-MAC "Use (featurep :system 'macos) instead" "3.0.0")
|
||||
(make-obsolete-variable 'IS-LINUX "Use (featurep :system 'linux) instead" "3.0.0")
|
||||
(make-obsolete-variable 'IS-WINDOWS "Use (featurep :system 'windows) instead" "3.0.0")
|
||||
(make-obsolete-variable 'IS-BSD "Use (featurep :system 'bsd) instead" "3.0.0")
|
||||
(make-obsolete-variable 'EMACS28+ "Use (>= emacs-major-version 28) instead" "3.0.0")
|
||||
(make-obsolete-variable 'EMACS29+ "Use (>= emacs-major-version 29) instead" "3.0.0")
|
||||
(make-obsolete-variable 'MODULES "Use (featurep 'dynamic-modules) instead" "3.0.0")
|
||||
(make-obsolete-variable 'NATIVECOMP "Use (featurep 'native-compile) instead" "3.0.0"))
|
||||
|
||||
(make-obsolete-variable 'EMACS28+ "Use (>= emacs-major-version 28) instead" "3.0.0")
|
||||
(make-obsolete-variable 'EMACS29+ "Use (>= emacs-major-version 29) instead" "3.0.0")
|
||||
(make-obsolete-variable 'MODULES "Use (featurep 'dynamic-modules) instead" "3.0.0")
|
||||
(make-obsolete-variable 'NATIVECOMP "Use (featurep 'native-compile) instead" "3.0.0")
|
||||
|
||||
;;; Fix $HOME on Windows
|
||||
;; $HOME isn't normally defined on Windows, but many unix tools expect it.
|
||||
(when IS-WINDOWS
|
||||
(when doom--system-windows-p
|
||||
(when-let (realhome
|
||||
(and (null (getenv-internal "HOME"))
|
||||
(getenv "USERPROFILE")))
|
||||
|
@ -228,7 +256,7 @@ These files should not be shared across systems. By default, it is used by
|
|||
(define-obsolete-variable-alias 'doom-etc-dir 'doom-data-dir "3.0.0")
|
||||
(defvar doom-data-dir
|
||||
(if doom-profile
|
||||
(if IS-WINDOWS
|
||||
(if doom--system-windows-p
|
||||
(expand-file-name "doomemacs/data/" (getenv-internal "APPDATA"))
|
||||
(expand-file-name "doom/" (or (getenv-internal "XDG_DATA_HOME") "~/.local/share")))
|
||||
;; DEPRECATED: .local will be removed entirely in 3.0
|
||||
|
@ -247,7 +275,7 @@ For profile-local data files, use `doom-profile-data-dir' instead.")
|
|||
|
||||
(defvar doom-cache-dir
|
||||
(if doom-profile
|
||||
(if IS-WINDOWS
|
||||
(if doom--system-windows-p
|
||||
(expand-file-name "doomemacs/cache/" (getenv-internal "APPDATA"))
|
||||
(expand-file-name "doom/" (or (getenv-internal "XDG_CACHE_HOME") "~/.cache")))
|
||||
;; DEPRECATED: .local will be removed entirely in 3.0
|
||||
|
@ -266,7 +294,7 @@ For profile-local cache files, use `doom-profile-cache-dir' instead.")
|
|||
|
||||
(defvar doom-state-dir
|
||||
(if doom-profile
|
||||
(if IS-WINDOWS
|
||||
(if doom--system-windows-p
|
||||
(expand-file-name "doomemacs/state/" (getenv-internal "APPDATA"))
|
||||
(expand-file-name "doom/" (or (getenv-internal "XDG_STATE_HOME") "~/.local/state")))
|
||||
;; DEPRECATED: .local will be removed entirely in 3.0
|
||||
|
@ -470,8 +498,8 @@ users).")
|
|||
(add-transient-hook! 'tool-bar-mode (tool-bar-setup)))
|
||||
|
||||
;; PERF: Unset a non-trivial list of command line options that aren't
|
||||
;; relevant to our current OS, but `command-line-1' still processes.
|
||||
(unless IS-MAC
|
||||
;; relevant to this session, but `command-line-1' still processes.
|
||||
(unless doom--system-macos-p
|
||||
(setq command-line-ns-option-alist nil))
|
||||
(unless (memq initial-window-system '(x pgtk))
|
||||
(setq command-line-x-option-alist nil)))))
|
||||
|
@ -649,7 +677,7 @@ of 'doom sync' or 'doom gc'."
|
|||
gnutls-algorithm-priority
|
||||
(when (boundp 'libgnutls-version)
|
||||
(concat "SECURE128:+SECURE192:-VERS-ALL"
|
||||
(if (and (not IS-WINDOWS)
|
||||
(if (and (not doom--system-windows-p)
|
||||
(>= libgnutls-version 30605))
|
||||
":+VERS-TLS1.3")
|
||||
":+VERS-TLS1.2"))
|
||||
|
@ -713,6 +741,8 @@ appropriately against `noninteractive' or the `cli' context."
|
|||
(defun doom--begin-init-h ()
|
||||
"Begin the startup process."
|
||||
(when (doom-context-push 'init)
|
||||
;; HACK: Ensure OS checks are as fast as possible (given their ubiquity).
|
||||
(setq features (cons :system (delq :system features)))
|
||||
;; Remember these variables' initial values, so we can safely reset them at
|
||||
;; a later time, or consult them without fear of contamination.
|
||||
(dolist (var '(exec-path load-path process-environment))
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
(defun doom-system-distro ()
|
||||
"Return a symbol representing the installed distro."
|
||||
(with-memoization (get 'doom-system-distro 'cached-value)
|
||||
(cond (IS-WINDOWS 'windows)
|
||||
(IS-MAC 'macos)
|
||||
(cond (doom--system-windows-p 'windows)
|
||||
(doom--system-macos-p 'macos)
|
||||
((ignore-errors
|
||||
(with-file-contents! "/etc/os-release"
|
||||
(when (re-search-forward "^ID=\"?\\([^\"\n]+\\)\"?" nil t)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;;; app/everywhere/doctor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(when IS-WINDOWS
|
||||
(when (featurep :system 'windows)
|
||||
(error! "emacs-everywhere package does not support windows."))
|
||||
|
||||
(when IS-LINUX
|
||||
(when (featurep :system 'linux)
|
||||
(let (unmet-deps)
|
||||
(dolist (dep '("xclip" "xdotool" "xprop" "xwininfo"))
|
||||
(unless (executable-find dep)
|
||||
|
|
|
@ -187,8 +187,8 @@ playback.")
|
|||
(setq circe-notifications-watch-strings +irc-notifications-watch-strings
|
||||
circe-notifications-emacs-focused nil
|
||||
circe-notifications-alert-style
|
||||
(cond (IS-MAC 'osx-notifier)
|
||||
(IS-LINUX 'libnotify)
|
||||
(cond ((featurep :system 'macos) 'osx-notifier)
|
||||
((featurep :system 'linux) 'libnotify)
|
||||
(circe-notifications-alert-style))))
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(cond ((setq langtool-bin
|
||||
(or (executable-find "languagetool-commandline")
|
||||
(executable-find "languagetool")))) ; for nixpkgs.languagetool
|
||||
(IS-MAC
|
||||
((featurep :system 'macos)
|
||||
(cond
|
||||
;; is user using home brew?
|
||||
((file-directory-p "/usr/local/Cellar/languagetool")
|
||||
|
@ -25,7 +25,7 @@
|
|||
;; macports compatibility
|
||||
((file-directory-p "/opt/local/share/java/LanguageTool")
|
||||
(setq langtool-java-classpath "/opt/local/share/java/LanguageTool/*"))))
|
||||
(IS-LINUX
|
||||
((featurep :system 'linux)
|
||||
(setq langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")))))
|
||||
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ Can be negative.")
|
|||
|
||||
(defvar helm-generic-files-map (make-sparse-keymap))
|
||||
(after! helm-locate
|
||||
(when (and IS-MAC
|
||||
(when (and (featurep :system 'macos)
|
||||
(null helm-locate-command)
|
||||
(executable-find "mdfind"))
|
||||
(setq helm-locate-command "mdfind -name %s"))
|
||||
|
|
|
@ -237,7 +237,7 @@ results buffer.")
|
|||
(add-to-list 'ivy-sort-functions-alist '(counsel-imenu))
|
||||
|
||||
;; `counsel-locate'
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
;; Use spotlight on mac by default since it doesn't need any additional setup
|
||||
(setq counsel-locate-cmd #'counsel-locate-cmd-mdfind))
|
||||
|
||||
|
@ -276,13 +276,13 @@ results buffer.")
|
|||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
collect "--exclude"
|
||||
collect dir)
|
||||
(if IS-WINDOWS '("--path-separator=/")))))
|
||||
(if (featurep :system 'windows) '("--path-separator=/")))))
|
||||
((executable-find "rg" t)
|
||||
(append (list "rg" "--hidden" "--files" "--follow" "--color=never" "--no-messages")
|
||||
(cl-loop for dir in projectile-globally-ignored-directories
|
||||
collect "--glob"
|
||||
collect (concat "!" dir))
|
||||
(if IS-WINDOWS '("--path-separator=/"))))
|
||||
(if (featurep :system 'windows) '("--path-separator=/"))))
|
||||
((cons find-program args)))
|
||||
(unless (listp args)
|
||||
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))
|
||||
|
|
|
@ -153,7 +153,7 @@ orderless."
|
|||
;; https://github.com/sharkdp/fd/issues/839
|
||||
"--full-path --absolute-path"
|
||||
"--hidden --exclude .git"
|
||||
(when IS-WINDOWS "--path-separator=/"))))
|
||||
(if (featurep :system 'windows) "--path-separator=/"))))
|
||||
|
||||
(consult-customize
|
||||
consult-ripgrep consult-git-grep consult-grep
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
:g "M-8" #'+workspace/switch-to-7
|
||||
:g "M-9" #'+workspace/switch-to-8
|
||||
:g "M-0" #'+workspace/switch-to-final
|
||||
(:when IS-MAC
|
||||
(:when (featurep :system 'macos)
|
||||
:g "s-t" #'+workspace/new
|
||||
:g "s-T" #'+workspace/display
|
||||
:n "s-1" #'+workspace/switch-to-0
|
||||
|
|
|
@ -24,7 +24,7 @@ If ARG (universal argument), runs `compile' from the current directory."
|
|||
generate `completing-read' candidates."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (and (not IS-MAC) (executable-find "man"))
|
||||
(if (and (not (featurep :system 'macos)) (executable-find "man"))
|
||||
(or (command-remapping #'man)
|
||||
#'man)
|
||||
#'woman)))
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
|
||||
;;;###package tramp
|
||||
(unless IS-WINDOWS
|
||||
(unless (featurep :system 'windows)
|
||||
(setq tramp-default-method "ssh")) ; faster than the default scp
|
||||
|
||||
|
||||
|
@ -300,7 +300,7 @@ Continues comments if executed from a commented line. Consults
|
|||
(define-key tabulated-list-mode-map "q" #'quit-window))
|
||||
|
||||
;; OS specific fixes
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
;; Fix MacOS shift+tab
|
||||
(define-key key-translation-map [S-iso-lefttab] [backtab])
|
||||
;; Fix conventional OS keys in Emacs
|
||||
|
@ -487,7 +487,7 @@ Continues comments if executed from a commented line. Consults
|
|||
:gi "C-S-RET" #'+default/newline-above
|
||||
:gn [C-S-return] #'+default/newline-above
|
||||
|
||||
(:when IS-MAC
|
||||
(:when (featurep :system 'macos)
|
||||
:gn "s-RET" #'+default/newline-below
|
||||
:gn [s-return] #'+default/newline-below
|
||||
:gn "S-s-RET" #'+default/newline-above
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
(indent 0))
|
||||
(with-current-buffer formatted-buffer
|
||||
(erase-buffer)
|
||||
(unless IS-WINDOWS
|
||||
(unless (featurep :system 'windows)
|
||||
(setq-local coding-system-for-read 'utf-8)
|
||||
(setq-local coding-system-for-write 'utf-8))
|
||||
;; Ensure this temp buffer seems as much like the origin buffer as
|
||||
|
|
|
@ -74,8 +74,7 @@
|
|||
(apply fn args)))
|
||||
|
||||
;; REVIEW This is tremendously slow on macos and windows for some reason.
|
||||
(setq evil-mc-enable-bar-cursor (not (or IS-MAC
|
||||
IS-WINDOWS)))
|
||||
(setq evil-mc-enable-bar-cursor (featurep :system 'linux))
|
||||
|
||||
(after! smartparens
|
||||
;; Make evil-mc cooperate with smartparens better
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
hy-mode) . parinfer-rust-mode)
|
||||
:init
|
||||
(setq parinfer-rust-library
|
||||
(concat doom-data-dir "parinfer-rust/"
|
||||
(cond (IS-MAC "parinfer-rust-darwin.so")
|
||||
(IS-LINUX "parinfer-rust-linux.so")
|
||||
(IS-WINDOWS "parinfer-rust-windows.dll")
|
||||
(IS-BSD "libparinfer_rust.so")))
|
||||
parinfer-rust-auto-download (not IS-BSD))
|
||||
(file-name-concat
|
||||
doom-data-dir "parinfer-rust/"
|
||||
(cond ((featurep :system 'macos) "parinfer-rust-darwin.so")
|
||||
((featurep :system 'linux) "parinfer-rust-linux.so")
|
||||
((featurep :system 'windows) "parinfer-rust-windows.dll")
|
||||
((featurep :system 'bsd) "libparinfer_rust.so")))
|
||||
parinfer-rust-auto-download (not (featurep :system 'bsd)))
|
||||
:config
|
||||
(map! :map parinfer-rust-mode-map
|
||||
:localleader
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
(set-evil-initial-state! 'image-dired-display-image-mode 'emacs)
|
||||
|
||||
(let ((args (list "-ahl" "-v" "--group-directories-first")))
|
||||
(when IS-BSD
|
||||
(when (featurep :system 'bsd)
|
||||
;; Use GNU ls as `gls' from `coreutils' if available. Add `(setq
|
||||
;; dired-use-ls-dired nil)' to your config to suppress the Dired warning
|
||||
;; when not using GNU ls.
|
||||
|
@ -188,9 +188,9 @@ we have to clean it up ourselves."
|
|||
;; deleted directory. Of course I do!
|
||||
(setq dired-clean-confirm-killing-deleted-buffers nil)
|
||||
;; Let OS decide how to open certain files
|
||||
(when-let (cmd (cond (IS-MAC "open")
|
||||
(IS-LINUX "xdg-open")
|
||||
(IS-WINDOWS "start")))
|
||||
(when-let (cmd (cond ((featurep :system 'macos) "open")
|
||||
((featurep :system 'linux) "xdg-open")
|
||||
((featurep :system 'windows) "start")))
|
||||
(setq dired-guess-shell-alist-user
|
||||
`(("\\.\\(?:docx\\|pdf\\|djvu\\|eps\\)\\'" ,cmd)
|
||||
("\\.\\(?:jpe?g\\|png\\|gif\\|xpm\\)\\'" ,cmd)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; emacs/dired/doctor.el -*- lexical-binding: t; -*-
|
||||
|
||||
(when (and IS-BSD (not (executable-find "gls")))
|
||||
(when (and (featurep :system 'bsd) (not (executable-find "gls")))
|
||||
(warn! "Cannot find gls (GNU ls). This may cause issues with dired"))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
;; 2021, amirite?
|
||||
(setq-default vc-handled-backends '(SVN Git Hg))
|
||||
|
||||
(when IS-WINDOWS
|
||||
(when (featurep :system 'windows)
|
||||
(setenv "GIT_ASKPASS" "git-gui--askpass"))
|
||||
|
||||
;; In case the user is using `bug-reference-mode'
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
(defun +org-msg-img-scale-css (img-uri)
|
||||
"For a given IMG-URI, use imagemagick to find its width."
|
||||
(if +org-msg-currently-exporting
|
||||
(when (and (not IS-WINDOWS)) ; relies on posix path
|
||||
(when (and (not (featurep :system 'windows))) ; relies on posix path
|
||||
(let ((width-call (and (executable-find "identify")
|
||||
(doom-call-process "identify" "-format" "%w"
|
||||
(substring img-uri 7))))) ; 7=(length "file://")
|
||||
|
|
|
@ -365,7 +365,7 @@ This should already be the case yet it does not always seem to be."
|
|||
(read-only-mode -1))
|
||||
|
||||
;; process lock control
|
||||
(when IS-WINDOWS
|
||||
(when (featurep :system 'windows)
|
||||
(setq
|
||||
+mu4e-lock-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock")
|
||||
+mu4e-lock-request-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock_request")))
|
||||
|
@ -696,7 +696,7 @@ See `+mu4e-msg-gmail-p' and `mu4e-sent-messages-behavior'.")
|
|||
t)))
|
||||
mails)))
|
||||
|
||||
(when IS-LINUX
|
||||
(when (featurep :system 'linux)
|
||||
(mu4e-alert-set-default-style 'libnotify)
|
||||
|
||||
(defvar +mu4e-alert-bell-cmd '("paplay" . "/usr/share/sounds/freedesktop/stereo/message.oga")
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
You may not have a way of fetching mail."))
|
||||
|
||||
(when (and (modulep! +org)
|
||||
(not IS-WINDOWS))
|
||||
(not (featurep :system 'windows)))
|
||||
(unless (executable-find "identify")
|
||||
(warn! "Couldn't find the identify command from imagemagick. \
|
||||
LaTeX fragment re-scaling with org-msg will not work.")))
|
||||
|
|
|
@ -17,7 +17,7 @@ This is ignored by ccls.")
|
|||
`((c-mode . nil)
|
||||
(c++-mode
|
||||
. ,(list "-std=c++1z" ; use C++17 draft by default
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
;; NOTE beware: you'll get abi-inconsistencies when passing
|
||||
;; std-objects to libraries linked with libstdc++ (e.g. if you
|
||||
;; use boost which wasn't compiled with libc++)
|
||||
|
@ -286,7 +286,7 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
|
|||
|
||||
;; NOTE : This setting is untested yet
|
||||
(after! eglot
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
(add-to-list 'eglot-workspace-configuration
|
||||
`((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
|
||||
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||
|
@ -313,12 +313,12 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
|
|||
(setq-hook! 'lsp-configure-hook
|
||||
ccls-sem-highlight-method (if lsp-enable-semantic-highlighting
|
||||
ccls-sem-highlight-method))
|
||||
(when (or IS-MAC
|
||||
IS-LINUX)
|
||||
(when (or (featurep :system 'macos)
|
||||
(featurep :system 'linux))
|
||||
(setq ccls-initialization-options
|
||||
`(:index (:trackDependency 1
|
||||
:threads ,(max 1 (/ (doom-system-cpus) 2))))))
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
(setq ccls-initialization-options
|
||||
(append ccls-initialization-options
|
||||
`(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(`skim
|
||||
(when-let
|
||||
(app-path
|
||||
(and IS-MAC
|
||||
(and (featurep :system 'macos)
|
||||
(file-exists-p! (or "/Applications/Skim.app"
|
||||
"~/Applications/Skim.app"))))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Skim"))
|
||||
|
@ -18,7 +18,7 @@
|
|||
app-path)))))
|
||||
|
||||
(`sumatrapdf
|
||||
(when (and IS-WINDOWS
|
||||
(when (and (featurep :system 'windows)
|
||||
(executable-find "SumatraPDF"))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "SumatraPDF"))))
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
(`pdf-tools
|
||||
(when (modulep! :tools pdf)
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
;; PDF Tools isn't in `TeX-view-program-list-builtin' on macs.
|
||||
(add-to-list 'TeX-view-program-list '("PDF Tools" TeX-pdf-tools-sync-view)))
|
||||
;; Update PDF buffers after successful LaTeX runs.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(format "%s %s"
|
||||
(if (executable-find "love")
|
||||
"love"
|
||||
(if IS-MAC "open -a love.app"))
|
||||
(if (featurep :system 'macos) "open -a love.app"))
|
||||
(shell-quote-argument root))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -34,9 +34,9 @@ lua-language-server.")
|
|||
;; is a function is to dynamically change when/if `+lua-lsp-dir' does
|
||||
(list (or (executable-find "lua-language-server")
|
||||
(doom-path +lua-lsp-dir
|
||||
(cond (IS-MAC "bin/macOS")
|
||||
(IS-LINUX "bin/Linux")
|
||||
(IS-WINDOWS "bin/Windows"))
|
||||
(cond ((featurep :system 'macos) "bin/macOS")
|
||||
((featurep :system 'linux) "bin/Linux")
|
||||
((featurep :system 'windows) "bin/Windows"))
|
||||
"lua-language-server"))
|
||||
"-E" "-e" "LANG=en"
|
||||
(doom-path +lua-lsp-dir "main.lua")))
|
||||
|
|
|
@ -32,8 +32,8 @@ capture, the end position, and the output buffer.")
|
|||
;; This is set to `nil' by default, which causes a wrong-type-arg error
|
||||
;; when you use `markdown-open'. These are more sensible defaults.
|
||||
markdown-open-command
|
||||
(cond (IS-MAC "open")
|
||||
(IS-LINUX "xdg-open"))
|
||||
(cond ((featurep :system 'macos) "open")
|
||||
((featurep :system 'linux) "xdg-open"))
|
||||
|
||||
;; A sensible and simple default preamble for markdown exports that
|
||||
;; takes after the github asthetic (plus highlightjs syntax coloring).
|
||||
|
|
|
@ -14,7 +14,7 @@ nimsuggest isn't installed."
|
|||
|
||||
(set-formatter! 'nmfmt '("nimfmt" filepath) :modes '(nim-mode))
|
||||
|
||||
(when IS-WINDOWS
|
||||
(when (featurep :system 'windows)
|
||||
;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
|
||||
(defadvice! +nim--suggest-get-temp-file-name-a (path)
|
||||
"Removes invalid characters from the temp file path, including the unicode
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
(width . 70)
|
||||
(height . 25)
|
||||
(transient . t)
|
||||
,@(when IS-LINUX
|
||||
,@(when (featurep :system 'linux)
|
||||
`((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x))
|
||||
(display . ,(or (getenv "WAYLAND_DISPLAY")
|
||||
(getenv "DISPLAY")
|
||||
":0"))))
|
||||
,(if IS-MAC '(menu-bar-lines . 1)))
|
||||
,(if (featurep :system 'macos) '(menu-bar-lines . 1)))
|
||||
"TODO")
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
(defun +org--yank-html-buffer (buffer)
|
||||
(with-current-buffer buffer
|
||||
(require 'ox-clip)
|
||||
(cond ((or IS-WINDOWS IS-MAC)
|
||||
(cond ((or (featurep :system 'windows)
|
||||
(featurep :system 'macos))
|
||||
(shell-command-on-region
|
||||
(point-min)
|
||||
(point-max)
|
||||
(cond (IS-WINDOWS ox-clip-w32-cmd)
|
||||
(IS-MAC ox-clip-osx-cmd))))
|
||||
(IS-LINUX
|
||||
(cond ((featurep :system 'windows) ox-clip-w32-cmd)
|
||||
((featurep :system 'macos) ox-clip-osx-cmd))))
|
||||
((featurep :system 'linux)
|
||||
(let ((html (buffer-string)))
|
||||
(with-temp-file (make-temp-file "ox-clip-md" nil ".html")
|
||||
(insert html))
|
||||
|
|
|
@ -507,7 +507,7 @@ relative to `org-directory', unless it is an absolute path."
|
|||
"file" :face (lambda (path)
|
||||
(if (or (file-remote-p path)
|
||||
;; filter out network shares on windows (slow)
|
||||
(if IS-WINDOWS (string-prefix-p "\\\\" path))
|
||||
(if (featurep :system 'windows) (string-prefix-p "\\\\" path))
|
||||
(file-exists-p path))
|
||||
'org-link
|
||||
'(warning org-link))))
|
||||
|
@ -931,7 +931,7 @@ between the two."
|
|||
[C-return] #'+org/insert-item-below
|
||||
[C-S-return] #'+org/insert-item-above
|
||||
[C-M-return] #'org-insert-subheading
|
||||
(:when IS-MAC
|
||||
(:when (featurep :system 'macos)
|
||||
[s-return] #'+org/insert-item-below
|
||||
[s-S-return] #'+org/insert-item-above
|
||||
[s-M-return] #'org-insert-subheading)
|
||||
|
@ -1391,7 +1391,7 @@ between the two."
|
|||
"Advise `server-visit-files' to load `org-protocol' lazily."
|
||||
:around #'server-visit-files
|
||||
(if (not (cl-loop with protocol =
|
||||
(if IS-WINDOWS
|
||||
(if (featurep :system 'windows)
|
||||
;; On Windows, the file arguments for `emacsclient'
|
||||
;; get funnelled through `expand-file-path' by
|
||||
;; `server-process-filter'. This substitutes
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
(setq org-download-method 'attach
|
||||
org-download-timestamp "_%Y%m%d_%H%M%S"
|
||||
org-download-screenshot-method
|
||||
(cond (IS-MAC "screencapture -i %s")
|
||||
(IS-LINUX
|
||||
(cond ((featurep :system 'macos) "screencapture -i %s")
|
||||
((featurep :system 'linux)
|
||||
(cond ((executable-find "maim") "maim -s %s")
|
||||
((executable-find "scrot") "scrot -s %s")
|
||||
((executable-find "gnome-screenshot") "gnome-screenshot -a -f %s"))))
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(advice-add #'org-babel-ipython-initiate-session :override #'+org-ob-ipython-initiate-session-a)
|
||||
|
||||
;; retina resolution image hack
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
(advice-add #'ob-ipython--write-base64-string :around #'+org-ob-ipython-write-base64-string-a))
|
||||
|
||||
;; ipython has its own async keyword, disable ipython in ob-async.
|
||||
|
|
|
@ -16,10 +16,10 @@ Migrate your notes to org-roam-v2 and switch to the +roam2 flag (see the module
|
|||
(warn! "Couldn't find the dot executable (from graphviz). org-roam will not be able to generate graph visualizations.")))
|
||||
|
||||
(when (modulep! +dragndrop)
|
||||
(when IS-MAC
|
||||
(when (featurep :system 'macos)
|
||||
(unless (executable-find "pngpaste")
|
||||
(warn! "Couldn't find the pngpaste executable. org-download-clipboard will not work.")))
|
||||
(when IS-LINUX
|
||||
(when (featurep :system 'linux)
|
||||
(unless (or (executable-find "maim") (executable-find "scrot") (executable-find "gnome-screenshot"))
|
||||
(warn! "Couldn't find the maim, scrot or gnome-screenshot executable. org-download-clipboard will not work."))
|
||||
(if (string= "wayland" (getenv "XDG_SESSION_TYPE"))
|
||||
|
@ -27,6 +27,6 @@ Migrate your notes to org-roam-v2 and switch to the +roam2 flag (see the module
|
|||
(warn! "Couldn't find the wl-paste executable (from wl-clipboard). org-download-clipboard will not work."))
|
||||
(unless (executable-find "xclip")
|
||||
(warn! "Couldn't find the xclip executable. org-download-clipboard will not work."))))
|
||||
(when IS-WINDOWS
|
||||
(when (featurep :system 'windows)
|
||||
(unless (executable-find "convert")
|
||||
(warn! "Couldn't find the convert program (from ImageMagick). org-download-clipboard will not work."))))
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
:type git
|
||||
:repo "https://repo.or.cz/org-contacts.git")))
|
||||
|
||||
(when (and IS-MAC
|
||||
(when (and (featurep :system 'macos)
|
||||
(modulep! :os macos))
|
||||
(package! org-mac-link :pin "e30171a6e98db90787ab8a23b3a7dc4fd13b10f9"))
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
(set-company-backend! 'sh-mode '(company-shell company-files))
|
||||
(setq company-shell-delete-duplicates t
|
||||
;; whatis lookups are exceptionally slow on macOS (#5860)
|
||||
company-shell-dont-fetch-meta IS-MAC))
|
||||
company-shell-dont-fetch-meta (featurep :system 'macos)))
|
||||
|
||||
|
||||
(use-package! powershell
|
||||
|
|
|
@ -48,6 +48,6 @@
|
|||
(when (not (fboundp 'system-move-file-to-trash))
|
||||
(defun system-move-file-to-trash (file)
|
||||
"Move FILE to trash."
|
||||
(when (and (not IS-LINUX)
|
||||
(when (and (not (featurep :system 'linux))
|
||||
(not (file-remote-p default-directory)))
|
||||
(osx-trash-move-file-to-trash file)))))
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
(add-hook 'tty-setup-hook #'xterm-mouse-mode)
|
||||
|
||||
;; Windows terminals don't support what I'm about to do, but best not to wrap
|
||||
;; this in a IS-WINDOWS check, in case you're using WSL or Cygwin, which do and
|
||||
;; *might* support it.
|
||||
;; this in an OS check, in case you're using WSL or Cygwin, which *might*
|
||||
;; support it.
|
||||
(add-hook! 'tty-setup-hook
|
||||
(defun doom-init-clipboard-in-tty-emacs-h ()
|
||||
;; Fix the clipboard in tty Emacs by...
|
||||
|
|
|
@ -242,7 +242,7 @@ Emacs versions < 29."
|
|||
|
||||
|
||||
(use-package! fish-completion
|
||||
:unless IS-WINDOWS
|
||||
:unless (featurep :system 'windows)
|
||||
:hook (eshell-mode . fish-completion-mode)
|
||||
:init (setq fish-completion-fallback-on-bash-p t
|
||||
fish-completion-inhibit-missing-fish-command-warning t))
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
(package! eshell-did-you-mean :pin "80cd8c4b186a2fb29621cf634bcf2bcd914f1e3d")
|
||||
(package! eshell-syntax-highlighting :pin "4ac27eec6595ba116a6151dfaf0b0e0440101e10")
|
||||
|
||||
(unless IS-WINDOWS
|
||||
(unless (featurep :system 'windows)
|
||||
(package! fish-completion :pin "d34d0b96fde63feedf13c4288183d8d4d4d748cf")
|
||||
(package! bash-completion :pin "f1daac0386c24cbe8a244a62c7588cc6847b07ae"))
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
((:lang rust +lsp) :after rustic-mode :require (dap-lldb dap-cpptools))
|
||||
((:lang javascript +lsp)
|
||||
:after (js2-mode typescript-mode)
|
||||
:require (dap-node dap-chrome dap-firefox ,@(if IS-WINDOWS '(dap-edge)))))
|
||||
:require (dap-node dap-chrome dap-firefox ,@(if (featurep :system 'windows) '(dap-edge)))))
|
||||
"TODO")
|
||||
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ Otherwise, falls back on `find-file-at-point'."
|
|||
(read-string "Look up in dictionary: "))
|
||||
current-prefix-arg))
|
||||
(message "Looking up dictionary definition for %S" identifier)
|
||||
(cond ((and IS-MAC (require 'osx-dictionary nil t))
|
||||
(cond ((and (featurep :system 'macos) (require 'osx-dictionary nil t))
|
||||
(osx-dictionary--view-result identifier))
|
||||
((and +lookup-dictionary-prefer-offline
|
||||
(require 'wordnut nil t))
|
||||
|
|
|
@ -216,7 +216,7 @@ Dictionary.app behind the scenes to get definitions.")
|
|||
|
||||
(use-package! define-word
|
||||
:when (modulep! +dictionary)
|
||||
:unless IS-MAC
|
||||
:unless (featurep :system 'macos)
|
||||
:defer t
|
||||
:config
|
||||
(setq define-word-displayfn-alist
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
(package! counsel-dash :pin "8decb980f111ebe7027361ee252279a9076da261")))
|
||||
|
||||
(when (modulep! +dictionary)
|
||||
(if IS-MAC
|
||||
(if (featurep :system 'macos)
|
||||
(package! osx-dictionary :pin "0715e5a3ac659df32a0f0fabfbbeef0228fbd9a9")
|
||||
(package! define-word :pin "31a8c67405afa99d0e25e7c86a4ee7ef84a808fe")
|
||||
;; REVIEW: This fork fixes SavchenkoValeriy/emacs-powerthesaurus#40.
|
||||
|
|
|
@ -157,7 +157,8 @@ and cannot run in."
|
|||
;; using the same composition-function-table method
|
||||
;; https://bitbucket.org/mituharu/emacs-mac/src/26c8fd9920db9d34ae8f78bceaec714230824dac/lisp/term/mac-win.el?at=master#lines-345:805
|
||||
;; so use that instead if this module is enabled.
|
||||
((and IS-MAC (fboundp 'mac-auto-operator-composition-mode))
|
||||
((if (featurep :system 'macos)
|
||||
(fboundp 'mac-auto-operator-composition-mode))
|
||||
(add-hook 'doom-init-ui-hook #'mac-auto-operator-composition-mode 'append))
|
||||
|
||||
;; NOTE: the module does not support Emacs 27 and less, but if we still try to enable ligatures,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
;; This cond expression mimics the activation conditional of ligatures,
|
||||
;; with a fallback that triggers a warning.
|
||||
(cond
|
||||
((and IS-MAC (fboundp 'mac-auto-operator-composition-mode))
|
||||
((if (featurep :system 'macos)
|
||||
(fboundp 'mac-auto-operator-composition-mode))
|
||||
(ignore))
|
||||
|
||||
((and (> emacs-major-version 27)
|
||||
|
@ -10,7 +11,6 @@
|
|||
(featurep 'composite)) ; Emacs loads `composite' at startup
|
||||
(ignore))
|
||||
|
||||
(t
|
||||
(if IS-MAC
|
||||
(warn! "The (:ui ligatures) module does not support your version of Emacs. Install emacs-plus with at least Emacs 28, or emacs-mac.")
|
||||
((if (featurep :system 'macos)
|
||||
(warn! "The (:ui ligatures) module does not support your version of Emacs. Install emacs-plus with at least Emacs 28, or emacs-mac.")
|
||||
(warn! "The (:ui ligatures) module does not support your version of Emacs. Make sure to have at least Emacs 28 with Harfbuzz configured (should be the default)."))))
|
||||
|
|
|
@ -489,7 +489,7 @@ lines are selected, or the NxM dimensions of a block selection.")
|
|||
`(:eval
|
||||
(let ((sys (coding-system-plist buffer-file-coding-system))
|
||||
(eol (coding-system-eol-type-mnemonic buffer-file-coding-system)))
|
||||
(concat (unless (equal eol ,(if IS-WINDOWS "CRLF" "LF"))
|
||||
(concat (unless (equal eol ,(if (featurep :system 'windows) "CRLF" "LF"))
|
||||
(concat " " eol " "))
|
||||
(if (memq (plist-get sys :category)
|
||||
'(coding-category-undecided coding-category-utf-8))
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
;; than the current OSes preference
|
||||
doom-modeline-buffer-encoding 'nondefault
|
||||
doom-modeline-default-eol-type
|
||||
(cond (IS-MAC 2)
|
||||
(IS-WINDOWS 1)
|
||||
(0)))
|
||||
(pcase doom-system ('macos 2) ('windows 1) (_ 0)))
|
||||
|
||||
:config
|
||||
;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
;;upload ; map local to remote projects via ssh/ftp
|
||||
|
||||
:os
|
||||
(:if IS-MAC macos) ; improve compatibility with macOS
|
||||
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
|
||||
;;tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue