emacs-diffs
[Top][All Lists]
Advanced

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

master 8813399cfa 2/3: Merge branch 'master' of git.savannah.gnu.org:/sr


From: Eli Zaretskii
Subject: master 8813399cfa 2/3: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Tue, 9 Aug 2022 13:44:45 -0400 (EDT)

branch: master
commit 8813399cfa336a2719f4c89e7ccc543dbcbce547
Merge: 7b84954a7c ee201bc77b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 lisp/emacs-lisp/loaddefs-gen.el | 46 +++++++++++++++++++++++++----------------
 lisp/ibuf-ext.el                | 32 +++++++++++++---------------
 lisp/ibuf-macs.el               |  7 +++----
 lisp/ibuffer.el                 | 13 +++++++++++-
 lisp/textmodes/ispell.el        |  4 ++--
 test/lisp/ibuffer-tests.el      |  2 +-
 6 files changed, 60 insertions(+), 44 deletions(-)

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 8aa17be765..3b329357ad 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -127,6 +127,15 @@ scanning for autoloads and will be in the `load-path'."
         (substring name 0 (match-beginning 0))
       name)))
 
+(defun loaddefs-generate--shorten-autoload (form)
+  "Remove optional nil elements from an `autoload' form."
+  (take (max (- (length form)
+                (seq-position (reverse form) nil
+                              (lambda (e1 e2)
+                                (not (eq e1 e2)))))
+             3)
+        form))
+
 (defun loaddefs-generate--make-autoload (form file &optional expansion)
   "Turn FORM into an autoload or defvar for source file FILE.
 Returns nil if FORM is not a special autoload form (i.e. a function definition
@@ -165,8 +174,8 @@ expression, in which case we want to handle forms 
differently."
         ;; Add the usage form at the end where describe-function-1
         ;; can recover it.
         (when (consp args) (setq doc (help-add-fundoc-usage doc args)))
-        ;; (message "autoload of %S" (nth 1 form))
-        `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type)))
+        (loaddefs-generate--shorten-autoload
+         `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type))))
 
      ((and expansion (memq car '(progn prog1)))
       (let ((end (memq :autoload-end form)))
@@ -220,22 +229,23 @@ expression, in which case we want to handle forms 
differently."
         ;; can recover it.
        (when (listp args) (setq doc (help-add-fundoc-usage doc args)))
         ;; `define-generic-mode' quotes the name, so take care of that
-        `(autoload ,(if (listp name) name (list 'quote name))
-           ,file ,doc
-           ,(or (and (memq car '(define-skeleton define-derived-mode
-                                  define-generic-mode
-                                  easy-mmode-define-global-mode
-                                  define-global-minor-mode
-                                  define-globalized-minor-mode
-                                  easy-mmode-define-minor-mode
-                                  define-minor-mode))
-                     t)
-                (and (eq (car-safe (car body)) 'interactive)
-                     ;; List of modes or just t.
-                     (or (if (nthcdr 1 (car body))
-                             (list 'quote (nthcdr 1 (car body)))
-                           t))))
-           ,(if macrop ''macro nil))))
+        (loaddefs-generate--shorten-autoload
+         `(autoload ,(if (listp name) name (list 'quote name))
+            ,file ,doc
+            ,(or (and (memq car '(define-skeleton define-derived-mode
+                                   define-generic-mode
+                                   easy-mmode-define-global-mode
+                                   define-global-minor-mode
+                                   define-globalized-minor-mode
+                                   easy-mmode-define-minor-mode
+                                   define-minor-mode))
+                      t)
+                 (and (eq (car-safe (car body)) 'interactive)
+                      ;; List of modes or just t.
+                      (or (if (nthcdr 1 (car body))
+                              (list 'quote (nthcdr 1 (car body)))
+                            t))))
+            ,(if macrop ''macro nil)))))
 
      ;; For defclass forms, use `eieio-defclass-autoload'.
      ((eq car 'defclass)
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 822ecbdd99..621e648a2d 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -48,7 +48,7 @@
 ;;; Utility functions
 (defun ibuffer-remove-alist (key alist)
   "Remove all entries in ALIST that have a key equal to KEY."
-  (while (ibuffer-awhen (assoc key alist)
+  (while (when-let ((it (assoc key alist)))
            (setq alist (remove it alist)) it))
   alist)
 
@@ -63,15 +63,10 @@
       (setq tail (cdr tail)))
     (nreverse new)))
 
-(defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts)
-  (let ((hip-crowd nil)
-       (lamers nil))
-    (dolist (ibuffer-split-list-elt ibuffer-split-list-elts)
-      (if (funcall ibuffer-split-list-fn ibuffer-split-list-elt)
-         (push ibuffer-split-list-elt hip-crowd)
-       (push ibuffer-split-list-elt lamers)))
-    ;; Too bad Emacs Lisp doesn't have multiple values.
-    (list (nreverse hip-crowd) (nreverse lamers))))
+(defun ibuffer-split-list (fn elts)
+  (declare (obsolete seq-group-by "29.1"))
+  (let ((res (seq-group-by fn elts)))
+    (list (cdr (assq t res)) (cdr (assq nil res)))))
 
 (defcustom ibuffer-never-show-predicates nil
   "A list of predicates (a regexp or function) for buffers not to display.
@@ -769,11 +764,12 @@ specification, with the same structure as an element of 
the list
          (i 0))
       (dolist (filtergroup filter-group-alist)
        (let ((filterset (cdr filtergroup)))
-         (cl-destructuring-bind (hip-crowd lamers)
-             (ibuffer-split-list (lambda (bufmark)
-                                   (ibuffer-included-in-filters-p (car bufmark)
-                                                                  filterset))
-                                 bmarklist)
+          (let* ((res (seq-group-by (lambda (bufmark)
+                                      (ibuffer-included-in-filters-p (car 
bufmark)
+                                                                     
filterset))
+                                    bmarklist))
+                 (hip-crowd (cdr (assq t res)))
+                 (lamers (cdr (assq nil res))))
            (aset vec i hip-crowd)
            (cl-incf i)
            (setq bmarklist lamers))))
@@ -1317,7 +1313,7 @@ For example, for a buffer associated with file 
'/a/b/c.d', this
 matches against '/a/b/c.d'."
   (:description "full file name"
    :reader (read-from-minibuffer "Filter by full file name (regexp): "))
-  (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
+  (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
     (string-match qualifier it)))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-basename "ibuf-ext")
@@ -1329,7 +1325,7 @@ matches against `c.d'."
   (:description "file basename"
    :reader (read-from-minibuffer
             "Filter by file name, without directory part (regex): "))
-  (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
+  (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
     (string-match qualifier (file-name-nondirectory it))))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-file-extension "ibuf-ext")
@@ -1342,7 +1338,7 @@ pattern.  For example, for a buffer associated with file
   (:description "filename extension"
    :reader (read-from-minibuffer
             "Filter by filename extension without separator (regex): "))
-  (ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
+  (when-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
     (string-match qualifier (or (file-name-extension it) ""))))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-directory "ibuf-ext")
diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el
index 51b206d7c4..718b779a92 100644
--- a/lisp/ibuf-macs.el
+++ b/lisp/ibuf-macs.el
@@ -47,10 +47,9 @@ Compare with `if'."
 (defmacro ibuffer-awhen (test &rest body)
   "Evaluate BODY if TEST returns non-nil.
 During evaluation of body, bind `it' to the value returned by TEST."
-  (declare (indent 1))
-  `(ibuffer-aif ,test
-       (progn ,@body)
-     nil))
+  (declare (indent 1) (obsolete when-let "29.1"))
+  `(when-let ((it ,test))
+     ,@body))
 
 (defmacro ibuffer-save-marks (&rest body)
   "Save the marked status of the buffers and execute BODY; restore marks."
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 65430d7d11..d6870aab5d 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2332,7 +2332,18 @@ FORMATS is the value to use for `ibuffer-formats'.
              (run-hooks 'ibuffer-hook))
          (setq buffer-read-only t))
        (unless ibuffer-expert
-         (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for 
help"))))))
+          (message (substitute-command-keys
+                    (concat "Commands: \\[ibuffer-mark-forward], "
+                            "\\[ibuffer-unmark-forward], "
+                            "\\[ibuffer-toggle-marks], "
+                            "\\[ibuffer-visit-buffer], "
+                            "\\[ibuffer-update], "
+                            "\\[ibuffer-do-kill-lines], "
+                            "\\[ibuffer-do-save], "
+                            "\\[ibuffer-do-delete], "
+                            "\\[ibuffer-do-query-replace]; "
+                            "\\[quit-window] to quit; "
+                            "\\[describe-mode] for help"))))))))
 
 ;;;###autoload
 (defun ibuffer-jump (&optional other-window)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index f85d0aba9c..91354940e7 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -116,8 +116,6 @@
   "User variables for Emacs ispell interface."
   :group 'applications)
 
-(defalias 'check-ispell-version 'ispell-check-version)
-
 (declare-function flyspell-unhighlight-at "flyspell" (pos))
 
 ;;; **********************************************************************
@@ -4230,6 +4228,8 @@ Both should not be used to define a buffer-local 
dictionary."
                          (insert comment-end)))))
              (insert (concat " " word))))))))
 
+(define-obsolete-function-alias 'check-ispell-version #'ispell-check-version 
"29.1")
+
 (provide 'ispell)
 
 
diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el
index 343e2ae50b..d54718e297 100644
--- a/test/lisp/ibuffer-tests.el
+++ b/test/lisp/ibuffer-tests.el
@@ -132,7 +132,7 @@
           (ibuffer-switch-to-saved-filter-groups "saved-filters")
           (should (assoc "Elisp" (cdar ibuffer-saved-filter-groups))))
       (setq ibuffer-saved-filter-groups orig-filters)
-      (ibuffer-awhen (get-buffer "*Ibuffer*")
+      (when-let ((it (get-buffer "*Ibuffer*")))
         (and (buffer-live-p it) (kill-buffer it))))))
 
 



reply via email to

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