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

@ -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

View file

@ -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))

View file

@ -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

View file

@ -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"))))

View file

@ -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.

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.")))
(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."))))

View file

@ -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"))