From 72c7ee2e525d87b58a28aea8af8cef31f607d7c0 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 3 Aug 2022 01:40:32 +0200 Subject: Avoid cl-cXXXr compat aliases * lisp/emacs-lisp/cl-lib.el (cl-third, cl-fourth): * lisp/emacs-lisp/cl-macs.el (cl--do-&aux, cl--do-arglist) (cl--parse-loop-clause, cl--loop-let, cl--loop-build-ands) (cl--do-proclaim, cl-defstruct): Prefer using cXXXr functions directly, instead of cl-cXXXr prefixed compat aliases. --- lisp/emacs-lisp/cl-macs.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lisp/emacs-lisp/cl-macs.el') diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 727b3098e34..12917c99e10 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -527,7 +527,7 @@ its argument list allows full Common Lisp conventions." (while (and (eq (car args) '&aux) (pop args)) (while (and args (not (memq (car args) cl--lambda-list-keywords))) (if (consp (car args)) - (if (and cl--bind-enquote (cl-cadar args)) + (if (and cl--bind-enquote (cadar args)) (cl--do-arglist (caar args) `',(cadr (pop args))) (cl--do-arglist (caar args) (cadr (pop args)))) @@ -612,7 +612,7 @@ its argument list allows full Common Lisp conventions." (if (eq ?_ (aref name 0)) (setq name (substring name 1))) (intern (format ":%s" name))))) - (varg (if (consp (car arg)) (cl-cadar arg) (car arg))) + (varg (if (consp (car arg)) (cadar arg) (car arg))) (def (if (cdr arg) (cadr arg) ;; The ordering between those two or clauses is ;; irrelevant, since in practice only one of the two @@ -1339,7 +1339,7 @@ For more details, see Info node `(cl)Loop Facility'. (temp-idx (if (eq (car cl--loop-args) 'using) (if (and (= (length (cadr cl--loop-args)) 2) - (eq (cl-caadr cl--loop-args) 'index)) + (eq (caadr cl--loop-args) 'index)) (cadr (cl--pop2 cl--loop-args)) (error "Bad `using' clause")) (make-symbol "--cl-idx--")))) @@ -1370,8 +1370,8 @@ For more details, see Info node `(cl)Loop Facility'. (other (if (eq (car cl--loop-args) 'using) (if (and (= (length (cadr cl--loop-args)) 2) - (memq (cl-caadr cl--loop-args) hash-types) - (not (eq (cl-caadr cl--loop-args) word))) + (memq (caadr cl--loop-args) hash-types) + (not (eq (caadr cl--loop-args) word))) (cadr (cl--pop2 cl--loop-args)) (error "Bad `using' clause")) (make-symbol "--cl-var--")))) @@ -1433,8 +1433,8 @@ For more details, see Info node `(cl)Loop Facility'. (other (if (eq (car cl--loop-args) 'using) (if (and (= (length (cadr cl--loop-args)) 2) - (memq (cl-caadr cl--loop-args) key-types) - (not (eq (cl-caadr cl--loop-args) word))) + (memq (caadr cl--loop-args) key-types) + (not (eq (caadr cl--loop-args) word))) (cadr (cl--pop2 cl--loop-args)) (error "Bad `using' clause")) (make-symbol "--cl-var--")))) @@ -1656,7 +1656,7 @@ If BODY is `setq', then use SPECS for assignments rather than for bindings." (let ((temps nil) (new nil)) (when par (let ((p specs)) - (while (and p (or (symbolp (car-safe (car p))) (null (cl-cadar p)))) + (while (and p (or (symbolp (car-safe (car p))) (null (cadar p)))) (setq p (cdr p))) (when p (setq par nil) @@ -1731,7 +1731,7 @@ such that COMBO is equivalent to (and . CLAUSES)." (setq clauses (cons (nconc (butlast (car clauses)) (if (eq (car-safe (cadr clauses)) 'progn) - (cl-cdadr clauses) + (cdadr clauses) (list (cadr clauses)))) (cddr clauses))) ;; A final (progn ,@A t) is moved outside of the `and'. @@ -2613,7 +2613,7 @@ Example: ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings)) (while (setq spec (cdr spec)) (if (consp (car spec)) - (if (eq (cl-cadar spec) 0) + (if (eq (cadar spec) 0) (byte-compile-disable-warning (caar spec)) (byte-compile-enable-warning (caar spec))))))) nil) @@ -3093,9 +3093,9 @@ To see the documentation for a defined struct type, use (t `(and (consp cl-x) (memq (nth ,pos cl-x) ,tag-symbol)))))) pred-check (and pred-form (> safety 0) - (if (and (eq (cl-caadr pred-form) 'vectorp) + (if (and (eq (caadr pred-form) 'vectorp) (= safety 1)) - (cons 'and (cl-cdddr pred-form)) + (cons 'and (cdddr pred-form)) `(,predicate cl-x)))) (when pred-form (push `(,defsym ,predicate (cl-x) -- cgit v1.2.3 From 4c1bc8315d8e677e4eeb2760d7a5ab7b7553359b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 4 Aug 2022 11:02:49 +0200 Subject: Fix up some prefix registration problems in doc strings * lisp/uniquify.el (uniquify-buffer-name-style): * lisp/org/ob-core.el (org-src-sha): * lisp/emacs-lisp/cl-macs.el (cl--optimize): * lisp/battery.el (battery-update-functions): Avoid triggering the `register-definition-prefixes' in doc strings (bug#56968). --- lisp/battery.el | 16 ++++++++-------- lisp/emacs-lisp/cl-macs.el | 6 +++--- lisp/org/ob-core.el | 12 ++++++------ lisp/uniquify.el | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'lisp/emacs-lisp/cl-macs.el') diff --git a/lisp/battery.el b/lisp/battery.el index 3cff3167a6c..93f4070e4bc 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -255,14 +255,14 @@ of the following information may or may not be available: For instance, to play an alarm when the battery power dips below 10%, you could use a function like the following: -(defvar my-prev-battery nil) -(defun my-battery-alarm (data) - (when (and my-prev-battery - (equal (alist-get ?L data) \"off-line\") - (< (string-to-number (alist-get ?p data)) 10) - (>= (string-to-number (alist-get ?p my-prev-battery)) 10)) - (play-sound-file \"~/alarm.wav\" 5)) - (setq my-prev-battery data))" + (defvar my-prev-battery nil) + (defun my-battery-alarm (data) + (when (and my-prev-battery + (equal (alist-get ?L data) \"off-line\") + (< (string-to-number (alist-get ?p data)) 10) + (>= (string-to-number (alist-get ?p my-prev-battery)) 10)) + (play-sound-file \"~/alarm.wav\" 5)) + (setq my-prev-battery data))" :version "29.1" :type '(repeat function)) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 12917c99e10..eefaa36b911 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2563,9 +2563,9 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C). (defun cl--optimize (f _args &rest qualities) "Serve `cl-optimize' in function declarations. Example: -(defun foo (x) - (declare (cl-optimize (speed 3) (safety 0))) - x)" + (defun foo (x) + (declare (cl-optimize (speed 3) (safety 0))) + x)" ;; FIXME this should make use of `cl--declare-stack' but I suspect ;; this mechanism should be reviewed first. (cl-loop for (qly val) in qualities diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 3d159ed38a9..3b114703cdc 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el @@ -488,13 +488,13 @@ arguments, imagine you'd like to set the file name output of a latex source block to a sha1 of its contents. We could achieve this with: -(defun org-src-sha () - (let ((elem (org-element-at-point))) - (concat (sha1 (org-element-property :value elem)) \".svg\"))) + (defun org-src-sha () + (let ((elem (org-element-at-point))) + (concat (sha1 (org-element-property :value elem)) \".svg\"))) -(setq org-babel-default-header-args:latex - `((:results . \"file link replace\") - (:file . (lambda () (org-src-sha))))) + (setq org-babel-default-header-args:latex + `((:results . \"file link replace\") + (:file . (lambda () (org-src-sha))))) Because the closure is evaluated with point at the source block, the call to `org-element-at-point' above will always retrieve diff --git a/lisp/uniquify.el b/lisp/uniquify.el index b75b47c03c5..74655e299a8 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -109,8 +109,8 @@ BASE and EXTRA-STRINGS where BASE is a string and EXTRA-STRINGS is a list of strings. For example the current implementation for post-forward-angle-brackets could be: -(defun my-post-forward-angle-brackets (base extra-string) - (concat base \"<\" (mapconcat #\\='identity extra-string \"/\") \">\")) + (defun my-post-forward-angle-brackets (base extra-string) + (concat base \"<\" (mapconcat #\\='identity extra-string \"/\") \">\")) The \"mumble\" part may be stripped as well, depending on the setting of `uniquify-strip-common-suffix'. For more options that -- cgit v1.2.3