1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00

Merge from origin/emacs-28

# Conflicts:
#	etc/NEWS
#	lisp/desktop.el
#	lisp/dired.el
This commit is contained in:
Eli Zaretskii 2022-04-13 16:52:50 +03:00
commit 5a14406ecf
3 changed files with 40 additions and 716 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3063,12 +3063,10 @@ You can then feed the file name(s) to other commands with \\[yank]."
;;; Keeping Dired buffers in sync with the filesystem and with each other ;;; Keeping Dired buffers in sync with the filesystem and with each other
(defun dired-buffers-for-dir (dir &optional file subdirs) (defun dired-buffers-for-dir (dir &optional file)
"Return a list of buffers for DIR (top level or in-situ subdir). "Return a list of buffers for DIR (top level or in-situ subdir).
If FILE is non-nil, include only those whose wildcard pattern (if any) If FILE is non-nil, include only those whose wildcard pattern (if any)
matches FILE. matches FILE.
If SUBDIRS is non-nil, also include the dired buffers of
directories below DIR.
The list is in reverse order of buffer creation, most recent last. The list is in reverse order of buffer creation, most recent last.
As a side effect, killed dired buffers for DIR are removed from As a side effect, killed dired buffers for DIR are removed from
`dired-buffers'." `dired-buffers'."
@ -3080,20 +3078,35 @@ As a side effect, killed dired buffers for DIR are removed from
((null (buffer-name buf)) ((null (buffer-name buf))
;; Buffer is killed - clean up: ;; Buffer is killed - clean up:
(setq dired-buffers (delq elt dired-buffers))) (setq dired-buffers (delq elt dired-buffers)))
((dired-in-this-tree-p (car elt) dir) ((dired-in-this-tree-p dir (car elt))
(with-current-buffer buf (with-current-buffer buf
(when (and (or subdirs (and (assoc dir dired-subdir-alist)
(assoc dir dired-subdir-alist)) (or (null file)
(or (null file) (if (stringp dired-directory)
(if (stringp dired-directory) (let ((wildcards (file-name-nondirectory
(let ((wildcards (file-name-nondirectory dired-directory)))
dired-directory))) (or (zerop (length wildcards))
(or (zerop (length wildcards)) (string-match-p (dired-glob-regexp wildcards)
(string-match-p (dired-glob-regexp wildcards) file)))
file))) (member (expand-file-name file dir)
(member (expand-file-name file dir) (cdr dired-directory))))
(cdr dired-directory))))) (setq result (cons buf result)))))))
(setq result (cons buf result))))))) result))
(defun dired-buffers-for-dir-or-subdir (dir)
"Return a list of buffers for DIR or a subdirectory thereof.
As a side effect, killed dired buffers for DIR are removed from
`dired-buffers'."
(setq dir (file-name-as-directory dir))
(let (result buf)
(dolist (elt dired-buffers)
(setq buf (cdr elt))
(cond
((null (buffer-name buf))
;; Buffer is killed - clean up:
(setq dired-buffers (delq elt dired-buffers)))
((dired-in-this-tree-p (car elt) dir)
(setq result (cons buf result)))))
result)) result))
(defun dired-glob-regexp (pattern) (defun dired-glob-regexp (pattern)
@ -3672,14 +3685,16 @@ confirmation. To disable the confirmation, see
(file-name-nondirectory fn)))) (file-name-nondirectory fn))))
(not dired-clean-confirm-killing-deleted-buffers)) (not dired-clean-confirm-killing-deleted-buffers))
(kill-buffer buf))) (kill-buffer buf)))
(let ((buf-list (dired-buffers-for-dir fn nil 'subdirs))) (let ((buf-list (dired-buffers-for-dir-or-subdir
(expand-file-name fn))))
(and buf-list (and buf-list
(or (and dired-clean-confirm-killing-deleted-buffers (or (and dired-clean-confirm-killing-deleted-buffers
(y-or-n-p (y-or-n-p
(format (format
(ngettext "Kill Dired buffer of %s, too? " (ngettext
"Kill Dired buffers of %s, too? " "Kill Dired buffer of %s, too? "
(length buf-list)) "Kill Dired buffers of %s and its sub-directories, too? "
(length buf-list))
(file-name-nondirectory (file-name-nondirectory
;; FN may end in a / if `dired-listing-switches' ;; FN may end in a / if `dired-listing-switches'
;; contains -p, so we need to strip that ;; contains -p, so we need to strip that

View File

@ -391,7 +391,7 @@ This can be an \"!\" or the \"n\" in \"ifndef\".")
;; Fontification variables: ;; Fontification variables:
(defvar font-lock-keywords nil (defvar font-lock-keywords nil
"A list of the keywords to highlight. "A list of keywords and corresponding font-lock highlighting rules.
There are two kinds of values: user-level, and compiled. There are two kinds of values: user-level, and compiled.
A user-level keywords list is what a major mode or the user would A user-level keywords list is what a major mode or the user would
@ -416,10 +416,10 @@ point, and set `match-data' appropriately if it succeeds; like
`re-search-forward' would). MATCHER regexps can be generated via `re-search-forward' would). MATCHER regexps can be generated via
the function `regexp-opt'. the function `regexp-opt'.
FORM is an expression, whose value should be a keyword element, FORM is an expression, whose value should be a keyword element
evaluated when the keyword is (first) used in a buffer. This of one of the above forms, evaluated when the keyword is (first)
feature can be used to provide a keyword that can only be used in a buffer. This feature can be used to provide a keyword
generated when Font Lock mode is actually turned on. that can only be generated when Font Lock mode is actually turned on.
HIGHLIGHT should be either MATCH-HIGHLIGHT or MATCH-ANCHORED. HIGHLIGHT should be either MATCH-HIGHLIGHT or MATCH-ANCHORED.