(defvar authors-obsolete-files-regexps
- '(".*loaddefs.el$" ; not obsolete, but auto-generated
+ '(".*loaddefs\\.el$" ; not obsolete, but auto-generated
"\\.\\(bzr\\|cvs\\|git\\)ignore$" ; obsolete or uninteresting
"\\.arch-inventory$"
"ChangeLog\\(\\.[0-9]+\\)?\\'"
"\\`\\(indent\\|automated\\)\\'" "indent/" "mod-test/"
"-resources/"
"unidata/.*\\.txt\\'"
- "BidiCharacterTest.txt"
+ "BidiCharacterTest\\.txt"
;; TODO lib/? Matches other things?
- "build-aux/" "m4/" "Emacs.xcodeproj" "mapfiles" "\\.map\\'"
+ "build-aux/" "m4/" "Emacs\\.xcodeproj" "mapfiles" "\\.map\\'"
"preferences\\.\\(nib\\|gorm\\)"
;; Generated files that have since been removed.
"\\(refcard\\(-de\\|-pl\\)?\\|calccard\\|dired-ref\\|orgcard\\|\
("\\`org-\\(ascii\\|beamer\\|html\\|icalendar\\|jsinfo\\|latex\
\\|odt\\|publish\\)\\.el\\'" "ox-\\1.el")
;; From test/ to test/automated/.
- ("comint-testsuite.el" "automated/\\&")
+ ("comint-testsuite\\.el" "automated/\\&")
("\\`\\(bytecomp\\|font-parse\\|icalendar\\|occur\\|newsticker\\)\
-testsuite\\.el" "\\1-tests.el")
("automated/flymake/warnpred/\\(Makefile\\|test\\.\\(?:c\\|pl\\)\\)\\'"
(let ((store-dir (expand-file-name auth-source-pass-filename)))
(mapcar
(lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
- (directory-files-recursively store-dir "\\.gpg$"))))
+ (directory-files-recursively store-dir "\\.gpg\\'"))))
(defun auth-source-pass--find-match (host user port)
"Return password-store entry data matching HOST, USER and PORT.
shortf todo-show-first)))
(when (eq todo-show-first 'regexp)
(let ((rxfiles (directory-files todo-directory t
- ".*\\.todr$" t)))
+ "\\.todr\\'" t)))
(when (and rxfiles (> (length rxfiles) 1))
(let ((rxf (mapcar #'todo-short-file-name rxfiles)))
(setq fi-file (todo-absolute-file-name
(defun todo-find-filtered-items-file ()
"Choose a filtered items file and visit it."
(interactive)
- (let ((files (directory-files todo-directory t "\\.tod[rty]$" t))
+ (let ((files (directory-files todo-directory t "\\.tod[rty]\\'" t))
falist file)
(dolist (f files)
(let ((sf-name (todo-short-file-name f))
(regexp ".todr")))))
(multi (> (length flist) 1))
(rxfiles (when regexp
- (directory-files todo-directory t ".*\\.todr$" t)))
+ (directory-files todo-directory t "\\.todr\\'" t)))
(file-exists (or (file-exists-p fname) rxfiles))
bufname)
(cond ((and top new (natnump new))
"The :set function for user option `todo-nondiary-marker'."
(let* ((oldvalue (symbol-value symbol))
(files (append todo-files todo-archives
- (directory-files todo-directory t "\\.tod[rty]$" t))))
+ (directory-files todo-directory t "\\.tod[rty]\\'" t))))
(custom-set-default symbol value)
;; Need to reset these to get font-locking right.
(setq todo-nondiary-start (nth 0 todo-nondiary-marker)
"The :set function for user option `todo-done-string'."
(let ((oldvalue (symbol-value symbol))
(files (append todo-files todo-archives
- (directory-files todo-directory t "\\.todr$" t))))
+ (directory-files todo-directory t "\\.todr\\'" t))))
(custom-set-default symbol value)
;; Need to reset this to get font-locking right.
(setq todo-done-string-start
"The :set function for user option `todo-comment-string'."
(let ((oldvalue (symbol-value symbol))
(files (append todo-files todo-archives
- (directory-files todo-directory t "\\.todr$" t))))
+ (directory-files todo-directory t "\\.todr\\'" t))))
(custom-set-default symbol value)
(when (not (equal value oldvalue))
(dolist (f files)
"The :set function for user option `todo-highlight-item'."
(let ((oldvalue (symbol-value symbol))
(files (append todo-files todo-archives
- (directory-files todo-directory t "\\.tod[rty]$" t))))
+ (directory-files todo-directory t "\\.tod[rty]\\'" t))))
(custom-set-default symbol value)
(when (not (equal value oldvalue))
(dolist (f files)
"Load all semanticdb controlled EBROWSE caches."
(interactive)
(let ((f (directory-files semanticdb-default-save-directory
- t (concat semanticdb-ebrowse-default-file-name "-load.el$") t)))
+ t (concat semanticdb-ebrowse-default-file-name
+ "-load\\.el\\'")
+ t)))
(while f
(load (car f) nil t)
(setq f (cdr f)))
(setq tabs (cdr tabs)))
r))
(t
- (directory-files default-directory nil "\\.texi$"))
+ (directory-files default-directory nil "\\.texi\\'"))
)))
;; Turns out this might not be useful.
;; 4) - Find new files and add them to the map.
(dolist (dir srecode-map-load-path)
(when (file-exists-p dir)
- (dolist (f (directory-files dir t "\\.srt$"))
+ (dolist (f (directory-files dir t "\\.srt\\'"))
(when (and (not (backup-file-name-p f))
(not (auto-save-file-name-p f))
(file-readable-p f))
:group 'dired)
;; Match anything but `.' and `..'.
-(defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")
+(defvar dired-re-no-dot (rx (or (not ".") "...")))
;; Delete file, possibly delete a directory and all its files.
;; This function is useful outside of dired. One could change its name
;; what is the suffix for the underlying OS.
(unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf)
(push suf tmp)))
- (concat "^[^=.].*" (regexp-opt tmp t) "\\'")))
+ (concat "\\`[^=.].*" (regexp-opt tmp t) "\\'")))
(files (apply #'nconc
(mapcar (lambda (dir)
(directory-files (expand-file-name dir)
(setq true-names (append true-names (list dir)))
(setq dir (directory-file-name (or pp ".")))
(setq curr-files (if (file-accessible-directory-p dir)
- (directory-files dir nil ".\\.elc?\\(\\.gz\\)?$" t)))
+ (directory-files dir nil
+ "\\.elc?\\(?:\\.gz\\)?\\'" t)))
(and curr-files
(not noninteractive)
(message "Checking %d files in %s..." (length curr-files) dir))
("\\.pas\\'" . pascal-mode)
("\\.\\(dpr\\|DPR\\)\\'" . delphi-mode)
("\\.ad[abs]\\'" . ada-mode)
- ("\\.ad[bs].dg\\'" . ada-mode)
+ ("\\.ad[bs]\\.dg\\'" . ada-mode)
("\\.\\([pP]\\([Llm]\\|erl\\|od\\)\\|al\\)\\'" . perl-mode)
("Imakefile\\'" . makefile-imake-mode)
("Makeppfile\\(?:\\.mk\\)?\\'" . makefile-makepp-mode) ; Put this before .mk
("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
("\\.toml\\'" . conf-toml-mode)
("\\.desktop\\'" . conf-desktop-mode)
- ("/\\.redshift.conf\\'" . conf-windows-mode)
+ ("/\\.redshift\\.conf\\'" . conf-windows-mode)
("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
;; ChangeLog.old etc. Other change-log-mode entries are above;
(write-region "" nil filename nil 0))
(defconst directory-files-no-dot-files-regexp
- "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"
+ "[^.]\\|\\.\\.\\."
"Regexp matching any file name except \".\" and \"..\".")
(defun files--force (no-such fn &rest args)
;; Allow compressed files also.
(setq package--builtins nil)
(setq finder-keywords-hash (make-hash-table :test 'eq))
- (let* ((el-file-regexp "^\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?$")
+ (let* ((el-file-regexp "\\`\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?\\'")
(file-count 0)
(files (cl-loop for d in (or dirs load-path)
when (file-exists-p (directory-file-name d))
"nowait"
"internal")
'(("^\\([-A-Za-z0-9_]+\\)" 1 font-lock-type-face))
- '("/etc/inetd.conf\\'")
+ '("/etc/inetd\\.conf\\'")
(list
(function
(lambda ()
(2 font-lock-variable-name-face)
(3 font-lock-constant-face)))
;; List of additional automode-alist expressions
- '("/etc/named.boot\\'")
+ '("/etc/named\\.boot\\'")
;; List of set up functions to call
nil))
;; List of additional font-lock-expressions
nil
;; List of additional auto-mode-alist expressions
- '("/etc/resolv[e]?.conf\\'")
+ '("/etc/resolve?\\.conf\\'")
;; List of set up functions to call
nil))
;; List of additional font-lock-expressions
nil
;; List of additional automode-alist expressions
- '("/etc/modules.conf" "/etc/conf.modules")
+ '("/etc/modules\\.conf" "/etc/conf\\.modules")
;; List of set up functions to call
nil))
(file-attributes (directory-files-and-attributes
(gnus-agent-article-name
"" gnus-agent-read-agentview)
- nil "^[0-9]+$" t)))
+ nil "\\`[0-9]+\\'" t)))
(while file-attributes
(let ((fa (pop file-attributes)))
(unless (file-attribute-type (cdr fa))
(sort (delq nil (mapcar (lambda (name)
(and (not (file-directory-p (nnheader-concat dir name)))
(string-to-number name)))
- (directory-files dir nil "^[0-9]+$" t)))
+ (directory-files
+ dir nil "\\`[0-9]+\\'" t)))
'>)
(progn (gnus-make-directory dir) nil)))
nov-arts
(setq delta sum))
(let ((sum (- (nth 2 entry)))
(info (directory-files-and-attributes
- path nil "^-?[0-9]+$" t))
+ path nil "\\`-?[0-9]+\\'" t))
file)
(while (setq file (pop info))
(cl-incf sum (float (or (file-attribute-size (cdr file)) 0))))
(when (file-exists-p dir)
(setq articles
(sort (mapcar (lambda (name) (string-to-number name))
- (directory-files dir nil "^[0-9]+$" t))
+ (directory-files dir nil "\\`[0-9]+\\'" t))
'<))
;; Update the cache active file, just to synch more.
(if articles
(if (file-directory-p (car files))
(setq out (nconc (directory-files
(car files) t
- (concat (gnus-score-file-regexp) "$"))))
+ (concat (gnus-score-file-regexp) "\\'"))))
(push (car files) out))
(setq files (cdr files)))
(setq gnus-internal-global-score-files out)))
If there's no subdirectory, delete DIRECTORY as well."
(when (file-directory-p directory)
(let ((files (directory-files
- directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))
+ directory t (rx (or (not ".") "..."))))
file dir)
(while files
(setq file (pop files))
did-unpack))
(defun gnus-uu-dir-files (dir)
- (let ((dirs (directory-files dir t "[^/][^\\.][^\\.]?$"))
+ (let ((dirs (directory-files dir t (rx (or (not ".") "..."))))
files file)
(while dirs
(if (file-directory-p (setq file (car dirs)))
(nnheader-re-read-dir pathname)
(setq dir (mapcar (lambda (name) (string-to-number (substring name 1)))
(ignore-errors (directory-files
- pathname nil "^#[0-9]+#$" t))))
+ pathname nil "\\`#[0-9]+#\\'" t))))
(dolist (n dir)
(unless (file-exists-p
(setq file (expand-file-name (int-to-string n) pathname)))
(setq dir
(sort
(mapcar 'string-to-number
- (directory-files pathname nil "^[0-9]+$" t))
+ (directory-files pathname nil "\\`[0-9]+\\'" t))
'<))
(cond
(dir
(nnmh-possibly-change-directory group server)
(let ((articles (mapcar 'string-to-number
(directory-files
- nnmh-current-directory nil "^[0-9]+$"))))
+ nnmh-current-directory nil "\\`[0-9]+\\'"))))
(when articles
(setcar active (apply 'min articles))
(setcdr active (apply 'max articles))))))
;; Delete all articles in GROUP.
(if (not force)
() ; Don't delete the articles.
- (let ((articles (directory-files nnmh-current-directory t "^[0-9]+$")))
+ (let ((articles (directory-files nnmh-current-directory t "\\`[0-9]+\\'")))
(while articles
(when (file-writable-p (car articles))
(nnheader-message 5 "Deleting article %s in %s..."
;; Find the highest number in the group.
(let ((files (sort
(mapcar 'string-to-number
- (directory-files dir nil "^[0-9]+$"))
+ (directory-files dir nil "\\`[0-9]+\\'"))
'>)))
(when files
(setcdr active (car files)))))
(let* ((dir nnmh-current-directory)
(files (sort (mapcar 'string-to-number
(directory-files nnmh-current-directory
- nil "^[0-9]+$" t))
+ nil "\\`[0-9]+\\'" t))
'<))
(nnmh-file (concat dir ".nnmh-articles"))
new articles)
t)
;; Yes, completely empty spool directories *are* possible.
;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
- (when (setq dir (directory-files pathname nil "^[0-9]+$" t))
+ (when (setq dir (directory-files pathname nil "\\`[0-9]+\\'" t))
(setq dir (sort (mapcar 'string-to-number dir) '<)))
(if dir
(nnheader-insert
(defun spam-stat-process-directory (dir func)
"Process all the regular files in directory DIR using function FUNC."
- (let* ((files (directory-files dir t "^[^.]"))
+ (let* ((files (directory-files dir t "\\`[^.]"))
(max (/ (length files) 100.0))
(count 0))
(with-temp-buffer
non-spam in a temporary buffer. If it is the symbol `ham',
display non-spam files; otherwise display spam files."
(interactive "DDirectory: ")
- (let* ((files (directory-files dir t "^[^.]"))
+ (let* ((files (directory-files dir t "\\`[^.]"))
display-files
buffer-score
(total (length files))
;; of the *packages* in which the function is defined.
(let* ((name (symbol-name symbol))
(re (concat "\\_<" (regexp-quote name) "\\_>"))
- (news (directory-files data-directory t "\\`NEWS.[1-9]"))
+ (news (directory-files data-directory t "\\`NEWS\\.[1-9]"))
(place nil)
(first nil))
(with-temp-buffer
(setq res (cons (match-string-no-properties 1) res)))))
(cons "NEWS"
(directory-files data-directory nil
- "^NEWS\\.[0-9][-0-9]*$" nil)))
+ "\\`NEWS\\.[0-9][-0-9]*\\'" nil)))
(sort (delete-dups res) #'string>)))
(current (car all-versions)))
(setq version (completing-read
(while quail-dirs
(setq dirname (car quail-dirs))
(when dirname
- (setq pkg-list (directory-files dirname 'full "\\.el$"))
+ (setq pkg-list (directory-files dirname 'full "\\.el\\'"))
(while pkg-list
(with-temp-buffer
(insert-file-contents (car pkg-list))
(if (file-directory-p filename)
(progn
(message "Converting all tit files in the directory %s" filename)
- (setq files (directory-files filename t "\\.tit$")))
+ (setq files (directory-files filename t "\\.tit\\'")))
(setq files (list filename)))
(while files
(setq file (expand-file-name (car files)))
;; So I create a vm-spool-files entry for each of those mail drops
(mapcar 'file-name-sans-extension
(directory-files mspools-folder-directory nil
- (format "^[^.]+\\.%s" mspools-suffix)))
+ (format "\\`[^.]+\\.%s" mspools-suffix)))
))
))
(if (null mspools-folder-directory)
(error "Set `mspools-folder-directory' to where the spool files are"))
(setq folders (directory-files mspools-folder-directory nil
- (format "^[^.]+\\.%s$" mspools-suffix)))
+ (format "\\`[^.]+\\.%s\\'" mspools-suffix)))
(setq folders (mapcar 'mspools-size-folder folders))
(setq folders (delq nil folders))
(setq mspools-files folders)
:type 'directory
:group 'rmail-files)
;;;###autoload
-(defcustom rmail-secondary-file-regexp (purecopy "\\.xmail$")
+(defcustom rmail-secondary-file-regexp (purecopy "\\.xmail\\'")
"Regexp for which files are secondary Rmail files."
:type 'regexp
:group 'rmail-files)
(font-lock-fontify-region (point-min) (point-max)))))))
\f
;;; Speedbar support for RMAIL files.
-(defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"
+(defcustom rmail-speedbar-match-folder-regexp
+ "\\`[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?\\'"
"Regexp matching Rmail folder names to be displayed in Speedbar.
Enabling this permits Speedbar to display your folders for easy
browsing, and moving of messages."
(ange-ftp-delete-directory file recursive trash)
(delete-file file trash)))
;; We do not want to delete "." and "..".
- (directory-files
- dir 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
+ (directory-files dir 'full (rx (or (not ".") "...")))))
(if parsed
(let* ((host (nth 0 parsed))
(user (nth 1 parsed))
(regexp-opt
(mapcar
#'file-name-sans-extension
- (directory-files dir nil "^tramp.+\\.elc?$"))
+ (directory-files dir nil "\\`tramp.+\\.elc?\\'"))
'paren))))
(mapatoms
(lambda (atom)
(interactive "DRequest updates for Lisp directory: \nP")
(with-current-buffer (get-buffer-create gulp-tmp-buffer)
(let ((m-p-alist (gulp-create-m-p-alist
- (directory-files dir nil "^[^=].*\\.el$" t)
+ (directory-files dir nil "\\`[^=].*\\.el\\'" t)
dir))
;; Temporarily inhibit undo in the *gulp* buffer.
(buffer-undo-list t)
(unless (file-writable-p rl-dir)
(error "No writable revlib directory found"))
(message "Revlib at %s" rl-dir)
- (let* ((archives (directory-files rl-dir 'full "[^.]\\|..."))
+ (let* ((archives (directory-files rl-dir 'full (rx (or (not ".") "..."))))
(categories
(apply 'append
(mapcar (lambda (dir)
(when (file-directory-p dir)
- (directory-files dir 'full "[^.]\\|...")))
+ (directory-files dir 'full
+ (rx (or (not ".") "...")))))
archives)))
(branches
(apply 'append
(mapcar (lambda (dir)
(when (file-directory-p dir)
- (directory-files dir 'full "[^.]\\|...")))
+ (directory-files dir 'full
+ (rx (or (not ".") "...")))))
categories)))
(versions
(apply 'append
(delete-file file)))
;; We do not want to delete "." and "..".
(directory-files org-babel-temporary-directory 'full
- "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))
+ (rx (or (not ".") "..."))))
(delete-directory org-babel-temporary-directory))
(error
(message "Failed to remove temporary Org-babel directory %s"
:group 'ebnf-syntactic)
-(defcustom ebnf-file-suffix-regexp "\\.[Bb][Nn][Ff]$"
+(defcustom ebnf-file-suffix-regexp "\\.[Bb][Nn][Ff]\\'"
"Specify file name suffix that contains EBNF.
See `ebnf-eps-directory' command."
(ebnf-syntax . 'ebnf)
(ebnf-iso-alternative-p . nil)
(ebnf-iso-normalize-p . nil)
- (ebnf-file-suffix-regexp . "\\.[Bb][Nn][Ff]$")
+ (ebnf-file-suffix-regexp . "\\.[Bb][Nn][Ff]\\'")
(ebnf-eps-prefix . "ebnf--")
(ebnf-eps-header-font . '(11 Helvetica "Black" "White" bold))
(ebnf-eps-header . nil)
If PROGRAM is non-nil, use that instead of \"find\"."
;; Pick file to search from location we know
(let* ((dir (file-truename data-directory))
- (file (car (directory-files dir nil "^[^.]"))))
+ (file (car (directory-files dir nil "\\`[^.]"))))
(with-temp-buffer
(call-process (or program "find")
nil
((not (eq system-type 'windows-nt))
(concat "~" init-file-user "/.emacs"))
;; Else deal with the Windows situation.
- ((directory-files "~" nil "^\\.emacs\\(\\.elc?\\)?$")
+ ((directory-files "~" nil "\\`\\.emacs\\(\\.elc?\\)?\\'")
;; Prefer .emacs on Windows.
"~/.emacs")
- ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
+ ((directory-files "~" nil "\\`_emacs\\(\\.elc?\\)?\\'")
;; Also support _emacs for compatibility, but warn about it.
(push `(initialization
,(format-message
dir files)
(while (setq dir (car dirs))
(setq files
- (append (directory-files dir t "\\.bib$")
+ (append (directory-files dir t "\\.bib\\'")
files))
(setq dirs (cdr dirs)))
files))
(mapc (lambda (f)
(if (string-match "url-\\(.*\\).el$" f)
(push (match-string 1 f) schemes)))
- (directory-files d nil "^url-.*\\.el$")))
+ (directory-files d nil "\\`url-.*\\.el\\'")))
load-path)
(put 'url-extension-protocols 'schemes schemes)
schemes)))))
(setq subdir (expand-file-name "RCS"
(file-name-directory file)))))
(not (directory-files (file-name-directory file)
- nil ".*,v$" t))
+ nil ",v\\'" t))
(yes-or-no-p "Create RCS subdirectory? ")
(make-directory subdir))
(apply #'vc-do-command "*vc*" 0 "ci" file
(and (string= (file-name-nondirectory (directory-file-name dir)) "RCS")
;; check whether RCS dir is empty, i.e. it does not
;; contain any files except "." and ".."
- (not (directory-files dir nil
- "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*"))
+ (not (directory-files dir nil (rx (or (not ".") "..."))))
(yes-or-no-p (format "Directory %s is empty; remove it? " dir))
(delete-directory dir)))))
(setq attr (directory-files-and-attributes tmp-name 'full))
(dolist (elt attr)
(should (equal (file-attributes (car elt)) (cdr elt))))
- (setq attr (directory-files-and-attributes tmp-name nil "^b"))
+ (setq attr (directory-files-and-attributes tmp-name nil "\\`b"))
(should (equal (mapcar #'car attr) '("bar"))))
;; Cleanup.
(tramp--test-file-attributes-equal-p
(file-attributes (car elt)) (cdr elt))))
- (setq attr (directory-files-and-attributes tmp-name2 nil "^b"))
+ (setq attr (directory-files-and-attributes tmp-name2 nil "\\`b"))
(should (equal (mapcar #'car attr) '("bar" "boz"))))
;; Cleanup.