From 9efc29a2dfda67c2e6b6693a6cb06a19fbdccaeb Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 13 Feb 2016 17:40:34 +1100 Subject: [PATCH] Remove several gnus-util compat functions * lisp/gnus/gnus-util.el (gnus-set-process-query-on-exit-flag): Remove. (gnus-read-shell-command): Remove. (gnus-match-substitute-replacement): Remove. (gnus-string-match-p): Remove. (gnus-string-prefix-p): Remove. --- lisp/gnus/gnus-art.el | 5 ++-- lisp/gnus/gnus-msg.el | 6 ++-- lisp/gnus/gnus-notifications.el | 5 ++-- lisp/gnus/gnus-sum.el | 2 +- lisp/gnus/gnus-util.el | 51 --------------------------------- lisp/gnus/mm-decode.el | 3 +- lisp/gnus/mml-sec.el | 6 ++-- lisp/gnus/nnimap.el | 8 +++--- lisp/gnus/nnir.el | 2 +- lisp/gnus/nnmaildir.el | 12 ++++---- lisp/gnus/nntp.el | 2 +- lisp/gnus/spam-report.el | 2 +- 12 files changed, 26 insertions(+), 78 deletions(-) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e22d422c548..4858c2a663e 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2459,7 +2459,7 @@ long lines if and only if arg is positive." ;; The command is a string, so we interpret the command ;; as a, well, command, and fork it off. (let ((process-connection-type nil)) - (gnus-set-process-query-on-exit-flag + (set-process-query-on-exit-flag (start-process "article-x-face" nil shell-file-name shell-command-switch gnus-article-x-face-command) @@ -4126,8 +4126,7 @@ and the raw article including all headers will be piped." (setq command (if (and (eq command 'default) default) default - (gnus-read-shell-command "Shell command on this article: " - default)))) + (read-shell-command "Shell command on this article: " default)))) (when (string-equal command "") (if default (setq command default) diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 43a496942e3..e2b8dcc51e4 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1904,10 +1904,10 @@ this is a reply." (cond ((stringp value) (if (and matched-string - (gnus-string-match-p "\\\\[&[:digit:]]" value) + (string-match-p "\\\\[&[:digit:]]" value) (match-beginning 1)) - (gnus-match-substitute-replacement value nil nil - matched-string) + (match-substitute-replacement value nil nil + matched-string) value)) ((or (symbolp value) (functionp value)) diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el index d0b0202788d..2f6d6a8b619 100644 --- a/lisp/gnus/gnus-notifications.el +++ b/lisp/gnus/gnus-notifications.el @@ -182,8 +182,9 @@ This is typically a function to add in address (cond ((functionp gnus-ignored-from-addresses) (funcall gnus-ignored-from-addresses address)) - (t (gnus-string-match-p (gnus-ignored-from-addresses) - address)))) + (t (string-match-p + (gnus-ignored-from-addresses) + address)))) (let* ((photo-file (gnus-notifications-get-photo-file address)) (notification-id (gnus-notifications-notify (or (car address-components) address) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 2c87ba1573a..a20816054bc 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -12061,7 +12061,7 @@ no matter what the properties `:decode' and `:headers' are." command result) (unless (numberp (car articles)) (error "No article to pipe")) - (setq command (gnus-read-shell-command + (setq command (read-shell-command (concat "Shell command on " (if (cdr articles) (format "these %d articles" (length articles)) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 23c6cd92cfb..5e6b66dfb4b 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1656,15 +1656,6 @@ empty directories from OLD-PATH." (ignore-errors (set-file-modes filename mode))) -(if (fboundp 'set-process-query-on-exit-flag) - (defalias 'gnus-set-process-query-on-exit-flag - 'set-process-query-on-exit-flag) - (defalias 'gnus-set-process-query-on-exit-flag - 'process-kill-without-query)) - -(defalias 'gnus-read-shell-command - (if (fboundp 'read-shell-command) 'read-shell-command 'read-string)) - (declare-function image-size "image.c" (spec &optional pixels frame)) (defun gnus-rescale-image (image size) @@ -1715,48 +1706,6 @@ The first found will be returned if a file has hard or symbolic links." (memq elem list)))) found)) -(eval-and-compile - (cond - ((fboundp 'match-substitute-replacement) - (defalias 'gnus-match-substitute-replacement 'match-substitute-replacement)) - (t - (defun gnus-match-substitute-replacement (replacement &optional fixedcase literal string subexp) - "Return REPLACEMENT as it will be inserted by `replace-match'. -In other words, all back-references in the form `\\&' and `\\N' -are substituted with actual strings matched by the last search. -Optional FIXEDCASE, LITERAL, STRING and SUBEXP have the same -meaning as for `replace-match'. - -This is the definition of match-substitute-replacement in subr.el from GNU Emacs." - (let ((match (match-string 0 string))) - (save-match-data - (set-match-data (mapcar (lambda (x) - (if (numberp x) - (- x (match-beginning 0)) - x)) - (match-data t))) - (replace-match replacement fixedcase literal match subexp))))))) - -(if (fboundp 'string-match-p) - (defalias 'gnus-string-match-p 'string-match-p) - (defsubst gnus-string-match-p (regexp string &optional start) - "\ -Same as `string-match' except this function does not change the match data." - (save-match-data - (string-match regexp string start)))) - -(if (fboundp 'string-prefix-p) - (defalias 'gnus-string-prefix-p 'string-prefix-p) - (defun gnus-string-prefix-p (str1 str2 &optional ignore-case) - "Return non-nil if STR1 is a prefix of STR2. -If IGNORE-CASE is non-nil, the comparison is done without paying attention -to case differences." - (and (<= (length str1) (length str2)) - (let ((prefix (substring str2 0 (length str1)))) - (if ignore-case - (string-equal (downcase str1) (downcase prefix)) - (string-equal str1 prefix)))))) - (defun gnus-test-list (list predicate) "To each element of LIST apply PREDICATE. Return nil if LIST is no list or is empty or some test returns nil; diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 383aeded66f..28b08af2439 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -28,7 +28,6 @@ (eval-when-compile (require 'cl)) (autoload 'gnus-map-function "gnus-util") -(autoload 'gnus-read-shell-command "gnus-util") (autoload 'mm-inline-partial "mm-partial") (autoload 'mm-inline-external-body "mm-extern") @@ -1451,7 +1450,7 @@ text/\\(\\sw+\\)\\(?:;\\s-*charset=\\([^\"'>]+\\)\\)?[^>]*>" nil t) Use CMD as the process." (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) (command (or cmd - (gnus-read-shell-command + (read-shell-command "Shell command on MIME part: " mm-last-shell-command)))) (mm-with-unibyte-buffer (mm-insert-part handle) diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index 4744187994a..bc7c0ac5210 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -704,9 +704,9 @@ be present in the keyring." ;; In contrast, signing requires secret key. (mml-secure-secret-key-exists-p context subkey)) (or (not fingerprint) - (gnus-string-match-p (concat fingerprint "$") fpr) - (gnus-string-match-p (concat fingerprint "$") - (epg-sub-key-fingerprint subkey)))) + (string-match-p (concat fingerprint "$") fpr) + (string-match-p (concat fingerprint "$") + (epg-sub-key-fingerprint subkey)))) (throw 'break t))))))) (defun mml-secure-find-usable-keys (context name usage &optional justone) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index eefe1a140b7..a53d6cd11c0 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -437,7 +437,7 @@ textual parts.") :success " OK " :starttls-function (lambda (capabilities) - (when (gnus-string-match-p "STARTTLS" capabilities) + (when (string-match-p "STARTTLS" capabilities) "1 STARTTLS\r\n")))) (stream (car stream-list)) (props (cdr stream-list)) @@ -459,15 +459,15 @@ textual parts.") (nnheader-report 'nnimap "Unable to contact %s:%s via %s" nnimap-address (car ports) nnimap-stream) 'no-connect) - (gnus-set-process-query-on-exit-flag stream nil) - (if (not (gnus-string-match-p "[*.] \\(OK\\|PREAUTH\\)" greeting)) + (set-process-query-on-exit-flag stream nil) + (if (not (string-match-p "[*.] \\(OK\\|PREAUTH\\)" greeting)) (nnheader-report 'nnimap "%s" greeting) ;; Store the greeting (for debugging purposes). (setf (nnimap-greeting nnimap-object) greeting) (setf (nnimap-capabilities nnimap-object) (mapcar #'upcase (split-string capabilities))) - (unless (gnus-string-match-p "[*.] PREAUTH" greeting) + (unless (string-match-p "[*.] PREAUTH" greeting) (if (not (setq credentials (if (eq nnimap-authenticator 'anonymous) (list "anonymous" diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 7614002a920..6c2d11396cb 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -1669,7 +1669,7 @@ actually)." (server (cadr (gnus-server-to-method srv))) (groupspec (mapconcat (lambda (x) - (if (gnus-string-match-p "gmane" x) + (if (string-match-p "gmane" x) (format "group:%s" (gnus-group-short-name x)) (error "Can't search non-gmane groups: %s" x))) groups " ")) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index e34a13b4561..cebdc95876f 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -97,14 +97,14 @@ See `nnmaildir-flag-mark-mapping'." (defun nnmaildir--ensure-suffix (filename) "Ensure that FILENAME contains the suffix \":2,\"." - (if (gnus-string-match-p ":2," filename) + (if (string-match-p ":2," filename) filename (concat filename ":2,"))) (defun nnmaildir--add-flag (flag suffix) "Return a copy of SUFFIX where FLAG is set. SUFFIX should start with \":2,\"." - (unless (gnus-string-match-p "^:2," suffix) + (unless (string-match-p "^:2," suffix) (error "Invalid suffix `%s'" suffix)) (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) @@ -117,7 +117,7 @@ SUFFIX should start with \":2,\"." (defun nnmaildir--remove-flag (flag suffix) "Return a copy of SUFFIX where FLAG is cleared. SUFFIX should start with \":2,\"." - (unless (gnus-string-match-p "^:2," suffix) + (unless (string-match-p "^:2," suffix) (error "Invalid suffix `%s'" suffix)) (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) @@ -848,11 +848,11 @@ by nnmaildir-request-article.") (when (or ;; first look for marks in suffix, if it's valid... (when (and (stringp suffix) - (gnus-string-prefix-p ":2," suffix)) + (string-prefix-p ":2," suffix)) (or - (not (gnus-string-match-p + (not (string-match-p (string (nnmaildir--mark-to-flag 'read)) suffix)) - (gnus-string-match-p + (string-match-p (string (nnmaildir--mark-to-flag 'tick)) suffix))) ;; then look in marks directories (not (file-exists-p (concat cdir prefix))) diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 6108b5a7768..e6483c2046a 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el @@ -1302,7 +1302,7 @@ If SEND-IF-FORCE, only send authinfo to the server if the ;; Use TCP-keepalive so that connections that pass through a NAT router ;; don't hang when left idle. (set-network-process-option process :keepalive t)) - (gnus-set-process-query-on-exit-flag process nil) + (set-process-query-on-exit-flag process nil) (if (and (nntp-wait-for process "^2.*\n" buffer nil t) (memq (process-status process) '(open run))) (prog1 diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el index 0b58dc8c25b..88854e04253 100644 --- a/lisp/gnus/spam-report.el +++ b/lisp/gnus/spam-report.el @@ -255,7 +255,7 @@ This is initialized based on `user-mail-address'." 80)) (error "Could not open connection to %s" host)) (set-marker (process-mark tcp-connection) (point-min)) - (gnus-set-process-query-on-exit-flag tcp-connection nil) + (set-process-query-on-exit-flag tcp-connection nil) (process-send-string tcp-connection (format "GET %s HTTP/1.1\nUser-Agent: %s\nHost: %s\n\n" -- 2.39.2