1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-28 19:42:02 +00:00

Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs

This commit is contained in:
Eli Zaretskii 2022-08-09 18:52:25 +03:00
commit 8813399cfa
6 changed files with 60 additions and 44 deletions

View File

@ -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)

View File

@ -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")

View File

@ -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."

View File

@ -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)

View File

@ -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)

View File

@ -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))))))