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:
Henrik Lissner 2023-12-05 17:05:13 -05:00
parent d38787edf4
commit 659f7bfc71
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
52 changed files with 150 additions and 120 deletions

View file

@ -379,7 +379,7 @@ Or to create aliases for functions that behave differently:
"C-x C-r" 'a-global-keybind "C-x C-r" 'a-global-keybind
:g "C-x C-r" 'another-global-keybind ; same as above :g "C-x C-r" 'another-global-keybind ; same as above
(:when IS-MAC (:when (featurep :system 'macos)
:n "M-s" 'some-fn :n "M-s" 'some-fn
:i "M-o" (cmd! (message "Hi")))) :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 ;;helm
:tools :tools
(:if IS-MAC macos) (:if (featurep :system 'macos) macos)
docker docker
lsp lsp
@ -617,7 +617,7 @@ These are side-by-side comparisons, showing how to bind keys with and without
((string= system-name "writing-pc") ((string= system-name "writing-pc")
(org +dragndrop) (org +dragndrop)
ruby)) ruby))
(:if IS-LINUX (:if (featurep :system 'linux)
(web +lsp) (web +lsp)
web) web)

View file

@ -297,7 +297,7 @@ declaration) or dependency thereof that hasn't already been."
;; variables entry is missing the suffix" errors when ;; variables entry is missing the suffix" errors when
;; installing them (see hlissner/doom-emacs#2637), so ;; installing them (see hlissner/doom-emacs#2637), so
;; have git handle conversion by force. ;; 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))) (let ((default-directory (straight--repos-dir local-repo)))
(when (file-in-directory-p default-directory straight-base-dir) (when (file-in-directory-p default-directory straight-base-dir)
(straight--process-run "git" "config" "core.autocrlf" "true"))))) (straight--process-run "git" "config" "core.autocrlf" "true")))))

View file

