emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 7aa705b65e 02/16: Require features at compile ti


From: ELPA Syncer
Subject: [elpa] externals/compat 7aa705b65e 02/16: Require features at compile time
Date: Wed, 4 Jan 2023 07:57:26 -0500 (EST)

branch: externals/compat
commit 7aa705b65e9978a708db69aedb8059067808df91
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Require features at compile time
---
 compat-25.el   |  6 +++---
 compat-26.el   |  2 +-
 compat-27.el   |  4 ++--
 compat-28.el   | 20 ++++++++++----------
 compat-29.el   |  8 ++++----
 compat-macs.el |  5 ++++-
 6 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/compat-25.el b/compat-25.el
index f9eb80b7d2..4d25bb1bc0 100644
--- a/compat-25.el
+++ b/compat-25.el
@@ -194,7 +194,7 @@ Is equivalent to:
     (+ (- (/ (+ 5 20) 25)) 40)
 Note how the single `-' got converted into a list before
 threading."
-  :feature 'subr-x
+  :feature subr-x
   (declare (indent 1)
            (debug (form &rest [&or symbolp (sexp &rest form)])))
   (let ((body (car forms)))
@@ -219,7 +219,7 @@ Is equivalent to:
     (+ 40 (- (/ 25 (+ 20 5))))
 Note how the single `-' got converted into a list before
 threading."
