mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
nit(lib): doom-compat: make version comments consistent
This commit is contained in:
@ -7,12 +7,12 @@
|
|||||||
;;
|
;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
;;; From Emacs 28+
|
;;; From Emacs >= 28
|
||||||
;; `format-spec' wasn't autoloaded until 28.1
|
;; `format-spec' wasn't autoloaded until 28.1
|
||||||
(unless (fboundp 'format-spec)
|
(unless (fboundp 'format-spec)
|
||||||
(autoload 'format-spec "format-spec"))
|
(autoload 'format-spec "format-spec"))
|
||||||
|
|
||||||
;; Introduced in Emacs 28.1
|
;; Introduced in 28.1
|
||||||
(unless (fboundp 'ensure-list)
|
(unless (fboundp 'ensure-list)
|
||||||
(defun ensure-list (object)
|
(defun ensure-list (object)
|
||||||
"Return OBJECT as a list.
|
"Return OBJECT as a list.
|
||||||
@ -21,7 +21,7 @@ one-element list containing OBJECT."
|
|||||||
(declare (pure t) (side-effect-free t))
|
(declare (pure t) (side-effect-free t))
|
||||||
(if (listp object) object (list object))))
|
(if (listp object) object (list object))))
|
||||||
|
|
||||||
;; Introduced in Emacs 28.1
|
;; Introduced in 28.1
|
||||||
(unless (fboundp 'always)
|
(unless (fboundp 'always)
|
||||||
(defun always (&rest _args)
|
(defun always (&rest _args)
|
||||||
"Do nothing and return t.
|
"Do nothing and return t.
|
||||||
@ -29,7 +29,7 @@ This function accepts any number of ARGUMENTS, but ignores them. Also see
|
|||||||
`ignore'."
|
`ignore'."
|
||||||
t))
|
t))
|
||||||
|
|
||||||
;; Introduced in Emacs 28.1
|
;; Introduced in 28.1
|
||||||
(unless (fboundp 'file-name-concat)
|
(unless (fboundp 'file-name-concat)
|
||||||
(defun file-name-concat (directory &rest components)
|
(defun file-name-concat (directory &rest components)
|
||||||
"Append COMPONENTS to DIRECTORY and return the resulting string.
|
"Append COMPONENTS to DIRECTORY and return the resulting string.
|
||||||
@ -48,7 +48,7 @@ inserted before contatenating."
|
|||||||
collect it)
|
collect it)
|
||||||
"/")))
|
"/")))
|
||||||
|
|
||||||
;; Introduced in Emacs 28.1
|
;; Introduced in 28.1
|
||||||
(unless (fboundp 'with-environment-variables)
|
(unless (fboundp 'with-environment-variables)
|
||||||
(defmacro with-environment-variables (variables &rest body)
|
(defmacro with-environment-variables (variables &rest body)
|
||||||
"Set VARIABLES in the environment and execute BODY.
|
"Set VARIABLES in the environment and execute BODY.
|
||||||
@ -65,7 +65,7 @@ The previous values will be restored upon exit."
|
|||||||
collect `(setenv ,(car var) ,(cadr var)))
|
collect `(setenv ,(car var) ,(cadr var)))
|
||||||
,@body)))
|
,@body)))
|
||||||
|
|
||||||
;; Introduced in Emacs 28.1
|
;; Introduced in 28.1
|
||||||
(unless (fboundp 'file-name-with-extension)
|
(unless (fboundp 'file-name-with-extension)
|
||||||
(defun file-name-with-extension (filename extension)
|
(defun file-name-with-extension (filename extension)
|
||||||
"Return FILENAME modified to have the specified EXTENSION.
|
"Return FILENAME modified to have the specified EXTENSION.
|
||||||
@ -90,8 +90,8 @@ See also `file-name-sans-extension'."
|
|||||||
((concat (file-name-sans-extension filename) "." extn))))))
|
((concat (file-name-sans-extension filename) "." extn))))))
|
||||||
|
|
||||||
|
|
||||||
;;; From Emacs 29+
|
;;; From Emacs >= 29
|
||||||
;; Introduced in Emacs 29+
|
;; Introduced in Emacs 29.1
|
||||||
(unless (fboundp 'with-memoization)
|
(unless (fboundp 'with-memoization)
|
||||||
(defmacro with-memoization (place &rest code)
|
(defmacro with-memoization (place &rest code)
|
||||||
"Return the value of CODE and stash it in PLACE.
|
"Return the value of CODE and stash it in PLACE.
|
||||||
@ -105,12 +105,11 @@ and return the value found in PLACE instead."
|
|||||||
,(funcall setter val)
|
,(funcall setter val)
|
||||||
,val))))))
|
,val))))))
|
||||||
|
|
||||||
;; Introduced in emacs-mirror/emacs@f117b5df4dc6, renamed to pos-* in
|
;; Introduced in 29.1
|
||||||
;; emacs-mirror/emacs@2614e5321639
|
|
||||||
(unless (fboundp 'pos-bol) (defalias 'pos-bol #'line-beginning-position))
|
(unless (fboundp 'pos-bol) (defalias 'pos-bol #'line-beginning-position))
|
||||||
(unless (fboundp 'pos-eol) (defalias 'pos-eol #'line-end-position))
|
(unless (fboundp 'pos-eol) (defalias 'pos-eol #'line-end-position))
|
||||||
|
|
||||||
;; Introduced in Emacs 29+
|
;; Introduced in 29.1
|
||||||
(unless (boundp 'major-mode-remap-alist)
|
(unless (boundp 'major-mode-remap-alist)
|
||||||
(defvar major-mode-remap-alist nil)
|
(defvar major-mode-remap-alist nil)
|
||||||
(defvar-local set-auto-mode--last nil)
|
(defvar-local set-auto-mode--last nil)
|
||||||
@ -127,7 +126,7 @@ and return the value found in PLACE instead."
|
|||||||
(setq set-auto-mode--last (cons mode major-mode)))
|
(setq set-auto-mode--last (cons mode major-mode)))
|
||||||
mode))))
|
mode))))
|
||||||
|
|
||||||
;; Introduced in Emacs 29.1
|
;; Introduced in 29.1
|
||||||
(unless (boundp 'enable-theme-functions)
|
(unless (boundp 'enable-theme-functions)
|
||||||
(defcustom enable-theme-functions nil
|
(defcustom enable-theme-functions nil
|
||||||
"Abnormal hook that is run after a theme has been enabled.
|
"Abnormal hook that is run after a theme has been enabled.
|
||||||
@ -151,8 +150,8 @@ The functions in the hook are called with one parameter -- the
|
|||||||
(run-hook-with-args 'enable-theme-functions theme))))
|
(run-hook-with-args 'enable-theme-functions theme))))
|
||||||
|
|
||||||
|
|
||||||
;;; From Emacs 30+
|
;;; From Emacs >= 30
|
||||||
;; Introduced in Emacs 30+
|
;; Introduced in 30.1
|
||||||
(unless (fboundp 'major-mode-remap)
|
(unless (fboundp 'major-mode-remap)
|
||||||
(defvar major-mode-remap-defaults nil)
|
(defvar major-mode-remap-defaults nil)
|
||||||
(defun major-mode-remap (mode)
|
(defun major-mode-remap (mode)
|
||||||
@ -161,7 +160,7 @@ The functions in the hook are called with one parameter -- the
|
|||||||
(assq mode major-mode-remap-defaults)))
|
(assq mode major-mode-remap-defaults)))
|
||||||
mode)))
|
mode)))
|
||||||
|
|
||||||
;; Introduced in Emacs 30+
|
;; Introduced in 30.1
|
||||||
(unless (boundp 'safe-local-variable-directories)
|
(unless (boundp 'safe-local-variable-directories)
|
||||||
(defvar safe-local-variable-directories ())
|
(defvar safe-local-variable-directories ())
|
||||||
(define-advice hack-local-variables-filter
|
(define-advice hack-local-variables-filter
|
||||||
|
Reference in New Issue
Block a user