diff options
| author | Eli Zaretskii | 2022-04-13 16:52:50 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-04-13 16:52:50 +0300 |
| commit | 5a14406ecfbd1efd03a00c49a84c19d31bb77f48 (patch) | |
| tree | 0ef3345816636a1530806b2585ba1f40c30c84de /lisp | |
| parent | be42fdc6dc60bec1d14065d04dc43b693398c591 (diff) | |
| parent | f2ae39829812098d8269eafbc0fcb98959ee5bb7 (diff) | |
| download | emacs-5a14406ecfbd1efd03a00c49a84c19d31bb77f48.tar.gz emacs-5a14406ecfbd1efd03a00c49a84c19d31bb77f48.zip | |
Merge from origin/emacs-28
# Conflicts:
# etc/NEWS
# lisp/desktop.el
# lisp/dired.el
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/dired.el | 55 | ||||
| -rw-r--r-- | lisp/font-lock.el | 10 |
2 files changed, 40 insertions, 25 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 5accad8efd2..d0cf72adc58 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -3063,12 +3063,10 @@ You can then feed the file name(s) to other commands with \\[yank]." | |||
| 3063 | 3063 | ||
| 3064 | ;;; Keeping Dired buffers in sync with the filesystem and with each other | 3064 | ;;; Keeping Dired buffers in sync with the filesystem and with each other |
| 3065 | 3065 | ||
| 3066 | (defun dired-buffers-for-dir (dir &optional file subdirs) | 3066 | (defun dired-buffers-for-dir (dir &optional file) |
| 3067 | "Return a list of buffers for DIR (top level or in-situ subdir). | 3067 | "Return a list of buffers for DIR (top level or in-situ subdir). |
| 3068 | If FILE is non-nil, include only those whose wildcard pattern (if any) | 3068 | If FILE is non-nil, include only those whose wildcard pattern (if any) |
| 3069 | matches FILE. | 3069 | matches FILE. |
| 3070 | If SUBDIRS is non-nil, also include the dired buffers of | ||
| 3071 | directories below DIR. | ||
| 3072 | The list is in reverse order of buffer creation, most recent last. | 3070 | The list is in reverse order of buffer creation, most recent last. |
| 3073 | As a side effect, killed dired buffers for DIR are removed from | 3071 | As a side effect, killed dired buffers for DIR are removed from |
| 3074 | `dired-buffers'." | 3072 | `dired-buffers'." |
| @@ -3080,20 +3078,35 @@ As a side effect, killed dired buffers for DIR are removed from | |||
| 3080 | ((null (buffer-name buf)) | 3078 | ((null (buffer-name buf)) |
| 3081 | ;; Buffer is killed - clean up: | 3079 | ;; Buffer is killed - clean up: |
| 3082 | (setq dired-buffers (delq elt dired-buffers))) | 3080 | (setq dired-buffers (delq elt dired-buffers))) |
| 3083 | ((dired-in-this-tree-p (car elt) dir) | 3081 | ((dired-in-this-tree-p dir (car elt)) |
| 3084 | (with-current-buffer buf | 3082 | (with-current-buffer buf |
| 3085 | (when (and (or subdirs | 3083 | (and (assoc dir dired-subdir-alist) |
| 3086 | (assoc dir dired-subdir-alist)) | 3084 | (or (null file) |
| 3087 | (or (null file) | 3085 | (if (stringp dired-directory) |
| 3088 | (if (stringp dired-directory) | 3086 | (let ((wildcards (file-name-nondirectory |
| 3089 | (let ((wildcards (file-name-nondirectory | 3087 | dired-directory))) |
| 3090 | dired-directory))) | 3088 | (or (zerop (length wildcards)) |
| 3091 | (or (zerop (length wildcards)) | 3089 | (string-match-p (dired-glob-regexp wildcards) |
| 3092 | (string-match-p (dired-glob-regexp wildcards) | 3090 | file))) |
| 3093 | file))) | 3091 | (member (expand-file-name file dir) |
| 3094 | (member (expand-file-name file dir) | 3092 | (cdr dired-directory)))) |
| 3095 | (cdr dired-directory))))) | 3093 | (setq result (cons buf result))))))) |
| 3096 | (setq result (cons buf result))))))) | 3094 | result)) |
| 3095 | |||
| 3096 | (defun dired-buffers-for-dir-or-subdir (dir) | ||
| 3097 | "Return a list of buffers for DIR or a subdirectory thereof. | ||
| 3098 | As a side effect, killed dired buffers for DIR are removed from | ||
| 3099 | `dired-buffers'." | ||
| 3100 | (setq dir (file-name-as-directory dir)) | ||
| 3101 | (let (result buf) | ||
| 3102 | (dolist (elt dired-buffers) | ||
| 3103 | (setq buf (cdr elt)) | ||
| 3104 | (cond | ||
| 3105 | ((null (buffer-name buf)) | ||
| 3106 | ;; Buffer is killed - clean up: | ||
| 3107 | (setq dired-buffers (delq elt dired-buffers))) | ||
| 3108 | ((dired-in-this-tree-p (car elt) dir) | ||
| 3109 | (setq result (cons buf result))))) | ||
| 3097 | result)) | 3110 | result)) |
| 3098 | 3111 | ||
| 3099 | (defun dired-glob-regexp (pattern) | 3112 | (defun dired-glob-regexp (pattern) |
| @@ -3672,14 +3685,16 @@ confirmation. To disable the confirmation, see | |||
| 3672 | (file-name-nondirectory fn)))) | 3685 | (file-name-nondirectory fn)))) |
| 3673 | (not dired-clean-confirm-killing-deleted-buffers)) | 3686 | (not dired-clean-confirm-killing-deleted-buffers)) |
| 3674 | (kill-buffer buf))) | 3687 | (kill-buffer buf))) |
| 3675 | (let ((buf-list (dired-buffers-for-dir fn nil 'subdirs))) | 3688 | (let ((buf-list (dired-buffers-for-dir-or-subdir |
| 3689 | (expand-file-name fn)))) | ||
| 3676 | (and buf-list | 3690 | (and buf-list |
| 3677 | (or (and dired-clean-confirm-killing-deleted-buffers | 3691 | (or (and dired-clean-confirm-killing-deleted-buffers |
| 3678 | (y-or-n-p | 3692 | (y-or-n-p |
| 3679 | (format | 3693 | (format |
| 3680 | (ngettext "Kill Dired buffer of %s, too? " | 3694 | (ngettext |
| 3681 | "Kill Dired buffers of %s, too? " | 3695 | "Kill Dired buffer of %s, too? " |
| 3682 | (length buf-list)) | 3696 | "Kill Dired buffers of %s and its sub-directories, too? " |
| 3697 | (length buf-list)) | ||
| 3683 | (file-name-nondirectory | 3698 | (file-name-nondirectory |
| 3684 | ;; FN may end in a / if `dired-listing-switches' | 3699 | ;; FN may end in a / if `dired-listing-switches' |
| 3685 | ;; contains -p, so we need to strip that | 3700 | ;; contains -p, so we need to strip that |
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 5034c98d26e..488874a1755 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -391,7 +391,7 @@ This can be an \"!\" or the \"n\" in \"ifndef\".") | |||
| 391 | ;; Fontification variables: | 391 | ;; Fontification variables: |
| 392 | 392 | ||
| 393 | (defvar font-lock-keywords nil | 393 | (defvar font-lock-keywords nil |
| 394 | "A list of the keywords to highlight. | 394 | "A list of keywords and corresponding font-lock highlighting rules. |
| 395 | There are two kinds of values: user-level, and compiled. | 395 | There are two kinds of values: user-level, and compiled. |
| 396 | 396 | ||
| 397 | A user-level keywords list is what a major mode or the user would | 397 | 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 | |||
| 416 | `re-search-forward' would). MATCHER regexps can be generated via | 416 | `re-search-forward' would). MATCHER regexps can be generated via |
| 417 | the function `regexp-opt'. | 417 | the function `regexp-opt'. |
| 418 | 418 | ||
| 419 | FORM is an expression, whose value should be a keyword element, | 419 | FORM is an expression, whose value should be a keyword element |
| 420 | evaluated when the keyword is (first) used in a buffer. This | 420 | of one of the above forms, evaluated when the keyword is (first) |
| 421 | feature can be used to provide a keyword that can only be | 421 | used in a buffer. This feature can be used to provide a keyword |
| 422 | generated when Font Lock mode is actually turned on. | 422 | that can only be generated when Font Lock mode is actually turned on. |
| 423 | 423 | ||
| 424 | HIGHLIGHT should be either MATCH-HIGHLIGHT or MATCH-ANCHORED. | 424 | HIGHLIGHT should be either MATCH-HIGHLIGHT or MATCH-ANCHORED. |
| 425 | 425 | ||