-  :feature 'subr-x
+  :feature subr-x
   (declare (indent 1) (debug thread-first))
   (let ((body (car forms)))
     (dolist (form (cdr forms))
@@ -233,7 +233,7 @@ threading."
 (declare-function macrop nil (object))
 (compat-defun macroexpand-1 (form &optional environment)
   "Perform (at most) one step of macro expansion."
-  :feature 'macroexp
+  :feature macroexp
   (cond
    ((consp form)
     (let* ((head (car form))
diff --git a/compat-26.el b/compat-26.el
index f2a0cc90f2..bd7e4c704b 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -382,7 +382,7 @@ This is like `when-let' but doesn't handle a VARLIST of the 
form
   "Bind variables according to VARLIST and conditionally evaluate BODY.
 Like `when-let*', except if BODY is empty and all the bindings
 are non-nil, then the result is non-nil."
-  :feature 'subr-x
+  :feature subr-x
   (declare (indent 1)
            (debug ((&rest [&or symbolp (symbolp form) (form)])
                    body)))
diff --git a/compat-27.el b/compat-27.el
index 9883c2b14b..8e1f4b1a9b 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -720,7 +720,7 @@ The return value is a string (or nil in case we can’t find 
it)."
 (compat-defun dired-get-marked-files
     (&optional localp arg filter distinguish-one-marked error)
   "Return the marked files’ names as list of strings."
-  :feature 'dired
+  :feature dired
   :explicit t
   (let ((result (dired-get-marked-files localp arg filter 
distinguish-one-marked)))
     (if (and (null result) error)
@@ -731,7 +731,7 @@ The return value is a string (or nil in case we can’t find 
it)."
 
 (compat-defun date-days-in-month (year month)
   "The number of days in MONTH in YEAR."
-  :feature 'time-date
+  :feature time-date
   (unless (and (numberp month)
                (<= 1 month)
                (<= month 12))
diff --git a/compat-28.el b/compat-28.el
index 2d90ac9f3e..43d9538890 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -446,7 +446,7 @@ not a list, return a one-element list containing OBJECT."
 All sequences of whitespaces in STRING are collapsed into a
 single space character, and leading/trailing whitespace is
 removed."
-  :feature 'subr-x
+  :feature subr-x
   (let ((blank "[[:blank:]\r\n]+"))
     (replace-regexp-in-string
      "^[[:blank:]\r\n]+\\|[[:blank:]\r\n]+$"
@@ -459,7 +459,7 @@ removed."
 All sequences of whitespaces in STRING are collapsed into a
 single space character, and leading/trailing whitespace is
 removed."
-  :feature 'subr-x
+  :feature subr-x
   (with-temp-buffer
     (insert string)
     (goto-char (point-min))
@@ -471,7 +471,7 @@ removed."
 (compat-defun string-lines (string &optional omit-nulls)
   "Split STRING into a list of lines.
 If OMIT-NULLS, empty lines will be removed from the results."
-  :feature 'subr-x
+  :feature subr-x
   (split-string string "\n" omit-nulls))
 
 (compat-defun string-pad (string length &optional padding start)
@@ -485,7 +485,7 @@ is done.
 If START is nil (or not present), the padding is done to the end
 of the string, and if non-nil, padding is done to the start of
 the string."
-  :feature 'subr-x
+  :feature subr-x
   (unless (natnump length)
     (signal 'wrong-type-argument (list 'natnump length)))
   (let ((pad-length (- length (length string))))
@@ -499,7 +499,7 @@ the string."
 
 (compat-defun string-chop-newline (string)
   "Remove the final newline (if any) from STRING."
-  :feature 'subr-x
+  :feature subr-x
   (if (and (>= (length string) 1) (= (aref string (1- (length string))) ?\n))
       (substring string 0 -1)
     string))
@@ -510,7 +510,7 @@ Like `let', bind variables in BINDINGS and then evaluate 
BODY,
 but with the twist that BODY can evaluate itself recursively by
 calling NAME, where the arguments passed to NAME are used
 as the new values of the bound variables in the recursive invocation."
-  :feature 'subr-x
+  :feature subr-x
   (declare (indent 2) (debug (symbolp (&rest (symbolp form)) body)))
   (let ((fargs (mapcar (lambda (b)
                          (let ((var (if (consp b) (car b) b)))
@@ -760,7 +760,7 @@ just the selected frame."
   "Return the THING at mouse click.
 Like `thing-at-point', but tries to use the event
 where the mouse button is clicked to find a thing nearby."
-  :feature 'thingatpt
+  :feature thingatpt
   (save-excursion
     (mouse-set-point event)
     (thing-at-point thing no-properties)))
@@ -775,7 +775,7 @@ A non-nil result is expected to be reliable when called 
from a macro in order
 to find the file in which the macro's call was found, and it should be
 reliable as well when used at the top-level of a file.
 Other uses risk returning non-nil value that point to the wrong file."
-  :feature 'macroexp
+  :feature macroexp
   (let ((file (car (last current-load-list))))
     (or (if (stringp file) file)
         (bound-and-true-p byte-compile-current-file))))
@@ -807,7 +807,7 @@ The previous values will be be restored upon exit."
 When clicked, CALLBACK will be called with the DATA as the
 function argument.  If DATA isn't present (or is nil), the button
 itself will be used instead as the function argument."
-  :feature 'button
+  :feature button
   (propertize string
               'face 'button
               'button t
@@ -847,7 +847,7 @@ directory or directories specified."
   "Interpret DECODED as a period and return its length in seconds.
 For computational purposes, years are 365 days long and months
 are 30 days long."
-  :feature 'time-date
+  :feature time-date
   :version "28"
   ;; Inlining the definitions from compat-27
   (+ (if (consp (nth 0 time))
diff --git a/compat-29.el b/compat-29.el
index fd0ad87787..fbdd6faf37 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -347,7 +347,7 @@ character.
 When shortening strings for display purposes,
 `truncate-string-to-width' is almost always a better alternative
 than this function."
-  :feature 'subr-x
+  :feature subr-x
   (unless (natnump length)
     (signal 'wrong-type-argument (list 'natnump length)))
   (if coding-system
@@ -376,7 +376,7 @@ than this function."
 ;;* UNTESTED
 (compat-defun string-pixel-width (string)
   "Return the width of STRING in pixels."
-  :feature 'subr-x
+  :feature subr-x
   (if (zerop (length string))
       0
     ;; Keeping a work buffer around is more efficient than creating a
@@ -406,7 +406,7 @@ changes that are normally perceived as \"buffer 
modifications\", such
 as changes in text properties, `buffer-file-coding-system', buffer
 multibyteness, etc. -- will not be noticed, and the buffer will still
 be marked unmodified, effectively ignoring those changes."
-  :feature 'subr-x
+  :feature subr-x
   (declare (debug t) (indent 0))
   (let ((hash (make-symbol "hash"))
         (buffer (make-symbol "buffer")))
@@ -434,7 +434,7 @@ properties are retained.
 
 If OBJECT is non-nil, it should be a string or a buffer.  If nil,
 this defaults to the current buffer."
-  :feature 'subr-x
+  :feature subr-x
   (let ((sub-start start)
         (sub-end 0)
         disp)
diff --git a/compat-macs.el b/compat-macs.el
index f778703cf8..4dc476df26 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -34,7 +34,7 @@
   (declare (indent 1))
   (if feature
       ;; See https://nullprogram.com/blog/2018/02/22/:
-      `(eval-after-load ,feature `(funcall ',(lambda () ,body)))
+      `(eval-after-load ',feature `(funcall ',(lambda () ,body)))
     body))
 
 (defun compat--generate (name def-fn install-fn check-fn attr)
@@ -91,6 +91,9 @@ ignored:
                   nil)
                  (`(when (and ,(if cond cond t)
                               ,(funcall check-fn)))))))
+    (when feature
+      (unless (require feature nil t)
+        (setq feature nil)))
     (when (and (plist-get attr :realname)
                (string= name (plist-get attr :realname)))
       (error "%S: Name is equal to realname" name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]