From aaa80f408cbfe9419c2bc140f358604cf0b1a7c7 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 10 Feb 2021 20:58:16 +0100 Subject: Avoid having erc in irrelevant finder categories * lisp/erc/erc-backend.el: * lisp/erc/erc-button.el: * lisp/erc/erc-dcc.el: * lisp/erc/erc-identd.el: * lisp/erc/erc-join.el: * lisp/erc/erc-lang.el: * lisp/erc/erc-log.el: * lisp/erc/erc-match.el: * lisp/erc/erc-menu.el: * lisp/erc/erc-pcomplete.el: * lisp/erc/erc-replace.el: * lisp/erc/erc-spelling.el: * lisp/erc/erc-stamp.el: * lisp/erc/erc-track.el: * lisp/erc/erc-xdcc.el: Remove irrelevant entries in Keywords header. --- lisp/erc/erc-dcc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/erc/erc-dcc.el') diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 9dedd3cda86..e72d8fbe3db 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -7,7 +7,7 @@ ;; Noah Friedman ;; Per Persson ;; Maintainer: Amin Bandali -;; Keywords: comm, processes +;; Keywords: comm ;; Created: 1994-01-23 ;; This file is part of GNU Emacs. -- cgit v1.2.3 From f463633f007a92418f1ea7d46347824d51373aa3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 18 Mar 2021 23:14:33 -0400 Subject: lisp/erc: Use lexical-binding Also remove various redundant `:group` arguments. * lisp/erc/erc-backend.el (define-erc-response-handler): Move `declare` after the docstring. * lisp/erc/erc-capab.el: Use lexical-binding. (erc-capab-identify-activate): Simplify with `member`. * lisp/erc/erc-dcc.el (erc-dcc): Move before erc-dcc-mode definition, which refers to it. (erc-dcc-chat-accept): Remove unused vars `nick` and `buffer`. * lisp/erc/erc-imenu.el: Use lexical-binding. (erc-create-imenu-index): Remove unused var `prev-pos`. * lisp/erc/erc-match.el: Use lexical-binding. (erc-match-message): Remove unused var `old-pt`. (erc-match-message): Strength-reduce `eval` to `symbol-value`. * lisp/erc/erc-page.el: Use lexical-binding. (erc-page): Move Custom group before `erg-page-mode` which refers to it. * lisp/erc/erc-replace.el: Use lexical-binding. (erc-replace-insert): Use `functionp`. * lisp/erc/erc-status-sidebar.el: Use lexical-binding. (erc-status-sidebar-open): Remove unused var `sidebar-window`. * lisp/erc/erc.el: Fix header to use the customary 3 semi-colons. (erc-fill-column): Declare variable. * lisp/erc/erc-autoaway.el: Use lexical-binding. * lisp/erc/erc-ezbounce.el: Use lexical-binding. * lisp/erc/erc-fill.el: Use lexical-binding. * lisp/erc/erc-goodies.el: Use lexical-binding. * lisp/erc/erc-ibuffer.el: Use lexical-binding. * lisp/erc/erc-identd.el: Use lexical-binding. * lisp/erc/erc-join.el: Use lexical-binding. * lisp/erc/erc-lang.el: Use lexical-binding. * lisp/erc/erc-log.el: Use lexical-binding. * lisp/erc/erc-menu.el: Use lexical-binding. * lisp/erc/erc-netsplit.el: Use lexical-binding. * lisp/erc/erc-networks.el: Use lexical-binding. * lisp/erc/erc-pcomplete.el: Use lexical-binding. * lisp/erc/erc-ring.el: Use lexical-binding. * lisp/erc/erc-speedbar.el: Use lexical-binding. * lisp/erc/erc-spelling.el: Use lexical-binding. * lisp/erc/erc-truncate.el: Use lexical-binding. * lisp/erc/erc-xdcc.el: Use lexical-binding. --- lisp/erc/erc-autoaway.el | 54 +++++++-------- lisp/erc/erc-backend.el | 37 +++------- lisp/erc/erc-button.el | 41 +++++------ lisp/erc/erc-capab.el | 32 ++++----- lisp/erc/erc-dcc.el | 74 ++++++++------------ lisp/erc/erc-desktop-notifications.el | 10 ++- lisp/erc/erc-ezbounce.el | 18 +++-- lisp/erc/erc-fill.el | 17 ++--- lisp/erc/erc-goodies.el | 65 +++++++++--------- lisp/erc/erc-ibuffer.el | 9 +-- lisp/erc/erc-identd.el | 17 +++-- lisp/erc/erc-imenu.el | 7 +- lisp/erc/erc-join.el | 26 +++---- lisp/erc/erc-lang.el | 2 +- lisp/erc/erc-list.el | 26 +++---- lisp/erc/erc-log.el | 57 +++++++--------- lisp/erc/erc-match.el | 48 +++++-------- lisp/erc/erc-menu.el | 2 +- lisp/erc/erc-netsplit.el | 25 +++---- lisp/erc/erc-networks.el | 20 +++--- lisp/erc/erc-notify.el | 26 +++---- lisp/erc/erc-page.el | 18 +++-- lisp/erc/erc-pcomplete.el | 16 ++--- lisp/erc/erc-replace.el | 13 ++-- lisp/erc/erc-ring.el | 14 ++-- lisp/erc/erc-services.el | 42 +++++------- lisp/erc/erc-sound.el | 8 +-- lisp/erc/erc-speedbar.el | 21 +++--- lisp/erc/erc-spelling.el | 8 +-- lisp/erc/erc-stamp.el | 13 ---- lisp/erc/erc-status-sidebar.el | 30 ++++---- lisp/erc/erc-track.el | 72 +++++++------------- lisp/erc/erc-truncate.el | 7 +- lisp/erc/erc-xdcc.el | 14 ++-- lisp/erc/erc.el | 125 +++++++++++++++++----------------- 35 files changed, 430 insertions(+), 584 deletions(-) (limited to 'lisp/erc/erc-dcc.el') diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el index a0085662e22..1a13aa95cd2 100644 --- a/lisp/erc/erc-autoaway.el +++ b/lisp/erc/erc-autoaway.el @@ -1,4 +1,4 @@ -;;; erc-autoaway.el --- Provides autoaway for ERC +;;; erc-autoaway.el --- Provides autoaway for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -58,7 +58,7 @@ function each time you change `erc-autoaway-idle-seconds'." (setq erc-autoaway-idletimer (run-with-idle-timer erc-autoaway-idle-seconds t - 'erc-autoaway-set-away + #'erc-autoaway-set-away erc-autoaway-idle-seconds))) (defun erc-autoaway-some-server-buffer () @@ -66,21 +66,21 @@ function each time you change `erc-autoaway-idle-seconds'." If none is found, return nil." (car (erc-buffer-list #'erc-open-server-buffer-p))) -(defun erc-autoaway-insinuate-maybe (&optional server &rest ignored) +(defun erc-autoaway-insinuate-maybe (&optional server &rest _ignored) "Add autoaway reset function to `post-command-hook' if at least one ERC process is alive. This is used when `erc-autoaway-idle-method' is `user'." (when (or server (erc-autoaway-some-server-buffer)) - (add-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) + (add-hook 'post-command-hook #'erc-autoaway-reset-idle-user))) -(defun erc-autoaway-remove-maybe (&rest ignored) +(defun erc-autoaway-remove-maybe (&rest _ignored) "Remove the autoaway reset function from `post-command-hook' if no ERC process is alive. This is used when `erc-autoaway-idle-method' is `user'." (unless (erc-autoaway-some-server-buffer) - (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) + (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user))) ;;;###autoload(autoload 'erc-autoaway-mode "erc-autoaway") (define-erc-module autoaway nil @@ -107,36 +107,36 @@ set you no longer away. Related variables: `erc-public-away-p' and `erc-away-nickname'." ;; Enable: ((when (boundp 'erc-autoaway-idle-method) - (add-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators) + (add-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators) (setq erc-autoaway-last-sent-time (erc-current-time)) (cond ((eq erc-autoaway-idle-method 'irc) - (add-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc) - (add-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc)) + (add-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc) + (add-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc)) ((eq erc-autoaway-idle-method 'user) - (add-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe) - (add-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe) + (add-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe) + (add-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe) (erc-autoaway-insinuate-maybe)) ((eq erc-autoaway-idle-method 'emacs) (erc-autoaway-reestablish-idletimer))) - (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away) - (add-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators))) + (add-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away) + (add-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators))) ;; Disable: ((when (boundp 'erc-autoaway-idle-method) - (remove-hook 'erc-connect-pre-hook 'erc-autoaway-reset-indicators) + (remove-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators) (cond ((eq erc-autoaway-idle-method 'irc) - (remove-hook 'erc-send-completed-hook 'erc-autoaway-reset-idle-irc) - (remove-hook 'erc-server-001-functions 'erc-autoaway-reset-idle-irc)) + (remove-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc) + (remove-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc)) ((eq erc-autoaway-idle-method 'user) - (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user) - (remove-hook 'erc-after-connect 'erc-autoaway-insinuate-maybe) - (remove-hook 'erc-disconnected-hook 'erc-autoaway-remove-maybe)) + (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user) + (remove-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe) + (remove-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe)) ((eq erc-autoaway-idle-method 'emacs) (cancel-timer erc-autoaway-idletimer) (setq erc-autoaway-idletimer nil))) - (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away) - (remove-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators)))) + (remove-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away) + (remove-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators)))) (defcustom erc-autoaway-idle-method 'user "The method used to determine how long you have been idle. @@ -148,7 +148,6 @@ The time itself is specified by `erc-autoaway-idle-seconds'. See `erc-autoaway-mode' for more information on the various definitions of being idle." - :group 'erc-autoaway :type '(choice (const :tag "User idle time" user) (const :tag "Emacs idle time" emacs) (const :tag "Last IRC action" irc)) @@ -166,7 +165,6 @@ ERC autoaway mode can set you away when you idle, and set you no longer away when you type something. This variable controls whether you will be set away when you idle. See `erc-auto-discard-away' for the other half." - :group 'erc-autoaway :type 'boolean) (defcustom erc-auto-discard-away t @@ -176,20 +174,17 @@ longer away when you type something. This variable controls whether you will be set no longer away when you type something. See `erc-auto-set-away' for the other half. See also `erc-autoaway-no-auto-discard-regexp'." - :group 'erc-autoaway :type 'boolean) (defcustom erc-autoaway-no-auto-discard-regexp "^/g?away.*$" "Input that matches this will not automatically discard away status. See `erc-auto-discard-away'." - :group 'erc-autoaway :type 'regexp) (defcustom erc-autoaway-idle-seconds 1800 "Number of seconds after which ERC will set you automatically away. If you are changing this variable using lisp instead of customizing it, you have to run `erc-autoaway-reestablish-idletimer' afterwards." - :group 'erc-autoaway :set (lambda (sym val) (set-default sym val) (when (eq erc-autoaway-idle-method 'emacs) @@ -201,10 +196,9 @@ you have to run `erc-autoaway-reestablish-idletimer' afterwards." "Message ERC will use when setting you automatically away. It is used as a `format' string with the argument of the idletime in seconds." - :group 'erc-autoaway :type 'string) -(defun erc-autoaway-reset-idle-user (&rest stuff) +(defun erc-autoaway-reset-idle-user (&rest _stuff) "Reset the stored user idle time. This is one global variable since a user talking on one net can talk on another net too." @@ -212,7 +206,7 @@ talk on another net too." (erc-autoaway-set-back #'erc-autoaway-remove-maybe)) (setq erc-autoaway-last-sent-time (erc-current-time))) -(defun erc-autoaway-reset-idle-irc (line &rest stuff) +(defun erc-autoaway-reset-idle-irc (line &rest _stuff) "Reset the stored IRC idle time. This is one global variable since a user talking on one net can talk on another net too." @@ -272,7 +266,7 @@ active server buffer available." (setq erc-autoaway-caused-away t) (erc-cmd-GAWAY (format-message erc-autoaway-message idle-time)))) -(defun erc-autoaway-reset-indicators (&rest stuff) +(defun erc-autoaway-reset-indicators (&rest _stuff) "Reset indicators used by the erc-autoaway module." (setq erc-autoaway-last-sent-time (erc-current-time)) (setq erc-autoaway-caused-away nil)) diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 73c2b56b02e..b1f97aea069 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -268,7 +268,6 @@ protection algorithm.") "Non-nil means that ERC will attempt to reestablish broken connections. Reconnection will happen automatically for any unexpected disconnection." - :group 'erc-server :type 'boolean) (defcustom erc-server-reconnect-attempts 2 @@ -276,7 +275,6 @@ Reconnection will happen automatically for any unexpected disconnection." broken connection, or t to always attempt to reconnect. This only has an effect if `erc-server-auto-reconnect' is non-nil." - :group 'erc-server :type '(choice (const :tag "Always reconnect" t) integer)) @@ -285,7 +283,6 @@ This only has an effect if `erc-server-auto-reconnect' is non-nil." successive reconnect attempts. If a key is pressed while ERC is waiting, it will stop waiting." - :group 'erc-server :type 'number) (defcustom erc-split-line-length 440 @@ -299,14 +296,12 @@ And a typical message looks like this: You can limit here the maximum length of the \"Hello!\" part. Good luck." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-coding-system-precedence '(utf-8 undecided) "List of coding systems to be preferred when receiving a string from the server. This will only be consulted if the coding system in `erc-server-coding-system' is `undecided'." - :group 'erc-server :version "24.1" :type '(repeat coding-system)) @@ -331,7 +326,6 @@ If you need to send non-ASCII text to people not using a client that does decoding on its own, you must tell ERC what encoding to use. Emacs cannot guess it, since it does not know what the people on the other end of the line are using." - :group 'erc-server :type '(choice (const :tag "None" nil) coding-system (cons (coding-system :tag "encoding" :value utf-8) @@ -346,37 +340,32 @@ current target as returned by `erc-default-target'. Example: If you know that the channel #linux-ru uses the coding-system `cyrillic-koi8', then add (\"#linux-ru\" . cyrillic-koi8) to the alist." - :group 'erc-server :type '(repeat (cons (regexp :tag "Target") coding-system))) (defcustom erc-server-connect-function #'erc-open-network-stream "Function used to initiate a connection. It should take same arguments as `open-network-stream' does." - :group 'erc-server :type 'function) (defcustom erc-server-prevent-duplicates '("301") "Either nil or a list of strings. Each string is a IRC message type, like PRIVMSG or NOTICE. All Message types in that list of subjected to duplicate prevention." - :type '(choice (const nil) (list string)) - :group 'erc-server) + :type '(choice (const nil) (list string))) (defcustom erc-server-duplicate-timeout 60 "The time allowed in seconds between duplicate messages. If two identical messages arrive within this value of one another, the second isn't displayed." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-server-timestamp-format "%Y-%m-%d %T" "Timestamp format used with server response messages. This string is processed using `format-time-string'." :version "24.3" - :type 'string - :group 'erc-server) + :type 'string) ;;; Flood-related @@ -395,22 +384,19 @@ detailed in RFC 2813, section 5.8 \"Flood control of clients\". time, send a message, and increase `erc-server-flood-last-message' by `erc-server-flood-penalty' for each message." - :type 'integer - :group 'erc-server) + :type 'integer) (defcustom erc-server-flood-penalty 3 "How much we penalize a message. See `erc-server-flood-margin' for an explanation of the flood protection algorithm." - :type 'integer - :group 'erc-server) + :type 'integer) ;; Ping handling (defcustom erc-server-send-ping-interval 30 "Interval of sending pings to the server, in seconds. If this is set to nil, pinging the server is disabled." - :group 'erc-server :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds"))) @@ -422,7 +408,6 @@ This must be greater than or equal to the value for `erc-server-send-ping-interval'. If this is set to nil, never try to reconnect." - :group 'erc-server :type '(choice (const :tag "Disabled" nil) (integer :tag "Seconds"))) @@ -1082,9 +1067,6 @@ Finds hooks by looking in the `erc-server-responses' hash table." (cl-defmacro define-erc-response-handler ((name &rest aliases) &optional extra-fn-doc extra-var-doc &rest fn-body) - (declare (debug (&define [&name "erc-response-handler@" - (symbolp &rest symbolp)] - &optional sexp sexp def-body))) "Define an ERC handler hook/function pair. NAME is the response name as sent by the server (see the IRC RFC for meanings). @@ -1164,6 +1146,9 @@ Would expand to: See also `erc-server-311'.\")) \(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)" + (declare (debug (&define [&name "erc-response-handler@" + (symbolp &rest symbolp)] + &optional sexp sexp def-body))) (if (numberp name) (setq name (intern (format "%03i" name)))) (setq aliases (mapcar (lambda (a) (if (numberp a) @@ -1226,8 +1211,8 @@ add things to `%s' instead." ,@(cl-loop for fn in fn-alternates for var in var-alternates for a in aliases - nconc (list `(defalias ',fn ',fn-name) - `(defvar ,var ',fn-name ,(format hook-doc a)) + nconc (list `(defalias ',fn #',fn-name) + `(defvar ,var #',fn-name ,(format hook-doc a)) `(put ',var 'definition-name ',hook-name)))))) (define-erc-response-handler (ERROR) diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el index 0a81da38974..8b13d1cf49c 100644 --- a/lisp/erc/erc-button.el +++ b/lisp/erc/erc-button.el @@ -52,14 +52,14 @@ ;;;###autoload(autoload 'erc-button-mode "erc-button" nil t) (define-erc-module button nil "This mode buttonizes all messages according to `erc-button-alist'." - ((add-hook 'erc-insert-modify-hook 'erc-button-add-buttons 'append) - (add-hook 'erc-send-modify-hook 'erc-button-add-buttons 'append) - (add-hook 'erc-complete-functions 'erc-button-next-function) - (add-hook 'erc-mode-hook 'erc-button-setup)) - ((remove-hook 'erc-insert-modify-hook 'erc-button-add-buttons) - (remove-hook 'erc-send-modify-hook 'erc-button-add-buttons) - (remove-hook 'erc-complete-functions 'erc-button-next-function) - (remove-hook 'erc-mode-hook 'erc-button-setup))) + ((add-hook 'erc-insert-modify-hook #'erc-button-add-buttons 'append) + (add-hook 'erc-send-modify-hook #'erc-button-add-buttons 'append) + (add-hook 'erc-complete-functions #'erc-button-next-function) + (add-hook 'erc-mode-hook #'erc-button-setup)) + ((remove-hook 'erc-insert-modify-hook #'erc-button-add-buttons) + (remove-hook 'erc-send-modify-hook #'erc-button-add-buttons) + (remove-hook 'erc-complete-functions #'erc-button-next-function) + (remove-hook 'erc-mode-hook #'erc-button-setup))) ;;; Variables @@ -91,7 +91,6 @@ above them." (defcustom erc-button-url-regexp browse-url-button-regexp "Regular expression that matches URLs." :version "27.1" - :group 'erc-button :type 'regexp) (defcustom erc-button-wrap-long-urls nil @@ -100,18 +99,15 @@ above them." If this variable is a number, consider URLs longer than its value to be \"long\". If t, URLs will be considered \"long\" if they are longer than `erc-fill-column'." - :group 'erc-button :type '(choice integer boolean)) (defcustom erc-button-buttonize-nicks t "Flag indicating whether nicks should be buttonized or not." - :group 'erc-button :type 'boolean) (defcustom erc-button-rfc-url "http://www.faqs.org/rfcs/rfc%s.html" "URL used to browse rfc references. %s is replaced by the number." - :group 'erc-button :type 'string) (define-obsolete-variable-alias 'erc-button-google-url @@ -121,7 +117,6 @@ longer than `erc-fill-column'." "URL used to search for a term. %s is replaced by the search string." :version "27.1" - :group 'erc-button :type 'string) (defcustom erc-button-alist @@ -179,7 +174,6 @@ PAR is a number of a regexp grouping whose text will be passed to CALLBACK. There can be several PAR arguments. If REGEXP is \\='nicknames, these are ignored, and CALLBACK will be called with the nickname matched as the argument." - :group 'erc-button :version "24.1" ; remove finger (bug#4443) :type '(repeat (list :tag "Button" @@ -200,20 +194,18 @@ PAR is a number of a regexp grouping whose text will be passed to (defcustom erc-emacswiki-url "https://www.emacswiki.org/cgi-bin/wiki.pl?" "URL of the EmacsWiki Homepage." - :group 'erc-button :type 'string) (defcustom erc-emacswiki-lisp-url "https://www.emacswiki.org/elisp/" "URL of the EmacsWiki ELisp area." - :group 'erc-button :type 'string) (defvar erc-button-keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'erc-button-press-button) - (define-key map (kbd "") 'erc-button-click-button) - (define-key map (kbd "TAB") 'erc-button-next) - (define-key map (kbd "") 'erc-button-previous) + (define-key map (kbd "RET") #'erc-button-press-button) + (define-key map (kbd "") #'erc-button-click-button) + (define-key map (kbd "TAB") #'erc-button-next) + (define-key map (kbd "") #'erc-button-previous) (define-key map [follow-link] 'mouse-face) (set-keymap-parent map erc-mode-map) map) @@ -244,7 +236,7 @@ global-level ERC button keys yet.") "Add ERC mode-level button movement keys. This is only done once." ;; Add keys. (unless erc-button-keys-added - (define-key erc-mode-map (kbd "") 'erc-button-previous) + (define-key erc-mode-map (kbd "") #'erc-button-previous) (setq erc-button-keys-added t))) (defun erc-button-add-buttons () @@ -287,7 +279,7 @@ specified by `erc-button-alist'." (fun (nth 3 entry)) bounds word) (when (or (eq t form) - (eval form)) + (eval form t)) (goto-char (point-min)) (while (erc-forward-word) (when (setq bounds (erc-bounds-of-word-at-point)) @@ -306,9 +298,9 @@ specified by `erc-button-alist'." (end (match-end (nth 1 entry))) (form (nth 2 entry)) (fun (nth 3 entry)) - (data (mapcar 'match-string (nthcdr 4 entry)))) + (data (mapcar #'match-string (nthcdr 4 entry)))) (when (or (eq t form) - (eval form)) + (eval form t)) (erc-button-add-button start end fun nil data regexp))))) (defun erc-button-remove-old-buttons () @@ -483,7 +475,6 @@ Examples: (format \"ldapsearch -x -P 2 -h db.debian.org -b dc=debian,dc=org ircnick=%s\" nick)))" - :group 'erc-button :type '(repeat (cons (string :tag "Op") sexp))) diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el index 4e4d012545a..2028917da0c 100644 --- a/lisp/erc/erc-capab.el +++ b/lisp/erc/erc-capab.el @@ -1,4 +1,4 @@ -;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB +;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB -*- lexical-binding: t; -*- ;; Copyright (C) 2006-2021 Free Software Foundation, Inc. @@ -80,12 +80,10 @@ If you change this from the default \"*\", be sure to use a character not found in IRC nicknames to avoid confusion." - :group 'erc-capab :type '(choice string (const nil))) (defface erc-capab-identify-unidentified '((t)) ; same as `erc-default-face' "Face to use for `erc-capab-identify-prefix'." - :group 'erc-capab :group 'erc-faces) ;;; Define module: @@ -94,22 +92,22 @@ character not found in IRC nicknames to avoid confusion." (define-erc-module capab-identify nil "Handle dancer-ircd's CAPAB IDENTIFY-MSG and IDENTIFY-CTCP." ;; append so that `erc-server-parameters' is already set by `erc-server-005' - ((add-hook 'erc-server-005-functions 'erc-capab-identify-setup t) - (add-hook 'erc-server-290-functions 'erc-capab-identify-activate) + ((add-hook 'erc-server-005-functions #'erc-capab-identify-setup t) + (add-hook 'erc-server-290-functions #'erc-capab-identify-activate) (add-hook 'erc-server-PRIVMSG-functions - 'erc-capab-identify-remove/set-identified-flag) + #'erc-capab-identify-remove/set-identified-flag) (add-hook 'erc-server-NOTICE-functions - 'erc-capab-identify-remove/set-identified-flag) - (add-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix t) + #'erc-capab-identify-remove/set-identified-flag) + (add-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix t) (mapc (lambda (buffer) (when buffer (with-current-buffer buffer (erc-capab-identify-setup)))) - (erc-buffer-list 'erc-open-server-buffer-p))) - ((remove-hook 'erc-server-005-functions 'erc-capab-identify-setup) - (remove-hook 'erc-server-290-functions 'erc-capab-identify-activate) + (erc-buffer-list #'erc-open-server-buffer-p))) + ((remove-hook 'erc-server-005-functions #'erc-capab-identify-setup) + (remove-hook 'erc-server-290-functions #'erc-capab-identify-activate) ;; we don't remove the `erc-capab-identify-remove/set-identified-flag' hooks ;; because there doesn't seem to be a way to tell the server to turn it off - (remove-hook 'erc-insert-modify-hook 'erc-capab-identify-add-prefix))) + (remove-hook 'erc-insert-modify-hook #'erc-capab-identify-add-prefix))) ;;; Variables: @@ -121,7 +119,7 @@ character not found in IRC nicknames to avoid confusion." ;;; Functions: -(defun erc-capab-identify-setup (&optional proc parsed) +(defun erc-capab-identify-setup (&optional _proc _parsed) "Set up CAPAB IDENTIFY on the current server. Optional argument PROC is the current server's process. @@ -146,19 +144,19 @@ These arguments are sent to this function when called as a hook in (setq erc-capab-identify-sent t))) -(defun erc-capab-identify-activate (proc parsed) +(defun erc-capab-identify-activate (_proc parsed) "Set `erc-capab-identify-activated' and display an activation message. PROC is the current server's process. PARSED is an `erc-parsed' response struct." - (when (or (string= "IDENTIFY-MSG" (erc-response.contents parsed)) - (string= "IDENTIFY-CTCP" (erc-response.contents parsed))) + (when (member (erc-response.contents parsed) + '("IDENTIFY-MSG" "IDENTIFY-CTCP")) (setq erc-capab-identify-activated t) (erc-display-message parsed 'notice 'active (format "%s activated" (erc-response.contents parsed))))) -(defun erc-capab-identify-remove/set-identified-flag (proc parsed) +(defun erc-capab-identify-remove/set-identified-flag (_proc parsed) "Remove PARSED message's id flag and add the `erc-identified' text property. PROC is the current server's process. diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index e72d8fbe3db..234b4b5a71d 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -1,4 +1,4 @@ -;;; erc-dcc.el --- CTCP DCC module for ERC +;;; erc-dcc.el --- CTCP DCC module for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 1993-1995, 1998, 2002-2004, 2006-2021 Free Software ;; Foundation, Inc. @@ -55,12 +55,6 @@ ;; Require at run-time too to silence compiler. (require 'pcomplete) -;;;###autoload(autoload 'erc-dcc-mode "erc-dcc") -(define-erc-module dcc nil - "Provide Direct Client-to-Client support for ERC." - ((add-hook 'erc-server-401-functions 'erc-dcc-no-such-nick)) - ((remove-hook 'erc-server-401-functions 'erc-dcc-no-such-nick))) - (defgroup erc-dcc nil "DCC stands for Direct Client Communication, where you and your friend's client programs connect directly to each other, @@ -71,9 +65,14 @@ Using DCC get and send, you can transfer files directly from and to other IRC users." :group 'erc) +;;;###autoload(autoload 'erc-dcc-mode "erc-dcc") +(define-erc-module dcc nil + "Provide Direct Client-to-Client support for ERC." + ((add-hook 'erc-server-401-functions #'erc-dcc-no-such-nick)) + ((remove-hook 'erc-server-401-functions #'erc-dcc-no-such-nick))) + (defcustom erc-dcc-verbose nil "If non-nil, be verbose about DCC activity reporting." - :group 'erc-dcc :type 'boolean) (defconst erc-dcc-connection-types @@ -120,7 +119,8 @@ All values of the list must be uppercase strings.") ;; more: the entry data from erc-dcc-list for this particular process. (defvar erc-dcc-connect-function 'erc-dcc-open-network-stream) -(defun erc-dcc-open-network-stream (procname buffer addr port entry) +(defun erc-dcc-open-network-stream (procname buffer addr port _entry) + ;; FIXME: Time to try activating this again!? (if nil; (fboundp 'open-network-stream-nowait) ;; this currently crashes ;; cvs emacs (open-network-stream-nowait procname buffer addr port) @@ -286,7 +286,6 @@ The result is also a string." "IP address to listen on when offering files. Should be set to a string or nil. If nil, automatic detection of the host interface to use will be attempted." - :group 'erc-dcc :type (list 'choice (list 'const :tag "Auto-detect" nil) (list 'string :tag "IP-address" :valid-regexp erc-dcc-ipv4-regexp))) @@ -295,7 +294,6 @@ the host interface to use will be attempted." "IP address to use for outgoing DCC offers. Should be set to a string or nil. If nil, use the value of `erc-dcc-listen-host'." - :group 'erc-dcc :type (list 'choice (list 'const :tag "Same as erc-dcc-listen-host" nil) (list 'string :tag "IP-address" :valid-regexp erc-dcc-ipv4-regexp))) @@ -306,7 +304,6 @@ Should be set to a string or nil. If nil, use the value of You might want to set `erc-dcc-auto-masks' for this. `auto' - Automatically accept the request and begin downloading the file `ignore' - Ignore incoming DCC Send requests completely." - :group 'erc-dcc :type '(choice (const ask) (const auto) (const ignore))) (defun erc-dcc-get-host (proc) @@ -323,7 +320,6 @@ If variable `erc-dcc-host' is non-nil, use it. Otherwise call (defcustom erc-dcc-port-range nil "If nil, any available user port is used for outgoing DCC connections. If set to a cons, it specifies a range of ports to use in the form (min . max)" - :group 'erc-dcc :type '(choice (const :tag "Any port" nil) (cons :tag "Port range" @@ -335,7 +331,6 @@ If set to a cons, it specifies a range of ports to use in the form (min . max)" accepted automatically. A user identifier has the form \"nick!login@host\". For instance, to accept all incoming DCC send offers automatically, add the string \".*!.*@.*\" to this list." - :group 'erc-dcc :type '(repeat regexp)) (defun erc-dcc-server (name filter sentinel) @@ -391,7 +386,6 @@ the accepted connection." (defcustom erc-dcc-get-default-directory nil "Default directory for incoming DCC file transfers. If this is nil, then the current value of `default-directory' is used." - :group 'erc-dcc :type '(choice (const nil :tag "Default directory") directory)) ;;;###autoload @@ -468,7 +462,7 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc." 'dcc-chat-offer ?n nick) t)))) -(defun erc-dcc-do-CLOSE-command (proc &optional type nick) +(defun erc-dcc-do-CLOSE-command (_proc &optional type nick) "Close a connection. Usage: /dcc close type nick. At least one of TYPE and NICK must be provided." ;; disambiguate type and nick if only one is provided @@ -540,7 +534,7 @@ PROC is the server process." (defvar-local erc-dcc-byte-count nil) -(defun erc-dcc-do-LIST-command (proc) +(defun erc-dcc-do-LIST-command (_proc) "This is the handler for the /dcc list command. It lists the current state of `erc-dcc-list' in an easy to read manner." (let ((alist erc-dcc-list) @@ -703,7 +697,6 @@ the matching regexp, or nil if none found." `ask' - Report the Chat request, and wait for the user to manually accept it `auto' - Automatically accept the request and open a new chat window `ignore' - Ignore incoming DCC chat requests completely." - :group 'erc-dcc :type '(choice (const ask) (const auto) (const ignore))) (defun erc-dcc-handle-ctcp-chat (proc query nick login host to) @@ -757,13 +750,11 @@ the matching regexp, or nil if none found." (defcustom erc-dcc-block-size 1024 "Block size to use for DCC SEND sessions." - :group 'erc-dcc :type 'integer) (defcustom erc-dcc-pump-bytes nil "If set to an integer, keep sending until that number of bytes are unconfirmed." - :group 'erc-dcc :type '(choice (const nil) integer)) (define-inline erc-dcc-get-parent (proc) @@ -837,7 +828,6 @@ bytes sent." '(erc-dcc-display-send erc-dcc-send-block) "Hook run whenever the remote end of a DCC SEND offer connected to your listening port." - :group 'erc-dcc :type 'hook) (defun erc-dcc-nick (plist) @@ -900,7 +890,6 @@ other client." (defcustom erc-dcc-receive-cache (* 1024 512) "Number of bytes to let the receive buffer grow before flushing it." - :group 'erc-dcc :type 'integer) (defvar-local erc-dcc-file-name nil) @@ -942,12 +931,12 @@ and making the connection." (set-process-coding-system proc 'binary 'binary) (set-buffer-file-coding-system 'binary t) - (set-process-filter proc 'erc-dcc-get-filter) - (set-process-sentinel proc 'erc-dcc-get-sentinel) + (set-process-filter proc #'erc-dcc-get-filter) + (set-process-sentinel proc #'erc-dcc-get-sentinel) (setq entry (plist-put entry :start-time (erc-current-time))) (setq entry (plist-put entry :peer proc))))) -(defun erc-dcc-append-contents (buffer file) +(defun erc-dcc-append-contents (buffer _file) "Append the contents of BUFFER to FILE. The contents of the BUFFER will then be erased." (with-current-buffer buffer @@ -1000,7 +989,7 @@ rather than every 1024 byte block, but nobody seems to care." proc (erc-pack-int received-bytes))))))) -(defun erc-dcc-get-sentinel (proc event) +(defun erc-dcc-get-sentinel (proc _event) "This is the process sentinel for CTCP DCC SEND connections. It shuts down the connection and notifies the user that the transfer is complete." @@ -1025,25 +1014,21 @@ transfer is complete." (defcustom erc-dcc-chat-buffer-name-format "DCC-CHAT-%s" "Format to use for DCC Chat buffer names." - :group 'erc-dcc :type 'string) (defcustom erc-dcc-chat-mode-hook nil "Hook calls when `erc-dcc-chat-mode' finished setting up the buffer." - :group 'erc-dcc :type 'hook) (defcustom erc-dcc-chat-connect-hook nil "" - :group 'erc-dcc :type 'hook) (defcustom erc-dcc-chat-exit-hook nil "" - :group 'erc-dcc :type 'hook) -(defun erc-cmd-CREQ (line &optional force) +(defun erc-cmd-CREQ (line &optional _force) "Set or get the DCC chat request flag. Possible values are: ask, auto, ignore." (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line) @@ -1058,7 +1043,7 @@ Possible values are: ask, auto, ignore." erc-dcc-chat-request))) t))) -(defun erc-cmd-SREQ (line &optional force) +(defun erc-cmd-SREQ (line &optional _force) "Set or get the DCC send request flag. Possible values are: ask, auto, ignore." (when (string-match "^\\s-*\\(auto\\|ask\\|ignore\\)?$" line) @@ -1075,7 +1060,7 @@ Possible values are: ask, auto, ignore." (defun pcomplete/erc-mode/CREQ () (pcomplete-here '("auto" "ask" "ignore"))) -(defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ) +(defalias 'pcomplete/erc-mode/SREQ #'pcomplete/erc-mode/CREQ) (define-obsolete-variable-alias 'erc-dcc-chat-filter-hook 'erc-dcc-chat-filter-functions "24.3") @@ -1087,19 +1072,19 @@ the unprocessed output.") (defvar erc-dcc-chat-mode-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'erc-send-current-line) - (define-key map "\t" 'completion-at-point) + (define-key map (kbd "RET") #'erc-send-current-line) + (define-key map "\t" #'completion-at-point) map) "Keymap for `erc-dcc-mode'.") (define-derived-mode erc-dcc-chat-mode fundamental-mode "DCC-Chat" "Major mode for wasting time via DCC chat." (setq mode-line-process '(":%s") - erc-send-input-line-function 'erc-dcc-chat-send-input-line + erc-send-input-line-function #'erc-dcc-chat-send-input-line erc-default-recipients '(dcc)) - (add-hook 'completion-at-point-functions 'erc-complete-word-at-point nil t)) + (add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t)) -(defun erc-dcc-chat-send-input-line (recipient line &optional force) +(defun erc-dcc-chat-send-input-line (recipient line &optional _force) "Send LINE to the remote end. Argument RECIPIENT should always be the symbol dcc, and force is ignored." @@ -1150,14 +1135,14 @@ other client." (setq erc-input-marker (make-marker)) (erc-display-prompt buffer (point-max)) (set-process-buffer proc buffer) - (add-hook 'kill-buffer-hook 'erc-dcc-chat-buffer-killed nil t) + (add-hook 'kill-buffer-hook #'erc-dcc-chat-buffer-killed nil t) (run-hook-with-args 'erc-dcc-chat-connect-hook proc) buffer)) (defun erc-dcc-chat-accept (entry parent-proc) "Accept an incoming DCC connection and open a DCC window." - (let* ((nick (erc-extract-nick (plist-get entry :nick))) - buffer proc) + (let* (;; (nick (erc-extract-nick (plist-get entry :nick))) + proc) ;; buffer (setq proc (funcall erc-dcc-connect-function "dcc-chat" nil @@ -1167,9 +1152,10 @@ other client." ;; XXX: connected, should we kill the ip/port properties? (setq entry (plist-put entry :peer proc)) (setq entry (plist-put entry :parent parent-proc)) - (set-process-filter proc 'erc-dcc-chat-filter) - (set-process-sentinel proc 'erc-dcc-chat-sentinel) - (setq buffer (erc-dcc-chat-setup entry)))) + (set-process-filter proc #'erc-dcc-chat-filter) + (set-process-sentinel proc #'erc-dcc-chat-sentinel) + ;; (setq buffer + (erc-dcc-chat-setup entry))) ;; ) (defun erc-dcc-chat-filter (proc str) (let ((orig-buffer (current-buffer))) diff --git a/lisp/erc/erc-desktop-notifications.el b/lisp/erc/erc-desktop-notifications.el index 056fb23777f..990f013cd2a 100644 --- a/lisp/erc/erc-desktop-notifications.el +++ b/lisp/erc/erc-desktop-notifications.el @@ -45,13 +45,11 @@ (defcustom erc-notifications-icon nil "Icon to use for notification." - :group 'erc-notifications :type '(choice (const :tag "No icon" nil) file)) (defcustom erc-notifications-bus :session "D-Bus bus to use for notification." :version "25.1" - :group 'erc-notifications :type '(choice (const :tag "Session bus" :session) string)) (defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors @@ -99,11 +97,11 @@ This will replace the last notification sent with this function." (define-erc-module notifications nil "Send notifications on private message reception and mentions." ;; Enable - ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) - (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)) + ((add-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG) + (add-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match)) ;; Disable - ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) - (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))) + ((remove-hook 'erc-server-PRIVMSG-functions #'erc-notifications-PRIVMSG) + (remove-hook 'erc-text-matched-hook #'erc-notifications-notify-on-match))) (provide 'erc-desktop-notifications) diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el index 8378ff53742..331d29a7b5b 100644 --- a/lisp/erc/erc-ezbounce.el +++ b/lisp/erc/erc-ezbounce.el @@ -1,4 +1,4 @@ -;;; erc-ezbounce.el --- Handle EZBounce bouncer commands +;;; erc-ezbounce.el --- Handle EZBounce bouncer commands -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -33,7 +33,6 @@ (defcustom erc-ezb-regexp "^ezbounce!srv$" "Regexp used by the EZBouncer to identify itself to the user." - :group 'erc-ezbounce :type 'regexp) (defcustom erc-ezb-login-alist '() @@ -44,7 +43,6 @@ The alist's format is as follows: (((server . port) . (username . password)) ((server . port) . (username . password)) ...)" - :group 'erc-ezbounce :type '(repeat (cons (cons :tag "Server" string @@ -68,7 +66,7 @@ The alist's format is as follows: "Indicate whether current notices are expected to be EZB session listings.") ;;;###autoload -(defun erc-cmd-ezb (line &optional force) +(defun erc-cmd-ezb (line &optional _force) "Send EZB commands to the EZBouncer verbatim." (erc-server-send (concat "EZB " line))) (put 'erc-cmd-EZB 'do-not-parse-args t) @@ -102,7 +100,7 @@ in the alist is nil, prompt for the appropriate values." found)) ;;;###autoload -(defun erc-ezb-notice-autodetect (proc parsed) +(defun erc-ezb-notice-autodetect (_proc parsed) "React on an EZBounce NOTICE request." (let* ((sender (erc-response.sender parsed)) (message (erc-response.contents parsed)) @@ -113,7 +111,7 @@ in the alist is nil, prompt for the appropriate values." nil) ;;;###autoload -(defun erc-ezb-identify (message) +(defun erc-ezb-identify (_message) "Identify to the EZBouncer server." (let ((login (erc-ezb-get-login erc-session-server (erc-port-to-string erc-session-port)))) (unless (null login) @@ -122,13 +120,13 @@ in the alist is nil, prompt for the appropriate values." (erc-server-send (concat "LOGIN " username " " pass)))))) ;;;###autoload -(defun erc-ezb-init-session-list (message) +(defun erc-ezb-init-session-list (_message) "Reset the EZBounce session list to nil." (setq erc-ezb-session-list nil) (setq erc-ezb-inside-session-listing t)) ;;;###autoload -(defun erc-ezb-end-of-session-list (message) +(defun erc-ezb-end-of-session-list (_message) "Indicate the end of the EZBounce session listing." (setq erc-ezb-inside-session-listing nil)) @@ -143,7 +141,7 @@ in the alist is nil, prompt for the appropriate values." (add-to-list 'erc-ezb-session-list (list id nick to))))) ;;;###autoload -(defun erc-ezb-select (message) +(defun erc-ezb-select (_message) "Select an IRC server to use by EZBounce, in ERC style." (unless (and erc-ezb-session-list (erc-ezb-select-session)) @@ -169,7 +167,7 @@ in the alist is nil, prompt for the appropriate values." ;;;###autoload (defun erc-ezb-initialize () "Add EZBouncer convenience functions to ERC." - (add-hook 'erc-server-NOTICE-functions 'erc-ezb-notice-autodetect)) + (add-hook 'erc-server-NOTICE-functions #'erc-ezb-notice-autodetect)) (provide 'erc-ezbounce) diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index 83ef5f93fa7..0312d221ece 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -1,4 +1,4 @@ -;;; erc-fill.el --- Filling IRC messages in various ways +;;; erc-fill.el --- Filling IRC messages in various ways -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -47,7 +47,7 @@ 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 :group 'erc-fill + :global t (if erc-fill-mode (erc-fill-enable) (erc-fill-disable))) @@ -55,19 +55,18 @@ the channel buffers are filled." (defun erc-fill-enable () "Setup hooks for `erc-fill-mode'." (interactive) - (add-hook 'erc-insert-modify-hook 'erc-fill) - (add-hook 'erc-send-modify-hook 'erc-fill)) + (add-hook 'erc-insert-modify-hook #'erc-fill) + (add-hook 'erc-send-modify-hook #'erc-fill)) (defun erc-fill-disable () "Cleanup hooks, disable `erc-fill-mode'." (interactive) - (remove-hook 'erc-insert-modify-hook 'erc-fill) - (remove-hook 'erc-send-modify-hook 'erc-fill)) + (remove-hook 'erc-insert-modify-hook #'erc-fill) + (remove-hook 'erc-send-modify-hook #'erc-fill)) (defcustom erc-fill-prefix nil "Values used as `fill-prefix' for `erc-fill-variable'. nil means fill with space, a string means fill with this string." - :group 'erc-fill :type '(choice (const nil) string)) (defcustom erc-fill-function 'erc-fill-variable @@ -94,7 +93,6 @@ These two styles are implemented using `erc-fill-variable' and `erc-fill-static'. You can, of course, define your own filling function. Narrowing to the region in question is in effect while your function is called." - :group 'erc-fill :type '(choice (const :tag "Variable Filling" erc-fill-variable) (const :tag "Static Filling" erc-fill-static) function)) @@ -104,18 +102,15 @@ function is called." centered. This column denotes the point where the ` ' character between and the entered text will be put, thus aligning nick names right and text left." - :group 'erc-fill :type 'integer) (defcustom erc-fill-variable-maximum-indentation 17 "If we indent a line after a long nick, don't indent more then this characters. Set to nil to disable." - :group 'erc-fill :type 'integer) (defcustom erc-fill-column 78 "The column at which a filled paragraph is broken." - :group 'erc-fill :type 'integer) ;;;###autoload diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index aef68810dfa..1143faa1e26 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -1,4 +1,4 @@ -;; erc-goodies.el --- Collection of ERC modules +;; erc-goodies.el --- Collection of ERC modules -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -37,7 +37,7 @@ "Setup Imenu support in an ERC buffer." (setq-local imenu-create-index-function #'erc-create-imenu-index)) -(add-hook 'erc-mode-hook 'erc-imenu-setup) +(add-hook 'erc-mode-hook #'erc-imenu-setup) (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function") ;;; Automatically scroll to bottom @@ -53,16 +53,16 @@ argument to `recenter'." (define-erc-module scrolltobottom nil "This mode causes the prompt to stay at the end of the window." - ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) - (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) + ((add-hook 'erc-mode-hook #'erc-add-scroll-to-bottom) + (add-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (erc-add-scroll-to-bottom)))) - ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) - (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) + ((remove-hook 'erc-mode-hook #'erc-add-scroll-to-bottom) + (remove-hook 'erc-insert-done-hook #'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer - (remove-hook 'post-command-hook 'erc-scroll-to-bottom t))))) + (remove-hook 'post-command-hook #'erc-scroll-to-bottom t))))) (defun erc-possibly-scroll-to-bottom () "Like `erc-add-scroll-to-bottom', but only if window is selected." @@ -77,7 +77,7 @@ the value of `erc-input-line-position'. This works whenever scrolling happens, so it's added to `window-scroll-functions' rather than `erc-insert-post-hook'." - (add-hook 'post-command-hook 'erc-scroll-to-bottom nil t)) + (add-hook 'post-command-hook #'erc-scroll-to-bottom nil t)) (defun erc-scroll-to-bottom () "Recenter WINDOW so that `point' is on the last line. @@ -104,10 +104,10 @@ variable `erc-input-line-position'." ;;; Make read only (define-erc-module readonly nil "This mode causes all inserted text to be read-only." - ((add-hook 'erc-insert-post-hook 'erc-make-read-only) - (add-hook 'erc-send-post-hook 'erc-make-read-only)) - ((remove-hook 'erc-insert-post-hook 'erc-make-read-only) - (remove-hook 'erc-send-post-hook 'erc-make-read-only))) + ((add-hook 'erc-insert-post-hook #'erc-make-read-only) + (add-hook 'erc-send-post-hook #'erc-make-read-only)) + ((remove-hook 'erc-insert-post-hook #'erc-make-read-only) + (remove-hook 'erc-send-post-hook #'erc-make-read-only))) (defun erc-make-read-only () "Make all the text in the current buffer read-only. @@ -119,14 +119,14 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'." ;;; Move to prompt when typing text (define-erc-module move-to-prompt nil "This mode causes the point to be moved to the prompt when typing text." - ((add-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + ((add-hook 'erc-mode-hook #'erc-move-to-prompt-setup) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (erc-move-to-prompt-setup)))) - ((remove-hook 'erc-mode-hook 'erc-move-to-prompt-setup) + ((remove-hook 'erc-mode-hook #'erc-move-to-prompt-setup) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer - (remove-hook 'pre-command-hook 'erc-move-to-prompt t))))) + (remove-hook 'pre-command-hook #'erc-move-to-prompt t))))) (defun erc-move-to-prompt () "Move the point to the ERC prompt if this is a self-inserting command." @@ -138,15 +138,15 @@ Put this function on `erc-insert-post-hook' and/or `erc-send-post-hook'." (defun erc-move-to-prompt-setup () "Initialize the move-to-prompt module for XEmacs." - (add-hook 'pre-command-hook 'erc-move-to-prompt nil t)) + (add-hook 'pre-command-hook #'erc-move-to-prompt nil t)) ;;; Keep place in unvisited channels (define-erc-module keep-place nil "Leave point above un-viewed text in other channels." - ((add-hook 'erc-insert-pre-hook 'erc-keep-place)) - ((remove-hook 'erc-insert-pre-hook 'erc-keep-place))) + ((add-hook 'erc-insert-pre-hook #'erc-keep-place)) + ((remove-hook 'erc-insert-pre-hook #'erc-keep-place))) -(defun erc-keep-place (ignored) +(defun erc-keep-place (_ignored) "Move point away from the last line in a non-selected ERC buffer." (when (and (not (eq (window-buffer (selected-window)) (current-buffer))) @@ -183,8 +183,8 @@ does not appear in the ERC buffer after the user presses ENTER.") "This mode distinguishes non-commands. Commands listed in `erc-insert-this' know how to display themselves." - ((add-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands)) - ((remove-hook 'erc-pre-send-functions 'erc-send-distinguish-noncommands))) + ((add-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands)) + ((remove-hook 'erc-pre-send-functions #'erc-send-distinguish-noncommands))) (defun erc-send-distinguish-noncommands (state) "If STR is an ERC non-command, set `insertp' in STATE to nil." @@ -211,20 +211,17 @@ highlighting effects. When this variable is non-nil, it can cause Emacs to run slowly on systems lacking sufficient CPU speed. In chatty channels, or in an emergency (message flood) it can be turned off to save processing time. See `erc-toggle-interpret-controls'." - :group 'erc-control-characters :type '(choice (const :tag "Highlight control characters" t) (const :tag "Remove control characters" remove) (const :tag "Display raw control characters" nil))) (defcustom erc-interpret-mirc-color nil "If non-nil, ERC will interpret mIRC color codes." - :group 'erc-control-characters :type 'boolean) (defcustom erc-beep-p nil "Beep if C-g is in the server message. The value `erc-interpret-controls-p' must also be t for this to work." - :group 'erc-control-characters :type 'boolean) (defface erc-bold-face '((t :weight bold)) @@ -372,10 +369,10 @@ The value `erc-interpret-controls-p' must also be t for this to work." (define-erc-module irccontrols nil "This mode enables the interpretation of IRC control chars." - ((add-hook 'erc-insert-modify-hook 'erc-controls-highlight) - (add-hook 'erc-send-modify-hook 'erc-controls-highlight)) - ((remove-hook 'erc-insert-modify-hook 'erc-controls-highlight) - (remove-hook 'erc-send-modify-hook 'erc-controls-highlight))) + ((add-hook 'erc-insert-modify-hook #'erc-controls-highlight) + (add-hook 'erc-send-modify-hook #'erc-controls-highlight)) + ((remove-hook 'erc-insert-modify-hook #'erc-controls-highlight) + (remove-hook 'erc-send-modify-hook #'erc-controls-highlight))) (defun erc-controls-interpret (str) "Return a copy of STR after dealing with IRC control characters. @@ -546,10 +543,10 @@ Else interpretation is turned off." "This mode translates text-smileys such as :-) into pictures. This requires the function `smiley-region', which is defined in smiley.el, which is part of Gnus." - ((add-hook 'erc-insert-modify-hook 'erc-smiley) - (add-hook 'erc-send-modify-hook 'erc-smiley)) - ((remove-hook 'erc-insert-modify-hook 'erc-smiley) - (remove-hook 'erc-send-modify-hook 'erc-smiley))) + ((add-hook 'erc-insert-modify-hook #'erc-smiley) + (add-hook 'erc-send-modify-hook #'erc-smiley)) + ((remove-hook 'erc-insert-modify-hook #'erc-smiley) + (remove-hook 'erc-send-modify-hook #'erc-smiley))) (defun erc-smiley () "Smilify a region. @@ -560,8 +557,8 @@ This function should be used with `erc-insert-modify-hook'." ;; Unmorse (define-erc-module unmorse nil "This mode causes morse code in the current channel to be unmorsed." - ((add-hook 'erc-insert-modify-hook 'erc-unmorse)) - ((remove-hook 'erc-insert-modify-hook 'erc-unmorse))) + ((add-hook 'erc-insert-modify-hook #'erc-unmorse)) + ((remove-hook 'erc-insert-modify-hook #'erc-unmorse))) (defun erc-unmorse () "Unmorse some text. diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 5a002ccae3e..22336ede219 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -1,4 +1,4 @@ -;;; erc-ibuffer.el --- ibuffer integration with ERC +;;; erc-ibuffer.el --- ibuffer integration with ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -39,20 +39,16 @@ (defcustom erc-ibuffer-keyword-char ?k "Char used to indicate a channel which had keyword traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-pal-char ?p "Char used to indicate a channel which had pal traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-fool-char ?f "Char used to indicate a channel which had fool traffic lately (hidden)." - :group 'erc-ibuffer :type 'character) (defcustom erc-ibuffer-dangerous-host-char ?d "Char used to indicate a channel which had dangerous-host traffic lately \(hidden)." - :group 'erc-ibuffer :type 'character) (define-ibuffer-filter erc-server @@ -153,7 +149,7 @@ (if (and (eq major-mode 'erc-mode) (or (> (length erc-channel-modes) 0) erc-channel-user-limit)) - (concat (apply 'concat + (concat (apply #'concat "(+" erc-channel-modes) (if erc-channel-user-limit (format "l %d" erc-channel-user-limit) @@ -181,6 +177,7 @@ (defvar erc-ibuffer-limit-map nil "Prefix keymap to use for ERC related limiting.") (define-prefix-command 'erc-ibuffer-limit-map) +;; FIXME: Where is `ibuffer-limit-by-erc-server' defined? (define-key 'erc-ibuffer-limit-map (kbd "s") 'ibuffer-limit-by-erc-server) (define-key ibuffer-mode-map (kbd "/ \C-e") 'erc-ibuffer-limit-map) diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el index 1f68272ebb1..3821e298cda 100644 --- a/lisp/erc/erc-identd.el +++ b/lisp/erc/erc-identd.el @@ -1,4 +1,4 @@ -;;; erc-identd.el --- RFC1413 (identd authentication protocol) server +;;; erc-identd.el --- RFC1413 (identd authentication protocol) server -*- lexical-binding: t; -*- ;; Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc. @@ -50,7 +50,6 @@ `erc-identd-start'. This can be either a string or a number." - :group 'erc-identd :type '(choice (const :tag "None" nil) (integer :tag "Port number") (string :tag "Port string"))) @@ -58,10 +57,10 @@ This can be either a string or a number." ;;;###autoload(autoload 'erc-identd-mode "erc-identd") (define-erc-module identd nil "This mode launches an identd server on port 8113." - ((add-hook 'erc-connect-pre-hook 'erc-identd-quickstart) - (add-hook 'erc-disconnected-hook 'erc-identd-stop)) - ((remove-hook 'erc-connect-pre-hook 'erc-identd-quickstart) - (remove-hook 'erc-disconnected-hook 'erc-identd-stop))) + ((add-hook 'erc-connect-pre-hook #'erc-identd-quickstart) + (add-hook 'erc-disconnected-hook #'erc-identd-stop)) + ((remove-hook 'erc-connect-pre-hook #'erc-identd-quickstart) + (remove-hook 'erc-disconnected-hook #'erc-identd-stop))) (defun erc-identd-filter (proc string) "This filter implements RFC1413 (identd authentication protocol)." @@ -95,16 +94,16 @@ system." :buffer nil :host 'local :service port :server t :noquery t :nowait t - :filter 'erc-identd-filter)) + :filter #'erc-identd-filter)) (set-process-query-on-exit-flag erc-identd-process nil)) -(defun erc-identd-quickstart (&rest ignored) +(defun erc-identd-quickstart (&rest _ignored) "Start the identd server with the default port. The default port is specified by `erc-identd-port'." (erc-identd-start)) ;;;###autoload -(defun erc-identd-stop (&rest ignore) +(defun erc-identd-stop (&rest _ignore) (interactive) (when erc-identd-process (delete-process erc-identd-process) diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el index ecdfc2a04b5..b2a2dc588e5 100644 --- a/lisp/erc/erc-imenu.el +++ b/lisp/erc/erc-imenu.el @@ -1,4 +1,4 @@ -;;; erc-imenu.el -- Imenu support for ERC +;;; erc-imenu.el -- Imenu support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation, ;; Inc. @@ -71,7 +71,7 @@ Don't rely on this function, read it first!" (message-alist '()) (mode-change-alist '()) (topic-change-alist '()) - prev-pos) + ) ;; prev-pos (goto-char (point-max)) (while (if (bolp) (> (forward-line -1) @@ -106,7 +106,8 @@ Don't rely on this function, read it first!" "^\\(\\S-+\\) (.+) has set the topic for \\S-+: \\(.*\\)$" notice-text) (push (cons (concat (match-string 1 notice-text) ": " - (match-string 2 notice-text)) pos) + (match-string 2 notice-text)) + pos) topic-change-alist))))) (when (looking-at "<\\(\\S-+\\)> \\(.+\\)$") (let ((from (match-string 1)) diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 1707e714cc1..2ad9c8bd941 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -1,4 +1,4 @@ -;;; erc-join.el --- autojoin channels on connect and reconnects +;;; erc-join.el --- autojoin channels on connect and reconnects -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -42,14 +42,14 @@ ;;;###autoload(autoload 'erc-autojoin-mode "erc-join" nil t) (define-erc-module autojoin nil "Makes ERC autojoin on connects and reconnects." - ((add-hook 'erc-after-connect 'erc-autojoin-channels) - (add-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident) - (add-hook 'erc-server-JOIN-functions 'erc-autojoin-add) - (add-hook 'erc-server-PART-functions 'erc-autojoin-remove)) - ((remove-hook 'erc-after-connect 'erc-autojoin-channels) - (remove-hook 'erc-nickserv-identified-hook 'erc-autojoin-after-ident) - (remove-hook 'erc-server-JOIN-functions 'erc-autojoin-add) - (remove-hook 'erc-server-PART-functions 'erc-autojoin-remove))) + ((add-hook 'erc-after-connect #'erc-autojoin-channels) + (add-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident) + (add-hook 'erc-server-JOIN-functions #'erc-autojoin-add) + (add-hook 'erc-server-PART-functions #'erc-autojoin-remove)) + ((remove-hook 'erc-after-connect #'erc-autojoin-channels) + (remove-hook 'erc-nickserv-identified-hook #'erc-autojoin-after-ident) + (remove-hook 'erc-server-JOIN-functions #'erc-autojoin-add) + (remove-hook 'erc-server-PART-functions #'erc-autojoin-remove))) (defcustom erc-autojoin-channels-alist nil "Alist of channels to autojoin on IRC networks. @@ -70,7 +70,6 @@ keeps track of what channels you are on, and will join them again when you get disconnected. When you restart Emacs, however, those changes are lost, and the customization you saved the last time is used again." - :group 'erc-autojoin :type '(repeat (cons :tag "Server" (regexp :tag "Name") (repeat :tag "Channels" @@ -82,7 +81,6 @@ If the value is `connect', autojoin immediately on connecting. If the value is `ident', autojoin after successful NickServ identification, or after `erc-autojoin-delay' seconds. Any other value means the same as `connect'." - :group 'erc-autojoin :version "24.1" :type '(choice (const :tag "On Connection" connect) (const :tag "When Identified" ident))) @@ -92,7 +90,6 @@ Any other value means the same as `connect'." This only takes effect if `erc-autojoin-timing' is `ident'. If NickServ identification occurs before this delay expires, ERC autojoins immediately at that time." - :group 'erc-autojoin :version "24.1" :type 'integer) @@ -102,7 +99,6 @@ If non-nil, and a channel on the server a.b.c is joined, then only b.c is used as the server for `erc-autojoin-channels-alist'. This is important for networks that redirect you to other servers, presumably in the same domain." - :group 'erc-autojoin :type 'boolean) (defvar-local erc--autojoin-timer nil) @@ -121,7 +117,7 @@ This is called from a timer set up by `erc-autojoin-channels'." (erc-log "Delayed autojoin started (no ident success detected yet)") (erc-autojoin-channels server nick)))) -(defun erc-autojoin-after-ident (network nick) +(defun erc-autojoin-after-ident (_network _nick) "Autojoin channels in `erc-autojoin-channels-alist'. This function is run from `erc-nickserv-identified-hook'." (if erc--autojoin-timer @@ -149,7 +145,7 @@ This function is run from `erc-nickserv-identified-hook'." (when (> erc-autojoin-delay 0) (setq erc--autojoin-timer (run-with-timer erc-autojoin-delay nil - 'erc-autojoin-channels-delayed + #'erc-autojoin-channels-delayed server nick (current-buffer)))) ;; `erc-autojoin-timing' is `connect': (let ((server (or erc-session-server erc-server-announced-name))) diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el index 4163e5a08d0..136131ca36b 100644 --- a/lisp/erc/erc-lang.el +++ b/lisp/erc/erc-lang.el @@ -1,4 +1,4 @@ -;;; erc-lang.el --- provide the LANG command to ERC +;;; erc-lang.el --- provide the LANG command to ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el index cf150e74ab5..31693a7b77a 100644 --- a/lisp/erc/erc-list.el +++ b/lisp/erc/erc-list.el @@ -59,13 +59,13 @@ ;;;###autoload(autoload 'erc-list-mode "erc-list") (define-erc-module list nil "List channels nicely in a separate buffer." - ((remove-hook 'erc-server-321-functions 'erc-server-321-message) - (remove-hook 'erc-server-322-functions 'erc-server-322-message)) + ((remove-hook 'erc-server-321-functions #'erc-server-321-message) + (remove-hook 'erc-server-322-functions #'erc-server-322-message)) ((erc-with-all-buffers-of-server nil #'erc-open-server-buffer-p - (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t)) - (add-hook 'erc-server-321-functions 'erc-server-321-message t) - (add-hook 'erc-server-322-functions 'erc-server-322-message t))) + (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t)) + (add-hook 'erc-server-321-functions #'erc-server-321-message t) + (add-hook 'erc-server-322-functions #'erc-server-322-message t))) ;; Format a record for display. (defun erc-list-make-string (channel users topic) @@ -126,17 +126,17 @@ (defvar erc-list-menu-mode-map (let ((map (make-keymap))) (set-keymap-parent map special-mode-map) - (define-key map "k" 'erc-list-kill) - (define-key map "j" 'erc-list-join) - (define-key map "g" 'erc-list-revert) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) + (define-key map "k" #'erc-list-kill) + (define-key map "j" #'erc-list-join) + (define-key map "g" #'erc-list-revert) + (define-key map "n" #'next-line) + (define-key map "p" #'previous-line) map) "Local keymap for `erc-list-mode' buffers.") (defvar erc-list-menu-sort-button-map (let ((map (make-sparse-keymap))) - (define-key map [header-line mouse-1] 'erc-list-menu-sort-by-column) + (define-key map [header-line mouse-1] #'erc-list-menu-sort-by-column) (define-key map [follow-link] 'mouse-face) map) "Local keymap for ERC list menu mode sorting buttons.") @@ -181,12 +181,12 @@ (defun erc-list-install-322-handler (server-buffer) (with-current-buffer server-buffer ;; Arrange for 322 responses to insert into our buffer. - (add-hook 'erc-server-322-functions 'erc-list-handle-322 t t) + (add-hook 'erc-server-322-functions #'erc-list-handle-322 t t) ;; Arrange for 323 (end of list) to end this. (erc-once-with-server-event 323 (lambda (_proc _parsed) - (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))) + (remove-hook 'erc-server-322-functions #'erc-list-handle-322 t))) ;; Find the list buffer, empty it, and display it. (setq-local erc-list-buffer (get-buffer-create (concat "*Channels of " diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el index 22fd3d27136..ddd00afd73b 100644 --- a/lisp/erc/erc-log.el +++ b/lisp/erc/erc-log.el @@ -1,4 +1,4 @@ -;;; erc-log.el --- Logging facilities for ERC. +;;; erc-log.el --- Logging facilities for ERC. -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. @@ -112,7 +112,6 @@ SERVER and PORT are the parameters that were used to connect to BUFFERs If you want to write logs into different directories, make a custom function which returns the directory part and set `erc-log-channels-directory' to its name." - :group 'erc-log :type '(choice (const :tag "#channel!nick@server:port.txt" erc-generate-log-file-name-long) (const :tag "#channel!nick@network.txt" @@ -124,7 +123,6 @@ custom function which returns the directory part and set (defcustom erc-truncate-buffer-on-save nil "Erase the contents of any ERC (channel, query, server) buffer when it is saved." - :group 'erc-log :type 'boolean) (defcustom erc-enable-logging t @@ -138,7 +136,6 @@ This variable is buffer local. Setting it via \\[customize] sets the default value. Log files are stored in `erc-log-channels-directory'." - :group 'erc-log :type '(choice boolean function)) (make-variable-buffer-local 'erc-enable-logging) @@ -153,14 +150,12 @@ If this is the name of a function, the function will be called with the buffer, target, nick, server, and port arguments. See `erc-generate-log-file-name-function' for a description of these arguments." - :group 'erc-log :type '(choice directory (function "Function") (const :tag "Disable logging" nil))) (defcustom erc-log-insert-log-on-open nil "Insert log file contents into the buffer if a log file exists." - :group 'erc-log :type 'boolean) (defcustom erc-save-buffer-on-part t @@ -168,7 +163,6 @@ arguments." If you set this to nil, you may want to enable both `erc-log-write-after-send' and `erc-log-write-after-insert'." - :group 'erc-log :type 'boolean) (defcustom erc-save-queries-on-quit t @@ -176,7 +170,6 @@ If you set this to nil, you may want to enable both If you set this to nil, you may want to enable both `erc-log-write-after-send' and `erc-log-write-after-insert'." - :group 'erc-log :type 'boolean) (defcustom erc-log-write-after-send nil @@ -184,7 +177,6 @@ If you set this to nil, you may want to enable both If you set this to nil, you may want to enable both `erc-save-buffer-on-part' and `erc-save-queries-on-quit'." - :group 'erc-log :type 'boolean) (defcustom erc-log-write-after-insert nil @@ -193,7 +185,6 @@ logged ERC buffer. If you set this to nil, you may want to enable both `erc-save-buffer-on-part' and `erc-save-queries-on-quit'." - :group 'erc-log :type 'boolean) (defcustom erc-log-file-coding-system 'emacs-mule @@ -201,15 +192,13 @@ If you set this to nil, you may want to enable both This should ideally, be a \"catch-all\" coding system, like `emacs-mule', or `iso-2022-7bit'." - :type 'coding-system - :group 'erc-log) + :type 'coding-system) (defcustom erc-log-filter-function nil "If non-nil, pass text through the given function before writing it to a log file. The function should take one argument, which is the text to filter." - :group 'erc-log :type '(choice (function "Function") (const :tag "No filtering" nil))) @@ -232,31 +221,31 @@ also be a predicate function. To only log when you are not set away, use: (null (erc-away-time)))))" ;; enable ((when erc-log-write-after-insert - (add-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs)) + (add-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs)) (when erc-log-write-after-send - (add-hook 'erc-send-post-hook 'erc-save-buffer-in-logs)) - (add-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) - (add-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) - (add-hook 'kill-emacs-hook 'erc-log-save-all-buffers) - (add-hook 'erc-quit-hook 'erc-conditional-save-queries) - (add-hook 'erc-part-hook 'erc-conditional-save-buffer) + (add-hook 'erc-send-post-hook #'erc-save-buffer-in-logs)) + (add-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs) + (add-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs) + (add-hook 'kill-emacs-hook #'erc-log-save-all-buffers) + (add-hook 'erc-quit-hook #'erc-conditional-save-queries) + (add-hook 'erc-part-hook #'erc-conditional-save-buffer) ;; append, so that 'erc-initialize-log-marker runs first - (add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append) + (add-hook 'erc-connect-pre-hook #'erc-log-setup-logging 'append) (dolist (buffer (erc-buffer-list)) (erc-log-setup-logging buffer))) ;; disable - ((remove-hook 'erc-insert-post-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-send-post-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-kill-buffer-hook 'erc-save-buffer-in-logs) - (remove-hook 'erc-kill-channel-hook 'erc-save-buffer-in-logs) - (remove-hook 'kill-emacs-hook 'erc-log-save-all-buffers) - (remove-hook 'erc-quit-hook 'erc-conditional-save-queries) - (remove-hook 'erc-part-hook 'erc-conditional-save-buffer) - (remove-hook 'erc-connect-pre-hook 'erc-log-setup-logging) + ((remove-hook 'erc-insert-post-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-send-post-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-kill-buffer-hook #'erc-save-buffer-in-logs) + (remove-hook 'erc-kill-channel-hook #'erc-save-buffer-in-logs) + (remove-hook 'kill-emacs-hook #'erc-log-save-all-buffers) + (remove-hook 'erc-quit-hook #'erc-conditional-save-queries) + (remove-hook 'erc-part-hook #'erc-conditional-save-buffer) + (remove-hook 'erc-connect-pre-hook #'erc-log-setup-logging) (dolist (buffer (erc-buffer-list)) (erc-log-disable-logging buffer)))) -(define-key erc-mode-map "\C-c\C-l" 'erc-save-buffer-in-logs) +(define-key erc-mode-map "\C-c\C-l" #'erc-save-buffer-in-logs) ;;; functionality referenced from erc.el (defun erc-log-setup-logging (buffer) @@ -357,13 +346,13 @@ The result is converted to lowercase, as IRC is case-insensitive." buffer target nick server port) erc-log-channels-directory))))) -(defun erc-generate-log-file-name-with-date (buffer &rest ignore) +(defun erc-generate-log-file-name-with-date (buffer &rest _ignore) "This function computes a short log file name. The name of the log file is composed of BUFFER and the current date. This function is a possible value for `erc-generate-log-file-name-function'." (concat (buffer-name buffer) "-" (format-time-string "%Y-%m-%d") ".txt")) -(defun erc-generate-log-file-name-short (buffer &rest ignore) +(defun erc-generate-log-file-name-short (buffer &rest _ignore) "This function computes a short log file name. In fact, it only uses the buffer name of the BUFFER argument, so you can affect that using `rename-buffer' and the-like. This @@ -371,7 +360,7 @@ function is a possible value for `erc-generate-log-file-name-function'." (concat (buffer-name buffer) ".txt")) -(defun erc-generate-log-file-name-long (buffer target nick server port) +(defun erc-generate-log-file-name-long (_buffer target nick server port) "Generates a log-file name in the way ERC always did it. This results in a file name of the form #channel!nick@server:port.txt. This function is a possible value for `erc-generate-log-file-name-function'." @@ -385,7 +374,7 @@ This function is a possible value for `erc-generate-log-file-name-function'." (declare-function erc-network-name "erc-networks" ()) -(defun erc-generate-log-file-name-network (buffer target nick server port) +(defun erc-generate-log-file-name-network (buffer target nick server _port) "Generates a log-file name using the network name rather than server name. This results in a file name of the form #channel!nick@network.txt. This function is a possible value for `erc-generate-log-file-name-function'." diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index eede15c11af..43fbca3e666 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -1,4 +1,4 @@ -;;; erc-match.el --- Highlight messages matching certain regexps +;;; erc-match.el --- Highlight messages matching certain regexps -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -52,19 +52,17 @@ they are hidden or highlighted. This is controlled via the variables `erc-current-nick-highlight-type'. For all these highlighting types, you can decide whether the entire message or only the sending nick is highlighted." - ((add-hook 'erc-insert-modify-hook 'erc-match-message 'append)) - ((remove-hook 'erc-insert-modify-hook 'erc-match-message))) + ((add-hook 'erc-insert-modify-hook #'erc-match-message 'append)) + ((remove-hook 'erc-insert-modify-hook #'erc-match-message))) ;; Remaining customizations (defcustom erc-pals nil "List of pals on IRC." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-fools nil "List of fools on IRC." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-keywords nil @@ -72,14 +70,12 @@ highlighted." Each entry in the list is either a regexp, or a cons cell with the regexp in the car and the face to use in the cdr. If no face is specified, `erc-keyword-face' is used." - :group 'erc-match :type '(repeat (choice regexp (list regexp face)))) (defcustom erc-dangerous-hosts nil "List of regexps for hosts to highlight. Useful to mark nicks from dangerous hosts." - :group 'erc-match :type '(repeat regexp)) (defcustom erc-current-nick-highlight-type 'keyword @@ -99,7 +95,6 @@ The following values are allowed: current nickname occurs Any other value disables highlighting of current nickname altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const keyword) @@ -120,7 +115,6 @@ The following values are allowed: from pal Any other value disables pal highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -139,7 +133,6 @@ The following values are allowed: from fool Any other value disables fool highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -157,7 +150,6 @@ The following values are allowed: containing keyword Any other value disables keyword highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const keyword) (const message) @@ -175,7 +167,6 @@ The following values are allowed: from dangerous-host Any other value disables dangerous-host highlighting altogether." - :group 'erc-match :type '(choice (const nil) (const nick) (const message) @@ -193,7 +184,6 @@ Valid match type keys are: The other element of each cons pair in this list is the buffer name to use for the logged message." - :group 'erc-match :type '(repeat (cons (choice :tag "Key" (const keyword) (const pal) @@ -207,7 +197,6 @@ use for the logged message." When nil, don't log any matched messages. When t, log messages. When `away', log messages only when away." - :group 'erc-match :type '(choice (const nil) (const away) (const t))) @@ -222,14 +211,12 @@ will be formatted. The various format specs are: %u Nickname!user@host of sender %c Channel in which this was received %m Message" - :group 'erc-match :type 'string) (defcustom erc-beep-match-types '(current-nick) "Types of matches to beep for when a match occurs. The function `erc-beep-on-match' needs to be added to `erc-text-matched-hook' for beeping to work." - :group 'erc-match :type '(choice (repeat :tag "Beep on match" (choice (const current-nick) (const keyword) @@ -244,14 +231,12 @@ Functions in this hook are passed as arguments: \(match-type nick!user@host message) where MATCH-TYPE is a symbol of: current-nick, keyword, pal, dangerous-host, fool." :options '(erc-log-matches erc-hide-fools erc-beep-on-match) - :group 'erc-match :type 'hook) (defcustom erc-match-exclude-server-buffer nil "If true, don't perform match on the server buffer; this is useful for excluding all the things like MOTDs from the server and other miscellaneous functions." - :group 'erc-match :version "24.3" :type 'boolean) @@ -390,7 +375,7 @@ car is the string." (interactive) (erc-remove-entry-from-list 'erc-dangerous-hosts "Delete dangerous-host: ")) -(defun erc-match-current-nick-p (nickuserhost msg) +(defun erc-match-current-nick-p (_nickuserhost msg) "Check whether the current nickname is in MSG. NICKUSERHOST will be ignored." (with-syntax-table erc-match-syntax-table @@ -400,7 +385,7 @@ NICKUSERHOST will be ignored." "\\b") msg)))) -(defun erc-match-pal-p (nickuserhost msg) +(defun erc-match-pal-p (nickuserhost _msg) "Check whether NICKUSERHOST is in `erc-pals'. MSG will be ignored." (and nickuserhost @@ -412,7 +397,7 @@ MSG will be ignored." (or (erc-list-match erc-fools nickuserhost) (erc-match-directed-at-fool-p msg)))) -(defun erc-match-keyword-p (nickuserhost msg) +(defun erc-match-keyword-p (_nickuserhost msg) "Check whether any keyword of `erc-keywords' matches for MSG. NICKUSERHOST will be ignored." (and msg @@ -424,7 +409,7 @@ NICKUSERHOST will be ignored." erc-keywords) msg))) -(defun erc-match-dangerous-host-p (nickuserhost msg) +(defun erc-match-dangerous-host-p (nickuserhost _msg) "Check whether NICKUSERHOST is in `erc-dangerous-hosts'. MSG will be ignored." (and nickuserhost @@ -457,7 +442,7 @@ Use this defun with `erc-insert-modify-hook'." (nickuserhost (erc-get-parsed-vector-nick vector)) (nickname (and nickuserhost (nth 0 (erc-parse-user nickuserhost)))) - (old-pt (point)) + ;; (old-pt (point)) (nick-beg (and nickname (re-search-forward (regexp-quote nickname) (point-max) t) @@ -484,11 +469,12 @@ Use this defun with `erc-insert-modify-hook'." (goto-char (point-min)) (let* ((match-prefix (concat "erc-" match-type)) (match-pred (intern (concat "erc-match-" match-type "-p"))) - (match-htype (eval (intern (concat match-prefix - "-highlight-type")))) + (match-htype (symbol-value (intern (concat match-prefix + "-highlight-type")))) (match-regex (if (string= match-type "current-nick") (regexp-quote (erc-current-nick)) - (eval (intern (concat match-prefix "s"))))) + (symbol-value + (intern (concat match-prefix "s"))))) (match-face (intern (concat match-prefix "-face")))) (when (funcall match-pred nickuserhost message) (cond @@ -601,7 +587,7 @@ See `erc-log-match-format'." (kill-buffer buffer))))) buffer))) -(defun erc-log-matches-come-back (proc parsed) +(defun erc-log-matches-come-back (_proc _parsed) "Display a notice that messages were logged while away." (when (and (erc-away-time) (eq erc-log-matches-flag 'away)) @@ -629,7 +615,7 @@ See `erc-log-match-format'." nil) ; This handler must be run _before_ erc-process-away is. -(add-hook 'erc-server-305-functions 'erc-log-matches-come-back nil) +(add-hook 'erc-server-305-functions #'erc-log-matches-come-back nil) (defun erc-go-to-log-matches-buffer () "Interactively open an erc-log-matches buffer." @@ -642,9 +628,9 @@ See `erc-log-match-format'." (get-buffer (car buffer-cons)))))) (switch-to-buffer buffer-name))) -(define-key erc-mode-map "\C-c\C-k" 'erc-go-to-log-matches-buffer) +(define-key erc-mode-map "\C-c\C-k" #'erc-go-to-log-matches-buffer) -(defun erc-hide-fools (match-type nickuserhost message) +(defun erc-hide-fools (match-type _nickuserhost _message) "Hide foolish comments. This function should be called from `erc-text-matched-hook'." (when (eq match-type 'fool) @@ -652,7 +638,7 @@ This function should be called from `erc-text-matched-hook'." '(invisible intangible) (current-buffer)))) -(defun erc-beep-on-match (match-type nickuserhost message) +(defun erc-beep-on-match (match-type _nickuserhost _message) "Beep when text matches. This function is meant to be called from `erc-text-matched-hook'." (when (member match-type erc-beep-match-types) diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el index d76e0a345ef..0dc819fbbbe 100644 --- a/lisp/erc/erc-menu.el +++ b/lisp/erc/erc-menu.el @@ -1,4 +1,4 @@ -;; erc-menu.el -- Menu-bar definitions for ERC +;; erc-menu.el -- Menu-bar definitions for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc. diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el index 37fc4cf16c1..9cfb947003c 100644 --- a/lisp/erc/erc-netsplit.el +++ b/lisp/erc/erc-netsplit.el @@ -1,4 +1,4 @@ -;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits +;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -42,30 +42,27 @@ netsplits, so that it can filter the JOIN messages on a netjoin too." (define-erc-module netsplit nil "This mode hides quit/join messages if a netsplit occurs." ((erc-netsplit-install-message-catalogs) - (add-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN) - (add-hook 'erc-server-MODE-functions 'erc-netsplit-MODE) - (add-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT) - (add-hook 'erc-timer-hook 'erc-netsplit-timer)) - ((remove-hook 'erc-server-JOIN-functions 'erc-netsplit-JOIN) - (remove-hook 'erc-server-MODE-functions 'erc-netsplit-MODE) - (remove-hook 'erc-server-QUIT-functions 'erc-netsplit-QUIT) - (remove-hook 'erc-timer-hook 'erc-netsplit-timer))) + (add-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN) + (add-hook 'erc-server-MODE-functions #'erc-netsplit-MODE) + (add-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT) + (add-hook 'erc-timer-hook #'erc-netsplit-timer)) + ((remove-hook 'erc-server-JOIN-functions #'erc-netsplit-JOIN) + (remove-hook 'erc-server-MODE-functions #'erc-netsplit-MODE) + (remove-hook 'erc-server-QUIT-functions #'erc-netsplit-QUIT) + (remove-hook 'erc-timer-hook #'erc-netsplit-timer))) (defcustom erc-netsplit-show-server-mode-changes-flag nil "Set to t to enable display of server mode changes." - :group 'erc-netsplit :type 'boolean) (defcustom erc-netsplit-debug nil "If non-nil, debug messages will be shown in the sever buffer." - :group 'erc-netsplit :type 'boolean) (defcustom erc-netsplit-regexp "^[^ @!\"\n]+\\.[^ @!\n]+ [^ @!\n]+\\.[^ @!\"\n]+$" "This regular expression should match quit reasons produced by netsplits." - :group 'erc-netsplit :type 'regexp) (defcustom erc-netsplit-hook nil @@ -190,13 +187,13 @@ join from that split has been detected or not.") (erc-display-message nil 'notice 'active 'netsplit-wholeft ?s (car elt) - ?n (mapconcat 'erc-extract-nick (nthcdr 3 elt) " ") + ?n (mapconcat #'erc-extract-nick (nthcdr 3 elt) " ") ?t (if (nth 2 elt) "(joining)" ""))))) t) -(defalias 'erc-cmd-WL 'erc-cmd-WHOLEFT) +(defalias 'erc-cmd-WL #'erc-cmd-WHOLEFT) (provide 'erc-netsplit) diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el index 9926255e3aa..aed02a9e267 100644 --- a/lisp/erc/erc-networks.el +++ b/lisp/erc/erc-networks.el @@ -1,4 +1,4 @@ -;;; erc-networks.el --- IRC networks +;;; erc-networks.el --- IRC networks -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004-2021 Free Software Foundation, Inc. @@ -443,7 +443,6 @@ NET is a symbol indicating to which network from `erc-networks-alist' this server corresponds, HOST is the servers hostname and PORTS is either a number, a list of numbers, or a list of port ranges." - :group 'erc-networks :type '(alist :key-type (string :tag "Name") :value-type (group symbol (string :tag "Hostname") @@ -714,7 +713,6 @@ MATCHER is used to find a corresponding network to a server while connected to it. If it is regexp, it's used to match against `erc-server-announced-name'. It can also be a function (predicate). Then it is executed with the server buffer as current-buffer." - :group 'erc-networks :type '(repeat (list :tag "Network" (symbol :tag "Network name") @@ -762,25 +760,25 @@ Return the name of this server's network as a symbol." "Return the name of the current network as a string." (erc-with-server-buffer (symbol-name erc-network))) -(defun erc-set-network-name (proc parsed) +(defun erc-set-network-name (_proc _parsed) "Set `erc-network' to the value returned by `erc-determine-network'." (unless erc-server-connected (setq erc-network (erc-determine-network))) nil) -(defun erc-unset-network-name (nick ip reason) +(defun erc-unset-network-name (_nick _ip _reason) "Set `erc-network' to nil." (setq erc-network nil) nil) (define-erc-module networks nil "Provide data about IRC networks." - ((add-hook 'erc-server-375-functions 'erc-set-network-name) - (add-hook 'erc-server-422-functions 'erc-set-network-name) - (add-hook 'erc-disconnected-hook 'erc-unset-network-name)) - ((remove-hook 'erc-server-375-functions 'erc-set-network-name) - (remove-hook 'erc-server-422-functions 'erc-set-network-name) - (remove-hook 'erc-disconnected-hook 'erc-unset-network-name))) + ((add-hook 'erc-server-375-functions #'erc-set-network-name) + (add-hook 'erc-server-422-functions #'erc-set-network-name) + (add-hook 'erc-disconnected-hook #'erc-unset-network-name)) + ((remove-hook 'erc-server-375-functions #'erc-set-network-name) + (remove-hook 'erc-server-422-functions #'erc-set-network-name) + (remove-hook 'erc-disconnected-hook #'erc-unset-network-name))) (defun erc-ports-list (ports) "Return a list of PORTS. diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el index e133e05a7d3..1ed056c277d 100644 --- a/lisp/erc/erc-notify.el +++ b/lisp/erc/erc-notify.el @@ -42,20 +42,17 @@ (defcustom erc-notify-list nil "List of nicknames you want to be notified about online/offline status change." - :group 'erc-notify :type '(repeat string)) (defcustom erc-notify-interval 60 "Time interval (in seconds) for checking online status of notified people." - :group 'erc-notify :type 'integer) (defcustom erc-notify-signon-hook nil "Hook run after someone on `erc-notify-list' has signed on. Two arguments are passed to the function, SERVER and NICK, both strings." - :group 'erc-notify :type 'hook :options '(erc-notify-signon)) @@ -63,7 +60,6 @@ strings." "Hook run after someone on `erc-notify-list' has signed off. Two arguments are passed to the function, SERVER and NICK, both strings." - :group 'erc-notify :type 'hook :options '(erc-notify-signoff)) @@ -95,14 +91,14 @@ strings." (define-erc-module notify nil "Periodically check for the online status of certain users and report changes." - ((add-hook 'erc-timer-hook 'erc-notify-timer) - (add-hook 'erc-server-JOIN-functions 'erc-notify-JOIN) - (add-hook 'erc-server-NICK-functions 'erc-notify-NICK) - (add-hook 'erc-server-QUIT-functions 'erc-notify-QUIT)) - ((remove-hook 'erc-timer-hook 'erc-notify-timer) - (remove-hook 'erc-server-JOIN-functions 'erc-notify-JOIN) - (remove-hook 'erc-server-NICK-functions 'erc-notify-NICK) - (remove-hook 'erc-server-QUIT-functions 'erc-notify-QUIT))) + ((add-hook 'erc-timer-hook #'erc-notify-timer) + (add-hook 'erc-server-JOIN-functions #'erc-notify-JOIN) + (add-hook 'erc-server-NICK-functions #'erc-notify-NICK) + (add-hook 'erc-server-QUIT-functions #'erc-notify-QUIT)) + ((remove-hook 'erc-timer-hook #'erc-notify-timer) + (remove-hook 'erc-server-JOIN-functions #'erc-notify-JOIN) + (remove-hook 'erc-server-NICK-functions #'erc-notify-NICK) + (remove-hook 'erc-server-QUIT-functions #'erc-notify-QUIT))) ;;;; Timer handler @@ -137,7 +133,7 @@ changes." (setq erc-last-ison ison-list) t))) (erc-server-send - (concat "ISON " (mapconcat 'identity erc-notify-list " "))) + (concat "ISON " (mapconcat #'identity erc-notify-list " "))) (setq erc-last-ison-time now))) (defun erc-notify-JOIN (proc parsed) @@ -211,7 +207,7 @@ with args, toggle notify status of people." 'notify_current ?l ison)))) ((string= (car args) "-l") (erc-display-message nil 'notice 'active - 'notify_list ?l (mapconcat 'identity erc-notify-list + 'notify_list ?l (mapconcat #'identity erc-notify-list " "))) (t (while args @@ -231,7 +227,7 @@ with args, toggle notify status of people." (setq args (cdr args))) (erc-display-message nil 'notice 'active - 'notify_list ?l (mapconcat 'identity erc-notify-list " ")))) + 'notify_list ?l (mapconcat #'identity erc-notify-list " ")))) t) (autoload 'pcomplete-erc-all-nicks "erc-pcomplete") diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el index 0cb60f5efa0..4c244b7984d 100644 --- a/lisp/erc/erc-page.el +++ b/lisp/erc/erc-page.el @@ -1,4 +1,4 @@ -;; erc-page.el - CTCP PAGE support for ERC +;; erc-page.el - CTCP PAGE support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002, 2004, 2006-2021 Free Software Foundation, Inc. @@ -30,6 +30,10 @@ (require 'erc) +(defgroup erc-page nil + "React to CTCP PAGE messages." + :group 'erc) + ;;;###autoload(autoload 'erc-page-mode "erc-page") (define-erc-module page ctcp-page "Process CTCP PAGE requests from IRC." @@ -37,10 +41,6 @@ (erc-define-catalog-entry 'english 'CTCP-PAGE "Page from %n (%u@%h): %m") -(defgroup erc-page nil - "React to CTCP PAGE messages." - :group 'erc) - (defcustom erc-page-function nil "A function to process a \"page\" request. If nil, this prints the page message in the minibuffer and calls @@ -53,20 +53,18 @@ Example for your init file: (lambda (sender msg) (play-sound-file \"/home/alex/elisp/erc/sounds/ni.wav\") (message \"IRC Page from %s: %s\" sender msg)))" - :group 'erc-page :type '(choice (const nil) (function))) -(defcustom erc-ctcp-query-PAGE-hook '(erc-ctcp-query-PAGE) +(defcustom erc-ctcp-query-PAGE-hook (list #'erc-ctcp-query-PAGE) "List of functions to be called when a CTCP PAGE is received. This is called from `erc-process-ctcp-query'. The functions are called with six arguments: PROC NICK LOGIN HOST TO MSG. Note that you can also set `erc-page-function' to a function, which only gets two arguments, SENDER and MSG, so that might be easier to use." - :group 'erc-page :type '(repeat function)) -(defun erc-ctcp-query-PAGE (proc nick login host to msg) +(defun erc-ctcp-query-PAGE (_proc nick login host _to msg) "Deal with an CTCP PAGE query, if `erc-page-mode' is non-nil. This will call `erc-page-function', if defined, or it will just print a message and `beep'. In addition to that, the page message is also @@ -91,7 +89,7 @@ inserted into the server buffer." nil 'notice nil text))) nil) -(defun erc-cmd-PAGE (line &optional force) +(defun erc-cmd-PAGE (line &optional _force) "Send a CTCP page to the user given as the first word in LINE. The rest of LINE is the message to send. Note that you will only receive pages if `erc-page-mode' is on." diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el index e9ebf0a07a4..8ea37c7f290 100644 --- a/lisp/erc/erc-pcomplete.el +++ b/lisp/erc/erc-pcomplete.el @@ -1,4 +1,4 @@ -;;; erc-pcomplete.el --- Provides programmable completion for ERC +;;; erc-pcomplete.el --- Provides programmable completion for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2004, 2006-2021 Free Software Foundation, Inc. @@ -50,23 +50,21 @@ (defcustom erc-pcomplete-nick-postfix ":" "When `pcomplete' is used in the first word after the prompt, add this string to nicks completed." - :group 'erc-pcomplete :type 'string) (defcustom erc-pcomplete-order-nickname-completions t "If t, channel nickname completions will be ordered such that the most recent speakers are listed first." - :group 'erc-pcomplete :type 'boolean) ;;;###autoload(autoload 'erc-completion-mode "erc-pcomplete" nil t) (define-erc-module pcomplete Completion "In ERC Completion mode, the TAB key does completion whenever possible." - ((add-hook 'erc-mode-hook 'pcomplete-erc-setup) - (add-hook 'erc-complete-functions 'erc-pcompletions-at-point) + ((add-hook 'erc-mode-hook #'pcomplete-erc-setup) + (add-hook 'erc-complete-functions #'erc-pcompletions-at-point) (erc-buffer-list #'pcomplete-erc-setup)) - ((remove-hook 'erc-mode-hook 'pcomplete-erc-setup) - (remove-hook 'erc-complete-functions 'erc-pcompletions-at-point))) + ((remove-hook 'erc-mode-hook #'pcomplete-erc-setup) + (remove-hook 'erc-complete-functions #'erc-pcompletions-at-point))) (defun erc-pcompletions-at-point () "ERC completion data from pcomplete. @@ -154,7 +152,7 @@ for use on `completion-at-point-function'." (defun pcomplete/erc-mode/NAMES () (while (pcomplete-here (pcomplete-erc-channels)))) -(defalias 'pcomplete/erc-mode/NOTICE 'pcomplete/erc-mode/MSG) +(defalias 'pcomplete/erc-mode/NOTICE #'pcomplete/erc-mode/MSG) (defun pcomplete/erc-mode/OP () (while (pcomplete-here (pcomplete-erc-not-ops)))) @@ -162,7 +160,7 @@ for use on `completion-at-point-function'." (defun pcomplete/erc-mode/PART () (pcomplete-here (pcomplete-erc-channels))) -(defalias 'pcomplete/erc-mode/LEAVE 'pcomplete/erc-mode/PART) +(defalias 'pcomplete/erc-mode/LEAVE #'pcomplete/erc-mode/PART) (defun pcomplete/erc-mode/QUERY () (pcomplete-here (append (pcomplete-erc-all-nicks) diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el index c67d7514037..d08d9850c10 100644 --- a/lisp/erc/erc-replace.el +++ b/lisp/erc/erc-replace.el @@ -1,4 +1,4 @@ -;; erc-replace.el -- wash and massage messages inserted into the buffer +;; erc-replace.el -- wash and massage messages inserted into the buffer -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2002, 2004, 2006-2021 Free Software Foundation, ;; Inc. @@ -49,7 +49,6 @@ expression or a variable, or any sexp, TO can be a string or a function to call, or any sexp. If a function, it will be called with one argument, the string to be replaced, and it should return a replacement string." - :group 'erc-replace :type '(repeat (cons :tag "Search & Replace" (choice :tag "From" regexp @@ -68,23 +67,23 @@ It replaces text according to `erc-replace-alist'." (let ((from (car elt)) (to (cdr elt))) (unless (stringp from) - (setq from (eval from))) + (setq from (eval from t))) (while (re-search-forward from nil t) (cond ((stringp to) (replace-match to)) - ((and (symbolp to) (fboundp to)) + ((functionp to) (replace-match (funcall to (match-string 0)))) (t - (eval to)))))) + (eval to t)))))) erc-replace-alist)) ;;;###autoload(autoload 'erc-replace-mode "erc-replace") (define-erc-module replace nil "This mode replaces incoming text according to `erc-replace-alist'." ((add-hook 'erc-insert-modify-hook - 'erc-replace-insert)) + #'erc-replace-insert)) ((remove-hook 'erc-insert-modify-hook - 'erc-replace-insert))) + #'erc-replace-insert))) (provide 'erc-replace) diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el index 028ab1eead8..28299ae46c3 100644 --- a/lisp/erc/erc-ring.el +++ b/lisp/erc/erc-ring.el @@ -1,4 +1,4 @@ -;; erc-ring.el -- Command history handling for erc using ring.el +;; erc-ring.el -- Command history handling for erc using ring.el -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -46,12 +46,12 @@ (define-erc-module ring nil "Stores input in a ring so that previous commands and messages can be recalled using M-p and M-n." - ((add-hook 'erc-pre-send-functions 'erc-add-to-input-ring) - (define-key erc-mode-map "\M-p" 'erc-previous-command) - (define-key erc-mode-map "\M-n" 'erc-next-command)) - ((remove-hook 'erc-pre-send-functions 'erc-add-to-input-ring) - (define-key erc-mode-map "\M-p" 'undefined) - (define-key erc-mode-map "\M-n" 'undefined))) + ((add-hook 'erc-pre-send-functions #'erc-add-to-input-ring) + (define-key erc-mode-map "\M-p" #'erc-previous-command) + (define-key erc-mode-map "\M-n" #'erc-next-command)) + ((remove-hook 'erc-pre-send-functions #'erc-add-to-input-ring) + (define-key erc-mode-map "\M-p" #'undefined) + (define-key erc-mode-map "\M-n" #'undefined))) (defvar-local erc-input-ring nil "Input ring for erc.") diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index 9ef8b7f46ab..09d1f7a3302 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -91,7 +91,6 @@ Possible settings are:. nil - Disables automatic Nickserv identification. You can also use \\[erc-nickserv-identify-mode] to change modes." - :group 'erc-services :type '(choice (const autodetect) (const nick-change) (const both) @@ -107,13 +106,13 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." "This mode automates communication with services." ((erc-nickserv-identify-mode erc-nickserv-identify-mode)) ((remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect))) + #'erc-nickserv-identification-autodetect))) ;;;###autoload (defun erc-nickserv-identify-mode (mode) @@ -123,7 +122,7 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." "Choose Nickserv identify mode (RET to disable): " '(("autodetect") ("nick-change") ("both")) nil t)))) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect) + #'erc-nickserv-identification-autodetect) (unless erc-networks-mode ;; Force-enable networks module, because we need it to set ;; erc-network for us. @@ -131,41 +130,40 @@ You can also use \\[erc-nickserv-identify-mode] to change modes." (cond ((eq mode 'autodetect) (setq erc-nickserv-identify-mode 'autodetect) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect)) + #'erc-nickserv-identify-on-connect)) ((eq mode 'nick-change) (setq erc-nickserv-identify-mode 'nick-change) (add-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (add-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect)) + #'erc-nickserv-identify-autodetect)) ((eq mode 'both) (setq erc-nickserv-identify-mode 'both) (add-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (add-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (add-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change)) + #'erc-nickserv-identify-on-nick-change)) (t (setq erc-nickserv-identify-mode nil) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identify-autodetect) + #'erc-nickserv-identify-autodetect) (remove-hook 'erc-after-connect - 'erc-nickserv-identify-on-connect) + #'erc-nickserv-identify-on-connect) (remove-hook 'erc-nick-changed-functions - 'erc-nickserv-identify-on-nick-change) + #'erc-nickserv-identify-on-nick-change) (remove-hook 'erc-server-NOTICE-functions - 'erc-nickserv-identification-autodetect)))) + #'erc-nickserv-identification-autodetect)))) (defcustom erc-prompt-for-nickserv-password t "Ask for the password when identifying to NickServ." - :group 'erc-services :type 'boolean) (defcustom erc-use-auth-source-for-nickserv-password nil @@ -174,7 +172,6 @@ This option has an no effect if `erc-prompt-for-nickserv-password' is non-nil, and passwords from `erc-nickserv-passwords' take precedence." :version "28.1" - :group 'erc-services :type 'boolean) (defcustom erc-nickserv-passwords nil @@ -187,7 +184,6 @@ Example of use: \\='((freenode ((\"nick-one\" . \"password\") (\"nick-two\" . \"password\"))) (DALnet ((\"nick\" . \"password\")))))" - :group 'erc-services :type '(repeat (list :tag "Network" (choice :tag "Network name" @@ -305,7 +301,6 @@ ANSWER is the command to use for the answer. The default is `privmsg'. SUCCESS-REGEXP is a regular expression matching the message nickserv sends when you've successfully identified. The last two elements are optional." - :group 'erc-services :type '(repeat (list :tag "Nickserv data" (symbol :tag "Network name") @@ -357,7 +352,6 @@ The last two elements are optional." (defcustom erc-nickserv-identified-hook nil "Run this hook when NickServ acknowledged successful identification. Hooks are called with arguments (NETWORK NICK)." - :group 'erc-services :type 'hook) (defun erc-nickserv-identification-autodetect (_proc parsed) diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el index fff1639a9de..92759d206a3 100644 --- a/lisp/erc/erc-sound.el +++ b/lisp/erc/erc-sound.el @@ -52,11 +52,11 @@ "In ERC sound mode, the client will respond to CTCP SOUND requests and play sound files as requested." ;; Enable: - ((add-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND) - (define-key erc-mode-map "\C-c\C-s" 'erc-toggle-sound)) + ((add-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND) + (define-key erc-mode-map "\C-c\C-s" #'erc-toggle-sound)) ;; Disable: - ((remove-hook 'erc-ctcp-query-SOUND-hook 'erc-ctcp-query-SOUND) - (define-key erc-mode-map "\C-c\C-s" 'undefined))) + ((remove-hook 'erc-ctcp-query-SOUND-hook #'erc-ctcp-query-SOUND) + (define-key erc-mode-map "\C-c\C-s" #'undefined))) (erc-define-catalog-entry 'english 'CTCP-SOUND "%n (%u@%h) plays %s:%m") diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index c2be23990f1..bb858445235 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -1,4 +1,4 @@ -;;; erc-speedbar.el --- Speedbar support for ERC +;;; erc-speedbar.el --- Speedbar support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. @@ -52,7 +52,6 @@ `activity' - Sort users by channel activity `alphabetical' - Sort users alphabetically nil - Do not sort users" - :group 'erc-speedbar :type '(choice (const :tag "Sort users by channel activity" activity) (const :tag "Sort users alphabetically" alphabetical) (const :tag "Do not sort users" nil))) @@ -67,11 +66,11 @@ nil - Do not sort users" (setq erc-speedbar-key-map (speedbar-make-specialized-keymap)) ;; Basic tree features - (define-key erc-speedbar-key-map "e" 'speedbar-edit-line) - (define-key erc-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key erc-speedbar-key-map "+" 'speedbar-expand-line) - (define-key erc-speedbar-key-map "=" 'speedbar-expand-line) - (define-key erc-speedbar-key-map "-" 'speedbar-contract-line)) + (define-key erc-speedbar-key-map "e" #'speedbar-edit-line) + (define-key erc-speedbar-key-map "\C-m" #'speedbar-edit-line) + (define-key erc-speedbar-key-map "+" #'speedbar-expand-line) + (define-key erc-speedbar-key-map "=" #'speedbar-expand-line) + (define-key erc-speedbar-key-map "-" #'speedbar-contract-line)) (speedbar-add-expansion-list '("ERC" erc-speedbar-menu-items erc-speedbar-key-map @@ -124,7 +123,7 @@ This will add a speedbar major display mode." (erc-speedbar-insert-target buffer 0)) (t (ignore))))) -(defun erc-speedbar-server-buttons (directory depth) +(defun erc-speedbar-server-buttons (_directory depth) "Insert the initial list of servers you are connected to." (let ((servers (erc-buffer-list (lambda () @@ -154,7 +153,7 @@ This will add a speedbar major display mode." (t (error "Ooops... not sure what to do"))) (speedbar-center-buffer-smartly)) -(defun erc-speedbar-channel-buttons (directory depth server-buffer) +(defun erc-speedbar-channel-buttons (_directory depth server-buffer) (when (get-buffer server-buffer) (let* ((proc (with-current-buffer server-buffer erc-server-process)) (targets (erc-buffer-list @@ -191,7 +190,7 @@ INDENT is the current indentation level." (save-excursion (end-of-line) (forward-char 1) (let ((modes (with-current-buffer channel - (concat (apply 'concat + (concat (apply #'concat erc-channel-modes) (cond ((and erc-channel-user-limit @@ -314,7 +313,7 @@ The update is only done when the channel is actually expanded already." (t (error "Ooops... not sure what to do"))) (speedbar-center-buffer-smartly)) -(defun erc-speedbar-goto-buffer (text buffer indent) +(defun erc-speedbar-goto-buffer (_text buffer _indent) "When user clicks on TEXT, goto an ERC buffer. The INDENT level is ignored." (if (featurep 'dframe) diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el index c18ac5b3ec0..950a821e3c4 100644 --- a/lisp/erc/erc-spelling.el +++ b/lisp/erc/erc-spelling.el @@ -1,4 +1,4 @@ -;;; erc-spelling.el --- use flyspell in ERC +;;; erc-spelling.el --- use flyspell in ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2021 Free Software Foundation, Inc. @@ -38,10 +38,10 @@ "Enable flyspell mode in ERC buffers." ;; Use erc-connect-pre-hook instead of erc-mode-hook as pre-hook is ;; called AFTER the server buffer is initialized. - ((add-hook 'erc-connect-pre-hook 'erc-spelling-init) + ((add-hook 'erc-connect-pre-hook #'erc-spelling-init) (dolist (buffer (erc-buffer-list)) (erc-spelling-init buffer))) - ((remove-hook 'erc-connect-pre-hook 'erc-spelling-init) + ((remove-hook 'erc-connect-pre-hook #'erc-spelling-init) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (flyspell-mode 0))))) @@ -104,7 +104,7 @@ The cadr is the beginning and the caddr is the end." (put 'erc-mode 'flyspell-mode-predicate - 'erc-spelling-flyspell-verify) + #'erc-spelling-flyspell-verify) (provide 'erc-spelling) diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index da91364e9cc..31de9e80697 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -52,7 +52,6 @@ This string is processed using `format-time-string'. Good examples are \"%T\" and \"%H:%M\". If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -66,7 +65,6 @@ screen when `erc-insert-timestamp-function' is set to `erc-insert-timestamp-left-and-right'. If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -80,7 +78,6 @@ screen when `erc-insert-timestamp-function' is set to `erc-insert-timestamp-left-and-right'. If nil, timestamping is turned off." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -95,7 +92,6 @@ operate on. You will probably want to set `erc-insert-away-timestamp-function' to the same value." - :group 'erc-stamp :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) @@ -108,7 +104,6 @@ If nil, timestamping is turned off when away unless `erc-timestamp-format' is set. If `erc-timestamp-format' is set, this will not be used." - :group 'erc-stamp :type '(choice (const nil) (string))) @@ -117,7 +112,6 @@ If `erc-timestamp-format' is set, this will not be used." "Function to use to insert the away timestamp. See `erc-insert-timestamp-function' for details." - :group 'erc-stamp :type '(choice (const :tag "Both sides" erc-insert-timestamp-left-and-right) (const :tag "Right" erc-insert-timestamp-right) (const :tag "Left" erc-insert-timestamp-left) @@ -128,7 +122,6 @@ See `erc-insert-timestamp-function' for details." This is useful for logging, because, although timestamps will be hidden, they will still be present in the logs." - :group 'erc-stamp :type 'boolean) (defcustom erc-echo-timestamps nil @@ -136,20 +129,17 @@ hidden, they will still be present in the logs." Using this variable, you can turn off normal timestamping, and simply move point to an irc message to see its timestamp printed in the minibuffer." - :group 'erc-stamp :type 'boolean) (defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S" "Format string to be used when `erc-echo-timestamps' is non-nil. This string specifies the format of the timestamp being echoed in the minibuffer." - :group 'erc-stamp :type 'string) (defcustom erc-timestamp-intangible nil "Whether the timestamps should be intangible, i.e. prevent the point from entering them and instead jump over them." - :group 'erc-stamp :version "24.5" :type 'boolean) @@ -211,7 +201,6 @@ string of spaces which is the same size as the timestamp is added to the beginning of the line in its place. If you use `erc-insert-timestamp-right', nothing gets inserted in place of the timestamp." - :group 'erc-stamp :type 'boolean) (defcustom erc-timestamp-right-column nil @@ -219,7 +208,6 @@ timestamp." if the timestamp is to be printed to the right. If nil, `erc-insert-timestamp-right' will use other means to determine the correct column." - :group 'erc-stamp :type '(choice (integer :tag "Column number") (const :tag "Unspecified" nil))) @@ -231,7 +219,6 @@ Asian language characters and math symbols) precede a timestamp. A side effect of enabling this is that there will only be one space before a right timestamp in any saved logs." - :group 'erc-stamp :type 'boolean) (defun erc-insert-timestamp-left (string) diff --git a/lisp/erc/erc-status-sidebar.el b/lisp/erc/erc-status-sidebar.el index ff51026088a..a75a74bb6fd 100644 --- a/lisp/erc/erc-status-sidebar.el +++ b/lisp/erc/erc-status-sidebar.el @@ -1,4 +1,4 @@ -;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC +;;; erc-status-sidebar.el --- HexChat-like activity overview for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2017, 2020-2021 Free Software Foundation, Inc. @@ -58,36 +58,30 @@ (defcustom erc-status-sidebar-buffer-name "*ERC Status*" "Name of the sidebar buffer." - :type 'string - :group 'erc-status-sidebar) + :type 'string) (defcustom erc-status-sidebar-mode-line-format "ERC Status" "Mode line format for the status sidebar." - :type 'string - :group 'erc-status-sidebar) + :type 'string) (defcustom erc-status-sidebar-header-line-format nil "Header line format for the status sidebar." :type '(choice (const :tag "No header line" nil) - string) - :group 'erc-status-sidebar) + string)) (defcustom erc-status-sidebar-width 15 "Default width of the sidebar (in columns)." - :type 'number - :group 'erc-status-sidebar) + :type 'number) (defcustom erc-status-sidebar-channel-sort 'erc-status-sidebar-default-chansort "Sorting function used to determine order of channels in the sidebar." - :type 'function - :group 'erc-status-sidebar) + :type 'function) (defcustom erc-status-sidebar-channel-format 'erc-status-sidebar-default-chan-format "Function used to format channel names for display in the sidebar." - :type 'function - :group 'erc-status-sidebar) + :type 'function) (defun erc-status-sidebar-display-window () "Display the status buffer in a side window. Return the new window." @@ -152,7 +146,8 @@ containing it on the current frame is closed. See (save-excursion (let ((sidebar-exists (erc-status-sidebar-buffer-exists-p)) (sidebar-buffer (erc-status-sidebar-get-buffer)) - (sidebar-window (erc-status-sidebar-get-window))) + ;; (sidebar-window (erc-status-sidebar-get-window)) + ) (unless sidebar-exists (with-current-buffer sidebar-buffer (erc-status-sidebar-mode) @@ -253,7 +248,7 @@ name stand out." erc-disconnected-hook erc-quit-hook)) -(defun erc-status-sidebar--post-refresh (&rest ignore) +(defun erc-status-sidebar--post-refresh (&rest _ignore) "Schedule sidebar refresh for execution after command stack is cleared. Ignore arguments in IGNORE, allowing this function to be added to @@ -276,7 +271,7 @@ to the `window-configuration-change-hook'." (when (and (eq (selected-window) (erc-status-sidebar-get-window)) (fboundp 'window-preserve-size)) (unless (eq (window-total-width) (window-min-size nil t)) - (apply 'window-preserve-size (selected-window) t t nil)))) + (apply #'window-preserve-size (selected-window) t t nil)))) (define-derived-mode erc-status-sidebar-mode special-mode "ERC Sidebar" "Major mode for ERC status sidebar" @@ -298,8 +293,7 @@ to the `window-configuration-change-hook'." ;; erc-status-sidebar-mode initialization code, so it won't undo the ;; add-hook's we did in the previous expressions. (add-hook 'change-major-mode-hook #'erc-status-sidebar-mode--unhook nil t) - (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t) - :group 'erc-status-sidebar) + (add-hook 'kill-buffer-hook #'erc-status-sidebar-mode--unhook nil t)) (provide 'erc-status-sidebar) ;;; erc-status-sidebar.el ends here diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index a853a362252..8be55558823 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -60,7 +60,6 @@ The reason for using this default value is to both (1) adhere to the Emacs development guidelines which say not to touch keys of the form C-c C- and also (2) to meet the expectations of long-time ERC users, many of whom rely on these keybindings." - :group 'erc-track :type '(choice (const :tag "Ask, if used already" ask) (const :tag "Enable" t) (const :tag "Disable" nil))) @@ -80,7 +79,6 @@ nil - only the selected frame selected-visible - only the selected frame if it is visible Activity means that there was no user input in the last 10 seconds." - :group 'erc-track :type '(choice (const :tag "All frames" t) (const :tag "All visible frames" visible) (const :tag "Only the selected frame" nil) @@ -89,13 +87,11 @@ Activity means that there was no user input in the last 10 seconds." (defcustom erc-track-exclude nil "A list targets (channel names or query targets) which should not be tracked." - :group 'erc-track :type '(repeat string)) (defcustom erc-track-remove-disconnected-buffers nil "If true, remove buffers associated with a server that is disconnected from `erc-modified-channels-alist'." - :group 'erc-track :type 'boolean) (defcustom erc-track-exclude-types '("NICK" "333" "353") @@ -105,25 +101,21 @@ This list could look like (\"JOIN\" \"PART\"). By default, exclude changes of nicknames (NICK), display of who set the channel topic (333), and listing of users on the current channel (353)." - :group 'erc-track :type 'erc-message-type) (defcustom erc-track-exclude-server-buffer nil "If true, don't perform tracking on the server buffer; this is useful for excluding all the things like MOTDs from the server and other miscellaneous functions." - :group 'erc-track :type 'boolean) (defcustom erc-track-shorten-start 1 "This number specifies the minimum number of characters a channel name in the mode-line should be reduced to." - :group 'erc-track :type 'number) (defcustom erc-track-shorten-cutoff 4 "All channel names longer than this value will be shortened." - :group 'erc-track :type 'number) (defcustom erc-track-shorten-aggressively nil @@ -144,7 +136,6 @@ not compared to #electronica -- only to #vi, therefore it can be shortened even more and the result is #e and #v. This setting is used by `erc-track-shorten-names'." - :group 'erc-track :type '(choice (const :tag "No" nil) (const :tag "Yes" t) (const :tag "Max" max))) @@ -154,7 +145,6 @@ This setting is used by `erc-track-shorten-names'." It takes one argument, CHANNEL-NAMES which is a list of strings. It should return a list of strings of the same number of elements. If nil instead of a function, shortening is disabled." - :group 'erc-track :type '(choice (const :tag "Disabled") function)) @@ -165,14 +155,12 @@ If nil instead of a function, shortening is disabled." This is useful for people that don't use the default mode-line notification but instead use a separate mechanism to provide notification of channel activity." - :group 'erc-track :type 'hook) (defcustom erc-track-use-faces t "Use faces in the mode-line. The faces used are the same as used for text in the buffers. \(e.g. `erc-pal-face' is used if a pal sent a message to that channel.)" - :group 'erc-track :type 'boolean) (defcustom erc-track-faces-priority-list @@ -199,7 +187,6 @@ The faces used are the same as used for text in the buffers. "A list of faces used to highlight active buffer names in the mode line. If a message contains one of the faces in this list, the buffer name will be highlighted using that face. The first matching face is used." - :group 'erc-track :type '(repeat (choice face (repeat :tag "Combination" face)))) @@ -214,7 +201,6 @@ this feature. Note: If you have a lot of faces listed in `erc-track-faces-priority-list', setting this variable might not be very useful." - :group 'erc-track :type '(choice (const nil) (repeat string) (const all))) @@ -237,7 +223,6 @@ message. This gives a rough indication that active conversations are occurring in these channels. The effect may be disabled by setting this variable to nil." - :group 'erc-track :type '(repeat (choice face (repeat :tag "Combination" face)))) @@ -249,7 +234,6 @@ Choices are: `after-modes' - add to the end of `mode-line-modes', t - add to the end of `global-mode-string', nil - don't add to mode line." - :group 'erc-track :type '(choice (const :tag "Just before mode information" before-modes) (const :tag "Just after mode information" after-modes) (const :tag "After all other information" t) @@ -266,7 +250,7 @@ nil - don't add to mode line." (if strings (concat (if (eq erc-track-position-in-mode-line 'after-modes) "[" " [") - (mapconcat 'identity (nreverse strings) ",") + (mapconcat #'identity (nreverse strings) ",") (if (eq erc-track-position-in-mode-line 'before-modes) "] " "]")) "")) @@ -289,20 +273,17 @@ while the buffer was not visible.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." - :type 'boolean - :group 'erc-track) + :type 'boolean) (defcustom erc-track-showcount-string ":" "The string to display between buffer name and the count in the mode line. The default is a colon, resulting in \"#emacs:9\"." - :type 'string - :group 'erc-track) + :type 'string) (defcustom erc-track-switch-from-erc t "If non-nil, `erc-track-switch-buffer' will return to the last non-erc buffer when there are no more active channels." - :type 'boolean - :group 'erc-track) + :type 'boolean) (defcustom erc-track-switch-direction 'oldest "Direction `erc-track-switch-buffer' should switch. @@ -316,7 +297,6 @@ when there are no more active channels." If set to `importance', the importance is determined by position in `erc-track-faces-priority-list', where first is most important." - :group 'erc-track :type '(choice (const importance) (const oldest) (const newest) @@ -472,9 +452,9 @@ START is the minimum length of the name used." (defvar erc-track-minor-mode-map (make-sparse-keymap) "Keymap for rcirc track minor mode.") -(define-key erc-track-minor-mode-map (kbd "C-c C-@") 'erc-track-switch-buffer) +(define-key erc-track-minor-mode-map (kbd "C-c C-@") #'erc-track-switch-buffer) (define-key erc-track-minor-mode-map (kbd "C-c C-SPC") - 'erc-track-switch-buffer) + #'erc-track-switch-buffer) ;;;###autoload (define-minor-mode erc-track-minor-mode @@ -487,8 +467,7 @@ keybindings will not do anything useful." :init-value nil :lighter "" :keymap erc-track-minor-mode-map - :global t - :group 'erc-track) + :global t) (defun erc-track-minor-mode-maybe (&optional buffer) "Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'." @@ -530,17 +509,17 @@ keybindings will not do anything useful." ((when (boundp 'erc-track-when-inactive) (if erc-track-when-inactive (progn - (add-hook 'window-configuration-change-hook 'erc-user-is-active) - (add-hook 'erc-send-completed-hook 'erc-user-is-active) - (add-hook 'erc-server-001-functions 'erc-user-is-active)) + (add-hook 'window-configuration-change-hook #'erc-user-is-active) + (add-hook 'erc-send-completed-hook #'erc-user-is-active) + (add-hook 'erc-server-001-functions #'erc-user-is-active)) (erc-track-add-to-mode-line erc-track-position-in-mode-line) (erc-update-mode-line) (add-hook 'window-configuration-change-hook - 'erc-window-configuration-change) - (add-hook 'erc-insert-post-hook 'erc-track-modified-channels) - (add-hook 'erc-disconnected-hook 'erc-modified-channels-update)) + #'erc-window-configuration-change) + (add-hook 'erc-insert-post-hook #'erc-track-modified-channels) + (add-hook 'erc-disconnected-hook #'erc-modified-channels-update)) ;; enable the tracking keybindings - (add-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) + (add-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe) (erc-track-minor-mode-maybe))) ;; Disable: ((when (boundp 'erc-track-when-inactive) @@ -548,23 +527,22 @@ keybindings will not do anything useful." (if erc-track-when-inactive (progn (remove-hook 'window-configuration-change-hook - 'erc-user-is-active) - (remove-hook 'erc-send-completed-hook 'erc-user-is-active) - (remove-hook 'erc-server-001-functions 'erc-user-is-active) - (remove-hook 'erc-timer-hook 'erc-user-is-active)) + #'erc-user-is-active) + (remove-hook 'erc-send-completed-hook #'erc-user-is-active) + (remove-hook 'erc-server-001-functions #'erc-user-is-active) + (remove-hook 'erc-timer-hook #'erc-user-is-active)) (remove-hook 'window-configuration-change-hook - 'erc-window-configuration-change) - (remove-hook 'erc-disconnected-hook 'erc-modified-channels-update) - (remove-hook 'erc-insert-post-hook 'erc-track-modified-channels)) + #'erc-window-configuration-change) + (remove-hook 'erc-disconnected-hook #'erc-modified-channels-update) + (remove-hook 'erc-insert-post-hook #'erc-track-modified-channels)) ;; disable the tracking keybindings - (remove-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe) + (remove-hook 'erc-connect-pre-hook #'erc-track-minor-mode-maybe) (when erc-track-minor-mode (erc-track-minor-mode -1))))) (defcustom erc-track-when-inactive nil "Enable channel tracking even for visible buffers, if you are inactive." - :group 'erc-track :type 'boolean :set (lambda (sym val) (if erc-track-mode @@ -705,9 +683,9 @@ Use `erc-make-mode-line-buffer-name' to create buttons." ;; four lists we use to create a new ;; `erc-modified-channels-object' using ;; `erc-make-mode-line-buffer-name'. - (let* ((buffers (mapcar 'car erc-modified-channels-alist)) - (counts (mapcar 'cadr erc-modified-channels-alist)) - (faces (mapcar 'cddr erc-modified-channels-alist)) + (let* ((buffers (mapcar #'car erc-modified-channels-alist)) + (counts (mapcar #'cadr erc-modified-channels-alist)) + (faces (mapcar #'cddr erc-modified-channels-alist)) (long-names (mapcar #'(lambda (buf) (or (buffer-name buf) "")) diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el index f4514ca1371..ff33fbc5570 100644 --- a/lisp/erc/erc-truncate.el +++ b/lisp/erc/erc-truncate.el @@ -1,4 +1,4 @@ -;;; erc-truncate.el --- Functions for truncating ERC buffers +;;; erc-truncate.el --- Functions for truncating ERC buffers -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc. @@ -41,7 +41,6 @@ "Maximum size in chars of each ERC buffer. Used only when auto-truncation is enabled. \(see `erc-truncate-buffer' and `erc-insert-post-hook')." - :group 'erc-truncate :type 'integer) ;;;###autoload(autoload 'erc-truncate-mode "erc-truncate" nil t) @@ -51,9 +50,9 @@ This prevents the query buffer from getting too large, which can bring any grown Emacs to its knees after a few days worth of tracking heavy-traffic channels." ;;enable - ((add-hook 'erc-insert-post-hook 'erc-truncate-buffer)) + ((add-hook 'erc-insert-post-hook #'erc-truncate-buffer)) ;; disable - ((remove-hook 'erc-insert-post-hook 'erc-truncate-buffer))) + ((remove-hook 'erc-insert-post-hook #'erc-truncate-buffer))) ;;;###autoload (defun erc-truncate-buffer-to-size (size &optional buffer) diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el index db8383ba20b..e1b9f0de3a7 100644 --- a/lisp/erc/erc-xdcc.el +++ b/lisp/erc/erc-xdcc.el @@ -1,4 +1,4 @@ -;;; erc-xdcc.el --- XDCC file-server support for ERC +;;; erc-xdcc.el --- XDCC file-server support for ERC -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc. @@ -51,7 +51,7 @@ Your friends should issue \"/ctcp yournick XDCC list\" to see this." (defcustom erc-xdcc-help-text '(("Hey " nick ", wondering how this works? Pretty easy.") ("Available commands: XDCC [" - (mapconcat 'car erc-xdcc-handler-alist "|") "]") + (mapconcat #'car erc-xdcc-handler-alist "|") "]") ("Type \"/ctcp " (erc-current-nick) " XDCC list\" to see the list of offered files, then type \"/ctcp " (erc-current-nick) " XDCC send #\" to get a particular file number.")) @@ -82,7 +82,7 @@ being evaluated and should return strings." (defvar erc-ctcp-query-XDCC-hook '(erc-xdcc) "Hook called whenever a CTCP XDCC message is received.") -(defun erc-xdcc (proc nick login host to query) +(defun erc-xdcc (proc nick login host _to query) "Handle incoming CTCP XDCC queries." (when erc-xdcc-verbose-flag (erc-display-message nil 'notice proc @@ -96,15 +96,15 @@ being evaluated and should return strings." (format "Unknown XDCC sub-command, try \"/ctcp %s XDCC help\"" (erc-current-nick)))))) -(defun erc-xdcc-help (proc nick login host args) +(defun erc-xdcc-help (proc nick _login _host _args) "Send basic help information to NICK." (mapc (lambda (msg) (erc-xdcc-reply proc nick - (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt))) msg ""))) + (mapconcat (lambda (elt) (if (stringp elt) elt (eval elt t))) msg ""))) erc-xdcc-help-text)) -(defun erc-xdcc-list (proc nick login host args) +(defun erc-xdcc-list (proc nick _login _host _args) "Show the contents of `erc-xdcc-files' via privmsg to NICK." (if (null erc-xdcc-files) (erc-xdcc-reply proc nick "No files offered, sorry") @@ -117,7 +117,7 @@ being evaluated and should return strings." (setq n (1+ n)) (erc-dcc-file-to-name file))))))) -(defun erc-xdcc-send (proc nick login host args) +(defun erc-xdcc-send (proc nick _login _host args) "Send a file to NICK." (let ((n (string-to-number (car args))) (len (length erc-xdcc-files))) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 939113acc52..bdb1914d7bf 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1,4 +1,4 @@ -;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- +;;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -1133,31 +1133,31 @@ which the local user typed." (defvar erc-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-m" 'erc-send-current-line) - (define-key map "\C-a" 'erc-bol) - (define-key map [home] 'erc-bol) - (define-key map "\C-c\C-a" 'erc-bol) - (define-key map "\C-c\C-b" 'erc-switch-to-buffer) - (define-key map "\C-c\C-c" 'erc-toggle-interpret-controls) - (define-key map "\C-c\C-d" 'erc-input-action) - (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse) - (define-key map "\C-c\C-f" 'erc-toggle-flood-control) - (define-key map "\C-c\C-i" 'erc-invite-only-mode) - (define-key map "\C-c\C-j" 'erc-join-channel) - (define-key map "\C-c\C-n" 'erc-channel-names) - (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress) - (define-key map "\C-c\C-p" 'erc-part-from-channel) - (define-key map "\C-c\C-q" 'erc-quit-server) - (define-key map "\C-c\C-r" 'erc-remove-text-properties-region) - (define-key map "\C-c\C-t" 'erc-set-topic) - (define-key map "\C-c\C-u" 'erc-kill-input) - (define-key map "\C-c\C-x" 'erc-quit-server) - (define-key map "\M-\t" 'ispell-complete-word) - (define-key map "\t" 'completion-at-point) + (define-key map "\C-m" #'erc-send-current-line) + (define-key map "\C-a" #'erc-bol) + (define-key map [home] #'erc-bol) + (define-key map "\C-c\C-a" #'erc-bol) + (define-key map "\C-c\C-b" #'erc-switch-to-buffer) + (define-key map "\C-c\C-c" #'erc-toggle-interpret-controls) + (define-key map "\C-c\C-d" #'erc-input-action) + (define-key map "\C-c\C-e" #'erc-toggle-ctcp-autoresponse) + (define-key map "\C-c\C-f" #'erc-toggle-flood-control) + (define-key map "\C-c\C-i" #'erc-invite-only-mode) + (define-key map "\C-c\C-j" #'erc-join-channel) + (define-key map "\C-c\C-n" #'erc-channel-names) + (define-key map "\C-c\C-o" #'erc-get-channel-mode-from-keypress) + (define-key map "\C-c\C-p" #'erc-part-from-channel) + (define-key map "\C-c\C-q" #'erc-quit-server) + (define-key map "\C-c\C-r" #'erc-remove-text-properties-region) + (define-key map "\C-c\C-t" #'erc-set-topic) + (define-key map "\C-c\C-u" #'erc-kill-input) + (define-key map "\C-c\C-x" #'erc-quit-server) + (define-key map "\M-\t" #'ispell-complete-word) + (define-key map "\t" #'completion-at-point) ;; Suppress `font-lock-fontify-block' key binding since it ;; destroys face properties. - (define-key map [remap font-lock-fontify-block] 'undefined) + (define-key map [remap font-lock-fontify-block] #'undefined) map) "ERC keymap.") @@ -1293,6 +1293,9 @@ 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. :global ,(not local-p) :group (quote ,group) (if ,mode (,enable) @@ -1313,12 +1316,10 @@ if ARG is omitted or nil. ,@disable-body) ,(when (and alias (not (eq name alias))) `(defalias - (quote - ,(intern + ',(intern (format "erc-%s-mode" - (downcase (symbol-name alias))))) - (quote - ,mode))) + (downcase (symbol-name alias)))) + #',mode)) ;; For find-function and find-variable. (put ',mode 'definition-name ',name) (put ',enable 'definition-name ',name) @@ -1745,7 +1746,7 @@ nil." (ignore res) res))) -(define-obsolete-function-alias 'erc-iswitchb 'erc-switch-to-buffer "25.1") +(define-obsolete-function-alias 'erc-iswitchb #'erc-switch-to-buffer "25.1") (defun erc--switch-to-buffer (&optional arg) (read-buffer "Switch to ERC buffer: " (when (boundp 'erc-modified-channels-alist) @@ -1854,7 +1855,7 @@ removed from the list will be disabled." :get (lambda (sym) ;; replace outdated names with their newer equivalents (erc-migrate-modules (symbol-value sym))) - :initialize 'custom-initialize-default + :initialize #'custom-initialize-default :set (lambda (sym val) ;; disable modules which have just been removed (when (and (boundp 'erc-modules) erc-modules val) @@ -2219,8 +2220,8 @@ be invoked for the values of the other parameters." (erc-open server port nick full-name t password)) ;;;###autoload -(defalias 'erc-select 'erc) -(defalias 'erc-ssl 'erc-tls) +(defalias 'erc-select #'erc) +(defalias 'erc-ssl #'erc-tls) ;;;###autoload (defun erc-tls (&rest r) @@ -2841,14 +2842,14 @@ VALUE is computed by evaluating the rest of LINE in Lisp." (val (read (match-string 2 line)))) (if (boundp var) (progn - (set var (eval val)) + (set var (eval val t)) (erc-display-message nil nil 'active (format "Set %S to %S" var val)) t) (setq var (read (match-string 1 line))) (if (boundp var) (progn - (set var (eval val)) + (set var (eval val t)) (erc-display-message nil nil 'active (format "Set %S to %S" var val)) t) @@ -2870,8 +2871,8 @@ VALUE is computed by evaluating the rest of LINE in Lisp." (current-buffer)) t) (t nil))) -(defalias 'erc-cmd-VAR 'erc-cmd-SET) -(defalias 'erc-cmd-VARIABLE 'erc-cmd-SET) +(defalias 'erc-cmd-VAR #'erc-cmd-SET) +(defalias 'erc-cmd-VARIABLE #'erc-cmd-SET) (put 'erc-cmd-SET 'do-not-parse-args t) (put 'erc-cmd-SET 'process-not-needed t) @@ -2999,7 +3000,7 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (car user-data)) ops))))) erc-channel-users)) - (setq ops (sort ops 'string-lessp)) + (setq ops (sort ops #'string-lessp)) (if ops (erc-display-message nil 'notice (current-buffer) 'ops @@ -3098,7 +3099,7 @@ For a list of user commands (/join /part, ...): (message "Type C-h m to get additional information about keybindings.") t)) -(defalias 'erc-cmd-H 'erc-cmd-HELP) +(defalias 'erc-cmd-H #'erc-cmd-HELP) (put 'erc-cmd-HELP 'process-not-needed t) (defun erc-server-join-channel (server channel &optional secret) @@ -3144,8 +3145,8 @@ were most recently invited. See also `invitation'." (erc-server-join-channel server chnl key))))) t) -(defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN) -(defalias 'erc-cmd-J 'erc-cmd-JOIN) +(defalias 'erc-cmd-CHANNEL #'erc-cmd-JOIN) +(defalias 'erc-cmd-J #'erc-cmd-JOIN) (defvar-local erc-channel-new-member-names nil "If non-nil, a names list is currently being received. @@ -3169,7 +3170,7 @@ command." (erc-server-send (concat "NAMES " tgt))) (erc-display-message nil 'error (current-buffer) 'no-default-channel))) t) -(defalias 'erc-cmd-N 'erc-cmd-NAMES) +(defalias 'erc-cmd-N #'erc-cmd-NAMES) (defun erc-cmd-KICK (target &optional reason-or-nick &rest reasonwords) "Kick the user indicated in LINE from the current channel. @@ -3239,7 +3240,7 @@ If SERVER is non-nil, use that, rather than the current server." (erc-log (format "cmd: %s" send)) (erc-server-send send) t)) -(defalias 'erc-cmd-WI 'erc-cmd-WHOIS) +(defalias 'erc-cmd-WI #'erc-cmd-WHOIS) (defun erc-cmd-WHOAMI () "Display whois information about yourself." @@ -3410,7 +3411,7 @@ The rest is the message to send." The rest of LINE is the message to send." (erc-message "PRIVMSG" line)) -(defalias 'erc-cmd-M 'erc-cmd-MSG) +(defalias 'erc-cmd-M #'erc-cmd-MSG) (put 'erc-cmd-MSG 'do-not-parse-args t) (defun erc-cmd-SQUERY (line) @@ -3465,7 +3466,7 @@ Otherwise leave the channel indicated by LINE." (t nil))) (put 'erc-cmd-PART 'do-not-parse-args t) -(defalias 'erc-cmd-LEAVE 'erc-cmd-PART) +(defalias 'erc-cmd-LEAVE #'erc-cmd-PART) (defun erc-cmd-PING (recipient) "Ping RECIPIENT." @@ -3517,7 +3518,7 @@ If USER is omitted, close the current query buffer if one exists ;; currently broken, evil hack to display help anyway ;(erc-delete-query)))) (signal 'wrong-number-of-arguments "")))) -(defalias 'erc-cmd-Q 'erc-cmd-QUERY) +(defalias 'erc-cmd-Q #'erc-cmd-QUERY) (defun erc-quit/part-reason-default () "Default quit/part message." @@ -3612,9 +3613,9 @@ the message given by REASON." t) (t nil))) -(defalias 'erc-cmd-BYE 'erc-cmd-QUIT) -(defalias 'erc-cmd-EXIT 'erc-cmd-QUIT) -(defalias 'erc-cmd-SIGNOFF 'erc-cmd-QUIT) +(defalias 'erc-cmd-BYE #'erc-cmd-QUIT) +(defalias 'erc-cmd-EXIT #'erc-cmd-QUIT) +(defalias 'erc-cmd-SIGNOFF #'erc-cmd-QUIT) (put 'erc-cmd-QUIT 'do-not-parse-args t) (put 'erc-cmd-QUIT 'process-not-needed t) @@ -3633,7 +3634,7 @@ the message given by REASON." (kill-buffer buffer))))) t) -(defalias 'erc-cmd-GQ 'erc-cmd-GQUIT) +(defalias 'erc-cmd-GQ #'erc-cmd-GQUIT) (put 'erc-cmd-GQUIT 'do-not-parse-args t) (put 'erc-cmd-GQUIT 'process-not-needed t) @@ -3731,7 +3732,7 @@ the message given by REASON." (erc-server-send (concat "TIME " args))) t) (t (erc-server-send "TIME")))) -(defalias 'erc-cmd-DATE 'erc-cmd-TIME) +(defalias 'erc-cmd-DATE #'erc-cmd-TIME) (defun erc-cmd-TOPIC (topic) "Set or request the topic for a channel. @@ -3772,7 +3773,7 @@ be displayed." (erc-display-message nil 'error (current-buffer) 'no-target))) t) (t nil))) -(defalias 'erc-cmd-T 'erc-cmd-TOPIC) +(defalias 'erc-cmd-T #'erc-cmd-TOPIC) (put 'erc-cmd-TOPIC 'do-not-parse-args t) (defun erc-cmd-APPENDTOPIC (topic) @@ -3784,7 +3785,7 @@ be displayed." ;; strip trailing ^O (when (string-match "\\(.*\\)\C-o" oldtopic) (erc-cmd-TOPIC (concat (match-string 1 oldtopic) topic))))) -(defalias 'erc-cmd-AT 'erc-cmd-APPENDTOPIC) +(defalias 'erc-cmd-AT #'erc-cmd-APPENDTOPIC) (put 'erc-cmd-APPENDTOPIC 'do-not-parse-args t) (defun erc-cmd-CLEARTOPIC (&optional channel) @@ -3808,6 +3809,8 @@ The property `received-from-server' indicates whether or not the ban list has been requested from the server.") (put 'erc-channel-banlist 'received-from-server nil) +(defvar erc-fill-column) + (defun erc-cmd-BANLIST () "Pretty-print the contents of `erc-channel-banlist'. @@ -3878,7 +3881,7 @@ The ban list is fetched from the server if necessary." (put 'erc-channel-banlist 'received-from-server nil))))) t) -(defalias 'erc-cmd-BL 'erc-cmd-BANLIST) +(defalias 'erc-cmd-BL #'erc-cmd-BANLIST) (defun erc-cmd-MASSUNBAN () "Mass Unban. @@ -3920,7 +3923,7 @@ Unban all currently banned users in the current channel." (erc-group-list bans 3)))) t)))) -(defalias 'erc-cmd-MUB 'erc-cmd-MASSUNBAN) +(defalias 'erc-cmd-MUB #'erc-cmd-MASSUNBAN) ;;;; End of IRC commands @@ -4121,7 +4124,7 @@ This places `point' just after the prompt, or at the beginning of the line." (defun erc-complete-word-at-point () (run-hook-with-args-until-success 'erc-complete-functions)) -(define-obsolete-function-alias 'erc-complete-word 'completion-at-point "24.1") +(define-obsolete-function-alias 'erc-complete-word #'completion-at-point "24.1") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -5169,7 +5172,7 @@ TOPIC string to the current topic." "Sort LIST-OF-STRINGS in lexicographic order. Side-effect free." - (sort (copy-sequence list-of-strings) 'string<)) + (sort (copy-sequence list-of-strings) #'string<)) (defun erc-parse-modes (mode-string) "Parse MODE-STRING into a list. @@ -6106,11 +6109,11 @@ non-nil value is found. ;; time routines -(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number +(define-obsolete-function-alias 'erc-string-to-emacs-time #'string-to-number "27.1") -(defalias 'erc-emacs-time-to-erc-time 'float-time) -(defalias 'erc-current-time 'float-time) +(defalias 'erc-emacs-time-to-erc-time #'float-time) +(defalias 'erc-current-time #'float-time) (defun erc-time-diff (t1 t2) "Return the absolute value of the difference in seconds between T1 and T2." @@ -6892,7 +6895,3 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL." (require 'erc-goodies) ;;; erc.el ends here -;; -;; Local Variables: -;; outline-regexp: ";;+" -;; End: -- cgit v1.2.3 From 3492cc36f23c99344a6533a5ba4c6080b10d35a1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 9 Apr 2021 00:04:13 +0200 Subject: Remove redundant #' before lambda in {calendar,erc,mh-e}/*.el * lisp/calendar/icalendar.el (icalendar--get-most-recent-observance): * lisp/calendar/parse-time.el (parse-time-rules): * lisp/erc/erc-dcc.el (pcomplete/erc-mode/DCC): * lisp/erc/erc-track.el (erc-modified-channels-display): * lisp/erc/erc.el (erc-toggle-debug-irc-protocol) (erc-cmd-IGNORE, erc-cmd-JOIN, erc-default-server-handler) (erc-banlist-update): * lisp/mh-e/mh-search.el (mh-search, mh-mairix-convert-to-sop*) (mh-index-create-sequences): * lisp/mh-e/mh-thread.el (mh-toggle-threads, mh-thread-generate) (mh-thread-prune-containers, mh-thread-sort-containers): * lisp/mh-e/mh-utils.el (mh-sub-folders): Remove redundant #' before lambda. --- lisp/calendar/icalendar.el | 26 +++++++++---------- lisp/calendar/parse-time.el | 62 ++++++++++++++++++++++----------------------- lisp/erc/erc-dcc.el | 24 +++++++++--------- lisp/erc/erc-track.el | 6 ++--- lisp/erc/erc.el | 26 +++++++++---------- lisp/mh-e/mh-search.el | 40 ++++++++++++++--------------- lisp/mh-e/mh-thread.el | 36 +++++++++++++------------- lisp/mh-e/mh-utils.el | 4 +-- 8 files changed, 112 insertions(+), 112 deletions(-) (limited to 'lisp/erc/erc-dcc.el') diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 04b525efc8a..6eb086aa14d 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -581,19 +581,19 @@ ALIST is a VTIMEZONE potentially containing historical records." (list (car (sort components - #'(lambda (a b) - (let* ((get-recent (lambda (n) - (car - (sort - (delq nil - (mapcar (lambda (p) - (and (memq (car p) '(DTSTART RDATE)) - (car (cddr p)))) - n)) - 'string-greaterp)))) - (a-recent (funcall get-recent (car (cddr a)))) - (b-recent (funcall get-recent (car (cddr b))))) - (string-greaterp a-recent b-recent)))))))) + (lambda (a b) + (let* ((get-recent (lambda (n) + (car + (sort + (delq nil + (mapcar (lambda (p) + (and (memq (car p) '(DTSTART RDATE)) + (car (cddr p)))) + n)) + 'string-greaterp)))) + (a-recent (funcall get-recent (car (cddr a)))) + (b-recent (funcall get-recent (car (cddr b))))) + (string-greaterp a-recent b-recent)))))))) (defun icalendar--convert-all-timezones (icalendar) "Convert all timezones in the ICALENDAR into an alist. diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index aa3236cf256..5a3d2706afd 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el @@ -103,46 +103,46 @@ letters, digits, plus or minus signs or colons." ((4) parse-time-months) ((5) (100)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 8) - (= (aref parse-time-elt 2) ?:) - (= (aref parse-time-elt 5) ?:))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 8) + (= (aref parse-time-elt 2) ?:) + (= (aref parse-time-elt 5) ?:))) [0 2] [3 5] [6 8]) ((8 7) parse-time-zoneinfo - ,#'(lambda () (car parse-time-val)) - ,#'(lambda () (cadr parse-time-val))) + ,(lambda () (car parse-time-val)) + ,(lambda () (cadr parse-time-val))) ((8) - ,#'(lambda () - (and (stringp parse-time-elt) - (= 5 (length parse-time-elt)) - (or (= (aref parse-time-elt 0) ?+) - (= (aref parse-time-elt 0) ?-)))) - ,#'(lambda () (* 60 (+ (cl-parse-integer parse-time-elt :start 3 :end 5) - (* 60 (cl-parse-integer parse-time-elt :start 1 :end 3))) - (if (= (aref parse-time-elt 0) ?-) -1 1)))) + ,(lambda () + (and (stringp parse-time-elt) + (= 5 (length parse-time-elt)) + (or (= (aref parse-time-elt 0) ?+) + (= (aref parse-time-elt 0) ?-)))) + ,(lambda () (* 60 (+ (cl-parse-integer parse-time-elt :start 3 :end 5) + (* 60 (cl-parse-integer parse-time-elt :start 1 :end 3))) + (if (= (aref parse-time-elt 0) ?-) -1 1)))) ((5 4 3) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 10) - (= (aref parse-time-elt 4) ?-) - (= (aref parse-time-elt 7) ?-))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 10) + (= (aref parse-time-elt 4) ?-) + (= (aref parse-time-elt 7) ?-))) [0 4] [5 7] [8 10]) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 5) - (= (aref parse-time-elt 2) ?:))) - [0 2] [3 5] ,#'(lambda () 0)) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 5) + (= (aref parse-time-elt 2) ?:))) + [0 2] [3 5] ,(lambda () 0)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 4) - (= (aref parse-time-elt 1) ?:))) - [0 1] [2 4] ,#'(lambda () 0)) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 4) + (= (aref parse-time-elt 1) ?:))) + [0 1] [2 4] ,(lambda () 0)) ((2 1 0) - ,#'(lambda () (and (stringp parse-time-elt) - (= (length parse-time-elt) 7) - (= (aref parse-time-elt 1) ?:))) + ,(lambda () (and (stringp parse-time-elt) + (= (length parse-time-elt) 7) + (= (aref parse-time-elt 1) ?:))) [0 1] [2 4] [5 7]) - ((5) (50 110) ,#'(lambda () (+ 1900 parse-time-elt))) - ((5) (0 49) ,#'(lambda () (+ 2000 parse-time-elt)))) + ((5) (50 110) ,(lambda () (+ 1900 parse-time-elt))) + ((5) (0 49) ,(lambda () (+ 2000 parse-time-elt)))) "(slots predicate extractor...)") ;;;###autoload(put 'parse-time-rules 'risky-local-variable t) diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index 234b4b5a71d..219af3741fa 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el @@ -415,33 +415,33 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc." (pcase (intern (downcase (pcomplete-arg 1))) ('chat (mapcar (lambda (elt) (plist-get elt :nick)) (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) 'CHAT)) + (lambda (elt) + (eq (plist-get elt :type) 'CHAT)) erc-dcc-list))) ('close (delete-dups (mapcar (lambda (elt) (symbol-name (plist-get elt :type))) erc-dcc-list))) ('get (mapcar #'erc-dcc-nick (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) 'GET)) + (lambda (elt) + (eq (plist-get elt :type) 'GET)) erc-dcc-list))) ('send (pcomplete-erc-all-nicks)))) (pcomplete-here (pcase (intern (downcase (pcomplete-arg 2))) ('get (mapcar (lambda (elt) (plist-get elt :file)) (cl-remove-if-not - #'(lambda (elt) - (and (eq (plist-get elt :type) 'GET) - (erc-nick-equal-p (erc-extract-nick - (plist-get elt :nick)) - (pcomplete-arg 1)))) + (lambda (elt) + (and (eq (plist-get elt :type) 'GET) + (erc-nick-equal-p (erc-extract-nick + (plist-get elt :nick)) + (pcomplete-arg 1)))) erc-dcc-list))) ('close (mapcar #'erc-dcc-nick (cl-remove-if-not - #'(lambda (elt) - (eq (plist-get elt :type) - (intern (upcase (pcomplete-arg 1))))) + (lambda (elt) + (eq (plist-get elt :type) + (intern (upcase (pcomplete-arg 1))))) erc-dcc-list))) ('send (pcomplete-entries))))) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index 8be55558823..9985b6a02f0 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -686,9 +686,9 @@ Use `erc-make-mode-line-buffer-name' to create buttons." (let* ((buffers (mapcar #'car erc-modified-channels-alist)) (counts (mapcar #'cadr erc-modified-channels-alist)) (faces (mapcar #'cddr erc-modified-channels-alist)) - (long-names (mapcar #'(lambda (buf) - (or (buffer-name buf) - "")) + (long-names (mapcar (lambda (buf) + (or (buffer-name buf) + "")) buffers)) (short-names (if (functionp erc-track-shorten-function) (funcall erc-track-shorten-function diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 2f6e48dce1a..f0144de8446 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2321,7 +2321,7 @@ If ARG is non-nil, show the *erc-protocol* buffer." (use-local-map (make-sparse-keymap)) (local-set-key (kbd "t") 'erc-toggle-debug-irc-protocol)) (add-hook 'kill-buffer-hook - #'(lambda () (setq erc-debug-irc-protocol nil)) + (lambda () (setq erc-debug-irc-protocol nil)) nil 'local) (goto-char (point-max)) (let ((inhibit-read-only t)) @@ -2945,9 +2945,9 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (if (null (erc-with-server-buffer erc-ignore-list)) (erc-display-line (erc-make-notice "Ignore list is empty") 'active) (erc-display-line (erc-make-notice "Ignore list:") 'active) - (mapc #'(lambda (item) - (erc-display-line (erc-make-notice item) - 'active)) + (mapc (lambda (item) + (erc-display-line (erc-make-notice item) + 'active)) (erc-with-server-buffer erc-ignore-list)))) t) @@ -3129,8 +3129,8 @@ were most recently invited. See also `invitation'." (when chnl ;; Prevent double joining of same channel on same server. (let* ((joined-channels - (mapcar #'(lambda (chanbuf) - (with-current-buffer chanbuf (erc-default-target))) + (mapcar (lambda (chanbuf) + (with-current-buffer chanbuf (erc-default-target))) (erc-channel-list erc-server-process))) (server (with-current-buffer (process-buffer erc-server-process) (or erc-session-server erc-server-announced-name))) @@ -4149,9 +4149,9 @@ Displays PROC and PARSED appropriately using `erc-display-message'." (mapconcat #'identity (let (res) - (mapc #'(lambda (x) - (if (stringp x) - (setq res (append res (list x))))) + (mapc (lambda (x) + (if (stringp x) + (setq res (append res (list x))))) parsed) res) " "))) @@ -4539,10 +4539,10 @@ See also: `erc-echo-notice-in-user-buffers', ;; Remove the unbanned masks from the ban list (setq erc-channel-banlist (cl-delete-if - #'(lambda (y) - (member (upcase (cdr y)) - (mapcar #'upcase - (cdr (split-string mode))))) + (lambda (y) + (member (upcase (cdr y)) + (mapcar #'upcase + (cdr (split-string mode))))) erc-channel-banlist))) ((string-match "^\\+" mode) ;; Add the banned mask(s) to the ban list diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index aece03ef0f3..cb8f8e34558 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -274,23 +274,23 @@ folder containing the index search results." t))) ;; Copy the search results over. - (maphash #'(lambda (folder msgs) - (let ((cur (car (mh-translate-range folder "cur"))) - (msgs (sort (cl-loop - for msg being the hash-keys of msgs - collect msg) - #'<))) - (mh-exec-cmd "refile" msgs "-src" folder - "-link" index-folder) - ;; Restore cur to old value, that refile changed - (when cur - (mh-exec-cmd-quiet nil "mark" folder "-add" "-zero" - "-sequence" - "cur" (format "%s" cur))) - (cl-loop for msg in msgs - do (cl-incf result-count) - (setf (gethash result-count origin-map) - (cons folder msg))))) + (maphash (lambda (folder msgs) + (let ((cur (car (mh-translate-range folder "cur"))) + (msgs (sort (cl-loop + for msg being the hash-keys of msgs + collect msg) + #'<))) + (mh-exec-cmd "refile" msgs "-src" folder + "-link" index-folder) + ;; Restore cur to old value, that refile changed + (when cur + (mh-exec-cmd-quiet nil "mark" folder "-add" "-zero" + "-sequence" + "cur" (format "%s" cur))) + (cl-loop for msg in msgs + do (cl-incf result-count) + (setf (gethash result-count origin-map) + (cons folder msg))))) folder-results-map) ;; Vist the results folder. @@ -1136,10 +1136,10 @@ REGEXP-LIST is an alist of fields and values." ((atom (cadr expr)) `(or (and ,expr))) ((eq (caadr expr) 'not) (mh-mairix-convert-to-sop* (cadadr expr))) ((eq (caadr expr) 'and) (mh-mairix-convert-to-sop* - `(or ,@(mapcar #'(lambda (x) `(not ,x)) + `(or ,@(mapcar (lambda (x) `(not ,x)) (cdadr expr))))) ((eq (caadr expr) 'or) (mh-mairix-convert-to-sop* - `(and ,@(mapcar #'(lambda (x) `(not ,x)) + `(and ,@(mapcar (lambda (x) `(not ,x)) (cdadr expr))))) (t (error "Unreachable: %s" expr)))) @@ -1620,7 +1620,7 @@ garbled." (cl-loop for seq in seq-list do (apply #'mh-exec-cmd "mark" mh-current-folder "-sequence" (symbol-name (car seq)) "-add" - (mapcar #'(lambda (x) (format "%s" x)) (cdr seq)))))) + (mapcar (lambda (x) (format "%s" x)) (cdr seq)))))) ;;;###mh-autoload (defun mh-create-sequence-map (seq-list) diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el index a7878aaae9b..01b6863038b 100644 --- a/lisp/mh-e/mh-thread.el +++ b/lisp/mh-e/mh-thread.el @@ -233,7 +233,7 @@ sibling." (push index msg-list))) (forward-line)) (mh-scan-folder mh-current-folder - (mapcar #'(lambda (x) (format "%s" x)) + (mapcar (lambda (x) (format "%s" x)) (mh-coalesce-msg-list msg-list)) t)) (when mh-index-data @@ -591,7 +591,7 @@ Only information about messages in MSG-LIST are added to the tree." #'call-process (expand-file-name mh-scan-prog mh-progs) nil '(t nil) nil "-width" "10000" "-format" "%(msg)\n%{message-id}\n%{references}\n%{in-reply-to}\n%{subject}\n" - folder (mapcar #'(lambda (x) (format "%s" x)) msg-list))) + folder (mapcar (lambda (x) (format "%s" x)) msg-list))) (goto-char (point-min)) (let ((roots ()) (case-fold-search t)) @@ -635,9 +635,9 @@ Only information about messages in MSG-LIST are added to the tree." (mh-thread-remove-parent-link id) (mh-thread-add-link (car ancestors) id))) (mh-thread-add-link (car ancestors) (cadr ancestors))))))) - (maphash #'(lambda (_k v) - (when (null (mh-container-parent v)) - (push v roots))) + (maphash (lambda (_k v) + (when (null (mh-container-parent v)) + (push v roots))) mh-thread-id-table) (setq roots (mh-thread-prune-containers roots)) (prog1 (setq roots (mh-thread-group-by-subject roots)) @@ -720,25 +720,25 @@ For now it will take the last string inside angles." mh-thread-history) (mh-thread-remove-parent-link node))))) (let ((results ())) - (maphash #'(lambda (_k v) - (when (and (null (mh-container-parent v)) - (gethash (mh-message-id (mh-container-message v)) - mh-thread-id-index-map)) - (push v results))) + (maphash (lambda (_k v) + (when (and (null (mh-container-parent v)) + (gethash (mh-message-id (mh-container-message v)) + mh-thread-id-index-map)) + (push v results))) mh-thread-id-table) (mh-thread-sort-containers results)))) (defun mh-thread-sort-containers (containers) "Sort a list of message CONTAINERS to be in ascending order wrt index." (sort containers - #'(lambda (x y) - (when (and (mh-container-message x) (mh-container-message y)) - (let* ((id-x (mh-message-id (mh-container-message x))) - (id-y (mh-message-id (mh-container-message y))) - (index-x (gethash id-x mh-thread-id-index-map)) - (index-y (gethash id-y mh-thread-id-index-map))) - (and (integerp index-x) (integerp index-y) - (< index-x index-y))))))) + (lambda (x y) + (when (and (mh-container-message x) (mh-container-message y)) + (let* ((id-x (mh-message-id (mh-container-message x))) + (id-y (mh-message-id (mh-container-message y))) + (index-x (gethash id-x mh-thread-id-index-map)) + (index-y (gethash id-y mh-thread-id-index-map))) + (and (integerp index-x) (integerp index-y) + (< index-x index-y))))))) (defvar mh-thread-last-ancestor) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index be66e62a1d7..e73c1db9e45 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -544,8 +544,8 @@ nested folders within them." (mh-sub-folders-actual folder))) (t match)))) (if add-trailing-slash-flag - (mapcar #'(lambda (x) - (if (cdr x) (cons (concat (car x) "/") (cdr x)) x)) + (mapcar (lambda (x) + (if (cdr x) (cons (concat (car x) "/") (cdr x)) x)) sub-folders) sub-folders))) -- 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/erc/erc-dcc.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 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/erc/erc-dcc.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