@ -30,7 +30,7 @@ and Emacs states, and for non-evil users.")
;;; Global keybind settings ;;; Global keybind settings
(cond (cond
(IS-MAC (doom--system-macos-p
;; mac-* variables are used by the special emacs-mac build of Emacs by ;; mac-* variables are used by the special emacs-mac build of Emacs by
;; Yamamoto Mitsuharu, while other builds use ns-*. ;; Yamamoto Mitsuharu, while other builds use ns-*.
(setq mac-command-modifier 'super (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 ;; Free up the right option for character composition
mac-right-option-modifier 'none mac-right-option-modifier 'none
ns-right-option-modifier 'none)) ns-right-option-modifier 'none))
(IS-WINDOWS (doom--system-windows-p
(setq w32-lwindow-modifier 'super (setq w32-lwindow-modifier 'super
w32-rwindow-modifier 'super))) w32-rwindow-modifier 'super)))

View file

@ -147,7 +147,7 @@ c) are not valid projectile projects."
(projectile-serialize-cache)))) (projectile-serialize-cache))))
;; Some MSYS utilities auto expanded the `/' path separator, so we need to prevent it. ;; 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 "MSYS_NO_PATHCONV" "1") ; Fix path in Git Bash
(setenv "MSYS2_ARG_CONV_EXCL" "--path-separator")) ; Fix path in MSYS2 (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" (concat (format "%s . -0 -H --color=never --type file --type symlink --follow --exclude .git %s"
bin (if (version< version "8.3.0") bin (if (version< version "8.3.0")
"" "--strip-cwd-prefix")) "" "--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 ;; Otherwise, resort to ripgrep, which is also faster than find
((executable-find "rg" t) ((executable-find "rg" t)
(concat "rg -0 --files --follow --color=never --hidden -g!.git" (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")))) ("find . -type f -print0"))))
(defadvice! doom--projectile-default-generic-command-a (fn &rest args) (defadvice! doom--projectile-default-generic-command-a (fn &rest args)

View file

@ -120,7 +120,7 @@
;; focus when it is started, among other things, so enable the menu-bar for ;; 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 ;; GUI frames, but keep it disabled in terminal frames because there it
;; activates an ugly, in-frame menu bar. ;; 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) (add-hook! '(window-setup-hook after-make-frame-functions)
(defun doom-restore-menu-bar-in-gui-frames-h (&optional frame) (defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
(when-let (frame (or frame (selected-frame))) (when-let (frame (or frame (selected-frame)))
@ -137,7 +137,7 @@
(setq default-input-method nil) (setq default-input-method nil)
;; ...And the clipboard on Windows could be in a wider encoding (UTF-16), so ;; ...And the clipboard on Windows could be in a wider encoding (UTF-16), so
;; leave Emacs to its own devices. ;; leave Emacs to its own devices.
(eval-when! IS-WINDOWS (eval-when! (not doom--system-windows-p)
(setq selection-coding-system 'utf-8)) (setq selection-coding-system 'utf-8))

View file

@ -107,7 +107,30 @@
"recompile it.") "recompile it.")
emacs-version old-version))) 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 ;; Emacs needs a more consistent way to detect build features, and the docs
;; claim `system-configuration-features' is not da way. Some features (that ;; claim `system-configuration-features' is not da way. Some features (that
;; don't represent packages) can be found in `features' (which `featurep' ;; don't represent packages) can be found in `features' (which `featurep'
@ -126,25 +149,30 @@
(if (not (native-comp-available-p)) (if (not (native-comp-available-p))
(delq 'native-compile features))) (delq 'native-compile features)))
;;; Global constants
;; DEPRECATED remove in v3 ;; DEPRECATED remove in v3
(defconst IS-MAC (eq system-type 'darwin)) (with-no-warnings
(defconst IS-LINUX (memq system-type '(gnu gnu/linux gnu/kfreebsd berkeley-unix))) (defconst IS-MAC doom--system-macos-p)
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos))) (defconst IS-LINUX doom--system-linux-p)
(defconst IS-BSD (memq system-type '(darwin berkeley-unix gnu/kfreebsd))) (defconst IS-WINDOWS doom--system-windows-p)
(defconst EMACS28+ (> emacs-major-version 27)) (defconst IS-BSD (memq 'bsd doom-features))
(defconst EMACS29+ (> emacs-major-version 28)) (defconst EMACS28+ (> emacs-major-version 27))
(defconst MODULES (featurep 'dynamic-modules)) (defconst EMACS29+ (> emacs-major-version 28))
(defconst NATIVECOMP (featurep 'native-compile)) (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 ;;; Fix $HOME on Windows
;; $HOME isn't normally defined on Windows, but many unix tools expect it. ;; $HOME isn't normally defined on Windows, but many unix tools expect it.
(when IS-WINDOWS (when doom--system-windows-p
(when-let (realhome (when-let (realhome
(and (null (getenv-internal "HOME")) (and (null (getenv-internal "HOME"))
(getenv "USERPROFILE"))) (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") (define-obsolete-variable-alias 'doom-etc-dir 'doom-data-dir "3.0.0")
(defvar doom-data-dir (defvar doom-data-dir
(if doom-profile (if doom-profile
(if IS-WINDOWS (if doom--system-windows-p
(expand-file-name "doomemacs/data/" (getenv-internal "APPDATA")) (expand-file-name "doomemacs/data/" (getenv-internal "APPDATA"))
(expand-file-name "doom/" (or (getenv-internal "XDG_DATA_HOME") "~/.local/share"))) (expand-file-name "doom/" (or (getenv-internal "XDG_DATA_HOME") "~/.local/share")))
;; DEPRECATED: .local will be removed entirely in 3.0 ;; 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 (defvar doom-cache-dir
(if doom-profile (if doom-profile
(if IS-WINDOWS (if doom--system-windows-p
(expand-file-name "doomemacs/cache/" (getenv-internal "APPDATA")) (expand-file-name "doomemacs/cache/" (getenv-internal "APPDATA"))
(expand-file-name "doom/" (or (getenv-internal "XDG_CACHE_HOME") "~/.cache"))) (expand-file-name "doom/" (or (getenv-internal "XDG_CACHE_HOME") "~/.cache")))
;; DEPRECATED: .local will be removed entirely in 3.0 ;; 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 (defvar doom-state-dir
(if doom-profile (if doom-profile
(if IS-WINDOWS (if doom--system-windows-p
(expand-file-name "doomemacs/state/" (getenv-internal "APPDATA")) (expand-file-name "doomemacs/state/" (getenv-internal "APPDATA"))
(expand-file-name "doom/" (or (getenv-internal "XDG_STATE_HOME") "~/.local/state"))) (expand-file-name "doom/" (or (getenv-internal "XDG_STATE_HOME") "~/.local/state")))
;; DEPRECATED: .local will be removed entirely in 3.0 ;; DEPRECATED: .local will be removed entirely in 3.0
@ -470,8 +498,8 @@ users).")
(add-transient-hook! 'tool-bar-mode (tool-bar-setup))) (add-transient-hook! 'tool-bar-mode (tool-bar-setup)))
;; PERF: Unset a non-trivial list of command line options that aren't ;; PERF: Unset a non-trivial list of command line options that aren't
;; relevant to our current OS, but `command-line-1' still processes. ;; relevant to this session, but `command-line-1' still processes.
(unless IS-MAC (unless doom--system-macos-p
(setq command-line-ns-option-alist nil)) (setq command-line-ns-option-alist nil))
(unless (memq initial-window-system '(x pgtk)) (unless (memq initial-window-system '(x pgtk))
(setq command-line-x-option-alist nil))))) (setq command-line-x-option-alist nil)))))
@ -649,7 +677,7 @@ of 'doom sync' or 'doom gc'."
gnutls-algorithm-priority gnutls-algorithm-priority
(when (boundp 'libgnutls-version) (when (boundp 'libgnutls-version)
(concat "SECURE128:+SECURE192:-VERS-ALL" (concat "SECURE128:+SECURE192:-VERS-ALL"
(if (and (not IS-WINDOWS) (if (and (not doom--system-windows-p)
(>= libgnutls-version 30605)) (>= libgnutls-version 30605))
":+VERS-TLS1.3") ":+VERS-TLS1.3")
":+VERS-TLS1.2")) ":+VERS-TLS1.2"))
@ -713,6 +741,8 @@ appropriately against `noninteractive' or the `cli' context."
(defun doom--begin-init-h () (defun doom--begin-init-h ()
"Begin the startup process." "Begin the startup process."
(when (doom-context-push 'init) (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 ;; Remember these variables' initial values, so we can safely reset them at
;; a later time, or consult them without fear of contamination. ;; a later time, or consult them without fear of contamination.
(dolist (var '(exec-path load-path process-environment)) (dolist (var '(exec-path load-path process-environment))

View file

@ -4,8 +4,8 @@
(defun doom-system-distro () (defun doom-system-distro ()
"Return a symbol representing the installed distro." "Return a symbol representing the installed distro."
(with-memoization (get 'doom-system-distro 'cached-value) (with-memoization (get 'doom-system-distro 'cached-value)
(cond (IS-WINDOWS 'windows) (cond (doom--system-windows-p 'windows)
(IS-MAC 'macos) (doom--system-macos-p 'macos)
((ignore-errors ((ignore-errors
(with-file-contents! "/etc/os-release" (with-file-contents! "/etc/os-release"
(when (re-search-forward "^ID=\"?\\([^\"\n]+\\)\"?" nil t) (when (re-search-forward "^ID=\"?\\([^\"\n]+\\)\"?" nil t)

View file

@ -1,9 +1,9 @@
;;; app/everywhere/doctor.el -*- lexical-binding: t; -*- ;;; app/everywhere/doctor.el -*- lexical-binding: t; -*-
(when IS-WINDOWS (when (featurep :system 'windows)
(error! "emacs-everywhere package does not support windows.")) (error! "emacs-everywhere package does not support windows."))
(when IS-LINUX (when (featurep :system 'linux)
(let (unmet-deps) (let (unmet-deps)
(dolist (dep '("xclip" "xdotool" "xprop" "xwininfo")) (dolist (dep '("xclip" "xdotool" "xprop" "xwininfo"))
(unless (executable-find dep) (unless (executable-find dep)

View file

@ -187,8 +187,8 @@ playback.")
(setq circe-notifications-watch-strings +irc-notifications-watch-strings (setq circe-notifications-watch-strings +irc-notifications-watch-strings
circe-notifications-emacs-focused nil circe-notifications-emacs-focused nil
circe-notifications-alert-style circe-notifications-alert-style
(cond (IS-MAC 'osx-notifier) (cond ((featurep :system 'macos) 'osx-notifier)
(IS-LINUX 'libnotify) ((featurep :system 'linux) 'libnotify)
(circe-notifications-alert-style)))) (circe-notifications-alert-style))))

View file

@ -13,7 +13,7 @@
(cond ((setq langtool-bin (cond ((setq langtool-bin
(or (executable-find "languagetool-commandline") (or (executable-find "languagetool-commandline")
(executable-find "languagetool")))) ; for nixpkgs.languagetool (executable-find "languagetool")))) ; for nixpkgs.languagetool
(IS-MAC ((featurep :system 'macos)
(cond (cond
;; is user using home brew? ;; is user using home brew?
((file-directory-p "/usr/local/Cellar/languagetool") ((file-directory-p "/usr/local/Cellar/languagetool")
@ -25,7 +25,7 @@
;; macports compatibility ;; macports compatibility
((file-directory-p "/opt/local/share/java/LanguageTool") ((file-directory-p "/opt/local/share/java/LanguageTool")
(setq langtool-java-classpath "/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/*"))))) (setq langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*")))))

View file

@ -148,7 +148,7 @@ Can be negative.")
(defvar helm-generic-files-map (make-sparse-keymap)) (defvar helm-generic-files-map (make-sparse-keymap))
(after! helm-locate (after! helm-locate
(when (and IS-MAC (when (and (featurep :system 'macos)
(null helm-locate-command) (null helm-locate-command)
(executable-find "mdfind")) (executable-find "mdfind"))
(setq helm-locate-command "mdfind -name %s")) (setq helm-locate-command "mdfind -name %s"))

View file

@ -237,7 +237,7 @@ results buffer.")
(add-to-list 'ivy-sort-functions-alist '(counsel-imenu)) (add-to-list 'ivy-sort-functions-alist '(counsel-imenu))
;; `counsel-locate' ;; `counsel-locate'
(when IS-MAC (when (featurep :system 'macos)
;; Use spotlight on mac by default since it doesn't need any additional setup ;; Use spotlight on mac by default since it doesn't need any additional setup
(setq counsel-locate-cmd #'counsel-locate-cmd-mdfind)) (setq counsel-locate-cmd #'counsel-locate-cmd-mdfind))
@ -276,13 +276,13 @@ results buffer.")
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
collect "--exclude" collect "--exclude"
collect dir) collect dir)
(if IS-WINDOWS '("--path-separator=/"))))) (if (featurep :system 'windows) '("--path-separator=/")))))
((executable-find "rg" t) ((executable-find "rg" t)
(append (list "rg" "--hidden" "--files" "--follow" "--color=never" "--no-messages") (append (list "rg" "--hidden" "--files" "--follow" "--color=never" "--no-messages")
(cl-loop for dir in projectile-globally-ignored-directories (cl-loop for dir in projectile-globally-ignored-directories
collect "--glob" collect "--glob"
collect (concat "!" dir)) collect (concat "!" dir))
(if IS-WINDOWS '("--path-separator=/")))) (if (featurep :system 'windows) '("--path-separator=/"))))
((cons find-program args))) ((cons find-program args)))
(unless (listp args) (unless (listp args)
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly.")) (user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))

View file

@ -153,7 +153,7 @@ orderless."
;; https://github.com/sharkdp/fd/issues/839 ;; https://github.com/sharkdp/fd/issues/839
"--full-path --absolute-path" "--full-path --absolute-path"
"--hidden --exclude .git" "--hidden --exclude .git"
(when IS-WINDOWS "--path-separator=/")))) (if (featurep :system 'windows) "--path-separator=/"))))
(consult-customize (consult-customize
consult-ripgrep consult-git-grep consult-grep consult-ripgrep consult-git-grep consult-grep

View file

@ -228,7 +228,7 @@
:g "M-8" #'+workspace/switch-to-7 :g "M-8" #'+workspace/switch-to-7
:g "M-9" #'+workspace/switch-to-8 :g "M-9" #'+workspace/switch-to-8
:g "M-0" #'+workspace/switch-to-final :g "M-0" #'+workspace/switch-to-final
(:when IS-MAC (:when (featurep :system 'macos)
:g "s-t" #'+workspace/new :g "s-t" #'+workspace/new
:g "s-T" #'+workspace/display :g "s-T" #'+workspace/display
:n "s-1" #'+workspace/switch-to-0 :n "s-1" #'+workspace/switch-to-0

View file

@ -24,7 +24,7 @@ If ARG (universal argument), runs `compile' from the current directory."
generate `completing-read' candidates." generate `completing-read' candidates."
(interactive) (interactive)
(call-interactively (call-interactively
(if (and (not IS-MAC) (executable-find "man")) (if (and (not (featurep :system 'macos)) (executable-find "man"))
(or (command-remapping #'man) (or (command-remapping #'man)
#'man) #'man)
#'woman))) #'woman)))

View file

@ -81,7 +81,7 @@
;;;###package tramp ;;;###package tramp
(unless IS-WINDOWS (unless (featurep :system 'windows)
(setq tramp-default-method "ssh")) ; faster than the default scp (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)) (define-key tabulated-list-mode-map "q" #'quit-window))
;; OS specific fixes ;; OS specific fixes
(when IS-MAC (when (featurep :system 'macos)
;; Fix MacOS shift+tab ;; Fix MacOS shift+tab
(define-key key-translation-map [S-iso-lefttab] [backtab]) (define-key key-translation-map [S-iso-lefttab] [backtab])
;; Fix conventional OS keys in Emacs ;; 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 :gi "C-S-RET" #'+default/newline-above
:gn [C-S-return] #'+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-RET" #'+default/newline-below
:gn [s-return] #'+default/newline-below :gn [s-return] #'+default/newline-below
:gn "S-s-RET" #'+default/newline-above :gn "S-s-RET" #'+default/newline-above

View file

@ -17,7 +17,7 @@
(indent 0)) (indent 0))
(with-current-buffer formatted-buffer (with-current-buffer formatted-buffer
(erase-buffer) (erase-buffer)
(unless IS-WINDOWS (unless (featurep :system 'windows)
(setq-local coding-system-for-read 'utf-8) (setq-local coding-system-for-read 'utf-8)
(setq-local coding-system-for-write 'utf-8)) (setq-local coding-system-for-write 'utf-8))
;; Ensure this temp buffer seems as much like the origin buffer as ;; Ensure this temp buffer seems as much like the origin buffer as

View file

@ -74,8 +74,7 @@
(apply fn args))) (apply fn args)))
;; REVIEW This is tremendously slow on macos and windows for some reason. ;; REVIEW This is tremendously slow on macos and windows for some reason.
(setq evil-mc-enable-bar-cursor (not (or IS-MAC (setq evil-mc-enable-bar-cursor (featurep :system 'linux))
IS-WINDOWS)))
(after! smartparens (after! smartparens
;; Make evil-mc cooperate with smartparens better ;; Make evil-mc cooperate with smartparens better

View file

@ -11,12 +11,13 @@
hy-mode) . parinfer-rust-mode) hy-mode) . parinfer-rust-mode)
:init :init
(setq parinfer-rust-library (setq parinfer-rust-library
(concat doom-data-dir "parinfer-rust/" (file-name-concat
(cond (IS-MAC "parinfer-rust-darwin.so") doom-data-dir "parinfer-rust/"
(IS-LINUX "parinfer-rust-linux.so") (cond ((featurep :system 'macos) "parinfer-rust-darwin.so")
(IS-WINDOWS "parinfer-rust-windows.dll") ((featurep :system 'linux) "parinfer-rust-linux.so")
(IS-BSD "libparinfer_rust.so"))) ((featurep :system 'windows) "parinfer-rust-windows.dll")
parinfer-rust-auto-download (not IS-BSD)) ((featurep :system 'bsd) "libparinfer_rust.so")))
parinfer-rust-auto-download (not (featurep :system 'bsd)))
:config :config
(map! :map parinfer-rust-mode-map (map! :map parinfer-rust-mode-map
:localleader :localleader

View file

@ -29,7 +29,7 @@
(set-evil-initial-state! 'image-dired-display-image-mode 'emacs) (set-evil-initial-state! 'image-dired-display-image-mode 'emacs)
(let ((args (list "-ahl" "-v" "--group-directories-first"))) (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 ;; Use GNU ls as `gls' from `coreutils' if available. Add `(setq
;; dired-use-ls-dired nil)' to your config to suppress the Dired warning ;; dired-use-ls-dired nil)' to your config to suppress the Dired warning
;; when not using GNU ls. ;; when not using GNU ls.
@ -188,9 +188,9 @@ we have to clean it up ourselves."
;; deleted directory. Of course I do! ;; deleted directory. Of course I do!
(setq dired-clean-confirm-killing-deleted-buffers nil) (setq dired-clean-confirm-killing-deleted-buffers nil)
;; Let OS decide how to open certain files ;; Let OS decide how to open certain files
(when-let (cmd (cond (IS-MAC "open") (when-let (cmd (cond ((featurep :system 'macos) "open")
(IS-LINUX "xdg-open") ((featurep :system 'linux) "xdg-open")
(IS-WINDOWS "start"))) ((featurep :system 'windows) "start")))
(setq dired-guess-shell-alist-user (setq dired-guess-shell-alist-user
`(("\\.\\(?:docx\\|pdf\\|djvu\\|eps\\)\\'" ,cmd) `(("\\.\\(?:docx\\|pdf\\|djvu\\|eps\\)\\'" ,cmd)
("\\.\\(?:jpe?g\\|png\\|gif\\|xpm\\)\\'" ,cmd) ("\\.\\(?:jpe?g\\|png\\|gif\\|xpm\\)\\'" ,cmd)

View file

@ -1,4 +1,4 @@
;;; emacs/dired/doctor.el -*- lexical-binding: t; -*- ;;; 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")) (warn! "Cannot find gls (GNU ls). This may cause issues with dired"))

View file

@ -5,7 +5,7 @@
;; 2021, amirite? ;; 2021, amirite?
(setq-default vc-handled-backends '(SVN Git Hg)) (setq-default vc-handled-backends '(SVN Git Hg))
(when IS-WINDOWS (when (featurep :system 'windows)
(setenv "GIT_ASKPASS" "git-gui--askpass")) (setenv "GIT_ASKPASS" "git-gui--askpass"))
;; In case the user is using `bug-reference-mode' ;; In case the user is using `bug-reference-mode'

View file

@ -6,7 +6,7 @@
(defun +org-msg-img-scale-css (img-uri) (defun +org-msg-img-scale-css (img-uri)
"For a given IMG-URI, use imagemagick to find its width." "For a given IMG-URI, use imagemagick to find its width."
(if +org-msg-currently-exporting (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") (let ((width-call (and (executable-find "identify")
(doom-call-process "identify" "-format" "%w" (doom-call-process "identify" "-format" "%w"
(substring img-uri 7))))) ; 7=(length "file://") (substring img-uri 7))))) ; 7=(length "file://")

View file

@ -365,7 +365,7 @@ This should already be the case yet it does not always seem to be."
(read-only-mode -1)) (read-only-mode -1))
;; process lock control ;; process lock control
(when IS-WINDOWS (when (featurep :system 'windows)
(setq (setq
+mu4e-lock-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock") +mu4e-lock-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock")
+mu4e-lock-request-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock_request"))) +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))) t)))
mails))) mails)))
(when IS-LINUX (when (featurep :system 'linux)
(mu4e-alert-set-default-style 'libnotify) (mu4e-alert-set-default-style 'libnotify)
(defvar +mu4e-alert-bell-cmd '("paplay" . "/usr/share/sounds/freedesktop/stereo/message.oga") (defvar +mu4e-alert-bell-cmd '("paplay" . "/usr/share/sounds/freedesktop/stereo/message.oga")

View file

@ -9,7 +9,7 @@
You may not have a way of fetching mail.")) You may not have a way of fetching mail."))
(when (and (modulep! +org) (when (and (modulep! +org)
(not IS-WINDOWS)) (not (featurep :system 'windows)))
(unless (executable-find "identify") (unless (executable-find "identify")
(warn! "Couldn't find the identify command from imagemagick. \ (warn! "Couldn't find the identify command from imagemagick. \
LaTeX fragment re-scaling with org-msg will not work."))) LaTeX fragment re-scaling with org-msg will not work.")))

View file

@ -17,7 +17,7 @@ This is ignored by ccls.")
`((c-mode . nil) `((c-mode . nil)
(c++-mode (c++-mode
. ,(list "-std=c++1z" ; use C++17 draft by default . ,(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 ;; NOTE beware: you'll get abi-inconsistencies when passing
;; std-objects to libraries linked with libstdc++ (e.g. if you ;; std-objects to libraries linked with libstdc++ (e.g. if you
;; use boost which wasn't compiled with libc++) ;; 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 ;; NOTE : This setting is untested yet
(after! eglot (after! eglot
(when IS-MAC (when (featurep :system 'macos)
(add-to-list 'eglot-workspace-configuration (add-to-list 'eglot-workspace-configuration
`((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1" `((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-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 (setq-hook! 'lsp-configure-hook
ccls-sem-highlight-method (if lsp-enable-semantic-highlighting ccls-sem-highlight-method (if lsp-enable-semantic-highlighting
ccls-sem-highlight-method)) ccls-sem-highlight-method))
(when (or IS-MAC (when (or (featurep :system 'macos)
IS-LINUX) (featurep :system 'linux))
(setq ccls-initialization-options (setq ccls-initialization-options
`(:index (:trackDependency 1 `(:index (:trackDependency 1
:threads ,(max 1 (/ (doom-system-cpus) 2)))))) :threads ,(max 1 (/ (doom-system-cpus) 2))))))
(when IS-MAC (when (featurep :system 'macos)
(setq ccls-initialization-options (setq ccls-initialization-options
(append ccls-initialization-options (append ccls-initialization-options
`(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1" `(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"

View file

@ -9,7 +9,7 @@
(`skim (`skim
(when-let (when-let
(app-path (app-path
(and IS-MAC (and (featurep :system 'macos)
(file-exists-p! (or "/Applications/Skim.app" (file-exists-p! (or "/Applications/Skim.app"
"~/Applications/Skim.app")))) "~/Applications/Skim.app"))))
(add-to-list 'TeX-view-program-selection '(output-pdf "Skim")) (add-to-list 'TeX-view-program-selection '(output-pdf "Skim"))
@ -18,7 +18,7 @@
app-path))))) app-path)))))
(`sumatrapdf (`sumatrapdf
(when (and IS-WINDOWS (when (and (featurep :system 'windows)
(executable-find "SumatraPDF")) (executable-find "SumatraPDF"))
(add-to-list 'TeX-view-program-selection '(output-pdf "SumatraPDF")))) (add-to-list 'TeX-view-program-selection '(output-pdf "SumatraPDF"))))
@ -40,7 +40,7 @@
(`pdf-tools (`pdf-tools
(when (modulep! :tools pdf) (when (modulep! :tools pdf)
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools")) (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. ;; 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))) (add-to-list 'TeX-view-program-list '("PDF Tools" TeX-pdf-tools-sync-view)))
;; Update PDF buffers after successful LaTeX runs. ;; Update PDF buffers after successful LaTeX runs.

View file

@ -5,7 +5,7 @@
(format "%s %s" (format "%s %s"
(if (executable-find "love") (if (executable-find "love")
"love" "love"
(if IS-MAC "open -a love.app")) (if (featurep :system 'macos) "open -a love.app"))
(shell-quote-argument root)))) (shell-quote-argument root))))
;;;###autoload ;;;###autoload

View file

@ -34,9 +34,9 @@ lua-language-server.")
;; is a function is to dynamically change when/if `+lua-lsp-dir' does ;; is a function is to dynamically change when/if `+lua-lsp-dir' does
(list (or (executable-find "lua-language-server") (list (or (executable-find "lua-language-server")
(doom-path +lua-lsp-dir (doom-path +lua-lsp-dir
(cond (IS-MAC "bin/macOS") (cond ((featurep :system 'macos) "bin/macOS")
(IS-LINUX "bin/Linux") ((featurep :system 'linux) "bin/Linux")
(IS-WINDOWS "bin/Windows")) ((featurep :system 'windows) "bin/Windows"))
"lua-language-server")) "lua-language-server"))
"-E" "-e" "LANG=en" "-E" "-e" "LANG=en"
(doom-path +lua-lsp-dir "main.lua"))) (doom-path +lua-lsp-dir "main.lua")))

View file

@ -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 ;; This is set to `nil' by default, which causes a wrong-type-arg error
;; when you use `markdown-open'. These are more sensible defaults. ;; when you use `markdown-open'. These are more sensible defaults.
markdown-open-command markdown-open-command
(cond (IS-MAC "open") (cond ((featurep :system 'macos) "open")
(IS-LINUX "xdg-open")) ((featurep :system 'linux) "xdg-open"))
;; A sensible and simple default preamble for markdown exports that ;; A sensible and simple default preamble for markdown exports that
;; takes after the github asthetic (plus highlightjs syntax coloring). ;; takes after the github asthetic (plus highlightjs syntax coloring).

View file

@ -14,7 +14,7 @@ nimsuggest isn't installed."
(set-formatter! 'nmfmt '("nimfmt" filepath) :modes '(nim-mode)) (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) ;; TODO File PR/report upstream (https://github.com/nim-lang/nim-mode)
(defadvice! +nim--suggest-get-temp-file-name-a (path) (defadvice! +nim--suggest-get-temp-file-name-a (path)
"Removes invalid characters from the temp file path, including the unicode "Removes invalid characters from the temp file path, including the unicode

View file

@ -15,12 +15,12 @@
(width . 70) (width . 70)
(height . 25) (height . 25)
(transient . t) (transient . t)
,@(when IS-LINUX ,@(when (featurep :system 'linux)
`((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x)) `((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x))
(display . ,(or (getenv "WAYLAND_DISPLAY") (display . ,(or (getenv "WAYLAND_DISPLAY")
(getenv "DISPLAY") (getenv "DISPLAY")
":0")))) ":0"))))
,(if IS-MAC '(menu-bar-lines . 1))) ,(if (featurep :system 'macos) '(menu-bar-lines . 1)))
"TODO") "TODO")
;;;###autoload ;;;###autoload

View file

@ -3,13 +3,14 @@
(defun +org--yank-html-buffer (buffer) (defun +org--yank-html-buffer (buffer)
(with-current-buffer buffer (with-current-buffer buffer
(require 'ox-clip) (require 'ox-clip)
(cond ((or IS-WINDOWS IS-MAC) (cond ((or (featurep :system 'windows)
(featurep :system 'macos))
(shell-command-on-region (shell-command-on-region
(point-min) (point-min)
(point-max) (point-max)
(cond (IS-WINDOWS ox-clip-w32-cmd) (cond ((featurep :system 'windows) ox-clip-w32-cmd)
(IS-MAC ox-clip-osx-cmd)))) ((featurep :system 'macos) ox-clip-osx-cmd))))
(IS-LINUX ((featurep :system 'linux)
(let ((html (buffer-string))) (let ((html (buffer-string)))
(with-temp-file (make-temp-file "ox-clip-md" nil ".html") (with-temp-file (make-temp-file "ox-clip-md" nil ".html")
(insert html)) (insert html))

View file

@ -507,7 +507,7 @@ relative to `org-directory', unless it is an absolute path."
"file" :face (lambda (path) "file" :face (lambda (path)
(if (or (file-remote-p path) (if (or (file-remote-p path)
;; filter out network shares on windows (slow) ;; 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)) (file-exists-p path))
'org-link 'org-link
'(warning org-link)))) '(warning org-link))))
@ -931,7 +931,7 @@ between the two."
[C-return] #'+org/insert-item-below [C-return] #'+org/insert-item-below
[C-S-return] #'+org/insert-item-above [C-S-return] #'+org/insert-item-above
[C-M-return] #'org-insert-subheading [C-M-return] #'org-insert-subheading
(:when IS-MAC (:when (featurep :system 'macos)
[s-return] #'+org/insert-item-below [s-return] #'+org/insert-item-below
[s-S-return] #'+org/insert-item-above [s-S-return] #'+org/insert-item-above
[s-M-return] #'org-insert-subheading) [s-M-return] #'org-insert-subheading)
@ -1391,7 +1391,7 @@ between the two."
"Advise `server-visit-files' to load `org-protocol' lazily." "Advise `server-visit-files' to load `org-protocol' lazily."
:around #'server-visit-files :around #'server-visit-files
(if (not (cl-loop with protocol = (if (not (cl-loop with protocol =
(if IS-WINDOWS (if (featurep :system 'windows)
;; On Windows, the file arguments for `emacsclient' ;; On Windows, the file arguments for `emacsclient'
;; get funnelled through `expand-file-path' by ;; get funnelled through `expand-file-path' by
;; `server-process-filter'. This substitutes ;; `server-process-filter'. This substitutes

View file

@ -26,8 +26,8 @@
(setq org-download-method 'attach (setq org-download-method 'attach
org-download-timestamp "_%Y%m%d_%H%M%S" org-download-timestamp "_%Y%m%d_%H%M%S"
org-download-screenshot-method org-download-screenshot-method
(cond (IS-MAC "screencapture -i %s") (cond ((featurep :system 'macos) "screencapture -i %s")
(IS-LINUX ((featurep :system 'linux)
(cond ((executable-find "maim") "maim -s %s") (cond ((executable-find "maim") "maim -s %s")
((executable-find "scrot") "scrot -s %s") ((executable-find "scrot") "scrot -s %s")
((executable-find "gnome-screenshot") "gnome-screenshot -a -f %s")))) ((executable-find "gnome-screenshot") "gnome-screenshot -a -f %s"))))

View file

@ -33,7 +33,7 @@
(advice-add #'org-babel-ipython-initiate-session :override #'+org-ob-ipython-initiate-session-a) (advice-add #'org-babel-ipython-initiate-session :override #'+org-ob-ipython-initiate-session-a)
;; retina resolution image hack ;; 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)) (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. ;; ipython has its own async keyword, disable ipython in ob-async.

View file

@ -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."))) (warn! "Couldn't find the dot executable (from graphviz). org-roam will not be able to generate graph visualizations.")))
(when (modulep! +dragndrop) (when (modulep! +dragndrop)
(when IS-MAC (when (featurep :system 'macos)
(unless (executable-find "pngpaste") (unless (executable-find "pngpaste")
(warn! "Couldn't find the pngpaste executable. org-download-clipboard will not work."))) (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")) (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.")) (warn! "Couldn't find the maim, scrot or gnome-screenshot executable. org-download-clipboard will not work."))
(if (string= "wayland" (getenv "XDG_SESSION_TYPE")) (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.")) (warn! "Couldn't find the wl-paste executable (from wl-clipboard). org-download-clipboard will not work."))
(unless (executable-find "xclip") (unless (executable-find "xclip")
(warn! "Couldn't find the xclip executable. org-download-clipboard will not work.")))) (warn! "Couldn't find the xclip executable. org-download-clipboard will not work."))))
(when IS-WINDOWS (when (featurep :system 'windows)
(unless (executable-find "convert") (unless (executable-find "convert")
(warn! "Couldn't find the convert program (from ImageMagick). org-download-clipboard will not work.")))) (warn! "Couldn't find the convert program (from ImageMagick). org-download-clipboard will not work."))))

View file

@ -54,7 +54,7 @@
:type git :type git
:repo "https://repo.or.cz/org-contacts.git"))) :repo "https://repo.or.cz/org-contacts.git")))
(when (and IS-MAC (when (and (featurep :system 'macos)
(modulep! :os macos)) (modulep! :os macos))
(package! org-mac-link :pin "e30171a6e98db90787ab8a23b3a7dc4fd13b10f9")) (package! org-mac-link :pin "e30171a6e98db90787ab8a23b3a7dc4fd13b10f9"))

View file

@ -83,7 +83,7 @@
(set-company-backend! 'sh-mode '(company-shell company-files)) (set-company-backend! 'sh-mode '(company-shell company-files))
(setq company-shell-delete-duplicates t (setq company-shell-delete-duplicates t
;; whatis lookups are exceptionally slow on macOS (#5860) ;; 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 (use-package! powershell

View file

@ -48,6 +48,6 @@
(when (not (fboundp 'system-move-file-to-trash)) (when (not (fboundp 'system-move-file-to-trash))
(defun system-move-file-to-trash (file) (defun system-move-file-to-trash (file)
"Move FILE to trash." "Move FILE to trash."
(when (and (not IS-LINUX) (when (and (not (featurep :system 'linux))
(not (file-remote-p default-directory))) (not (file-remote-p default-directory)))
(osx-trash-move-file-to-trash file))))) (osx-trash-move-file-to-trash file)))))

View file

@ -19,8 +19,8 @@
(add-hook 'tty-setup-hook #'xterm-mouse-mode) (add-hook 'tty-setup-hook #'xterm-mouse-mode)
;; Windows terminals don't support what I'm about to do, but best not to wrap ;; 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 ;; this in an OS check, in case you're using WSL or Cygwin, which *might*
;; *might* support it. ;; support it.
(add-hook! 'tty-setup-hook (add-hook! 'tty-setup-hook
(defun doom-init-clipboard-in-tty-emacs-h () (defun doom-init-clipboard-in-tty-emacs-h ()
;; Fix the clipboard in tty Emacs by... ;; Fix the clipboard in tty Emacs by...

View file

@ -242,7 +242,7 @@ Emacs versions < 29."
(use-package! fish-completion (use-package! fish-completion
:unless IS-WINDOWS :unless (featurep :system 'windows)
:hook (eshell-mode . fish-completion-mode) :hook (eshell-mode . fish-completion-mode)
:init (setq fish-completion-fallback-on-bash-p t :init (setq fish-completion-fallback-on-bash-p t
fish-completion-inhibit-missing-fish-command-warning t)) fish-completion-inhibit-missing-fish-command-warning t))

View file

@ -8,6 +8,6 @@
(package! eshell-did-you-mean :pin "80cd8c4b186a2fb29621cf634bcf2bcd914f1e3d") (package! eshell-did-you-mean :pin "80cd8c4b186a2fb29621cf634bcf2bcd914f1e3d")
(package! eshell-syntax-highlighting :pin "4ac27eec6595ba116a6151dfaf0b0e0440101e10") (package! eshell-syntax-highlighting :pin "4ac27eec6595ba116a6151dfaf0b0e0440101e10")
(unless IS-WINDOWS (unless (featurep :system 'windows)
(package! fish-completion :pin "d34d0b96fde63feedf13c4288183d8d4d4d748cf") (package! fish-completion :pin "d34d0b96fde63feedf13c4288183d8d4d4d748cf")
(package! bash-completion :pin "f1daac0386c24cbe8a244a62c7588cc6847b07ae")) (package! bash-completion :pin "f1daac0386c24cbe8a244a62c7588cc6847b07ae"))

View file

@ -27,7 +27,7 @@
((:lang rust +lsp) :after rustic-mode :require (dap-lldb dap-cpptools)) ((:lang rust +lsp) :after rustic-mode :require (dap-lldb dap-cpptools))
((:lang javascript +lsp) ((:lang javascript +lsp)
:after (js2-mode typescript-mode) :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") "TODO")

View file

@ -413,7 +413,7 @@ Otherwise, falls back on `find-file-at-point'."
(read-string "Look up in dictionary: ")) (read-string "Look up in dictionary: "))
current-prefix-arg)) current-prefix-arg))
(message "Looking up dictionary definition for %S" identifier) (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)) (osx-dictionary--view-result identifier))
((and +lookup-dictionary-prefer-offline ((and +lookup-dictionary-prefer-offline
(require 'wordnut nil t)) (require 'wordnut nil t))

View file

@ -216,7 +216,7 @@ Dictionary.app behind the scenes to get definitions.")
(use-package! define-word (use-package! define-word
:when (modulep! +dictionary) :when (modulep! +dictionary)
:unless IS-MAC :unless (featurep :system 'macos)
:defer t :defer t
:config :config
(setq define-word-displayfn-alist (setq define-word-displayfn-alist

View file

@ -25,7 +25,7 @@
(package! counsel-dash :pin "8decb980f111ebe7027361ee252279a9076da261"))) (package! counsel-dash :pin "8decb980f111ebe7027361ee252279a9076da261")))
(when (modulep! +dictionary) (when (modulep! +dictionary)
(if IS-MAC (if (featurep :system 'macos)
(package! osx-dictionary :pin "0715e5a3ac659df32a0f0fabfbbeef0228fbd9a9") (package! osx-dictionary :pin "0715e5a3ac659df32a0f0fabfbbeef0228fbd9a9")
(package! define-word :pin "31a8c67405afa99d0e25e7c86a4ee7ef84a808fe") (package! define-word :pin "31a8c67405afa99d0e25e7c86a4ee7ef84a808fe")
;; REVIEW: This fork fixes SavchenkoValeriy/emacs-powerthesaurus#40. ;; REVIEW: This fork fixes SavchenkoValeriy/emacs-powerthesaurus#40.

View file

@ -157,7 +157,8 @@ and cannot run in."
;; using the same composition-function-table method ;; 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 ;; 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. ;; 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)) (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, ;; NOTE: the module does not support Emacs 27 and less, but if we still try to enable ligatures,

View file

@ -1,7 +1,8 @@
;; This cond expression mimics the activation conditional of ligatures, ;; This cond expression mimics the activation conditional of ligatures,
;; with a fallback that triggers a warning. ;; with a fallback that triggers a warning.
(cond (cond
((and IS-MAC (fboundp 'mac-auto-operator-composition-mode)) ((if (featurep :system 'macos)
(fboundp 'mac-auto-operator-composition-mode))
(ignore)) (ignore))
((and (> emacs-major-version 27) ((and (> emacs-major-version 27)
@ -10,7 +11,6 @@
(featurep 'composite)) ; Emacs loads `composite' at startup (featurep 'composite)) ; Emacs loads `composite' at startup
(ignore)) (ignore))
(t ((if (featurep :system 'macos)
(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.")
(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).")))) (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)."))))

View file

@ -489,7 +489,7 @@ lines are selected, or the NxM dimensions of a block selection.")
`(:eval `(:eval
(let ((sys (coding-system-plist buffer-file-coding-system)) (let ((sys (coding-system-plist buffer-file-coding-system))
(eol (coding-system-eol-type-mnemonic 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 " ")) (concat " " eol " "))
(if (memq (plist-get sys :category) (if (memq (plist-get sys :category)
'(coding-category-undecided coding-category-utf-8)) '(coding-category-undecided coding-category-utf-8))

View file

@ -24,9 +24,7 @@
;; than the current OSes preference ;; than the current OSes preference
doom-modeline-buffer-encoding 'nondefault doom-modeline-buffer-encoding 'nondefault
doom-modeline-default-eol-type doom-modeline-default-eol-type
(cond (IS-MAC 2) (pcase doom-system ('macos 2) ('windows 1) (_ 0)))
(IS-WINDOWS 1)
(0)))
:config :config
;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS ;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS

View file

@ -110,7 +110,7 @@
;;upload ; map local to remote projects via ssh/ftp ;;upload ; map local to remote projects via ssh/ftp
:os :os
(:if IS-MAC macos) ; improve compatibility with macOS (:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience ;;tty ; improve the terminal Emacs experience
:lang :lang