From b9cb3b904008a80c69ab433f4851377967b100db Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 2 Mar 2021 08:07:59 +0100 Subject: Improve the dired-do-kill-lines doc string * lisp/dired-aux.el (dired-do-kill-lines): Document the FMT parameter (bug#46867). --- lisp/dired-aux.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index a94bdf5b42e..d5f49108767 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1072,8 +1072,13 @@ To kill an entire subdirectory \(without killing its line in the parent directory), go to its directory header line and use this command with a prefix argument (the value does not matter). -To undo the killing, the undo command can be used as normally." - ;; Returns count of killed lines. FMT="" suppresses message. +To undo the killing, the undo command can be used as normally. + +This function returns the number of killed lines. + +FMT is a format string used for messaging the user about the +killed lines, and defaults to \"Killed %d line%s.\" if not +present. A FMT of \"\" will suppress the messaging." (interactive "P") (if arg (if (dired-get-subdir) -- cgit v1.2.3 From cf607c262e15c873961fdfcced254e6f8e82f8d7 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 28 Mar 2021 16:01:53 +0200 Subject: Clarify dired-do-shell-command doc string * lisp/dired-aux.el (dired-do-shell-command): Mention what happens to FILE-LIST (bug#47432). --- lisp/dired-aux.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d5f49108767..eea2188142f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -826,6 +826,8 @@ If no files are marked or a numeric prefix arg is given, the next ARG files are used. Just \\[universal-argument] means the current file. The prompt mentions the file(s) or the marker, as appropriate. +When executing, FILE-LIST is appended to the COMMAND string. + If there is a `*' in COMMAND, surrounded by whitespace, this runs COMMAND just once with the entire file list substituted there. -- cgit v1.2.3 From 01cf0eb75786834b7a0ee5be34be53f6e8e14c11 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 28 Mar 2021 17:06:01 +0200 Subject: Revert "Clarify dired-do-shell-command doc string" This reverts commit cf607c262e15c873961fdfcced254e6f8e82f8d7. The doc string already explains this. --- lisp/dired-aux.el | 2 -- 1 file changed, 2 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index eea2188142f..d5f49108767 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -826,8 +826,6 @@ If no files are marked or a numeric prefix arg is given, the next ARG files are used. Just \\[universal-argument] means the current file. The prompt mentions the file(s) or the marker, as appropriate. -When executing, FILE-LIST is appended to the COMMAND string. - If there is a `*' in COMMAND, surrounded by whitespace, this runs COMMAND just once with the entire file list substituted there. -- cgit v1.2.3 From c45bfd3c4abbfa585c9199f4866b6b8046945117 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 11 Apr 2021 23:47:14 -0400 Subject: * lisp/**/*.el: Avoid positional args to `define-minor-mode` Back in Emacs-21.1, `define-minor-mode` grew keywords arguments to replace its old positional arguments. Let's make sure we don't use the old-style any more. * lisp/org/ox-beamer.el (org-beamer-mode-map): Move initialization into declaration. (org-beamer-mode): * lisp/textmodes/tildify.el (tildify-mode): * lisp/textmodes/sgml-mode.el (html-autoview-mode): * lisp/textmodes/rst.el (rst-minor-mode): * lisp/textmodes/remember.el (remember-notes-mode): * lisp/textmodes/ispell.el (ispell-minor-mode): * lisp/tar-mode.el (tar-subfile-mode): * lisp/strokes.el (strokes-mode): * lisp/so-long.el (so-long-minor-mode): * lisp/shell.el (shell-dirtrack-mode): * lisp/scroll-all.el (scroll-all-mode): * lisp/ruler-mode.el (ruler-mode): * lisp/rect.el (rectangle-mark-mode): * lisp/progmodes/sh-script.el (sh-electric-here-document-mode): * lisp/outline.el (outline-minor-mode): * lisp/org/org.el (org-cdlatex-mode): * lisp/org/org-table.el (org-table-header-line-mode) (org-table-follow-field-mode, orgtbl-mode): * lisp/org/org-src.el (org-src-mode): * lisp/org/org-list.el (org-list-checkbox-radio-mode): * lisp/org/org-indent.el (org-indent-mode): * lisp/org/org-capture.el (org-capture-mode): * lisp/obsolete/pc-select.el (pc-selection-mode): * lisp/obsolete/iswitchb.el (iswitchb-mode): * lisp/net/rcirc.el (rcirc-omit-mode, rcirc-multiline-minor-mode) (rcirc-track-minor-mode): * lisp/net/goto-addr.el (goto-address-mode, goto-address-prog-mode): * lisp/image-mode.el (image-minor-mode): * lisp/ibuf-ext.el (ibuffer-auto-mode): * lisp/gnus/gnus-cite.el (gnus-message-citation-mode): * lisp/font-core.el (font-lock-mode): * lisp/erc/erc.el (define-erc-module): * lisp/erc/erc-track.el (erc-track-minor-mode): * lisp/erc/erc-fill.el (erc-fill-mode): * lisp/epa-mail.el (epa-mail-mode): * lisp/emacs-lisp/checkdoc.el (checkdoc-minor-mode): * lisp/dirtrack.el (dirtrack-mode, dirtrack-debug-mode): * lisp/dired-aux.el (dired-isearch-filenames-mode): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-mode): * lisp/cedet/semantic/decorate/mode.el (semantic-decoration-mode): * lisp/autoarg.el (autoarg-mode, autoarg-kp-mode): * lisp/vc/pcvs.el (cvs-minor-mode): Avoid old-style positional args to `define-minor-mode`. --- lisp/autoarg.el | 4 ++-- lisp/cedet/semantic/decorate/mode.el | 2 +- lisp/cedet/semantic/idle.el | 3 ++- lisp/dired-aux.el | 2 +- lisp/dirtrack.el | 4 ++-- lisp/emacs-lisp/checkdoc.el | 2 +- lisp/emacs-lisp/macroexp.el | 3 ++- lisp/epa-mail.el | 2 +- lisp/erc/erc-fill.el | 1 - lisp/erc/erc-track.el | 3 --- lisp/erc/erc.el | 1 - lisp/font-core.el | 1 - lisp/gnus/gnus-cite.el | 4 +--- lisp/ibuf-ext.el | 2 +- lisp/image-mode.el | 3 +-- lisp/net/goto-addr.el | 8 ++------ lisp/net/rcirc.el | 7 +------ lisp/obsolete/iswitchb.el | 2 +- lisp/obsolete/pc-select.el | 2 -- lisp/org/org-capture.el | 2 +- lisp/org/org-indent.el | 2 +- lisp/org/org-list.el | 2 +- lisp/org/org-src.el | 2 +- lisp/org/org-table.el | 6 +++--- lisp/org/org.el | 2 +- lisp/org/ox-beamer.el | 8 +++++--- lisp/outline.el | 5 +++-- lisp/progmodes/sh-script.el | 2 +- lisp/rect.el | 2 +- lisp/ruler-mode.el | 2 -- lisp/scroll-all.el | 2 +- lisp/shell.el | 2 +- lisp/so-long.el | 2 +- lisp/strokes.el | 2 +- lisp/tar-mode.el | 2 +- lisp/textmodes/ispell.el | 2 +- lisp/textmodes/remember.el | 2 +- lisp/textmodes/rst.el | 12 +++++------- lisp/textmodes/sgml-mode.el | 2 +- lisp/textmodes/tildify.el | 2 +- lisp/vc/pcvs.el | 2 +- 41 files changed, 52 insertions(+), 71 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/autoarg.el b/lisp/autoarg.el index c2cb0c7051c..7c2c6f1030d 100644 --- a/lisp/autoarg.el +++ b/lisp/autoarg.el @@ -107,7 +107,7 @@ then invokes the normal binding of \\[autoarg-terminate]. `C-u \\[autoarg-terminate]' invokes the normal binding of \\[autoarg-terminate] four times. \\{autoarg-mode-map}" - nil " Aarg" autoarg-mode-map :global t :group 'keyboard) + :lighter" Aarg" :global t :group 'keyboard) ;;;###autoload (define-minor-mode autoarg-kp-mode @@ -118,7 +118,7 @@ This is similar to `autoarg-mode' but rebinds the keypad keys `kp-1' etc. to supply digit arguments. \\{autoarg-kp-mode-map}" - nil " Aakp" autoarg-kp-mode-map :global t :group 'keyboard + :lighter " Aakp" :global t :group 'keyboard (if autoarg-kp-mode (dotimes (i 10) (let ((sym (intern (format "kp-%d" i)))) diff --git a/lisp/cedet/semantic/decorate/mode.el b/lisp/cedet/semantic/decorate/mode.el index 78950159199..c6bf15205fd 100644 --- a/lisp/cedet/semantic/decorate/mode.el +++ b/lisp/cedet/semantic/decorate/mode.el @@ -254,7 +254,7 @@ available and the current buffer was set up for parsing. Return non-nil if the minor mode is enabled." ;; ;;\\{semantic-decoration-map}" - nil nil nil + :lighter nil (if semantic-decoration-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 420a457b0ea..b883573a30f 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -171,7 +171,8 @@ date, and reparses while the user is idle (not typing.) The minor mode can be turned on only if semantic feature is available and the current buffer was set up for parsing. Return -non-nil if the minor mode is enabled." nil nil nil +non-nil if the minor mode is enabled." + :lighter nil (if semantic-idle-scheduler-mode (if (not (and (featurep 'semantic) (semantic-active-p))) (progn diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d5f49108767..8fe612fa0b1 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2980,7 +2980,7 @@ a file name. Otherwise, it searches the whole buffer without restrictions." When on, Isearch skips matches outside file names using the predicate `dired-isearch-filter-filenames' that matches only at file names. When off, it uses the original predicate." - nil nil nil + :lighter nil (if dired-isearch-filenames-mode (add-function :before-while (local 'isearch-filter-predicate) #'dired-isearch-filter-filenames diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el index 7f76ef6653a..be8db75c967 100644 --- a/lisp/dirtrack.el +++ b/lisp/dirtrack.el @@ -184,7 +184,7 @@ working directory at all times, and that you set the variable This is an alternative to `shell-dirtrack-mode', which works by tracking `cd' and similar commands which change the shell working directory." - nil nil nil + :lighter nil (if dirtrack-mode (add-hook 'comint-preoutput-filter-functions 'dirtrack nil t) (remove-hook 'comint-preoutput-filter-functions 'dirtrack t))) @@ -192,7 +192,7 @@ directory." (define-minor-mode dirtrack-debug-mode "Toggle Dirtrack debugging." - nil nil nil + :lighter nil (if dirtrack-debug-mode (display-buffer (get-buffer-create dirtrack-debug-buffer)))) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 96b16f7ed45..00cc7777e1a 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1242,7 +1242,7 @@ bound to \\\\[checkdoc-eval-defun] and `checkdoc-eval-c checking of documentation strings. \\{checkdoc-minor-mode-map}" - nil checkdoc-minor-mode-string nil + :lighter checkdoc-minor-mode-string :group 'checkdoc) ;;; Subst utils diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 59ada5ec35a..df864464b77 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -394,7 +394,8 @@ Assumes the caller has bound `macroexpand-all-environment'." ;; Record which arguments expect functions, so we can warn when those ;; are accidentally quoted with ' rather than with #' -(dolist (f '(funcall apply mapcar mapatoms mapconcat mapc cl-mapcar maphash)) +(dolist (f '( funcall apply mapcar mapatoms mapconcat mapc cl-mapcar maphash + map-char-table map-keymap map-keymap-internal)) (put f 'funarg-positions '(1))) (dolist (f '( add-hook remove-hook advice-remove advice--remove-function defalias fset global-set-key run-after-idle-timeout diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el index 7e100569b0f..7eac1f89986 100644 --- a/lisp/epa-mail.el +++ b/lisp/epa-mail.el @@ -59,7 +59,7 @@ Otherwise, signal an error." ;;;###autoload (define-minor-mode epa-mail-mode "A minor-mode for composing encrypted/clearsigned mails." - nil " epa-mail" epa-mail-mode-map) + :lighter " epa-mail") ;;; Utilities diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 0312d221ece..41256682c00 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -46,7 +46,6 @@ the mode if ARG is omitted or nil. ERC fill mode is a global minor mode. When enabled, messages in the channel buffers are filled." - nil nil nil :global t (if erc-fill-mode (erc-fill-enable) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 9985b6a02f0..2364d45d6f3 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -464,9 +464,6 @@ ERC Track minor mode is a global minor mode. It exists for the sole purpose of providing the C-c C-SPC and C-c C-@ keybindings. Make sure that you have enabled the track module, otherwise the keybindings will not do anything useful." - :init-value nil - :lighter "" - :keymap erc-track-minor-mode-map :global t) (defun erc-track-minor-mode-maybe (&optional buffer) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index f0144de8446..e20aa8057de 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1289,7 +1289,6 @@ With a prefix argument ARG, enable %s if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. %s" name name doc) - nil nil nil ;; FIXME: We don't know if this group exists, so this `:group' may ;; actually just silence a valid warning about the fact that the var ;; is not associated with any group. diff --git a/lisp/font-core.el b/lisp/font-core.el index 4b695424977..db06a607660 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -126,7 +126,6 @@ buffer local value for `font-lock-defaults', via its mode hook. The above is the default behavior of `font-lock-mode'; you may specify your own function which is called when `font-lock-mode' is toggled via `font-lock-function'." - nil nil nil :after-hook (font-lock-initial-fontify) ;; Don't turn on Font Lock mode if we don't have a display (we're running a ;; batch job) or if the buffer is invisible (the name starts with a space). diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el index 4249b50b9ff..34947cece89 100644 --- a/lisp/gnus/gnus-cite.el +++ b/lisp/gnus/gnus-cite.el @@ -1134,9 +1134,7 @@ Returns nil if there is no such line before LIMIT, t otherwise." (define-minor-mode gnus-message-citation-mode "Minor mode providing more font-lock support for nested citations. When enabled, it automatically turns on `font-lock-mode'." - nil ;; init-value - "" ;; lighter - nil ;; keymap + :lighter "" (when (derived-mode-p 'message-mode) ;; FIXME: Use font-lock-add-keywords! (let ((defaults (car font-lock-defaults)) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 48f9e8a990d..1dc8acbe1f3 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -402,7 +402,7 @@ format. See `ibuffer-update-saved-filters-format' and ;;;###autoload (define-minor-mode ibuffer-auto-mode "Toggle use of Ibuffer's auto-update facility (Ibuffer Auto mode)." - nil nil nil + :lighter nil (unless (derived-mode-p 'ibuffer-mode) (error "This buffer is not in Ibuffer mode")) (cond (ibuffer-auto-mode diff --git a/lisp/image-mode.el b/lisp/image-mode.el index f4ff35f9c41..69ef7015cce 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -713,8 +713,7 @@ Key bindings: Image minor mode provides the key \\\\[image-toggle-display], to switch back to `image-mode' and display an image file as the actual image." - nil (:eval (if image-type (format " Image[%s]" image-type) " Image")) - image-minor-mode-map + :lighter (:eval (if image-type (format " Image[%s]" image-type) " Image")) :group 'image :version "22.1" (if image-minor-mode diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el index af12f6970a6..8992ef736a6 100644 --- a/lisp/net/goto-addr.el +++ b/lisp/net/goto-addr.el @@ -263,9 +263,7 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and ;;;###autoload (define-minor-mode goto-address-mode "Minor mode to buttonize URLs and e-mail addresses in the current buffer." - nil - "" - nil + :lighter "" (if goto-address-mode (jit-lock-register #'goto-address-fontify-region) (jit-lock-unregister #'goto-address-fontify-region) @@ -285,9 +283,7 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and ;;;###autoload (define-minor-mode goto-address-prog-mode "Like `goto-address-mode', but only for comments and strings." - nil - "" - nil + :lighter "" (if goto-address-prog-mode (jit-lock-register #'goto-address-fontify-region) (jit-lock-unregister #'goto-address-fontify-region) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 938fadfed74..7bb8ca671cf 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -196,7 +196,7 @@ If nil, no maximum is applied." Uninteresting lines are those whose responses are listed in `rcirc-omit-responses'." - nil " Omit" nil + :lighter " Omit" (if rcirc-omit-mode (progn (add-to-invisibility-spec '(rcirc-omit . nil)) @@ -1359,9 +1359,7 @@ Create the buffer if it doesn't exist." (define-minor-mode rcirc-multiline-minor-mode "Minor mode for editing multiple lines in rcirc." - :init-value nil :lighter " rcirc-mline" - :keymap rcirc-multiline-minor-mode-map :global nil (setq fill-column rcirc-max-message-length)) @@ -1863,9 +1861,6 @@ This function does not alter the INPUT string." ;;;###autoload (define-minor-mode rcirc-track-minor-mode "Global minor mode for tracking activity in rcirc buffers." - :init-value nil - :lighter "" - :keymap rcirc-track-minor-mode-map :global t (or global-mode-string (setq global-mode-string '(""))) ;; toggle the mode-line channel indicator diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index 7ffee762eb2..a630baf3543 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -1336,7 +1336,7 @@ See the variable `iswitchb-case' for details." Iswitchb mode is a global minor mode that enables switching between buffers using substrings. See `iswitchb' for details." - nil nil iswitchb-global-map :global t + :keymap iswitchb-global-map :global t (if iswitchb-mode (add-hook 'minibuffer-setup-hook #'iswitchb-minibuffer-setup) (remove-hook 'minibuffer-setup-hook #'iswitchb-minibuffer-setup))) diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el index 59828759e66..f999f507972 100644 --- a/lisp/obsolete/pc-select.el +++ b/lisp/obsolete/pc-select.el @@ -314,8 +314,6 @@ but before calling PC Selection mode): C-BACKSPACE backward-kill-word M-BACKSPACE undo" ;; FIXME: bring pc-bindings-mode here ? - nil nil nil - :global t (if pc-selection-mode diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index f40f2b335ef..7ae8fae3aab 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el @@ -521,7 +521,7 @@ for a capture buffer.") "Minor mode for special key bindings in a capture buffer. Turning on this mode runs the normal hook `org-capture-mode-hook'." - nil " Cap" org-capture-mode-map + :lighter " Cap" (setq-local header-line-format (substitute-command-keys diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index c6bf416564e..3475cadc42d 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -167,7 +167,7 @@ properties, after each buffer modification, on the modified zone. The process is synchronous. Though, initial indentation of buffer, which can take a few seconds on large buffers, is done during idle time." - nil " Ind" nil + :lighter " Ind" (cond (org-indent-mode ;; mode was turned on. diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 39122e7ce41..f97164ee33b 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -2304,7 +2304,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is ;;;###autoload (define-minor-mode org-list-checkbox-radio-mode "When turned on, use list checkboxes as radio buttons." - nil " CheckBoxRadio" nil + :lighter " CheckBoxRadio" (unless (eq major-mode 'org-mode) (user-error "Cannot turn this mode outside org-mode buffers"))) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 20acee4e662..cabedecb689 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -682,7 +682,7 @@ This minor mode is turned on in two situations: \\{org-src-mode-map} See also `org-src-mode-hook'." - nil " OrgSrc" nil + :lighter " OrgSrc" (when org-edit-src-persistent-message (setq header-line-format (substitute-command-keys diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 1248efabc15..0e93fb271f3 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -495,7 +495,7 @@ This may be useful when columns have been shrunk." ;;;###autoload (define-minor-mode org-table-header-line-mode "Display the first row of the table at point in the header line." - nil " TblHeader" nil + :lighter " TblHeader" (unless (eq major-mode 'org-mode) (user-error "Cannot turn org table header mode outside org-mode buffers")) (if org-table-header-line-mode @@ -1976,7 +1976,7 @@ lines." When this mode is active, the field editor window will always show the current field. The mode exits automatically when the cursor leaves the table (but see `org-table-exit-follow-field-mode-when-leaving-table')." - nil " TblFollow" nil + :lighter " TblFollow" (if org-table-follow-field-mode (add-hook 'post-command-hook 'org-table-follow-fields-with-editor 'append 'local) @@ -5149,7 +5149,7 @@ When LOCAL is non-nil, show references for the table at point." ;;;###autoload (define-minor-mode orgtbl-mode "The Org mode table editor as a minor mode for use in other modes." - :lighter " OrgTbl" :keymap orgtbl-mode-map + :lighter " OrgTbl" (org-load-modules-maybe) (cond ((derived-mode-p 'org-mode) diff --git a/lisp/org/org.el b/lisp/org/org.el index cebe1735bed..f560c65dc4f 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -15584,7 +15584,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved This mode supports entering LaTeX environment and math in LaTeX fragments in Org mode. \\{org-cdlatex-mode-map}" - nil " OCDL" nil + :lighter " OCDL" (when org-cdlatex-mode (require 'cdlatex) (run-hooks 'cdlatex-mode-hook) diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el index 1a1732b6836..6ed95e84d6b 100644 --- a/lisp/org/ox-beamer.el +++ b/lisp/org/ox-beamer.el @@ -895,14 +895,16 @@ holding export options." ;;; Minor Mode -(defvar org-beamer-mode-map (make-sparse-keymap) +(defvar org-beamer-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\C-c\C-b" 'org-beamer-select-environment) + map) "The keymap for `org-beamer-mode'.") -(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment) ;;;###autoload (define-minor-mode org-beamer-mode "Support for editing Beamer oriented Org mode files." - nil " Bm" 'org-beamer-mode-map) + :lighter " Bm") (when (fboundp 'font-lock-add-keywords) (font-lock-add-keywords diff --git a/lisp/outline.el b/lisp/outline.el index 79029a6e5e7..bce9c6b9e4d 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -374,8 +374,9 @@ faces to major mode's faces." "Toggle Outline minor mode. See the command `outline-mode' for more information on this mode." - nil " Outl" (list (cons [menu-bar] outline-minor-mode-menu-bar-map) - (cons outline-minor-mode-prefix outline-mode-prefix-map)) + :lighter " Outl" + :keymap (list (cons [menu-bar] outline-minor-mode-menu-bar-map) + (cons outline-minor-mode-prefix outline-mode-prefix-map)) (if outline-minor-mode (progn (when (or outline-minor-mode-cycle outline-minor-mode-highlight) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index ba59f9c6616..c6bd32a4a4b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2967,7 +2967,7 @@ The document is bounded by `sh-here-document-word'." (define-minor-mode sh-electric-here-document-mode "Make << insert a here document skeleton." - nil nil nil + :lighter nil (if sh-electric-here-document-mode (add-hook 'post-self-insert-hook #'sh--maybe-here-document nil t) (remove-hook 'post-self-insert-hook #'sh--maybe-here-document t))) diff --git a/lisp/rect.el b/lisp/rect.el index cb941b46009..504be41b673 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -652,7 +652,7 @@ with a prefix argument, prompt for START-AT and FORMAT." "Toggle the region as rectangular. Activates the region if needed. Only lasts until the region is deactivated." - nil nil nil + :lighter nil (rectangle--reset-crutches) (when rectangle-mark-mode (add-hook 'deactivate-mark-hook diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 11226fda020..a0d4f6e96c2 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -568,8 +568,6 @@ format first." ;;;###autoload (define-minor-mode ruler-mode "Toggle display of ruler in header line (Ruler mode)." - nil nil - ruler-mode-map :group 'ruler-mode :variable (ruler-mode . (lambda (enable) diff --git a/lisp/scroll-all.el b/lisp/scroll-all.el index 8ba0cc9e032..415244f9e92 100644 --- a/lisp/scroll-all.el +++ b/lisp/scroll-all.el @@ -108,7 +108,7 @@ ARG is like in `end-of-buffer'." When Scroll-All mode is enabled, scrolling commands invoked in one window apply to all visible windows in the same frame." - nil " *SL*" nil + :lighter " *SL*" :global t :group 'windows (if scroll-all-mode diff --git a/lisp/shell.el b/lisp/shell.el index cd99b008776..3098d3a14da 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -980,7 +980,7 @@ Environment variables are expanded, see function `substitute-in-file-name'." The `dirtrack' package provides an alternative implementation of this feature; see the function `dirtrack-mode'." - nil nil nil + :lighter nil (setq list-buffers-directory (if shell-dirtrack-mode default-directory)) (if shell-dirtrack-mode (add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t) diff --git a/lisp/so-long.el b/lisp/so-long.el index f44d41dc5eb..f916b61b60f 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1185,7 +1185,7 @@ current buffer, and buffer-local values are assigned to variables in accordance with `so-long-variable-overrides'. This minor mode is a standard `so-long-action' option." - nil nil nil + :lighter nil (if so-long-minor-mode ;; We are enabling the mode. (progn ;; Housekeeping. `so-long-minor-mode' might be invoked directly rather diff --git a/lisp/strokes.el b/lisp/strokes.el index 4b682e99feb..4a018ff1993 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el @@ -1393,7 +1393,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer], \\[strokes-decode-buffer]. \\{strokes-mode-map}" - nil strokes-lighter strokes-mode-map :global t + :ligher strokes-lighter :global t (cond ((not (display-mouse-p)) (error "Can't use Strokes without a mouse")) (strokes-mode ; turn on strokes diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index fa9b47556f7..d9b2d421932 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -751,7 +751,7 @@ into the tar-file buffer that it came from. The changes will actually appear on disk when you save the tar-file's buffer." ;; Don't do this, because it is redundant and wastes mode line space. ;; :lighter " TarFile" - nil nil nil + :lighter nil (or (and (boundp 'tar-superior-buffer) tar-superior-buffer) (error "This buffer is not an element of a tar file")) (cond (tar-subfile-mode diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index eb521134dc4..932308ee59d 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -3744,7 +3744,7 @@ SPC. For spell-checking \"on the fly\", not just after typing SPC or RET, use `flyspell-mode'." - nil " Spell" ispell-minor-keymap) + :lighter " Spell" :keymap ispell-minor-keymap) (defun ispell-minor-check () "Check previous word, then continue with the normal binding of this key. diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index cd76bf80f19..8a0436afc64 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -607,7 +607,7 @@ This sets `buffer-save-without-query' so that `save-some-buffers' will save the notes buffer without asking. \\{remember-notes-mode-map}" - nil nil nil + :lighter nil (cond (remember-notes-mode (add-hook 'kill-buffer-query-functions diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 56cca840047..1471be0ecd6 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -1408,13 +1408,11 @@ highlighting. When ReST minor mode is enabled, the ReST mode keybindings are installed on top of the major mode bindings. Use this for modes derived from Text mode, like Mail mode." - ;; The initial value. - nil - ;; The indicator for the mode line. - " ReST" - ;; The minor mode bindings. - rst-mode-map - :group 'rst) + ;; The indicator for the mode line. + :lighter " ReST" + ;; The minor mode bindings. + :keymap rst-mode-map + :group 'rst) ;; FIXME: can I somehow install these too? ;; :abbrev-table rst-mode-abbrev-table diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 6958ab8f658..67f731917e2 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -2440,7 +2440,7 @@ The third `match-string' will be the used in the menu.") HTML Autoview mode is a buffer-local minor mode for use with `html-mode'. If enabled, saving the file automatically runs `browse-url-of-buffer' to view it." - nil nil nil + :lighter nil (if html-autoview-mode (add-hook 'after-save-hook #'browse-url-of-buffer nil t) (remove-hook 'after-save-hook #'browse-url-of-buffer t))) diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 069c8e3f443..163978b4315 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -486,7 +486,7 @@ that space character is replaced by a hard space specified by When `tildify-mode' is enabled, if `tildify-string-alist' specifies a hard space representation for current major mode, the `tildify-space-string' buffer-local variable will be set to the representation." - nil " ~" nil + :lighter " ~" (when tildify-mode (let ((space (with-suppressed-warnings ((obsolete tildify--pick-alist-entry)) diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el index 6e039cc6256..42f531e4f75 100644 --- a/lisp/vc/pcvs.el +++ b/lisp/vc/pcvs.el @@ -331,7 +331,7 @@ the primary since reading the primary can deactivate it." "This mode is used for buffers related to a main *cvs* buffer. All the `cvs-mode' buffer operations are simply rebound under the \\[cvs-mode-map] prefix." - nil " CVS" + :lighter " CVS" :group 'pcl-cvs) (put 'cvs-minor-mode 'permanent-local t) -- cgit v1.2.3 From 5ec4a3dbbc81ef9ed51065189a19689c351e0e8d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 6 May 2021 13:08:56 +0200 Subject: Fix bug#47625 in dired * lisp/dired-aux.el (dired-create-files): Check, that `dired-do-symlink' does not create symlinks on different hosts. (Bug#47625) --- lisp/dired-aux.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 8fe612fa0b1..8fce402c7ad 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1962,6 +1962,11 @@ ESC or `q' to not overwrite any of the remaining files, (file-in-directory-p destname from) (error "Cannot copy `%s' into its subdirectory `%s'" from to))) + ;; Check, that `dired-do-symlink' does not create symlinks + ;; on different hosts. + (when (and (eq file-creator 'make-symbolic-link) + (not (equal (file-remote-p from) (file-remote-p to)))) + (error "Cannot symlink `%s' to `%s' on another host" from to)) (condition-case err (progn (funcall file-creator from to dired-overwrite-confirmed) -- cgit v1.2.3 From dac20f08fa8f6b9fbdb8251af0652a909dee9fc8 Mon Sep 17 00:00:00 2001 From: Sun Lin Date: Mon, 17 May 2021 18:03:55 +0200 Subject: Allow specifying the default archive types to compress to in Dired * lisp/dired-aux.el (dired-compress-file-default-suffix): (dired-compress-directory-default-suffix): New user options (bug#47119). (dired-compress-file-alist): New variable. * lisp/dired-aux.el (dired-compress-file): Use them. (dired-compress-file-suffixes): Remove the directory item. --- doc/emacs/dired.texi | 23 +++++----- etc/NEWS | 12 +++++ lisp/dired-aux.el | 121 ++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 111 insertions(+), 45 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index f57606dc799..36257030c88 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -862,21 +862,24 @@ Compress the specified files (@code{dired-do-compress}). If the file appears to be a compressed file already, uncompress it instead. Each marked file is compressed into its own archive; this uses the @command{gzip} program if it is available, otherwise it uses -@command{compress}. On a directory name, this command produces a -compressed @file{.tar.gz} archive containing all of the directory's -files, by running the @command{tar} command with output piped to -@command{gzip}. To allow decompression of compressed directories, -typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive file unpacks -all the files in the archive into a directory whose name is the -archive name with the extension removed. +@command{compress}. + +On a directory name, this command produces a compressed archive +depending on the @code{dired-compress-directory-default-suffix} user +option. The default is a @file{.tar.gz} archive containing all of the +directory's files, by running the @command{tar} command with output +piped to @command{gzip}. To allow decompression of compressed +directories, typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive +file unpacks all the files in the archive into a directory whose name +is the archive name with the extension removed. @findex dired-do-compress-to @kindex c @r{(Dired)} @item c Compress the specified files (@code{dired-do-compress-to}) into a -single archive anywhere on the file system. The compression algorithm -is determined by the extension of the archive, see -@code{dired-compress-files-alist}. +single archive anywhere on the file system. The default archive is +controlled by the @code{dired-compress-directory-default-suffix} user +option. Also see @code{dired-compress-files-alist}. @findex epa-dired-do-decrypt @kindex :d @r{(Dired)} diff --git a/etc/NEWS b/etc/NEWS index a619df1f72d..ae8a864f102 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -712,6 +712,18 @@ line, and allows truncating them (to preserve space on the mode line) or showing them literally, either instead of, or in addition to, displaying "by name" or "by date" sort order. ++++ +*** New user option 'dired-compress-directory-default-suffix'. +This user option controls default suffix for compressing a directory. +If it's nil, ".tar.gz" will be used. Refer to +'dired-compress-files-alist' for a list of supported suffixes. + ++++ +*** New user option 'dired-compress-file-default-suffix'. +This user option controls the default suffix for compressing files. +If it's nil, ".gz" will be used. Refer to 'dired-compress-file-alist' +for a list of supported suffixes. + --- *** Broken and circular links are shown with the 'dired-broken-symlink' face. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 8fce402c7ad..2e4ff934590 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1132,6 +1132,7 @@ present. A FMT of \"\" will suppress the messaging." ;; Solaris 10 version of tar (obsolete in 2024?). ;; Same thing on AIX 7.1 (obsolete 2023?) and 7.2 (obsolete 2022?). ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -") + ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -") ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -") ("\\.gz\\'" "" "gunzip") ("\\.lz\\'" "" "lzip -d") @@ -1149,10 +1150,7 @@ present. A FMT of \"\" will suppress the messaging." ("\\.zst\\'" "" "unzstd --rm") ("\\.7z\\'" "" "7z x -aoa -o%o %i") ;; This item controls naming for compression. - ("\\.tar\\'" ".tgz" nil) - ;; This item controls the compression of directories. Its REGEXP - ;; element should never match any valid file name. - ("\000" ".tar.gz" "tar -cf - %i | gzip -c9 > %o")) + ("\\.tar\\'" ".tgz" nil)) "Control changes in file name suffixes for compression and uncompression. Each element specifies one transformation rule, and has the form: (REGEXP NEW-SUFFIX PROGRAM) @@ -1168,6 +1166,34 @@ output file. Otherwise, the rule is a compression rule, and compression is done with gzip. ARGS are command switches passed to PROGRAM.") +(defcustom dired-compress-file-default-suffix nil + "Default suffix for compressing a single file. +If nil, \".gz\" will be used." + :type 'string + :group 'dired + :version "28.1") + +(defvar dired-compress-file-alist + '(("\\.gz\\'" . "gzip -9f %i") + ("\\.bz2\\'" . "bzip2 -9f %i") + ("\\.xz\\'" . "xz -9f %i") + ("\\.zst\\'" . "zstd -qf -19 --rm -o %o %i")) + "Controls the compression shell command for `dired-do-compress-to'. + +Each element is (REGEXP . CMD), where REGEXP is the name of the +archive to which you want to compress, and CMD is the +corresponding command. + +Within CMD, %i denotes the input file(s), and %o denotes the +output file. %i path(s) are relative, while %o is absolute.") + +(defcustom dired-compress-directory-default-suffix nil + "Default suffix for compressing a directory. +If nil, \".tar.gz\" will be used." + :type 'string + :group 'dired + :version "28.1") + (defvar dired-compress-files-alist '(("\\.tar\\.gz\\'" . "tar -cf - %i | gzip -c9 > %o") ("\\.tar\\.bz2\\'" . "tar -cf - %i | bzip2 -c9 > %o") @@ -1177,7 +1203,7 @@ ARGS are command switches passed to PROGRAM.") ("\\.tar\\.lzo\\'" . "tar -cf - %i | lzop -c9 > %o") ("\\.zip\\'" . "zip %o -r --filesync %i") ("\\.pax\\'" . "pax -wf %o %i")) - "Control the compression shell command for `dired-do-compress-to'. + "Controls the compression shell command for `dired-do-compress-to'. Each element is (REGEXP . CMD), where REGEXP is the name of the archive to which you want to compress, and CMD is the @@ -1275,37 +1301,62 @@ Return nil if no change in files." ;; Try gzip; if we don't have that, use compress. (condition-case nil (if (file-directory-p file) - (progn - (setq suffix (cdr (assoc "\000" dired-compress-file-suffixes))) - (when suffix - (let ((out-name (concat file (car suffix))) - (default-directory (file-name-directory file))) - (dired-shell-command - (replace-regexp-in-string - "%o" (shell-quote-argument out-name) + (let* ((suffix + (or dired-compress-directory-default-suffix + ".tar.gz")) + (rule (cl-find-if + (lambda (x) (string-match-p (car x) suffix)) + dired-compress-files-alist))) + (if rule + (let ((out-name (concat file suffix)) + (default-directory (file-name-directory file))) + (dired-shell-command + (replace-regexp-in-string + "%o" (shell-quote-argument out-name) + (replace-regexp-in-string + "%i" (shell-quote-argument + (file-name-nondirectory file)) + (cdr rule) + nil t) + nil t)) + out-name) + (user-error + "No compression rule found for \ +`dired-compress-directory-default-suffix' %s, see `dired-compress-files-alist' for\ + the supported suffixes list." + dired-compress-directory-default-suffix))) + (let* ((suffix (or dired-compress-file-default-suffix ".gz")) + (out-name (concat file suffix)) + (rule (cl-find-if + (lambda (x) (string-match-p (car x) suffix)) + dired-compress-file-alist))) + (if (not rule) + (user-error "No compression rule found for suffix %s, \ +see `dired-compress-file-alist' for the supported suffixes list." + dired-compress-file-default-suffix) + (and (or (not (file-exists-p out-name)) + (y-or-n-p + (format + "File %s already exists. Really compress? " + out-name))) + (dired-shell-command (replace-regexp-in-string - "%i" (shell-quote-argument (file-name-nondirectory file)) - (cadr suffix) - nil t) - nil t)) - out-name))) - (let ((out-name (concat file ".gz"))) - (and (or (not (file-exists-p out-name)) - (y-or-n-p - (format "File %s already exists. Really compress? " - out-name))) - (not - (dired-check-process (concat "Compressing " file) - "gzip" "-f" file)) - (or (file-exists-p out-name) - (setq out-name (concat file ".z"))) - ;; Rename the compressed file to NEWNAME - ;; if it hasn't got that name already. - (if (and newname (not (equal newname out-name))) - (progn - (rename-file out-name newname t) - newname) - out-name)))) + "%o" (shell-quote-argument out-name) + (replace-regexp-in-string + "%i" (shell-quote-argument + (file-name-nondirectory file)) + (cdr rule) + nil t) + nil t)) + (or (file-exists-p out-name) + (setq out-name (concat file ".z"))) + ;; Rename the compressed file to NEWNAME + ;; if it hasn't got that name already. + (if (and newname (not (equal newname out-name))) + (progn + (rename-file out-name newname t) + newname) + out-name))))) (file-error (if (not (dired-check-process (concat "Compressing " file) "compress" "-f" file)) -- cgit v1.2.3 From 68f5718c0a4393391ce3c4179e8ab1430e5b0119 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 18 May 2021 17:49:05 +0200 Subject: Fix some regressions introduced by the previous dired-aux change * lisp/dired-aux.el (dired-compress-file): Check that the file we're compressing exists. Also work outside the current directory. --- lisp/dired-aux.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 2e4ff934590..eb43ab187d5 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1334,7 +1334,8 @@ Return nil if no change in files." (user-error "No compression rule found for suffix %s, \ see `dired-compress-file-alist' for the supported suffixes list." dired-compress-file-default-suffix) - (and (or (not (file-exists-p out-name)) + (and (file-exists-p file) + (or (not (file-exists-p out-name)) (y-or-n-p (format "File %s already exists. Really compress? " @@ -1343,8 +1344,7 @@ see `dired-compress-file-alist' for the supported suffixes list." (replace-regexp-in-string "%o" (shell-quote-argument out-name) (replace-regexp-in-string - "%i" (shell-quote-argument - (file-name-nondirectory file)) + "%i" (shell-quote-argument file) (cdr rule) nil t) nil t)) -- cgit v1.2.3 From e100ee84e358755c0dc8a449091bde28603970c6 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 19 May 2021 08:28:35 -0700 Subject: Fix custom type of recent dired-aux additions * lisp/dired-aux.el (dired-compress-file-default-suffix) (dired-compress-directory-default-suffix): Fix :type. --- lisp/dired-aux.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index eb43ab187d5..d57237f0383 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1169,7 +1169,7 @@ ARGS are command switches passed to PROGRAM.") (defcustom dired-compress-file-default-suffix nil "Default suffix for compressing a single file. If nil, \".gz\" will be used." - :type 'string + :type '(choice (const :tag ".gz" nil) string) :group 'dired :version "28.1") @@ -1190,7 +1190,7 @@ output file. %i path(s) are relative, while %o is absolute.") (defcustom dired-compress-directory-default-suffix nil "Default suffix for compressing a directory. If nil, \".tar.gz\" will be used." - :type 'string + :type '(choice (const :tag ".tar.gz" nil) string) :group 'dired :version "28.1") -- cgit v1.2.3 From 099caace34867a716224eeba5b9901373b06df28 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 21 May 2021 21:31:48 +0300 Subject: * lisp/dired-aux.el (dired-do-revert-buffer): New defcustom (bug#48456). (dired-do-create-files): Use it. --- etc/NEWS | 5 +++++ lisp/dired-aux.el | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'lisp/dired-aux.el') diff --git a/etc/NEWS b/etc/NEWS index 693d0c0026b..acd7899b750 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -748,6 +748,11 @@ If set to non-nil, Dired will dereference symbolic links when copying. This can be switched off on a per-usage basis by providing 'dired-do-copy' with a 'C-u' prefix. +*** New user option 'dired-do-revert-buffer'. +Non-nil reverts the destination Dired buffer after preforming one +of these operations: 'dired-do-copy', 'dired-do-rename', +'dired-do-symlink', 'dired-do-hardlink'. + *** New user option 'dired-mark-region' affects all Dired commands that mark files. When non-nil and the region is active in Transient Mark mode, then Dired commands operate only on files in the active diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d57237f0383..0ac4e54bafe 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2065,6 +2065,25 @@ ESC or `q' to not overwrite any of the remaining files, operation success-count)))) (dired-move-to-filename)) +(defcustom dired-do-revert-buffer nil + "Automatically revert Dired buffers after `dired-do' operations. +This option controls whether to refresh the directory listing in a +Dired buffer that is the destination of one of these operations: +`dired-do-copy', `dired-do-rename', `dired-do-symlink', `dired-do-hardlink'. +If the value is t, always revert the Dired buffer updated in the result +of these operations. +If the value is a function, it is called with the destination directory name +as a single argument, and the buffer is reverted after Dired operations +if the function returns non-nil." + :type '(choice + (const :tag "Don't revert" nil) + (const :tag "Always revert destination directory" t) + (const :tag "Revert only local Dired buffers" + (lambda (dir) (not (file-remote-p dir)))) + (function :tag "Predicate function")) + :group 'dired + :version "28.1") + (defun dired-do-create-files (op-symbol file-creator operation arg &optional marker-char op1 how-to) @@ -2168,7 +2187,12 @@ Optional arg HOW-TO determines how to treat the target. (lambda (from) (expand-file-name (file-name-nondirectory from) target)) (lambda (_from) target)) - marker-char)))) + marker-char) + (when (or (eq dired-do-revert-buffer t) + (and (functionp dired-do-revert-buffer) + (funcall dired-do-revert-buffer target))) + (dired-fun-in-all-buffers (file-name-directory target) nil + #'revert-buffer))))) ;; Read arguments for a marked-files command that wants a file name, ;; perhaps popping up the list of marked files. -- cgit v1.2.3 From fcb3990b8dfb564110c11295a0a7555f90f4fde9 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 25 May 2021 21:29:24 +0200 Subject: Restore `dired-do-create-files' return value * lisp/dired-aux.el (dired-do-create-files): Preserve the return value from `dired-create-files', which is apparently an undocumented feature used by dired-aux-tests.el (dired-test-bug30624). --- lisp/dired-aux.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 0ac4e54bafe..a1dda3f5a20 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2179,20 +2179,21 @@ Optional arg HOW-TO determines how to treat the target. (error "%s: Target directory does not exist: %s" operation target)) ;; rename-file bombs when moving directories unless we do this: (or into-dir (setq target (directory-file-name target))) - (dired-create-files - file-creator operation fn-list - (if into-dir ; target is a directory - ;; This function uses fluid variable target when called - ;; inside dired-create-files: - (lambda (from) - (expand-file-name (file-name-nondirectory from) target)) - (lambda (_from) target)) - marker-char) - (when (or (eq dired-do-revert-buffer t) - (and (functionp dired-do-revert-buffer) - (funcall dired-do-revert-buffer target))) - (dired-fun-in-all-buffers (file-name-directory target) nil - #'revert-buffer))))) + (prog1 + (dired-create-files + file-creator operation fn-list + (if into-dir ; target is a directory + ;; This function uses fluid variable target when called + ;; inside dired-create-files: + (lambda (from) + (expand-file-name (file-name-nondirectory from) target)) + (lambda (_from) target)) + marker-char) + (when (or (eq dired-do-revert-buffer t) + (and (functionp dired-do-revert-buffer) + (funcall dired-do-revert-buffer target))) + (dired-fun-in-all-buffers (file-name-directory target) nil + #'revert-buffer)))))) ;; Read arguments for a marked-files command that wants a file name, ;; perhaps popping up the list of marked files. -- cgit v1.2.3 From 7ea7e26ab1976b7534f7c573107adfa74defee22 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 2 Jun 2021 10:13:58 +0200 Subject: Move point in dired buffers when handling a list of files * lisp/dired-aux.el (dired-create-files): Advance point to the current file (bug#8015). --- lisp/dired-aux.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index a1dda3f5a20..3a721cd4d9d 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1963,6 +1963,9 @@ or with the current marker character if MARKER-CHAR is t." (let (to overwrite-query overwrite-backup-query) ; for dired-handle-overwrite (dolist (from fn-list) + ;; Position point on the current file -- this is useful if + ;; handling a number of files to show where we're working at. + (dired-goto-file from) (setq to (funcall name-constructor from)) (if (equal to from) (progn -- cgit v1.2.3 From b425966b072792b7b22b845b5f2e39ff4f60b5ab Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sat, 12 Jun 2021 14:45:53 +0200 Subject: Use file-in-directory-p instead of obsolete dired-in-this-tree-p * lisp/dired-aux.el (dired-rename-subdir,dired-rename-subdir-1) (dired-insert-subdir,dired-insert-subdir-validate) (dired-kill-tree,dired-tree-down): Use file-in-directory-p instead of obsolete dired-in-this-tree-p. --- lisp/dired-aux.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 3a721cd4d9d..54cfbbad034 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1859,7 +1859,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (while blist (with-current-buffer (car blist) (if (and buffer-file-name - (dired-in-this-tree-p buffer-file-name expanded-from-dir)) + (file-in-directory-p buffer-file-name expanded-from-dir)) (let ((modflag (buffer-modified-p)) (to-file (replace-regexp-in-string (concat "^" (regexp-quote from-dir)) @@ -1878,7 +1878,7 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (while alist (setq elt (car alist) alist (cdr alist)) - (if (dired-in-this-tree-p (car elt) expanded-dir) + (if (file-in-directory-p (car elt) expanded-dir) ;; ELT's subdir is affected by the rename (dired-rename-subdir-2 elt dir to))) (if (equal dir default-directory) @@ -2707,7 +2707,7 @@ This function takes some pains to conform to `ls -lR' output." (setq switches (string-replace "R" "" switches)) (dolist (cur-ass dired-subdir-alist) (let ((cur-dir (car cur-ass))) - (and (dired-in-this-tree-p cur-dir dirname) + (and (file-in-directory-p cur-dir dirname) (let ((cur-cons (assoc-string cur-dir dired-switches-alist))) (if cur-cons (setcdr cur-cons switches) @@ -2719,7 +2719,7 @@ This function takes some pains to conform to `ls -lR' output." (defun dired-insert-subdir-validate (dirname &optional switches) ;; Check that it is valid to insert DIRNAME with SWITCHES. ;; Signal an error if invalid (e.g. user typed `i' on `..'). - (or (dired-in-this-tree-p dirname (expand-file-name default-directory)) + (or (file-in-directory-p dirname (expand-file-name default-directory)) (error "%s: not in this directory tree" dirname)) (let ((real-switches (or switches dired-subdir-switches))) (when real-switches @@ -2760,7 +2760,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." (setq dir (car (car s-alist)) s-alist (cdr s-alist)) (and (or kill-root (not (string-equal dir dirname))) - (dired-in-this-tree-p dir dirname) + (file-in-directory-p dir dirname) (dired-goto-subdir dir) (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) m-alist)) @@ -2992,7 +2992,7 @@ Lower levels are unaffected." (while rest (setq elt (car rest) rest (cdr rest)) - (if (dired-in-this-tree-p (directory-file-name (car elt)) dir) + (if (file-in-directory-p (directory-file-name (car elt)) dir) (setq rest nil pos (dired-goto-subdir (car elt)))))) (if pos -- cgit v1.2.3 From 142962a8bd9e1e4e926183a9f68a426ada91cda0 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 22 Jun 2021 17:10:19 +0200 Subject: Give feedback to the user in dired-do-find-regexp * lisp/dired-aux.el (dired-do-find-regexp): Give some feedback to the user (bug#35352). --- lisp/dired-aux.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 54cfbbad034..d002d1fa907 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3208,10 +3208,12 @@ REGEXP should use constructs supported by your local `grep' command." files)) (push mark files))) (nreverse marks)) + (message "Searching...") (setq xrefs (xref-matches-in-files regexp files)) (unless xrefs (user-error "No matches for: %s" regexp)) + (message "Searching...done") xrefs)))) (xref--show-xrefs fetcher nil))) -- cgit v1.2.3 From 1b1c4ef3cba235a97c424da4bc7ccfafea5b4bf8 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Wed, 30 Jun 2021 20:10:30 +0200 Subject: Cleanup whitespace and comments in dired libraries * lisp/dired-aux.el: Cleanup whitespace and comments. * lisp/dired-x.el: Cleanup whitespace and comments. * lisp/dired.el: Cleanup whitespace and comments. --- lisp/dired-aux.el | 66 +++++++++++++++++++++++++-------------------------- lisp/dired-x.el | 68 ++++++++++++++++++++++++++-------------------------- lisp/dired.el | 71 ++++++++++++++++++++++++++----------------------------- 3 files changed, 101 insertions(+), 104 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d002d1fa907..73bceffbc2c 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -135,7 +135,7 @@ substituted, and will be passed through normally to the shell. %s -(Press ^ to %s markers below these occurrences.) +\(Press ^ to %s markers below these occurrences.) " "`" (string (aref command (car char-positions))) @@ -288,12 +288,12 @@ If this file is a backup, diff it with its original. The backup file is the first file given to `diff'. With prefix arg, prompt for argument SWITCHES which is options for `diff'." (interactive - (if current-prefix-arg - (list (read-string "Options for diff: " - (if (stringp diff-switches) - diff-switches - (mapconcat #'identity diff-switches " ")))) - nil)) + (if current-prefix-arg + (list (read-string "Options for diff: " + (if (stringp diff-switches) + diff-switches + (mapconcat #'identity diff-switches " ")))) + nil)) (diff-backup (dired-get-filename) switches)) ;;;###autoload @@ -636,7 +636,7 @@ Uses the shell command coming from variables `lpr-command' and (dired-run-shell-command (dired-shell-stuff-it command file-list nil)))) (defun dired-mark-read-string (prompt initial op-symbol arg files - &optional default-value collection) + &optional default-value collection) "Read args for a Dired marked-files command, prompting with PROMPT. Return the user input (a string). @@ -871,8 +871,8 @@ can be produced by `dired-get-marked-files', for example. `dired-guess-shell-alist-default' and `dired-guess-shell-alist-user' are consulted when the user is prompted for the shell command to use interactively." -;;Functions dired-run-shell-command and dired-shell-stuff-it do the -;;actual work and can be redefined for customization. + ;; Functions dired-run-shell-command and dired-shell-stuff-it do the + ;; actual work and can be redefined for customization. (interactive (let ((files (dired-get-marked-files t current-prefix-arg nil nil t))) (list @@ -914,13 +914,13 @@ prompted for the shell command to use interactively." "Separates marked files in dired shell commands.") (defun dired-shell-stuff-it (command file-list on-each &optional _raw-arg) -;; "Make up a shell command line from COMMAND and FILE-LIST. -;; If ON-EACH is t, COMMAND should be applied to each file, else -;; simply concat all files and apply COMMAND to this. -;; FILE-LIST's elements will be quoted for the shell." -;; Might be redefined for smarter things and could then use RAW-ARG -;; (coming from interactive P and currently ignored) to decide what to do. -;; Smart would be a way to access basename or extension of file names. + ;; "Make up a shell command line from COMMAND and FILE-LIST. + ;; If ON-EACH is t, COMMAND should be applied to each file, else + ;; simply concat all files and apply COMMAND to this. + ;; FILE-LIST's elements will be quoted for the shell." + ;; Might be redefined for smarter things and could then use RAW-ARG + ;; (coming from interactive P and currently ignored) to decide what to do. + ;; Smart would be a way to access basename or extension of file names. (let* ((in-background (string-match "[ \t]*&[ \t]*\\'" command)) (command (if in-background (substring command 0 (match-beginning 0)) @@ -1382,19 +1382,19 @@ see `dired-compress-file-alist' for the supported suffixes list." (dired-mark-prompt arg files) "? "))))) (defun dired-map-over-marks-check (fun arg op-symbol &optional show-progress) -; "Map FUN over marked files (with second ARG like in dired-map-over-marks) -; and display failures. + ;; "Map FUN over marked files (with second ARG like in dired-map-over-marks) + ;; and display failures. -; FUN takes zero args. It returns non-nil (the offending object, e.g. -; the short form of the filename) for a failure and probably logs a -; detailed error explanation using function `dired-log'. + ;; FUN takes zero args. It returns non-nil (the offending object, e.g. + ;; the short form of the filename) for a failure and probably logs a + ;; detailed error explanation using function `dired-log'. -; OP-SYMBOL is a symbol describing the operation performed (e.g. -; `compress'). It is used with `dired-mark-pop-up' to prompt the user -; (e.g. with `Compress * [2 files]? ') and to display errors (e.g. -; `Failed to compress 1 of 2 files - type W to see why ("foo")') + ;; OP-SYMBOL is a symbol describing the operation performed (e.g. + ;; `compress'). It is used with `dired-mark-pop-up' to prompt the user + ;; (e.g. with `Compress * [2 files]? ') and to display errors (e.g. + ;; `Failed to compress 1 of 2 files - type W to see why ("foo")') -; SHOW-PROGRESS if non-nil means redisplay dired after each file." + ;; SHOW-PROGRESS if non-nil means redisplay dired after each file." (if (dired-mark-confirm op-symbol arg) (let* ((total-list;; all of FUN's return values (dired-map-over-marks (funcall fun) arg show-progress)) @@ -1486,7 +1486,7 @@ uncompress and unpack all the files in the archive." ;; Return nil for success, offending file name else. (let ((file (dired-get-filename)) failure) (condition-case err - (load file nil nil t) + (load file nil nil t) (error (setq failure err))) (if (not failure) nil @@ -1700,7 +1700,7 @@ files matching `dired-omit-regexp'." (forward-line 1) (while (and (not (eolp)) ; don't cross subdir boundary (not (dired-move-to-filename))) - (forward-line 1)) + (forward-line 1)) (point))) ;;;###autoload @@ -2415,7 +2415,7 @@ suggested for the target directory depends on the value of For relative symlinks, use \\[dired-do-relsymlink]." (interactive "P") (dired-do-create-files 'symlink #'make-symbolic-link - "Symlink" arg dired-keep-marker-symlink)) + "Symlink" arg dired-keep-marker-symlink)) ;;;###autoload (defun dired-do-hardlink (&optional arg) @@ -2428,7 +2428,7 @@ suggested for the target directory depends on the value of `dired-dwim-target', which see." (interactive "P") (dired-do-create-files 'hardlink #'dired-hardlink - "Hardlink" arg dired-keep-marker-hardlink)) + "Hardlink" arg dired-keep-marker-hardlink)) (defun dired-hardlink (file newname &optional ok-if-already-exists) (dired-handle-overwrite newname) @@ -2455,7 +2455,7 @@ of `dired-dwim-target', which see." (defvar rename-regexp-query) (defun dired-do-create-files-regexp - (file-creator operation arg regexp newname &optional whole-name marker-char) + (file-creator operation arg regexp newname &optional whole-name marker-char) ;; Create a new file for each marked file using regexps. ;; FILE-CREATOR and OPERATION as in dired-create-files. ;; ARG as in dired-get-marked-files. @@ -2575,7 +2575,7 @@ See function `dired-do-rename-regexp' for more info." (defvar rename-non-directory-query) (defun dired-create-files-non-directory - (file-creator basename-constructor operation arg) + (file-creator basename-constructor operation arg) ;; Perform FILE-CREATOR on the non-directory part of marked files ;; using function BASENAME-CONSTRUCTOR, with query for each file. ;; OPERATION like in dired-create-files, ARG as in dired-get-marked-files. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 6619a391673..38a624fa72b 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -623,7 +623,7 @@ you can relist single subdirs using \\[dired-do-redisplay]." (and (looking-at "^ wildcard ") (buffer-substring (match-end 0) (line-end-position)))))) - (if wildcard + (if wildcard (setq dirname (expand-file-name wildcard default-directory)))) ;; If raw ls listing (not a saved old dired buffer), give it a ;; decent subdir headerline: @@ -723,27 +723,27 @@ Also useful for `auto-mode-alist' like this: ;;; GUESS SHELL COMMAND. ;; Brief Description: -;;; +;; ;; * `dired-do-shell-command' is bound to `!' by dired.el. -;;; +;; ;; * `dired-guess-shell-command' provides smarter defaults for -;;; dired-aux.el's `dired-read-shell-command'. -;;; +;; dired-aux.el's `dired-read-shell-command'. +;; ;; * `dired-guess-shell-command' calls `dired-guess-default' with list of -;;; marked files. -;;; +;; marked files. +;; ;; * Parse `dired-guess-shell-alist-user' and -;;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP -;;; that matches the first file in the file list. -;;; +;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP +;; that matches the first file in the file list. +;; ;; * If the REGEXP matches all the entries of the file list then evaluate -;;; COMMAND, which is either a string or a Lisp expression returning a -;;; string. COMMAND may be a list of commands. -;;; +;; COMMAND, which is either a string or a Lisp expression returning a +;; string. COMMAND may be a list of commands. +;; ;; * Return this command to `dired-guess-shell-command' which prompts user -;;; with it. The list of commands is put into the list of default values. -;;; If a command is used successfully then it is stored permanently in -;;; `dired-shell-command-history'. +;; with it. The list of commands is put into the list of default values. +;; If a command is used successfully then it is stored permanently in +;; `dired-shell-command-history'. ;; Guess what shell command to apply to a file. (defvar dired-shell-command-history nil @@ -1089,7 +1089,7 @@ results in ;;;###autoload (defun dired-do-relsymlink (&optional arg) - "Relative symlink all marked (or next ARG) files into a directory. + "Relative symlink all marked (or next ARG) files into a directory. Otherwise make a relative symbolic link to the current file. This creates relative symbolic links like @@ -1102,7 +1102,7 @@ not absolute ones like For absolute symlinks, use \\[dired-do-symlink]." (interactive "P") (dired-do-create-files 'relsymlink #'dired-make-relative-symlink - "RelSymLink" arg dired-keep-marker-relsymlink)) + "RelSymLink" arg dired-keep-marker-relsymlink)) (autoload 'dired-mark-read-regexp "dired-aux") (autoload 'dired-do-create-files-regexp "dired-aux") @@ -1120,27 +1120,27 @@ for more info." ;;; VISIT ALL MARKED FILES SIMULTANEOUSLY. ;; Brief Description: -;;; +;; ;; `dired-do-find-marked-files' is bound to `F' by dired-x.el. -;;; +;; ;; * Use `dired-get-marked-files' to collect the marked files in the current -;;; Dired Buffer into a list of filenames `FILE-LIST'. -;;; +;; Dired Buffer into a list of filenames `FILE-LIST'. +;; ;; * Pass FILE-LIST to `dired-simultaneous-find-file' all with -;;; `dired-do-find-marked-files''s prefix argument NOSELECT. -;;; +;; `dired-do-find-marked-files''s prefix argument NOSELECT. +;; ;; * `dired-simultaneous-find-file' runs through FILE-LIST decrementing the -;;; list each time. -;;; +;; list each time. +;; ;; * If NOSELECT is non-nil then just run `find-file-noselect' on each -;;; element of FILE-LIST. -;;; +;; element of FILE-LIST. +;; ;; * If NOSELECT is nil then calculate the `size' of the window for each file -;;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is -;;; cognizant of the window-configuration. -;;; +;; by dividing the `window-height' by length of FILE-LIST. Thus, `size' is +;; cognizant of the window-configuration. +;; ;; * If `size' is too small abort, otherwise run `find-file' on each element -;;; of FILE-LIST giving each a window of height `size'. +;; of FILE-LIST giving each a window of height `size'. (defun dired-do-find-marked-files (&optional noselect) "Find all marked files displaying all of them simultaneously. @@ -1196,8 +1196,8 @@ NOSELECT the files are merely found but not selected." (defun dired-man () "Run `man' on this file." -;; Used also to say: "Display old buffer if buffer name matches filename." -;; but I have no idea what that means. + ;; Used also to say: "Display old buffer if buffer name matches filename." + ;; but I have no idea what that means. (interactive) (require 'man) (let* ((file (dired-get-filename)) diff --git a/lisp/dired.el b/lisp/dired.el index bb428e21983..1f9037180dc 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -53,7 +53,6 @@ :prefix "dired-" :group 'dired) - ;;;###autoload (defcustom dired-listing-switches (purecopy "-al") "Switches passed to `ls' for Dired. MUST contain the `l' option. @@ -78,9 +77,9 @@ some of the `ls' switches are not supported; see the doc string of (defcustom dired-subdir-switches nil "If non-nil, switches passed to `ls' for inserting subdirectories. If nil, `dired-listing-switches' is used." - :group 'dired - :type '(choice (const :tag "Use dired-listing-switches" nil) - (string :tag "Switches"))) + :group 'dired + :type '(choice (const :tag "Use dired-listing-switches" nil) + (string :tag "Switches"))) (defcustom dired-maybe-use-globstar nil "If non-nil, enable globstar if the shell supports it. @@ -144,8 +143,8 @@ For more details, see Info node `(emacs)ls in Lisp'." (defcustom dired-touch-program "touch" "Name of touch command (usually `touch')." - :group 'dired - :type 'file) + :group 'dired + :type 'file) (defcustom dired-ls-F-marks-symlinks nil "Informs Dired about how `ls -lF' marks symbolic links. @@ -220,7 +219,7 @@ or the most recently used window with a Dired buffer, or to use any other function. When the value is a function, it will be called with no arguments and is expected to return a list of directories which will be used as defaults (i.e. default target and \"future history\") -(though, `dired-dwim-target-defaults' might modify it a bit). +\(though, `dired-dwim-target-defaults' might modify it a bit). The value t prefers the next windows on the same frame. The target is used in the prompt for file copy, rename etc." @@ -247,9 +246,9 @@ The target is used in the prompt for file copy, rename etc." This is similar to the \"-L\" option for the \"cp\" shell command." :type 'boolean :group 'dired) - ; -; These variables were deleted and the replacements are on files.el. -; We leave aliases behind for back-compatibility. + +;; These variables were deleted and the replacements are on files.el. +;; We leave aliases behind for back-compatibility. (define-obsolete-variable-alias 'dired-free-space-program 'directory-free-space-program "27.1") (define-obsolete-variable-alias 'dired-free-space-args @@ -376,8 +375,8 @@ This is what the do-commands look for, and what the mark-commands store.") "Character used to flag files for deletion.") (defvar dired-shrink-to-fit t -;; I see no reason ever to make this nil -- rms. -;; (> baud-rate search-slow-speed) + ;; I see no reason ever to make this nil -- rms. + ;; (> baud-rate search-slow-speed) "Non-nil means Dired shrinks the display buffer to fit the marked files.") (make-obsolete-variable 'dired-shrink-to-fit "use the Customization interface to add a new rule @@ -425,7 +424,7 @@ The directory name must be absolute, but need not be fully expanded.") "[bcsp][^:]")) (defvar dired-re-exe;; match ls permission string of an executable file (mapconcat (lambda (x) - (concat dired-re-maybe-mark dired-re-inode-size x)) + (concat dired-re-maybe-mark dired-re-inode-size x)) '("-[-r][-w][xs][-r][-w].[-r][-w]." "-[-r][-w].[-r][-w][xs][-r][-w]." "-[-r][-w].[-r][-w].[-r][-w][xst]") @@ -684,7 +683,7 @@ Subexpression 2 must end right before the \\n.") ;; ;; Directory headers. (list dired-subdir-regexp '(1 dired-header-face)) -) + ) "Additional expressions to highlight in Dired mode.") (defvar dnd-protocol-alist) @@ -1969,7 +1968,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ;; No need to do this, now that top-level items are fewer. ;;;; ;; Get rid of the Edit menu bar item to save space. - ;(define-key map [menu-bar edit] 'undefined) + ;;(define-key map [menu-bar edit] 'undefined) map) "Local keymap for Dired mode buffers.") @@ -2282,7 +2281,8 @@ Keybindings: "Summarize basic Dired commands and show recent Dired errors." (interactive) (dired-why) - ;>> this should check the key-bindings and use substitute-command-keys if non-standard + ;; FIXME this should check the key-bindings and use + ;; substitute-command-keys if non-standard (message "d-elete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, h-elp")) @@ -2581,7 +2581,7 @@ Otherwise, an error occurs in these cases." (concat (dired-current-directory localp) file))))) (defun dired-string-replace-match (regexp string newtext - &optional literal global) + &optional literal global) "Replace first match of REGEXP in STRING with NEWTEXT. If it does not match, nil is returned instead of the new string. Optional arg LITERAL means to take NEWTEXT literally. @@ -2592,7 +2592,7 @@ Optional arg GLOBAL means to replace all matches." (let ((from-end (- (length string) (match-end 0)))) (setq ret (setq string (replace-match newtext t literal string))) (setq start (- (length string) from-end)))) - ret) + ret) (if (not (string-match regexp string 0)) nil (replace-match newtext t literal string)))) @@ -2776,9 +2776,9 @@ If EOL, it should be an position to use instead of (or no-error (not (eq opoint (point))) (error "%s" (if hidden - (substitute-command-keys - "File line is hidden, type \\[dired-hide-subdir] to unhide") - "No file on this line"))) + (substitute-command-keys + "File line is hidden, type \\[dired-hide-subdir] to unhide") + "No file on this line"))) (if (eq opoint (point)) nil (point))))) @@ -2887,8 +2887,6 @@ dired-buffers." (substring pattern matched-in-pattern)) "\\'"))) - - (defun dired-advertise () ;;"Advertise in variable `dired-buffers' that we dired `default-directory'." ;; With wildcards we actually advertise too much. @@ -2936,8 +2934,8 @@ dired-buffers." (beginning-of-line) ; alist stores b-o-l positions (and (zerop (- (point) (cdr (assoc cur-dir - dired-subdir-alist)))) - cur-dir)))) + dired-subdir-alist)))) + cur-dir)))) (define-obsolete-function-alias 'dired-get-subdir-min 'cdr "27.1") @@ -3046,11 +3044,11 @@ instead of `dired-actual-switches'." new-dir-name) (setq new-dir-name res))) (dired-alist-add-1 new-dir-name - ;; Place a sub directory boundary between lines. - (save-excursion - (goto-char (match-beginning 0)) - (beginning-of-line) - (point-marker))))) + ;; Place a sub directory boundary between lines. + (save-excursion + (goto-char (match-beginning 0)) + (beginning-of-line) + (point-marker))))) (if (and (> count 1) (called-interactively-p 'interactive)) (message "Buffer includes %d directories" count))) ;; We don't need to sort it because it is in buffer order per @@ -3378,7 +3376,7 @@ non-empty directories is allowed." (defun dired-fun-in-all-buffers (directory file fun &rest args) "In all buffers dired'ing DIRECTORY, run FUN with ARGS. If the buffer has a wildcard pattern, check that it matches FILE. -(FILE does not include a directory component.) +\(FILE does not include a directory component.) FILE may be nil, in which case ignore it. Return list of buffers where FUN succeeded (i.e., returned non-nil)." (let (success-list) @@ -3860,8 +3858,7 @@ since it was last visited." (with-temp-buffer (insert-file-contents fn) (goto-char (point-min)) - (re-search-forward regexp nil t)))) - ))) + (re-search-forward regexp nil t))))))) "matching file"))) (defun dired-flag-files-regexp (regexp) @@ -4406,10 +4403,10 @@ Ask means pop up a menu for the user to select one of copy, move or link." (desktop-file-name dired-directory dirname)) ;; Subdirectories in `dired-subdir-alist'. (cdr - (nreverse - (mapcar - (lambda (f) (desktop-file-name (car f) dirname)) - dired-subdir-alist))))) + (nreverse + (mapcar + (lambda (f) (desktop-file-name (car f) dirname)) + dired-subdir-alist))))) (defun dired-restore-desktop-buffer (_file-name _buffer-name -- cgit v1.2.3 From 1a00bf16a72b03c9d79ec3bd301d02efc94f9683 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 14 Mar 2021 20:24:07 +0100 Subject: Improve consistency of outline headings in dired libraries * lisp/dired-aux.el: Improve consistency of outline headings. * lisp/dired-x.el: Improve consistency of outline headings. * lisp/dired.el: Improve consistency of outline headings. - Use three semicolons at beginning of headings because that already is the dominant number of semicolons for headings in these files. - Prefix each heading with a ^L instead of randomly omitting it in front of some. - Always prefix the line with the ^L with a completely empty line. - Begin headings with a capital letter. - Do not update complete headings. - Do not end headings with a period. - Remove a handful of section end markers. - Address further inconsistencies. --- lisp/dired-aux.el | 59 ++++++++++++++++++++++++------------------ lisp/dired-x.el | 39 ++++++++++++++++------------ lisp/dired.el | 77 ++++++++++++++++++++++++++++++++++++------------------- 3 files changed, 106 insertions(+), 69 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 73bceffbc2c..060f3a84111 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -33,6 +33,7 @@ ;; sorting by Sebastian Kremer . ;; Finished up by rms in 1992. + ;;; Code: (require 'cl-lib) @@ -45,9 +46,8 @@ Functions that operate recursively can store additional names into this list; they also should call `dired-log' to log the errors.") -;;; 15K -;;;###begin dired-cmd.el -;; Diffing and compressing + +;;; Diffing and compressing (defconst dired-star-subst-regexp "\\(^\\|[ \t]\\)\\*\\([ \t]\\|$\\)") (defconst dired-quark-subst-regexp "\\(^\\|[ \t]\\)\\?\\([ \t]\\|$\\)") @@ -418,6 +418,7 @@ List has a form of (file-name full-file-name (attribute-list))." full-file-name (file-attributes full-file-name)))) (directory-files dir))) + ;;; Change file attributes @@ -655,8 +656,9 @@ passed as the second arg to `completing-read'." 'completing-read (format prompt (dired-mark-prompt arg files)) collection nil nil initial nil default-value nil)) + -;;; Cleaning a directory: flagging some backups for deletion. +;;; Cleaning a directory: flagging some backups for deletion (defvar dired-file-version-alist) @@ -699,7 +701,8 @@ with a prefix argument." (dired-map-dired-file-lines #'dired-trample-file-versions) (message "Cleaning numerical backups...done"))) -;;; Subroutines of dired-clean-directory. + +;;; Subroutines of dired-clean-directory (defun dired-map-dired-file-lines (fun) ;; Perform FUN with point at the end of each non-directory line. @@ -750,6 +753,7 @@ with a prefix argument." (progn (beginning-of-line) (delete-char 1) (insert dired-del-marker))))) + ;;; Shell commands @@ -986,8 +990,8 @@ prompted for the shell command to use interactively." (shell-command command))) ;; Return nil for sake of nconc in dired-bunch-files. nil) - + (defun dired-check-process (msg program &rest arguments) "Display MSG while running PROGRAM, and check for output. Remaining arguments are strings passed as command arguments to PROGRAM. @@ -1032,8 +1036,9 @@ Return the result of `process-file' - zero for success." (unless (zerop res) (pop-to-buffer out-buffer)) res)))) + -;; Commands that delete or redisplay part of the dired buffer. +;;; Commands that delete or redisplay part of the dired buffer (defun dired-kill-line (&optional arg) "Kill the current line (not the files). @@ -1098,10 +1103,8 @@ present. A FMT of \"\" will suppress the messaging." (message (or fmt "Killed %d line%s.") count (dired-plural-s count))) count)))) -;;;###end dired-cmd.el -;;; 30K -;;;###begin dired-cp.el +;;; Compression (defun dired-compress () ;; Compress or uncompress the current file. @@ -1454,7 +1457,8 @@ uncompress and unpack all the files in the archive." (interactive "P") (dired-map-over-marks-check #'dired-compress arg 'compress t)) -;; Commands for Emacs Lisp files - load and byte compile + +;;; Commands for Emacs Lisp files - load and byte compile (defun dired-byte-compile () ;; Return nil for success, offending file name else. @@ -1546,6 +1550,7 @@ See Info node `(emacs)Subdir switches' for more details." (interactive) (setq dired-switches-alist nil) (revert-buffer)) + (defun dired-update-file-line (file) ;; Delete the current line, and insert an entry for FILE. @@ -1734,6 +1739,7 @@ See `dired-delete-file' in case you wish that." (line-beginning-position 2))) (setq file (directory-file-name file)) (dired-add-entry file (if (eq ?\s marker) nil marker))))) + ;;; Copy, move/rename, making hard and symbolic links @@ -1933,7 +1939,9 @@ unless OK-IF-ALREADY-EXISTS is non-nil." (defvar overwrite-query) (defvar overwrite-backup-query) -;; The basic function for half a dozen variations on cp/mv/ln/ln -s. + +;;; The basic function for half a dozen variations on cp/mv/ln/ln -s + (defun dired-create-files (file-creator operation fn-list name-constructor &optional marker-char) "Create one or more new files from a list of existing files FN-LIST. @@ -2067,6 +2075,7 @@ ESC or `q' to not overwrite any of the remaining files, success-count) operation success-count)))) (dired-move-to-filename)) + (defcustom dired-do-revert-buffer nil "Automatically revert Dired buffers after `dired-do' operations. @@ -2299,7 +2308,6 @@ Optional arg HOW-TO determines how to treat the target. dired-dirs))) - ;; We use this function in `dired-create-directory' and ;; `dired-create-empty-file'; the return value is the new entry ;; in the updated Dired buffer. @@ -2448,10 +2456,10 @@ of `dired-dwim-target', which see." (interactive "P") (dired-do-create-files 'move #'dired-rename-file "Move" arg dired-keep-marker-rename "Rename")) -;;;###end dired-cp.el + -;;; 5K -;;;###begin dired-re.el +;;; Operate on files matched by regexp + (defvar rename-regexp-query) (defun dired-do-create-files-regexp @@ -2572,6 +2580,9 @@ See function `dired-do-rename-regexp' for more info." #'make-symbolic-link "SymLink" arg regexp newname whole-name dired-keep-marker-symlink)) + +;;; Change case of file names + (defvar rename-non-directory-query) (defun dired-create-files-non-directory @@ -2617,10 +2628,8 @@ Type SPC or `y' to %s one file, DEL or `n' to skip to next, (interactive "P") (dired-rename-non-directory #'downcase "Rename downcase" arg)) -;;;###end dired-re.el -;;; 13K -;;;###begin dired-ins.el +;;; Insert subdirectory ;;;###autoload (defun dired-maybe-insert-subdir (dirname &optional @@ -2894,8 +2903,9 @@ is always equal to STRING." (setq result (cons (substring str end) result))) (nreverse result))) + -;;; moving by subdirectories +;;; Moving by subdirectories ;;;###autoload (defun dired-prev-subdir (arg &optional no-error-if-not-found no-skip) @@ -2998,8 +3008,9 @@ Lower levels are unaffected." (if pos (goto-char pos) (error "At the bottom")))) + -;;; hiding +;;; Hiding ;;;###autoload (defun dired-hide-subdir (arg) @@ -3043,10 +3054,8 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory." (dired--hide start end)) (setq pos (cdr subdir))))))) ; prev dir gets current dir -;;;###end dired-ins.el - -;; Search only in file names in the Dired buffer. +;;; Search only in file names in the Dired buffer (defcustom dired-isearch-filenames nil "Non-nil to Isearch in file names only. @@ -3116,7 +3125,7 @@ is part of a file name (i.e., has the text property `dired-filename')." (isearch-forward-regexp nil t)) -;; Functions for searching in tags style among marked files. +;;; Functions for searching in tags style among marked files ;;;###autoload (defun dired-do-isearch () diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 38a624fa72b..8d99d1a21c6 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -44,7 +44,8 @@ ;; but maybe not if a dired-x function is being autoloaded. (require 'dired) -;;; User-defined variables. + +;;; User-defined variables (defgroup dired-x nil "Extended directory editing (dired-x)." @@ -217,7 +218,9 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." :type 'boolean :group 'dired-x) -;;; KEY BINDINGS. + +;;; Key bindings + (when (keymapp (lookup-key dired-mode-map "*")) (define-key dired-mode-map "*(" 'dired-mark-sexp) (define-key dired-mode-map "*O" 'dired-mark-omitted) @@ -234,7 +237,8 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." (define-key dired-mode-map "Y" 'dired-do-relsymlink) (define-key dired-mode-map "V" 'dired-do-run-mail) -;;; MENU BINDINGS + +;;; Menu bindings (when-let ((menu (lookup-key dired-mode-map [menu-bar]))) (easy-menu-add-item menu '("Operate") @@ -274,7 +278,7 @@ files"] "Refresh")) -;; Install into appropriate hooks. +;;; Install into appropriate hooks (add-hook 'dired-mode-hook 'dired-extra-startup) (add-hook 'dired-after-readin-hook 'dired-omit-expunge) @@ -303,7 +307,7 @@ See also the functions: (dired-omit-startup)) -;;; EXTENSION MARKING FUNCTIONS. +;;; Extension marking functions (defun dired--mark-suffix-interactive-spec () (let* ((default @@ -432,7 +436,7 @@ See variables `dired-texinfo-unclean-extensions', (list ".dvi")))) -;;; OMITTING. +;;; Omitting ;; Enhanced omitting of lines from directory listings. ;; Marked files are never omitted. @@ -570,7 +574,7 @@ files in the active region if `dired-mark-region' is non-nil." msg))) -;;; VIRTUAL DIRED MODE. +;;; Virtual dired mode ;; For browsing `ls -lR' listings in a dired-like fashion. @@ -693,7 +697,7 @@ Also useful for `auto-mode-alist' like this: (dired-virtual (dired-virtual-guess-dir))) -;;; SMART SHELL. +;;; Smart shell ;; An Emacs buffer can have but one working directory, stored in the ;; buffer-local variable `default-directory'. A Dired buffer may have @@ -720,7 +724,7 @@ Also useful for `auto-mode-alist' like this: (shell-command command output-buffer error-buffer))) -;;; GUESS SHELL COMMAND. +;;; Guess shell command ;; Brief Description: ;; @@ -1028,7 +1032,7 @@ See `dired-guess-shell-alist-user'." (if (equal val "") default val)))) -;;; RELATIVE SYMBOLIC LINKS. +;;; Relative symbolic links (declare-function make-symbolic-link "fileio.c") @@ -1117,7 +1121,7 @@ for more info." "RelSymLink" arg regexp newname whole-name dired-keep-marker-relsymlink)) -;;; VISIT ALL MARKED FILES SIMULTANEOUSLY. +;;; Visit all marked files simultaneously ;; Brief Description: ;; @@ -1186,7 +1190,7 @@ NOSELECT the files are merely found but not selected." (find-file file))))) -;;; MISCELLANEOUS COMMANDS. +;;; Miscellaneous commands ;; Run man on files. @@ -1254,7 +1258,7 @@ otherwise." (dired-rmail))))) -;;; MISCELLANEOUS INTERNAL FUNCTIONS. +;;; Miscellaneous internal functions ;; This should be a builtin (defun dired-buffer-more-recently-used-p (buffer1 buffer2) @@ -1264,7 +1268,6 @@ Considers buffers closer to the car of `buffer-list' to be more recent." (memq buffer1 (buffer-list)) (not (memq buffer1 (memq buffer2 (buffer-list)))))) - ;; Needed if ls -lh is supported and also for GNU ls -ls. (defun dired-x--string-to-number (str) "Like `string-to-number' but recognize a trailing unit prefix. @@ -1437,7 +1440,7 @@ only in the active region if `dired-mark-region' is non-nil." (format "'%s file" predicate)))) -;;; FIND FILE AT POINT. +;;; Find file at point (defcustom dired-x-hands-off-my-keys t "Non-nil means don't remap `find-file' to `dired-x-find-file'. @@ -1484,7 +1487,8 @@ a prefix argument, when it offers the filename near point as a default." (interactive (list (dired-x-read-filename-at-point "Find file: "))) (find-file-other-window filename)) -;;; Internal functions. + +;;; Internal functions ;; Fixme: This should probably use `thing-at-point'. -- fx (define-obsolete-function-alias 'dired-filename-at-point @@ -1532,8 +1536,9 @@ If `current-prefix-arg' is non-nil, uses name at point as guess." (define-obsolete-function-alias 'read-filename-at-point 'dired-x-read-filename-at-point "24.1") ; is this even needed? + -;;; BUG REPORTS +;;; Epilog (define-obsolete-function-alias 'dired-x-submit-report 'report-emacs-bug "24.1") diff --git a/lisp/dired.el b/lisp/dired.el index 1f9037180dc..9ddd2c542dc 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -41,6 +41,7 @@ (declare-function dired-buffer-more-recently-used-p "dired-x" (buffer1 buffer2)) + ;;; Customizable variables (defgroup dired nil @@ -254,8 +255,6 @@ This is similar to the \"-L\" option for the \"cp\" shell command." (define-obsolete-variable-alias 'dired-free-space-args 'directory-free-space-args "27.1") -;;; Hook variables - (defcustom dired-load-hook nil "Run after loading Dired. You can customize key bindings or load extensions with this." @@ -357,7 +356,8 @@ is anywhere on its Dired line, except the beginning of the line." :group 'dired :version "28.1") -;; Internal variables + +;;; Internal variables (defvar dired-marker-char ?* ; the answer is 42 ;; so that you can write things like @@ -457,6 +457,9 @@ The match starts at the beginning of the line and ends after the end of the line. Subexpression 2 must end right before the \\n.") + +;;; Faces + (defgroup dired-faces nil "Faces used by Dired." :group 'dired @@ -560,6 +563,9 @@ Subexpression 2 must end right before the \\n.") (defvar dired-ignored-face 'dired-ignored "Face name used for files suffixed with `completion-ignored-extensions'.") + +;;; Font-lock + (defvar dired-font-lock-keywords (list ;; @@ -687,8 +693,11 @@ Subexpression 2 must end right before the \\n.") "Additional expressions to highlight in Dired mode.") (defvar dnd-protocol-alist) + -;;; Macros must be defined before they are used, for the byte compiler. +;;; Macros + +;; Macros must be defined before they are used, for the byte compiler. (defmacro dired-mark-if (predicate msg) "Mark files for PREDICATE, according to `dired-marker-char'. @@ -883,7 +892,7 @@ ERROR can be a string with the error message." (point-max))) -;; The dired command +;;; The dired command (defun dired-read-dir-and-switches (str) ;; For use in interactive. @@ -1263,7 +1272,7 @@ The return value is the target column for the file names." found))) -;; Read in a new dired buffer +;;; Read in a new dired buffer (defun dired-readin () "Read in a new Dired buffer. @@ -1627,8 +1636,9 @@ see `dired-use-ls-dired' for more details.") (put-text-property (+ (point) 4) (line-end-position) 'invisible 'dired-hide-details-link)))) (forward-line 1)))) + -;; Reverting a dired buffer +;;; Reverting a dired buffer (defun dired-revert (&optional _arg _noconfirm) "Reread the Dired buffer. @@ -1815,8 +1825,9 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (let ((handler (find-file-name-handler dir 'dired-uncache))) (if handler (funcall handler 'dired-uncache dir)))) + -;; dired mode key bindings and initialization +;;; Dired mode key bindings and menus (defvar dired-mode-map ;; This looks ugly when substitute-command-keys uses C-d instead d: @@ -2177,6 +2188,8 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." :help "Delete image tag from current or marked files"])) +;;; Dired mode + ;; Dired mode is suitable only for specially formatted data. (put 'dired-mode 'mode-class 'special) @@ -2274,8 +2287,9 @@ Keybindings: (add-hook 'file-name-at-point-functions #'dired-file-name-at-point nil t) (add-hook 'isearch-mode-hook #'dired-isearch-filenames-setup nil t) (run-mode-hooks 'dired-mode-hook)) + -;; Idiosyncratic dired commands that don't deal with marks. +;;; Idiosyncratic dired commands that don't deal with marks (defun dired-summary () "Summarize basic Dired commands and show recent Dired errors." @@ -2473,8 +2487,9 @@ Otherwise, display it in another buffer." (interactive) (display-buffer (find-file-noselect (dired-get-file-for-visit)) t)) + -;;; Functions for extracting and manipulating file names in Dired buffers. +;;; Functions for extracting and manipulating file names in Dired buffers (defun dired-unhide-subdir () (with-silent-modifications @@ -2619,7 +2634,10 @@ unchanged." (if (string-match (concat "^" (regexp-quote dir)) file) (substring file (match-end 0)) file)) + +;;; Mode to hide details + (define-minor-mode dired-hide-details-mode "Toggle visibility of detailed information in current Dired buffer. When this minor mode is enabled, details such as file ownership and @@ -2656,6 +2674,7 @@ See options: `dired-hide-details-hide-symlink-targets' and 'add-to-invisibility-spec 'remove-from-invisibility-spec) 'dired-hide-details-link)) + ;;; Functions to hide/unhide text @@ -2685,7 +2704,7 @@ See options: `dired-hide-details-hide-symlink-targets' and (progn (goto-char end) (line-end-position)) '(invisible)))) -;;; Functions for finding the file name in a dired buffer line. +;;; Functions for finding the file name in a dired buffer line (defvar dired-permission-flags-regexp "\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)" @@ -2784,7 +2803,7 @@ If EOL, it should be an position to use instead of (point))))) -;;; COPY NAMES OF MARKED FILES INTO KILL-RING. +;;; Copy names of marked files into kill-ring (defun dired-copy-filename-as-kill (&optional arg) "Copy names of marked (or next ARG) files into the kill ring. @@ -2818,7 +2837,7 @@ You can then feed the file name(s) to other commands with \\[yank]." (message "%s" string)))) -;; 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) "Return a list of buffers for DIR (top level or in-situ subdir). @@ -2904,10 +2923,9 @@ dired-buffers." ;; Removing is also done as a side-effect in dired-buffer-for-dir. (setq dired-buffers (delq (assoc (expand-file-name dir) dired-buffers) dired-buffers))) - -;; Tree Dired -;;; utility functions + +;;; Utility functions (defun dired-in-this-tree-p (file dir) ;;"Is FILE part of the directory tree starting at DIR?" @@ -3167,7 +3185,7 @@ It runs the hook `dired-initial-position-hook'." (dired-goto-subdir dirname)) (if dired-trivial-filenames (dired-goto-next-nontrivial-file)) (run-hooks 'dired-initial-position-hook)) - + ;; These are hooks which make tree dired work. ;; They are in this file because other parts of dired need to call them. ;; But they don't call the rest of tree dired unless there are subdirs loaded. @@ -3206,8 +3224,9 @@ is the directory where the file on this line resides." (if (or (null (cdr dired-subdir-alist)) (not (dired-next-subdir 1 t t))) (point-max) (point)))) + -;; Deleting files +;;; Deleting files (defcustom dired-recursive-deletes 'top "Whether Dired deletes directories recursively. @@ -3448,7 +3467,7 @@ confirmation. To disable the confirmation, see (kill-buffer buf)))))) -;; Confirmation +;;; Confirmation (defun dired-marker-regexp () (concat "^" (regexp-quote (char-to-string dired-marker-char)))) @@ -3567,8 +3586,9 @@ argument or confirmation)." (let ((beg (point))) (completion--insert-strings files) (put-text-property beg (point) 'mouse-face nil))) + -;; Commands to mark or flag file(s) at or near current line. +;;; Commands to mark or flag file(s) at or near current line (defun dired-repeat-over-lines (arg function) ;; This version skips non-file lines. @@ -3756,8 +3776,9 @@ on the whole buffer." (list ?\s dired-marker-char) (list dired-marker-char ?\s)))) (forward-line 1))))) + -;;; Commands to mark or flag files based on their characteristics or names. +;;; Commands to mark or flag files based on their characteristics or names (defvar dired-regexp-history nil "History list of regular expressions used in Dired commands.") @@ -4033,8 +4054,9 @@ Type SPC or `y' to unmark one file, DEL or `n' to skip to next, (message (if (= count 1) "1 mark removed" "%d marks removed") count)))) + -;; Logging failures operating on files, and showing the results. +;;; Logging failures operating on files, and showing the results (defvar dired-log-buffer "*Dired log*") @@ -4099,6 +4121,7 @@ or nil if file names are not applicable." ;; Log a summary describing a bunch of errors. (dired-log (concat "\n" string "\n")) (dired-log t)) + ;;; Sorting @@ -4280,9 +4303,9 @@ To be called first in body of `dired-sort-other', etc." ;; No pre-R subdir alist, so revert to main directory ;; listing: (list (car (reverse dired-subdir-alist)))))))) - -;;;; Drag and drop support + +;;; Drag and drop support (defcustom dired-recursive-copies 'top "Whether Dired copies directories recursively. @@ -4384,9 +4407,9 @@ Ask means pop up a menu for the user to select one of copy, move or link." (let ((local-file (dnd-get-local-file-uri uri))) (if local-file (dired-dnd-handle-local-file local-file action) nil))) - -;;;; Desktop support + +;;; Desktop support (eval-when-compile (require 'desktop)) (declare-function desktop-file-name "desktop" (filename dirname)) @@ -4432,7 +4455,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." '(dired-mode . dired-restore-desktop-buffer)) -;;;; Jump to Dired +;;; Jump to Dired (defvar archive-superior-buffer) (defvar tar-superior-buffer) -- cgit v1.2.3 From 051434fdefd6418bf1f0cd28c087b31cb3921f48 Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Sun, 8 Aug 2021 18:58:46 +0200 Subject: Use string-replace instead of replace-regexp-in-string `string-replace` is easier to understand, less error-prone, much faster, and results in shorter Lisp and byte code. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-scan-change-log): * lisp/autoinsert.el (auto-insert-alist): * lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent) (calc-edit-macro-combine-ext-command) (calc-edit-macro-combine-var-name): * lisp/calc/calc-units.el (math-make-unit-string): * lisp/calendar/cal-html.el (cal-html-comment): * lisp/calendar/cal-tex.el (cal-tex-comment): * lisp/calendar/icalendar.el (icalendar--convert-string-for-export) (icalendar--convert-string-for-import): * lisp/calendar/iso8601.el (iso8601--concat-regexps) (iso8601--full-time-match, iso8601--combined-match): * lisp/calendar/time-date.el (format-seconds): * lisp/calendar/todo-mode.el (todo-filter-items-filename): * lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name) (cedet-file-name-to-directory-name): * lisp/comint.el (comint-watch-for-password-prompt): * lisp/dired-aux.el (dired-do-chmod): * lisp/dired-x.el (dired-man): * lisp/dired.el (dired-insert-directory, dired-goto-file-1): * lisp/emacs-lisp/comp.el (comp-c-func-name): * lisp/emacs-lisp/re-builder.el (reb-copy): * lisp/erc/erc-dcc.el (erc-dcc-unquote-filename): * lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy) (erc-update-mode-line-buffer, erc-message-english-PART): * lisp/files.el (make-backup-file-name-1, files--transform-file-name) (read-file-modes): * lisp/fringe.el (fringe-mode): * lisp/gnus/gnus-art.el (gnus-button-handle-info-url): * lisp/gnus/gnus-group.el (gnus-group-completing-read): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-search.el (gnus-search-query-parse-date) (gnus-search-transform-expression, gnus-search-run-search): * lisp/gnus/gnus-start.el (gnus-dribble-enter): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-mode-string-quote): * lisp/gnus/message.el (message-put-addresses-in-ecomplete) (message-parse-mailto-url, message-mailto-1): * lisp/gnus/mml-sec.el (mml-secure-epg-sign): * lisp/gnus/mml-smime.el (mml-smime-epg-verify): * lisp/gnus/mml2015.el (mml2015-epg-verify): * lisp/gnus/nnmaildir.el (nnmaildir--system-name) (nnmaildir-request-list, nnmaildir-retrieve-groups) (nnmaildir-request-group, nnmaildir-retrieve-headers): * lisp/gnus/nnrss.el (nnrss-node-text): * lisp/gnus/spam-report.el (spam-report-gmane-internal) (spam-report-user-mail-address): * lisp/ibuffer.el (name): * lisp/image-dired.el (image-dired-pngnq-thumb) (image-dired-pngcrush-thumb, image-dired-optipng-thumb) (image-dired-create-thumb-1): * lisp/info.el (Info-set-mode-line): * lisp/international/mule-cmds.el (describe-language-environment): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rfc2368.el (rfc2368-parse-mailto-url): * lisp/mail/rmail.el (rmail-insert-inbox-text) (rmail-simplified-subject-regexp): * lisp/mail/rmailout.el (rmail-output-body-to-file): * lisp/mail/undigest.el (rmail-digest-rfc1153): * lisp/man.el (Man-default-man-entry): * lisp/mouse.el (minor-mode-menu-from-indicator): * lisp/mpc.el (mpc--debug): * lisp/net/browse-url.el (browse-url-mail): * lisp/net/eww.el (eww-update-header-line-format): * lisp/net/newst-backend.el (newsticker-save-item): * lisp/net/rcirc.el (rcirc-sentinel): * lisp/net/soap-client.el (soap-decode-date-time): * lisp/nxml/rng-cmpct.el (rng-c-literal-2-re): * lisp/nxml/xmltok.el (let*): * lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex) (nnir-run-find-grep): * lisp/play/dunnet.el (dun-doassign): * lisp/play/handwrite.el (handwrite): * lisp/proced.el (proced-format-args): * lisp/profiler.el (profiler-report-header-line-format): * lisp/progmodes/gdb-mi.el (gdb-mi-quote): * lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex) (makefile-make-font-lock-keywords): * lisp/progmodes/prolog.el (prolog-guess-fill-prefix): * lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes): * lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal): * lisp/progmodes/which-func.el (which-func-current): * lisp/replace.el (query-replace-read-from) (occur-engine, replace-quote): * lisp/select.el (xselect--encode-string): * lisp/ses.el (ses-export-tab): * lisp/subr.el (shell-quote-argument): * lisp/term/pc-win.el (msdos-show-help): * lisp/term/w32-win.el (w32--set-selection): * lisp/term/xterm.el (gui-backend-set-selection): * lisp/textmodes/picture.el (picture-tab-search): * lisp/thumbs.el (thumbs-call-setroot-command): * lisp/tooltip.el (tooltip-show-help-non-mode): * lisp/transient.el (transient-format-key): * lisp/url/url-mailto.el (url-mailto): * lisp/vc/log-edit.el (log-edit-changelog-ours-p): * lisp/vc/vc-bzr.el (vc-bzr-status): * lisp/vc/vc-hg.el (vc-hg--glob-to-pcre): * lisp/vc/vc-svn.el (vc-svn-after-dir-status): * lisp/xdg.el (xdg-desktop-strings): * test/lisp/electric-tests.el (defun): * test/lisp/term-tests.el (term-simple-lines): * test/lisp/time-stamp-tests.el (formatz-mod-del-colons): * test/lisp/wdired-tests.el (wdired-test-bug32173-01) (wdired-test-unfinished-edit-01): * test/src/json-tests.el (json-parse-with-custom-null-and-false-objects): Use `string-replace` instead of `replace-regexp-in-string`. --- admin/authors.el | 2 +- lisp/autoinsert.el | 4 ++-- lisp/calc/calc-prog.el | 8 ++++---- lisp/calc/calc-units.el | 2 +- lisp/calendar/cal-html.el | 2 +- lisp/calendar/cal-tex.el | 2 +- lisp/calendar/icalendar.el | 12 ++++++------ lisp/calendar/iso8601.el | 6 +++--- lisp/calendar/time-date.el | 2 +- lisp/calendar/todo-mode.el | 2 +- lisp/cedet/cedet-files.el | 4 ++-- lisp/comint.el | 2 +- lisp/dired-aux.el | 2 +- lisp/dired-x.el | 2 +- lisp/dired.el | 14 +++++++------- lisp/emacs-lisp/comp.el | 2 +- lisp/emacs-lisp/re-builder.el | 2 +- lisp/erc/erc-dcc.el | 4 ++-- lisp/erc/erc.el | 8 ++++---- lisp/files.el | 6 +++--- lisp/fringe.el | 2 +- lisp/gnus/gnus-art.el | 2 +- lisp/gnus/gnus-group.el | 2 +- lisp/gnus/gnus-icalendar.el | 8 ++++---- lisp/gnus/gnus-mlspl.el | 2 +- lisp/gnus/gnus-search.el | 10 +++++----- lisp/gnus/gnus-start.el | 2 +- lisp/gnus/gnus-sum.el | 2 +- lisp/gnus/gnus-util.el | 2 +- lisp/gnus/message.el | 8 ++++---- lisp/gnus/mml-sec.el | 2 +- lisp/gnus/mml-smime.el | 2 +- lisp/gnus/mml2015.el | 2 +- lisp/gnus/nnmaildir.el | 18 ++++++++---------- lisp/gnus/nnrss.el | 2 +- lisp/gnus/spam-report.el | 4 ++-- lisp/ibuffer.el | 2 +- lisp/image-dired.el | 8 ++++---- lisp/info.el | 4 ++-- lisp/international/mule-cmds.el | 2 +- lisp/mail/rfc2231.el | 2 +- lisp/mail/rfc2368.el | 2 +- lisp/mail/rmail.el | 4 ++-- lisp/mail/rmailout.el | 4 ++-- lisp/mail/undigest.el | 2 +- lisp/man.el | 2 +- lisp/mouse.el | 2 +- lisp/mpc.el | 4 ++-- lisp/net/browse-url.el | 2 +- lisp/net/eww.el | 2 +- lisp/net/newst-backend.el | 2 +- lisp/net/rcirc.el | 2 +- lisp/net/soap-client.el | 2 +- lisp/nxml/rng-cmpct.el | 2 +- lisp/nxml/xmltok.el | 2 +- lisp/obsolete/nnir.el | 12 ++++++------ lisp/play/dunnet.el | 2 +- lisp/play/handwrite.el | 2 +- lisp/proced.el | 2 +- lisp/profiler.el | 2 +- lisp/progmodes/gdb-mi.el | 2 +- lisp/progmodes/make-mode.el | 7 +++---- lisp/progmodes/prolog.el | 2 +- lisp/progmodes/ruby-mode.el | 4 ++-- lisp/progmodes/sql.el | 4 ++-- lisp/progmodes/which-func.el | 2 +- lisp/replace.el | 14 ++++++-------- lisp/select.el | 2 +- lisp/ses.el | 2 +- lisp/subr.el | 2 +- lisp/term/pc-win.el | 2 +- lisp/term/w32-win.el | 2 +- lisp/term/xterm.el | 5 ++--- lisp/textmodes/picture.el | 4 ++-- lisp/thumbs.el | 6 +++--- lisp/tooltip.el | 2 +- lisp/transient.el | 12 ++++++------ lisp/url/url-mailto.el | 2 +- lisp/vc/log-edit.el | 4 ++-- lisp/vc/vc-bzr.el | 2 +- lisp/vc/vc-hg.el | 4 ++-- lisp/vc/vc-svn.el | 2 +- lisp/xdg.el | 4 ++-- test/lisp/electric-tests.el | 2 +- test/lisp/term-tests.el | 2 +- test/lisp/time-stamp-tests.el | 2 +- test/lisp/wdired-tests.el | 4 ++-- test/src/json-tests.el | 2 +- 88 files changed, 164 insertions(+), 170 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/admin/authors.el b/admin/authors.el index 6c81c7872fc..a400b1327af 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1475,7 +1475,7 @@ Suggested\\|Trivial\\|Version\\|Originally\\|From:\\|Patch[ \t]+[Bb]y\\)"))) (when (string-match ":" line) (setq line (substring line 0 (match-beginning 0))) (setq line (replace-regexp-in-string "[[(<{].*$" "" line)) - (setq line (replace-regexp-in-string "," "" line)) + (setq line (string-replace "," "" line)) (dolist (file (split-string line)) (when (setq file (authors-canonical-file-name file log-file pos (car authors))) (dolist (author authors) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 0392903c332..995d9e2e0fe 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -93,8 +93,8 @@ If this contains a %s, that will be replaced by the matching rule." '((("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") (replace-regexp-in-string "[^A-Z0-9]" "_" - (replace-regexp-in-string - "\\+" "P" + (string-replace + "+" "P" (upcase (file-name-nondirectory buffer-file-name)))) "#ifndef " str \n "#define " str "\n\n" diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 4e27d7671e2..6f1e5c782df 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -802,8 +802,8 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string "SPC" " SPC " - (replace-regexp-in-string " " "" line))) + (setq line (string-replace "SPC" " SPC " + (string-replace " " "" line))) (insert line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) @@ -830,7 +830,7 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string " " "" line)) + (setq line (string-replace " " "" line)) (insert cmdbeg " " line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) @@ -857,7 +857,7 @@ (when match (kill-line 1) (setq line (concat line (substring curline 0 match)))) - (setq line (replace-regexp-in-string " " "" line)) + (setq line (string-replace " " "" line)) (insert line "\t\t\t") (if (> (current-column) 24) (delete-char -1)) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index c3adc3db02a..8b6f0637035 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -406,7 +406,7 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).") If EXPR is nil, return nil." (if expr (let ((cexpr (math-compose-expr expr 0))) - (replace-regexp-in-string + (string-replace " / " "/" (if (stringp cexpr) cexpr diff --git a/lisp/calendar/cal-html.el b/lisp/calendar/cal-html.el index e5810c3f027..58a5a0f83a5 100644 --- a/lisp/calendar/cal-html.el +++ b/lisp/calendar/cal-html.el @@ -151,7 +151,7 @@ (defun cal-html-comment (string) "Return STRING as html comment." (format "\n" - (replace-regexp-in-string "--" "++" string))) + (string-replace "--" "++" string))) (defun cal-html-href (link string) "Return a hyperlink to url LINK with text STRING." diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index f5932014dd9..3830024ef3d 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -1755,7 +1755,7 @@ current contents." COMMENT may contain newlines, which are prefixed by \"% \" in the output." (insert (format "%% %s\n" (if comment - (replace-regexp-in-string "\n" "\n% " comment) + (string-replace "\n" "\n% " comment) "")))) (defun cal-tex-banner (comment) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index d18ec5e798f..cf37331394c 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -998,15 +998,15 @@ TIMESTRING and has the same result as \"9:00\"." (defun icalendar--convert-string-for-export (string) "Escape comma and other critical characters in STRING." - (replace-regexp-in-string "," "\\\\," string)) + (string-replace "," "\\," string)) (defun icalendar--convert-string-for-import (string) "Remove escape chars for comma, semicolon etc. from STRING." - (replace-regexp-in-string - "\\\\n" "\n " (replace-regexp-in-string - "\\\\\"" "\"" (replace-regexp-in-string - "\\\\;" ";" (replace-regexp-in-string - "\\\\," "," string))))) + (string-replace + "\\n" "\n " (string-replace + "\\\"" "\"" (string-replace + "\\;" ";" (string-replace + "\\," "," string))))) ;; ====================================================================== ;; Export -- convert emacs-diary to iCalendar diff --git a/lisp/calendar/iso8601.el b/lisp/calendar/iso8601.el index f22f060e205..1de1796a054 100644 --- a/lisp/calendar/iso8601.el +++ b/lisp/calendar/iso8601.el @@ -57,7 +57,7 @@ (defun iso8601--concat-regexps (regexps) (mapconcat (lambda (regexp) (concat "\\(?:" - (replace-regexp-in-string "(" "(?:" regexp) + (string-replace "(" "(?:" regexp) "\\)")) regexps "\\|")) @@ -92,13 +92,13 @@ "\\(Z\\|\\([+-]\\)\\([0-9][0-9]\\):?\\([0-9][0-9]\\)?\\)") (defconst iso8601--full-time-match - (concat "\\(" (replace-regexp-in-string "(" "(?:" iso8601--time-match) "\\)" + (concat "\\(" (string-replace "(" "(?:" iso8601--time-match) "\\)" "\\(" iso8601--zone-match "\\)?")) (defconst iso8601--combined-match (concat "\\(" iso8601--date-match "\\)" "\\(?:T\\(" - (replace-regexp-in-string "(" "(?:" iso8601--time-match) + (string-replace "(" "(?:" iso8601--time-match) "\\)" "\\(" iso8601--zone-match "\\)?\\)?")) diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 1c169b78fd6..0aa38166bc1 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -357,7 +357,7 @@ is output until the first non-zero unit is encountered." (format " %s%s" name (if (= num 1) "" "s")))) t t string)))))) - (replace-regexp-in-string "%%" "%" string)) + (string-replace "%%" "%" string)) (defvar seconds-to-string (list (list 1 "ms" 0.001) diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 680beb85aff..371d10631c5 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -4546,7 +4546,7 @@ its priority has changed, and `same' otherwise." (let ((bufname (buffer-name))) (string-match "\"\\([^\"]+\\)\"" bufname) (let* ((filename-str (substring bufname (match-beginning 1) (match-end 1))) - (filename-base (replace-regexp-in-string ", " "-" filename-str)) + (filename-base (string-replace ", " "-" filename-str)) (top-priorities (string-match "top priorities" bufname)) (diary-items (string-match "diary items" bufname)) (regexp-items (string-match "regexp items" bufname))) diff --git a/lisp/cedet/cedet-files.el b/lisp/cedet/cedet-files.el index c9d557f5974..f540fb5540f 100644 --- a/lisp/cedet/cedet-files.el +++ b/lisp/cedet/cedet-files.el @@ -59,7 +59,7 @@ to the file's truename, and dodging platform tricks." ;; doubling `!'s in the original name... (setq file (subst-char-in-string ?/ ?! - (replace-regexp-in-string "!" "!!" file))) + (string-replace "!" "!!" file))) file)) (defun cedet-file-name-to-directory-name (referencefile &optional testmode) @@ -71,7 +71,7 @@ specific conversions during tests." ;; Replace the ! with / (setq file (subst-char-in-string ?! ?/ file)) ;; Occurrences of // meant there was once a single !. - (setq file (replace-regexp-in-string "//" "!" file)) + (setq file (string-replace "//" "!" file)) ;; Handle Windows special cases (when (or (memq system-type '(windows-nt ms-dos)) testmode) diff --git a/lisp/comint.el b/lisp/comint.el index 40f58f2da7b..7af8e8fd2a5 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -2439,7 +2439,7 @@ carriage returns (\\r) in STRING. This function could be in the list `comint-output-filter-functions'." (when (let ((case-fold-search t)) (string-match comint-password-prompt-regexp - (replace-regexp-in-string "\r" "" string))) + (string-replace "\r" "" string))) (let ((comint--prompt-recursion-depth (1+ comint--prompt-recursion-depth))) (if (> comint--prompt-recursion-depth 10) (message "Password prompt recursion too deep") diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 060f3a84111..72969dd96e2 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -508,7 +508,7 @@ has no effect on MS-Windows." (default (and (stringp modestr) (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr) - (replace-regexp-in-string + (string-replace "-" "" (format "u=%s,g=%s,o=%s" (match-string 1 modestr) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index a7bfae759ed..a990bd3fec3 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1193,7 +1193,7 @@ NOSELECT the files are merely found but not selected." (interactive) (require 'man) (let* ((file (dired-get-filename)) - (manual-program (replace-regexp-in-string "\\*" "%s" + (manual-program (string-replace "*" "%s" (dired-guess-shell-command "Man command: " (list file))))) (Man-getpage-in-background file))) diff --git a/lisp/dired.el b/lisp/dired.el index 28448be06ce..e577df510ad 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1587,8 +1587,8 @@ see `dired-use-ls-dired' for more details.") ;; because newlines in dirnames are uncommon, and people may ;; have gotten used to seeing unescaped "\" in the headers. ;; Note: adjust dired-build-subdir-alist if you change this. - (setq dir (replace-regexp-in-string "\\\\" "\\\\" dir nil t) - dir (replace-regexp-in-string "\n" "\\n" dir nil t))) + (setq dir (string-replace "\\" "\\\\" dir) + dir (string-replace "\n" "\\n" dir))) ;; If we used --dired and it worked, the lines are already indented. ;; Otherwise, indent them. (unless (save-excursion @@ -3167,15 +3167,15 @@ the quoted forms of those characters. FULL-NAME specifies the actual file name the listing must have, as returned by `dired-get-filename'. LIMIT is the search limit." (let (str) - (setq str (replace-regexp-in-string "\^m" "\\^m" file nil t)) - (setq str (replace-regexp-in-string "\\\\" "\\\\" str nil t)) + (setq str (string-replace "\^m" "\\^m" file)) + (setq str (string-replace "\\" "\\\\" str)) (and (dired-switches-escape-p dired-actual-switches) (string-match-p "[ \t\n]" str) ;; FIXME: to fix this for embedded control characters etc, we ;; should escape everything that `ls -b' does. - (setq str (replace-regexp-in-string " " "\\ " str nil t) - str (replace-regexp-in-string "\t" "\\t" str nil t) - str (replace-regexp-in-string "\n" "\\n" str nil t))) + (setq str (string-replace " " "\\ " str) + str (string-replace "\t" "\\t" str) + str (string-replace "\n" "\\n" str))) (let ((found nil) ;; filenames are preceded by SPC, this makes the search faster ;; (e.g. for the filename "-"). diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index a04413b6f00..ed75bf2bfa9 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1171,7 +1171,7 @@ clashes." do (aset str j (aref byte 0)) (aset str (1+ j) (aref byte 1)) finally return str)) - (human-readable (replace-regexp-in-string + (human-readable (string-replace "-" "_" orig-name)) (human-readable (replace-regexp-in-string (rx (not (any "0-9a-z_"))) "" human-readable))) diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 396949d59a2..aec438ed994 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -436,7 +436,7 @@ provided in the Commentary section of this library." (let ((re (with-output-to-string (print (reb-target-binding reb-regexp))))) (setq re (substring re 1 (1- (length re)))) - (setq re (replace-regexp-in-string "\n" "\\n" re nil t)) + (setq re (string-replace "\n" "\\n" re)) (kill-new re) (message "Copied regexp `%s' to kill-ring" re))) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 219af3741fa..fcdb8df2032 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -630,8 +630,8 @@ that subcommand." (define-inline erc-dcc-unquote-filename (filename) (inline-quote - (replace-regexp-in-string "\\\\\\\\" "\\" - (replace-regexp-in-string "\\\\\"" "\"" ,filename t t) t t))) + (string-replace "\\\\" "\\" + (string-replace "\\\"" "\"" ,filename)))) (defun erc-dcc-handle-ctcp-send (proc query nick login host to) "This is called if a CTCP DCC SEND subcommand is sent to the client. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 026c6f84164..c66b03d2e4e 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3597,7 +3597,7 @@ If S is non-nil, it will be used as the quit reason." If S is non-nil, it will be used as the quit reason." (or s (if (fboundp 'yow) - (replace-regexp-in-string "\n" "" (yow)) + (string-replace "\n" "" (yow)) (erc-quit/part-reason-default)))) (make-obsolete 'erc-quit-reason-zippy "it will be removed." "24.4") @@ -3624,7 +3624,7 @@ If S is non-nil, it will be used as the part reason." If S is non-nil, it will be used as the quit reason." (or s (if (fboundp 'yow) - (replace-regexp-in-string "\n" "" (yow)) + (string-replace "\n" "" (yow)) (erc-quit/part-reason-default)))) (make-obsolete 'erc-part-reason-zippy "it will be removed." "24.4") @@ -6528,7 +6528,7 @@ if `erc-away' is non-nil." (fill-region (point-min) (point-max)) (buffer-string)))) (setq header-line-format - (replace-regexp-in-string + (string-replace "%" "%%" (if face @@ -6804,7 +6804,7 @@ functions." nick user host channel (if (not (string= reason "")) (format ": %s" - (replace-regexp-in-string "%" "%%" reason)) + (string-replace "%" "%%" reason)) ""))))) diff --git a/lisp/files.el b/lisp/files.el index 89ee13eb686..54d0b919e1d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5201,7 +5201,7 @@ The function `find-backup-file-name' also uses this." (expand-file-name (subst-char-in-string ?/ ?! - (replace-regexp-in-string "!" "!!" file)) + (string-replace "!" "!!" file)) backup-directory)) (expand-file-name (file-name-nondirectory file) (file-name-as-directory abs-backup-directory)))))) @@ -6876,7 +6876,7 @@ the resulting file name, and SUFFIX is appended." (file-name-directory result) (subst-char-in-string ?/ ?! - (replace-regexp-in-string + (string-replace "!" "!!" filename)))) (t result)))) (setq result @@ -7989,7 +7989,7 @@ based on existing mode bits, as in \"og+rX-w\"." (default (and (stringp modestr) (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr) - (replace-regexp-in-string + (string-replace "-" "" (format "u=%s,g=%s,o=%s" (match-string 1 modestr) diff --git a/lisp/fringe.el b/lisp/fringe.el index d73aae0459e..82cfacc6b6f 100644 --- a/lisp/fringe.el +++ b/lisp/fringe.el @@ -189,7 +189,7 @@ fringes." :type `(choice ,@ (mapcar (lambda (style) (let ((name - (replace-regexp-in-string "-" " " (car style)))) + (string-replace "-" " " (car style)))) `(const :tag ,(concat (capitalize (substring name 0 1)) (substring name 1)) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index fb0295d0703..d65e75e44c2 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -8288,7 +8288,7 @@ url is put as the `gnus-button-url' overlay property on the button." ")" (gnus-url-unhex-string (match-string 2 url))))) ((string-match "([^)\"]+)[^\"]+" url) (setq url - (replace-regexp-in-string + (string-replace "\"" "" (replace-regexp-in-string "[\n\t ]+" " " url))) (gnus-info-find-node url)) (t (error "Can't parse %s" url)))) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 6202567344f..b1134397e55 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2186,7 +2186,7 @@ handle COLLECTION as a list, hash table, or vector." require-match initial-input (or hist 'gnus-group-history) def))) - (replace-regexp-in-string "\n" "" group))) + (string-replace "\n" "" group))) ;;;###autoload (defun gnus-fetch-group (group &optional articles) diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index 1b2743c1484..56f4fdf6d33 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -252,10 +252,10 @@ ;; ugly, but cannot get ;;replace-regexp-in-string work with "\\" as ;;REP, plus we should also handle "\\;" - (replace-regexp-in-string - "\\\\," "," - (replace-regexp-in-string - "\\\\n" "\n" (substring-no-properties value)))))) + (string-replace + "\\," "," + (string-replace + "\\n" "\n" (substring-no-properties value)))))) (accumulate-args (mapping) (cl-destructuring-bind (slot . ical-property) mapping diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el index d42f0971259..664027f0164 100644 --- a/lisp/gnus/gnus-mlspl.el +++ b/lisp/gnus/gnus-mlspl.el @@ -209,7 +209,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns: "\\)")) ;; Now create the new SPLIT (let ((split-regexp-with-list-ids - (replace-regexp-in-string "@" "[@.]" split-regexp t t)) + (string-replace "@" "[@.]" split-regexp)) (exclude ;; Generate RESTRICTs for SPLIT-EXCLUDEs. (if (listp split-exclude) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 8182630dfed..59b8efaa3ac 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -572,7 +572,7 @@ nil. If VALUE is a relative time, interpret it as relative to REL-DATE, or (current-time) if REL-DATE is nil." ;; Time parsing doesn't seem to work with slashes. - (let ((value (replace-regexp-in-string "/" "-" value)) + (let ((value (string-replace "/" "-" value)) (now (append '(0 0 0) (seq-subseq (decode-time (or rel-date (current-time))) @@ -1669,7 +1669,7 @@ cross our fingers for the rest of it." Mairix negation requires a \"~\" preceding string search terms, and \"-\" before marks." (let ((next (gnus-search-transform-expression engine (cadr expr)))) - (replace-regexp-in-string + (string-replace ":" (if (eql (caadr expr) 'mark) ":-" @@ -1863,9 +1863,9 @@ Assume \"size\" key is equal to \"larger\"." group (if (file-directory-p (setq group - (replace-regexp-in-string - "\\." "/" - group nil t))) + (string-replace + "." "/" + group))) group)))))) (unless group (signal 'gnus-search-config-error diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 44e97d54846..02bbe19e7fe 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -854,7 +854,7 @@ If REGEXP is given, lines that match it will be deleted." (goto-char (point-max)) ;; Make sure that each dribble entry is a single line, so that ;; the "remove" code above works. - (insert (replace-regexp-in-string "\n" "\\\\n" string) "\n") + (insert (string-replace "\n" "\\n" string) "\n") (bury-buffer gnus-dribble-buffer) (with-current-buffer gnus-group-buffer (gnus-group-set-mode-line))))) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 4bdc2023eb4..dc004927b67 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -9191,7 +9191,7 @@ specified by the `gnus-refer-thread-limit' variable." (interactive "sMessage-ID: " gnus-summary-mode) (when (and (stringp message-id) (not (zerop (length message-id)))) - (setq message-id (replace-regexp-in-string " " "" message-id)) + (setq message-id (string-replace " " "" message-id)) ;; Construct the correct Message-ID if necessary. ;; Suggested by tale@pawl.rpi.edu. (unless (string-match "^<" message-id) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index be0284515dc..7a5e00c5ec9 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -408,7 +408,7 @@ Cache the result as a text property stored in DATE." (defun gnus-mode-string-quote (string) "Quote all \"%\"'s in STRING." - (replace-regexp-in-string "%" "%%" string)) + (string-replace "%" "%%" string)) (defsubst gnus-make-hashtable (&optional size) "Make a hash table of SIZE, testing on `equal'." diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index bcbf7476715..a3ffaec3ff3 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8599,7 +8599,7 @@ From headers in the original article." (let ((value (message-field-value header))) (dolist (string (mail-header-parse-addresses value 'raw)) (setq string - (replace-regexp-in-string + (string-replace "\n" "" (replace-regexp-in-string "^ +\\| +$" "" string))) (ecomplete-add-item 'mail (car (mail-header-parse-address string)) @@ -8889,7 +8889,7 @@ used to take the screenshot." (defun message-parse-mailto-url (url) "Parse a mailto: url." - (setq url (replace-regexp-in-string "\n" " " url)) + (setq url (string-replace "\n" " " url)) (when (string-match "mailto:/*\\(.*\\)" url) (setq url (substring url (match-beginning 1) nil))) (setq url (if (string-match "^\\?" url) @@ -8931,9 +8931,9 @@ will then start up Emacs ready to compose mail. For emacsclient use (dolist (arg args) (unless (equal (car arg) "body") (message-position-on-field (capitalize (car arg))) - (insert (replace-regexp-in-string + (insert (string-replace "\r\n" "\n" - (mapconcat #'identity (reverse (cdr arg)) ", ") nil t)))) + (mapconcat #'identity (reverse (cdr arg)) ", "))))) (when (assoc "body" args) (message-goto-body) (dolist (body (cdr (assoc "body" args))) diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 15157e6fbc8..b49793509fc 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -1022,7 +1022,7 @@ Returns non-nil if the user has chosen to use SENDER." (if (eq 'OpenPGP protocol) (epg-sign-string context (buffer-string) mode) (epg-sign-string context - (replace-regexp-in-string + (string-replace "\n" "\r\n" (buffer-string)) t)) mml-secure-secret-key-id-list nil) diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index 5c133e680af..959de0902e2 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el @@ -404,7 +404,7 @@ Content-Disposition: attachment; filename=smime.p7m nil t))))) (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) - (setq part (replace-regexp-in-string "\n" "\r\n" part) + (setq part (string-replace "\n" "\r\n" part) context (epg-make-context 'CMS)) (condition-case error ;; (setq plain diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 1af7d10d055..8c40fc79f00 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el @@ -863,7 +863,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." nil t)))) (mm-sec-error 'gnus-info "Corrupted") (throw 'error handle)) - (setq part (replace-regexp-in-string "\n" "\r\n" part) + (setq part (string-replace "\n" "\r\n" part) signature (mm-get-part signature) context (epg-make-context)) (condition-case error diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 4867455393a..372df64e2e5 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -637,13 +637,11 @@ This variable is set by `nnmaildir-request-article'.") (funcall func (cdr entry))))))) (defun nnmaildir--system-name () - (replace-regexp-in-string + (string-replace ":" "\\072" - (replace-regexp-in-string + (string-replace "/" "\\057" - (replace-regexp-in-string "\\\\" "\\134" (system-name) nil 'literal) - nil 'literal) - nil 'literal)) + (string-replace "\\" "\\134" (system-name))))) (defun nnmaildir-request-type (_group &optional _article) 'mail) @@ -937,9 +935,9 @@ This variable is set by `nnmaildir-request-article'.") (setq pgname (nnmaildir--pgname nnmaildir--cur-server gname) ro (nnmaildir--param pgname 'read-only)) - (insert (replace-regexp-in-string + (insert (string-replace " " "\\ " - (nnmaildir--grp-name group) nil t) + (nnmaildir--grp-name group)) " ") (princ (nnmaildir--group-maxnum nnmaildir--cur-server group) nntp-server-buffer) @@ -968,7 +966,7 @@ This variable is set by `nnmaildir-request-article'.") (princ (nnmaildir--group-maxnum nnmaildir--cur-server group) nntp-server-buffer) (insert " " - (replace-regexp-in-string " " "\\ " gname nil t) + (string-replace " " "\\ " gname) "\n"))))) 'group) @@ -1098,7 +1096,7 @@ This variable is set by `nnmaildir-request-article'.") (insert " ") (princ (nnmaildir--group-maxnum nnmaildir--cur-server group) nntp-server-buffer) - (insert " " (replace-regexp-in-string " " "\\ " gname nil t) "\n") + (insert " " (string-replace " " "\\ " gname) "\n") t)))) (defun nnmaildir-request-create-group (gname &optional server _args) @@ -1262,7 +1260,7 @@ This variable is set by `nnmaildir-request-article'.") (insert "\t" (nnmaildir--nov-get-beg nov) "\t" (nnmaildir--art-msgid article) "\t" (nnmaildir--nov-get-mid nov) "\tXref: nnmaildir " - (replace-regexp-in-string " " "\\ " gname nil t) ":") + (string-replace " " "\\ " gname) ":") (princ num nntp-server-buffer) (insert "\t" (nnmaildir--nov-get-end nov) "\n")))) (catch 'return diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index a40fa88631f..8cd8cbe84f1 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el @@ -785,7 +785,7 @@ It is useful when `(setq nnrss-use-local t)'." (nnrss-node-just-text node) node)) (cleaned-text (if text - (replace-regexp-in-string + (string-replace "\r\n" "\n" (replace-regexp-in-string "^[\000-\037\177]+\\|^ +\\| +$" "" diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el index a4234f84001..5fa280ea058 100644 --- a/lisp/gnus/spam-report.el +++ b/lisp/gnus/spam-report.el @@ -159,7 +159,7 @@ submitted at once. Internal variable.") rpt-host (concat "/" - (replace-regexp-in-string + (string-replace "/" ":" (replace-regexp-in-string "^.*article.gmane.org/" "" @@ -224,7 +224,7 @@ the function specified by `spam-report-url-ping-function'." (defcustom spam-report-user-mail-address (and (stringp user-mail-address) - (replace-regexp-in-string "@" "" user-mail-address)) + (string-replace "@" "" user-mail-address)) "Mail address of this user used for spam reports to Gmane. This is initialized based on `user-mail-address'." :type '(choice string diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 9088f31053b..6c0180590b9 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1719,7 +1719,7 @@ If point is on a group name, this function operates on that group." (ibuffer-buffer-name-face buffer mark)))) (if (not (seq-position string ?\n)) string - (replace-regexp-in-string + (string-replace "\n" (propertize "^J" 'font-lock-face 'escape-glyph) string)))) (define-ibuffer-column size diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 2509ecf8f82..74985b9e56d 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -704,7 +704,7 @@ Increase at own risk.") (thumb (cdr (assq ?t spec)))) (rename-file nq8 thumb t))) (message "command %S %s" (process-command process) - (replace-regexp-in-string "\n" "" status))))) + (string-replace "\n" "" status))))) process)) (defun image-dired-pngcrush-thumb (spec) @@ -726,7 +726,7 @@ Increase at own risk.") (unless (and (eq (process-status process) 'exit) (zerop (process-exit-status process))) (message "command %S %s" (process-command process) - (replace-regexp-in-string "\n" "" status))) + (string-replace "\n" "" status))) (when (memq (process-status process) '(exit signal)) (let ((temp (cdr (assq ?q spec)))) (delete-file temp))))) @@ -744,7 +744,7 @@ Increase at own risk.") (unless (and (eq (process-status process) 'exit) (zerop (process-exit-status process))) (message "command %S %s" (process-command process) - (replace-regexp-in-string "\n" "" status))))) + (string-replace "\n" "" status))))) process)) (defun image-dired-create-thumb-1 (original-file thumbnail-file) @@ -794,7 +794,7 @@ Increase at own risk.") (zerop (process-exit-status process)))) (message "Thumb could not be created for %s: %s" (abbreviate-file-name original-file) - (replace-regexp-in-string "\n" "" status)) + (string-replace "\n" "" status)) (set-file-modes thumbnail-file #o600) (clear-image-cache thumbnail-file) ;; PNG thumbnail has been created since we are diff --git a/lisp/info.el b/lisp/info.el index b65728ba41b..1c477a7082f 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1732,14 +1732,14 @@ escaped (\\\",\\\\)." (concat " (" (if (stringp Info-current-file) - (replace-regexp-in-string + (string-replace "%" "%%" (file-name-sans-extension (file-name-nondirectory Info-current-file))) (format "*%S*" Info-current-file)) ") " (if Info-current-node - (propertize (replace-regexp-in-string + (propertize (string-replace "%" "%%" Info-current-node) 'face 'mode-line-buffer-id 'help-echo diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 55accf5beee..71e2653ffe9 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2166,7 +2166,7 @@ See `set-language-info-alist' for use in programs." (let ((str (eval (get-language-info language-name 'sample-text)))) (if (stringp str) (insert "Sample text:\n " - (replace-regexp-in-string "\n" "\n " str) + (string-replace "\n" "\n " str) "\n\n"))) (error nil)) (let ((input-method (get-language-info language-name 'input-method)) diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el index 6fb4502b23b..db34fd2cb9e 100644 --- a/lisp/mail/rfc2231.el +++ b/lisp/mail/rfc2231.el @@ -63,7 +63,7 @@ must never cause a Lisp error." (let (mod) (when (and (string-match "\\\\\"" string) (not (string-match "\\`\"\\|[^\\]\"" string))) - (setq string (replace-regexp-in-string "\\\\\"" "\"" string) + (setq string (string-replace "\\\"" "\"" string) mod t)) (when (and (string-match "\\\\(" string) (string-match "\\\\)" string) diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el index 553f3cc3a54..b96f15d3e68 100644 --- a/lisp/mail/rfc2368.el +++ b/lisp/mail/rfc2368.el @@ -91,7 +91,7 @@ Note: make sure MAILTO-URL has been \"unhtmlized\" (e.g., & -> &), before calling this function." (let ((case-fold-search t) prequery query headers-alist) - (setq mailto-url (replace-regexp-in-string "\n" " " mailto-url)) + (setq mailto-url (string-replace "\n" " " mailto-url)) (if (string-match rfc2368-mailto-regexp mailto-url) (progn (setq prequery diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index e479a8e9b4a..8a38337773e 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1960,7 +1960,7 @@ Value is the size of the newly read mail after conversion." (file-name-nondirectory (if (memq system-type '(windows-nt cygwin ms-dos)) ;; cannot have colons in file name - (replace-regexp-in-string ":" "-" file) + (string-replace ":" "-" file) file))) ;; Use the directory of this rmail file ;; because it's a nuisance to use the homedir @@ -3374,7 +3374,7 @@ The idea is to match it against simplified subjects of other messages." ;; Hide commas so it will work ok if parsed as a comma-separated list ;; of regexps. (setq subject - (replace-regexp-in-string "," "\054" subject t t)) + (string-replace "," "\054" subject)) (concat "\\`" subject "\\'"))) (defun rmail-next-same-subject (n) diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index eb8590f1f73..4c23686909c 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el @@ -678,9 +678,9 @@ than appending to it. Deletes the message after writing if (or (mail-fetch-field "Subject") rmail-default-body-file))) (setq default-file - (replace-regexp-in-string ":" "-" default-file)) + (string-replace ":" "-" default-file)) (setq default-file - (replace-regexp-in-string " " "-" default-file)) + (string-replace " " "-" default-file)) (list (setq rmail-default-body-file (read-file-name "Output message body to file: " diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el index bf57ed6fa6f..0760a477296 100644 --- a/lisp/mail/undigest.el +++ b/lisp/mail/undigest.el @@ -125,7 +125,7 @@ See rmail-digest-methods." ;; Undo masking of separators inside digestified messages (goto-char (point-min)) (while (search-forward - (replace-regexp-in-string "\n-" "\n " separator) nil t) + (string-replace "\n-" "\n " separator) nil t) (replace-match separator)) ;; Return the list of marker pairs (nreverse result)))))) diff --git a/lisp/man.el b/lisp/man.el index 9b941a2b3d2..54b6ffe9836 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -802,7 +802,7 @@ POS defaults to `point'." ;; added by troff, and remove it. (or (not (eq (string-to-char (substring 1st-part -1)) ?-)) (string-match-p "-" (substring 1st-part 0 -1)) - (setq word (replace-regexp-in-string "-" "" word)))) + (setq word (string-replace "-" "" word)))) ;; Make sure the section number gets included by the code below. (goto-char (match-end 1))) (when (string-match "[-._‐]+$" word) diff --git a/lisp/mouse.el b/lisp/mouse.el index 89e5d7c48a3..cf7c17be28f 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -180,7 +180,7 @@ items `Turn Off' and `Help'." `(keymap ,(format "%s - %s" indicator (capitalize - (replace-regexp-in-string + (string-replace "-" " " (format "%S" minor-mode)))) (turn-off menu-item "Turn off minor mode" ,mm-fun) (help menu-item "Help for minor mode" diff --git a/lisp/mpc.el b/lisp/mpc.el index ab572aa539a..e04ffa49747 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -214,8 +214,8 @@ defaults to 6600 and HOST defaults to localhost." (with-current-buffer "*MPC-debug*" (goto-char (point-max)) (insert-before-markers ;So it scrolls. - (replace-regexp-in-string "\n" "\n " - (apply #'format-message format args)) + (string-replace "\n" "\n " + (apply #'format-message format args)) "\n")))) (defun mpc--proc-filter (proc string) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 6d64100be17..f739cd72cc3 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1644,7 +1644,7 @@ used instead of `browse-url-new-window-flag'." (insert "\n")) (goto-char (prog1 (point) - (insert (replace-regexp-in-string "\r\n" "\n" body)) + (insert (string-replace "\r\n" "\n" body)) (unless (bolp) (insert "\n")))))))) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index eec3ec7ba8b..2a81d2e0c8c 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -779,7 +779,7 @@ Currently this means either text/html or application/xhtml+xml." (propertize "...: " 'face 'variable-pitch)))) (propertize "..." 'face 'variable-pitch))))))) - (replace-regexp-in-string + (string-replace "%" "%%" (format-spec eww-header-line-format diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index e623dab26df..dc541943587 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -610,7 +610,7 @@ This does NOT start the retrieval timers." (interactive) (let ((filename (read-string "Filename: " (concat feed ":_" - (replace-regexp-in-string + (string-replace " " "_" (newsticker--title item)) ".html")))) (with-temp-buffer diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index f11f36e8096..e7aec505b0b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -800,7 +800,7 @@ When 0, do not auto-reconnect." (defun rcirc-sentinel (process sentinel) "Called when PROCESS receives SENTINEL." - (let ((sentinel (replace-regexp-in-string "\n" "" sentinel))) + (let ((sentinel (string-replace "\n" "" sentinel))) (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) (with-rcirc-process-buffer process (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 821ef4af8e0..f5480afb698 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -659,7 +659,7 @@ representing leap seconds." (if second (if second-fraction (let* ((second-fraction-significand - (replace-regexp-in-string "\\." "" second-fraction)) + (string-replace "." "" second-fraction)) (hertz (expt 10 (length second-fraction-significand))) (ticks (+ (* hertz (string-to-number second)) diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index 1314ade9e31..d820d1b99b5 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el @@ -100,7 +100,7 @@ Return a pattern." "Regular expression to match a single-quoted literal.") (defconst rng-c-literal-2-re - (replace-regexp-in-string "'" "\"" rng-c-literal-1-re) + (string-replace "'" "\"" rng-c-literal-1-re) "Regular expression to match a double-quoted literal.") (defconst rng-c-ncname-re "\\w+") diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el index 9824eebbd8b..38bc2e141e6 100644 --- a/lisp/nxml/xmltok.el +++ b/lisp/nxml/xmltok.el @@ -479,7 +479,7 @@ and VALUE-END, otherwise a STRING giving the value." "[^<'&\r\n\t]*" (xmltok-g complex1 "[&\r\n\t][^<']*") opt "'")) - (lit2 (cons (replace-regexp-in-string "'" "\"" (car lit1)) + (lit2 (cons (string-replace "'" "\"" (car lit1)) '(complex2))) (literal (xmltok-g literal lit1 or lit2)) (name (xmltok+ open (xmltok-g xmlns "xmlns") or ncname close diff --git a/lisp/obsolete/nnir.el b/lisp/obsolete/nnir.el index 40a8ec57b98..caeca988810 100644 --- a/lisp/obsolete/nnir.el +++ b/lisp/obsolete/nnir.el @@ -920,10 +920,10 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." ;; eliminate all ".", "/", "\" from beginning. Always matches. (string-match "^[./\\]*\\(.*\\)$" dirnam) ;; "/" -> "." - (setq group (replace-regexp-in-string + (setq group (string-replace "/" "." (match-string 1 dirnam))) ;; Windows "\\" -> "." - (setq group (replace-regexp-in-string "\\\\" "." group)) + (setq group (string-replace "\\" "." group)) (push (vector (gnus-group-full-name group server) (string-to-number artno) @@ -996,7 +996,7 @@ Tested with swish-e-2.0.1 on Windows NT 4.0." (when (string-match prefix dirnam) (setq dirnam (replace-match "" t t dirnam))) (push (vector (gnus-group-full-name - (replace-regexp-in-string "/" "." dirnam) server) + (string-replace "/" "." dirnam) server) (string-to-number artno) (string-to-number score)) artlist)) @@ -1205,9 +1205,9 @@ construct path: search terms (see the variable group (if (file-directory-p (setq group - (replace-regexp-in-string - "\\." "/" - group nil t))) + (string-replace + "." "/" + group))) group)))))) (unless group (error "Cannot locate directory for group")) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index c3be029a658..3bb8bf0c82b 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -2373,7 +2373,7 @@ Also prints current score to let user know he has scored." (dun-mprincl "Incorrect."))) (let (varname epoint afterq i value) - (setq varname (replace-regexp-in-string " " "" (substring line 0 esign))) + (setq varname (string-replace " " "" (substring line 0 esign))) (if (or (= (length varname) 0) (< (- (length line) esign) 2)) (progn diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el index cc058230751..2aec408e11b 100644 --- a/lisp/play/handwrite.el +++ b/lisp/play/handwrite.el @@ -200,7 +200,7 @@ Variables: `handwrite-linespace' (default 12) (concat "\\\\" (cdr trans)) line))) (switch-to-buffer ps-buf-name) - (insert (replace-regexp-in-string "\n" "" line)) + (insert (string-replace "\n" "" line)) (message "write write write...") (setq ps-ypos (+ ps-ypos handwrite-linespace)) (end-of-line) diff --git a/lisp/proced.el b/lisp/proced.el index d1a243df8e0..2fafdcc58e5 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -1389,7 +1389,7 @@ The return string is always 6 characters wide." (defun proced-format-args (args) "Format attribute ARGS. Replace newline characters by \"^J\" (two characters)." - (replace-regexp-in-string "\n" "^J" args)) + (string-replace "\n" "^J" args)) (defun proced-format (process-alist format) "Display PROCESS-ALIST using FORMAT." diff --git a/lisp/profiler.el b/lisp/profiler.el index 8145e51d75d..4c427692cb8 100644 --- a/lisp/profiler.el +++ b/lisp/profiler.el @@ -499,7 +499,7 @@ RET: expand or collapse")) (defun profiler-report-header-line-format (fmt &rest args) (let* ((header (apply #'profiler-format fmt args)) - (escaped (replace-regexp-in-string "%" "%%" header))) + (escaped (string-replace "%" "%%" header))) (concat (propertize " " 'display '(space :align-to 0) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index b9c8305bed0..97596d0d278 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1963,7 +1963,7 @@ commands to be prefixed by \"-interpreter-exec console\".") The string is enclosed in double quotes. All embedded quotes, newlines, and backslashes are preceded with a backslash." (setq string (replace-regexp-in-string "\\([\"\\]\\)" "\\\\\\&" string)) - (setq string (replace-regexp-in-string "\n" "\\n" string t t)) + (setq string (string-replace "\n" "\\n" string)) (concat "\"" string "\"")) (defun gdb-input (command handler-function &optional trigger-name) diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 4d277755aeb..df17b87c013 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -257,7 +257,7 @@ not be enclosed in { } or ( )." "Regex used to highlight makepp rule action lines in font lock mode.") (defconst makefile-bsdmake-rule-action-regex - (replace-regexp-in-string "-@" "-+@" makefile-rule-action-regex) + (string-replace "-@" "-+@" makefile-rule-action-regex) "Regex used to highlight BSD rule action lines in font lock mode.") ;; Note that the first and second subexpression is used by font lock. Note @@ -358,11 +358,10 @@ not be enclosed in { } or ( )." ,@(if keywords ;; Fontify conditionals and includes. `((,(concat "^\\(?: [ \t]*\\)?" - (replace-regexp-in-string + (string-replace " " "[ \t]+" (if (eq (car keywords) t) - (replace-regexp-in-string "-" "[_-]" - (regexp-opt (cdr keywords) t)) + (string-replace "-" "[_-]" (regexp-opt (cdr keywords) t)) (regexp-opt keywords t))) "\\>[ \t]*\\([^: \t\n#]*\\)") (1 font-lock-keyword-face) (2 font-lock-variable-name-face)))) diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 0b520e39074..2e23c2e2cab 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -2277,7 +2277,7 @@ between them)." ;(goto-char beg) (if (search-forward-regexp "^[ \t]*\\(%+\\|\\*+\\|/\\*+\\)[ \t]*" end t) - (replace-regexp-in-string "/" " " (buffer-substring beg (point))) + (string-replace "/" " " (buffer-substring beg (point))) (beginning-of-line) (when (search-forward-regexp "^[ \t]+" end t) (buffer-substring beg (point))))))))) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 01fb044161b..74b48ca4bde 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1788,8 +1788,8 @@ If the result is do-end block, it will always be multiline." (buffer-substring-no-properties (1+ min) (1- max)))) (setq content (if (equal string-quote "'") - (replace-regexp-in-string "\\\\\"" "\"" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)'" "\\1\\\\'" content)) - (replace-regexp-in-string "\\\\'" "'" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)\"" "\\1\\\\\"" content)))) + (string-replace "\\\"" "\"" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)'" "\\1\\\\'" content)) + (string-replace "\\'" "'" (replace-regexp-in-string "\\(\\`\\|[^\\]\\)\"" "\\1\\\\\"" content)))) (let ((orig-point (point))) (delete-region min max) (insert diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index f144549cf6d..b9012166a52 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -3843,7 +3843,7 @@ to avoid deleting non-prompt output." (defun sql-remove-tabs-filter (str) "Replace tab characters with spaces." - (replace-regexp-in-string "\t" " " str nil t)) + (string-replace "\t" " " str)) (defun sql-toggle-pop-to-buffer-after-send-region (&optional value) "Toggle `sql-pop-to-buffer-after-send-region'. @@ -3864,7 +3864,7 @@ If given the optional parameter VALUE, sets "If non-nil, display messages related to the use of redirection.") (defun sql-str-literal (s) - (concat "'" (replace-regexp-in-string "[']" "''" s) "'")) + (concat "'" (string-replace "[']" "''" s) "'")) (defun sql-redirect (sqlbuf command &optional outbuf save-prior) "Execute the SQL command and send output to OUTBUF. diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 02a8d72758c..eb170baa5d8 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -175,7 +175,7 @@ and you want to simplify them for the mode line (defvar which-func-table (make-hash-table :test 'eq :weakness 'key)) (defconst which-func-current - '(:eval (replace-regexp-in-string + '(:eval (string-replace "%" "%%" (or (gethash (selected-window) which-func-table) which-func-unknown)))) diff --git a/lisp/replace.el b/lisp/replace.el index ee46286a75f..c67877efd5d 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -213,7 +213,7 @@ wants to replace FROM with TO." (when query-replace-from-to-separator ;; Check if the first non-whitespace char is displayable (if (char-displayable-p - (string-to-char (replace-regexp-in-string + (string-to-char (string-replace " " "" query-replace-from-to-separator))) query-replace-from-to-separator " -> "))) @@ -2101,7 +2101,7 @@ See also `multi-occur'." ;; Add non-numeric prefix to all non-first lines ;; of multi-line matches. (concat - (replace-regexp-in-string + (string-replace "\n" (if prefix-face (propertize @@ -2506,12 +2506,10 @@ a string, it is first passed through `prin1-to-string' with the `noescape' argument set. `match-data' is preserved across the call." - (save-match-data - (replace-regexp-in-string "\\\\" "\\\\" - (if (stringp replacement) - replacement - (prin1-to-string replacement t)) - t t))) + (string-replace "\\" "\\\\" + (if (stringp replacement) + replacement + (prin1-to-string replacement t)))) (defun replace-loop-through-replacements (data count) ;; DATA is a vector containing the following values: diff --git a/lisp/select.el b/lisp/select.el index eaa74cebd80..15e171c13f9 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -496,7 +496,7 @@ two markers or an overlay. Otherwise, it is nil." (error "Unknown selection type: %S" type))))) ;; Most programs are unable to handle NUL bytes in strings. - (setq str (replace-regexp-in-string "\0" "\\0" str t t)) + (setq str (string-replace "\0" "\\0" str)) (setq next-selection-coding-system nil) (cons type str)))) diff --git a/lisp/ses.el b/lisp/ses.el index ca515f829dc..81c27144a54 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -3357,7 +3357,7 @@ is non-nil. Newlines and tabs in the export text are escaped." (push "'" result) (setq item (cadr item))) (setq item (ses-prin1 item)) - (setq item (replace-regexp-in-string "\t" "\\\\t" item)) + (setq item (string-replace "\t" "\\t" item)) (push item result) (cond ((< col maxcol) diff --git a/lisp/subr.el b/lisp/subr.el index b8286600664..87298b5cfde 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3681,7 +3681,7 @@ See Info node `(elisp)Security Considerations'." "''" ;; Quote everything except POSIX filename characters. ;; This should be safe enough even for really weird shells. - (replace-regexp-in-string + (string-replace "\n" "'\n'" (replace-regexp-in-string "[^-0-9a-zA-Z_./\n]" "\\\\\\&" argument)))) )) diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index 8cff2ceaeec..9e7b360b9c6 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -290,7 +290,7 @@ This is used by `msdos-show-help'.") (not cursor-in-echo-area)) ;Don't overwrite a prompt. (cond ((stringp help) - (setq help (replace-regexp-in-string "\n" ", " help)) + (setq help (string-replace "\n" ", " help)) (unless (or msdos-previous-message (string-equal help (current-message)) (and (stringp msdos-last-help-message) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 6b849164aec..80afcb36040 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -410,7 +410,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;;; Fix interface to (X-specific) mouse.el (defun w32--set-selection (type value) (if (eq type 'CLIPBOARD) - (w32-set-clipboard-data (replace-regexp-in-string "\0" "\\0" value t t)) + (w32-set-clipboard-data (string-replace "\0" "\\0" value)) (put 'x-selections (or type 'PRIMARY) value))) (defun w32--get-selection (&optional type data-type) diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 8bcae37afe4..868b33ea9c5 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -1015,10 +1015,9 @@ hitting screen's max DCS length." 'terminal-init-screen)) (bytes (encode-coding-string data 'utf-8-unix)) (base-64 (if screen - (replace-regexp-in-string + (string-replace "\n" "\e\\\eP" - (base64-encode-string bytes) - :fixedcase :literal) + (base64-encode-string bytes)) (base64-encode-string bytes :no-line-break))) (length (length base-64))) (if (> length xterm-max-cut-length) diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 1368af01bac..1d5d1caeabc 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -449,8 +449,8 @@ If no such character is found, move to beginning of line." (progn (beginning-of-line) (skip-chars-backward - (concat "^" (replace-regexp-in-string - "\\\\" "\\\\" picture-tab-chars nil t)) + (concat "^" (string-replace + "\\" "\\\\" picture-tab-chars)) (point-min)) (not (bobp)))) (move-to-column target)) diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 5710b8c353b..4c863883ba4 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el @@ -434,10 +434,10 @@ Open another window." (defun thumbs-call-setroot-command (img) "Call the setroot program for IMG." (run-hooks 'thumbs-before-setroot-hook) - (shell-command (replace-regexp-in-string - "\\*" + (shell-command (string-replace + "*" (shell-quote-argument (expand-file-name img)) - thumbs-setroot-command nil t)) + thumbs-setroot-command)) (run-hooks 'thumbs-after-setroot-hook)) (defun thumbs-set-image-at-point-to-root-window () diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 03d9f54ea6c..23b67ee2cab 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -346,7 +346,7 @@ It is also called if Tooltip mode is on, for text-only displays." (not cursor-in-echo-area)) ;Don't overwrite a prompt. (cond ((stringp help) - (setq help (replace-regexp-in-string "\n" ", " help)) + (setq help (string-replace "\n" ", " help)) (unless (or tooltip-previous-message (equal-including-properties help (current-message)) (and (stringp tooltip-help-message) diff --git a/lisp/transient.el b/lisp/transient.el index 5f66a13094b..4087a0c68a6 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3064,18 +3064,18 @@ Optional support for popup buttons is also implemented here." ((equal (seq-take seq len) transient--redisplay-key) (let ((pre (key-description (vconcat (seq-take seq len)))) (suf (key-description (vconcat (seq-drop seq len))))) - (setq pre (replace-regexp-in-string "RET" "C-m" pre t)) - (setq pre (replace-regexp-in-string "TAB" "C-i" pre t)) - (setq suf (replace-regexp-in-string "RET" "C-m" suf t)) - (setq suf (replace-regexp-in-string "TAB" "C-i" suf t)) + (setq pre (string-replace "RET" "C-m" pre)) + (setq pre (string-replace "TAB" "C-i" pre)) + (setq suf (string-replace "RET" "C-m" suf)) + (setq suf (string-replace "TAB" "C-i" suf)) ;; We use e.g. "-k" instead of the more correct "- k", ;; because the former is prettier. If we did that in ;; the definition, then we want to drop the space that ;; is reinserted above. False-positives are possible ;; for silly bindings like "-C-c C-c". (unless (string-match-p " " key) - (setq pre (replace-regexp-in-string " " "" pre)) - (setq suf (replace-regexp-in-string " " "" suf))) + (setq pre (string-replace " " "" pre)) + (setq suf (string-replace " " "" suf))) (concat (propertize pre 'face 'default) (and (string-prefix-p (concat pre " ") key) " ") (transient--colorize-key suf cmd) diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el index 29c2780121a..4fd631d2955 100644 --- a/lisp/url/url-mailto.el +++ b/lisp/url/url-mailto.el @@ -105,7 +105,7 @@ (goto-char (point-max))) (insert (mapconcat (lambda (string) - (replace-regexp-in-string "\r\n" "\n" string)) + (string-replace "\r\n" "\n" string)) (cdar args) "\n"))) (url-mail-goto-field (caar args)) ;; (setq func (intern-soft (concat "mail-" (caar args)))) diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 4a44787bb03..46e9c97eb0a 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -974,8 +974,8 @@ Return non-nil if it is." (not (looking-at (format ".+ .+ <%s>" (regexp-quote mail)))) (looking-at ".+ \\(.+ <.+>\\) *\\((tiny change)\\)?")) - (let ((author (replace-regexp-in-string " " " " - (match-string 1)))) + (let ((author (string-replace " " " " + (match-string 1)))) (unless (and log-edit-author (string-match (regexp-quote author) (car log-edit-author))) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index de5a90dc602..5144b5d0bbb 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -467,7 +467,7 @@ in the branch repository (or whose status not be determined)." ;; Erase the status text that matched. (delete-region (match-beginning 0) (match-end 0)) (setq status - (intern (replace-regexp-in-string " " "" statusword))))) + (intern (string-replace " " "" statusword))))) (when status (goto-char (point-min)) (skip-chars-forward " \n\t") ;Throw away spaces. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index c9c1e91d483..4a64caa36b8 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -851,8 +851,8 @@ if we don't understand a construct, we signal (push "\\[" parts)) (t (let ((x (substring glob i j))) - (setf x (replace-regexp-in-string - "\\\\" "\\\\" x t t)) + (setf x (string-replace + "\\" "\\\\" x)) (setf i (1+ j)) (cond ((eq (aref x 0) ?!) (setf (aref x 0) ?^)) diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el index c30920dd157..544a6c769fc 100644 --- a/lisp/vc/vc-svn.el +++ b/lisp/vc/vc-svn.el @@ -192,7 +192,7 @@ switches." (let ((state (cdr (assq (aref (match-string 1) 0) state-map))) (propstat (cdr (assq (aref (match-string 2) 0) state-map))) (filename (if (memq system-type '(windows-nt ms-dos)) - (replace-regexp-in-string "\\\\" "/" (match-string 4)) + (string-replace "\\" "/" (match-string 4)) (match-string 4)))) (and (memq propstat '(conflict edited)) (not (eq state 'conflict)) ; conflict always wins diff --git a/lisp/xdg.el b/lisp/xdg.el index 0bdfd114c48..e5165bbd86a 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el @@ -208,8 +208,8 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"." "Partition VALUE into elements delimited by unescaped semicolons." (let (res) (setq value (string-trim-left value)) - (dolist (x (split-string (replace-regexp-in-string "\\\\;" "\0" value) ";")) - (push (replace-regexp-in-string "\0" ";" x) res)) + (dolist (x (split-string (string-replace "\\;" "\0" value) ";")) + (push (string-replace "\0" ";" x) res)) (when (null (string-match-p "[^[:blank:]]" (car res))) (pop res)) (nreverse res))) diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 235c02f8e8b..ea856ab311c 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -146,7 +146,7 @@ The buffer's contents should %s: "") char (if (string= fixture expected-string) "stay" "become") - (replace-regexp-in-string "\n" "\\\\n" expected-string) + (string-replace "\n" "\\n" expected-string) expected-point))) `(ert-deftest ,(intern (format "electric-pair-%s-at-point-%s-in-%s%s" name diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el index 503cb5d7aab..50ac370b5b5 100644 --- a/test/lisp/term-tests.el +++ b/test/lisp/term-tests.el @@ -56,7 +56,7 @@ first line\r next line\r\n")) (should (equal (term-test-screen-from-input 40 12 str) - (replace-regexp-in-string "\r" "" str))))) + (string-replace "\r" "" str))))) (ert-deftest term-carriage-return () (skip-unless (not (memq system-type '(windows-nt ms-dos)))) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 0d64320496d..4e6fbbba923 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -849,7 +849,7 @@ The functions in `pattern-mod' are composed left to right." (defun formatz-mod-del-colons (string) "Returns STRING with any colons removed." - (replace-regexp-in-string ":" "" string)) + (string-replace ":" "" string)) (defun formatz-mod-add-00 (string) "Returns STRING with \"00\" appended." diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el index ba276e24d96..96a01fc2c7b 100644 --- a/test/lisp/wdired-tests.el +++ b/test/lisp/wdired-tests.el @@ -31,7 +31,7 @@ Partially modifying a file name should succeed." (let* ((test-dir (make-temp-file "test-dir-" t)) (test-file (concat (file-name-as-directory test-dir) "foo.c")) (replace "bar") - (new-file (replace-regexp-in-string "foo" replace test-file)) + (new-file (string-replace "foo" replace test-file)) (wdired-use-interactive-rename t)) (write-region "" nil test-file nil 'silent) (advice-add 'dired-query ; Don't ask confirmation to overwrite a file. @@ -109,7 +109,7 @@ wdired-mode." (let* ((test-dir (make-temp-file "test-dir-" t)) (test-file (concat (file-name-as-directory test-dir) "foo.c")) (replace "bar") - (new-file (replace-regexp-in-string "foo" replace test-file))) + (new-file (string-replace "foo" replace test-file))) (write-region "" nil test-file nil 'silent) (let ((buf (find-file-noselect test-dir))) (unwind-protect diff --git a/test/src/json-tests.el b/test/src/json-tests.el index 908945fcb08..8dc0a744aa0 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el @@ -252,7 +252,7 @@ Test with both unibyte and multibyte strings." (let* ((input "{ \"abc\" : [9, false] , \"def\" : null }") (output - (replace-regexp-in-string " " "" input))) + (string-replace " " "" input))) (should (equal (json-parse-string input :object-type 'plist :null-object :json-null -- cgit v1.2.3 From 61677ac3e4685d8f81c3b90eb751d9b5e8a3732d Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sun, 8 Aug 2021 16:45:50 +0200 Subject: Un-obsolete dired-in-this-tree-p and use it again in certain places. This reverts parts of b425966b07, and 7b50ed553f, i.e. it reverts the obsoletion of dired-in-this-tree-p and switches some new callers of file-in-directory-p back to using dired-in-this-tree-p. It turned out that using file-in-directory-p can be a major performance regression in case you have a dired buffer of a remote directory which has become (almost) inaccessible. Any attempt to open a new dired buffer is checking if a buffer for that directory already exists (in terms of dired-buffers-for-dir) which meant that file-in-directory-p was called with the directory of any existing dired buffer including the inaccessible one where the file-truename call in file-in-directory-p could block for seconds or even minutes. * lisp/dired.el (dired-in-this-tree-p): Undo obsoletion. (dired-buffers-for-dir): Use dired-in-this-tree-p as before. * lisp/dired-aux.el (dired-kill-tree,dired-tree-down): Une dired-in-this-tree-p as before. --- lisp/dired-aux.el | 4 ++-- lisp/dired.el | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 72969dd96e2..5dbd55849e9 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2769,7 +2769,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." (setq dir (car (car s-alist)) s-alist (cdr s-alist)) (and (or kill-root (not (string-equal dir dirname))) - (file-in-directory-p dir dirname) + (dired-in-this-tree-p dir dirname) (dired-goto-subdir dir) (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) m-alist)) @@ -3002,7 +3002,7 @@ Lower levels are unaffected." (while rest (setq elt (car rest) rest (cdr rest)) - (if (file-in-directory-p (directory-file-name (car elt)) dir) + (if (dired-in-this-tree-p (directory-file-name (car elt)) dir) (setq rest nil pos (dired-goto-subdir (car elt)))))) (if pos diff --git a/lisp/dired.el b/lisp/dired.el index e577df510ad..816b8b69881 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2872,7 +2872,7 @@ dired-buffers." ((null (buffer-name buf)) ;; Buffer is killed - clean up: (setq dired-buffers (delq elt dired-buffers))) - ((file-in-directory-p (car elt) dir) + ((dired-in-this-tree-p (car elt) dir) (with-current-buffer buf (when (and (or subdirs (assoc dir dired-subdir-alist)) @@ -2947,7 +2947,7 @@ dired-buffers." ;;"Is FILE part of the directory tree starting at DIR?" (let (case-fold-search) (string-match-p (concat "^" (regexp-quote dir)) file))) -(make-obsolete 'dired-in-this-tree-p 'file-in-directory-p "28.1") + (define-obsolete-function-alias 'dired-in-this-tree 'dired-in-this-tree-p "27.1") -- cgit v1.2.3 From 3b7b181bded1bddb2505eda1224a5631cbf04c1b Mon Sep 17 00:00:00 2001 From: Mattias Engdegård Date: Mon, 9 Aug 2021 11:20:00 +0200 Subject: Use string-search instead of string-match[-p] `string-search` is easier to understand, less error-prone, much faster, does not pollute the regexp cache, and does not mutate global state. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-canonical-file-name) (authors-scan-change-log): * lisp/apropos.el (apropos-command) (apropos-documentation-property, apropos-symbols-internal): * lisp/arc-mode.el (archive-arc-summarize) (archive-zoo-summarize): * lisp/calc/calc-aent.el (math-read-factor): * lisp/calc/calc-ext.el (math-read-big-expr) (math-format-nice-expr, math-format-number-fancy): * lisp/calc/calc-forms.el (math-read-angle-brackets): * lisp/calc/calc-graph.el (calc-graph-set-range): * lisp/calc/calc-keypd.el (calc-keypad-press): * lisp/calc/calc-lang.el (tex, latex, math-read-big-rec): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-user-define-permanent, math-define-exp): * lisp/calc/calc.el (calc-record, calcDigit-key) (calc-count-lines): * lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots) (math-do-integral): * lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum) (calc-get-fit-variables): * lisp/cedet/ede/speedbar.el (ede-tag-expand): * lisp/cedet/semantic/java.el (semantic-java-expand-tag): * lisp/cedet/semantic/sb.el (semantic-sb-show-extra) (semantic-sb-expand-group): * lisp/cedet/semantic/wisent/python.el (semantic-python-instance-variable-p): * lisp/cus-edit.el (get): * lisp/descr-text.el (describe-text-sexp): * lisp/dired-aux.el (dired-compress-file): * lisp/dired-x.el (dired-make-relative-symlink): * lisp/dired.el (dired-glob-regexp): * lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename): * lisp/edmacro.el (edmacro-format-keys): * lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand): * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand): * lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list): * lisp/emacs-lisp/warnings.el (display-warning): * lisp/emulation/viper-ex.el (viper-ex-read-file-name) (ex-print-display-lines): * lisp/env.el (read-envvar-name, setenv): * lisp/epa-mail.el (epa-mail-encrypt): * lisp/epg.el (epg--start): * lisp/erc/erc-backend.el (erc-parse-server-response): * lisp/erc/erc-dcc.el (erc-dcc-member): * lisp/erc/erc-speedbar.el (erc-speedbar-expand-server) (erc-speedbar-expand-channel, erc-speedbar-expand-user): * lisp/erc/erc.el (erc-send-input): * lisp/eshell/em-glob.el (eshell-glob-entries): * lisp/eshell/esh-proc.el (eshell-needs-pipe-p): * lisp/eshell/esh-util.el (eshell-convert): * lisp/eshell/esh-var.el (eshell-envvar-names): * lisp/faces.el (x-resolve-font-name): * lisp/ffap.el (ffap-file-at-point): * lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern): * lisp/forms.el (forms--update): * lisp/frameset.el (frameset-filter-unshelve-param): * lisp/gnus/gnus-art.el (article-decode-charset): * lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc) (gnus-inews-insert-gcc): * lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body): * lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output) (gnus-search--complete-key-data): * lisp/gnus/gnus-spec.el (gnus-parse-simple-format): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-extract-address-components) (gnus-newsgroup-directory-form): * lisp/gnus/gnus-uu.el (gnus-uu-grab-view): * lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name): * lisp/gnus/message.el (message-check-news-header-syntax) (message-make-message-id, message-user-mail-address) (message-make-fqdn, message-get-reply-headers, message-followup): * lisp/gnus/mm-decode.el (mm-dissect-buffer): * lisp/gnus/nnheader.el (nnheader-insert): * lisp/gnus/nnimap.el (nnimap-process-quirk) (nnimap-imap-ranges-to-gnus-ranges): * lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix): * lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path): * lisp/gnus/nnrss.el (nnrss-match-macro): * lisp/gnus/nntp.el (nntp-find-group-and-number): * lisp/help-fns.el (help--symbol-completion-table-affixation): * lisp/help.el (help-function-arglist): * lisp/hippie-exp.el (he-concat-directory-file-name): * lisp/htmlfontify.el (hfy-relstub): * lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word) (ido-exhibit): * lisp/image/image-converter.el (image-convert-p): * lisp/info-xref.el (info-xref-docstrings): * lisp/info.el (Info-toc-build, Info-follow-reference) (Info-backward-node, Info-finder-find-node) (Info-speedbar-expand-node): * lisp/international/mule-diag.el (print-fontset-element): * lisp/language/korea-util.el (default-korean-keyboard): * lisp/linum.el (linum-after-change): * lisp/mail/ietf-drums.el (ietf-drums-parse-address): * lisp/mail/mail-utils.el (mail-dont-reply-to): * lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rmailkwd.el (rmail-set-label): * lisp/mail/rmailsum.el (rmail-header-summary): * lisp/mail/smtpmail.el (smtpmail-maybe-append-domain) (smtpmail-user-mail-address): * lisp/mail/uce.el (uce-reply-to-uce): * lisp/man.el (Man-default-man-entry): * lisp/mh-e/mh-alias.el (mh-alias-gecos-name) (mh-alias-minibuffer-confirm-address): * lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject): * lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output): * lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter) (mh-folder-completion-function): * lisp/minibuffer.el (completion--make-envvar-table) (completion-file-name-table, completion-flex-try-completion) (completion-flex-all-completions): * lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p) (mpc-constraints-tag-lookup): * lisp/net/ange-ftp.el (ange-ftp-send-cmd) (ange-ftp-allow-child-lookup): * lisp/net/mailcap.el (mailcap-mime-types): * lisp/net/mairix.el (mairix-search-thread-this-article): * lisp/net/pop3.el (pop3-open-server): * lisp/net/soap-client.el (soap-decode-xs-complex-type): * lisp/net/socks.el (socks-filter): * lisp/nxml/nxml-outln.el (nxml-highlighted-qname): * lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype): * lisp/nxml/rng-uri.el (rng-uri-file-name-1): * lisp/obsolete/complete.el (partial-completion-mode) (PC-do-completion): * lisp/obsolete/longlines.el (longlines-encode-string): * lisp/obsolete/nnir.el (nnir-compose-result): * lisp/obsolete/terminal.el (te-quote-arg-for-sh): * lisp/obsolete/tpu-edt.el (tpu-check-search-case): * lisp/obsolete/url-ns.el (isPlainHostName): * lisp/pcmpl-unix.el (pcomplete/scp): * lisp/play/dunnet.el (dun-listify-string2, dun-get-path) (dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface): * lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment): * lisp/progmodes/gdb-mi.el (gdb-var-delete) (gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result): * lisp/progmodes/gud.el (gud-find-expr): * lisp/progmodes/idlw-help.el (idlwave-do-context-help1): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode) (idlwave-shell-filter-hidden-output, idlwave-shell-filter): * lisp/progmodes/idlwave.el (idlwave-skip-label-or-case) (idlwave-routine-info): * lisp/progmodes/octave.el (inferior-octave-completion-at-point): * lisp/progmodes/sh-script.el (sh-add-completer): * lisp/progmodes/sql.el (defun): * lisp/progmodes/xscheme.el (xscheme-process-filter): * lisp/replace.el (query-replace-compile-replacement) (map-query-replace-regexp): * lisp/shell.el (shell--command-completion-data) (shell-environment-variable-completion): * lisp/simple.el (display-message-or-buffer): * lisp/speedbar.el (speedbar-dired, speedbar-tag-file) (speedbar-tag-expand): * lisp/subr.el (split-string-and-unquote): * lisp/tar-mode.el (tar-extract): * lisp/term.el (term-command-hook, serial-read-name): * lisp/textmodes/bibtex.el (bibtex-print-help-message): * lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter) (ispell-parse-output, ispell-buffer-local-parsing): * lisp/textmodes/reftex-cite.el (reftex-do-citation): * lisp/textmodes/reftex-parse.el (reftex-notice-new): * lisp/textmodes/reftex-ref.el (reftex-show-entry): * lisp/textmodes/reftex.el (reftex-compile-variables): * lisp/textmodes/tex-mode.el (tex-send-command) (tex-start-tex, tex-append): * lisp/thingatpt.el (thing-at-point-url-at-point): * lisp/tmm.el (tmm-add-one-shortcut): * lisp/transient.el (transient-format-key): * lisp/url/url-auth.el (url-basic-auth) (url-digest-auth-directory-id-assoc): * lisp/url/url-news.el (url-news): * lisp/url/url-util.el (url-parse-query-string): * lisp/vc/vc-cvs.el (vc-cvs-parse-entry): * lisp/wid-browse.el (widget-browse-sexp): * lisp/woman.el (woman-parse-colon-path, woman-mini-help) (WoMan-getpage-in-background, woman-negative-vertical-space): * lisp/xml.el: * test/lisp/emacs-lisp/check-declare-tests.el (check-declare-tests-warn): * test/lisp/files-tests.el (files-tests-file-name-non-special-dired-compress-handler): * test/lisp/net/network-stream-tests.el (server-process-filter): * test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode): Use `string-search` instead of `string-match` and `string-match-p`. --- admin/authors.el | 4 ++-- lisp/apropos.el | 8 ++++---- lisp/arc-mode.el | 4 ++-- lisp/calc/calc-aent.el | 4 ++-- lisp/calc/calc-ext.el | 6 +++--- lisp/calc/calc-forms.el | 2 +- lisp/calc/calc-graph.el | 2 +- lisp/calc/calc-keypd.el | 2 +- lisp/calc/calc-lang.el | 8 ++++---- lisp/calc/calc-prog.el | 8 ++++---- lisp/calc/calc.el | 6 +++--- lisp/calc/calcalg2.el | 6 +++--- lisp/calc/calcalg3.el | 6 +++--- lisp/cedet/ede/speedbar.el | 4 ++-- lisp/cedet/semantic/java.el | 2 +- lisp/cedet/semantic/sb.el | 8 ++++---- lisp/cedet/semantic/wisent/python.el | 2 +- lisp/cus-edit.el | 2 +- lisp/descr-text.el | 2 +- lisp/dired-aux.el | 2 +- lisp/dired-x.el | 6 +++--- lisp/dired.el | 2 +- lisp/dos-fns.el | 12 ++++++------ lisp/edmacro.el | 2 +- lisp/emacs-lisp/eieio-opt.el | 4 ++-- lisp/emacs-lisp/eieio-speedbar.el | 4 ++-- lisp/emacs-lisp/lisp-mnt.el | 2 +- lisp/emacs-lisp/warnings.el | 2 +- lisp/emulation/viper-ex.el | 6 +++--- lisp/env.el | 4 ++-- lisp/epa-mail.el | 2 +- lisp/epg.el | 2 +- lisp/erc/erc-backend.el | 10 +++++----- lisp/erc/erc-dcc.el | 2 +- lisp/erc/erc-speedbar.el | 12 ++++++------ lisp/erc/erc.el | 2 +- lisp/eshell/em-glob.el | 2 +- lisp/eshell/esh-proc.el | 2 +- lisp/eshell/esh-util.el | 2 +- lisp/eshell/esh-var.el | 2 +- lisp/faces.el | 2 +- lisp/ffap.el | 2 +- lisp/files.el | 4 ++-- lisp/forms.el | 2 +- lisp/frameset.el | 2 +- lisp/gnus/gnus-art.el | 2 +- lisp/gnus/gnus-kill.el | 2 +- lisp/gnus/gnus-mlspl.el | 2 +- lisp/gnus/gnus-msg.el | 10 +++++----- lisp/gnus/gnus-rfc1843.el | 2 +- lisp/gnus/gnus-search.el | 4 ++-- lisp/gnus/gnus-spec.el | 2 +- lisp/gnus/gnus-sum.el | 2 +- lisp/gnus/gnus-util.el | 4 ++-- lisp/gnus/gnus-uu.el | 2 +- lisp/gnus/gnus.el | 8 ++++---- lisp/gnus/message.el | 26 +++++++++++++------------- lisp/gnus/mm-decode.el | 2 +- lisp/gnus/nnheader.el | 2 +- lisp/gnus/nnimap.el | 4 ++-- lisp/gnus/nnmaildir.el | 2 +- lisp/gnus/nnmairix.el | 2 +- lisp/gnus/nnrss.el | 2 +- lisp/gnus/nntp.el | 4 ++-- lisp/help-fns.el | 2 +- lisp/help.el | 2 +- lisp/hippie-exp.el | 4 ++-- lisp/htmlfontify.el | 2 +- lisp/ido.el | 10 +++++----- lisp/image/image-converter.el | 2 +- lisp/info-xref.el | 2 +- lisp/info.el | 12 ++++++------ lisp/international/mule-diag.el | 4 ++-- lisp/language/korea-util.el | 2 +- lisp/linum.el | 2 +- lisp/mail/ietf-drums.el | 2 +- lisp/mail/mail-utils.el | 2 +- lisp/mail/rfc2047.el | 4 ++-- lisp/mail/rfc2231.el | 6 +++--- lisp/mail/rmailkwd.el | 2 +- lisp/mail/rmailsum.el | 2 +- lisp/mail/smtpmail.el | 4 ++-- lisp/mail/uce.el | 8 ++++---- lisp/man.el | 2 +- lisp/mh-e/mh-alias.el | 6 +++--- lisp/mh-e/mh-comp.el | 4 ++-- lisp/mh-e/mh-speed.el | 2 +- lisp/mh-e/mh-utils.el | 4 ++-- lisp/minibuffer.el | 8 ++++---- lisp/mpc.el | 6 +++--- lisp/net/ange-ftp.el | 6 +++--- lisp/net/mailcap.el | 2 +- lisp/net/mairix.el | 2 +- lisp/net/pop3.el | 4 ++-- lisp/net/soap-client.el | 2 +- lisp/net/socks.el | 2 +- lisp/nxml/nxml-outln.el | 2 +- lisp/nxml/rng-cmpct.el | 4 ++-- lisp/nxml/rng-uri.el | 4 ++-- lisp/obsolete/complete.el | 4 ++-- lisp/obsolete/longlines.el | 4 ++-- lisp/obsolete/nnir.el | 2 +- lisp/obsolete/terminal.el | 2 +- lisp/obsolete/tpu-edt.el | 6 +++--- lisp/obsolete/url-ns.el | 2 +- lisp/pcmpl-unix.el | 2 +- lisp/play/dunnet.el | 18 +++++++++--------- lisp/progmodes/ebnf2ps.el | 2 +- lisp/progmodes/gdb-mi.el | 8 ++++---- lisp/progmodes/gud.el | 2 +- lisp/progmodes/idlw-help.el | 2 +- lisp/progmodes/idlw-shell.el | 10 +++++----- lisp/progmodes/idlwave.el | 8 ++++---- lisp/progmodes/octave.el | 2 +- lisp/progmodes/sh-script.el | 2 +- lisp/progmodes/sql.el | 2 +- lisp/progmodes/xscheme.el | 4 ++-- lisp/replace.el | 8 ++++---- lisp/shell.el | 4 ++-- lisp/simple.el | 4 ++-- lisp/speedbar.el | 12 ++++++------ lisp/subr.el | 2 +- lisp/tar-mode.el | 2 +- lisp/term.el | 6 +++--- lisp/textmodes/bibtex.el | 2 +- lisp/textmodes/ispell.el | 10 +++++----- lisp/textmodes/reftex-cite.el | 2 +- lisp/textmodes/reftex-parse.el | 2 +- lisp/textmodes/reftex-ref.el | 2 +- lisp/textmodes/reftex.el | 2 +- lisp/textmodes/tex-mode.el | 6 +++--- lisp/thingatpt.el | 2 +- lisp/tmm.el | 2 +- lisp/transient.el | 2 +- lisp/url/url-auth.el | 8 ++++---- lisp/url/url-news.el | 2 +- lisp/url/url-util.el | 2 +- lisp/vc/vc-cvs.el | 2 +- lisp/wid-browse.el | 2 +- lisp/woman.el | 10 +++++----- lisp/xml.el | 4 ++-- test/lisp/emacs-lisp/check-declare-tests.el | 10 +++++----- test/lisp/files-tests.el | 2 +- test/lisp/net/network-stream-tests.el | 2 +- test/src/coding-tests.el | 2 +- 145 files changed, 299 insertions(+), 299 deletions(-) (limited to 'lisp/dired-aux.el') diff --git a/admin/authors.el b/admin/authors.el index a400b1327af..b4e6c934b67 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1330,7 +1330,7 @@ to print a message if FILE is not found." (unless (or valid (member file authors-ignored-files) (authors-obsolete-file-p file) - (string-match "[*]" file) + (string-search "*" file) (string-match "^[0-9.]+$" file) laxlog) (setq authors-invalid-file-names @@ -1465,7 +1465,7 @@ Suggested\\|Trivial\\|Version\\|Originally\\|From:\\|Patch[ \t]+[Bb]y\\)"))) ((looking-at "^[ \t]+\\*") (let ((line (buffer-substring-no-properties (match-end 0) (line-end-position)))) - (while (and (not (string-match ":" line)) + (while (and (not (string-search ":" line)) (forward-line 1) (not (looking-at ":\\|^[ \t]*$"))) (setq line (concat line diff --git a/lisp/apropos.el b/lisp/apropos.el index 376c1b2cbc5..a1470537d9a 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -616,7 +616,7 @@ while a list of strings is used as a word list." (if (eq doc 'error) "(documentation error)" (setq score (+ score (apropos-score-doc doc))) - (substring doc 0 (string-match "\n" doc))) + (substring doc 0 (string-search "\n" doc))) "(not documented)"))) (and var-predicate (funcall var-predicate symbol) @@ -625,7 +625,7 @@ while a list of strings is used as a word list." (progn (setq score (+ score (apropos-score-doc doc))) (substring doc 0 - (string-match "\n" doc))))))) + (string-search "\n" doc))))))) (setcar (cdr (car p)) score) (setq p (cdr p)))) (and (let ((apropos-multi-type do-all)) @@ -639,7 +639,7 @@ while a list of strings is used as a word list." "Like (documentation-property SYMBOL PROPERTY RAW) but handle errors." (condition-case () (let ((doc (documentation-property symbol property raw))) - (if doc (substring doc 0 (string-match "\n" doc)) + (if doc (substring doc 0 (string-search "\n" doc)) "(not documented)")) (error "(error retrieving documentation)"))) @@ -767,7 +767,7 @@ the output includes key-bindings of commands." "(alias for undefined function)") (error "(can't retrieve function documentation)"))) - (substring doc 0 (string-match "\n" doc)) + (substring doc 0 (string-search "\n" doc)) "(not documented)")) (when (boundp symbol) (apropos-documentation-property diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 83c516100ab..71ad7bd0c5d 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1707,7 +1707,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (= (get-byte p) ?\C-z) (> (get-byte (1+ p)) 0)) (let* ((namefld (buffer-substring (+ p 2) (+ p 2 13))) - (fnlen (or (string-match "\0" namefld) 13)) + (fnlen (or (string-search "\0" namefld) 13)) (efnname (decode-coding-string (substring namefld 0 fnlen) archive-file-name-coding-system)) (csize (archive-l-e (+ p 15) 4)) @@ -2089,7 +2089,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (dirtype (get-byte (+ p 4))) (lfnlen (if (= dirtype 2) (get-byte (+ p 56)) 0)) (ldirlen (if (= dirtype 2) (get-byte (+ p 57)) 0)) - (fnlen (or (string-match "\0" namefld) 13)) + (fnlen (or (string-search "\0" namefld) 13)) (efnname (let ((str (concat (if (> ldirlen 0) diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 1e31c3cadc0..db4751a9fbb 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -1139,7 +1139,7 @@ If the current Calc language does not use placeholders, return nil." 0) (setq sym (intern (substring (symbol-name sym) 1)))) - (or (string-match "-" (symbol-name sym)) + (or (string-search "-" (symbol-name sym)) (setq sym (intern (concat "calcFunc-" (symbol-name sym)))))) @@ -1149,7 +1149,7 @@ If the current Calc language does not use placeholders, return nil." (let ((val (list 'var (intern (math-remove-dashes (symbol-name sym))) - (if (string-match "-" (symbol-name sym)) + (if (string-search "-" (symbol-name sym)) sym (intern (concat "var-" (symbol-name sym))))))) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index e85ecf03906..45337e187be 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -3088,7 +3088,7 @@ If X is not an error form, return 1." (math-read-big-err-msg nil) math-read-big-baseline math-read-big-h2 new-pos p) - (while (setq new-pos (string-match "\n" str pos)) + (while (setq new-pos (string-search "\n" str pos)) (setq math-read-big-lines (cons (substring str pos new-pos) math-read-big-lines) pos (1+ new-pos))) @@ -3249,7 +3249,7 @@ If X is not an error form, return 1." (t (let ((str (math-format-flat-expr x 0)) (pos 0) p) - (or (string-match "\"" str) + (or (string-search "\"" str) (while (<= (setq p (+ pos w)) (length str)) (while (and (> (setq p (1- p)) pos) (not (= (aref str p) ? )))) @@ -3278,7 +3278,7 @@ If X is not an error form, return 1." (math-format-radix-float a prec)) (format "%d#%s" calc-number-radix (math-format-radix-float a prec))))) - (if (and prec (> prec 191) (string-match "\\*" str)) + (if (and prec (> prec 191) (string-search "*" str)) (concat "(" str ")") str)))) ((eq (car a) 'frac) diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el index ee53b94cd64..ac57011da04 100644 --- a/lisp/calc/calc-forms.el +++ b/lisp/calc/calc-forms.el @@ -2238,7 +2238,7 @@ and ends on the last Sunday of October at 2 a.m." (if (eq (car-safe str2) 'error) str2 (append '(calcFunc-lambda) (cdr str1) (list str2))))) - (if (string-match "#" str) + (if (string-search "#" str) (let ((calc-hashes-used 0)) (and (setq str (math-read-expr str)) (if (eq (car-safe str) 'error) diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 423d1e64126..9ac24bf1889 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el @@ -1025,7 +1025,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." (calc-pop-stack 1)))) (if (string-match "\\[.+\\]" range) (setq range (substring range 1 -1))) - (if (and (not (string-match ":" range)) + (if (and (not (string-search ":" range)) (or (string-match "," range) (string-match " " range))) (aset range (match-beginning 0) ?\:)) diff --git a/lisp/calc/calc-keypd.el b/lisp/calc/calc-keypd.el index 1902a4f3f29..acbef27a1da 100644 --- a/lisp/calc/calc-keypd.el +++ b/lisp/calc/calc-keypd.el @@ -481,7 +481,7 @@ ":" (if (and (equal cmd "e") (or (not input) - (string-match + (string-search "#" input)) (> radix 14)) (format "*%d.^" radix) diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 0117f449dd5..aef3173f5c0 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -660,7 +660,7 @@ (setq math-exp-pos (match-end 0) math-exp-token 'punc math-expr-data "[") - (let ((right (string-match "}" math-exp-str math-exp-pos))) + (let ((right (string-search "}" math-exp-str math-exp-pos))) (and right (setq math-exp-str (copy-sequence math-exp-str)) (aset math-exp-str right ?\])))))))))) @@ -899,7 +899,7 @@ (setq math-exp-pos (match-end 0) math-exp-token 'punc math-expr-data "[") - (let ((right (string-match "}" math-exp-str math-exp-pos))) + (let ((right (string-search "}" math-exp-str math-exp-pos))) (and right (setq math-exp-str (copy-sequence math-exp-str)) (aset math-exp-str right ?\])))))))))) @@ -2342,7 +2342,7 @@ order to Calc's." (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t) (if (= (math-read-big-char widest v) ?\() (progn - (setq line (if (string-match "-" p) + (setq line (if (string-search "-" p) (intern p) (intern (concat "calcFunc-" p))) h (1+ widest) @@ -2362,7 +2362,7 @@ order to Calc's." (setq p (cons line (nreverse p)))) (setq p (list 'var (intern (math-remove-dashes p)) - (if (string-match "-" p) + (if (string-search "-" p) (intern p) (intern (concat "var-" p))))))) diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 6f1e5c782df..f9dd9eb98a9 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -604,7 +604,7 @@ ((equal name "#") (search-backward "#") (error "Token `#' is reserved")) - ((and unquoted (string-match "#" name)) + ((and unquoted (string-search "#" name)) (error "Tokens containing `#' must be quoted")) ((not (string-match "[^ ]" name)) (search-backward "\"" nil t) @@ -1068,7 +1068,7 @@ Redefine the corresponding command." (insert (setq str (prin1-to-string (cons 'defun (cons cmd (cdr fcmd))))) "\n") - (or (and (string-match "\"" str) (not q-ok)) + (or (and (string-search "\"" str) (not q-ok)) (fill-region pt (point))) (indent-rigidly pt (point) 2) (delete-region pt (1+ pt)) @@ -1087,7 +1087,7 @@ Redefine the corresponding command." (cons 'defun (cons func (cdr ffunc))))) "\n") - (or (and (string-match "\"" str) (not q-ok)) + (or (and (string-search "\"" str) (not q-ok)) (fill-region pt (point))) (indent-rigidly pt (point) 2) (delete-region pt (1+ pt)) @@ -2132,7 +2132,7 @@ Redefine the corresponding command." (cdr prim)) ((memq exp math-exp-env) exp) - ((string-match "-" name) + ((string-search "-" name) exp) (t (intern (concat "var-" name)))))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 1e7d5e7766c..a10b3178302 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2126,7 +2126,7 @@ the United States." (goto-char (point-max)) (cond ((null prefix) (insert " ")) ((and (> (length prefix) 4) - (string-match " " prefix 4)) + (string-search " " prefix 4)) (insert (substring prefix 0 4) " ")) (t (insert (format "%4s " prefix)))) (insert fval "\n") @@ -2469,7 +2469,7 @@ the United States." (calc-minibuffer-contains "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9]+\\.?0*[@oh] *\\)?\\([0-9]+\\.?0*['m] *\\)?[0-9]*\\(\\.?[0-9]*\\(e[-+]?[0-3]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\\)?\\|[0-9]:\\([0-9]+:\\)?[0-9]*\\)?[\"s]?\\'")) (if (and (memq last-command-event '(?@ ?o ?h ?\' ?m)) - (string-match " " calc-hms-format)) + (string-search " " calc-hms-format)) (insert " ")) (if (and (memq last-command '(calcDigit-start calcDigit-key)) (eq last-command-event ?.)) @@ -3059,7 +3059,7 @@ the United States." (defun calc-count-lines (s) (let ((pos 0) (num 1)) - (while (setq pos (string-match "\n" s pos)) + (while (setq pos (string-search "\n" s pos)) (setq pos (1+ pos) num (1+ num))) num)) diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 94b99aa29d8..8d93ae987a1 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -158,7 +158,7 @@ (calc-top-n 2) (calc-top-n 1))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -175,7 +175,7 @@ (calc-top-n 2) (calc-top-n 1))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -1028,7 +1028,7 @@ (fset 'calcFunc-integ math-old-integ)))) ;; See if the function is a symbolic derivative. - (and (string-match "'" (symbol-name (car expr))) + (and (string-search "'" (symbol-name (car expr))) (let ((name (symbol-name (car expr))) (p expr) (n 0) (which nil) (bad nil)) (while (setq n (1+ n) p (cdr p)) diff --git a/lisp/calc/calcalg3.el b/lisp/calc/calcalg3.el index ee3ae0a4c1f..3cb1886f3bd 100644 --- a/lisp/calc/calcalg3.el +++ b/lisp/calc/calcalg3.el @@ -56,7 +56,7 @@ (calc-top-n 1) (calc-top-n 2))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -81,7 +81,7 @@ (calc-top-n 1) (calc-top-n 2))) (let ((var (if (and (string-match ",\\|[^ ] +[^ ]" var) - (not (string-match "\\[" var))) + (not (string-search "[" var))) (math-read-expr (concat "[" var "]")) (math-read-expr var)))) (if (eq (car-safe var) 'error) @@ -490,7 +490,7 @@ defc) ","))))) (coefs nil)) - (setq vars (if (string-match "\\[" vars) + (setq vars (if (string-search "[" vars) (math-read-expr vars) (math-read-expr (concat "[" vars "]")))) (if (eq (car-safe vars) 'error) diff --git a/lisp/cedet/ede/speedbar.el b/lisp/cedet/ede/speedbar.el index 01d4f943df5..b321cb637bc 100644 --- a/lisp/cedet/ede/speedbar.el +++ b/lisp/cedet/ede/speedbar.el @@ -276,7 +276,7 @@ INDENT is the current indentation level." Etags does not support this feature. TEXT will be the button string. TOKEN will be the list, and INDENT is the current indentation level." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -284,7 +284,7 @@ level." (speedbar-insert-generic-list indent token 'ede-tag-expand 'ede-tag-find)))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index f48b835fe39..0c2fb843f0b 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -141,7 +141,7 @@ corresponding compound declaration." (semantic-tag-put-attribute clone :dereference (+ dim0 (cdr dim))) (semantic-tag-set-bounds clone start end))) - ((and (eq class 'type) (string-match "\\." (semantic-tag-name tag))) + ((and (eq class 'type) (string-search "." (semantic-tag-name tag))) ;; javap outputs files where the package name is stuck onto the class or interface ;; name. To make this more regular, we extract the package name into a package statement, ;; then make the class name regular. diff --git a/lisp/cedet/semantic/sb.el b/lisp/cedet/semantic/sb.el index debdfd1dc04..fe981d34fb7 100644 --- a/lisp/cedet/semantic/sb.el +++ b/lisp/cedet/semantic/sb.el @@ -279,7 +279,7 @@ Optional MODIFIERS is additional text needed for variables." (defun semantic-sb-show-extra (text token indent) "Display additional information about the token as an expansion. TEXT TOKEN and INDENT are the details." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -288,7 +288,7 @@ TEXT TOKEN and INDENT are the details." (narrow-to-region (point) (point)) ;; Add in stuff specific to this type of token. (semantic-sb-insert-details token (1+ indent)))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -325,7 +325,7 @@ TEXT TOKEN and INDENT are the details." (defun semantic-sb-expand-group (text token indent) "Expand a group which has semantic tokens. TEXT TOKEN and INDENT are the details." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -333,7 +333,7 @@ TEXT TOKEN and INDENT are the details." (save-restriction (narrow-to-region (point-min) (point)) (semantic-sb-buttons-plain (1+ indent) token))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 9ac4ed9f518..fb878dde712 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -555,7 +555,7 @@ SELF or the instance name \"self\" if SELF is nil." (rx-to-string `(seq string-start ,(or self "self") ".")) name) - (not (string-match "\\." (substring name 5))))))) + (not (string-search "." (substring name 5))))))) (defun semantic-python-docstring-p (tag) "Return non-nil, when TAG is a Python documentation string." diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 980a1cc7179..7eae2e416bb 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1910,7 +1910,7 @@ item in another window.\n\n")) (widget-put (get 'editable-field 'widget-type) :custom-show (lambda (_widget value) (let ((pp (pp-to-string value))) - (cond ((string-match-p "\n" pp) + (cond ((string-search "\n" pp) nil) ((> (length pp) 40) nil) diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 85017de5d5e..f5e467d37e7 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -50,7 +50,7 @@ (when (string-match-p "\n\\'" pp) (setq pp (substring pp 0 (1- (length pp))))) - (if (and (not (string-match-p "\n" pp)) + (if (and (not (string-search "\n" pp)) (<= (length pp) (- (window-width) (current-column)))) (insert pp) (insert-text-button diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 5dbd55849e9..0b8c693b29f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1288,7 +1288,7 @@ Return nil if no change in files." nil t) nil t))) ;; We found an uncompression rule. - (let ((match (string-match " " command)) + (let ((match (string-search " " command)) (msg (concat "Uncompressing " file))) (unless (if match (dired-check-process msg diff --git a/lisp/dired-x.el b/lisp/dired-x.el index a990bd3fec3..380e47786fc 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -1044,11 +1044,11 @@ results in len2 (length file2)) ;; Find common initial file name components: (let (next) - (while (and (setq next (string-match "/" file1 index)) + (while (and (setq next (string-search "/" file1 index)) (< (setq next (1+ next)) (min len1 len2)) ;; For the comparison, both substrings must end in ;; `/', so NEXT is *one plus* the result of the - ;; string-match. + ;; string-search. ;; E.g., consider the case of linking "/tmp/a/abc" ;; to "/tmp/abc" erroneously giving "/tmp/a" instead ;; of "/tmp/" as common initial component @@ -1066,7 +1066,7 @@ results in (start 0) (count 0)) ;; Count number of slashes we must compensate for ... - (while (setq start (string-match "/" tem start)) + (while (setq start (string-search "/" tem start)) (setq count (1+ count) start (1+ start))) ;; ... and prepend a "../" for each slash found: diff --git a/lisp/dired.el b/lisp/dired.el index 816b8b69881..ff822506bf1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2909,7 +2909,7 @@ dired-buffers." (if (= (aref pattern (1+ set-start)) ?^) (+ 3 set-start) (+ 2 set-start))) - (set-end (string-match-p "]" pattern set-cont)) + (set-end (string-search "]" pattern set-cont)) (set (substring pattern set-start (1+ set-end)))) (setq regexp (concat regexp set)) (setq matched-in-pattern (1+ set-end)))) diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el index 255edd0f371..e0a533c637a 100644 --- a/lisp/dos-fns.el +++ b/lisp/dos-fns.el @@ -86,7 +86,7 @@ sure to obey the 8.3 limitations." ;; close to the beginning, change that to a period. This ;; is so we could salvage more characters of the original ;; name by pushing them into the extension. - (if (and (not (string-match "\\." string)) + (if (and (not (string-search "." string)) (> (length string) 8) ;; We don't gain anything if we put the period closer ;; than 5 chars from the beginning (5 + 3 = 8). @@ -100,21 +100,21 @@ sure to obey the 8.3 limitations." ;; If we don't have a period in the first 8 chars, insert one. ;; This enables having 3 more characters from the original ;; name in the extension. - (if (> (or (string-match "\\." string) (length string)) + (if (> (or (string-search "." string) (length string)) 8) (setq string (concat (substring string 0 8) "." (substring string 8)))) - (setq firstdot (or (string-match "\\." string) + (setq firstdot (or (string-search "." string) (1- (length string)))) ;; Truncate to 3 chars after the first period. (if (> (length string) (+ firstdot 4)) (setq string (substring string 0 (+ firstdot 4)))) ;; Change all periods except the first one into underscores. ;; (DOS doesn't allow more than one period.) - (while (string-match "\\." string (1+ firstdot)) - (setq i (string-match "\\." string (1+ firstdot))) + (while (string-search "." string (1+ firstdot)) + (setq i (string-search "." string (1+ firstdot))) (aset string i ?_)) ;; If the last character of the original filename was `~' or `#', ;; make sure the munged name ends with it also. This is so that @@ -160,7 +160,7 @@ sure to obey the 8.3 limitations." (strlen (length string)) (lastchar (aref string (1- strlen))) firstdot) - (setq firstdot (string-match "\\." string)) + (setq firstdot (string-search "." string)) (cond (firstdot ;; Truncate the extension to 3 characters. diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 84de69a2ce1..9e4a71c336e 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -559,7 +559,7 @@ doubt, use whitespace." (or fkey key) " ")))) (if prefix (setq desc (concat (edmacro-sanitize-for-string prefix) desc))) - (unless (string-match " " desc) + (unless (string-search " " desc) (let ((times 1) (pos bind-len)) (while (not (cl-mismatch rest-mac rest-mac :start1 0 :end1 bind-len diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index 08a6debc203..9c842f46829 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -323,7 +323,7 @@ current expansion depth." (defun eieio-sb-expand (text class indent) "For button TEXT, expand CLASS at the current location. Argument INDENT is the depth of indentation." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -332,7 +332,7 @@ Argument INDENT is the depth of indentation." (while subclasses (eieio-class-button (car subclasses) (1+ indent)) (setq subclasses (cdr subclasses))))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/emacs-lisp/eieio-speedbar.el b/lisp/emacs-lisp/eieio-speedbar.el index 3f2a6537ab8..86b22cad73b 100644 --- a/lisp/emacs-lisp/eieio-speedbar.el +++ b/lisp/emacs-lisp/eieio-speedbar.el @@ -344,14 +344,14 @@ The object is at indentation level INDENT." (defun eieio-speedbar-object-expand (text token indent) "Expand object represented by TEXT. TOKEN is the object. INDENT is the current indentation level." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (oset token expanded t) (speedbar-with-writable (save-excursion (end-of-line) (forward-char 1) (eieio-speedbar-expand token (1+ indent))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (oset token expanded nil) (speedbar-delete-subblock indent)) diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index 83da495edf0..d6a6a5f0442 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -458,7 +458,7 @@ each line." "Return list of keywords given in file FILE." (let ((keywords (lm-keywords file))) (if keywords - (if (string-match-p "," keywords) + (if (string-search "," keywords) (split-string keywords ",[ \t\n]*" t "[ ]+") (split-string keywords "[ \t\n]+" t "[ ]+"))))) diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index 67de690e67d..36b275e2d3c 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -307,7 +307,7 @@ entirely by setting `warning-suppress-types' or 'type 'warning-suppress-log-warning 'warning-type type)) (funcall newline) - (when (and warning-fill-prefix (not (string-match "\n" message))) + (when (and warning-fill-prefix (not (string-search "\n" message))) (let ((fill-prefix warning-fill-prefix) (fill-column warning-fill-column)) (fill-region start (point)))) diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 5b2fa048a09..55930e7e6bc 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -1100,7 +1100,7 @@ reversed." (setq viper-keep-reading-filename nil val (read-file-name (concat prompt str) nil default-directory)) (setq val (expand-file-name val)) - (if (and (string-match " " val) + (if (and (string-search " " val) (ex-cmd-accepts-multiple-files-p ex-token)) (setq val (concat "\"" val "\""))) (setq str (concat str (if (equal val "") "" " ") @@ -2300,10 +2300,10 @@ Type `mak ' (including the space) to run make with no args." (defun ex-print-display-lines (lines) (cond ;; String doesn't contain a newline. - ((not (string-match "\n" lines)) + ((not (string-search "\n" lines)) (message "%s" lines)) ;; String contains only one newline at the end. Strip it off. - ((= (string-match "\n" lines) (1- (length lines))) + ((= (string-search "\n" lines) (1- (length lines))) (message "%s" (substring lines 0 -1))) ;; String spans more than one line. Use a temporary buffer. (t diff --git a/lisp/env.el b/lisp/env.el index 51247f1ff84..83f43d1006b 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -44,7 +44,7 @@ If it is also not t, RET does not exit if it does non-null completion." (completing-read prompt (mapcar (lambda (enventry) (let ((str (substring enventry 0 - (string-match "=" enventry)))) + (string-search "=" enventry)))) (if (multibyte-string-p str) (decode-coding-string str locale-coding-system t) @@ -184,7 +184,7 @@ a side-effect." (setq variable (encode-coding-string variable locale-coding-system))) (if (and value (multibyte-string-p value)) (setq value (encode-coding-string value locale-coding-system))) - (if (string-match-p "=" variable) + (if (string-search "=" variable) (error "Environment variable name `%s' contains `='" variable)) (if (string-equal "TZ" variable) (set-time-zone-rule value)) diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el index bed0c065aea..b9dd437ed12 100644 --- a/lisp/epa-mail.el +++ b/lisp/epa-mail.el @@ -219,7 +219,7 @@ If no one is selected, symmetric encryption will be performed. " (epa-mail--find-usable-key (epg-list-keys (epg-make-context epa-protocol) - (if (string-match "@" recipient) + (if (string-search "@" recipient) (concat "<" recipient ">") recipient)) 'encrypt))) diff --git a/lisp/epg.el b/lisp/epg.el index 36515ef4e5f..9d6295594fd 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -573,7 +573,7 @@ callback data (if any)." "--status-fd" "1" "--yes") (if (and (not (eq (epg-context-protocol context) 'CMS)) - (string-match ":" (or agent-info ""))) + (string-search ":" (or agent-info ""))) '("--use-agent")) (if (and (not (eq (epg-context-protocol context) 'CMS)) (epg-context-progress-callback context)) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 7a17ee233fd..6d84665873e 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -950,15 +950,15 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (unless (string= string "") ;; Ignore empty strings (save-match-data (let* ((tag-list (when (eq (aref string 0) ?@) - (substring string 1 (string-match " " string)))) + (substring string 1 (string-search " " string)))) (msg (make-erc-response :unparsed string :tags (when tag-list (erc-parse-tags tag-list)))) (string (if tag-list - (substring string (+ 1 (string-match " " string))) + (substring string (+ 1 (string-search " " string))) string)) (posn (if (eq (aref string 0) ?:) - (string-match " " string) + (string-search " " string) 0))) (setf (erc-response.sender msg) @@ -968,7 +968,7 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (setf (erc-response.command msg) (let* ((bposn (string-match "[^ \n]" string posn)) - (eposn (string-match " " string bposn))) + (eposn (string-search " " string bposn))) (setq posn (and eposn (string-match "[^ \n]" string eposn))) (substring string bposn eposn))) @@ -976,7 +976,7 @@ PROCs `process-buffer' is `current-buffer' when this function is called." (while (and posn (not (eq (aref string posn) ?:))) (push (let* ((bposn posn) - (eposn (string-match " " string bposn))) + (eposn (string-search " " string bposn))) (setq posn (and eposn (string-match "[^ \n]" string eposn))) (substring string bposn eposn)) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index fcdb8df2032..de72624aaa1 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -187,7 +187,7 @@ compared with `erc-nick-equal-p' which is IRC case-insensitive." (plist-get elt prop))) ;; if the property exists and is equal, we continue, else, try the ;; next element of the list - (or (and (eq prop :nick) (string-match "!" val) + (or (and (eq prop :nick) (string-search "!" val) test (string-equal test val)) (and (eq prop :nick) test val diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index bb858445235..e61e741302d 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -139,7 +139,7 @@ This will add a speedbar major display mode." t)))) (defun erc-speedbar-expand-server (text server indent) - (cond ((string-match "\\+" text) + (cond ((string-search "+" text) (speedbar-change-expand-button-char ?-) (if (speedbar-with-writable (save-excursion @@ -147,7 +147,7 @@ This will add a speedbar major display mode." (erc-speedbar-channel-buttons nil (1+ indent) server))) (speedbar-change-expand-button-char ?-) (speedbar-change-expand-button-char ??))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -184,7 +184,7 @@ This will add a speedbar major display mode." "For the line matching TEXT, in CHANNEL, expand or contract a line. INDENT is the current indentation level." (cond - ((string-match "\\+" text) + ((string-search "+" text) (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -233,7 +233,7 @@ INDENT is the current indentation level." (speedbar-with-writable (dolist (entry names) (erc-speedbar-insert-user entry ?+ (1+ indent)))))))))) - ((string-match "-" text) + ((string-search "-" text) (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -284,7 +284,7 @@ The update is only done when the channel is actually expanded already." (erc-speedbar-expand-channel "+" buffer 1))))) (defun erc-speedbar-expand-user (text token indent) - (cond ((string-match "\\+" text) + (cond ((string-search "+" text) (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion @@ -307,7 +307,7 @@ The update is only done when the channel is actually expanded already." nil nil nil nil info nil nil nil (1+ indent))))))) - ((string-match "-" text) + ((string-search "-" text) (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c66b03d2e4e..73202016ba7 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -5587,7 +5587,7 @@ This returns non-nil only if we actually send anything." (when (and (erc-input-sendp state) erc-send-this) (let ((string (erc-input-string state))) - (if (or (string-match "\n" string) + (if (or (string-search "\n" string) (not (string-match erc-command-regexp string))) (mapc (lambda (line) diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 316094b17e4..e36f2d0c7fe 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -291,7 +291,7 @@ the form: (let ((index 1)) (setq incl glob) (while (and (eq incl glob) - (setq index (string-match "~" glob index))) + (setq index (string-search "~" glob index))) (if (or (get-text-property index 'escaped glob) (or (= (1+ index) len))) (setq index (1+ index)) diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 96c9a60deab..7a0b26a0658 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -266,7 +266,7 @@ See `eshell-needs-pipe'." ;; neither 'first nor 'last? See bug#1388 discussion. (catch 'found (dolist (exe eshell-needs-pipe) - (if (string-equal exe (if (string-match "/" exe) + (if (string-equal exe (if (string-search "/" exe) command (file-name-nondirectory command))) (throw 'found t)))))) diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 30104816f07..72de6b13e2e 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -204,7 +204,7 @@ then quoting is done by a backslash, rather than a doubled delimiter." string (if (eq (aref string (1- len)) ?\n) (setq string (substring string 0 (1- len)))) - (if (string-match "\n" string) + (if (string-search "\n" string) (split-string string "\n") (if (and eshell-convert-numeric-arguments (string-match diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 9fccc6b1c9d..5dc6a193050 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -381,7 +381,7 @@ This function is explicit for adding to `eshell-parse-argument-hook'." (defun eshell-envvar-names (&optional environment) "Return a list of currently visible environment variable names." (mapcar (lambda (x) - (substring x 0 (string-match "=" x))) + (substring x 0 (string-search "=" x))) (or environment process-environment))) (defun eshell-environment-variables () diff --git a/lisp/faces.el b/lisp/faces.el index 4bb3a2b00fc..a3a6f1b78dd 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -3062,7 +3062,7 @@ also the same size as FACE on FRAME, or fail." (let ((fonts (x-list-fonts pattern face frame 1))) (or fonts (if face - (if (string-match-p "\\*" pattern) + (if (string-search "*" pattern) (if (null (face-font face)) (error "No matching fonts are the same height as the frame default font") (error "No matching fonts are the same height as face `%s'" face)) diff --git a/lisp/ffap.el b/lisp/ffap.el index 9be9c2906ea..0069af25974 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1418,7 +1418,7 @@ which may actually result in an URL rather than a filename." (string (ffap-string-at-point)) ; uses mode alist (name (or (condition-case nil - (and (not (string-match "//" string)) ; foo.com://bar + (and (not (string-search "//" string)) ; foo.com://bar (substitute-in-file-name string)) (error nil)) string)) diff --git a/lisp/files.el b/lisp/files.el index 54d0b919e1d..6c366177ce8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6979,7 +6979,7 @@ by `sh' are supported." (prog1 ; copy everything upto next `]'. (substring wildcard i - (setq j (string-match + (setq j (string-search "]" wildcard i))) (setq i (if j (1- j) (1- len))))))) ((eq ch ?.) "\\.") @@ -7105,7 +7105,7 @@ need to be passed verbatim to shell commands." ;; DOS/Windows don't allow `"' in file names. So if the ;; argument has quotes, we can safely assume it is already ;; quoted by the caller. - (if (or (string-match "[\"]" pattern) + (if (or (string-search "\"" pattern) ;; We quote [&()#$`'] in case their shell is a port of a ;; Unixy shell. We quote [,=+] because stock DOS and ;; Windows shells require that in some cases, such as diff --git a/lisp/forms.el b/lisp/forms.el index 8696aea98ee..46f4df9b6c4 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -1576,7 +1576,7 @@ As a side effect: sets `forms--the-record-list'." (forms--trans the-record "\n" forms-multi-line)) ;; A final sanity check before updating. - (if (string-match-p "\n" the-record) + (if (string-search "\n" the-record) (error "Multi-line fields in this record - update refused")) (with-current-buffer forms--file-buffer diff --git a/lisp/frameset.el b/lisp/frameset.el index e698d5401db..6aa94f8be5a 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -636,7 +636,7 @@ see `frameset-filter-alist'." (not (frameset-switch-to-gui-p parameters)) (let* ((prefix:p (symbol-name (car current))) (p (intern (substring prefix:p - (1+ (string-match-p ":" prefix:p))))) + (1+ (string-search ":" prefix:p))))) (val (cdr current)) (found (assq p filtered))) (if (not found) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index d65e75e44c2..3c1403e1551 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2519,7 +2519,7 @@ If PROMPT (the prefix), prompt for a coding system to use." format (and ctl (mail-content-type-get ctl 'format))) (when cte (setq cte (mail-header-strip-cte cte))) - (if (and ctl (not (string-match "/" (car ctl)))) + (if (and ctl (not (string-search "/" (car ctl)))) (setq ctl nil)) (goto-char (point-max))) (forward-line 1) diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el index f73627a6480..525823e72ce 100644 --- a/lisp/gnus/gnus-kill.el +++ b/lisp/gnus/gnus-kill.el @@ -435,7 +435,7 @@ Returns the number of articles marked as read." ;; The "f:+" command marks everything *but* the matches as read, ;; so we simply first match everything as read, and then unmark ;; PATTERN later. - (when (string-match "\\+" commands) + (when (string-search "+" commands) (gnus-kill "from" ".") (setq commands "m")) diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el index 664027f0164..6adda2ed147 100644 --- a/lisp/gnus/gnus-mlspl.el +++ b/lisp/gnus/gnus-mlspl.el @@ -169,7 +169,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns: (when (not (null params)) (let ((split-spec (assoc 'split-spec params)) group-clean) ;; Remove backend from group name - (setq group-clean (string-match ":" group)) + (setq group-clean (string-search ":" group)) (setq group-clean (if group-clean (substring group (1+ group-clean)) diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index db54237a767..ef89e6e9fcb 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1323,7 +1323,7 @@ For the \"inline\" alternatives, also see the variable ((stringp self) (insert "Gcc: " (encode-coding-string - (if (string-match " " self) + (if (string-search " " self) (concat "\"" self "\"") self) (gnus-group-name-charset (gnus-inews-group-method self) @@ -1681,7 +1681,7 @@ this is a reply." (gnus-group-find-parameter group 'gcc-self t))) (gcc-self-get (lambda (gcc-self-val group) (if (stringp gcc-self-val) - (if (string-match " " gcc-self-val) + (if (string-search " " gcc-self-val) (concat "\"" gcc-self-val "\"") gcc-self-val) ;; In nndoc groups, we use the parent group name @@ -1689,7 +1689,7 @@ this is a reply." (let ((group (or (gnus-group-find-parameter gnus-newsgroup-name 'parent-group) group))) - (if (string-match " " group) + (if (string-search " " group) (concat "\"" group "\"") group))))) result @@ -1752,11 +1752,11 @@ this is a reply." (gnus-delete-line))) ;; Use the list of groups. (while (setq name (pop groups)) - (let ((str (if (string-match ":" name) + (let ((str (if (string-search ":" name) name (gnus-group-prefixed-name name gnus-message-archive-method)))) - (insert (if (string-match " " str) + (insert (if (string-search " " str) (concat "\"" str "\"") str))) (when groups diff --git a/lisp/gnus/gnus-rfc1843.el b/lisp/gnus/gnus-rfc1843.el index 5697c870888..c135ecea369 100644 --- a/lisp/gnus/gnus-rfc1843.el +++ b/lisp/gnus/gnus-rfc1843.el @@ -44,7 +44,7 @@ (case-fold-search t) (ct (message-fetch-field "Content-Type" t)) (ctl (and ct (mail-header-parse-content-type ct)))) - (if (and ctl (not (string-match "/" (car ctl)))) + (if (and ctl (not (string-search "/" (car ctl)))) (setq ctl nil)) (goto-char (point-max)) (widen) diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 59b8efaa3ac..2a8069d400c 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1392,7 +1392,7 @@ Returns a list of [group article score] vectors." (if (string-match-p "\\`[[:digit:]]+\\'" article) (string-to-number article) (nnmaildir-base-name-to-article-number - (substring article 0 (string-match ":" article)) + (substring article 0 (string-search ":" article)) group (string-remove-prefix "nnmaildir:" server)))) (when (and (numberp article) (or (null groups) @@ -2136,7 +2136,7 @@ article came from is also searched." ;; If the value contains spaces, make sure it's ;; quoted. (when (and (memql status '(exact finished)) - (or (string-match-p " " str) + (or (string-search " " str) in-string)) (unless (looking-at-p "\\s\"") (insert "\"")) diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el index cb60108ea9c..59c6956ac2f 100644 --- a/lisp/gnus/gnus-spec.el +++ b/lisp/gnus/gnus-spec.el @@ -582,7 +582,7 @@ or to characters when given a pad value." ((string= fstring "") nil) ;; Not a format string. - ((not (string-match "%" fstring)) + ((not (string-search "%" fstring)) (list fstring)) ;; A format string with just a single string spec. ((string= fstring "%s") diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index dc004927b67..856e95c0ba0 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -9199,7 +9199,7 @@ specified by the `gnus-refer-thread-limit' variable." (unless (string-match ">$" message-id) (setq message-id (concat message-id ">"))) ;; People often post MIDs from URLs, so unhex it: - (unless (string-match "@" message-id) + (unless (string-search "@" message-id) (setq message-id (gnus-url-unhex-string message-id))) (let* ((header (gnus-id-to-header message-id)) (sparse (and header diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 7a5e00c5ec9..70ae81d95ea 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -154,7 +154,7 @@ is slower." (and (string-match "(.+)" from) (setq name (substring from (1+ (match-beginning 0)) (1- (match-end 0))))) - (and (string-match "()" from) + (and (string-search "()" from) (setq name address)) ;; XOVER might not support folded From headers. (and (string-match "(.*" from) @@ -265,7 +265,7 @@ If END is non-nil, use the end of the span instead." (defun gnus-newsgroup-directory-form (newsgroup) "Make hierarchical directory name from NEWSGROUP name." (let* ((newsgroup (gnus-newsgroup-savable-name newsgroup)) - (idx (string-match ":" newsgroup))) + (idx (string-search ":" newsgroup))) (concat (if idx (substring newsgroup 0 idx)) (if idx "/") diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el index ceb2ebcdcb1..6c926384c97 100644 --- a/lisp/gnus/gnus-uu.el +++ b/lisp/gnus/gnus-uu.el @@ -1434,7 +1434,7 @@ When called interactively, prompt for REGEXP." "View FILE using the gnus-uu methods." (let ((action (gnus-uu-get-action file))) (gnus-execute-command - (if (string-match "%" action) + (if (string-search "%" action) (format action file) (concat action " " file)) (eq gnus-view-pseudos 'not-confirm)))) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 8b93accccad..d52bd26a2cb 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -3526,7 +3526,7 @@ You should probably use `gnus-find-method-for-group' instead." (defun gnus-group-native-p (group) "Say whether the group is native or not." - (not (string-match ":" group))) + (not (string-search ":" group))) (defun gnus-group-secondary-p (group) "Say whether the group is secondary or not." @@ -3742,13 +3742,13 @@ just the host name." ;; Separate foreign select method from group name and collapse. ;; If method contains a server, collapse to non-domain server name, ;; otherwise collapse to select method. - (let* ((colon (string-match ":" group)) + (let* ((colon (string-search ":" group)) (server (and colon (substring group 0 colon))) - (plus (and server (string-match "\\+" server)))) + (plus (and server (string-search "+" server)))) (when server (if plus (setq foreign (substring server (+ 1 plus) - (string-match "\\." server)) + (string-search "." server)) group (substring group (+ 1 colon))) (setq foreign server group (substring group (+ 1 colon)))) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a3ffaec3ff3..bff1b2a60d9 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5340,7 +5340,7 @@ Otherwise, generate and save a value for `canlock-password' first." (followup-to (message-fetch-field "followup-to")) to) (when (and newsgroups - (string-match "," newsgroups) + (string-search "," newsgroups) (not followup-to) (not (zerop @@ -5371,11 +5371,11 @@ Otherwise, generate and save a value for `canlock-password' first." (message-id (message-fetch-field "message-id" t))) (or (not message-id) ;; Is there an @ in the ID? - (and (string-match "@" message-id) + (and (string-search "@" message-id) ;; Is there a dot in the ID? (string-match "@[^.]*\\." message-id) ;; Does the ID end with a dot? - (not (string-match "\\.>" message-id))) + (not (string-search ".>" message-id))) (y-or-n-p (format "The Message-ID looks strange: \"%s\". Really post? " message-id))))) @@ -5497,8 +5497,8 @@ Otherwise, generate and save a value for `canlock-password' first." "@[^\\.]*\\." (setq ad (nth 1 (mail-extract-address-components from))))) ;larsi@ifi - (string-match "\\.\\." ad) ;larsi@ifi..uio - (string-match "@\\." ad) ;larsi@.ifi.uio + (string-search ".." ad) ;larsi@ifi..uio + (string-search "@." ad) ;larsi@.ifi.uio (string-match "\\.$" ad) ;larsi@ifi.uio. (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio (string-match "(.*).*(.*)" from)) ;(lars) (lars) @@ -5523,7 +5523,7 @@ Otherwise, generate and save a value for `canlock-password' first." (cond ((not reply-to) t) - ((string-match "," reply-to) + ((string-search "," reply-to) (y-or-n-p (format "Multiple Reply-To addresses: \"%s\". Really post? " reply-to))) @@ -5531,8 +5531,8 @@ Otherwise, generate and save a value for `canlock-password' first." "@[^\\.]*\\." (setq ad (nth 1 (mail-extract-address-components reply-to))))) ;larsi@ifi - (string-match "\\.\\." ad) ;larsi@ifi..uio - (string-match "@\\." ad) ;larsi@.ifi.uio + (string-search ".." ad) ;larsi@ifi..uio + (string-search "@." ad) ;larsi@.ifi.uio (string-match "\\.$" ad) ;larsi@ifi.uio. (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio (string-match "(.*).*(.*)" reply-to)) ;(lars) (lars) @@ -5806,7 +5806,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'." (mail-header-subject message-reply-headers)) (message-strip-subject-re psubject)))) (and psupersedes - (string-match "_-_@" psupersedes))) + (string-search "_-_@" psupersedes))) "_-_" "")) "@" (message-make-fqdn) ">")) @@ -6022,7 +6022,7 @@ give as trustworthy answer as possible." "Return the pertinent part of `user-mail-address'." (when (and user-mail-address (string-match "@.*\\." user-mail-address)) - (if (string-match " " user-mail-address) + (if (string-search " " user-mail-address) (nth 1 (mail-extract-address-components user-mail-address)) user-mail-address))) @@ -6053,7 +6053,7 @@ give as trustworthy answer as possible." message-user-fqdn) ;; A system name without any dots is unlikely to be a good fully ;; qualified domain name. - ((and (string-match "[.]" sysname) + ((and (string-search "." sysname) (not (string-match message-bogus-system-names sysname))) ;; `system-name' returned the right result. sysname) @@ -7053,7 +7053,7 @@ article, it has the value of " mft " -which directs your response to " (if (string-match "," mft) +which directs your response to " (if (string-search "," mft) "the specified addresses" "that address only") ". @@ -7357,7 +7357,7 @@ want to get rid of this query permanently.")) You should normally obey the Followup-To: header. `Followup-To: " followup-to "' -directs your response to " (if (string-match "," followup-to) +directs your response to " (if (string-search "," followup-to) "the specified newsgroups" "that newsgroup only") ". diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 02cd6af0c98..82d1de25f3d 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -649,7 +649,7 @@ MIME-Version header before proceeding." (setq description (mail-decode-encoded-word-string description))))) (if (or (not ctl) - (not (string-match "/" (car ctl)))) + (not (string-search "/" (car ctl)))) (mm-dissect-singlepart (list mm-dissect-default-type) (and cte (intern (downcase (mail-header-strip-cte cte)))) diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index 708887cb9c7..c35e89289a2 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -803,7 +803,7 @@ If FORMAT isn't a format string, it and all ARGS will be inserted without formatting." (with-current-buffer nntp-server-buffer (erase-buffer) - (if (string-match "%" format) + (if (string-search "%" format) (insert (apply #'format format args)) (apply #'insert format args)) t)) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 3cf65453f3b..8a48cd87dba 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -1299,7 +1299,7 @@ If LIMIT, first try to limit the search to the N last articles." (when (and (nnimap-greeting nnimap-object) (string-match greeting-match (nnimap-greeting nnimap-object)) (eq type 'append) - (string-match "\000" data)) + (string-search "\000" data)) (let ((choice (gnus-multiple-choice "Message contains NUL characters. Delete, continue, abort? " '((?d "Delete NUL characters") @@ -1761,7 +1761,7 @@ If LIMIT, first try to limit the search to the N last articles." (let ((result nil)) (dolist (elem (split-string irange ",")) (push - (if (string-match ":" elem) + (if (string-search ":" elem) (let ((numbers (split-string elem ":"))) (cons (string-to-number (car numbers)) (string-to-number (cadr numbers)))) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 372df64e2e5..171f0813b38 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -87,7 +87,7 @@ See `nnmaildir-flag-mark-mapping'." (defun nnmaildir--ensure-suffix (filename) "Ensure that FILENAME contains the suffix \":2,\"." - (if (string-match-p ":2," filename) + (if (string-search ":2," filename) filename (concat filename ":2,"))) diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index c6aaf460ece..92944887f44 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el @@ -1629,7 +1629,7 @@ SERVER." (while (string-match "[<>]" mid) (setq mid (replace-match "" t t mid))) ;; mairix somehow does not like '$' in message-id - (when (string-match "\\$" mid) + (when (string-search "$" mid) (setq mid (concat mid "="))) (while (string-match "\\$" mid) (setq mid (replace-match "=," t t mid))) diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el index 8cd8cbe84f1..0f12ee0e9d2 100644 --- a/lisp/gnus/nnrss.el +++ b/lisp/gnus/nnrss.el @@ -849,7 +849,7 @@ DATA should be the output of `xml-parse-region'." (defmacro nnrss-match-macro (base-uri item onsite-list offsite-list) `(cond ((or (string-match (concat "^" ,base-uri) ,item) - (not (string-match "://" ,item))) + (not (string-search "://" ,item))) (setq ,onsite-list (append ,onsite-list (list ,item)))) (t (setq ,offsite-list (append ,offsite-list (list ,item)))))) diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 1fd2ed06eba..615a3c931bf 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el @@ -1697,7 +1697,7 @@ If SEND-IF-FORCE, only send authinfo to the server if the ;; article comes from that group, I'd say. ((and (setq newsgroups (mail-fetch-field "newsgroups")) - (not (string-match "," newsgroups))) + (not (string-search "," newsgroups))) newsgroups) ;; If there is more than one group in the ;; Newsgroups header, then the Xref header should @@ -1725,7 +1725,7 @@ If SEND-IF-FORCE, only send authinfo to the server if the number (string-to-number (match-string 2 xref)))) ((and (setq newsgroups (mail-fetch-field "newsgroups")) - (not (string-match "," newsgroups))) + (not (string-search "," newsgroups))) (setq group newsgroups)) (group) (t (setq group "")))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index d7fb038f45a..2c7956d9680 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -154,7 +154,7 @@ with the current prefix. The files are chosen according to (mapcar (lambda (c) (let* ((s (intern c)) (doc (condition-case nil (documentation s) (error nil))) - (doc (and doc (substring doc 0 (string-match "\n" doc))))) + (doc (and doc (substring doc 0 (string-search "\n" doc))))) (list c (propertize (format "%-4s" (help--symbol-class s)) 'face 'completions-annotations) diff --git a/lisp/help.el b/lisp/help.el index ba27fc5810f..29ae3404813 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1912,7 +1912,7 @@ the same names as used in the original source code, when possible." (let ((name (symbol-name arg))) (if (eq (aref name 0) ?&) (memq arg '(&rest &optional)) - (not (string-match "\\." name))))) + (not (string-search "." name))))) (setq valid nil))) (when valid arglist))) (let* ((arity (func-arity def)) diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el index cbb69b206d4..4fadbbe4180 100644 --- a/lisp/hippie-exp.el +++ b/lisp/hippie-exp.el @@ -507,8 +507,8 @@ otherwise." "Try to slam together two parts of a file specification, system dependently." (cond ((null dir-part) name-part) ((eq system-type 'ms-dos) - (if (and (string-match "\\\\" dir-part) - (not (string-match "/" dir-part)) + (if (and (string-search "\\" dir-part) + (not (string-search "/" dir-part)) (= (aref name-part (1- (length name-part))) ?/)) (aset name-part (1- (length name-part)) ?\\)) (concat dir-part name-part)) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index b453061388f..3b961989e3e 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1902,7 +1902,7 @@ tree depth, as determined from FILE (a filename). START is the offset at which to start looking for the / character in FILE." ;;(message "hfy-relstub");;DBUG (let ((c "")) - (while (setq start (string-match "/" file start)) + (while (setq start (string-search "/" file start)) (setq start (1+ start)) (setq c (concat c "../"))) c)) diff --git a/lisp/ido.el b/lisp/ido.el index ea5ff32b8d7..b81a9db5eb9 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1770,7 +1770,7 @@ is enabled then some keybindings are changed in the keymap." (let ((l (length dirname))) (if (and max-width (> max-width 0) (> l max-width)) (let* ((s (substring dirname (- max-width))) - (i (string-match "/" s))) + (i (string-search "/" s))) (concat "..." (if i (substring s i) s))) dirname))))) (t prompt))) @@ -2516,7 +2516,7 @@ If cursor is not at the end of the user input, move to end of input." ;; Do nothing ) ((and (memq ido-cur-item '(file dir)) - (string-match "[$]" ido-text)) + (string-search "$" ido-text)) (let ((evar (substitute-in-file-name (concat ido-current-directory ido-text)))) (if (not (file-exists-p (file-name-directory evar))) (message "Expansion generates non-existing directory name") @@ -3089,7 +3089,7 @@ If repeated, insert text from buffer instead." (setq ido-text-init word ido-try-merged-list nil ido-exit 'chdir)) - ((string-match "/" word) + ((string-search "/" word) (setq ido-text-init (concat ido-current-directory word) ido-try-merged-list nil ido-exit 'chdir)) @@ -4559,7 +4559,7 @@ For details of keybindings, see `ido-find-file'." (setq try-single-dir-match t)))) ((and (string-equal (substring contents -2 -1) "/") - (not (string-match "[$]" contents))) + (not (string-search "$" contents))) (ido-set-current-directory (cond ((= (length contents) 2) @@ -4656,7 +4656,7 @@ For details of keybindings, see `ido-find-file'." (memq ido-cur-item '(file dir)) (not (ido-is-root-directory)) (> (length contents) 1) - (not (string-match "[$]" contents)) + (not (string-search "$" contents)) (not ido-directory-nonreadable) (not ido-directory-too-big)) (ido-trace "merge?") diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index 97bf1ac058c..75d2e6692c0 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -78,7 +78,7 @@ is a string, it should be a MIME format string like (string-match image-converter-regexp source)) (and data-p (symbolp data-p) - (string-match "/" (symbol-name data-p)) + (string-search "/" (symbol-name data-p)) (string-match image-converter-regexp (concat "foo." (image-converter--mime-type data-p))))) diff --git a/lisp/info-xref.el b/lisp/info-xref.el index 538a017f3c0..e2e3e30ca21 100644 --- a/lisp/info-xref.el +++ b/lisp/info-xref.el @@ -547,7 +547,7 @@ the sources handy." ;; skip nodes with "%" as probably `format' strings such as in ;; info-look.el - (unless (string-match "%" node) + (unless (string-search "%" node) ;; "(emacs)" is the default manual for docstring hyperlinks, ;; per `help-make-xrefs' diff --git a/lisp/info.el b/lisp/info.el index 1c477a7082f..3718a1eb83f 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -2483,7 +2483,7 @@ Table of contents is created from the tree structure of menus." (match-string-no-properties 1))) (section "Top") menu-items) - (when (and upnode (string-match "(" upnode)) (setq upnode nil)) + (when (and upnode (string-search "(" upnode)) (setq upnode nil)) (when (and (not (Info-index-node nodename file)) (re-search-forward "^\\* Menu:" bound t)) (forward-line 1) @@ -2616,7 +2616,7 @@ new buffer." (let (target i (str (concat "\\*note " (regexp-quote footnotename))) (case-fold-search t)) - (while (setq i (string-match " " str i)) + (while (setq i (string-search " " str i)) (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) (setq i (+ i 6))) (save-excursion @@ -2933,7 +2933,7 @@ last sub-node, if any; otherwise go \"up\" to the parent node." (let ((prevnode (Info-extract-pointer "prev[ious]*" t)) (upnode (Info-extract-pointer "up" t)) (case-fold-search t)) - (cond ((and upnode (string-match "(" upnode)) + (cond ((and upnode (string-search "(" upnode)) (user-error "First node in file")) ((and upnode (or (null prevnode) ;; Use string-equal, not equal, @@ -3778,7 +3778,7 @@ Build a menu of the possible matches." "The following packages match the keyword ‘" nodename "’:\n\n") (insert "* Menu:\n\n") (let ((keywords - (mapcar #'intern (if (string-match-p "," nodename) + (mapcar #'intern (if (string-search "," nodename) (split-string nodename ",[ \t\n]*" t) (list nodename)))) hits desc) @@ -5244,7 +5244,7 @@ The INDENT level is ignored." TEXT is the text of the button we clicked on, a + or - item. TOKEN is data related to this node (NAME . FILE). INDENT is the current indentation depth." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (if (speedbar-with-writable (save-excursion @@ -5252,7 +5252,7 @@ INDENT is the current indentation depth." (Info-speedbar-hierarchy-buttons nil (1+ indent) token))) (speedbar-change-expand-button-char ?-) (speedbar-change-expand-button-char ??))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index 2d3cd25b4a4..02169ceb689 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -905,13 +905,13 @@ The IGNORED argument is ignored." (setq family "*-*") (if (symbolp family) (setq family (symbol-name family))) - (or (string-match "-" family) + (or (string-search "-" family) (setq family (concat "*-" family)))) (if (not registry) (setq registry "*-*") (if (symbolp registry) (setq registry (symbol-name registry))) - (or (string-match "-" registry) + (or (string-search "-" registry) (= (aref registry (1- (length registry))) ?*) (setq registry (concat registry "*")))) (insert (format"\n -%s-%s-%s-%s-%s-*-*-*-*-*-*-%s" diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el index b999eff662f..121a4c542e7 100644 --- a/lisp/language/korea-util.el +++ b/lisp/language/korea-util.el @@ -29,7 +29,7 @@ ;;;###autoload (defvar default-korean-keyboard - (purecopy (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) + (purecopy (if (string-search "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "")) "The kind of Korean keyboard for Korean (Hangul) input method. diff --git a/lisp/linum.el b/lisp/linum.el index b0281d366cd..c78f596d768 100644 --- a/lisp/linum.el +++ b/lisp/linum.el @@ -219,7 +219,7 @@ Linum mode is a buffer-local minor mode." ;; update overlays on deletions, and after newlines are inserted (when (or (= beg end) (= end (point-max)) - (string-match-p "\n" (buffer-substring-no-properties beg end))) + (string-search "\n" (buffer-substring-no-properties beg end))) (linum-update-current))) (defun linum-after-scroll (win _start) diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 2d683574743..b1682cf78a2 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el @@ -236,7 +236,7 @@ If DECODE, the DISPLAY-NAME will have RFC2047 decoding performed (setq display-string (ietf-drums-get-comment string))) (if (not mailbox) (when (and display-string - (string-match "@" display-string)) + (string-search "@" display-string)) (cons (mapconcat #'identity (nreverse display-name) "") (ietf-drums-get-comment string))) diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index bb1f8f13bac..3eb3ccb93de 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -252,7 +252,7 @@ comma-separated list, and return the pruned list." (setq cur-pos (string-match "[,\"]" destinations cur-pos)) (if (and cur-pos (equal (match-string 0 destinations) "\"")) ;; Search for matching quote. - (let ((next-pos (string-match "\"" destinations (1+ cur-pos)))) + (let ((next-pos (string-search "\"" destinations (1+ cur-pos)))) (if next-pos (setq cur-pos (1+ next-pos)) ;; If the open-quote has no close-quote, diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index 5b08713949f..c442913d282 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el @@ -612,7 +612,7 @@ should not change this value.") (setq next prev prev nil) (if (or (< index limit) - (<= (+ len (or (string-match "\n" tail) + (<= (+ len (or (string-search "\n" tail) (length tail))) rfc2047-encode-max-chars)) (setq prev next @@ -1111,7 +1111,7 @@ strings are stripped." "Decode MIME-encoded STRING and return the result. If ADDRESS-MIME is non-nil, strip backslashes which precede characters other than `\"' and `\\' in quoted strings." - (if (string-match "=\\?" string) + (if (string-search "=?" string) (with-temp-buffer ;; We used to only call mm-enable-multibyte if `m' is non-nil, ;; but this can't be the right criterion. Don't just revert this diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el index db34fd2cb9e..a398ce0e9cc 100644 --- a/lisp/mail/rfc2231.el +++ b/lisp/mail/rfc2231.el @@ -61,12 +61,12 @@ must never cause a Lisp error." ;; make it parsable. Let's try... (error (let (mod) - (when (and (string-match "\\\\\"" string) + (when (and (string-search "\\\"" string) (not (string-match "\\`\"\\|[^\\]\"" string))) (setq string (string-replace "\\\"" "\"" string) mod t)) - (when (and (string-match "\\\\(" string) - (string-match "\\\\)" string) + (when (and (string-search "\\(" string) + (string-search "\\)" string) (not (string-match "\\`(\\|[^\\][()]" string))) (setq string (replace-regexp-in-string "\\\\\\([()]\\)" "\\1" string) diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el index acbb5880b5c..58a8eb7a370 100644 --- a/lisp/mail/rmailkwd.el +++ b/lisp/mail/rmailkwd.el @@ -93,7 +93,7 @@ according to the choice made, and returns a symbol." "Set LABEL as present or absent according to STATE in message MSG. LABEL may be a symbol or string." (or (stringp label) (setq label (symbol-name label))) - (if (string-match "," label) + (if (string-search "," label) (error "More than one label specified")) (with-current-buffer rmail-buffer (rmail-maybe-set-message-counters) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index ac933b9706d..9dd9573a9fc 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -759,7 +759,7 @@ the message being processed." ;; If there are multiple lines in FROM, ;; discard up to the last newline in it. (while (and (stringp from) - (setq newline (string-match "\n" from))) + (setq newline (string-search "\n" from))) (setq from (substring from (1+ newline)))) (if (or (null from) (string-match diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 8e3927cdcf2..ec9f340db86 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -516,7 +516,7 @@ for `smtpmail-try-auth-method'.") (defun smtpmail-maybe-append-domain (recipient) (if (or (not smtpmail-sendto-domain) - (string-match "@" recipient)) + (string-search "@" recipient)) recipient (concat recipient "@" smtpmail-sendto-domain))) @@ -700,7 +700,7 @@ Returns an error if the server cannot be contacted." (let ((parts (split-string user-mail-address "@"))) (and (= (length parts) 2) ;; There's a dot in the domain name. - (string-match "\\." (cadr parts)) + (string-search "." (cadr parts)) user-mail-address)))) (defun smtpmail-via-smtp (recipient smtpmail-text-buffer diff --git a/lisp/mail/uce.el b/lisp/mail/uce.el index 9ebffef2e59..b07004de38c 100644 --- a/lisp/mail/uce.el +++ b/lisp/mail/uce.el @@ -246,10 +246,10 @@ You might need to set `uce-mail-reader' before using this." (if reply-to (setq to (format "%s, %s" to (mail-strip-quoted-names reply-to)))) (let (first-at-sign end-of-hostname sender-host) - (setq first-at-sign (string-match "@" to) + (setq first-at-sign (string-search "@" to) end-of-hostname (string-match "[ ,>]" to first-at-sign) sender-host (substring to first-at-sign end-of-hostname)) - (if (string-match "\\." sender-host) + (if (string-search "." sender-host) (setq to (format "%s, postmaster%s, abuse%s" to sender-host sender-host)))) (setq mail-send-actions nil) @@ -291,7 +291,7 @@ You might need to set `uce-mail-reader' before using this." (search-forward " ") (forward-char -1) ;; And add its postmaster to the list of addresses. - (if (string-match "\\." (buffer-substring temp (point))) + (if (string-search "." (buffer-substring temp (point))) (setq to (format "%s, postmaster@%s" to (buffer-substring temp (point))))) ;; Also look at the message-id, it helps *very* often. @@ -302,7 +302,7 @@ You might need to set `uce-mail-reader' before using this." (setq temp (point)) (search-forward ">") (forward-char -1) - (if (string-match "\\." (buffer-substring temp (point))) + (if (string-search "." (buffer-substring temp (point))) (setq to (format "%s, postmaster@%s" to (buffer-substring temp (point))))))) (when (eq uce-mail-reader 'gnus) diff --git a/lisp/man.el b/lisp/man.el index 54b6ffe9836..6009a319198 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -801,7 +801,7 @@ POS defaults to `point'." ;; doesn't include a hyphen, we consider the hyphen to be ;; added by troff, and remove it. (or (not (eq (string-to-char (substring 1st-part -1)) ?-)) - (string-match-p "-" (substring 1st-part 0 -1)) + (string-search "-" (substring 1st-part 0 -1)) (setq word (string-replace "-" "" word)))) ;; Make sure the section number gets included by the code below. (goto-char (match-end 1))) diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index 415e9848258..37fdb166011 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -111,10 +111,10 @@ COMMA-SEPARATOR is non-nil." (string-match "^\\([^,]+\\)," res)) (setq res (match-string 1 res))) ;; Replace "&" with capitalized username - (if (string-match "&" res) + (if (string-search "&" res) (setq res (mh-replace-regexp-in-string "&" (capitalize username) res))) ;; Remove " character - (if (string-match "\"" res) + (if (string-search "\"" res) (setq res (mh-replace-regexp-in-string "\"" "" res))) ;; If empty string, use username instead (if (string-equal "" res) @@ -285,7 +285,7 @@ Blind aliases or users from /etc/passwd are not expanded." (message "%s -> %s" the-name (mh-alias-expand the-name)) ;; Check if it was a single word likely to be an alias (if (and (equal mh-alias-flash-on-comma 1) - (not (string-match " " the-name))) + (not (string-search " " the-name))) (message "No alias for %s" the-name)))))) (self-insert-command 1)) diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index b64bbfb6f3b..4fae69defaf 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -637,8 +637,8 @@ See also `mh-compose-forward-as-mime-flag', (defun mh-forwarded-letter-subject (from subject) "Return a Subject suitable for a forwarded message. Original message has headers FROM and SUBJECT." - (let ((addr-start (string-match "<" from)) - (comment (string-match "(" from))) + (let ((addr-start (string-search "<" from)) + (comment (string-search "(" from))) (cond ((and addr-start (> addr-start 0)) ;; Full Name (setq from (substring from 0 (1- addr-start)))) diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index 3af840c3a31..76ef990d825 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -441,7 +441,7 @@ be handled next." (position 0) line-end line folder unseen total) (unwind-protect - (while (setq line-end (string-match "\n" output position)) + (while (setq line-end (string-search "\n" output position)) (setq line (format "%s%s" mh-speed-partial-line (substring output position line-end)) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index 8e900dc0113..bbce17013b1 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -378,7 +378,7 @@ names and the function is called when OUTPUT is available." (prevailing-match-data (match-data)) line-end folder) (unwind-protect - (while (setq line-end (string-match "\n" output position)) + (while (setq line-end (string-search "\n" output position)) (setq folder (format "+%s%s" mh-flists-partial-line (substring output position line-end))) @@ -702,7 +702,7 @@ See Info node `(elisp) Programmed Completion' for details." (let ((slash (mh-search-from-end ?/ orig-name))) (if slash (1+ slash) (if (string-match "\\`\\+" orig-name) 1 0))) - (if (cdr flag) (string-match "/" (cdr flag))))) + (if (cdr flag) (string-search "/" (cdr flag))))) ((eq flag nil) (let ((try-res (try-completion diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 2c6340e1c3e..9f327df28f5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2741,7 +2741,7 @@ Useful to give the user default values that won't be substituted." (defun completion--make-envvar-table () (mapcar (lambda (enventry) - (substring enventry 0 (string-match-p "=" enventry))) + (substring enventry 0 (string-search "=" enventry))) process-environment)) (defconst completion--embedded-envvar-re @@ -2810,7 +2810,7 @@ same as `substitute-in-file-name'." pred action)) ((eq (car-safe action) 'boundaries) (let ((start (length (file-name-directory string))) - (end (string-match-p "/" (cdr action)))) + (end (string-search "/" (cdr action)))) `(boundaries ;; if `string' is "C:" in w32, (file-name-directory string) ;; returns "C:/", so `start' is 3 rather than 2. @@ -3988,7 +3988,7 @@ which is at the core of flex logic. The extra (defun completion-flex-try-completion (string table pred point) "Try to flex-complete STRING in TABLE given PRED and POINT." - (unless (and completion-flex-nospace (string-match-p " " string)) + (unless (and completion-flex-nospace (string-search " " string)) (pcase-let ((`(,all ,pattern ,prefix ,suffix ,_carbounds) (completion-substring--all-completions string table pred point @@ -4005,7 +4005,7 @@ which is at the core of flex logic. The extra (defun completion-flex-all-completions (string table pred point) "Get flex-completions of STRING in TABLE, given PRED and POINT." - (unless (and completion-flex-nospace (string-match-p " " string)) + (unless (and completion-flex-nospace (string-search " " string)) (pcase-let ((`(,all ,pattern ,prefix ,_suffix ,_carbounds) (completion-substring--all-completions string table pred point diff --git a/lisp/mpc.el b/lisp/mpc.el index e04ffa49747..029f0ca8f42 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -305,7 +305,7 @@ defaults to 6600 and HOST defaults to localhost." (defun mpc--proc-quote-string (s) (if (numberp s) (number-to-string s) (setq s (replace-regexp-in-string "[\"\\]" "\\\\\\&" s)) - (if (string-match " " s) (concat "\"" s "\"") s))) + (if (string-search " " s) (concat "\"" s "\"") s))) (defconst mpc--proc-alist-to-alists-starters '(file directory)) @@ -611,7 +611,7 @@ Any call to `mpc-status-refresh' may cause it to be restarted." (defun mpc-cmd-special-tag-p (tag) (or (memq tag '(Playlist Search Directory)) - (string-match "|" (symbol-name tag)))) + (string-search "|" (symbol-name tag)))) (defun mpc-cmd-find (tag value) "Return a list of all songs whose tag TAG has value VALUE. @@ -1438,7 +1438,7 @@ when constructing the set of constraints." (let (res) (dolist (constraint constraints) (when (or (eq (car constraint) buffer-tag) - (and (string-match "|" (symbol-name buffer-tag)) + (and (string-search "|" (symbol-name buffer-tag)) (member (symbol-name (car constraint)) (split-string (symbol-name buffer-tag) "|")))) (setq res (cdr constraint)))) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 3f3a3df8e55..e302aa89f30 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -2296,7 +2296,7 @@ and NOWAIT." ;; If the dir name contains a space, some ftp servers will ;; refuse to list it. We instead change directory to the ;; directory in question and ls ".". - (when (string-match " " cmd1) + (when (string-search " " cmd1) ;; Keep the result. In case of failure, we will (see below) ;; short-circuit CMD and return this result directly. (setq result (ange-ftp-cd host user (nth 1 cmd) 'noerror)) @@ -2881,13 +2881,13 @@ NO-ERROR, if a listing for DIRECTORY cannot be obtained." (or ;; No dots in dir names in vms. (and (eq host-type 'vms) - (string-match "\\." efile)) + (string-search "." efile)) ;; No subdirs in mts of cms. (and (memq host-type '(mts cms)) (not (string-equal "/" (nth 2 parsed)))) ;; No dots in pseudo-dir names in bs2000. (and (eq host-type 'bs2000) - (string-match "\\." efile)))))) + (string-search "." efile)))))) (defun ange-ftp-file-entry-p (name) "Given NAME, return whether there is a file entry for it." diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index aeeb9bd8d3b..5473ba7e697 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -1075,7 +1075,7 @@ For instance, \"foo.png\" will result in \"image/png\"." (dolist (data mailcap--computed-mime-data) (dolist (info (cdr data)) (setq type (cdr (assq 'type (cdr info)))) - (unless (string-match-p "\\*" type) + (unless (string-search "*" type) (push type res)))) (nreverse res))))) diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el index e1d35c2a85a..727aa55de58 100644 --- a/lisp/net/mairix.el +++ b/lisp/net/mairix.el @@ -422,7 +422,7 @@ with m:msgid of the current article and enabled threads." (while (string-match "[<>]" mid) (setq mid (replace-match "" t t mid))) ;; mairix somehow does not like '$' in message-id - (when (string-match "\\$" mid) + (when (string-search "$" mid) (setq mid (concat mid "="))) (while (string-match "\\$" mid) (setq mid (replace-match "=," t t mid))) diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index cb49f75c81d..a267ac319b6 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -551,8 +551,8 @@ Returns the process associated with the connection." (when result (let ((response (plist-get (cdr result) :greeting))) (setq pop3-timestamp - (substring response (or (string-match "<" response) 0) - (+ 1 (or (string-match ">" response) -1))))) + (substring response (or (string-search "<" response) 0) + (+ 1 (or (string-search ">" response) -1))))) (set-process-query-on-exit-flag (car result) nil) (erase-buffer) (car result))))) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index f5480afb698..de1cd9d320f 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -1938,7 +1938,7 @@ This is a specialization of `soap-decode-type' for (e-name (soap-xs-element-name element)) ;; Heuristic: guess if we need to decode using local ;; namespaces. - (use-fq-names (string-match ":" (symbol-name (car node)))) + (use-fq-names (string-search ":" (symbol-name (car node)))) (children (if e-name (if use-fq-names ;; Find relevant children diff --git a/lisp/net/socks.el b/lisp/net/socks.el index 1da1d31d678..78a261fd83e 100644 --- a/lisp/net/socks.el +++ b/lisp/net/socks.el @@ -277,7 +277,7 @@ (setq version (process-get proc 'socks-server-protocol)) (cond ((equal version 'http) - (if (not (string-match "\r\n\r\n" string)) + (if (not (string-search "\r\n\r\n" string)) nil ; Need to spin some more (process-put proc 'socks-state socks-state-connected) (process-put proc 'socks-reply 0) diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index 6dca34a80f2..c265b19cf05 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el @@ -633,7 +633,7 @@ non-transparent child section." tag-qnames)))) (defun nxml-highlighted-qname (qname) - (let ((colon (string-match ":" qname))) + (let ((colon (string-search ":" qname))) (if colon (concat (propertize (substring qname 0 colon) 'face diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index d820d1b99b5..dd3000773fd 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el @@ -179,7 +179,7 @@ Return a pattern." (setq rng-c-default-namespace rng-c-inherit-namespace))) (defun rng-c-expand-name (prefixed-name) - (let ((i (string-match ":" prefixed-name))) + (let ((i (string-search ":" prefixed-name))) (rng-make-name (rng-c-lookup-prefix (substring prefixed-name 0 i)) @@ -222,7 +222,7 @@ and URI is a symbol.") (cdr binding))) (defun rng-c-expand-datatype (prefixed-name) - (let ((i (string-match ":" prefixed-name))) + (let ((i (string-search ":" prefixed-name))) (rng-make-datatype (rng-c-lookup-datatype-prefix (substring prefixed-name 0 i)) (substring prefixed-name (+ i 1))))) diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index fda481fa281..24f4d2ec443 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el @@ -93,7 +93,7 @@ Signal an error if URI is not a valid file URL." (rng-uri-error "`?' not escaped in file URI `%s'" uri)) (when fragment-id (rng-uri-error "URI `%s' has a fragment identifier" uri)) - (when (string-match ";" path) + (when (string-search ";" path) (rng-uri-error "`;' not escaped in URI `%s'" uri)) (when (string-match "%2[fF]" path) ;; 2f is hex code of slash (rng-uri-error "Escaped slash in URI `%s'" uri)) @@ -110,7 +110,7 @@ Signal an error if URI is not a valid file URL." (rng-uri-unescape-unibyte-replace path 2)) (t (rng-uri-unescape-unibyte path)))) - (when (string-match "\000" path) + (when (string-search "\000" path) (rng-uri-error "URI `%s' has NUL character in path" uri)) (when (eq pattern 'match) (setq path diff --git a/lisp/obsolete/complete.el b/lisp/obsolete/complete.el index 1c1167db89b..2d3be2dd9a4 100644 --- a/lisp/obsolete/complete.el +++ b/lisp/obsolete/complete.el @@ -243,7 +243,7 @@ second TAB brings up the `*Completions*' buffer." (when (and partial-completion-mode (null PC-env-vars-alist)) (setq PC-env-vars-alist (mapcar (lambda (string) - (let ((d (string-match "=" string))) + (let ((d (string-search "=" string))) (cons (concat "$" (substring string 0 d)) (and d (substring string (1+ d)))))) process-environment)))) @@ -575,7 +575,7 @@ GOTO-END is non-nil, however, it instead replaces up to END." p (+ p (length PC-ndelims-regex) 1))))) (setq p 0) (if filename - (while (setq p (string-match "\\\\\\*" regex p)) + (while (setq p (string-search "\\*" regex p)) (setq regex (concat (substring regex 0 p) "[^/]*" (substring regex (+ p 2)))))) diff --git a/lisp/obsolete/longlines.el b/lisp/obsolete/longlines.el index 9676d6b28e9..9bf68456826 100644 --- a/lisp/obsolete/longlines.el +++ b/lisp/obsolete/longlines.el @@ -393,11 +393,11 @@ compatibility with `format-alist', and is ignored." "Return a copy of STRING with each soft newline replaced by a space. Hard newlines are left intact." (let* ((str (copy-sequence string)) - (pos (string-match "\n" str))) + (pos (string-search "\n" str))) (while pos (if (null (get-text-property pos 'hard str)) (aset str pos ? )) - (setq pos (string-match "\n" str (1+ pos)))) + (setq pos (string-search "\n" str (1+ pos)))) str)) ;;; Auto wrap diff --git a/lisp/obsolete/nnir.el b/lisp/obsolete/nnir.el index caeca988810..9aab1e7c9f5 100644 --- a/lisp/obsolete/nnir.el +++ b/lisp/obsolete/nnir.el @@ -509,7 +509,7 @@ construct the vector entries." (vector (gnus-group-full-name group server) (if (string-match "\\`nnmaildir:" (gnus-group-server server)) (nnmaildir-base-name-to-article-number - (substring article 0 (string-match ":" article)) + (substring article 0 (string-search ":" article)) group nil) (string-to-number article)) (string-to-number score))))) diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el index dbfc79bf913..0167a00066b 100644 --- a/lisp/obsolete/terminal.el +++ b/lisp/obsolete/terminal.el @@ -1222,7 +1222,7 @@ of the terminal-emulator" (cond ((string-match "\\`[-a-zA-Z0-9+=_.@/:]+\\'" string) string) - ((not (string-match "[$]" string)) + ((not (string-search "$" string)) ;; "[\"\\]" are special to sh and the lisp reader in the same way (prin1-to-string string)) (t diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el index 1340618f055..e0e89c390ea 100644 --- a/lisp/obsolete/tpu-edt.el +++ b/lisp/obsolete/tpu-edt.el @@ -1415,9 +1415,9 @@ If an argument is specified, don't set the search direction." ;; if using regexp, eliminate upper case forms (\B \W \S.) (if tpu-regexp-p (let ((pat (copy-sequence string)) (case-fold-search nil) (pos 0)) - (while (setq pos (string-match "\\\\\\\\" pat)) (aset pat (+ 1 pos) ?.)) - (while (setq pos (string-match "\\\\B" pat)) (aset pat (+ 1 pos) ?.)) - (while (setq pos (string-match "\\\\W" pat)) (aset pat (+ 1 pos) ?.)) + (while (setq pos (string-search "\\\\" pat)) (aset pat (+ 1 pos) ?.)) + (while (setq pos (string-search "\\B" pat)) (aset pat (+ 1 pos) ?.)) + (while (setq pos (string-search "\\W" pat)) (aset pat (+ 1 pos) ?.)) (while (setq pos (string-match "\\\\S." pat)) (aset pat (+ 1 pos) ?.) (aset pat (+ 2 pos) ?.)) (string-equal pat (downcase pat))) diff --git a/lisp/obsolete/url-ns.el b/lisp/obsolete/url-ns.el index b62ad829990..6cd6693fc43 100644 --- a/lisp/obsolete/url-ns.el +++ b/lisp/obsolete/url-ns.el @@ -31,7 +31,7 @@ ;;;###autoload (defun isPlainHostName (host) - (not (string-match "\\." host))) + (not (string-search "." host))) ;;;###autoload (defun dnsDomainIs (host dom) diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el index e1d104f74ff..49dc2d2fc6c 100644 --- a/lisp/pcmpl-unix.el +++ b/lisp/pcmpl-unix.el @@ -214,7 +214,7 @@ Includes files as well as host names followed by a colon." (list string) (completion-table-subvert (pcomplete-all-entries) "" "/ssh:"))) - ((string-match "/" string) ; Local file name. + ((string-search "/" string) ; Local file name. (pcomplete-all-entries)) (t ;Host name or local file name. (append (all-completions string (pcomplete-all-entries)) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 3bb8bf0c82b..9d5ee261976 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -2170,7 +2170,7 @@ other words." (let (pos ret-list end-pos) (setq pos 0) (setq ret-list nil) - (while (setq end-pos (string-match " " (substring strin pos))) + (while (setq end-pos (string-search " " (substring strin pos))) (setq end-pos (+ end-pos pos)) (if (not (= end-pos pos)) (setq ret-list (append ret-list (list @@ -2269,7 +2269,7 @@ except for the verb." startlist (if (string= (substring dirstring 0 1) "/") (dun-get-path (substring dirstring 1) (append startlist (list "/"))) - (if (not (setq slash (string-match "/" dirstring))) + (if (not (setq slash (string-search "/" dirstring))) (append startlist (list dirstring)) (dun-get-path (substring dirstring (1+ slash)) (append startlist @@ -2348,7 +2348,7 @@ Also prints current score to let user know he has scored." (princ dun-line) (if (eq (dun-parse2 nil dun-unix-verbs dun-line) -1) (progn - (if (setq esign (string-match "=" dun-line)) + (if (setq esign (string-search "=" dun-line)) (dun-doassign dun-line esign) (dun-mprinc (car dun-line-list)) (dun-mprincl ": not found."))))) @@ -2380,21 +2380,21 @@ Also prints current score to let user know he has scored." (dun-mprinc line) (dun-mprincl " : not found.")) - (if (not (setq epoint (string-match ")" line))) + (if (not (setq epoint (string-search ")" line))) (if (string= (substring line (1+ esign) (+ esign 2)) "\"") (progn (setq afterq (substring line (+ esign 2))) (setq epoint (+ - (string-match "\"" afterq) + (string-search "\"" afterq) (+ esign 3)))) - (if (not (setq epoint (string-match " " line))) + (if (not (setq epoint (string-search " " line))) (setq epoint (length line)))) (setq epoint (1+ epoint)) (while (and (not (= epoint (length line))) - (setq i (string-match ")" (substring line epoint)))) + (setq i (string-search ")" (substring line epoint)))) (setq epoint (+ epoint i 1)))) (setq value (substring line (1+ esign) epoint)) (dun-eval varname value))))) @@ -2788,7 +2788,7 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") (cond ((null (setq args (car args))) (dun-mprincl "Usage: cat ")) - ((string-match-p "/" args) + ((string-search "/" args) (dun-mprincl "cat: only files in current directory allowed.")) ((and (> dun-cdroom 0) (string= args "description")) (dun-mprincl (car (nth dun-cdroom dun-rooms)))) @@ -3110,7 +3110,7 @@ File not found"))) (setq dun-line (downcase (dun-read-line))) (if (eq (dun-parse2 nil dun-unix-verbs dun-line) -1) (let (esign) - (if (setq esign (string-match "=" dun-line)) + (if (setq esign (string-search "=" dun-line)) (dun-doassign dun-line esign) (dun-mprinc (car dun-line-list)) (dun-mprincl ": not found."))))) diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index a00440d898c..884104a16f7 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -4337,7 +4337,7 @@ end (let ((len (1- (length str))) (index 0) new start fmt) - (while (setq start (string-match "%" str index)) + (while (setq start (string-search "%" str index)) (setq fmt (if (< start len) (aref str (1+ start)) ?\?) new (concat new (substring str index start) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 97596d0d278..67ad39b7f46 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1382,7 +1382,7 @@ With arg, enter name of variable to be watched in the minibuffer." (string-match "\\(\\S-+\\)" text) (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) (varnum (car var))) - (if (string-match "\\." (car var)) + (if (string-search "." (car var)) (message-box "Can only delete a root expression") (gdb-var-delete-1 var varnum))))) @@ -1479,14 +1479,14 @@ With arg, enter name of variable to be watched in the minibuffer." TEXT is the text of the button we clicked on, a + or - item. TOKEN is data related to this node. INDENT is the current indentation depth." - (cond ((string-match "\\+" text) ;expand this node + (cond ((string-search "+" text) ;expand this node (let* ((var (assoc token gdb-var-list)) (expr (nth 1 var)) (children (nth 2 var))) (if (or (<= (string-to-number children) gdb-max-children) (y-or-n-p (format "%s has %s children. Continue? " expr children))) (gdb-var-list-children token)))) - ((string-match "-" text) ;contract this node + ((string-search "-" text) ;contract this node (dolist (var gdb-var-list) (if (string-match (concat token "\\.") (car var)) (setq gdb-var-list (delq var gdb-var-list)))) @@ -2416,7 +2416,7 @@ rule from an incomplete data stream. The parser will stay in this state until the end of the current result or async record is reached." (when (< gdbmi-bnf-offset (length gud-marker-acc)) ;; Search the data stream for the end of the current record: - (let* ((newline-pos (string-match "\n" gud-marker-acc gdbmi-bnf-offset)) + (let* ((newline-pos (string-search "\n" gud-marker-acc gdbmi-bnf-offset)) (is-progressive (equal (cdr class-command) 'progressive)) (is-complete (not (null newline-pos))) result-str) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 05ad82acc4a..08814ebcaaa 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -3150,7 +3150,7 @@ Obeying it means displaying in another window the specified file and line." (buffer-substring (region-beginning) (region-end)) (apply gud-find-expr-function args)))) (save-match-data - (if (string-match "\n" expr) + (if (string-search "\n" expr) (error "Expression must not include a newline")) (with-current-buffer gud-comint-buffer (save-excursion diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el index db76df96a56..c53b9a4775c 100644 --- a/lisp/progmodes/idlw-help.el +++ b/lisp/progmodes/idlw-help.el @@ -495,7 +495,7 @@ It collects and prints the diagnostics messages." ((and (memq cw '(function-keyword procedure-keyword)) (stringp this-word) (string-match "\\S-" this-word) - (not (string-match "!" this-word))) + (not (string-search "!" this-word))) (cond ((or (= (char-before beg) ?/) (save-excursion (goto-char end) (looking-at "[ \t]*="))) diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index ad8feb988f5..eb88f25dfd6 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -967,7 +967,7 @@ IDL has currently stepped.") ;; Strip those pesky ctrl-m's. (add-hook 'comint-output-filter-functions (lambda (string) - (when (string-match "\r" string) + (when (string-search "\r" string) (let ((pmark (process-mark (get-buffer-process (current-buffer))))) (save-excursion @@ -1409,7 +1409,7 @@ Remove everything to the first newline, and all lines with % in front of them, with optional follow-on lines starting with two spaces. This works well enough, since any print output typically arrives before error messages, etc." - (setq output (substring output (string-match "\n" output))) + (setq output (substring output (string-search "\n" output))) (while (string-match "\\(\n\\|\\`\\)%.*\\(\n .*\\)*" output) (setq output (replace-match "" nil t output))) (unless @@ -1431,12 +1431,12 @@ and then calls `idlwave-shell-send-command' for any pending commands." (unwind-protect (progn ;; Ring the bell if necessary - (while (setq p (string-match "\C-G" string)) + (while (setq p (string-search "\C-G" string)) (ding) (aset string p ?\C-j )) (if idlwave-shell-hide-output (save-excursion - (while (setq p (string-match "\C-M" string)) + (while (setq p (string-search "\C-M" string)) (aset string p ?\ )) (set-buffer (get-buffer-create idlwave-shell-hidden-output-buffer)) @@ -1445,7 +1445,7 @@ and then calls `idlwave-shell-send-command' for any pending commands." (comint-output-filter proc string)) ;; Watch for magic - need to accumulate the current line ;; since it may not be sent all at once. - (if (string-match "\n" string) + (if (string-search "\n" string) (progn (if idlwave-shell-use-input-mode-magic (idlwave-shell-input-mode-magic diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index b55a98af0b3..55e712dd77d 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -2547,7 +2547,7 @@ If there is no label point is not moved and nil is returned." (end (idlwave-find-key ":" 1 'nomark eos))) (if (and end (= (nth 0 (parse-partial-sexp start end)) 0) - (not (string-match "\\?" (buffer-substring start end))) + (not (string-search "?" (buffer-substring start end))) (not (string-match "^::" (buffer-substring end eos)))) (progn (forward-char) @@ -7677,9 +7677,9 @@ arg, the class property is cleared out." (interactive "P") (idlwave-routines) - (if (string-match "->" (buffer-substring - (max (point-min) (1- (point))) - (min (+ 2 (point)) (point-max)))) + (if (string-search "->" (buffer-substring + (max (point-min) (1- (point))) + (min (+ 2 (point)) (point-max)))) ;; Cursor is on an arrow (if (get-text-property (point) 'idlwave-class) ;; arrow has class property diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index aff3066c698..b1a5f301587 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -895,7 +895,7 @@ startup file, `~/.emacs-octave'." (defun inferior-octave-completion-at-point () "Return the data to complete the Octave symbol at point." ;; https://debbugs.gnu.org/14300 - (unless (string-match-p "/" (or (comint--match-partial-filename) "")) + (unless (string-search "/" (or (comint--match-partial-filename) "")) (let ((beg (save-excursion (skip-syntax-backward "w_" (comint-line-beginning-position)) (point))) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 91db4ae21cb..2f98b9c53c1 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -2672,7 +2672,7 @@ t means to return a list of all possible completions of STRING. (or sh-shell-variables-initialized (sh-shell-initialize-variables)) (nconc (mapcar (lambda (var) - (substring var 0 (string-match "=" var))) + (substring var 0 (string-search "=" var))) process-environment) sh-shell-variables)))) (complete-with-action code vars string predicate))) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index b9012166a52..d144d68b571 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -1573,7 +1573,7 @@ statement. The format of variable should be a valid face))) (defun sql-regexp-abbrev (keyword) - (let ((brk (string-match "[~]" keyword)) + (let ((brk (string-search "~" keyword)) (len (length keyword)) (sep "\\(?:") re i) diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el index 613863dd613..70763319840 100644 --- a/lisp/progmodes/xscheme.el +++ b/lisp/progmodes/xscheme.el @@ -936,7 +936,7 @@ the remaining input.") (setq call-noexcursion nil) (with-current-buffer (process-buffer proc) (cond ((eq xscheme-process-filter-state 'idle) - (let ((start (string-match "\e" xscheme-filter-input))) + (let ((start (string-search "\e" xscheme-filter-input))) (if start (progn (xscheme-process-filter-output @@ -960,7 +960,7 @@ the remaining input.") (xscheme-process-filter-output ?\e char) (setq xscheme-process-filter-state 'idle))))))) ((eq xscheme-process-filter-state 'reading-string) - (let ((start (string-match "\e" xscheme-filter-input))) + (let ((start (string-search "\e" xscheme-filter-input))) (if start (let ((string (concat xscheme-string-accumulator diff --git a/lisp/replace.el b/lisp/replace.el index c67877efd5d..1d6f091dc71 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -310,7 +310,7 @@ the original string if not." ;; but not after (quote foo). (and (eq (car-safe (car pos)) 'quote) (not (= ?\( (aref to 0))))) - (eq (string-match " " to (cdr pos)) + (eq (string-search " " to (cdr pos)) (cdr pos))) (1+ (cdr pos)) (cdr pos)))) @@ -633,13 +633,13 @@ Arguments REGEXP, START, END, and REGION-NONCONTIGUOUS-P are passed to (if (listp to-strings) (setq replacements to-strings) (while (/= (length to-strings) 0) - (if (string-match " " to-strings) + (if (string-search " " to-strings) (setq replacements (append replacements (list (substring to-strings 0 - (string-match " " to-strings)))) + (string-search " " to-strings)))) to-strings (substring to-strings - (1+ (string-match " " to-strings)))) + (1+ (string-search " " to-strings)))) (setq replacements (append replacements (list to-strings)) to-strings "")))) (perform-replace regexp replacements t t nil n nil start end nil region-noncontiguous-p))) diff --git a/lisp/shell.el b/lisp/shell.el index 5aab80d1031..292f267d2e1 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1252,7 +1252,7 @@ Returns t if successful." (list start end (lambda (string pred action) - (if (string-match "/" string) + (if (string-search "/" string) (completion-file-name-table string pred action) (complete-with-action action completions string pred))) :exit-function @@ -1328,7 +1328,7 @@ Returns non-nil if successful." (looking-at "\\$?[({]*") (match-end 0))) (variables (mapcar (lambda (x) - (substring x 0 (string-match "=" x))) + (substring x 0 (string-search "=" x))) process-environment)) (suffix (pcase (char-before start) (?\{ "}") (?\( ")") (_ "")))) (list start end variables diff --git a/lisp/simple.el b/lisp/simple.el index 3ad8634975f..985beb06fc9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4272,11 +4272,11 @@ the contents are inserted into the buffer anyway. Optional arguments ACTION and FRAME are as for `display-buffer', and are used only if a pop-up buffer is displayed." - (cond ((and (stringp message) (not (string-match "\n" message))) + (cond ((and (stringp message) (not (string-search "\n" message))) ;; Trivial case where we can use the echo area (message "%s" message)) ((and (stringp message) - (= (string-match "\n" message) (1- (length message)))) + (= (string-search "\n" message) (1- (length message)))) ;; Trivial case where we can just remove single trailing newline (message "%s" (substring message 0 (1- (length message))))) (t diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 34fbec9c218..3cc3e276067 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -3270,7 +3270,7 @@ Handles end-of-sublist smartly." Clicking this button expands or contracts a directory. TEXT is the button clicked which has either a + or -. TOKEN is the directory to be expanded. INDENT is the current indentation level." - (cond ((string-match "\\+" text) ;we have to expand this dir + (cond ((string-search "+" text) ;we have to expand this dir (setq speedbar-shown-directories (cons (expand-file-name (concat (speedbar-line-directory indent) token "/")) @@ -3283,7 +3283,7 @@ expanded. INDENT is the current indentation level." (speedbar-default-directory-list (concat (speedbar-line-directory indent) token "/") (1+ indent))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-reset-scanners) (let ((oldl speedbar-shown-directories) (newl nil) @@ -3317,7 +3317,7 @@ INDENT is the current indentation level and is unused." The parameter TEXT and TOKEN are required, where TEXT is the button clicked, and TOKEN is the file to expand. INDENT is the current indentation level." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (let* ((fn (expand-file-name (concat (speedbar-line-directory indent) token))) (lst (speedbar-fetch-dynamic-tags fn))) @@ -3329,7 +3329,7 @@ indentation level." (save-excursion (end-of-line) (forward-char 1) (funcall (car lst) indent (cdr lst))))))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) @@ -3358,14 +3358,14 @@ INDENT is the current indentation level." "Expand a tag sublist. Imenu will return sub-lists of specialized tag types. Etags does not support this feature. TEXT will be the button string. TOKEN will be the list, and INDENT is the current indentation level." - (cond ((string-match "\\+" text) ;we have to expand this file + (cond ((string-search "+" text) ;we have to expand this file (speedbar-change-expand-button-char ?-) (speedbar-with-writable (save-excursion (end-of-line) (forward-char 1) (speedbar-insert-generic-list indent token 'speedbar-tag-expand 'speedbar-tag-find)))) - ((string-match "-" text) ;we have to contract this node + ((string-search "-" text) ;we have to contract this node (speedbar-change-expand-button-char ?+) (speedbar-delete-subblock indent)) (t (error "Ooops... not sure what to do"))) diff --git a/lisp/subr.el b/lisp/subr.el index 87298b5cfde..1cae3ee1a60 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4808,7 +4808,7 @@ It understands Emacs Lisp quoting within STRING, such that (split-string-and-unquote (combine-and-quote-strings strs)) == strs The SEPARATOR regexp defaults to \"\\s-+\"." (let ((sep (or separator "\\s-+")) - (i (string-match "\"" string))) + (i (string-search "\"" string))) (if (null i) (split-string string sep t) ; no quoting: easy (append (unless (eq i 0) (split-string (substring string 0 i) sep t)) diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 3f0cca0ab7a..411c71cd8c4 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -962,7 +962,7 @@ return nil. Otherwise point is returned." (new-buffer-file-name (expand-file-name ;; `:' is not allowed on Windows (concat tarname "!" - (if (string-match "/" name) + (if (string-search "/" name) name ;; Make sure `name' contains a / ;; so set-auto-mode doesn't try diff --git a/lisp/term.el b/lisp/term.el index 27f0bb1be3b..b3870a814d2 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -3488,9 +3488,9 @@ The top-most line is line 0." ((= (aref string 0) ?\032) ;; gdb (when invoked with -fullname) prints: ;; \032\032FULLFILENAME:LINENUMBER:CHARPOS:BEG_OR_MIDDLE:PC\n - (let* ((first-colon (string-match ":" string 1)) + (let* ((first-colon (string-search ":" string 1)) (second-colon - (string-match ":" string (1+ first-colon))) + (string-search ":" string (1+ first-colon))) (filename (substring string 1 first-colon)) (fileline (string-to-number (substring string (1+ first-colon) second-colon)))) @@ -4307,7 +4307,7 @@ well as the newer ports COM10 and higher." (when (or (null x) (and (stringp x) (zerop (length x)))) (error "No serial port selected")) (when (not (or (serial-port-is-file-p) - (string-match "\\\\" x))) + (string-search "\\" x))) (setq x (concat "\\\\.\\" x))) x)) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 31186fb4fac..5cece1aa3c6 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3962,7 +3962,7 @@ Optional arg COMMA is as in `bibtex-enclosing-field'. It is t for interactive calls." (interactive (list nil t)) (unless field (setq field (car (bibtex-find-text-internal nil nil comma)))) - (if (string-match "@" field) + (if (string-search "@" field) (cond ((bibtex-string= field "@string") (message "String definition")) ((bibtex-string= field "@preamble") diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 4c64531ea35..67852998f42 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -2497,7 +2497,7 @@ if defined." "Customize `ispell-alternate-dictionary' to set yours."))) (let* ((process-connection-type ispell-use-ptys-p) - (wild-p (string-match "\\*" word)) + (wild-p (string-search "*" word)) (look-p (and ispell-look-p ; Only use look for an exact match. (or ispell-have-new-look (not wild-p)))) (prog (if look-p ispell-look-command ispell-grep-command)) @@ -2560,7 +2560,7 @@ if defined." (continue t) end) (while continue - (setq end (string-match "\n" output start)) ; get text up to the newline. + (setq end (string-search "\n" output start)) ; get text up to the newline. ;; If we get out of sync and ispell-filter-continue is asserted when we ;; are not continuing, treat the next item as a separate list. When ;; ispell-filter-continue is asserted, ispell-filter *should* always be a @@ -2732,11 +2732,11 @@ Optional third arg SHIFT is an offset to apply based on previous corrections." (if (eq type ?#) (setq count 0) ; no misses for type # (setq count (string-to-number output) ; get number of misses. - output (substring output (1+ (string-match " " output 1))))) + output (substring output (1+ (string-search " " output 1))))) (setq offset (string-to-number output)) (setq output (if (eq type ?#) ; No miss or guess list. nil - (substring output (1+ (string-match " " output 1))))) + (substring output (1+ (string-search " " output 1))))) (while output (let ((end (string-match ", \\|\\($\\)" output))) ; end of miss/guess. (setq cur-count (1+ cur-count)) @@ -4077,7 +4077,7 @@ Includes LaTeX/Nroff modes and extended character mode." (ispell-send-string "+\n~tex\n")) ((string-match "nroff-mode" string) (ispell-send-string "-\n~nroff\n")) - ((string-match "~" string) ; Set extended character mode. + ((string-search "~" string) ; Set extended character mode. (ispell-send-string (concat string "\n"))) (t (message "Invalid Ispell Parsing argument!") (sit-for 2)))))))) diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 650d11d4aca..895064b82f3 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -718,7 +718,7 @@ While entering the regexp, completion on knows citation keys is possible. (insert string)) ;; Reposition cursor? - (when (string-match "\\?" string) + (when (string-search "?" string) (search-backward "?") (delete-char 1)) diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el index 0157f8443aa..9def10cee05 100644 --- a/lisp/textmodes/reftex-parse.el +++ b/lisp/textmodes/reftex-parse.el @@ -757,7 +757,7 @@ if the information is exact (t) or approximate (nil)." (while (and (setq tail (memq (assq 'toc (cdr tail)) tail)) (setq entry (car tail)) (>= (nth 5 entry) level)) - (setq star (string-match "\\*" (nth 6 entry)) + (setq star (string-search "*" (nth 6 entry)) context (nth 2 entry) section-number (reftex-section-number (nth 5 entry) star)) diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 611102ecbac..19081825931 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -798,7 +798,7 @@ When called with 2 C-u prefix args, disable magic word recognition." (push (cons (current-buffer) buffer-invisibility-spec) reftex-buffers-with-changed-invisibility) (setq buffer-invisibility-spec nil)) - ((string-match "\r" (buffer-substring beg end)) + ((string-search "\r" (buffer-substring beg end)) ;; Invisible with selective display. We need to copy it. (let ((string (buffer-substring-no-properties beg end))) (switch-to-buffer "*RefTeX Context Copy*") diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index c732299361c..1cb2cf40c3b 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -813,7 +813,7 @@ This enforces rescanning the buffer on next use." (setq wordlist (nthcdr 4 entry))) (if (and (stringp fmt) - (string-match "@" fmt)) + (string-search "@" fmt)) ;; Special syntax for specifying a label format (setq fmt (split-string fmt "@+")) (setq fmt (list "\\label{%s}" fmt))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index d9d8059f960..5169377c136 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2072,7 +2072,7 @@ Return the process in which TeX is running." (let* ((cmd (eval command t)) (proc (tex-shell-proc)) (buf (process-buffer proc)) - (star (string-match "\\*" cmd)) + (star (string-search "*" cmd)) (string (concat (if (null file) @@ -2474,7 +2474,7 @@ Only applies the FSPEC to the args part of FORMAT." (defun tex-start-tex (command file &optional dir) "Start a TeX run, using COMMAND on FILE." - (let* ((star (string-match "\\*" command)) + (let* ((star (string-search "*" command)) (compile-command (if star (concat (substring command 0 star) @@ -2773,7 +2773,7 @@ so normally SUFFIX starts with one." ;; Not found, so split on first period. (concat (file-name-directory file-name) (substring file 0 - (string-match "\\." file)) + (string-search "." file)) suffix))) " ")) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 5bbf1a85b36..66bbfb0f9f6 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -492,7 +492,7 @@ looks like an email address, \"ftp://\" if it starts with (and (string-match "\\`[[:alnum:]]+\\'" str) (eq (char-before (car bounds)) ?<) (eq (char-after (cdr bounds)) ?>) - (not (string-match "~" (expand-file-name (concat "~" str)))) + (not (string-search "~" (expand-file-name (concat "~" str)))) (setq str (concat "mailto:" str))) ;; If it looks like news.example.com, treat it as news. (if (thing-at-point-newsgroup-p str) diff --git a/lisp/tmm.el b/lisp/tmm.el index 2040f522700..71082bd2f4b 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -268,7 +268,7 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (cdr elt))) (t (let* ((str (car elt)) - (paren (string-match "(" str)) + (paren (string-search "(" str)) (pos 0) (word 0) char) (catch 'done ; ??? is this slow? (while (and (or (not tmm-shortcut-words) ; no limit on words diff --git a/lisp/transient.el b/lisp/transient.el index 4087a0c68a6..5f441e80ddd 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3073,7 +3073,7 @@ Optional support for popup buttons is also implemented here." ;; the definition, then we want to drop the space that ;; is reinserted above. False-positives are possible ;; for silly bindings like "-C-c C-c". - (unless (string-match-p " " key) + (unless (string-search " " key) (setq pre (string-replace " " "" pre)) (setq suf (string-replace " " "" suf))) (concat (propertize pre 'face 'default) diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el index f291414e81b..06cfacc99d6 100644 --- a/lisp/url/url-auth.el +++ b/lisp/url/url-auth.el @@ -102,10 +102,10 @@ instead of the filename inheritance method." (byserv (setq retval (cdr-safe (assoc file byserv))) (if (and (not retval) - (string-match "/" file)) + (string-search "/" file)) (while (and byserv (not retval)) (setq data (car (car byserv))) - (if (or (not (string-match "/" data)) ; It's a realm - take it! + (if (or (not (string-search "/" data)) ; It's a realm - take it! (and (>= (length file) (length data)) (string= data (substring file 0 (length data))))) @@ -251,12 +251,12 @@ a match." (assoc dirkey keylist) ;; No exact match found. Continue to look for partial match if ;; dirkey is not a realm. - (and (string-match "/" dirkey) + (and (string-search "/" dirkey) (let (match) (while (and (null match) keylist) (if (or ;; Any realm candidate matches. Why? - (not (string-match "/" (caar keylist))) + (not (string-search "/" (caar keylist))) ;; Parent directory matches. (string-prefix-p (caar keylist) dirkey)) (setq match (car keylist)) diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el index 49cc587590e..4fe909cadbc 100644 --- a/lisp/url/url-news.el +++ b/lisp/url/url-news.el @@ -106,7 +106,7 @@ (article (url-unhex-string (url-filename url)))) (url-news-open-host host port (url-user url) (url-password url)) (cond - ((string-match "@" article) ; Its a specific article + ((string-search "@" article) ; Its a specific article (setq buf (url-news-fetch-message-id host article))) ((string= article "") ; List all newsgroups (gnus)) diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 8b79736d004..113ac2833bc 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -252,7 +252,7 @@ Will not do anything if `url-show-status' is nil." (while pairs (setq cur (car pairs) pairs (cdr pairs)) - (unless (string-match "=" cur) + (unless (string-search "=" cur) (setq cur (concat cur "="))) (when (string-match "=" cur) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index ef607133e86..c8f36fb76ec 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1173,7 +1173,7 @@ is non-nil." (mtime (file-attribute-modification-time (file-attributes file))) (parsed-time (progn (require 'parse-time) (parse-time-string (concat time " +0000"))))) - (cond ((and (not (string-match "\\+" time)) + (cond ((and (not (string-search "+" time)) (decoded-time-second parsed-time) ;; Compare just the seconds part of the file time, ;; since CVS file time stamp resolution is just 1 second. diff --git a/lisp/wid-browse.el b/lisp/wid-browse.el index 54b71c9f9f6..7ce0633b40b 100644 --- a/lisp/wid-browse.el +++ b/lisp/wid-browse.el @@ -218,7 +218,7 @@ Nothing is assumed about value." (error (prin1-to-string signal))))) (when (string-match "\n\\'" pp) (setq pp (substring pp 0 (1- (length pp))))) - (if (cond ((string-match "\n" pp) + (if (cond ((string-search "\n" pp) nil) ((> (length pp) (- (window-width) (current-column))) nil) diff --git a/lisp/woman.el b/lisp/woman.el index 0bc992d8f7f..fe9f8969c3e 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -418,7 +418,7 @@ As a special case, if PATHS is nil then replace it by calling (if (memq system-type '(windows-nt ms-dos)) (cond ((null paths) (mapcar #'woman-Cyg-to-Win (woman-parse-man.conf))) - ((string-match-p ";" paths) + ((string-search ";" paths) ;; Assume DOS-style path-list... (mapcan ; splice list into list (lambda (x) @@ -1939,12 +1939,12 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated." (setq symbol (car p)) ; 1. name (if (functionp symbol) ; 2. command doc (if (setq doc (documentation symbol t)) - (substring doc 0 (string-match "\n" doc)) + (substring doc 0 (string-search "\n" doc)) "(not documented)")) (if (custom-variable-p symbol) ; 3. variable doc (if (setq doc (documentation-property symbol 'variable-documentation t)) - (substring doc 0 (string-match "\n" doc)))))) + (substring doc 0 (string-search "\n" doc)))))) (setq p (cdr p)))) ;; Output the result: (and (apropos-print t nil) @@ -1955,7 +1955,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated." (defun WoMan-getpage-in-background (topic) "Use TOPIC to start WoMan from `Man-follow-manual-reference'." ;; topic is a string, generally of the form "section topic" - (let ((s (string-match " " topic))) + (let ((s (string-search " " topic))) (if s (setq topic (substring topic (1+ s)))) (woman topic))) @@ -3840,7 +3840,7 @@ Leave 1 blank line. Format paragraphs upto TO." ((eolp) ; extend line ;; Insert character INCLUDING TEXT PROPERTIES: ;; (insert (substring overlap i (1+ i))) - (let ((eol (string-match "\n" overlap i))) + (let ((eol (string-search "\n" overlap i))) (insert (substring overlap i eol)) (setq i (or eol imax))) ) diff --git a/lisp/xml.el b/lisp/xml.el index 4e2dd13ecbd..1b2d6557388 100644 --- a/lisp/xml.el +++ b/lisp/xml.el @@ -922,11 +922,11 @@ references and parameter-entity references." (progn (setq elem (match-string-no-properties 1 string) modifier (match-string-no-properties 2 string)) - (if (string-match-p "|" elem) + (if (string-search "|" elem) (setq elem (cons 'choice (mapcar 'xml-parse-elem-type (split-string elem "|")))) - (if (string-match-p "," elem) + (if (string-search "," elem) (setq elem (cons 'seq (mapcar 'xml-parse-elem-type (split-string elem ","))))))) diff --git a/test/lisp/emacs-lisp/check-declare-tests.el b/test/lisp/emacs-lisp/check-declare-tests.el index 9552bf0e397..276530fb4d3 100644 --- a/test/lisp/emacs-lisp/check-declare-tests.el +++ b/test/lisp/emacs-lisp/check-declare-tests.el @@ -106,11 +106,11 @@ (let ((res (buffer-string))) ;; Don't care too much about the format of the output, but ;; check that key information is present. - (should (string-match-p "foo-file" res)) - (should (string-match-p "foo-fun" res)) - (should (string-match-p "bar-file" res)) - (should (string-match-p "it wasn't" res)) - (should (string-match-p "999" res)))))) + (should (string-search "foo-file" res)) + (should (string-search "foo-fun" res)) + (should (string-search "bar-file" res)) + (should (string-search "it wasn't" res)) + (should (string-search "999" res)))))) (provide 'check-declare-tests) ;;; check-declare-tests.el ends here diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index db93250b17b..fb24b98595b 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -610,7 +610,7 @@ unquoted file names." (ert-deftest files-tests-file-name-non-special-dired-compress-handler () ;; `dired-compress-file' can get confused by filenames with ":" in ;; them, which causes this to fail on `windows-nt' systems. - (when (string-match-p ":" (expand-file-name temporary-file-directory)) + (when (string-search ":" (expand-file-name temporary-file-directory)) (ert-skip "FIXME: `dired-compress-file' unreliable when filenames contain `:'.")) (files-tests--with-temp-non-special (tmpfile nospecial) (let ((compressed (dired-compress-file nospecial))) diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el index 1a4cc744f0c..4a0b23dd26f 100644 --- a/test/lisp/net/network-stream-tests.el +++ b/test/lisp/net/network-stream-tests.el @@ -128,7 +128,7 @@ (when prev (setq string (concat prev string)) (process-put proc 'previous-string nil))) - (if (and (not (string-match "\n" string)) + (if (and (not (string-search "\n" string)) (> (length string) 0)) (process-put proc 'previous-string string)) (let ((command (split-string string))) diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el index 0309b2b1ad6..134f5676709 100644 --- a/test/src/coding-tests.el +++ b/test/src/coding-tests.el @@ -56,7 +56,7 @@ (set-buffer-multibyte nil) (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n") (decode-coding-region (point-min) (point-max) 'euc-jp-dos) - (should-not (string-match-p "\^M" (buffer-string))))) + (should-not (string-search "\^M" (buffer-string))))) ;; Return the contents (specified by CONTENT-TYPE; ascii, latin, or ;; binary) of a test file. -- cgit v1.2.3