Merge from origin/emacs-29

de2239a584 Revert "alist-get testfn argument evaluation correction"
856d889f3a Revert "Elide broken but unnecessary `if` optimisations"
8e42e20ed7 Revert "Use equal and member instead of eq and memq"
This commit is contained in:
Stefan Kangas 2022-12-19 04:42:18 +01:00
commit d468cf91b9
9 changed files with 18 additions and 16 deletions

View file

@ -1731,7 +1731,7 @@ Display mechanism using tooltip for a list of possible completions.")
;; Add any tail info. ;; Add any tail info.
(setq msg (concat msg msg-tail)) (setq msg (concat msg msg-tail))
;; Display tooltip. ;; Display tooltip.
(when (not (equal msg "")) (when (not (eq msg ""))
(semantic-displayer-tooltip-show msg))))) (semantic-displayer-tooltip-show msg)))))
;;; Compatibility ;;; Compatibility

View file

@ -366,7 +366,7 @@ This function is semi-obsolete. Use `get-char-code-property'."
;; description is added to the category name as a tooltip ;; description is added to the category name as a tooltip
(defsubst describe-char-categories (category-set) (defsubst describe-char-categories (category-set)
(let ((mnemonics (category-set-mnemonics category-set))) (let ((mnemonics (category-set-mnemonics category-set)))
(unless (equal mnemonics "") (unless (eq mnemonics "")
(list (mapconcat (list (mapconcat
(lambda (x) (lambda (x)
(let* ((c (category-docstring x)) (let* ((c (category-docstring x))

View file

@ -1298,8 +1298,11 @@ See Info node `(elisp) Integer Basics'."
(if else (if else
`(progn ,condition ,@else) `(progn ,condition ,@else)
condition)) condition))
;; (if X t) -> (not (not X)) ;; (if X nil t) -> (not X)
((and (eq then t) (null else)) ((and (eq then nil) (eq else '(t)))
`(not ,condition))
;; (if X t [nil]) -> (not (not X))
((and (eq then t) (or (null else) (eq else '(nil))))
`(not ,(byte-opt--negate condition))) `(not ,(byte-opt--negate condition)))
;; (if VAR VAR X...) -> (or VAR (progn X...)) ;; (if VAR VAR X...) -> (or VAR (progn X...))
((and (symbolp condition) (eq condition then)) ((and (symbolp condition) (eq condition then))

View file

@ -417,9 +417,9 @@ The return value is the last VAL in the list.
(lambda (do key alist &optional default remove testfn) (lambda (do key alist &optional default remove testfn)
(macroexp-let2 macroexp-copyable-p k key (macroexp-let2 macroexp-copyable-p k key
(gv-letplace (getter setter) alist (gv-letplace (getter setter) alist
(macroexp-let2 nil p (if (member testfn '(nil 'eq #'eq)) (macroexp-let2 nil p `(if (and ,testfn (not (eq ,testfn 'eq)))
`(assq ,k ,getter) (assoc ,k ,getter ,testfn)
`(assoc ,k ,getter ,testfn)) (assq ,k ,getter))
(funcall do (if (null default) `(cdr ,p) (funcall do (if (null default) `(cdr ,p)
`(if ,p (cdr ,p) ,default)) `(if ,p (cdr ,p) ,default))
(lambda (v) (lambda (v)

View file

@ -194,9 +194,9 @@
viper-delete-backward-char viper-delete-backward-char
viper-join-lines viper-join-lines
viper-delete-char)) viper-delete-char))
(member (viper-event-key last-command-event) (memq (viper-event-key last-command-event)
'(up down left right (meta f) (meta b) '(up down left right (meta f) (meta b)
(control n) (control p) (control f) (control b))))) (control n) (control p) (control f) (control b)))))
(defsubst viper-insert-state-pre-command-sentinel () (defsubst viper-insert-state-pre-command-sentinel ()
(or (viper-preserve-cursor-color) (or (viper-preserve-cursor-color)

View file

@ -141,7 +141,7 @@ See `mh-identity-list'."
(cons '("None") (cons '("None")
(mapcar #'list (mapcar #'car mh-identity-list))) (mapcar #'list (mapcar #'car mh-identity-list)))
nil t default nil default)) nil t default nil default))
(if (equal identity "None") (if (eq identity "None")
nil nil
identity))) identity)))

View file

@ -2203,7 +2203,7 @@ value. Otherwise return CHILDREN as is."
(unless abort-only (unless abort-only
(setq post-command (setq post-command
(lambda () "@transient--delay-post-command" (lambda () "@transient--delay-post-command"
(let ((act (and (not (equal (this-command-keys-vector) [])) (let ((act (and (not (eq (this-command-keys-vector) []))
(or (eq this-command command) (or (eq this-command command)
;; `execute-extended-command' was ;; `execute-extended-command' was
;; used to call another command ;; used to call another command
@ -2241,7 +2241,7 @@ value. Otherwise return CHILDREN as is."
(transient--debug 'post-command) (transient--debug 'post-command)
(transient--with-emergency-exit (transient--with-emergency-exit
(cond (cond
((and (equal (this-command-keys-vector) []) ((and (eq (this-command-keys-vector) [])
(= (minibuffer-depth) (= (minibuffer-depth)
(1+ transient--minibuffer-depth))) (1+ transient--minibuffer-depth)))
(transient--suspend-override) (transient--suspend-override)

View file

@ -1674,8 +1674,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(if branchp "branch" "tag")))) (if branchp "branch" "tag"))))
(if branchp (if branchp
(vc-git-command nil 0 nil "checkout" "-b" name (vc-git-command nil 0 nil "checkout" "-b" name
(when (and start-point (when (and start-point (not (eq start-point "")))
(not (equal start-point "")))
start-point)) start-point))
(vc-git-command nil 0 nil "tag" name))))) (vc-git-command nil 0 nil "tag" name)))))

View file

@ -404,7 +404,7 @@
(ert-deftest cl-lib-nth-value-test-multiple-values () (ert-deftest cl-lib-nth-value-test-multiple-values ()
"While CL multiple values are an alias to list, these won't work." "While CL multiple values are an alias to list, these won't work."
:expected-result :failed :expected-result :failed
(should (equal (cl-nth-value 0 '(2 3)) '(2 3))) (should (eq (cl-nth-value 0 '(2 3)) '(2 3)))
(should (= (cl-nth-value 0 1) 1)) (should (= (cl-nth-value 0 1) 1))
(should (null (cl-nth-value 1 1))) (should (null (cl-nth-value 1 1)))
(should-error (cl-nth-value -1 (cl-values 2 3)) :type 'args-out-of-range) (should-error (cl-nth-value -1 (cl-values 2 3)) :type 'args-out-of-range)