aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-04-14 12:17:40 +0200
committerMattias EngdegÄrd2020-04-14 12:25:16 +0200
commit4acdd7fe58ae9f94102afeca67b0383141d597da (patch)
tree5c6856ade640eba80849dc0b251f4057e65937d3
parent5f36e21fe519fe98784d230dd65ca2af78444d14 (diff)
downloademacs-4acdd7fe58ae9f94102afeca67b0383141d597da.tar.gz
emacs-4acdd7fe58ae9f94102afeca67b0383141d597da.zip
Fix edge case errors in filename-matching regexps
These changes fix actual or latent bugs in regexps that match file names, such as PATTERN arguments to 'directory-files'. See https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00265.html * admin/authors.el (authors-obsolete-files-regexps) (authors-renamed-files-regexps): * lisp/auth-source-pass.el (auth-source-pass-entries): * lisp/calendar/todo-mode.el (todo-show, todo-find-filtered-items-file) (todo-filter-items, todo-reset-nondiary-marker, todo-reset-done-string) (todo-reset-comment-string, todo-reset-highlight-item): * lisp/cedet/semantic/db-ebrowse.el (semanticdb-load-ebrowse-caches): * lisp/cedet/semantic/texi.el (semantic-texi-associated-files): * lisp/cedet/srecode/map.el (srecode-map-update-map): * lisp/dired.el (dired-re-no-dot): * lisp/emacs-lisp/autoload.el (update-directory-autoloads): * lisp/emacs-lisp/shadow.el (load-path-shadows-find): * lisp/files.el (auto-mode-alist, directory-files-no-dot-files-regexp): * lisp/finder.el (finder-compile-keywords): * lisp/generic-x.el (inetd-conf-generic-mode, named-boot-generic-mode) (resolve-conf-generic-mode, etc-modules-conf-generic-mode): * lisp/gnus/gnus-agent.el (gnus-agent-read-agentview) (gnus-agent-regenerate-group, gnus-agent-update-files-total-fetched-for): * lisp/gnus/gnus-cache.el (gnus-cache-articles-in-group): * lisp/gnus/gnus-score.el (gnus-score-search-global-directories): * lisp/gnus/gnus-util.el (gnus-delete-directory): * lisp/gnus/gnus-uu.el (gnus-uu-dir-files): * lisp/gnus/nndraft.el (nndraft-request-group): * lisp/gnus/nnmh.el (nnmh-request-group, nnmh-request-create-group): (nnmh-request-delete-group, nnmh-active-number, nnmh-update-gnus-unreads): * lisp/gnus/nnspool.el (nnspool-request-group): * lisp/gnus/spam-stat.el (spam-stat-process-directory) (spam-stat-test-directory): * lisp/help-fns.el (help-fns--first-release): * lisp/help.el (view-emacs-news): * lisp/international/quail.el (quail-update-leim-list-file): * lisp/international/titdic-cnv.el (batch-titdic-convert): * lisp/mail/mspools.el (mspools-set-vm-spool-files) (mspools-get-spool-files): * lisp/mail/rmail.el (rmail-secondary-file-regexp) (rmail-speedbar-match-folder-regexp): * lisp/net/ange-ftp.el (ange-ftp-delete-directory): * lisp/net/tramp.el (tramp-use-absolute-autoload-file-names): * lisp/obsolete/gulp.el (gulp-send-requests): * lisp/obsolete/vc-arch.el (vc-arch-trim-revlib): * lisp/org/ob-core.el (org-babel-remove-temporary-directory): * lisp/progmodes/ebnf2ps.el (ebnf-file-suffix-regexp, ebnf-style-database): * lisp/progmodes/executable.el (executable-command-find-posix-p): * lisp/startup.el (command-line): * lisp/textmodes/refer.el (refer-get-bib-files): * lisp/url/url-about.el (url-probe-protocols): * lisp/vc/vc-rcs.el (vc-rcs-register, vc-rcs-unregister): * test/lisp/net/tramp-archive-tests.el (tramp-archive-test19-directory-files-and-attributes): * test/lisp/net/tramp-tests.el (tramp-test19-directory-files-and-attributes): Replace ^ and $ with \` and \', respectively. Use (rx (or (not ".") "...")), translated into "[^.]\\|\\.\\.\\.", to match anything but "." and "..", instead of several incorrect regexps.
-rw-r--r--admin/authors.el8
-rw-r--r--lisp/auth-source-pass.el2
-rw-r--r--lisp/calendar/todo-mode.el14
-rw-r--r--lisp/cedet/semantic/db-ebrowse.el4
-rw-r--r--lisp/cedet/semantic/texi.el2
-rw-r--r--lisp/cedet/srecode/map.el2
-rw-r--r--lisp/dired.el2
-rw-r--r--lisp/emacs-lisp/autoload.el2
-rw-r--r--lisp/emacs-lisp/shadow.el3
-rw-r--r--lisp/files.el6
-rw-r--r--lisp/finder.el2
-rw-r--r--lisp/generic-x.el8
-rw-r--r--lisp/gnus/gnus-agent.el7
-rw-r--r--lisp/gnus/gnus-cache.el2
-rw-r--r--lisp/gnus/gnus-score.el2
-rw-r--r--lisp/gnus/gnus-util.el2
-rw-r--r--lisp/gnus/gnus-uu.el2
-rw-r--r--lisp/gnus/nndraft.el2
-rw-r--r--lisp/gnus/nnmh.el10
-rw-r--r--lisp/gnus/nnspool.el2
-rw-r--r--lisp/gnus/spam-stat.el4
-rw-r--r--lisp/help-fns.el2
-rw-r--r--lisp/help.el2
-rw-r--r--lisp/international/quail.el2
-rw-r--r--lisp/international/titdic-cnv.el2
-rw-r--r--lisp/mail/mspools.el4
-rw-r--r--lisp/mail/rmail.el5
-rw-r--r--lisp/net/ange-ftp.el3
-rw-r--r--lisp/net/tramp.el2
-rw-r--r--lisp/obsolete/gulp.el2
-rw-r--r--lisp/obsolete/vc-arch.el8
-rw-r--r--lisp/org/ob-core.el2
-rw-r--r--lisp/progmodes/ebnf2ps.el4
-rw-r--r--lisp/progmodes/executable.el2
-rw-r--r--lisp/startup.el4
-rw-r--r--lisp/textmodes/refer.el2
-rw-r--r--lisp/url/url-about.el2
-rw-r--r--lisp/vc/vc-rcs.el5
-rw-r--r--test/lisp/net/tramp-archive-tests.el2
-rw-r--r--test/lisp/net/tramp-tests.el2
40 files changed, 75 insertions, 70 deletions
diff --git a/admin/authors.el b/admin/authors.el
index dc42bc72ef3..6cf7b954491 100644
--- a/admin/authors.el
+++ b/admin/authors.el
@@ -278,7 +278,7 @@ If REALNAME is nil, ignore that author.")
278 278
279 279
280(defvar authors-obsolete-files-regexps 280(defvar authors-obsolete-files-regexps
281 '(".*loaddefs.el$" ; not obsolete, but auto-generated 281 '(".*loaddefs\\.el$" ; not obsolete, but auto-generated
282 "\\.\\(bzr\\|cvs\\|git\\)ignore$" ; obsolete or uninteresting 282 "\\.\\(bzr\\|cvs\\|git\\)ignore$" ; obsolete or uninteresting
283 "\\.arch-inventory$" 283 "\\.arch-inventory$"
284 "ChangeLog\\(\\.[0-9]+\\)?\\'" 284 "ChangeLog\\(\\.[0-9]+\\)?\\'"
@@ -288,9 +288,9 @@ If REALNAME is nil, ignore that author.")
288 "\\`\\(indent\\|automated\\)\\'" "indent/" "mod-test/" 288 "\\`\\(indent\\|automated\\)\\'" "indent/" "mod-test/"
289 "-resources/" 289 "-resources/"
290 "unidata/.*\\.txt\\'" 290 "unidata/.*\\.txt\\'"
291 "BidiCharacterTest.txt" 291 "BidiCharacterTest\\.txt"
292 ;; TODO lib/? Matches other things? 292 ;; TODO lib/? Matches other things?
293 "build-aux/" "m4/" "Emacs.xcodeproj" "mapfiles" "\\.map\\'" 293 "build-aux/" "m4/" "Emacs\\.xcodeproj" "mapfiles" "\\.map\\'"
294 "preferences\\.\\(nib\\|gorm\\)" 294 "preferences\\.\\(nib\\|gorm\\)"
295 ;; Generated files that have since been removed. 295 ;; Generated files that have since been removed.
296 "\\(refcard\\(-de\\|-pl\\)?\\|calccard\\|dired-ref\\|orgcard\\|\ 296 "\\(refcard\\(-de\\|-pl\\)?\\|calccard\\|dired-ref\\|orgcard\\|\
@@ -1183,7 +1183,7 @@ ediff\\|emerge\\|log-edit\\|log-view\\|pcvs\\|smerge-mode\\|vc\\)\\.el\\'"
1183 ("\\`org-\\(ascii\\|beamer\\|html\\|icalendar\\|jsinfo\\|latex\ 1183 ("\\`org-\\(ascii\\|beamer\\|html\\|icalendar\\|jsinfo\\|latex\
1184\\|odt\\|publish\\)\\.el\\'" "ox-\\1.el") 1184\\|odt\\|publish\\)\\.el\\'" "ox-\\1.el")
1185 ;; From test/ to test/automated/. 1185 ;; From test/ to test/automated/.
1186 ("comint-testsuite.el" "automated/\\&") 1186 ("comint-testsuite\\.el" "automated/\\&")
1187 ("\\`\\(bytecomp\\|font-parse\\|icalendar\\|occur\\|newsticker\\)\ 1187 ("\\`\\(bytecomp\\|font-parse\\|icalendar\\|occur\\|newsticker\\)\
1188-testsuite\\.el" "\\1-tests.el") 1188-testsuite\\.el" "\\1-tests.el")
1189 ("automated/flymake/warnpred/\\(Makefile\\|test\\.\\(?:c\\|pl\\)\\)\\'" 1189 ("automated/flymake/warnpred/\\(Makefile\\|test\\.\\(?:c\\|pl\\)\\)\\'"
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index e2a6bfefb5d..ba66d0bb5df 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -190,7 +190,7 @@ CONTENTS is the contents of a password-store formatted file."
190 (let ((store-dir (expand-file-name auth-source-pass-filename))) 190 (let ((store-dir (expand-file-name auth-source-pass-filename)))
191 (mapcar 191 (mapcar
192 (lambda (file) (file-name-sans-extension (file-relative-name file store-dir))) 192 (lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
193 (directory-files-recursively store-dir "\\.gpg$")))) 193 (directory-files-recursively store-dir "\\.gpg\\'"))))
194 194
195(defun auth-source-pass--find-match (host user port) 195(defun auth-source-pass--find-match (host user port)
196 "Return password-store entry data matching HOST, USER and PORT. 196 "Return password-store entry data matching HOST, USER and PORT.
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 6d8fe9c998f..a49f428a3c8 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -707,7 +707,7 @@ and done items are always shown on visiting a category."
707 shortf todo-show-first))) 707 shortf todo-show-first)))
708 (when (eq todo-show-first 'regexp) 708 (when (eq todo-show-first 'regexp)
709 (let ((rxfiles (directory-files todo-directory t 709 (let ((rxfiles (directory-files todo-directory t
710 ".*\\.todr$" t))) 710 "\\.todr\\'" t)))
711 (when (and rxfiles (> (length rxfiles) 1)) 711 (when (and rxfiles (> (length rxfiles) 1))
712 (let ((rxf (mapcar #'todo-short-file-name rxfiles))) 712 (let ((rxf (mapcar #'todo-short-file-name rxfiles)))
713 (setq fi-file (todo-absolute-file-name 713 (setq fi-file (todo-absolute-file-name
@@ -4054,7 +4054,7 @@ regexp items."
4054(defun todo-find-filtered-items-file () 4054(defun todo-find-filtered-items-file ()
4055 "Choose a filtered items file and visit it." 4055 "Choose a filtered items file and visit it."
4056 (interactive) 4056 (interactive)
4057 (let ((files (directory-files todo-directory t "\\.tod[rty]$" t)) 4057 (let ((files (directory-files todo-directory t "\\.tod[rty]\\'" t))
4058 falist file) 4058 falist file)
4059 (dolist (f files) 4059 (dolist (f files)
4060 (let ((sf-name (todo-short-file-name f)) 4060 (let ((sf-name (todo-short-file-name f))
@@ -4187,7 +4187,7 @@ multifile commands for further details."
4187 (regexp ".todr"))))) 4187 (regexp ".todr")))))
4188 (multi (> (length flist) 1)) 4188 (multi (> (length flist) 1))
4189 (rxfiles (when regexp 4189 (rxfiles (when regexp
4190 (directory-files todo-directory t ".*\\.todr$" t))) 4190 (directory-files todo-directory t "\\.todr\\'" t)))
4191 (file-exists (or (file-exists-p fname) rxfiles)) 4191 (file-exists (or (file-exists-p fname) rxfiles))
4192 bufname) 4192 bufname)
4193 (cond ((and top new (natnump new)) 4193 (cond ((and top new (natnump new))
@@ -6154,7 +6154,7 @@ the empty string (i.e., no time string)."
6154 "The :set function for user option `todo-nondiary-marker'." 6154 "The :set function for user option `todo-nondiary-marker'."
6155 (let* ((oldvalue (symbol-value symbol)) 6155 (let* ((oldvalue (symbol-value symbol))
6156 (files (append todo-files todo-archives 6156 (files (append todo-files todo-archives
6157 (directory-files todo-directory t "\\.tod[rty]$" t)))) 6157 (directory-files todo-directory t "\\.tod[rty]\\'" t))))
6158 (custom-set-default symbol value) 6158 (custom-set-default symbol value)
6159 ;; Need to reset these to get font-locking right. 6159 ;; Need to reset these to get font-locking right.
6160 (setq todo-nondiary-start (nth 0 todo-nondiary-marker) 6160 (setq todo-nondiary-start (nth 0 todo-nondiary-marker)
@@ -6207,7 +6207,7 @@ the empty string (i.e., no time string)."
6207 "The :set function for user option `todo-done-string'." 6207 "The :set function for user option `todo-done-string'."
6208 (let ((oldvalue (symbol-value symbol)) 6208 (let ((oldvalue (symbol-value symbol))
6209 (files (append todo-files todo-archives 6209 (files (append todo-files todo-archives
6210 (directory-files todo-directory t "\\.todr$" t)))) 6210 (directory-files todo-directory t "\\.todr\\'" t))))
6211 (custom-set-default symbol value) 6211 (custom-set-default symbol value)
6212 ;; Need to reset this to get font-locking right. 6212 ;; Need to reset this to get font-locking right.
6213 (setq todo-done-string-start 6213 (setq todo-done-string-start
@@ -6236,7 +6236,7 @@ the empty string (i.e., no time string)."
6236 "The :set function for user option `todo-comment-string'." 6236 "The :set function for user option `todo-comment-string'."
6237 (let ((oldvalue (symbol-value symbol)) 6237 (let ((oldvalue (symbol-value symbol))
6238 (files (append todo-files todo-archives 6238 (files (append todo-files todo-archives
6239 (directory-files todo-directory t "\\.todr$" t)))) 6239 (directory-files todo-directory t "\\.todr\\'" t))))
6240 (custom-set-default symbol value) 6240 (custom-set-default symbol value)
6241 (when (not (equal value oldvalue)) 6241 (when (not (equal value oldvalue))
6242 (dolist (f files) 6242 (dolist (f files)
@@ -6262,7 +6262,7 @@ the empty string (i.e., no time string)."
6262 "The :set function for user option `todo-highlight-item'." 6262 "The :set function for user option `todo-highlight-item'."
6263 (let ((oldvalue (symbol-value symbol)) 6263 (let ((oldvalue (symbol-value symbol))
6264 (files (append todo-files todo-archives 6264 (files (append todo-files todo-archives
6265 (directory-files todo-directory t "\\.tod[rty]$" t)))) 6265 (directory-files todo-directory t "\\.tod[rty]\\'" t))))
6266 (custom-set-default symbol value) 6266 (custom-set-default symbol value)
6267 (when (not (equal value oldvalue)) 6267 (when (not (equal value oldvalue))
6268 (dolist (f files) 6268 (dolist (f files)
diff --git a/lisp/cedet/semantic/db-ebrowse.el b/lisp/cedet/semantic/db-ebrowse.el
index 55e755dc363..a3219af7d3e 100644
--- a/lisp/cedet/semantic/db-ebrowse.el
+++ b/lisp/cedet/semantic/db-ebrowse.el
@@ -181,7 +181,9 @@ is specified by `semanticdb-default-save-directory'."
181 "Load all semanticdb controlled EBROWSE caches." 181 "Load all semanticdb controlled EBROWSE caches."
182 (interactive) 182 (interactive)
183 (let ((f (directory-files semanticdb-default-save-directory 183 (let ((f (directory-files semanticdb-default-save-directory
184 t (concat semanticdb-ebrowse-default-file-name "-load.el$") t))) 184 t (concat semanticdb-ebrowse-default-file-name
185 "-load\\.el\\'")
186 t)))
185 (while f 187 (while f
186 (load (car f) nil t) 188 (load (car f) nil t)
187 (setq f (cdr f))) 189 (setq f (cdr f)))
diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el
index 760cb192159..8e8d362ceb5 100644
--- a/lisp/cedet/semantic/texi.el
+++ b/lisp/cedet/semantic/texi.el
@@ -495,7 +495,7 @@ that start with that symbol."
495 (setq tabs (cdr tabs))) 495 (setq tabs (cdr tabs)))
496 r)) 496 r))
497 (t 497 (t
498 (directory-files default-directory nil "\\.texi$")) 498 (directory-files default-directory nil "\\.texi\\'"))
499 ))) 499 )))
500 500
501;; Turns out this might not be useful. 501;; Turns out this might not be useful.
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index 784ebffe17c..dc949200968 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -327,7 +327,7 @@ if that file is NEW, otherwise assume the mode has not changed."
327 ;; 4) - Find new files and add them to the map. 327 ;; 4) - Find new files and add them to the map.
328 (dolist (dir srecode-map-load-path) 328 (dolist (dir srecode-map-load-path)
329 (when (file-exists-p dir) 329 (when (file-exists-p dir)
330 (dolist (f (directory-files dir t "\\.srt$")) 330 (dolist (f (directory-files dir t "\\.srt\\'"))
331 (when (and (not (backup-file-name-p f)) 331 (when (and (not (backup-file-name-p f))
332 (not (auto-save-file-name-p f)) 332 (not (auto-save-file-name-p f))
333 (file-readable-p f)) 333 (file-readable-p f))
diff --git a/lisp/dired.el b/lisp/dired.el
index 689ad1fbfab..f2d478e83c6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3171,7 +3171,7 @@ Any other value means to ask for each directory."
3171 :group 'dired) 3171 :group 'dired)
3172 3172
3173;; Match anything but `.' and `..'. 3173;; Match anything but `.' and `..'.
3174(defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*") 3174(defvar dired-re-no-dot (rx (or (not ".") "...")))
3175 3175
3176;; Delete file, possibly delete a directory and all its files. 3176;; Delete file, possibly delete a directory and all its files.
3177;; This function is useful outside of dired. One could change its name 3177;; This function is useful outside of dired. One could change its name
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 785e350e0e5..dc7461d93ee 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -1047,7 +1047,7 @@ write its autoloads into the specified file instead."
1047 ;; what is the suffix for the underlying OS. 1047 ;; what is the suffix for the underlying OS.
1048 (unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf) 1048 (unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf)
1049 (push suf tmp))) 1049 (push suf tmp)))
1050 (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))) 1050 (concat "\\`[^=.].*" (regexp-opt tmp t) "\\'")))
1051 (files (apply #'nconc 1051 (files (apply #'nconc
1052 (mapcar (lambda (dir) 1052 (mapcar (lambda (dir)
1053 (directory-files (expand-file-name dir) 1053 (directory-files (expand-file-name dir)
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el
index f0a4870a698..4ff129e367a 100644
--- a/lisp/emacs-lisp/shadow.el
+++ b/lisp/emacs-lisp/shadow.el
@@ -99,7 +99,8 @@ See the documentation for `list-load-path-shadows' for further information."
99 (setq true-names (append true-names (list dir))) 99 (setq true-names (append true-names (list dir)))
100 (setq dir (directory-file-name (or pp "."))) 100 (setq dir (directory-file-name (or pp ".")))
101 (setq curr-files (if (file-accessible-directory-p dir) 101 (setq curr-files (if (file-accessible-directory-p dir)
102 (directory-files dir nil ".\\.elc?\\(\\.gz\\)?$" t))) 102 (directory-files dir nil
103 "\\.elc?\\(?:\\.gz\\)?\\'" t)))
103 (and curr-files 104 (and curr-files
104 (not noninteractive) 105 (not noninteractive)
105 (message "Checking %d files in %s..." (length curr-files) dir)) 106 (message "Checking %d files in %s..." (length curr-files) dir))
diff --git a/lisp/files.el b/lisp/files.el
index 01da2a985bc..3e4ad7c0d44 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2671,7 +2671,7 @@ since only a single case-insensitive search through the alist is made."
2671 ("\\.pas\\'" . pascal-mode) 2671 ("\\.pas\\'" . pascal-mode)
2672 ("\\.\\(dpr\\|DPR\\)\\'" . delphi-mode) 2672 ("\\.\\(dpr\\|DPR\\)\\'" . delphi-mode)
2673 ("\\.ad[abs]\\'" . ada-mode) 2673 ("\\.ad[abs]\\'" . ada-mode)
2674 ("\\.ad[bs].dg\\'" . ada-mode) 2674 ("\\.ad[bs]\\.dg\\'" . ada-mode)
2675 ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode) 2675 ("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
2676 ("Imakefile\\'" . makefile-imake-mode) 2676 ("Imakefile\\'" . makefile-imake-mode)
2677 ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode) ; Put this before .mk 2677 ("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode) ; Put this before .mk
@@ -2822,7 +2822,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\)\\'" . archive-mo
2822 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode) 2822 ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
2823 ("\\.toml\\'" . conf-toml-mode) 2823 ("\\.toml\\'" . conf-toml-mode)
2824 ("\\.desktop\\'" . conf-desktop-mode) 2824 ("\\.desktop\\'" . conf-desktop-mode)
2825 ("/\\.redshift.conf\\'" . conf-windows-mode) 2825 ("/\\.redshift\\.conf\\'" . conf-windows-mode)
2826 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode) 2826 ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
2827 ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode) 2827 ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
2828 ;; ChangeLog.old etc. Other change-log-mode entries are above; 2828 ;; ChangeLog.old etc. Other change-log-mode entries are above;
@@ -5754,7 +5754,7 @@ If called interactively, then PARENTS is non-nil."
5754 (write-region "" nil filename nil 0)) 5754 (write-region "" nil filename nil 0))
5755 5755
5756(defconst directory-files-no-dot-files-regexp 5756(defconst directory-files-no-dot-files-regexp
5757 "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*" 5757 "[^.]\\|\\.\\.\\."
5758 "Regexp matching any file name except \".\" and \"..\".") 5758 "Regexp matching any file name except \".\" and \"..\".")
5759 5759
5760(defun files--force (no-such fn &rest args) 5760(defun files--force (no-such fn &rest args)
diff --git a/lisp/finder.el b/lisp/finder.el
index 96359b0b4fe..71f8ac740ee 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -188,7 +188,7 @@ from; the default is `load-path'."
188 ;; Allow compressed files also. 188 ;; Allow compressed files also.
189 (setq package--builtins nil) 189 (setq package--builtins nil)
190 (setq finder-keywords-hash (make-hash-table :test 'eq)) 190 (setq finder-keywords-hash (make-hash-table :test 'eq))
191 (let* ((el-file-regexp "^\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?$") 191 (let* ((el-file-regexp "\\`\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?\\'")
192 (file-count 0) 192 (file-count 0)
193 (files (cl-loop for d in (or dirs load-path) 193 (files (cl-loop for d in (or dirs load-path)
194 when (file-exists-p (directory-file-name d)) 194 when (file-exists-p (directory-file-name d))
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index d49193ccfc5..cd24f497c96 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1430,7 +1430,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1430 "nowait" 1430 "nowait"
1431 "internal") 1431 "internal")
1432 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face)) 1432 '(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face))
1433 '("/etc/inetd.conf\\'") 1433 '("/etc/inetd\\.conf\\'")
1434 (list 1434 (list
1435 (function 1435 (function
1436 (lambda () 1436 (lambda ()
@@ -1630,7 +1630,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1630 (2 font-lock-variable-name-face) 1630 (2 font-lock-variable-name-face)
1631 (3 font-lock-constant-face))) 1631 (3 font-lock-constant-face)))
1632 ;; List of additional automode-alist expressions 1632 ;; List of additional automode-alist expressions
1633 '("/etc/named.boot\\'") 1633 '("/etc/named\\.boot\\'")
1634 ;; List of set up functions to call 1634 ;; List of set up functions to call
1635 nil)) 1635 nil))
1636 1636
@@ -1667,7 +1667,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1667 ;; List of additional font-lock-expressions 1667 ;; List of additional font-lock-expressions
1668 nil 1668 nil
1669 ;; List of additional auto-mode-alist expressions 1669 ;; List of additional auto-mode-alist expressions
1670 '("/etc/resolv[e]?.conf\\'") 1670 '("/etc/resolve?\\.conf\\'")
1671 ;; List of set up functions to call 1671 ;; List of set up functions to call
1672 nil)) 1672 nil))
1673 1673
@@ -1803,7 +1803,7 @@ like an INI file. You can add this hook to `find-file-hook'."
1803 ;; List of additional font-lock-expressions 1803 ;; List of additional font-lock-expressions
1804 nil 1804 nil
1805 ;; List of additional automode-alist expressions 1805 ;; List of additional automode-alist expressions
1806 '("/etc/modules.conf" "/etc/conf.modules") 1806 '("/etc/modules\\.conf" "/etc/conf\\.modules")
1807 ;; List of set up functions to call 1807 ;; List of set up functions to call
1808 nil)) 1808 nil))
1809 1809
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 9f22b7df0ff..cf705ae5dc1 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -2074,7 +2074,7 @@ doesn't exist, to valid the overview buffer."
2074 (file-attributes (directory-files-and-attributes 2074 (file-attributes (directory-files-and-attributes
2075 (gnus-agent-article-name 2075 (gnus-agent-article-name
2076 "" gnus-agent-read-agentview) 2076 "" gnus-agent-read-agentview)
2077 nil "^[0-9]+$" t))) 2077 nil "\\`[0-9]+\\'" t)))
2078 (while file-attributes 2078 (while file-attributes
2079 (let ((fa (pop file-attributes))) 2079 (let ((fa (pop file-attributes)))
2080 (unless (file-attribute-type (cdr fa)) 2080 (unless (file-attribute-type (cdr fa))
@@ -3850,7 +3850,8 @@ If REREAD is not nil, downloaded articles are marked as unread."
3850 (sort (delq nil (mapcar (lambda (name) 3850 (sort (delq nil (mapcar (lambda (name)
3851 (and (not (file-directory-p (nnheader-concat dir name))) 3851 (and (not (file-directory-p (nnheader-concat dir name)))
3852 (string-to-number name))) 3852 (string-to-number name)))
3853 (directory-files dir nil "^[0-9]+$" t))) 3853 (directory-files
3854 dir nil "\\`[0-9]+\\'" t)))
3854 '>) 3855 '>)
3855 (progn (gnus-make-directory dir) nil))) 3856 (progn (gnus-make-directory dir) nil)))
3856 nov-arts 3857 nov-arts
@@ -4110,7 +4111,7 @@ agent has fetched."
4110 (setq delta sum)) 4111 (setq delta sum))
4111 (let ((sum (- (nth 2 entry))) 4112 (let ((sum (- (nth 2 entry)))
4112 (info (directory-files-and-attributes 4113 (info (directory-files-and-attributes
4113 path nil "^-?[0-9]+$" t)) 4114 path nil "\\`-?[0-9]+\\'" t))
4114 file) 4115 file)
4115 (while (setq file (pop info)) 4116 (while (setq file (pop info))
4116 (cl-incf sum (float (or (file-attribute-size (cdr file)) 0)))) 4117 (cl-incf sum (float (or (file-attribute-size (cdr file)) 0))))
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index 8b9acfe0510..02a8ea723d3 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -501,7 +501,7 @@ Returns the list of articles removed."
501 (when (file-exists-p dir) 501 (when (file-exists-p dir)
502 (setq articles 502 (setq articles
503 (sort (mapcar (lambda (name) (string-to-number name)) 503 (sort (mapcar (lambda (name) (string-to-number name))
504 (directory-files dir nil "^[0-9]+$" t)) 504 (directory-files dir nil "\\`[0-9]+\\'" t))
505 '<)) 505 '<))
506 ;; Update the cache active file, just to synch more. 506 ;; Update the cache active file, just to synch more.
507 (if articles 507 (if articles
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 41b63e23232..46b70eaf275 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -2981,7 +2981,7 @@ The list is determined from the variable `gnus-score-file-alist'."
2981 (if (file-directory-p (car files)) 2981 (if (file-directory-p (car files))
2982 (setq out (nconc (directory-files 2982 (setq out (nconc (directory-files
2983 (car files) t 2983 (car files) t
2984 (concat (gnus-score-file-regexp) "$")))) 2984 (concat (gnus-score-file-regexp) "\\'"))))
2985 (push (car files) out)) 2985 (push (car files) out))
2986 (setq files (cdr files))) 2986 (setq files (cdr files)))
2987 (setq gnus-internal-global-score-files out))) 2987 (setq gnus-internal-global-score-files out)))
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 23c62b4f939..3429d6560b7 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -768,7 +768,7 @@ nil. See also `gnus-bind-print-variables'."
768If there's no subdirectory, delete DIRECTORY as well." 768If there's no subdirectory, delete DIRECTORY as well."
769 (when (file-directory-p directory) 769 (when (file-directory-p directory)
770 (let ((files (directory-files 770 (let ((files (directory-files
771 directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) 771 directory t (rx (or (not ".") "..."))))
772 file dir) 772 file dir)
773 (while files 773 (while files
774 (setq file (pop files)) 774 (setq file (pop files))
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index d40ba9cef42..5902f2b37a7 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -1674,7 +1674,7 @@ Gnus might fail to display all of it.")
1674 did-unpack)) 1674 did-unpack))
1675 1675
1676(defun gnus-uu-dir-files (dir) 1676(defun gnus-uu-dir-files (dir)
1677 (let ((dirs (directory-files dir t "[^/][^\\.][^\\.]?$")) 1677 (let ((dirs (directory-files dir t (rx (or (not ".") "..."))))
1678 files file) 1678 files file)
1679 (while dirs 1679 (while dirs
1680 (if (file-directory-p (setq file (car dirs))) 1680 (if (file-directory-p (setq file (car dirs)))
diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el
index 3ee86a696cb..a1337e8d7fa 100644
--- a/lisp/gnus/nndraft.el
+++ b/lisp/gnus/nndraft.el
@@ -219,7 +219,7 @@ are generated if and only if they are also in `message-draft-headers'."
219 (nnheader-re-read-dir pathname) 219 (nnheader-re-read-dir pathname)
220 (setq dir (mapcar (lambda (name) (string-to-number (substring name 1))) 220 (setq dir (mapcar (lambda (name) (string-to-number (substring name 1)))
221 (ignore-errors (directory-files 221 (ignore-errors (directory-files
222 pathname nil "^#[0-9]+#$" t)))) 222 pathname nil "\\`#[0-9]+#\\'" t))))
223 (dolist (n dir) 223 (dolist (n dir)
224 (unless (file-exists-p 224 (unless (file-exists-p
225 (setq file (expand-file-name (int-to-string n) pathname))) 225 (setq file (expand-file-name (int-to-string n) pathname)))
diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el
index c075f298986..8e7f0565e67 100644
--- a/lisp/gnus/nnmh.el
+++ b/lisp/gnus/nnmh.el
@@ -172,7 +172,7 @@ as unread by Gnus.")
172 (setq dir 172 (setq dir
173 (sort 173 (sort
174 (mapcar 'string-to-number 174 (mapcar 'string-to-number
175 (directory-files pathname nil "^[0-9]+$" t)) 175 (directory-files pathname nil "\\`[0-9]+\\'" t))
176 '<)) 176 '<))
177 (cond 177 (cond
178 (dir 178 (dir
@@ -360,7 +360,7 @@ as unread by Gnus.")
360 (nnmh-possibly-change-directory group server) 360 (nnmh-possibly-change-directory group server)
361 (let ((articles (mapcar 'string-to-number 361 (let ((articles (mapcar 'string-to-number
362 (directory-files 362 (directory-files
363 nnmh-current-directory nil "^[0-9]+$")))) 363 nnmh-current-directory nil "\\`[0-9]+\\'"))))
364 (when articles 364 (when articles
365 (setcar active (apply 'min articles)) 365 (setcar active (apply 'min articles))
366 (setcdr active (apply 'max articles)))))) 366 (setcdr active (apply 'max articles))))))
@@ -371,7 +371,7 @@ as unread by Gnus.")
371 ;; Delete all articles in GROUP. 371 ;; Delete all articles in GROUP.
372 (if (not force) 372 (if (not force)
373 () ; Don't delete the articles. 373 () ; Don't delete the articles.
374 (let ((articles (directory-files nnmh-current-directory t "^[0-9]+$"))) 374 (let ((articles (directory-files nnmh-current-directory t "\\`[0-9]+\\'")))
375 (while articles 375 (while articles
376 (when (file-writable-p (car articles)) 376 (when (file-writable-p (car articles))
377 (nnheader-message 5 "Deleting article %s in %s..." 377 (nnheader-message 5 "Deleting article %s in %s..."
@@ -485,7 +485,7 @@ as unread by Gnus.")
485 ;; Find the highest number in the group. 485 ;; Find the highest number in the group.
486 (let ((files (sort 486 (let ((files (sort
487 (mapcar 'string-to-number 487 (mapcar 'string-to-number
488 (directory-files dir nil "^[0-9]+$")) 488 (directory-files dir nil "\\`[0-9]+\\'"))
489 '>))) 489 '>)))
490 (when files 490 (when files
491 (setcdr active (car files))))) 491 (setcdr active (car files)))))
@@ -509,7 +509,7 @@ as unread by Gnus.")
509 (let* ((dir nnmh-current-directory) 509 (let* ((dir nnmh-current-directory)
510 (files (sort (mapcar 'string-to-number 510 (files (sort (mapcar 'string-to-number
511 (directory-files nnmh-current-directory 511 (directory-files nnmh-current-directory
512 nil "^[0-9]+$" t)) 512 nil "\\`[0-9]+\\'" t))
513 '<)) 513 '<))
514 (nnmh-file (concat dir ".nnmh-articles")) 514 (nnmh-file (concat dir ".nnmh-articles"))
515 new articles) 515 new articles)
diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el
index da13a56001b..33b68fa989e 100644
--- a/lisp/gnus/nnspool.el
+++ b/lisp/gnus/nnspool.el
@@ -260,7 +260,7 @@ there.")
260 t) 260 t)
261 ;; Yes, completely empty spool directories *are* possible. 261 ;; Yes, completely empty spool directories *are* possible.
262 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu> 262 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
263 (when (setq dir (directory-files pathname nil "^[0-9]+$" t)) 263 (when (setq dir (directory-files pathname nil "\\`[0-9]+\\'" t))
264 (setq dir (sort (mapcar 'string-to-number dir) '<))) 264 (setq dir (sort (mapcar 'string-to-number dir) '<)))
265 (if dir 265 (if dir
266 (nnheader-insert 266 (nnheader-insert
diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el
index 2e03608b5df..3da45a2b623 100644
--- a/lisp/gnus/spam-stat.el
+++ b/lisp/gnus/spam-stat.el
@@ -557,7 +557,7 @@ check the variable `spam-stat-score-data'."
557 557
558(defun spam-stat-process-directory (dir func) 558(defun spam-stat-process-directory (dir func)
559 "Process all the regular files in directory DIR using function FUNC." 559 "Process all the regular files in directory DIR using function FUNC."
560 (let* ((files (directory-files dir t "^[^.]")) 560 (let* ((files (directory-files dir t "\\`[^.]"))
561 (max (/ (length files) 100.0)) 561 (max (/ (length files) 100.0))
562 (count 0)) 562 (count 0))
563 (with-temp-buffer 563 (with-temp-buffer
@@ -601,7 +601,7 @@ If VERBOSE is non-nil display names of files detected as spam or
601non-spam in a temporary buffer. If it is the symbol `ham', 601non-spam in a temporary buffer. If it is the symbol `ham',
602display non-spam files; otherwise display spam files." 602display non-spam files; otherwise display spam files."
603 (interactive "DDirectory: ") 603 (interactive "DDirectory: ")
604 (let* ((files (directory-files dir t "^[^.]")) 604 (let* ((files (directory-files dir t "\\`[^.]"))
605 display-files 605 display-files
606 buffer-score 606 buffer-score
607 (total (length files)) 607 (total (length files))
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 1be8e0ab082..c7d0112cb61 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -623,7 +623,7 @@ FILE is the file where FUNCTION was probably defined."
623 ;; of the *packages* in which the function is defined. 623 ;; of the *packages* in which the function is defined.
624 (let* ((name (symbol-name symbol)) 624 (let* ((name (symbol-name symbol))
625 (re (concat "\\_<" (regexp-quote name) "\\_>")) 625 (re (concat "\\_<" (regexp-quote name) "\\_>"))
626 (news (directory-files data-directory t "\\`NEWS.[1-9]")) 626 (news (directory-files data-directory t "\\`NEWS\\.[1-9]"))
627 (place nil) 627 (place nil)
628 (first nil)) 628 (first nil))
629 (with-temp-buffer 629 (with-temp-buffer
diff --git a/lisp/help.el b/lisp/help.el
index 45cbaad4e8b..0f1991e3185 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -361,7 +361,7 @@ With argument, display info only for the selected version."
361 (setq res (cons (match-string-no-properties 1) res))))) 361 (setq res (cons (match-string-no-properties 1) res)))))
362 (cons "NEWS" 362 (cons "NEWS"
363 (directory-files data-directory nil 363 (directory-files data-directory nil
364 "^NEWS\\.[0-9][-0-9]*$" nil))) 364 "\\`NEWS\\.[0-9][-0-9]*\\'" nil)))
365 (sort (delete-dups res) #'string>))) 365 (sort (delete-dups res) #'string>)))
366 (current (car all-versions))) 366 (current (car all-versions)))
367 (setq version (completing-read 367 (setq version (completing-read
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 193b1d7c2c2..3299cc55a28 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -3059,7 +3059,7 @@ of each directory."
3059 (while quail-dirs 3059 (while quail-dirs
3060 (setq dirname (car quail-dirs)) 3060 (setq dirname (car quail-dirs))
3061 (when dirname 3061 (when dirname
3062 (setq pkg-list (directory-files dirname 'full "\\.el$")) 3062 (setq pkg-list (directory-files dirname 'full "\\.el\\'"))
3063 (while pkg-list 3063 (while pkg-list
3064 (with-temp-buffer 3064 (with-temp-buffer
3065 (insert-file-contents (car pkg-list)) 3065 (insert-file-contents (car pkg-list))
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index 2a80d75fe7e..4f1bcf2f94e 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -553,7 +553,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\"."
553 (if (file-directory-p filename) 553 (if (file-directory-p filename)
554 (progn 554 (progn
555 (message "Converting all tit files in the directory %s" filename) 555 (message "Converting all tit files in the directory %s" filename)
556 (setq files (directory-files filename t "\\.tit$"))) 556 (setq files (directory-files filename t "\\.tit\\'")))
557 (setq files (list filename))) 557 (setq files (list filename)))
558 (while files 558 (while files
559 (setq file (expand-file-name (car files))) 559 (setq file (expand-file-name (car files)))
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el
index 9c0c3fe5ca9..94b0886c75f 100644
--- a/lisp/mail/mspools.el
+++ b/lisp/mail/mspools.el
@@ -223,7 +223,7 @@ your primary spool is. If this fails, set it to something like
223 ;; So I create a vm-spool-files entry for each of those mail drops 223 ;; So I create a vm-spool-files entry for each of those mail drops
224 (mapcar 'file-name-sans-extension 224 (mapcar 'file-name-sans-extension
225 (directory-files mspools-folder-directory nil 225 (directory-files mspools-folder-directory nil
226 (format "^[^.]+\\.%s" mspools-suffix))) 226 (format "\\`[^.]+\\.%s" mspools-suffix)))
227 )) 227 ))
228 )) 228 ))
229 229
@@ -357,7 +357,7 @@ nil."
357 (if (null mspools-folder-directory) 357 (if (null mspools-folder-directory)
358 (error "Set `mspools-folder-directory' to where the spool files are")) 358 (error "Set `mspools-folder-directory' to where the spool files are"))
359 (setq folders (directory-files mspools-folder-directory nil 359 (setq folders (directory-files mspools-folder-directory nil
360 (format "^[^.]+\\.%s$" mspools-suffix))) 360 (format "\\`[^.]+\\.%s\\'" mspools-suffix)))
361 (setq folders (mapcar 'mspools-size-folder folders)) 361 (setq folders (mapcar 'mspools-size-folder folders))
362 (setq folders (delq nil folders)) 362 (setq folders (delq nil folders))
363 (setq mspools-files folders) 363 (setq mspools-files folders)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index d798ffa0516..3feff803e3e 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -474,7 +474,7 @@ the frame where you have the RMAIL buffer displayed."
474 :type 'directory 474 :type 'directory
475 :group 'rmail-files) 475 :group 'rmail-files)
476;;;###autoload 476;;;###autoload
477(defcustom rmail-secondary-file-regexp (purecopy "\\.xmail$") 477(defcustom rmail-secondary-file-regexp (purecopy "\\.xmail\\'")
478 "Regexp for which files are secondary Rmail files." 478 "Regexp for which files are secondary Rmail files."
479 :type 'regexp 479 :type 'regexp
480 :group 'rmail-files) 480 :group 'rmail-files)
@@ -4354,7 +4354,8 @@ This has an effect only if a summary buffer exists."
4354 (font-lock-fontify-region (point-min) (point-max))))))) 4354 (font-lock-fontify-region (point-min) (point-max)))))))
4355 4355
4356;;; Speedbar support for RMAIL files. 4356;;; Speedbar support for RMAIL files.
4357(defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$" 4357(defcustom rmail-speedbar-match-folder-regexp
4358 "\\`[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?\\'"
4358 "Regexp matching Rmail folder names to be displayed in Speedbar. 4359 "Regexp matching Rmail folder names to be displayed in Speedbar.
4359Enabling this permits Speedbar to display your folders for easy 4360Enabling this permits Speedbar to display your folders for easy
4360browsing, and moving of messages." 4361browsing, and moving of messages."
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 1d456044901..92ed98b2a89 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4170,8 +4170,7 @@ directory, so that Emacs will know its current contents."
4170 (ange-ftp-delete-directory file recursive trash) 4170 (ange-ftp-delete-directory file recursive trash)
4171 (delete-file file trash))) 4171 (delete-file file trash)))
4172 ;; We do not want to delete "." and "..". 4172 ;; We do not want to delete "." and "..".
4173 (directory-files 4173 (directory-files dir 'full (rx (or (not ".") "...")))))
4174 dir 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
4175 (if parsed 4174 (if parsed
4176 (let* ((host (nth 0 parsed)) 4175 (let* ((host (nth 0 parsed))
4177 (user (nth 1 parsed)) 4176 (user (nth 1 parsed))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0ad65fb8bd0..4f3249d966a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2458,7 +2458,7 @@ remote file names."
2458 (regexp-opt 2458 (regexp-opt
2459 (mapcar 2459 (mapcar
2460 #'file-name-sans-extension 2460 #'file-name-sans-extension
2461 (directory-files dir nil "^tramp.+\\.elc?$")) 2461 (directory-files dir nil "\\`tramp.+\\.elc?\\'"))
2462 'paren)))) 2462 'paren))))
2463 (mapatoms 2463 (mapatoms
2464 (lambda (atom) 2464 (lambda (atom)
diff --git a/lisp/obsolete/gulp.el b/lisp/obsolete/gulp.el
index 6589ede69db..08ab3884d41 100644
--- a/lisp/obsolete/gulp.el
+++ b/lisp/obsolete/gulp.el
@@ -94,7 +94,7 @@ is left in the `*gulp*' buffer at the end."
94 (interactive "DRequest updates for Lisp directory: \nP") 94 (interactive "DRequest updates for Lisp directory: \nP")
95 (with-current-buffer (get-buffer-create gulp-tmp-buffer) 95 (with-current-buffer (get-buffer-create gulp-tmp-buffer)
96 (let ((m-p-alist (gulp-create-m-p-alist 96 (let ((m-p-alist (gulp-create-m-p-alist
97 (directory-files dir nil "^[^=].*\\.el$" t) 97 (directory-files dir nil "\\`[^=].*\\.el\\'" t)
98 dir)) 98 dir))
99 ;; Temporarily inhibit undo in the *gulp* buffer. 99 ;; Temporarily inhibit undo in the *gulp* buffer.
100 (buffer-undo-list t) 100 (buffer-undo-list t)
diff --git a/lisp/obsolete/vc-arch.el b/lisp/obsolete/vc-arch.el
index b186a5c52a2..bcdefac5187 100644
--- a/lisp/obsolete/vc-arch.el
+++ b/lisp/obsolete/vc-arch.el
@@ -597,18 +597,20 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
597 (unless (file-writable-p rl-dir) 597 (unless (file-writable-p rl-dir)
598 (error "No writable revlib directory found")) 598 (error "No writable revlib directory found"))
599 (message "Revlib at %s" rl-dir) 599 (message "Revlib at %s" rl-dir)
600 (let* ((archives (directory-files rl-dir 'full "[^.]\\|...")) 600 (let* ((archives (directory-files rl-dir 'full (rx (or (not ".") "..."))))
601 (categories 601 (categories
602 (apply 'append 602 (apply 'append
603 (mapcar (lambda (dir) 603 (mapcar (lambda (dir)
604 (when (file-directory-p dir) 604 (when (file-directory-p dir)
605 (directory-files dir 'full "[^.]\\|..."))) 605 (directory-files dir 'full
606 (rx (or (not ".") "...")))))
606 archives))) 607 archives)))
607 (branches 608 (branches
608 (apply 'append 609 (apply 'append
609 (mapcar (lambda (dir) 610 (mapcar (lambda (dir)
610 (when (file-directory-p dir) 611 (when (file-directory-p dir)
611 (directory-files dir 'full "[^.]\\|..."))) 612 (directory-files dir 'full
613 (rx (or (not ".") "...")))))
612 categories))) 614 categories)))
613 (versions 615 (versions
614 (apply 'append 616 (apply 'append
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 651561a2018..7654c7ebe41 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -3055,7 +3055,7 @@ of `org-babel-temporary-directory'."
3055 (delete-file file))) 3055 (delete-file file)))
3056 ;; We do not want to delete "." and "..". 3056 ;; We do not want to delete "." and "..".
3057 (directory-files org-babel-temporary-directory 'full 3057 (directory-files org-babel-temporary-directory 'full
3058 "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) 3058 (rx (or (not ".") "..."))))
3059 (delete-directory org-babel-temporary-directory)) 3059 (delete-directory org-babel-temporary-directory))
3060 (error 3060 (error
3061 (message "Failed to remove temporary Org-babel directory %s" 3061 (message "Failed to remove temporary Org-babel directory %s"
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index d5820bbfe0a..640cb576ef6 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -1898,7 +1898,7 @@ It's only used when `ebnf-syntax' is `iso-ebnf'."
1898 :group 'ebnf-syntactic) 1898 :group 'ebnf-syntactic)
1899 1899
1900 1900
1901(defcustom ebnf-file-suffix-regexp "\\.[Bb][Nn][Ff]$" 1901(defcustom ebnf-file-suffix-regexp "\\.[Bb][Nn][Ff]\\'"
1902 "Specify file name suffix that contains EBNF. 1902 "Specify file name suffix that contains EBNF.
1903 1903
1904See `ebnf-eps-directory' command." 1904See `ebnf-eps-directory' command."
@@ -2731,7 +2731,7 @@ Used in functions `ebnf-reset-style', `ebnf-push-style' and
2731 (ebnf-syntax . 'ebnf) 2731 (ebnf-syntax . 'ebnf)
2732 (ebnf-iso-alternative-p . nil) 2732 (ebnf-iso-alternative-p . nil)
2733 (ebnf-iso-normalize-p . nil) 2733 (ebnf-iso-normalize-p . nil)
2734 (ebnf-file-suffix-regexp . "\\.[Bb][Nn][Ff]$") 2734 (ebnf-file-suffix-regexp . "\\.[Bb][Nn][Ff]\\'")
2735 (ebnf-eps-prefix . "ebnf--") 2735 (ebnf-eps-prefix . "ebnf--")
2736 (ebnf-eps-header-font . '(11 Helvetica "Black" "White" bold)) 2736 (ebnf-eps-header-font . '(11 Helvetica "Black" "White" bold))
2737 (ebnf-eps-header . nil) 2737 (ebnf-eps-header . nil)
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index b42e6f73ab9..bae2bb66403 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -155,7 +155,7 @@ See `compilation-error-regexp-alist'.")
155If PROGRAM is non-nil, use that instead of \"find\"." 155If PROGRAM is non-nil, use that instead of \"find\"."
156 ;; Pick file to search from location we know 156 ;; Pick file to search from location we know
157 (let* ((dir (file-truename data-directory)) 157 (let* ((dir (file-truename data-directory))
158 (file (car (directory-files dir nil "^[^.]")))) 158 (file (car (directory-files dir nil "\\`[^.]"))))
159 (with-temp-buffer 159 (with-temp-buffer
160 (call-process (or program "find") 160 (call-process (or program "find")
161 nil 161 nil
diff --git a/lisp/startup.el b/lisp/startup.el
index 1f545c66922..5af264e3ef7 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1373,10 +1373,10 @@ please check its value")
1373 ((not (eq system-type 'windows-nt)) 1373 ((not (eq system-type 'windows-nt))
1374 (concat "~" init-file-user "/.emacs")) 1374 (concat "~" init-file-user "/.emacs"))
1375 ;; Else deal with the Windows situation. 1375 ;; Else deal with the Windows situation.
1376 ((directory-files "~" nil "^\\.emacs\\(\\.elc?\\)?$") 1376 ((directory-files "~" nil "\\`\\.emacs\\(\\.elc?\\)?\\'")
1377 ;; Prefer .emacs on Windows. 1377 ;; Prefer .emacs on Windows.
1378 "~/.emacs") 1378 "~/.emacs")
1379 ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$") 1379 ((directory-files "~" nil "\\`_emacs\\(\\.elc?\\)?\\'")
1380 ;; Also support _emacs for compatibility, but warn about it. 1380 ;; Also support _emacs for compatibility, but warn about it.
1381 (push `(initialization 1381 (push `(initialization
1382 ,(format-message 1382 ,(format-message
diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el
index 2865b422732..8d8223a7326 100644
--- a/lisp/textmodes/refer.el
+++ b/lisp/textmodes/refer.el
@@ -377,7 +377,7 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
377 dir files) 377 dir files)
378 (while (setq dir (car dirs)) 378 (while (setq dir (car dirs))
379 (setq files 379 (setq files
380 (append (directory-files dir t "\\.bib$") 380 (append (directory-files dir t "\\.bib\\'")
381 files)) 381 files))
382 (setq dirs (cdr dirs))) 382 (setq dirs (cdr dirs)))
383 files)) 383 files))
diff --git a/lisp/url/url-about.el b/lisp/url/url-about.el
index fd83ac34364..dde47e94de5 100644
--- a/lisp/url/url-about.el
+++ b/lisp/url/url-about.el
@@ -37,7 +37,7 @@
37 (mapc (lambda (f) 37 (mapc (lambda (f)
38 (if (string-match "url-\\(.*\\).el$" f) 38 (if (string-match "url-\\(.*\\).el$" f)
39 (push (match-string 1 f) schemes))) 39 (push (match-string 1 f) schemes)))
40 (directory-files d nil "^url-.*\\.el$"))) 40 (directory-files d nil "\\`url-.*\\.el\\'")))
41 load-path) 41 load-path)
42 (put 'url-extension-protocols 'schemes schemes) 42 (put 'url-extension-protocols 'schemes schemes)
43 schemes))))) 43 schemes)))))
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 00796e5d63f..273f37c10d6 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -247,7 +247,7 @@ to the RCS command."
247 (setq subdir (expand-file-name "RCS" 247 (setq subdir (expand-file-name "RCS"
248 (file-name-directory file))))) 248 (file-name-directory file)))))
249 (not (directory-files (file-name-directory file) 249 (not (directory-files (file-name-directory file)
250 nil ".*,v$" t)) 250 nil ",v\\'" t))
251 (yes-or-no-p "Create RCS subdirectory? ") 251 (yes-or-no-p "Create RCS subdirectory? ")
252 (make-directory subdir)) 252 (make-directory subdir))
253 (apply #'vc-do-command "*vc*" 0 "ci" file 253 (apply #'vc-do-command "*vc*" 0 "ci" file
@@ -312,8 +312,7 @@ whether to remove it."
312 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") 312 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS")
313 ;; check whether RCS dir is empty, i.e. it does not 313 ;; check whether RCS dir is empty, i.e. it does not
314 ;; contain any files except "." and ".." 314 ;; contain any files except "." and ".."
315 (not (directory-files dir nil 315 (not (directory-files dir nil (rx (or (not ".") "..."))))
316 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
317 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) 316 (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
318 (delete-directory dir))))) 317 (delete-directory dir)))))
319 318
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 3229d2b6506..95e41a3f03b 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -669,7 +669,7 @@ This tests also `access-file', `file-readable-p' and `file-regular-p'."
669 (setq attr (directory-files-and-attributes tmp-name 'full)) 669 (setq attr (directory-files-and-attributes tmp-name 'full))
670 (dolist (elt attr) 670 (dolist (elt attr)
671 (should (equal (file-attributes (car elt)) (cdr elt)))) 671 (should (equal (file-attributes (car elt)) (cdr elt))))
672 (setq attr (directory-files-and-attributes tmp-name nil "^b")) 672 (setq attr (directory-files-and-attributes tmp-name nil "\\`b"))
673 (should (equal (mapcar #'car attr) '("bar")))) 673 (should (equal (mapcar #'car attr) '("bar"))))
674 674
675 ;; Cleanup. 675 ;; Cleanup.
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 47d51767c5c..544bdb5c058 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3331,7 +3331,7 @@ They might differ only in time attributes or directory size."
3331 (tramp--test-file-attributes-equal-p 3331 (tramp--test-file-attributes-equal-p
3332 (file-attributes (car elt)) (cdr elt)))) 3332 (file-attributes (car elt)) (cdr elt))))
3333 3333
3334 (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) 3334 (setq attr (directory-files-and-attributes tmp-name2 nil "\\`b"))
3335 (should (equal (mapcar #'car attr) '("bar" "boz")))) 3335 (should (equal (mapcar #'car attr) '("bar" "boz"))))
3336 3336
3337 ;; Cleanup. 3337 ;; Cleanup.