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

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

[elpa] externals/compat 601387077a 04/16: Always require subr-x at compi


From: ELPA Syncer
Subject: [elpa] externals/compat 601387077a 04/16: Always require subr-x at compile time
Date: Wed, 4 Jan 2023 07:57:26 -0500 (EST)

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

    Always require subr-x at compile time
---
 compat-25.el   |  2 --
 compat-26.el   | 13 ++-----------
 compat-28.el   | 10 +++-------
 compat-29.el   |  4 ----
 compat-macs.el |  5 +++++
 5 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/compat-25.el b/compat-25.el
index 4d25bb1bc0..8571a7e899 100644
--- a/compat-25.el
+++ b/compat-25.el
@@ -194,7 +194,6 @@ Is equivalent to:
     (+ (- (/ (+ 5 20) 25)) 40)
 Note how the single `-' got converted into a list before
 threading."
-  :feature subr-x
   (declare (indent 1)
            (debug (form &rest [&or symbolp (sexp &rest form)])))
   (let ((body (car forms)))
@@ -219,7 +218,6 @@ Is equivalent to:
     (+ 40 (- (/ 25 (+ 20 5))))
 Note how the single `-' got converted into a list before
 threading."
-  :feature subr-x
   (declare (indent 1) (debug thread-first))
   (let ((body (car forms)))
     (dolist (form (cdr forms))
diff --git a/compat-26.el b/compat-26.el
index bd7e4c704b..987da44744 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -179,8 +179,6 @@ from the absolute start of the buffer, disregarding the 
narrowing."
   "Trim STRING of leading string matching REGEXP.
 
 REGEXP defaults to \"[ \\t\\n\\r]+\"."
-  :realname compat--internal-string-trim-left
-  :explicit t
   (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string)
       (substring string (match-end 0))
     string))
@@ -189,8 +187,6 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"."
   "Trim STRING of trailing string matching REGEXP.
 
 REGEXP defaults to  \"[ \\t\\n\\r]+\"."
-  :realname compat--internal-string-trim-right
-  :explicit t
   (let ((i (string-match-p
             (concat "\\(?:" (or regexp "[ \t\n\r]+") "\\)\\'")
             string)))
@@ -200,12 +196,8 @@ REGEXP defaults to  \"[ \\t\\n\\r]+\"."
   "Trim STRING of leading with and trailing matching TRIM-LEFT and TRIM-RIGHT.
 
 TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
-  :explicit t
-  ;; `string-trim-left' and `string-trim-right' were moved from subr-x
-  ;; to subr in Emacs 27, so to avoid loading subr-x we use the
-  ;; compatibility function here:
-  (compat--internal-string-trim-left
-   (compat--internal-string-trim-right
+  (string-trim-left
+   (string-trim-right
     string
     trim-right)
    trim-left))
@@ -382,7 +374,6 @@ 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
   (declare (indent 1)
            (debug ((&rest [&or symbolp (symbolp form) (form)])
                    body)))
diff --git a/compat-28.el b/compat-28.el
index 43d9538890..35d98514bc 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -446,7 +446,6 @@ 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
   (let ((blank "[[:blank:]\r\n]+"))
     (replace-regexp-in-string
      "^[[:blank:]\r\n]+\\|[[:blank:]\r\n]+$"
@@ -459,7 +458,6 @@ removed."
 All sequences of whitespaces in STRING are collapsed into a
 single space character, and leading/trailing whitespace is
 removed."
-  :feature subr-x
   (with-temp-buffer
     (insert string)
     (goto-char (point-min))
@@ -471,7 +469,6 @@ 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
   (split-string string "\n" omit-nulls))
 
 (compat-defun string-pad (string length &optional padding start)
@@ -485,7 +482,6 @@ 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
   (unless (natnump length)
     (signal 'wrong-type-argument (list 'natnump length)))
   (let ((pad-length (- length (length string))))
@@ -499,7 +495,6 @@ the string."
 
 (compat-defun string-chop-newline (string)
   "Remove the final newline (if any) from STRING."
-  :feature subr-x
   (if (and (>= (length string) 1) (= (aref string (1- (length string))) ?\n))
       (substring string 0 -1)
     string))
@@ -510,7 +505,6 @@ 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
   (declare (indent 2) (debug (symbolp (&rest (symbolp form)) body)))
   (let ((fargs (mapcar (lambda (b)
                          (let ((var (if (consp b) (car b) b)))
@@ -605,7 +599,9 @@ Errors if the FILENAME or EXTENSION are empty, or if the 
given
 FILENAME has the format of a directory.
 
 See also `file-name-sans-extension'."
-  (let ((extn (compat--internal-string-trim-left extension "[.]")))
+  (let ((extn (if (string-prefix-p "." extension)
+                  (substring extension 1)
+                extension)))
     (cond
      ((string= filename "")
       (error "Empty filename"))
diff --git a/compat-29.el b/compat-29.el
index fbdd6faf37..774b3a05f0 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -347,7 +347,6 @@ character.
 When shortening strings for display purposes,
 `truncate-string-to-width' is almost always a better alternative
 than this function."
-  :feature subr-x
   (unless (natnump length)
     (signal 'wrong-type-argument (list 'natnump length)))
   (if coding-system
@@ -376,7 +375,6 @@ than this function."
 ;;* UNTESTED
 (compat-defun string-pixel-width (string)
   "Return the width of STRING in pixels."
-  :feature subr-x
   (if (zerop (length string))
       0
     ;; Keeping a work buffer around is more efficient than creating a
@@ -406,7 +404,6 @@ 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
   (declare (debug t) (indent 0))
   (let ((hash (make-symbol "hash"))
         (buffer (make-symbol "buffer")))
@@ -434,7 +431,6 @@ 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
   (let ((sub-start start)
         (sub-end 0)
         disp)
diff --git a/compat-macs.el b/compat-macs.el
index 4dc476df26..c06fc00d8f 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -91,6 +91,11 @@ ignored:
                   nil)
                  (`(when (and ,(if cond cond t)
                               ,(funcall check-fn)))))))
+    ;; We always require subr-x for the check since many functions have been
+    ;; moved around
+    (when (eq feature 'subr-x)
+      (error "Feature subr-x is forbidden"))
+    (require 'subr-x)
     (when feature
       (unless (require feature nil t)
         (setq feature nil)))



reply via email to

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