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

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

[elpa] externals/compat 4364563 43/99: Use unprefixed symbols where poss


From: ELPA Syncer
Subject: [elpa] externals/compat 4364563 43/99: Use unprefixed symbols where possible
Date: Sun, 17 Oct 2021 05:57:54 -0400 (EDT)

branch: externals/compat
commit 4364563f768198ba15317985205cd217841f3671
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Use unprefixed symbols where possible
    
    Using the explicit compatibility function or variable requires all
    compatibility definitions to be loaded, while compat.el loads these
    conditionally. Therefore, void functions and variable errors can be
    raised, that avoided by using the unprefixed symbol.
---
 compat-25.1.el | 14 +++++++-------
 compat-26.1.el | 13 +++++++------
 compat-28.1.el |  2 +-
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/compat-25.1.el b/compat-25.1.el
index 4ccc02c..43141ee 100644
--- a/compat-25.1.el
+++ b/compat-25.1.el
@@ -127,15 +127,15 @@ This is like `if-let' but doesn't handle a VARLIST of the 
form
 This is like `when-let' but doesn't handle a VARLIST of the form
 \(SYMBOL SOMETHING) specially."
   :feature subr-x
-  (declare (indent 1) (debug compat--if-let*))
-  `(compat--if-let* ,varlist ,(macroexp-progn body)))
+  (declare (indent 1) (debug if-let*))
+  `(if-let* ,varlist ,(macroexp-progn body)))
 
 (compat-defmacro and-let* (varlist &rest body)
   "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 compat--if-let*))
+  (declare (indent 1) (debug if-let*))
   (let ((empty (make-symbol "s"))
         (last t) list)
     (dolist (var varlist)
@@ -173,7 +173,7 @@ with an old syntax that accepted only one binding."
              (not (listp (car spec))))
     ;; Adjust the single binding case
     (setq spec (list spec)))
-  `(compat--if-let* ,spec ,then ,@(macroexp-unprogn else)))
+  `(if-let* ,spec ,then ,@(macroexp-unprogn else)))
 
 (compat-defmacro when-let (spec &rest body)
   "Bind variables according to SPEC and conditionally evaluate BODY.
@@ -182,8 +182,8 @@ If all are non-nil, return the value of the last form in 
BODY.
 
 The variable list SPEC is the same as in `if-let'."
   :feature subr-x
-  (declare (indent 1) (debug compat--if-let))
-  (list 'compat--if-let spec (macroexp-progn body)))
+  (declare (indent 1) (debug if-let))
+  (list 'if-let spec (macroexp-progn body)))
 
 (compat-defmacro thread-first (&rest forms)
   "Thread FORMS elements as the first argument of their successor.
@@ -234,7 +234,7 @@ threading."
 
 ;;;; Defined in macroexp.el
 
-(declare macrop nil (object))
+(declare-function macrop nil (object))
 (compat-defun macroexpand-1 (form &optional environment)
   "Perform (at most) one step of macro expansion."
   :feature macroexp
diff --git a/compat-26.1.el b/compat-26.1.el
index 465e136..b38b940 100644
--- a/compat-26.1.el
+++ b/compat-26.1.el
@@ -120,12 +120,14 @@ REGEXP defaults to  \"[ \\t\\n\\r]+\"."
             string)))
     (if i (substring string 0 i) string)))
 
+(declare-function string-trim-left nil (string &optional regexp))
+(declare-function string-trim-right nil (string &optional regexp))
 (compat-defun string-trim (string &optional trim-left trim-right)
   "Trim STRING of leading with and trailing matching TRIM-LEFT and TRIM-RIGHT.
 
 TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
-  (compat--string-trim-left
-   (compat--string-trim-right
+  (string-trim-left
+   (string-trim-right
     string
     trim-right)
    trim-left))
@@ -256,9 +258,8 @@ TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
   "Return a new uninterned symbol.
 The name is made by appending `gensym-counter' to PREFIX.
 PREFIX is a string, and defaults to \"g\"."
-  (let ((num (prog1 compat--gensym-counter
-               (setq compat--gensym-counter
-                     (1+ compat--gensym-counter)))))
+  (let ((num (prog1 gensym-counter
+               (setq gensym-counter (1+ gensym-counter)))))
     (make-symbol (format "%s%d" (or prefix "g") num))))
 
 ;;;; Defined in files.el
@@ -300,7 +301,7 @@ the variable `temporary-file-directory' is returned."
                   default-directory 'temporary-file-directory)))
     (if handler
         (funcall handler 'temporary-file-directory)
-      (if (string-match compat--mounted-file-systems default-directory)
+      (if (string-match mounted-file-systems default-directory)
           default-directory
         temporary-file-directory))))
 
diff --git a/compat-28.1.el b/compat-28.1.el
index 37f1904..489188e 100644
--- a/compat-28.1.el
+++ b/compat-28.1.el
@@ -219,7 +219,7 @@ Also see `local-variable-p'."
       (void-variable nil (throw 'fail nil)))
     t))
 
-(declare gensym nil (&optional prefix))
+(declare-function gensym nil (&optional prefix))
 (compat-defmacro with-existing-directory (&rest body)
   "Execute BODY with `default-directory' bound to an existing directory.
 If `default-directory' is already an existing directory, it's not changed."



reply via email to

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