From e5f50f32f76bab2607d77f0dc51cf81ec0c1e232 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 17 Feb 2021 18:04:35 +0100 Subject: Further Tramp code cleanup * doc/misc/tramp.texi (Predefined connection information): Mention "about-args". * lisp/net/tramp-cmds.el (tramp-version): Adapt docstring. * lisp/net/tramp.el (tramp-handle-expand-file-name): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name): * lisp/net/tramp-sh.el (tramp-sh-handle-expand-file-name) * lisp/net/tramp-smb.el (tramp-smb-handle-expand-file-name): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name): Handle local "/..". * lisp/net/tramp-rclone.el (tramp-methods) : Adapt `tramp-mount-args'. (tramp-rclone-flush-directory-cache): Remove. (tramp-rclone-do-copy-or-rename-file) (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file) (tramp-rclone-handle-make-directory): Don't use that function. (tramp-rclone-maybe-open-connection): Fix use of `tramp-mount-args'. * lisp/net/trampver.el (tramp-inside-emacs): New defun. * lisp/net/tramp.el (tramp-handle-make-process): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process) (tramp-sh-handle-process-file, tramp-open-shell): Use it. (tramp-get-env-with-u-option): Remove. * test/lisp/net/tramp-tests.el (tramp-test05-expand-file-name-top): New test. --- lisp/net/tramp-cmds.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 097f25ea85e..f0bbe31cea0 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -465,7 +465,7 @@ For details, see `tramp-rename-files'." ;;;###tramp-autoload (defun tramp-version (arg) - "Print version number of tramp.el in minibuffer or current buffer." + "Print version number of tramp.el in echo area or current buffer." (interactive "P") (if arg (insert tramp-version) (message tramp-version))) -- cgit v1.2.3 From 0fd206badc761df0a2eb18cd5d9c7506c3bd0d2a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 28 Feb 2021 18:23:27 +0100 Subject: Add `completion-predicate' to some Tramp commands * lisp/net/tramp-cmds.el (tramp-cleanup-this-connection) (tramp-rename-these-files): Add property `completion-predicate'. * lisp/net/tramp.el (tramp-command-completion-p): New defun. --- lisp/net/tramp-cmds.el | 13 +++++++++++++ lisp/net/tramp.el | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index f0bbe31cea0..2aacf266f2b 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -144,11 +144,18 @@ When called interactively, a Tramp connection has to be selected." ;;;###tramp-autoload (defun tramp-cleanup-this-connection () "Flush all connection related objects of the current buffer's connection." + ;; (declare (completion tramp-command-completion-p))) (interactive) (and (tramp-tramp-file-p default-directory) (tramp-cleanup-connection (tramp-dissect-file-name default-directory 'noexpand)))) +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +;;;###tramp-autoload +(function-put + #'tramp-cleanup-this-connection 'completion-predicate + #'tramp-command-completion-p) + ;;;###tramp-autoload (defvar tramp-cleanup-all-connections-hook nil "List of functions to be called after all Tramp connections are cleaned up.") @@ -431,6 +438,7 @@ Interactively, TARGET is selected from `tramp-default-rename-alist' without confirmation if the prefix argument is non-nil. For details, see `tramp-rename-files'." + ;; (declare (completion tramp-command-completion-p)) (interactive (let ((source default-directory) target @@ -461,6 +469,11 @@ For details, see `tramp-rename-files'." (tramp-rename-files default-directory target)) +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +;;;###tramp-autoload +(function-put + #'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p) + ;; Tramp version is useful in a number of situations. ;;;###tramp-autoload diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e99e43938f2..14d5f8c3b6b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2591,6 +2591,14 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'." ;;; File name handler functions for completion mode: +;; This function takes action since Emacs 28.1, when +;; `read-extended-command-predicate' is set to +;; `command-completion-default-include-p'. +(defun tramp-command-completion-p (_symbol buffer) + "A predicate for Tramp interactive commands. +They are completed by \"M-x TAB\" only if the current buffer is remote." + (with-current-buffer buffer (tramp-tramp-file-p default-directory))) + (defun tramp-connectable-p (vec-or-filename) "Check, whether it is possible to connect the remote host w/o side-effects. This is true, if either the remote host is already connected, or if we are -- cgit v1.2.3 From dc083ebc4e34158b3be4c16d558d104c8c4e5c77 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 8 Mar 2021 10:11:22 -0500 Subject: * lisp/net/*.el: Use lexical-binding Also remove some redundant `:group` arguments. * lisp/net/eudc-export.el: Use lexical-binding. (eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`. * lisp/net/eudc-hotlist.el: Use lexical-binding. * lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid `eval`. * lisp/net/eudcb-bbdb.el: Use lexical-binding. (eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`. Move `bbdb-val` binding to avoid `setq`. Use `seq-some` instead of `eval+or`. (eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`. Use `funcall` to avoid `eval`. (eudc-bbdb-query-internal): Simplify a bit. * lisp/net/eudcb-ldap.el: Use lexical-binding. (eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`. * lisp/net/telnet.el: Use lexical-binding. * lisp/net/quickurl.el: Use lexical-binding. * lisp/net/newst-ticker.el: Use lexical-binding. * lisp/net/newst-reader.el: Use lexical-binding. * lisp/net/goto-addr.el: Use lexical-binding. * lisp/net/gnutls.el: Use lexical-binding. * lisp/net/eudcb-macos-contacts.el: Use lexical-binding. * lisp/net/eudcb-mab.el: Use lexical-binding. * lisp/net/net-utils.el: Use lexical-binding. (finger): Remove unused var `found`. * lisp/net/network-stream.el (open-protocol-stream): Remove redundant `defalias`. * lisp/net/newst-plainview.el: Use lexical-binding. (newsticker-hide-entry, newsticker-show-entry): Remove unused var `is-invisible`. (w3m-fill-column, w3-maximum-line-length): Declare vars. * lisp/net/tramp.el (tramp-compute-multi-hops): * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): * lisp/net/tramp-cmds.el (tramp-default-rename-file): * lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`. --- lisp/net/browse-url.el | 42 ++++++------- lisp/net/dictionary.el | 67 ++++++++++---------- lisp/net/dig.el | 4 +- lisp/net/dns.el | 8 +-- lisp/net/eudc-bob.el | 20 +++--- lisp/net/eudc-export.el | 78 +++++++++++------------ lisp/net/eudc-hotlist.el | 14 ++--- lisp/net/eudc.el | 14 ++--- lisp/net/eudcb-bbdb.el | 125 ++++++++++++++++++------------------- lisp/net/eudcb-ldap.el | 18 +++--- lisp/net/eudcb-mab.el | 2 +- lisp/net/eudcb-macos-contacts.el | 4 +- lisp/net/gnutls.el | 7 +-- lisp/net/goto-addr.el | 28 +++------ lisp/net/net-utils.el | 84 ++++++++----------------- lisp/net/network-stream.el | 3 +- lisp/net/newst-backend.el | 32 +++++----- lisp/net/newst-plainview.el | 121 ++++++++++++++++++------------------ lisp/net/newst-reader.el | 10 +-- lisp/net/newst-ticker.el | 12 ++-- lisp/net/newst-treeview.el | 129 ++++++++++++++++++--------------------- lisp/net/puny.el | 4 +- lisp/net/quickurl.el | 29 +++------ lisp/net/rcirc.el | 2 +- lisp/net/secrets.el | 10 +-- lisp/net/shr-color.el | 14 ++--- lisp/net/shr.el | 26 ++++---- lisp/net/sieve-mode.el | 6 +- lisp/net/soap-client.el | 26 ++++---- lisp/net/soap-inspect.el | 46 +++++++------- lisp/net/telnet.el | 20 +++--- lisp/net/tramp-cmds.el | 2 +- lisp/net/tramp-compat.el | 2 +- lisp/net/tramp-integration.el | 2 +- lisp/net/tramp-sh.el | 4 +- lisp/net/tramp.el | 25 ++++++-- lisp/net/webjump.el | 2 +- 37 files changed, 489 insertions(+), 553 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 58f01d5bf98..1c98335a20c 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -826,7 +826,7 @@ If optional arg TEMP-FILE-NAME is non-nil, delete it instead." (if (and file-name (file-exists-p file-name)) (delete-file file-name)))) -(add-hook 'kill-buffer-hook 'browse-url-delete-temp-file) +(add-hook 'kill-buffer-hook #'browse-url-delete-temp-file) (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) @@ -1064,7 +1064,7 @@ xdg-open is a desktop utility that calls your preferred web browser." (executable-find "xdg-open"))) ;;;###autoload -(defun browse-url-xdg-open (url &optional ignored) +(defun browse-url-xdg-open (url &optional _ignored) "Pass the specified URL to the \"xdg-open\" command. xdg-open is a desktop utility that calls your preferred web browser. The optional argument IGNORED is not used." @@ -1095,7 +1095,7 @@ used instead of `browse-url-new-window-flag'." (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment)) (process - (apply 'start-process + (apply #'start-process (concat "netscape " url) nil browse-url-netscape-program (append @@ -1125,7 +1125,7 @@ used instead of `browse-url-new-window-flag'." (let* ((process-environment (browse-url-process-environment))) ;; Netscape not running - start it (message "Starting %s..." browse-url-netscape-program) - (apply 'start-process (concat "netscape" url) nil + (apply #'start-process (concat "netscape" url) nil browse-url-netscape-program (append browse-url-netscape-startup-arguments (list url)))))) @@ -1144,7 +1144,7 @@ How depends on `browse-url-netscape-version'." "Send a remote control command to Netscape." (declare (obsolete nil "25.1")) (let* ((process-environment (browse-url-process-environment))) - (apply 'start-process "netscape" nil + (apply #'start-process "netscape" nil browse-url-netscape-program (append browse-url-netscape-arguments (list "-remote" command))))) @@ -1170,7 +1170,7 @@ used instead of `browse-url-new-window-flag'." (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment)) (process - (apply 'start-process + (apply #'start-process (concat "mozilla " url) nil browse-url-mozilla-program (append @@ -1196,7 +1196,7 @@ used instead of `browse-url-new-window-flag'." (let* ((process-environment (browse-url-process-environment))) ;; Mozilla is not running - start it (message "Starting %s..." browse-url-mozilla-program) - (apply 'start-process (concat "mozilla " url) nil + (apply #'start-process (concat "mozilla " url) nil browse-url-mozilla-program (append browse-url-mozilla-startup-arguments (list url)))))) @@ -1219,7 +1219,7 @@ instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment))) - (apply 'start-process + (apply #'start-process (concat "firefox " url) nil browse-url-firefox-program (append @@ -1242,7 +1242,7 @@ The optional argument NEW-WINDOW is not used." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment))) - (apply 'start-process + (apply #'start-process (concat "chromium " url) nil browse-url-chromium-program (append @@ -1260,7 +1260,7 @@ The optional argument NEW-WINDOW is not used." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment))) - (apply 'start-process + (apply #'start-process (concat "google-chrome " url) nil browse-url-chrome-program (append @@ -1290,7 +1290,7 @@ used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment)) - (process (apply 'start-process + (process (apply #'start-process (concat "galeon " url) nil browse-url-galeon-program @@ -1315,7 +1315,7 @@ used instead of `browse-url-new-window-flag'." (let* ((process-environment (browse-url-process-environment))) ;; Galeon is not running - start it (message "Starting %s..." browse-url-galeon-program) - (apply 'start-process (concat "galeon " url) nil + (apply #'start-process (concat "galeon " url) nil browse-url-galeon-program (append browse-url-galeon-startup-arguments (list url)))))) @@ -1338,7 +1338,7 @@ used instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment)) - (process (apply 'start-process + (process (apply #'start-process (concat "epiphany " url) nil browse-url-epiphany-program @@ -1362,7 +1362,7 @@ used instead of `browse-url-new-window-flag'." (let* ((process-environment (browse-url-process-environment))) ;; Epiphany is not running - start it (message "Starting %s..." browse-url-epiphany-program) - (apply 'start-process (concat "epiphany " url) nil + (apply #'start-process (concat "epiphany " url) nil browse-url-epiphany-program (append browse-url-epiphany-startup-arguments (list url)))))) @@ -1403,7 +1403,7 @@ When called non-interactively, optional second argument NEW-WINDOW is used instead of `browse-url-new-window-flag'." (declare (obsolete nil "25.1")) (interactive (browse-url-interactive-arg "URL: ")) - (apply 'start-process (concat "gnome-moz-remote " url) + (apply #'start-process (concat "gnome-moz-remote " url) nil browse-url-gnome-moz-program (append @@ -1437,7 +1437,7 @@ NEW-WINDOW instead of `browse-url-new-window-flag'." (interactive (browse-url-interactive-arg "URL: ")) (setq url (browse-url-encode-url url)) (let* ((process-environment (browse-url-process-environment))) - (apply 'start-process (format "conkeror %s" url) + (apply #'start-process (format "conkeror %s" url) nil browse-url-conkeror-program (append @@ -1487,7 +1487,7 @@ The `browse-url-gnudoit-program' program is used with options given by `browse-url-gnudoit-args'. Default to the URL around or before point." (declare (obsolete nil "25.1")) (interactive (browse-url-interactive-arg "W3 URL: ")) - (apply 'start-process (concat "gnudoit:" url) nil + (apply #'start-process (concat "gnudoit:" url) nil browse-url-gnudoit-program (append browse-url-gnudoit-args (list (concat "(w3-fetch \"" url "\")") @@ -1667,7 +1667,7 @@ don't offer a form of remote control." (interactive (browse-url-interactive-arg "URL: ")) (if (not browse-url-generic-program) (error "No browser defined (`browse-url-generic-program')")) - (apply 'call-process browse-url-generic-program nil + (apply #'call-process browse-url-generic-program nil 0 nil (append browse-url-generic-args (list url)))) @@ -1742,9 +1742,9 @@ from `browse-url-elinks-wrapper'." (defvar browse-url-button-map (let ((map (make-sparse-keymap))) - (define-key map "\r" 'browse-url-button-open) - (define-key map [mouse-2] 'browse-url-button-open) - (define-key map "w" 'browse-url-button-copy) + (define-key map "\r" #'browse-url-button-open) + (define-key map [mouse-2] #'browse-url-button-open) + (define-key map "w" #'browse-url-button-copy) map) "The keymap used for browse-url buttons.") diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index aba3698a533..5148a66724b 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -76,7 +76,7 @@ You can specify here: - dict.org: Only use dict.org - User-defined: You can specify your own server here" :group 'dictionary - :set 'dictionary-set-server-var + :set #'dictionary-set-server-var :type '(choice (const :tag "Automatic" nil) (const :tag "localhost" "localhost") (const :tag "dict.org" "dict.org") @@ -88,7 +88,7 @@ You can specify here: "The port of the dictionary server. This port is propably always 2628 so there should be no need to modify it." :group 'dictionary - :set 'dictionary-set-server-var + :set #'dictionary-set-server-var :type 'number :version "28.1") @@ -189,7 +189,7 @@ where the current word was found." nil "Connects via a HTTP proxy using the CONNECT command when not nil." :group 'dictionary-proxy - :set 'dictionary-set-server-var + :set #'dictionary-set-server-var :type 'boolean :version "28.1") @@ -197,7 +197,7 @@ where the current word was found." "proxy" "The name of the HTTP proxy to use when `dictionary-use-http-proxy' is set." :group 'dictionary-proxy - :set 'dictionary-set-server-var + :set #'dictionary-set-server-var :type 'string :version "28.1") @@ -205,7 +205,7 @@ where the current word was found." 3128 "The port of the proxy server, used only when `dictionary-use-http-proxy' is set." :group 'dictionary-proxy - :set 'dictionary-set-server-var + :set #'dictionary-set-server-var :type 'number :version "28.1") @@ -331,19 +331,19 @@ is utf-8" (suppress-keymap map) (set-keymap-parent map button-buffer-map) - (define-key map "q" 'dictionary-close) - (define-key map "h" 'dictionary-help) - (define-key map "s" 'dictionary-search) - (define-key map "d" 'dictionary-lookup-definition) - (define-key map "D" 'dictionary-select-dictionary) - (define-key map "M" 'dictionary-select-strategy) - (define-key map "m" 'dictionary-match-words) - (define-key map "l" 'dictionary-previous) - (define-key map "n" 'forward-button) - (define-key map "p" 'backward-button) - (define-key map " " 'scroll-up-command) - (define-key map [?\S-\ ] 'scroll-down-command) - (define-key map (read-kbd-macro "M-SPC") 'scroll-down-command) + (define-key map "q" #'dictionary-close) + (define-key map "h" #'dictionary-help) + (define-key map "s" #'dictionary-search) + (define-key map "d" #'dictionary-lookup-definition) + (define-key map "D" #'dictionary-select-dictionary) + (define-key map "M" #'dictionary-select-strategy) + (define-key map "m" #'dictionary-match-words) + (define-key map "l" #'dictionary-previous) + (define-key map "n" #'forward-button) + (define-key map "p" #'backward-button) + (define-key map " " #'scroll-up-command) + (define-key map [?\S-\ ] #'scroll-down-command) + (define-key map (read-kbd-macro "M-SPC") #'scroll-down-command) map) "Keymap for the dictionary mode.") @@ -413,7 +413,7 @@ This is a quick reference to this mode describing the default key bindings: (make-local-variable 'dictionary-default-dictionary) (make-local-variable 'dictionary-default-strategy) - (add-hook 'kill-buffer-hook 'dictionary-close t t) + (add-hook 'kill-buffer-hook #'dictionary-close t t) (run-hooks 'dictionary-mode-hook)) ;;;###autoload @@ -535,7 +535,7 @@ The connection takes the proxy setting in customization group ;; Dealing with closing the buffer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun dictionary-close (&rest ignored) +(defun dictionary-close (&rest _ignored) "Close the current dictionary buffer and its connection." (interactive) (if (eq major-mode 'dictionary-mode) @@ -669,7 +669,7 @@ previous state." (setq dictionary-positions (cons (point) (window-start)))) ;; Restore the previous state -(defun dictionary-restore-state (&rest ignored) +(defun dictionary-restore-state (&rest _ignored) "Restore the state just before the last operation." (let ((position (pop dictionary-position-stack)) (data (pop dictionary-data-stack))) @@ -872,7 +872,7 @@ The word is taken from the buffer, the DICTIONARY is given as argument." 'help-echo (concat "Press Mouse-2 to lookup \"" word "\" in \"" dictionary "\""))))) -(defun dictionary-select-dictionary (&rest ignored) +(defun dictionary-select-dictionary (&rest _ignored) "Save the current state and start a dictionary selection." (interactive) (dictionary-ensure-buffer) @@ -880,7 +880,7 @@ The word is taken from the buffer, the DICTIONARY is given as argument." (dictionary-do-select-dictionary) (dictionary-store-state 'dictionary-do-select-dictionary nil)) -(defun dictionary-do-select-dictionary (&rest ignored) +(defun dictionary-do-select-dictionary (&rest _ignored) "The workhorse for doing the dictionary selection." (message "Looking up databases and descriptions") @@ -916,7 +916,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-dictionary-line "! \"The first matching dictionary\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapc 'dictionary-display-dictionary-line list)) + (mapc #'dictionary-display-dictionary-line list)) (dictionary-post-buffer)) (defun dictionary-display-dictionary-line (string) @@ -984,7 +984,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-store-state 'dictionary-display-more-info dictionary)))) -(defun dictionary-select-strategy (&rest ignored) +(defun dictionary-select-strategy (&rest _ignored) "Save the current state and start a strategy selection." (interactive) (dictionary-ensure-buffer) @@ -1014,7 +1014,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (dictionary-display-strategy-line ". \"The servers default\"") (let* ((reply (dictionary-read-answer)) (list (dictionary-simple-split-string reply "\n+"))) - (mapc 'dictionary-display-strategy-line list)) + (mapc #'dictionary-display-strategy-line list)) (dictionary-post-buffer)) (defun dictionary-display-strategy-line (string) @@ -1030,7 +1030,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." 'help-echo (purecopy "Mouse-2 to select this matching algorithm")) (insert "\n"))))) -(defun dictionary-set-strategy (strategy &rest ignored) +(defun dictionary-set-strategy (strategy &rest _ignored) "Select this STRATEGY as new default." (setq dictionary-default-strategy strategy) (dictionary-restore-state) @@ -1194,7 +1194,7 @@ allows editing it." (describe-function 'dictionary-mode)) ;;;###autoload -(defun dictionary-match-words (&optional pattern &rest ignored) +(defun dictionary-match-words (&optional pattern &rest _ignored) "Search PATTERN in current default dictionary using default strategy." (interactive) ;; can't use interactive because of mouse events @@ -1270,7 +1270,7 @@ allows editing it." (defun dictionary-read-definition (&ignore) (let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+"))) - (mapconcat 'identity (cdr list) "\n"))) + (mapconcat #'identity (cdr list) "\n"))) ;;; Tooltip support for GNU Emacs (defvar global-dictionary-tooltip-mode @@ -1322,8 +1322,8 @@ will be set to nil." (interactive) (tooltip-mode on) (if on - (add-hook 'tooltip-functions 'dictionary-display-tooltip) - (remove-hook 'tooltip-functions 'dictionary-display-tooltip))) + (add-hook 'tooltip-functions #'dictionary-display-tooltip) + (remove-hook 'tooltip-functions #'dictionary-display-tooltip))) ;;;###autoload (defun dictionary-tooltip-mode (&optional arg) @@ -1364,9 +1364,8 @@ any buffer where (dictionary-tooltip-mode 1) has been called." (make-local-variable 'dictionary-tooltip-mouse-event) (setq-default track-mouse on) (dictionary-switch-tooltip-mode 1) - (if on - (global-set-key [mouse-movement] 'dictionary-tooltip-track-mouse) - (global-set-key [mouse-movement] 'ignore)) + (global-set-key [mouse-movement] + (if on #'dictionary-tooltip-track-mouse #'ignore)) on)) (provide 'dictionary) diff --git a/lisp/net/dig.el b/lisp/net/dig.el index 92dcf73250b..ddbfb9598b8 100644 --- a/lisp/net/dig.el +++ b/lisp/net/dig.el @@ -79,7 +79,7 @@ and is a commonly available debugging tool." (push domain cmdline) (if server (push (concat "@" server) cmdline) (if dig-dns-server (push (concat "@" dig-dns-server) cmdline))) - (apply 'call-process dig-program nil buf nil cmdline) + (apply #'call-process dig-program nil buf nil cmdline) buf)) (defun dig-extract-rr (domain &optional type class) @@ -120,7 +120,7 @@ Buffer should contain output generated by `dig-invoke'." (defvar dig-mode-map (let ((map (make-sparse-keymap))) (define-key map "g" nil) - (define-key map "q" 'dig-exit) + (define-key map "q" #'dig-exit) map)) (define-derived-mode dig-mode special-mode "Dig" diff --git a/lisp/net/dns.el b/lisp/net/dns.el index 90776e3c6f2..1086bab9466 100644 --- a/lisp/net/dns.el +++ b/lisp/net/dns.el @@ -135,8 +135,8 @@ updated. Set this variable to t to disable the check.") (if (stringp ended) (if (null name) ended - (concat (mapconcat 'identity (nreverse name) ".") "." ended)) - (mapconcat 'identity (nreverse name) ".")))) + (concat (mapconcat #'identity (nreverse name) ".") "." ended)) + (mapconcat #'identity (nreverse name) ".")))) (defun dns-write (spec &optional tcp-p) "Write a DNS packet according to SPEC. @@ -283,7 +283,7 @@ If TCP-P, the first two bytes of the packet will be the length field." (let ((bytes nil)) (dotimes (_ 4) (push (dns-read-bytes 1) bytes)) - (mapconcat 'number-to-string (nreverse bytes) "."))) + (mapconcat #'number-to-string (nreverse bytes) "."))) ((eq type 'AAAA) (let (hextets) (dotimes (_ 8) @@ -386,7 +386,7 @@ If REVERSE, look up an IP address." (when reverse (setq name (concat - (mapconcat 'identity (nreverse (split-string name "\\.")) ".") + (mapconcat #'identity (nreverse (split-string name "\\.")) ".") ".in-addr.arpa") type 'PTR)) diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el index 456d70ee0fe..1d7af7f5b5f 100644 --- a/lisp/net/eudc-bob.el +++ b/lisp/net/eudc-bob.el @@ -41,38 +41,38 @@ (defvar eudc-bob-generic-keymap (let ((map (make-sparse-keymap))) - (define-key map "s" 'eudc-bob-save-object) - (define-key map "!" 'eudc-bob-pipe-object-to-external-program) - (define-key map [down-mouse-3] 'eudc-bob-popup-menu) + (define-key map "s" #'eudc-bob-save-object) + (define-key map "!" #'eudc-bob-pipe-object-to-external-program) + (define-key map [down-mouse-3] #'eudc-bob-popup-menu) map) "Keymap for multimedia objects.") (defvar eudc-bob-image-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map eudc-bob-generic-keymap) - (define-key map "t" 'eudc-bob-toggle-inline-display) + (define-key map "t" #'eudc-bob-toggle-inline-display) map) "Keymap for inline images.") (defvar eudc-bob-sound-keymap (let ((map (make-sparse-keymap))) (set-keymap-parent map eudc-bob-generic-keymap) - (define-key map (kbd "RET") 'eudc-bob-play-sound-at-point) - (define-key map [down-mouse-2] 'eudc-bob-play-sound-at-mouse) + (define-key map (kbd "RET") #'eudc-bob-play-sound-at-point) + (define-key map [down-mouse-2] #'eudc-bob-play-sound-at-mouse) map) "Keymap for inline sounds.") (defvar eudc-bob-url-keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'browse-url-at-point) - (define-key map [down-mouse-2] 'browse-url-at-mouse) + (define-key map (kbd "RET") #'browse-url-at-point) + (define-key map [down-mouse-2] #'browse-url-at-mouse) map) "Keymap for inline urls.") (defvar eudc-bob-mail-keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "RET") 'goto-address-at-point) - (define-key map [down-mouse-2] 'goto-address-at-point) + (define-key map (kbd "RET") #'goto-address-at-point) + (define-key map [down-mouse-2] #'goto-address-at-point) map) "Keymap for inline e-mail addresses.") diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el index bac75e6555d..66db7814ad8 100644 --- a/lisp/net/eudc-export.el +++ b/lisp/net/eudc-export.el @@ -1,4 +1,4 @@ -;;; eudc-export.el --- functions to export EUDC query results +;;; eudc-export.el --- functions to export EUDC query results -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2021 Free Software Foundation, Inc. @@ -35,6 +35,7 @@ ;; NOERROR is so we can compile it. (require 'bbdb nil t) (require 'bbdb-com nil t) +(require 'cl-lib) (defun eudc-create-bbdb-record (record &optional silent) "Create a BBDB record using the RECORD alist. @@ -42,24 +43,22 @@ RECORD is an alist of (KEY . VALUE) where KEY is a directory attribute name symbol and VALUE is the corresponding value for the record. If SILENT is non-nil then the created BBDB record is not displayed." (require 'bbdb) + (declare-function bbdb-create-internal "bbdb-com" (&rest spec)) + (declare-function bbdb-display-records "bbdb" + (records &optional layout append)) ;; This function runs in a special context where lisp symbols corresponding ;; to field names in record are bound to the corresponding values - (eval - `(let* (,@(mapcar (lambda (c) - (list (car c) (if (listp (cdr c)) - (list 'quote (cdr c)) - (cdr c)))) - record) - bbdb-name - bbdb-company - bbdb-net - bbdb-address - bbdb-phones - bbdb-notes - spec - bbdb-record - value - (conversion-alist (symbol-value eudc-bbdb-conversion-alist))) + (cl-progv (mapcar #'car record) (mapcar #'cdr record) + (let* (bbdb-name + bbdb-company + bbdb-net + bbdb-address + bbdb-phones + bbdb-notes + spec + bbdb-record + value + (conversion-alist (symbol-value eudc-bbdb-conversion-alist))) ;; BBDB standard fields (setq bbdb-name (eudc-parse-spec (cdr (assq 'name conversion-alist)) record nil) @@ -68,14 +67,14 @@ If SILENT is non-nil then the created BBDB record is not displayed." bbdb-notes (eudc-parse-spec (cdr (assq 'notes conversion-alist)) record nil)) (setq spec (cdr (assq 'address conversion-alist))) (setq bbdb-address (delq nil (eudc-parse-spec (if (listp (car spec)) - spec - (list spec)) - record t))) + spec + (list spec)) + record t))) (setq spec (cdr (assq 'phone conversion-alist))) (setq bbdb-phones (delq nil (eudc-parse-spec (if (listp (car spec)) - spec - (list spec)) - record t))) + spec + (list spec)) + record t))) ;; BBDB custom fields (setq bbdb-notes (append (list (and bbdb-notes (cons 'notes bbdb-notes))) (mapcar (lambda (mapping) @@ -85,19 +84,20 @@ If SILENT is non-nil then the created BBDB record is not displayed." (cons (car mapping) value))) conversion-alist))) (setq bbdb-notes (delq nil bbdb-notes)) - (setq bbdb-record (bbdb-create-internal - bbdb-name - ,@(when (eudc--using-bbdb-3-or-newer-p) - '(nil - nil)) - bbdb-company - bbdb-net - ,@(if (eudc--using-bbdb-3-or-newer-p) - '(bbdb-phones - bbdb-address) - '(bbdb-address - bbdb-phones)) - bbdb-notes)) + (setq bbdb-record + (apply #'bbdb-create-internal + `(,bbdb-name + ,@(when (eudc--using-bbdb-3-or-newer-p) + '(nil + nil)) + ,bbdb-company + ,bbdb-net + ,@(if (eudc--using-bbdb-3-or-newer-p) + (list bbdb-phones + bbdb-address) + (list bbdb-address + bbdb-phones)) + ,bbdb-notes))) (or silent (bbdb-display-records (list bbdb-record)))))) @@ -111,7 +111,7 @@ If RECURSE is non-nil then SPEC may be a list of atomic specs." (symbolp (car spec)) (fboundp (car spec)))) (condition-case nil - (eval spec) + (eval spec t) (void-variable nil))) ((and recurse (listp spec)) @@ -194,9 +194,9 @@ LOCATION is used as the phone location for BBDB." (signal (car err) (cdr err))))) (if (= 3 (length phone-list)) (setq phone-list (append phone-list '(nil)))) - (apply 'vector location phone-list))) + (apply #'vector location phone-list))) ((listp phone) - (vector location (mapconcat 'identity phone ", "))) + (vector location (mapconcat #'identity phone ", "))) (t (error "Invalid phone specification")))) diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el index e4b7e8ae71b..a737a99ce95 100644 --- a/lisp/net/eudc-hotlist.el +++ b/lisp/net/eudc-hotlist.el @@ -1,4 +1,4 @@ -;;; eudc-hotlist.el --- hotlist management for EUDC +;;; eudc-hotlist.el --- hotlist management for EUDC -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2021 Free Software Foundation, Inc. @@ -37,12 +37,12 @@ (defvar eudc-hotlist-mode-map (let ((map (make-sparse-keymap))) - (define-key map "a" 'eudc-hotlist-add-server) - (define-key map "d" 'eudc-hotlist-delete-server) - (define-key map "s" 'eudc-hotlist-select-server) - (define-key map "t" 'eudc-hotlist-transpose-servers) - (define-key map "q" 'eudc-hotlist-quit-edit) - (define-key map "x" 'kill-current-buffer) + (define-key map "a" #'eudc-hotlist-add-server) + (define-key map "d" #'eudc-hotlist-delete-server) + (define-key map "s" #'eudc-hotlist-select-server) + (define-key map "t" #'eudc-hotlist-transpose-servers) + (define-key map "q" #'eudc-hotlist-quit-edit) + (define-key map "x" #'kill-current-buffer) map)) (define-derived-mode eudc-hotlist-mode fundamental-mode "EUDC-Servers" diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 4f048045d52..c112d273309 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -65,12 +65,12 @@ (defvar eudc-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map widget-keymap) - (define-key map "q" 'kill-current-buffer) - (define-key map "x" 'kill-current-buffer) - (define-key map "f" 'eudc-query-form) - (define-key map "b" 'eudc-try-bbdb-insert) - (define-key map "n" 'eudc-move-to-next-record) - (define-key map "p" 'eudc-move-to-previous-record) + (define-key map "q" #'kill-current-buffer) + (define-key map "x" #'kill-current-buffer) + (define-key map "f" #'eudc-query-form) + (define-key map "b" #'eudc-try-bbdb-insert) + (define-key map "n" #'eudc-move-to-next-record) + (define-key map "p" #'eudc-move-to-previous-record) map)) (defvar mode-popup-menu) @@ -407,7 +407,7 @@ if any, is called to print the value in cdr of FIELD." (val (cdr field))) (if match (progn - (eval (list (cdr match) val)) + (funcall (cdr match) val) (insert "\n")) (mapc (lambda (val-elem) diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el index e11458b29cb..e241a1c2fac 100644 --- a/lisp/net/eudcb-bbdb.el +++ b/lisp/net/eudcb-bbdb.el @@ -1,4 +1,4 @@ -;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend +;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2021 Free Software Foundation, Inc. @@ -34,6 +34,7 @@ ;; Make it loadable on systems without bbdb. (require 'bbdb nil t) (require 'bbdb-com nil t) +(require 'seq) ;;{{{ Internal cooking @@ -87,33 +88,30 @@ BBDB < 3 used `net'; BBDB >= 3 uses `mail'." "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." (require 'bbdb) (catch 'unmatch - (progn - (dolist (condition eudc-bbdb-current-query) - (let ((attr (car condition)) - (val (cdr condition)) - (case-fold-search t) - bbdb-val) - (or (and (memq attr '(firstname lastname aka company phones - addresses net)) - (progn - (setq bbdb-val - (eval (list (intern (concat "bbdb-record-" - (symbol-name - (eudc-bbdb-field - attr)))) - 'record))) - (if (listp bbdb-val) - (if eudc-bbdb-enable-substring-matches - (eval `(or ,@(mapcar (lambda (subval) - (string-match val subval)) - bbdb-val))) - (member (downcase val) - (mapcar 'downcase bbdb-val))) + (dolist (condition eudc-bbdb-current-query) + (let ((attr (car condition)) + (val (cdr condition)) + (case-fold-search t)) + (or (and (memq attr '(firstname lastname aka company phones + addresses net)) + (let ((bbdb-val + (funcall (intern (concat "bbdb-record-" + (symbol-name + (eudc-bbdb-field + attr)))) + record))) + (if (listp bbdb-val) (if eudc-bbdb-enable-substring-matches - (string-match val bbdb-val) - (string-equal (downcase val) (downcase bbdb-val)))))) - (throw 'unmatch nil)))) - record))) + (seq-some (lambda (subval) + (string-match val subval)) + bbdb-val) + (member (downcase val) + (mapcar #'downcase bbdb-val))) + (if eudc-bbdb-enable-substring-matches + (string-match val bbdb-val) + (string-equal (downcase val) (downcase bbdb-val)))))) + (throw 'unmatch nil)))) + record)) ;; External. (declare-function bbdb-phone-location "ext:bbdb" t) ; via bbdb-defstruct @@ -182,40 +180,34 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'." (require 'bbdb) (let ((attrs (or eudc-bbdb-current-return-attributes '(firstname lastname aka company phones addresses net notes))) - attr - eudc-rec - val) - (while (prog1 - (setq attr (car attrs)) - (setq attrs (cdr attrs))) - (cond - ((eq attr 'phones) - (setq val (eudc-bbdb-extract-phones record))) - ((eq attr 'addresses) - (setq val (eudc-bbdb-extract-addresses record))) - ((eq attr 'notes) - (if (eudc--using-bbdb-3-or-newer-p) - (setq val (bbdb-record-xfield record 'notes)) - (setq val (bbdb-record-notes record)))) - ((memq attr '(firstname lastname aka company net)) - (setq val (eval - (list (intern - (concat "bbdb-record-" - (symbol-name (eudc-bbdb-field attr)))) - 'record)))) - (t - (error "Unknown BBDB attribute"))) - (cond - ((or (not val) (equal val ""))) ; do nothing - ((memq attr '(phones addresses)) - (setq eudc-rec (append val eudc-rec))) - ((and (listp val) - (= 1 (length val))) - (setq eudc-rec (cons (cons attr (car val)) eudc-rec))) - ((> (length val) 0) - (setq eudc-rec (cons (cons attr val) eudc-rec))) - (t - (error "Unexpected attribute value")))) + eudc-rec) + (dolist (attr attrs) + (let ((val + (pcase attr + ('phones (eudc-bbdb-extract-phones record)) + ('addresses (eudc-bbdb-extract-addresses record)) + ('notes + (if (eudc--using-bbdb-3-or-newer-p) + (bbdb-record-xfield record 'notes) + (bbdb-record-notes record))) + ((or 'firstname 'lastname 'aka 'company 'net) + (funcall (intern + (concat "bbdb-record-" + (symbol-name (eudc-bbdb-field attr)))) + record)) + (_ + (error "Unknown BBDB attribute"))))) + (cond + ((or (not val) (equal val ""))) ; do nothing + ((memq attr '(phones addresses)) + (setq eudc-rec (append val eudc-rec))) + ((and (listp val) + (= 1 (length val))) + (push (cons attr (car val)) eudc-rec)) + ((> (length val) 0) + (push (cons attr val) eudc-rec)) + (t + (error "Unexpected attribute value"))))) (nreverse eudc-rec))) @@ -240,21 +232,20 @@ RETURN-ATTRS is a list of attributes to return, defaulting to (while (and records (> (length query-attrs) 0)) (setq bbdb-attrs (append bbdb-attrs (list (car query-attrs)))) (if (car query-attrs) - (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs)))) + ;; BEWARE: `bbdb-search' is a macro! + (setq records (eval `(bbdb-search records ,@bbdb-attrs) t))) (setq query-attrs (cdr query-attrs))) (mapc (lambda (record) (setq filtered (eudc-filter-duplicate-attributes record)) ;; If there were duplicate attributes reverse the order of the ;; record so the unique attributes appear first (if (> (length filtered) 1) - (setq filtered (mapcar (lambda (rec) - (reverse rec)) - filtered))) + (setq filtered (mapcar #'reverse filtered))) (setq result (append result filtered))) (delq nil - (mapcar 'eudc-bbdb-format-record-as-result + (mapcar #'eudc-bbdb-format-record-as-result (delq nil - (mapcar 'eudc-bbdb-filter-non-matching-record + (mapcar #'eudc-bbdb-filter-non-matching-record records))))) result)) diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el index 4623079ea9f..0aff276475e 100644 --- a/lisp/net/eudcb-ldap.el +++ b/lisp/net/eudcb-ldap.el @@ -1,4 +1,4 @@ -;;; eudcb-ldap.el --- Emacs Unified Directory Client - LDAP Backend +;;; eudcb-ldap.el --- Emacs Unified Directory Client - LDAP Backend -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2021 Free Software Foundation, Inc. @@ -38,10 +38,10 @@ ;;{{{ Internal cooking -(eval-and-compile +(defalias 'eudc-ldap-get-host-parameter (if (fboundp 'ldap-get-host-parameter) - (fset 'eudc-ldap-get-host-parameter 'ldap-get-host-parameter) - (defun eudc-ldap-get-host-parameter (host parameter) + #'ldap-get-host-parameter + (lambda (host parameter) "Get the value of PARAMETER for HOST in `ldap-host-parameters-alist'." (plist-get (cdr (assoc host ldap-host-parameters-alist)) parameter)))) @@ -84,7 +84,7 @@ record)) (defun eudc-filter-$ (string) - (mapconcat 'identity (split-string string "\\$") "\n")) + (mapconcat #'identity (split-string string "\\$") "\n")) (defun eudc-ldap-cleanup-record-filtering-addresses (record) "Clean up RECORD to make it suitable for EUDC. @@ -104,7 +104,7 @@ multiple addresses." (value (cdr field))) (when (and clean-up-addresses (memq name '(postaladdress registeredaddress))) - (setq value (mapcar 'eudc-filter-$ value))) + (setq value (mapcar #'eudc-filter-$ value))) (if (eq name 'mail) (setq mail-addresses (append mail-addresses value)) (push (cons name (if (cdr value) @@ -126,9 +126,9 @@ RETURN-ATTRS is a list of attributes to return, defaulting to (let ((result (ldap-search (eudc-ldap-format-query-as-rfc1558 query) eudc-server (if (listp return-attrs) - (mapcar 'symbol-name return-attrs)))) + (mapcar #'symbol-name return-attrs)))) final-result) - (setq result (mapcar 'eudc-ldap-cleanup-record-filtering-addresses result)) + (setq result (mapcar #'eudc-ldap-cleanup-record-filtering-addresses result)) (if (and eudc-strict-return-matches return-attrs @@ -154,7 +154,7 @@ attribute names are returned. Default to `person'." (let ((ldap-host-parameters-alist (list (cons eudc-server '(scope subtree sizelimit 1))))) - (mapcar 'eudc-ldap-cleanup-record-filtering-addresses + (mapcar #'eudc-ldap-cleanup-record-filtering-addresses (ldap-search (eudc-ldap-format-query-as-rfc1558 (list (cons "objectclass" diff --git a/lisp/net/eudcb-mab.el b/lisp/net/eudcb-mab.el index eb7032ac4c8..732881f75a0 100644 --- a/lisp/net/eudcb-mab.el +++ b/lisp/net/eudcb-mab.el @@ -1,4 +1,4 @@ -;;; eudcb-mab.el --- Emacs Unified Directory Client - AddressBook backend +;;; eudcb-mab.el --- Emacs Unified Directory Client - AddressBook backend -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. diff --git a/lisp/net/eudcb-macos-contacts.el b/lisp/net/eudcb-macos-contacts.el index b07016c1229..18c8958c160 100644 --- a/lisp/net/eudcb-macos-contacts.el +++ b/lisp/net/eudcb-macos-contacts.el @@ -1,4 +1,4 @@ -;;; eudcb-macos-contacts.el --- EUDC - macOS Contacts backend +;;; eudcb-macos-contacts.el --- EUDC - macOS Contacts backend -*- lexical-binding: t; -*- ;; Copyright (C) 2020-2021 Free Software Foundation, Inc. @@ -74,7 +74,7 @@ end tell" str)) "`osascript' executable not found. " "Is this is a macOS 10.0 or later system?")))) -(defun eudc-macos-contacts-query-internal (query &optional return-attrs) +(defun eudc-macos-contacts-query-internal (query &optional _return-attrs) "Query macOS Contacts with QUERY. QUERY is a list of cons cells (ATTR . VALUE) where ATTRs should be valid macOS Contacts attribute names. diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index ff58cbb035e..9c7bcdc261a 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -1,4 +1,4 @@ -;;; gnutls.el --- Support SSL/TLS connections through GnuTLS +;;; gnutls.el --- Support SSL/TLS connections through GnuTLS -*- lexical-binding: t; -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -59,7 +59,6 @@ general, Emacs network security is handled by the Network Security Manager (NSM), and the default value of nil delegates the job of checking the connection security to the NSM. See Info node `(emacs) Network Security'." - :group 'gnutls :type '(choice (const nil) string)) @@ -91,7 +90,6 @@ checks are performed at the gnutls level. Instead the checks are performed via `open-network-stream' at a higher level by the Network Security Manager. See Info node `(emacs) Network Security'." - :group 'gnutls :version "24.4" :type '(choice (const t) @@ -118,7 +116,6 @@ Security'." If a file path contains glob wildcards, they will be expanded. The files may be in PEM or DER format, as per the GnuTLS documentation. The files may not exist, in which case they will be ignored." - :group 'gnutls :type '(choice (function :tag "Function to produce list of bundle filenames") (repeat (file :tag "Bundle filename")))) @@ -139,7 +136,6 @@ network security is handled at a higher level via node `(emacs) Network Security'." :type '(choice (const :tag "Use default value" nil) (integer :tag "Number of bits" 2048)) - :group 'gnutls :version "27.1") (defcustom gnutls-crlfiles @@ -150,7 +146,6 @@ node `(emacs) Network Security'." If a file path contains glob wildcards, they will be expanded. The files may be in PEM or DER format, as per the GnuTLS documentation. The files may not exist, in which case they will be ignored." - :group 'gnutls :type '(choice (function :tag "Function to produce list of CRL filenames") (repeat (file :tag "CRL filename"))) :version "27.1") diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el index d1926302470..af12f6970a6 100644 --- a/lisp/net/goto-addr.el +++ b/lisp/net/goto-addr.el @@ -1,4 +1,4 @@ -;;; goto-addr.el --- click to browse URL or to send to e-mail address +;;; goto-addr.el --- click to browse URL or to send to e-mail address -*- lexical-binding: t; -*- ;; Copyright (C) 1995, 2000-2021 Free Software Foundation, Inc. @@ -73,19 +73,16 @@ (defcustom goto-address-fontify-p t "Non-nil means URLs and e-mail addresses in buffer are fontified. But only if `goto-address-highlight-p' is also non-nil." - :type 'boolean - :group 'goto-address) + :type 'boolean) (defcustom goto-address-highlight-p t "Non-nil means URLs and e-mail addresses in buffer are highlighted." - :type 'boolean - :group 'goto-address) + :type 'boolean) (defcustom goto-address-fontify-maximum-size 30000 "Maximum size of file in which to fontify and/or highlight URLs. A value of t means there is no limit--fontify regardless of the size." - :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t)) - :group 'goto-address) + :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t))) (defvar goto-address-mail-regexp ;; Actually pretty much any char could appear in the username part. -stef @@ -122,30 +119,26 @@ will have no effect.") (defvar goto-address-highlight-keymap (let ((m (make-sparse-keymap))) - (define-key m (kbd "") 'goto-address-at-point) - (define-key m (kbd "C-c RET") 'goto-address-at-point) + (define-key m (kbd "") #'goto-address-at-point) + (define-key m (kbd "C-c RET") #'goto-address-at-point) m) "Keymap to hold goto-addr's mouse key defs under highlighted URLs.") (defcustom goto-address-url-face 'link "Face to use for URLs." - :type 'face - :group 'goto-address) + :type 'face) (defcustom goto-address-url-mouse-face 'highlight "Face to use for URLs when the mouse is on them." - :type 'face - :group 'goto-address) + :type 'face) (defcustom goto-address-mail-face 'italic "Face to use for e-mail addresses." - :type 'face - :group 'goto-address) + :type 'face) (defcustom goto-address-mail-mouse-face 'secondary-selection "Face to use for e-mail addresses when the mouse is on them." - :type 'face - :group 'goto-address) + :type 'face) (defun goto-address-unfontify (start end) "Remove `goto-address' fontification from the given region." @@ -287,7 +280,6 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and ;;;###autoload (define-globalized-minor-mode global-goto-address-mode goto-address-mode goto-addr-mode--turn-on - :group 'goto-address :version "28.1") ;;;###autoload diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index d5aad3a3f77..3a561a0ea51 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -1,4 +1,4 @@ -;;; net-utils.el --- network functions +;;; net-utils.el --- network functions -*- lexical-binding: t; -*- ;; Copyright (C) 1998-2021 Free Software Foundation, Inc. @@ -67,17 +67,14 @@ "tracert" "traceroute") "Program to trace network hops to a destination." - :group 'net-utils :type 'string) (defcustom traceroute-program-options nil "Options for the traceroute program." - :group 'net-utils :type '(repeat string)) (defcustom ping-program "ping" "Program to send network test packets to a host." - :group 'net-utils :type 'string) ;; On GNU/Linux and Irix, the system's ping program seems to send packets @@ -87,7 +84,6 @@ (list "-c" "4")) "Options for the ping program. These options can be used to limit how many ICMP packets are emitted." - :group 'net-utils :type '(repeat string)) (defcustom ifconfig-program @@ -98,7 +94,6 @@ These options can be used to limit how many ICMP packets are emitted." (t "ip")) "Program to print network configuration information." :version "25.1" ; add ip - :group 'net-utils :type 'string) (defcustom ifconfig-program-options @@ -108,7 +103,6 @@ These options can be used to limit how many ICMP packets are emitted." "Options for the ifconfig program." :version "25.1" :set-after '(ifconfig-program) - :group 'net-utils :type '(repeat string)) (defcustom iwconfig-program @@ -116,7 +110,6 @@ These options can be used to limit how many ICMP packets are emitted." ((net-utils--executable-find-sbin "iw") "iw") (t "iw")) "Program to print wireless network configuration information." - :group 'net-utils :type 'string :version "26.1") @@ -124,7 +117,6 @@ These options can be used to limit how many ICMP packets are emitted." (cond ((string-match-p "iw\\'" iwconfig-program) (list "dev")) (t nil)) "Options for the iwconfig program." - :group 'net-utils :type '(repeat string) :version "26.1") @@ -133,25 +125,21 @@ These options can be used to limit how many ICMP packets are emitted." ((net-utils--executable-find-sbin "ss")) (t "ss")) "Program to print network statistics." - :group 'net-utils :type 'string :version "26.1") (defcustom netstat-program-options (list "-a") "Options for the netstat program." - :group 'net-utils :type '(repeat string)) (defcustom arp-program (or (net-utils--executable-find-sbin "arp") "arp") "Program to print IP to address translation tables." - :group 'net-utils :type 'string) (defcustom arp-program-options (list "-a") "Options for the arp program." - :group 'net-utils :type '(repeat string)) (defcustom route-program @@ -162,7 +150,6 @@ These options can be used to limit how many ICMP packets are emitted." ((net-utils--executable-find-sbin "ip")) (t "ip")) "Program to print routing tables." - :group 'net-utils :type 'string :version "26.1") @@ -171,18 +158,15 @@ These options can be used to limit how many ICMP packets are emitted." ((string-match-p "netstat\\'" route-program) (list "-r")) (t (list "route"))) "Options for the route program." - :group 'net-utils :type '(repeat string) :version "26.1") (defcustom nslookup-program "nslookup" "Program to interactively query DNS information." - :group 'net-utils :type 'string) (defcustom nslookup-program-options nil "Options for the nslookup program." - :group 'net-utils :type '(repeat string)) (defcustom nslookup-prompt-regexp "^> " @@ -190,28 +174,23 @@ These options can be used to limit how many ICMP packets are emitted." This variable is only used if the variable `comint-use-prompt-regexp' is non-nil." - :group 'net-utils :type 'regexp) (defcustom dig-program "dig" "Program to query DNS information." - :group 'net-utils :type 'string) (defcustom dig-program-options nil "Options for the dig program." - :group 'net-utils :type '(repeat string) :version "26.1") (defcustom ftp-program "ftp" "Program to run to do FTP transfers." - :group 'net-utils :type 'string) (defcustom ftp-program-options nil "Options for the ftp program." - :group 'net-utils :type '(repeat string)) (defcustom ftp-prompt-regexp "^ftp>" @@ -219,17 +198,14 @@ This variable is only used if the variable This variable is only used if the variable `comint-use-prompt-regexp' is non-nil." - :group 'net-utils :type 'regexp) (defcustom smbclient-program "smbclient" "Smbclient program." - :group 'net-utils :type 'string) (defcustom smbclient-program-options nil "Options for the smbclient program." - :group 'net-utils :type '(repeat string)) (defcustom smbclient-prompt-regexp "^smb: >" @@ -237,17 +213,14 @@ This variable is only used if the variable This variable is only used if the variable `comint-use-prompt-regexp' is non-nil." - :group 'net-utils :type 'regexp) (defcustom dns-lookup-program "host" "Program to interactively query DNS information." - :group 'net-utils :type 'string) (defcustom dns-lookup-program-options nil "Options for the dns-lookup program." - :group 'net-utils :type '(repeat string)) ;; Internal variables @@ -265,7 +238,7 @@ This variable is only used if the variable 1 'font-lock-keyword-face) ;; Dotted quads (list - (mapconcat 'identity + (mapconcat #'identity (make-list 4 "[0-9]+") "\\.") 0 'font-lock-variable-name-face) @@ -273,7 +246,7 @@ This variable is only used if the variable (list (let ((host-expression "[-A-Za-z0-9]+")) (concat - (mapconcat 'identity + (mapconcat #'identity (make-list 2 host-expression) "\\.") "\\(\\." host-expression "\\)*")) @@ -288,7 +261,7 @@ This variable is only used if the variable (list ;; Dotted quads (list - (mapconcat 'identity (make-list 4 "[0-9]+") "\\.") + (mapconcat #'identity (make-list 4 "[0-9]+") "\\.") 0 'font-lock-variable-name-face) ;; Simple rfc4291 addresses (list (concat @@ -300,7 +273,7 @@ This variable is only used if the variable (list (let ((host-expression "[-A-Za-z0-9]+")) (concat - (mapconcat 'identity (make-list 2 host-expression) "\\.") + (mapconcat #'identity (make-list 2 host-expression) "\\.") "\\(\\." host-expression "\\)*")) 0 'font-lock-variable-name-face)) "Expressions to font-lock for general network utilities.") @@ -371,8 +344,8 @@ This variable is only used if the variable (erase-buffer) (insert header "\n") (set-process-filter - (apply 'start-process name buf program args) - 'net-utils-remove-ctrl-m-filter) + (apply #'start-process name buf program args) + #'net-utils-remove-ctrl-m-filter) (display-buffer buf) buf)) @@ -405,12 +378,12 @@ This variable is only used if the variable `(net-utils-run-simple ,(current-buffer) ,program-name ,args nodisplay)) (set-process-filter - (apply 'start-process program-name - (current-buffer) program-name args) - 'net-utils-remove-ctrl-m-filter) + (apply #'start-process program-name + (current-buffer) program-name args) + #'net-utils-remove-ctrl-m-filter) (unless nodisplay (display-buffer (current-buffer))))) -(defun net-utils--revert-function (&optional ignore-auto noconfirm) +(defun net-utils--revert-function (&optional _ignore-auto _noconfirm) (message "Reverting `%s'..." (buffer-name)) (apply (car net-utils--revert-cmd) (cdr net-utils--revert-cmd)) (let ((proc (get-buffer-process (current-buffer)))) @@ -430,7 +403,7 @@ This variable is only used if the variable ifconfig-program ifconfig-program-options)) -(defalias 'ipconfig 'ifconfig) +(defalias 'ipconfig #'ifconfig) ;;;###autoload (defun iwconfig () @@ -532,7 +505,7 @@ in Lisp code." (net-utils-run-program "Nslookup" (concat "** " - (mapconcat 'identity + (mapconcat #'identity (list "Nslookup" host nslookup-program) " ** ")) nslookup-program @@ -618,7 +591,7 @@ This command uses `nslookup-program' to look up DNS records." (defvar nslookup-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\t" 'completion-at-point) + (define-key map "\t" #'completion-at-point) map)) ;; Using a derived mode gives us keymaps, hooks, etc. @@ -646,9 +619,9 @@ This command uses `dns-lookup-program' for looking up the DNS information." (net-utils-run-program (concat "DNS Lookup [" host "]") (concat "** " - (mapconcat 'identity - (list "DNS Lookup" host dns-lookup-program) - " ** ")) + (mapconcat #'identity + (list "DNS Lookup" host dns-lookup-program) + " ** ")) dns-lookup-program options))) @@ -669,13 +642,14 @@ This command uses `dig-program' for looking up the DNS information." (net-utils-run-program "Dig" (concat "** " - (mapconcat 'identity + (mapconcat #'identity (list "Dig" host dig-program) " ** ")) dig-program options))) (autoload 'comint-exec "comint") +(declare-function comint-watch-for-password-prompt "comint" (string)) ;; This is a lot less than ange-ftp, but much simpler. ;;;###autoload @@ -697,7 +671,7 @@ This command uses `dig-program' for looking up the DNS information." (defvar ftp-mode-map (let ((map (make-sparse-keymap))) ;; Occasionally useful - (define-key map "\t" 'completion-at-point) + (define-key map "\t" #'completion-at-point) map)) (define-derived-mode ftp-mode comint-mode "FTP" @@ -710,9 +684,9 @@ This command uses `dig-program' for looking up the DNS information." ;; password prompts will probably immediately follow the initial ;; connection), but it's better than getting prompted twice for the ;; same password. - (unless (memq 'comint-watch-for-password-prompt + (unless (memq #'comint-watch-for-password-prompt (default-value 'comint-output-filter-functions)) - (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt + (add-hook 'comint-output-filter-functions #'comint-watch-for-password-prompt nil t))) (defun smbclient (host service) @@ -759,9 +733,9 @@ This command uses `smbclient-program' to connect to HOST." ;; password prompts will probably immediately follow the initial ;; connection), but it's better than getting prompted twice for the ;; same password. - (unless (memq 'comint-watch-for-password-prompt + (unless (memq #'comint-watch-for-password-prompt (default-value 'comint-output-filter-functions)) - (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt + (add-hook 'comint-output-filter-functions #'comint-watch-for-password-prompt nil t))) @@ -810,7 +784,7 @@ This list is not complete.") (error "Could not open connection to %s" host)) (erase-buffer) (set-marker (process-mark tcp-connection) (point-min)) - (set-process-filter tcp-connection 'net-utils-remove-ctrl-m-filter) + (set-process-filter tcp-connection #'net-utils-remove-ctrl-m-filter) (and initial-string (process-send-string tcp-connection (concat initial-string "\r\n"))) @@ -825,7 +799,6 @@ This list is not complete.") If a host name passed to `finger' matches one of these regular expressions, it is assumed to be a host that doesn't accept queries of the form USER@HOST, and wants a query containing USER only." - :group 'net-utils :type '(repeat regexp) :version "21.1") @@ -852,7 +825,7 @@ and `network-connection-service-alist', which see." (let* ((user-and-host (concat user "@" host)) (process-name (concat "Finger [" user-and-host "]")) (regexps finger-X.500-host-regexps) - found) + ) ;; found (and regexps (while (not (string-match (car regexps) host)) (setq regexps (cdr regexps))) @@ -866,7 +839,6 @@ and `network-connection-service-alist', which see." (defcustom whois-server-name "rs.internic.net" "Default host name for the whois service." - :group 'net-utils :type 'string) (defcustom whois-server-list @@ -880,7 +852,6 @@ and `network-connection-service-alist', which see." ("whois.nic.gov") ("whois.ripe.net")) "A list of whois servers that can be queried." - :group 'net-utils :type '(repeat (list string))) ;; FIXME: modern whois clients include a much better tld <-> whois server @@ -903,14 +874,12 @@ and `network-connection-service-alist', which see." ("whois.nic.gov" . "gov") ("whois.nic.mil" . "mil")) "Alist to map top level domains to whois servers." - :group 'net-utils :type '(repeat (cons string string))) (defcustom whois-guess-server t "If non-nil then whois will try to deduce the appropriate whois server from the query. If the query doesn't look like a domain or hostname then the server named by `whois-server-name' is used." - :group 'net-utils :type 'boolean) (defun whois-get-tld (host) @@ -951,7 +920,6 @@ The port is deduced from `network-connection-service-alist'." (defcustom whois-reverse-lookup-server "whois.arin.net" "Server which provides inverse DNS mapping." - :group 'net-utils :type 'string) ;;;###autoload diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index b45cefcb442..1983688cef2 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -248,8 +248,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')." (list key cert))))))) ;;;###autoload -(defalias 'open-protocol-stream 'open-network-stream) -(define-obsolete-function-alias 'open-protocol-stream 'open-network-stream +(define-obsolete-function-alias 'open-protocol-stream #'open-network-stream "26.1") (defun network-stream-open-plain (name buffer host service parameters) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 418c1e2e966..c5488650b99 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -163,7 +163,7 @@ These were mostly extracted from the Radio Community Server You may add other entries in `newsticker-url-list'." :type `(set ,@(mapcar #'newsticker--splicer newsticker--raw-url-list-defaults)) - :set 'newsticker--set-customvar-retrieval + :set #'newsticker--set-customvar-retrieval :group 'newsticker-retrieval) (defcustom newsticker-url-list nil @@ -217,7 +217,7 @@ which apply for this feed only, overriding the value of (choice :tag "Wget Arguments" (const :tag "Default arguments" nil) (repeat :tag "Special arguments" string)))) - :set 'newsticker--set-customvar-retrieval + :set #'newsticker--set-customvar-retrieval :group 'newsticker-retrieval) (defcustom newsticker-retrieval-method @@ -260,7 +260,7 @@ make it less than 1800 seconds (30 minutes)!" (const :tag "Daily" 86400) (const :tag "Weekly" 604800) (integer :tag "Interval")) - :set 'newsticker--set-customvar-retrieval + :set #'newsticker--set-customvar-retrieval :group 'newsticker-retrieval) (defcustom newsticker-desc-comp-max @@ -549,7 +549,7 @@ name/timer pair to `newsticker--retrieval-timer-list'." (if (<= interval 0) (setq interval nil)) (setq timer (run-at-time start-time interval - 'newsticker-get-news feed-name)) + #'newsticker-get-news feed-name)) (if interval (add-to-list 'newsticker--retrieval-timer-list (cons feed-name timer)))))) @@ -727,10 +727,10 @@ See `newsticker-get-news'." (error "Another wget-process is running for %s" feed-name)) ;; start wget (let* ((args (append wget-arguments (list url))) - (proc (apply 'start-process feed-name buffername + (proc (apply #'start-process feed-name buffername newsticker-wget-name args))) (set-process-coding-system proc 'no-conversion 'no-conversion) - (set-process-sentinel proc 'newsticker--sentinel) + (set-process-sentinel proc #'newsticker--sentinel) (process-put proc 'nt-feed-name feed-name) (setq newsticker--process-ids (cons (process-id proc) newsticker--process-ids)) @@ -1131,9 +1131,9 @@ Restore an xml-string from a an xml NODE that was returned by xml-parse..." (children (cddr node))) (concat "<" qname (when att-list " ") - (mapconcat 'newsticker--unxml-attribute att-list " ") + (mapconcat #'newsticker--unxml-attribute att-list " ") ">" - (mapconcat 'newsticker--unxml children "") ""))) + (mapconcat #'newsticker--unxml children "") ""))) (defun newsticker--unxml-attribute (attribute) "Actually restore xml-string of an ATTRIBUTE of an xml node." @@ -1580,7 +1580,7 @@ Remove the pre-formatted from `newsticker--cache'." "Forget all cached pre-formatted data. Remove the pre-formatted from `newsticker--cache'." (mapc (lambda (feed) - (mapc 'newsticker--do-forget-preformatted + (mapc #'newsticker--do-forget-preformatted (cdr feed))) newsticker--cache) (when (fboundp 'newsticker--buffer-set-uptodate) @@ -1593,7 +1593,7 @@ This function calls `message' with arguments STRING and ARGS, if (and newsticker-debug ;;(not (active-minibuffer-window)) ;;(not (current-message)) - (apply 'message string args))) + (apply #'message string args))) (defun newsticker--decode-iso8601-date (string) "Return ISO8601-encoded STRING in format like `encode-time'. @@ -1751,10 +1751,10 @@ Save image as FILENAME in DIRECTORY, download it from URL." feed-name)) ;; start wget (let* ((args (append wget-arguments (list url))) - (proc (apply 'start-process proc-name buffername + (proc (apply #'start-process proc-name buffername newsticker-wget-name args))) (set-process-coding-system proc 'no-conversion 'no-conversion) - (set-process-sentinel proc 'newsticker--image-sentinel) + (set-process-sentinel proc #'newsticker--image-sentinel) (process-put proc 'nt-directory directory) (process-put proc 'nt-feed-name feed-name) (process-put proc 'nt-filename filename))))) @@ -2149,7 +2149,7 @@ FEED is a symbol!" "Save cache data for all feeds." (unless (file-directory-p newsticker-dir) (make-directory newsticker-dir t)) - (mapc 'newsticker--cache-save-feed newsticker--cache) + (mapc #'newsticker--cache-save-feed newsticker--cache) nil) (defun newsticker--cache-save-feed (feed) @@ -2223,7 +2223,7 @@ If AGES is nil, the total number of items is returned." (defun newsticker--stat-num-items-total (&optional age) "Return total number of items in all feeds which have the given AGE. If AGE is nil, the total number of items is returned." - (apply '+ + (apply #'+ (mapcar (lambda (feed) (if age (newsticker--stat-num-items (intern (car feed)) age) @@ -2395,7 +2395,7 @@ the item." (make-directory temp-dir t)) (cd temp-dir) (message "Getting image %s" url) - (apply 'start-process "wget-image" + (apply #'start-process "wget-image" " *newsticker-wget-download-images*" newsticker-wget-name (list url)) @@ -2417,7 +2417,7 @@ This function is suited for adding it to `newsticker-new-item-functions'." (make-directory temp-dir t)) (cd temp-dir) (message "Getting enclosure %s" url) - (apply 'start-process "wget-enclosure" + (apply #'start-process "wget-enclosure" " *newsticker-wget-download-enclosures*" newsticker-wget-name (list url)) diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el index 21d47b838f5..705bff666af 100644 --- a/lisp/net/newst-plainview.el +++ b/lisp/net/newst-plainview.el @@ -1,4 +1,4 @@ -;;; newst-plainview.el --- Single buffer frontend for newsticker. +;;; newst-plainview.el --- Single buffer frontend for newsticker. -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. @@ -90,7 +90,7 @@ The following sort methods are available: (const :tag "Keep original order" sort-by-original-order) (const :tag "Sort by time" sort-by-time) (const :tag "Sort by title" sort-by-title)) - :set 'newsticker--set-customvar-sorting + :set #'newsticker--set-customvar-sorting :group 'newsticker-plainview) (defcustom newsticker-heading-format @@ -107,7 +107,7 @@ The following printf-like specifiers can be used: %s The statistical data of the feed. See `newsticker-statistics-format'. %t The title of the feed, i.e. its name." :type 'string - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-plainview) (defcustom newsticker-item-format @@ -122,7 +122,7 @@ The following printf-like specifiers can be used: the title of the feed is used. %t The title of the item." :type 'string - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-plainview) (defcustom newsticker-desc-format @@ -133,7 +133,7 @@ The following printf-like specifiers can be used: %d The date the item was (first) retrieved. See `newsticker-date-format'." :type 'string - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-plainview) (defcustom newsticker-statistics-format @@ -146,7 +146,7 @@ The following printf-like specifiers can be used: %o The number of old items in the feed. %O The number of obsolete items in the feed." :type 'string - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-plainview) @@ -195,7 +195,7 @@ If set to t old items will be completely folded and only new items will show up in the *newsticker* buffer. Otherwise old as well as new items will be visible." :type 'boolean - :set 'newsticker--set-customvar-buffer + :set #'newsticker--set-customvar-buffer :group 'newsticker-plainview) (defcustom newsticker-show-descriptions-of-new-items @@ -204,14 +204,14 @@ well as new items will be visible." If set to t old items will be folded and new items will be unfolded. Otherwise old as well as new items will be folded." :type 'boolean - :set 'newsticker--set-customvar-buffer + :set #'newsticker--set-customvar-buffer :group 'newsticker-plainview) (defcustom newsticker-show-all-news-elements nil "Show all news elements." :type 'boolean - ;;:set 'newsticker--set-customvar + ;;:set #'newsticker--set-customvar :group 'newsticker-plainview) ;; ====================================================================== @@ -386,51 +386,45 @@ images." (defvar newsticker-mode-map (let ((map (make-keymap))) - (define-key map "sO" 'newsticker-show-old-items) - (define-key map "hO" 'newsticker-hide-old-items) - (define-key map "sa" 'newsticker-show-all-desc) - (define-key map "ha" 'newsticker-hide-all-desc) - (define-key map "sf" 'newsticker-show-feed-desc) - (define-key map "hf" 'newsticker-hide-feed-desc) - (define-key map "so" 'newsticker-show-old-item-desc) - (define-key map "ho" 'newsticker-hide-old-item-desc) - (define-key map "sn" 'newsticker-show-new-item-desc) - (define-key map "hn" 'newsticker-hide-new-item-desc) - (define-key map "se" 'newsticker-show-entry) - (define-key map "he" 'newsticker-hide-entry) - (define-key map "sx" 'newsticker-show-extra) - (define-key map "hx" 'newsticker-hide-extra) - - (define-key map [?\S-\ ] 'scroll-down-command) - (define-key map " " 'scroll-up-command) - (define-key map "q" 'newsticker-close-buffer) - (define-key map "p" 'newsticker-previous-item) - (define-key map "P" 'newsticker-previous-new-item) - (define-key map "F" 'newsticker-previous-feed) - (define-key map "\t" 'newsticker-next-item) - (define-key map "n" 'newsticker-next-item) - (define-key map "N" 'newsticker-next-new-item) - (define-key map "f" 'newsticker-next-feed) - (define-key map "M" 'newsticker-mark-all-items-as-read) - (define-key map "m" - 'newsticker-mark-all-items-at-point-as-read-and-redraw) - (define-key map "o" - 'newsticker-mark-item-at-point-as-read) - (define-key map "O" - 'newsticker-mark-all-items-at-point-as-read) - (define-key map "G" 'newsticker-get-all-news) - (define-key map "g" 'newsticker-get-news-at-point) - (define-key map "u" 'newsticker-buffer-update) - (define-key map "U" 'newsticker-buffer-force-update) - (define-key map "a" 'newsticker-add-url) - - (define-key map "i" - 'newsticker-mark-item-at-point-as-immortal) - - (define-key map "xf" - 'newsticker-toggle-auto-narrow-to-feed) - (define-key map "xi" - 'newsticker-toggle-auto-narrow-to-item) + (define-key map "sO" #'newsticker-show-old-items) + (define-key map "hO" #'newsticker-hide-old-items) + (define-key map "sa" #'newsticker-show-all-desc) + (define-key map "ha" #'newsticker-hide-all-desc) + (define-key map "sf" #'newsticker-show-feed-desc) + (define-key map "hf" #'newsticker-hide-feed-desc) + (define-key map "so" #'newsticker-show-old-item-desc) + (define-key map "ho" #'newsticker-hide-old-item-desc) + (define-key map "sn" #'newsticker-show-new-item-desc) + (define-key map "hn" #'newsticker-hide-new-item-desc) + (define-key map "se" #'newsticker-show-entry) + (define-key map "he" #'newsticker-hide-entry) + (define-key map "sx" #'newsticker-show-extra) + (define-key map "hx" #'newsticker-hide-extra) + + (define-key map [?\S-\ ] #'scroll-down-command) + (define-key map " " #'scroll-up-command) + (define-key map "q" #'newsticker-close-buffer) + (define-key map "p" #'newsticker-previous-item) + (define-key map "P" #'newsticker-previous-new-item) + (define-key map "F" #'newsticker-previous-feed) + (define-key map "\t" #'newsticker-next-item) + (define-key map "n" #'newsticker-next-item) + (define-key map "N" #'newsticker-next-new-item) + (define-key map "f" #'newsticker-next-feed) + (define-key map "M" #'newsticker-mark-all-items-as-read) + (define-key map "m" #'newsticker-mark-all-items-at-point-as-read-and-redraw) + (define-key map "o" #'newsticker-mark-item-at-point-as-read) + (define-key map "O" #'newsticker-mark-all-items-at-point-as-read) + (define-key map "G" #'newsticker-get-all-news) + (define-key map "g" #'newsticker-get-news-at-point) + (define-key map "u" #'newsticker-buffer-update) + (define-key map "U" #'newsticker-buffer-force-update) + (define-key map "a" #'newsticker-add-url) + + (define-key map "i" #'newsticker-mark-item-at-point-as-immortal) + + (define-key map "xf" #'newsticker-toggle-auto-narrow-to-feed) + (define-key map "xi" #'newsticker-toggle-auto-narrow-to-item) ;; Bind menu to mouse. (define-key map [down-mouse-3] newsticker-menu) @@ -479,11 +473,11 @@ images." ;; maps for the clickable portions (defvar newsticker--url-keymap (let ((map (make-sparse-keymap))) - (define-key map [mouse-1] 'newsticker-mouse-browse-url) - (define-key map [mouse-2] 'newsticker-mouse-browse-url) - (define-key map "\n" 'newsticker-browse-url) - (define-key map "\C-m" 'newsticker-browse-url) - (define-key map [(control return)] 'newsticker-handle-url) + (define-key map [mouse-1] #'newsticker-mouse-browse-url) + (define-key map [mouse-2] #'newsticker-mouse-browse-url) + (define-key map "\n" #'newsticker-browse-url) + (define-key map "\C-m" #'newsticker-browse-url) + (define-key map [(control return)] #'newsticker-handle-url) map) "Key map for click-able headings in the newsticker buffer.") @@ -980,7 +974,7 @@ not get changed." (let* (pos1 pos2 (inhibit-read-only t) inv-prop org-inv-prop - is-invisible) + ) ;; is-invisible (newsticker--buffer-beginning-of-item) (newsticker--buffer-goto '(desc)) (setq pos1 (max (point-min) (1- (point)))) @@ -1009,7 +1003,7 @@ not get changed." (let* (pos1 pos2 (inhibit-read-only t) inv-prop org-inv-prop - is-invisible) + ) ;; is-invisible (newsticker--buffer-beginning-of-item) (newsticker--buffer-goto '(desc)) (setq pos1 (max (point-min) (1- (point)))) @@ -1147,7 +1141,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on." (setq index-alist (list feed-list))) index-alist))) -(defun newsticker--imenu-goto (name pos &rest args) +(defun newsticker--imenu-goto (_name pos &rest _args) "Go to item NAME at position POS and show item. ARGS are ignored." (goto-char pos) @@ -1236,6 +1230,9 @@ item-retrieval time is added as well." ;; insert the description (newsticker--buffer-do-insert-text item 'desc feed-name-symbol)) +(defvar w3m-fill-column) +(defvar w3-maximum-line-length) + (defun newsticker--buffer-do-insert-text (item type feed-name-symbol) "Actually insert contents of news item, format it, render it and all that. ITEM is a news item, TYPE tells which part of the item shall be inserted, diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el index b188bd4589e..40e304402ad 100644 --- a/lisp/net/newst-reader.el +++ b/lisp/net/newst-reader.el @@ -1,4 +1,4 @@ -;;; newst-reader.el --- Generic RSS reader functions. +;;; newst-reader.el --- Generic RSS reader functions. -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. @@ -94,7 +94,7 @@ done." (const :tag "Right" right) (const :tag "Center" center) (const :tag "Full" full)) - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-reader) (defcustom newsticker-use-full-width @@ -103,7 +103,7 @@ done." If non-nil newsticker sets `fill-column' so that the whole window is used when filling. See also `newsticker-justification'." :type 'boolean - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-reader) (defcustom newsticker-html-renderer @@ -122,7 +122,7 @@ htmlr if this option is set." (const :tag "w3" w3-region) (const :tag "w3m" w3m-region) (const :tag "htmlr" newsticker-htmlr-render)) - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-reader) (defcustom newsticker-date-format @@ -130,7 +130,7 @@ htmlr if this option is set." "Format for the date part in item and feed lines. See `format-time-string' for a list of valid specifiers." :type 'string - :set 'newsticker--set-customvar-formatting + :set #'newsticker--set-customvar-formatting :group 'newsticker-reader) (defgroup newsticker-faces nil diff --git a/lisp/net/newst-ticker.el b/lisp/net/newst-ticker.el index 275c91a36ea..2f764708701 100644 --- a/lisp/net/newst-ticker.el +++ b/lisp/net/newst-ticker.el @@ -1,4 +1,4 @@ -;; newst-ticker.el --- mode line ticker for newsticker. +;; newst-ticker.el --- mode line ticker for newsticker. -*- lexical-binding: t; -*- ;; Copyright (C) 2003-2021 Free Software Foundation, Inc. @@ -83,7 +83,7 @@ smooth display (see `newsticker-scroll-smoothly') a value of 0.3 seems reasonable. For non-smooth display a value of 10 is a good starting point." :type 'number - :set 'newsticker--set-customvar-ticker + :set #'newsticker--set-customvar-ticker :group 'newsticker-ticker) (defcustom newsticker-scroll-smoothly @@ -104,7 +104,7 @@ at all. If you change `newsticker-scroll-smoothly' you should also change If t the echo area will not show immortal items. See also `newsticker-hide-old-items-in-echo-area'." :type 'boolean - :set 'newsticker--set-customvar-ticker + :set #'newsticker--set-customvar-ticker :group 'newsticker-ticker) (defcustom newsticker-hide-old-items-in-echo-area @@ -113,7 +113,7 @@ If t the echo area will not show immortal items. See also If t the echo area will show only new items, i.e. only items which have been added between the last two retrievals." :type 'boolean - :set 'newsticker--set-customvar-ticker + :set #'newsticker--set-customvar-ticker :group 'newsticker-ticker) (defcustom newsticker-hide-obsolete-items-in-echo-area @@ -122,7 +122,7 @@ been added between the last two retrievals." If t the echo area will not show obsolete items. See also `newsticker-hide-old-items-in-echo-area'." :type 'boolean - :set 'newsticker--set-customvar-ticker + :set #'newsticker--set-customvar-ticker :group 'newsticker-ticker) (defun newsticker--display-tick () @@ -205,7 +205,7 @@ running already." (setq newsticker--ticker-timer (run-at-time newsticker-ticker-interval newsticker-ticker-interval - 'newsticker--display-tick)))) + #'newsticker--display-tick)))) (defun newsticker-stop-ticker () "Stop newsticker's ticker (but not the news retrieval)." diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el index 2e207be20f9..d778cc17615 100644 --- a/lisp/net/newst-treeview.el +++ b/lisp/net/newst-treeview.el @@ -52,86 +52,73 @@ (defface newsticker-treeview-face '((((class color) (background dark)) :foreground "white") (((class color) (background light)) :foreground "black")) - "Face for newsticker tree." - :group 'newsticker-treeview) + "Face for newsticker tree.") (defface newsticker-treeview-new-face '((t :inherit newsticker-treeview-face :weight bold)) - "Face for newsticker tree." - :group 'newsticker-treeview) + "Face for newsticker tree.") (defface newsticker-treeview-old-face '((t :inherit newsticker-treeview-face)) - "Face for newsticker tree." - :group 'newsticker-treeview) + "Face for newsticker tree.") (defface newsticker-treeview-immortal-face '((default :inherit newsticker-treeview-face :slant italic) (((class color) (background dark)) :foreground "orange") (((class color) (background light)) :foreground "blue")) - "Face for newsticker tree." - :group 'newsticker-treeview) + "Face for newsticker tree.") (defface newsticker-treeview-obsolete-face '((t :inherit newsticker-treeview-face :strike-through t)) - "Face for newsticker tree." - :group 'newsticker-treeview) + "Face for newsticker tree.") (defface newsticker-treeview-selection-face '((((class color) (background dark)) :background "#4444aa") (((class color) (background light)) :background "#bbbbff")) - "Face for newsticker selection." - :group 'newsticker-treeview) + "Face for newsticker selection.") (defcustom newsticker-treeview-date-format "%d.%m.%y, %H:%M" "Format for the date column in the treeview list buffer. See `format-time-string' for a list of valid specifiers." :version "25.1" - :type 'string - :group 'newsticker-treeview) + :type 'string) (defcustom newsticker-treeview-own-frame nil "Decides whether newsticker treeview creates and uses its own frame." - :type 'boolean - :group 'newsticker-treeview) + :type 'boolean) (defcustom newsticker-treeview-treewindow-width 30 "Width of tree window in treeview layout. See also `newsticker-treeview-listwindow-height'." - :type 'integer - :group 'newsticker-treeview) + :type 'integer) (defcustom newsticker-treeview-listwindow-height 10 "Height of list window in treeview layout. See also `newsticker-treeview-treewindow-width'." - :type 'integer - :group 'newsticker-treeview) + :type 'integer) (defcustom newsticker-treeview-automatically-mark-displayed-items-as-old t "Decides whether to automatically mark displayed items as old. If t an item is marked as old as soon as it is displayed. This applies to newsticker only." - :type 'boolean - :group 'newsticker-treeview) + :type 'boolean) (defcustom newsticker-treeview-use-feed-name-from-url-list-in-treeview t "Use the feed names from 'newsticker-url-list' for display in treeview." :version "28.1" - :type 'boolean - :group 'newsticker-treeview) + :type 'boolean) (defcustom newsticker-treeview-use-feed-name-from-url-list-in-itemview t "Use feed names from 'newsticker-url-list' in itemview." :version "28.1" - :type 'boolean - :group 'newsticker-treeview) + :type 'boolean) (defvar newsticker-groups '("Feeds") @@ -166,14 +153,16 @@ Example: (\"Topmost group\" \"feed1\" (\"subgroup1\" \"feed 2\") (defvar newsticker--treeview-feed-tree nil) (defvar newsticker--treeview-vfeed-tree nil) +(declare-function newsticker-handle-url "newst-plainview" ()) + ;; maps for the clickable portions (defvar newsticker--treeview-url-keymap (let ((map (make-sparse-keymap 'newsticker--treeview-url-keymap))) - (define-key map [mouse-1] 'newsticker-treeview-mouse-browse-url) - (define-key map [mouse-2] 'newsticker-treeview-mouse-browse-url) - (define-key map "\n" 'newsticker-treeview-browse-url) - (define-key map "\C-m" 'newsticker-treeview-browse-url) - (define-key map [(control return)] 'newsticker-handle-url) + (define-key map [mouse-1] #'newsticker-treeview-mouse-browse-url) + (define-key map [mouse-2] #'newsticker-treeview-mouse-browse-url) + (define-key map "\n" #'newsticker-treeview-browse-url) + (define-key map "\C-m" #'newsticker-treeview-browse-url) + (define-key map [(control return)] #'newsticker-handle-url) map) "Key map for click-able headings in the newsticker treeview buffers.") @@ -342,9 +331,9 @@ If string SHOW-FEED is non-nil it is shown in the item string." (replace-match " ")) (let ((map (make-sparse-keymap))) (dolist (key'([mouse-1] [mouse-3])) - (define-key map key 'newsticker-treeview-tree-click)) - (define-key map "\n" 'newsticker-treeview-show-item) - (define-key map "\C-m" 'newsticker-treeview-show-item) + (define-key map key #'newsticker-treeview-tree-click)) + (define-key map "\n" #'newsticker-treeview-show-item) + (define-key map "\C-m" #'newsticker-treeview-show-item) (add-text-properties pos1 (point-max) (list :nt-item item :nt-feed feed @@ -626,9 +615,9 @@ If CLEAR-BUFFER is non-nil the list buffer is completely erased." (defvar newsticker-treeview-list-sort-button-map (let ((map (make-sparse-keymap))) (define-key map [header-line mouse-1] - 'newsticker--treeview-list-sort-by-column) + #'newsticker--treeview-list-sort-by-column) (define-key map [header-line mouse-2] - 'newsticker--treeview-list-sort-by-column) + #'newsticker--treeview-list-sort-by-column) map) "Local keymap for newsticker treeview list window sort buttons.") @@ -960,9 +949,9 @@ arguments NT-ID, FEED, VFEED and TOOLTIP are added as properties." (if (and num-new (> num-new 0)) (setq face 'newsticker-treeview-new-face)) (dolist (key '([mouse-1] [mouse-3])) - (define-key map key 'newsticker-treeview-tree-click)) - (define-key map "\n" 'newsticker-treeview-tree-do-click) - (define-key map "\C-m" 'newsticker-treeview-tree-do-click) + (define-key map key #'newsticker-treeview-tree-click)) + (define-key map "\n" #'newsticker-treeview-tree-do-click) + (define-key map "\C-m" #'newsticker-treeview-tree-do-click) (propertize tag 'face face 'keymap map :nt-id nt-id :nt-feed feed @@ -2029,37 +2018,37 @@ Return t if groups have changed, nil otherwise." (defvar newsticker-treeview-mode-map (let ((map (make-sparse-keymap 'newsticker-treeview-mode-map))) - (define-key map " " 'newsticker-treeview-next-page) - (define-key map "a" 'newsticker-add-url) - (define-key map "b" 'newsticker-treeview-browse-url-item) - (define-key map "c" 'newsticker-treeview-customize-current-feed) - (define-key map "F" 'newsticker-treeview-prev-feed) - (define-key map "f" 'newsticker-treeview-next-feed) - (define-key map "g" 'newsticker-treeview-get-news) - (define-key map "G" 'newsticker-get-all-news) - (define-key map "i" 'newsticker-treeview-toggle-item-immortal) - (define-key map "j" 'newsticker-treeview-jump) - (define-key map "n" 'newsticker-treeview-next-item) - (define-key map "N" 'newsticker-treeview-next-new-or-immortal-item) - (define-key map "O" 'newsticker-treeview-mark-list-items-old) - (define-key map "o" 'newsticker-treeview-mark-item-old) - (define-key map "p" 'newsticker-treeview-prev-item) - (define-key map "P" 'newsticker-treeview-prev-new-or-immortal-item) - (define-key map "q" 'newsticker-treeview-quit) - (define-key map "S" 'newsticker-treeview-save-item) - (define-key map "s" 'newsticker-treeview-save) - (define-key map "u" 'newsticker-treeview-update) - (define-key map "v" 'newsticker-treeview-browse-url) - ;;(define-key map "\n" 'newsticker-treeview-scroll-item) - ;;(define-key map "\C-m" 'newsticker-treeview-scroll-item) - (define-key map "\M-m" 'newsticker-group-move-feed) - (define-key map "\M-a" 'newsticker-group-add-group) - (define-key map "\M-d" 'newsticker-group-delete-group) - (define-key map "\M-r" 'newsticker-group-rename-group) - (define-key map [M-down] 'newsticker-group-shift-feed-down) - (define-key map [M-up] 'newsticker-group-shift-feed-up) - (define-key map [M-S-down] 'newsticker-group-shift-group-down) - (define-key map [M-S-up] 'newsticker-group-shift-group-up) + (define-key map " " #'newsticker-treeview-next-page) + (define-key map "a" #'newsticker-add-url) + (define-key map "b" #'newsticker-treeview-browse-url-item) + (define-key map "c" #'newsticker-treeview-customize-current-feed) + (define-key map "F" #'newsticker-treeview-prev-feed) + (define-key map "f" #'newsticker-treeview-next-feed) + (define-key map "g" #'newsticker-treeview-get-news) + (define-key map "G" #'newsticker-get-all-news) + (define-key map "i" #'newsticker-treeview-toggle-item-immortal) + (define-key map "j" #'newsticker-treeview-jump) + (define-key map "n" #'newsticker-treeview-next-item) + (define-key map "N" #'newsticker-treeview-next-new-or-immortal-item) + (define-key map "O" #'newsticker-treeview-mark-list-items-old) + (define-key map "o" #'newsticker-treeview-mark-item-old) + (define-key map "p" #'newsticker-treeview-prev-item) + (define-key map "P" #'newsticker-treeview-prev-new-or-immortal-item) + (define-key map "q" #'newsticker-treeview-quit) + (define-key map "S" #'newsticker-treeview-save-item) + (define-key map "s" #'newsticker-treeview-save) + (define-key map "u" #'newsticker-treeview-update) + (define-key map "v" #'newsticker-treeview-browse-url) + ;;(define-key map "\n" #'newsticker-treeview-scroll-item) + ;;(define-key map "\C-m" #'newsticker-treeview-scroll-item) + (define-key map "\M-m" #'newsticker-group-move-feed) + (define-key map "\M-a" #'newsticker-group-add-group) + (define-key map "\M-d" #'newsticker-group-delete-group) + (define-key map "\M-r" #'newsticker-group-rename-group) + (define-key map [M-down] #'newsticker-group-shift-feed-down) + (define-key map [M-up] #'newsticker-group-shift-feed-up) + (define-key map [M-S-down] #'newsticker-group-shift-group-down) + (define-key map [M-S-up] #'newsticker-group-shift-group-up) map) "Mode map for newsticker treeview.") diff --git a/lisp/net/puny.el b/lisp/net/puny.el index 1cdefc08f02..42a7e796798 100644 --- a/lisp/net/puny.el +++ b/lisp/net/puny.el @@ -37,7 +37,7 @@ For instance, \"fƛf.org\" => \"xn--ff-2sa.org\"." ;; add a check first to avoid doing unnecessary work. (if (string-match "\\`[[:ascii:]]+\\'" domain) domain - (mapconcat 'puny-encode-string (split-string domain "[.]") "."))) + (mapconcat #'puny-encode-string (split-string domain "[.]") "."))) (defun puny-encode-string (string) "Encode STRING according to the IDNA/punycode algorithm. @@ -57,7 +57,7 @@ For instance, \"bĂŒcher\" => \"xn--bcher-kva\"." (defun puny-decode-domain (domain) "Decode DOMAIN according to the IDNA/punycode algorithm. For instance, \"xn--ff-2sa.org\" => \"fƛf.org\"." - (mapconcat 'puny-decode-string (split-string domain "[.]") ".")) + (mapconcat #'puny-decode-string (split-string domain "[.]") ".")) (defun puny-decode-string (string) "Decode an IDNA/punycode-encoded string. diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el index ab1f43f552b..2574c8cb63e 100644 --- a/lisp/net/quickurl.el +++ b/lisp/net/quickurl.el @@ -1,4 +1,4 @@ -;;; quickurl.el --- insert a URL based on text at point in buffer +;;; quickurl.el --- insert a URL based on text at point in buffer -*- lexical-binding: t; -*- ;; Copyright (C) 1999-2021 Free Software Foundation, Inc. @@ -97,23 +97,19 @@ (locate-user-emacs-file "quickurls" ".quickurls") "File that contains the URL list." :version "24.4" ; added locate-user-emacs-file - :type 'file - :group 'quickurl) + :type 'file) (defcustom quickurl-format-function #'quickurl-format-url "Function to format the URL before insertion into the current buffer." - :type 'function - :group 'quickurl) + :type 'function) (defcustom quickurl-sort-function #'quickurl-sort-urls "Function to sort the URL list." - :type 'function - :group 'quickurl) + :type 'function) (defcustom quickurl-grab-lookup-function #'current-word "Function to grab the thing to lookup." - :type 'function - :group 'quickurl) + :type 'function) (defun quickurl--assoc-function (key alist) "Default function for `quickurl-assoc-function'." @@ -122,31 +118,26 @@ (defcustom quickurl-assoc-function #'quickurl--assoc-function "Function to use for alist lookup into `quickurl-urls'." :version "26.1" ; was the obsolete assoc-ignore-case - :type 'function - :group 'quickurl) + :type 'function) (defcustom quickurl-completion-ignore-case t "Should `quickurl-ask' ignore case when doing the input lookup?" - :type 'boolean - :group 'quickurl) + :type 'boolean) (defcustom quickurl-prefix ";; -*- lisp -*-\n\n" "Text to write to `quickurl-url-file' before writing the URL list." - :type 'string - :group 'quickurl) + :type 'string) (defcustom quickurl-postfix "" "Text to write to `quickurl-url-file' after writing the URL list. See the constant `quickurl-reread-hook-postfix' for some example text that could be used here." - :type 'string - :group 'quickurl) + :type 'string) (defcustom quickurl-list-mode-hook nil "Hooks for `quickurl-list-mode'." - :type 'hook - :group 'quickurl) + :type 'hook) ;; Constants. diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index c80cd49c006..938fadfed74 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -293,7 +293,7 @@ The following replacements are made: Setting this alone will not affect the prompt; use either M-x customize or also call `rcirc-update-prompt'." :type 'string - :set 'rcirc-set-changed + :set #'rcirc-set-changed :initialize 'custom-initialize-default) (defcustom rcirc-keywords nil diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index ad271679618..94db318c1b0 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -643,7 +643,7 @@ starting with a colon. Example: The object labels of the found items are returned as list." (mapcar (lambda (item-path) (secrets-get-item-property item-path "Label")) - (apply 'secrets-search-item-paths collection attributes))) + (apply #'secrets-search-item-paths collection attributes))) (defun secrets-create-item (collection item password &rest attributes) "Create a new item in COLLECTION with label ITEM and password PASSWORD. @@ -780,9 +780,9 @@ ITEM can also be an object path, which is used if contained in COLLECTION." (defvar secrets-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map (make-composed-keymap special-mode-map widget-keymap)) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) - (define-key map "z" 'kill-current-buffer) + (define-key map "n" #'next-line) + (define-key map "p" #'previous-line) + (define-key map "z" #'kill-current-buffer) map) "Keymap used in `secrets-mode' buffers.") @@ -859,7 +859,7 @@ to their attributes." ;; padding is needed to format attribute names. (padding (apply - 'max + #'max (cons (1+ (length "password")) (mapcar diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el index ac1f701fd37..eb78a259a8c 100644 --- a/lisp/net/shr-color.el +++ b/lisp/net/shr-color.el @@ -36,14 +36,12 @@ (defcustom shr-color-visible-luminance-min 40 "Minimum luminance distance between two colors to be considered visible. Must be between 0 and 100." - :group 'shr-color :type 'number) (defcustom shr-color-visible-distance-min 5 "Minimum color distance between two colors to be considered visible. This value is used to compare result for `ciede2000'. It's an absolute value without any unit." - :group 'shr-color :type 'integer) (defconst shr-color-html-colors-alist @@ -332,8 +330,8 @@ color will be adapted to be visible on BG." (if (or (null fg-norm) (null bg-norm)) (list bg fg) - (let* ((fg-lab (apply 'color-srgb-to-lab fg-norm)) - (bg-lab (apply 'color-srgb-to-lab bg-norm)) + (let* ((fg-lab (apply #'color-srgb-to-lab fg-norm)) + (bg-lab (apply #'color-srgb-to-lab bg-norm)) ;; Compute color distance using CIE DE 2000 (fg-bg-distance (color-cie-de2000 fg-lab bg-lab)) ;; Compute luminance distance (subtract L component) @@ -351,12 +349,12 @@ color will be adapted to be visible on BG." (list (if fixed-background bg - (apply 'format "#%02x%02x%02x" + (apply #'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab-to-srgb bg-lab)))) - (apply 'format "#%02x%02x%02x" + (apply #'color-lab-to-srgb bg-lab)))) + (apply #'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab-to-srgb fg-lab)))))))))) + (apply #'color-lab-to-srgb fg-lab)))))))))) (provide 'shr-color) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 0e89999b756..c122a19e90c 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -220,20 +220,20 @@ and other things: (defvar shr-map (let ((map (make-sparse-keymap))) - (define-key map "a" 'shr-show-alt-text) - (define-key map "i" 'shr-browse-image) - (define-key map "z" 'shr-zoom-image) - (define-key map [?\t] 'shr-next-link) - (define-key map [?\M-\t] 'shr-previous-link) + (define-key map "a" #'shr-show-alt-text) + (define-key map "i" #'shr-browse-image) + (define-key map "z" #'shr-zoom-image) + (define-key map [?\t] #'shr-next-link) + (define-key map [?\M-\t] #'shr-previous-link) (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] 'shr-browse-url) - (define-key map [C-down-mouse-1] 'shr-mouse-browse-url-new-window) - (define-key map "I" 'shr-insert-image) - (define-key map "w" 'shr-maybe-probe-and-copy-url) - (define-key map "u" 'shr-maybe-probe-and-copy-url) - (define-key map "v" 'shr-browse-url) - (define-key map "O" 'shr-save-contents) - (define-key map "\r" 'shr-browse-url) + (define-key map [mouse-2] #'shr-browse-url) + (define-key map [C-down-mouse-1] #'shr-mouse-browse-url-new-window) + (define-key map "I" #'shr-insert-image) + (define-key map "w" #'shr-maybe-probe-and-copy-url) + (define-key map "u" #'shr-maybe-probe-and-copy-url) + (define-key map "v" #'shr-browse-url) + (define-key map "O" #'shr-save-contents) + (define-key map "\r" #'shr-browse-url) map)) (defvar shr-image-map diff --git a/lisp/net/sieve-mode.el b/lisp/net/sieve-mode.el index 7bc1d16122d..966f0f056bd 100644 --- a/lisp/net/sieve-mode.el +++ b/lisp/net/sieve-mode.el @@ -139,9 +139,9 @@ (defvar sieve-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\C-c\C-l" 'sieve-upload) - (define-key map "\C-c\C-c" 'sieve-upload-and-kill) - (define-key map "\C-c\C-m" 'sieve-manage) + (define-key map "\C-c\C-l" #'sieve-upload) + (define-key map "\C-c\C-c" #'sieve-upload-and-kill) + (define-key map "\C-c\C-m" #'sieve-manage) map) "Key map used in sieve mode.") diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 3cc5569b55c..821ef4af8e0 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -10,6 +10,7 @@ ;; Package: soap-client ;; Homepage: https://github.com/alex-hhh/emacs-soap-client ;; Package-Requires: ((cl-lib "0.6.1")) +;;FIXME: Put in `Package-Requires:' the Emacs version we expect. ;; This file is part of GNU Emacs. @@ -771,6 +772,8 @@ This is a specialization of `soap-decode-type' for (Array (soap-decode-array node)))))) (defalias 'soap-type-of + ;; FIXME: Once we drop support for Emacs<25, use generic functions + ;; via `cl-defmethod' instead of our own ad-hoc version of it. (if (eq 'soap-xs-basic-type (type-of (make-soap-xs-basic-type))) ;; `type-of' in Emacs ≄ 26 already does what we need. #'type-of @@ -1263,7 +1266,7 @@ See also `soap-wsdl-resolve-references'." (soap-l2wk (xml-node-name node))) (setf (soap-xs-simple-type-base type) - (mapcar 'soap-l2fq + (mapcar #'soap-l2fq (split-string (or (xml-get-attribute-or-nil node 'memberTypes) "")))) @@ -1343,7 +1346,7 @@ See also `soap-wsdl-resolve-references'." (soap-validate-xs-basic-type value base)))) (error (push (cadr error-object) messages)))) (when messages - (error (mapconcat 'identity (nreverse messages) "; and: ")))) + (error (mapconcat #'identity (nreverse messages) "; and: ")))) (cl-labels ((fail-with-message (format value) (push (format format value) messages) (throw 'invalid nil))) @@ -2345,8 +2348,8 @@ See also `soap-resolve-references' and (when (= (length (soap-operation-parameter-order operation)) 0) (setf (soap-operation-parameter-order operation) - (mapcar 'car (soap-message-parts - (cdr (soap-operation-input operation)))))) + (mapcar #'car (soap-message-parts + (cdr (soap-operation-input operation)))))) (setf (soap-operation-parameter-order operation) (mapcar (lambda (p) @@ -2391,13 +2394,13 @@ See also `soap-wsdl-resolve-references'." ;; Install resolvers for our types (progn (put (soap-type-of (make-soap-message)) 'soap-resolve-references - 'soap-resolve-references-for-message) + #'soap-resolve-references-for-message) (put (soap-type-of (make-soap-operation)) 'soap-resolve-references - 'soap-resolve-references-for-operation) + #'soap-resolve-references-for-operation) (put (soap-type-of (make-soap-binding)) 'soap-resolve-references - 'soap-resolve-references-for-binding) + #'soap-resolve-references-for-binding) (put (soap-type-of (make-soap-port)) 'soap-resolve-references - 'soap-resolve-references-for-port)) + #'soap-resolve-references-for-port)) (defun soap-wsdl-resolve-references (wsdl) "Resolve all references inside the WSDL structure. @@ -2511,7 +2514,7 @@ Build on WSDL if it is provided." (soap-wsdl-resolve-references (soap-parse-wsdl xml wsdl)) wsdl)) -(defalias 'soap-load-wsdl-from-url 'soap-load-wsdl) +(defalias 'soap-load-wsdl-from-url #'soap-load-wsdl) (defun soap-parse-wsdl-phase-validate-node (node) "Assert that NODE is valid." @@ -2884,7 +2887,7 @@ decode function to perform the actual decoding." (if (fboundp 'define-error) (define-error 'soap-error "SOAP error") - ;; Support older Emacs versions that do not have define-error, so + ;; Support Emacs<24.4 that do not have define-error, so ;; that soap-client can remain unchanged in GNU ELPA. (put 'soap-error 'error-conditions @@ -3123,8 +3126,7 @@ http://schemas.xmlsoap.org/soap/encoding/\"\n")) (defcustom soap-debug nil "When t, enable some debugging facilities." - :type 'boolean - :group 'soap-client) + :type 'boolean) (defun soap-find-port (wsdl service) "Return the WSDL port having SERVICE name. diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el index 9d4e440719d..6f9ce6a2d69 100644 --- a/lisp/net/soap-inspect.el +++ b/lisp/net/soap-inspect.el @@ -109,7 +109,7 @@ soap-xs-attribute objects." This is a specialization of `soap-sample-value' for `soap-xs-simple-type' objects." (append - (mapcar 'soap-sample-value-for-xs-attribute + (mapcar #'soap-sample-value-for-xs-attribute (soap-xs-type-attributes type)) (cond ((soap-xs-simple-type-enumeration type) @@ -143,7 +143,7 @@ This is a specialization of `soap-sample-value' for This is a specialization of `soap-sample-value' for `soap-xs-complex-type' objects." (append - (mapcar 'soap-sample-value-for-xs-attribute + (mapcar #'soap-sample-value-for-xs-attribute (soap-xs-type-attributes type)) (cl-case (soap-xs-complex-type-indicator type) (array @@ -176,31 +176,31 @@ This is a specialization of `soap-sample-value' for ;; Install soap-sample-value methods for our types (put (soap-type-of (make-soap-xs-basic-type)) 'soap-sample-value - 'soap-sample-value-for-xs-basic-type) + #'soap-sample-value-for-xs-basic-type) (put (soap-type-of (make-soap-xs-element)) 'soap-sample-value - 'soap-sample-value-for-xs-element) + #'soap-sample-value-for-xs-element) (put (soap-type-of (make-soap-xs-attribute)) 'soap-sample-value - 'soap-sample-value-for-xs-attribute) + #'soap-sample-value-for-xs-attribute) (put (soap-type-of (make-soap-xs-attribute)) 'soap-sample-value - 'soap-sample-value-for-xs-attribute-group) + #'soap-sample-value-for-xs-attribute-group) (put (soap-type-of (make-soap-xs-simple-type)) 'soap-sample-value - 'soap-sample-value-for-xs-simple-type) + #'soap-sample-value-for-xs-simple-type) (put (soap-type-of (make-soap-xs-complex-type)) 'soap-sample-value - 'soap-sample-value-for-xs-complex-type) + #'soap-sample-value-for-xs-complex-type) (put (soap-type-of (make-soap-message)) 'soap-sample-value - 'soap-sample-value-for-message)) + #'soap-sample-value-for-message)) @@ -437,7 +437,7 @@ TYPE is a `soap-xs-complex-type'." (funcall (list 'soap-invoke '*WSDL* "SomeService" (soap-element-name operation)))) (let ((sample-invocation - (append funcall (mapcar 'cdr sample-message-value)))) + (append funcall (mapcar #'cdr sample-message-value)))) (pp sample-invocation (current-buffer))))) (defun soap-inspect-port-type (port-type) @@ -460,7 +460,7 @@ TYPE is a `soap-xs-complex-type'." collect o)) op-name-width) - (setq operations (sort operations 'string<)) + (setq operations (sort operations #'string<)) (setq op-name-width (cl-loop for o in operations maximizing (length o))) @@ -504,39 +504,39 @@ TYPE is a `soap-xs-complex-type'." ;; Install the soap-inspect methods for our types (put (soap-type-of (make-soap-xs-basic-type)) 'soap-inspect - 'soap-inspect-xs-basic-type) + #'soap-inspect-xs-basic-type) (put (soap-type-of (make-soap-xs-element)) 'soap-inspect - 'soap-inspect-xs-element) + #'soap-inspect-xs-element) (put (soap-type-of (make-soap-xs-simple-type)) 'soap-inspect - 'soap-inspect-xs-simple-type) + #'soap-inspect-xs-simple-type) (put (soap-type-of (make-soap-xs-complex-type)) 'soap-inspect - 'soap-inspect-xs-complex-type) + #'soap-inspect-xs-complex-type) (put (soap-type-of (make-soap-xs-attribute)) 'soap-inspect - 'soap-inspect-xs-attribute) + #'soap-inspect-xs-attribute) (put (soap-type-of (make-soap-xs-attribute-group)) 'soap-inspect - 'soap-inspect-xs-attribute-group) + #'soap-inspect-xs-attribute-group) (put (soap-type-of (make-soap-message)) 'soap-inspect - 'soap-inspect-message) + #'soap-inspect-message) (put (soap-type-of (make-soap-operation)) 'soap-inspect - 'soap-inspect-operation) + #'soap-inspect-operation) (put (soap-type-of (make-soap-port-type)) 'soap-inspect - 'soap-inspect-port-type) + #'soap-inspect-port-type) (put (soap-type-of (make-soap-binding)) 'soap-inspect - 'soap-inspect-binding) + #'soap-inspect-binding) (put (soap-type-of (make-soap-port)) 'soap-inspect - 'soap-inspect-port) + #'soap-inspect-port) (put (soap-type-of (soap-make-wsdl "origin")) 'soap-inspect - 'soap-inspect-wsdl)) + #'soap-inspect-wsdl)) (provide 'soap-inspect) ;;; soap-inspect.el ends here diff --git a/lisp/net/telnet.el b/lisp/net/telnet.el index 44f535f01c9..bb65ecaa981 100644 --- a/lisp/net/telnet.el +++ b/lisp/net/telnet.el @@ -1,4 +1,4 @@ -;;; telnet.el --- run a telnet session from within an Emacs buffer +;;; telnet.el --- run a telnet session from within an Emacs buffer -*- lexical-binding: t; -*- ;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2021 Free Software ;; Foundation, Inc. @@ -63,11 +63,11 @@ LOGIN-NAME, which is optional, says what to log in as on that machine.") (defvar telnet-new-line "\r") (defvar telnet-mode-map (let ((map (nconc (make-sparse-keymap) comint-mode-map))) - (define-key map "\C-m" 'telnet-send-input) - ;; (define-key map "\C-j" 'telnet-send-input) - (define-key map "\C-c\C-q" 'send-process-next-char) - (define-key map "\C-c\C-c" 'telnet-interrupt-subjob) - (define-key map "\C-c\C-z" 'telnet-c-z) + (define-key map "\C-m" #'telnet-send-input) + ;; (define-key map "\C-j" #'telnet-send-input) + (define-key map "\C-c\C-q" #'send-process-next-char) + (define-key map "\C-c\C-c" #'telnet-interrupt-subjob) + (define-key map "\C-c\C-z" #'telnet-c-z) map)) (defvar telnet-prompt-pattern "^[^#$%>\n]*[#$%>] *") @@ -152,7 +152,7 @@ rejecting one login and prompting again for a username and password.") (t (telnet-check-software-type-initialize string) (telnet-filter proc string) (cond ((> telnet-count telnet-maximum-count) - (set-process-filter proc 'telnet-filter)) + (set-process-filter proc #'telnet-filter)) (t (setq telnet-count (1+ telnet-count))))))))) ;; Identical to comint-simple-send, except that it sends telnet-new-line @@ -227,9 +227,9 @@ Normally input is edited in Emacs and sent a line at a time." (if (and buffer (get-buffer-process buffer)) (switch-to-buffer (concat "*" name "*")) (switch-to-buffer - (apply 'make-comint name telnet-program nil telnet-options)) + (apply #'make-comint name telnet-program nil telnet-options)) (setq process (get-buffer-process (current-buffer))) - (set-process-filter process 'telnet-initial-filter) + (set-process-filter process #'telnet-initial-filter) ;; Don't send the `open' cmd till telnet is ready for it. (accept-process-output process) (erase-buffer) @@ -263,7 +263,7 @@ Normally input is edited in Emacs and sent a line at a time." (require 'shell) (let ((name (concat "rsh-" host ))) (switch-to-buffer (make-comint name remote-shell-program nil host)) - (set-process-filter (get-process name) 'telnet-initial-filter) + (set-process-filter (get-process name) #'telnet-initial-filter) (telnet-mode) (setq-local telnet-connect-command (list 'rsh host)) (setq telnet-count -16))) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 2aacf266f2b..1e48f8dbb8c 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -250,7 +250,7 @@ function returns nil" (host (or (file-remote-p string 'host) "")) item result) (while (setq item (pop tdra)) - (when (string-match-p (or (eval (car item)) "") string) + (when (string-match-p (or (eval (car item) t) "") string) (setq tdra nil result (format-spec diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 27461e6917c..b67de1bd21b 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -70,7 +70,7 @@ It is the default value of `temporary-file-directory'." ;; We must return a local directory. If it is remote, we could run ;; into an infloop. - (eval (car (get 'temporary-file-directory 'standard-value)))) + (eval (car (get 'temporary-file-directory 'standard-value)) t)) (defsubst tramp-compat-make-temp-name () "Generate a local temporary file name (compat function)." diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index 64b5b48e7d4..5adc4ce354a 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -231,7 +231,7 @@ NAME must be equal to `tramp-current-connection'." (delete (info-lookup->mode-cache 'symbol 'tramp-info-lookup-mode) (info-lookup->topic-cache 'symbol))))) - (dolist (mode (mapcar 'car (info-lookup->topic-value 'symbol))) + (dolist (mode (mapcar #'car (info-lookup->topic-value 'symbol))) ;; Add `tramp-info-lookup-mode' to `other-modes' for either ;; `emacs-lisp-mode' itself, or to modes which use ;; `emacs-lisp-mode' as `other-modes'. Reset `info-lookup-cache'. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index dac83b82a82..7f6ecc6c327 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4918,7 +4918,7 @@ If there is just some editing, retry it after 5 seconds." (progn (tramp-message vec 5 "Cannot timeout session, trying it again in %s seconds." 5) - (run-at-time 5 nil 'tramp-timeout-session vec)) + (run-at-time 5 nil #'tramp-timeout-session vec)) (tramp-message vec 3 "Timeout session %s" (tramp-make-tramp-file-name vec 'noloc)) (tramp-cleanup-connection vec 'keep-debug nil 'keep-processes))) @@ -5149,7 +5149,7 @@ connection if a previous connection has died for some reason." (when (tramp-get-connection-property p "session-timeout" nil) (run-at-time (tramp-get-connection-property p "session-timeout" nil) nil - 'tramp-timeout-session vec)) + #'tramp-timeout-session vec)) ;; Make initial shell settings. (tramp-open-connection-setup-interactive-shell p vec) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 47d62f38045..9f65608f3a4 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -386,6 +386,8 @@ Also see `tramp-default-method-alist'." :type 'string) (defcustom tramp-default-method-alist nil + ;; FIXME: This is not an "alist", because its elements are not of + ;; the form (KEY . VAL) but (KEY1 KEY2 VAL). "Default method to use for specific host/user pairs. This is an alist of items (HOST USER METHOD). The first matching item specifies the method to use for a file name which does not specify a @@ -413,6 +415,8 @@ This variable is regarded as obsolete, and will be removed soon." :type '(choice (const nil) string)) (defcustom tramp-default-user-alist nil + ;; FIXME: This is not an "alist", because its elements are not of + ;; the form (KEY . VAL) but (KEY1 KEY2 VAL). "Default user to use for specific method/host pairs. This is an alist of items (METHOD HOST USER). The first matching item specifies the user to use for a file name which does not specify a @@ -432,6 +436,8 @@ Useful for su and sudo methods mostly." :type 'string) (defcustom tramp-default-host-alist nil + ;; FIXME: This is not an "alist", because its elements are not of + ;; the form (KEY . VAL) but (KEY1 KEY2 VAL). "Default host to use for specific method/user pairs. This is an alist of items (METHOD USER HOST). The first matching item specifies the host to use for a file name which does not specify a @@ -447,6 +453,8 @@ empty string for the method name." (choice :tag " Host name" string (const nil))))) (defcustom tramp-default-proxies-alist nil + ;; FIXME: This is not an "alist", because its elements are not of + ;; the form (KEY . VAL) but (KEY1 KEY2 VAL). "Route to be followed for specific host/user pairs. This is an alist of items (HOST USER PROXY). The first matching item specifies the proxy to be passed for a file name located on @@ -1710,6 +1718,10 @@ version, the function does nothing." "Used for highlighting Tramp debug buffers in `outline-mode'.") (defconst tramp-debug-font-lock-keywords + ;; FIXME: Make it a function instead of an ELisp expression, so you + ;; can evaluate it with `funcall' rather than `eval'! + ;; Also, in `font-lock-defaults' you can specify a function name for + ;; the "KEYWORDS" part, so font-lock calls it to get the actual keywords! '(list (concat "^\\(?:" tramp-debug-outline-regexp "\\).+") '(1 font-lock-warning-face t t) @@ -1738,8 +1750,11 @@ The outline level is equal to the verbosity of the Tramp message." (outline-mode)) (setq-local outline-level 'tramp-debug-outline-level) (setq-local font-lock-keywords - `(t (eval ,tramp-debug-font-lock-keywords) - ,(eval tramp-debug-font-lock-keywords))) + ;; FIXME: This `(t FOO . BAR)' representation in + ;; `font-lock-keywords' is supposed to be an + ;; internal implementation "detail". Don't abuse it here! + `(t (eval ,tramp-debug-font-lock-keywords t) + ,(eval tramp-debug-font-lock-keywords t))) ;; Do not edit the debug buffer. (use-local-map special-mode-map)) (current-buffer))) @@ -3691,15 +3706,15 @@ User is always nil." (setq choices tramp-default-proxies-alist) (while choices (setq item (pop choices) - proxy (eval (nth 2 item))) + proxy (eval (nth 2 item) t)) (when (and ;; Host. (string-match-p - (or (eval (nth 0 item)) "") + (or (eval (nth 0 item) t) "") (or (tramp-file-name-host-port (car target-alist)) "")) ;; User. (string-match-p - (or (eval (nth 1 item)) "") + (or (eval (nth 1 item) t) "") (or (tramp-file-name-user-domain (car target-alist)) ""))) (if (null proxy) ;; No more hops needed. diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el index 1fa625c3245..4baa657c0a5 100644 --- a/lisp/net/webjump.el +++ b/lisp/net/webjump.el @@ -252,7 +252,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke (cond ((not expr) "") ((stringp expr) expr) ((vectorp expr) (webjump-builtin expr name)) - ((listp expr) (eval expr)) + ((listp expr) (eval expr t)) ((symbolp expr) (if (fboundp expr) (funcall expr name) -- cgit v1.2.3 From 695f6792f1524a446d276bf5c5e53bbb4c200909 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 13 Mar 2021 14:35:39 +0100 Subject: Remove ;;;###tramp-autoload cookie from Tramp defcustoms (Bug#47063) * lisp/net/tramp-crypt.el (tramp-crypt-enabled-p): New defun. (tramp-crypt-add-directory, tramp-crypt-remove-directory): Add property `completion-predicate'. * lisp/net/tramp-sh.el (tramp-terminal-type, tramp-remote-path) (tramp-remote-process-environment): Remove. Move them to ... * lisp/net/tramp.el: ... here. --- lisp/net/tramp-adb.el | 2 -- lisp/net/tramp-cmds.el | 2 -- lisp/net/tramp-crypt.el | 19 ++++++++++++ lisp/net/tramp-gvfs.el | 1 - lisp/net/tramp-rclone.el | 1 - lisp/net/tramp-sh.el | 77 ------------------------------------------------ lisp/net/tramp-smb.el | 7 ----- lisp/net/tramp-sshfs.el | 1 - lisp/net/tramp.el | 69 +++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 88 insertions(+), 91 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 6ec4d1fed38..aacf83e663f 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -44,7 +44,6 @@ :version "24.4" :type 'string) -;;;###tramp-autoload (defcustom tramp-adb-connect-if-not-connected nil "Try to run `adb connect' if provided device is not connected currently. It is used for TCP/IP devices." @@ -56,7 +55,6 @@ It is used for TCP/IP devices." (defconst tramp-adb-method "adb" "When this method name is used, forward all calls to Android Debug Bridge.") -;;;###tramp-autoload (defcustom tramp-adb-prompt "^[^#$\n\r]*[#$][[:space:]]" "Regexp used as prompt in almquist shell." :type 'regexp diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 1e48f8dbb8c..d208f0e044a 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -208,7 +208,6 @@ This includes password cache, file cache, connection cache, buffers." (dolist (name (tramp-list-remote-buffers)) (when (bufferp (get-buffer name)) (kill-buffer name)))) -;;;###tramp-autoload (defcustom tramp-default-rename-alist nil "Default target for renaming remote buffer file names. This is an alist of cons cells (SOURCE . TARGET). The first @@ -231,7 +230,6 @@ expression which always matches." :type '(repeat (cons (choice :tag "Source regexp" regexp sexp) (choice :tag "Target name" string (const nil))))) -;;;###tramp-autoload (defcustom tramp-confirm-rename-file-names t "Whether renaming a buffer file name must be confirmed." :group 'tramp diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index f8de7085e25..278fb9d8732 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -112,6 +112,14 @@ initializing a new crypted remote directory." "Non-nil when encryption support is available.") (setq tramp-crypt-enabled (executable-find tramp-crypt-encfs-program)) +;; This function takes action since Emacs 28.1, when +;; `read-extended-command-predicate' is set to +;; `command-completion-default-include-p'. +(defun tramp-crypt-enabled-p (_symbol _buffer) + "A predicate for Tramp interactive commands. +They are completed by \"M-x TAB\" only when encryption support is enabled." + tramp-crypt-enabled) + ;;;###tramp-autoload (defconst tramp-crypt-encfs-config ".encfs6.xml" "Encfs configuration file name.") @@ -469,6 +477,7 @@ See `tramp-crypt-do-encrypt-or-decrypt-file'." Files in that directory and all subdirectories will be encrypted before copying to, and decrypted after copying from that directory. File names will be also encrypted." + ;; (declare (completion tramp-crypt-enabled-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled (tramp-user-error nil "Feature is not enabled.")) @@ -481,10 +490,16 @@ directory. File names will be also encrypted." (setq tramp-crypt-directories (cons name tramp-crypt-directories))) (tramp-register-file-name-handlers)) +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +;;;###tramp-autoload +(function-put + #'tramp-crypt-add-directory 'completion-predicate #'tramp-crypt-enabled-p) + (defun tramp-crypt-remove-directory (name) "Unmark remote directory NAME for encryption. Existing files in that directory and its subdirectories will be kept in their encrypted form." + ;; (declare (completion tramp-crypt-enabled-p)) (interactive "DRemote directory name: ") (unless tramp-crypt-enabled (tramp-user-error nil "Feature is not enabled.")) @@ -498,6 +513,10 @@ kept in their encrypted form." (setq tramp-crypt-directories (delete name tramp-crypt-directories)) (tramp-register-file-name-handlers))) +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +(function-put + #'tramp-crypt-remove-directory 'completion-predicate #'tramp-crypt-enabled-p) + ;; `auth-source' requires a user. (defun tramp-crypt-dissect-file-name (name) "Return a `tramp-file-name' structure for NAME. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 9d4e04ca689..c4ec1121da2 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -175,7 +175,6 @@ They are checked during start up via (dbus-list-known-names :session)) (setq tramp-media-methods (delete method tramp-media-methods))))) -;;;###tramp-autoload (defcustom tramp-gvfs-zeroconf-domain "local" "Zeroconf domain to be used for discovering services, like host names." :group 'tramp diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index e6f9fe56ec0..3b6de3e0b70 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -42,7 +42,6 @@ (defconst tramp-rclone-method "rclone" "When this method name is used, forward all calls to rclone mounts.") -;;;###tramp-autoload (defcustom tramp-rclone-program "rclone" "Name of the rclone program." :group 'tramp diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 14abf55e55d..7182cd6b1d9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -46,7 +46,6 @@ (defconst tramp-default-remote-shell "/bin/sh" "The default remote shell Tramp applies.") -;;;###tramp-autoload (defcustom tramp-inline-compress-start-size 4096 "The minimum size of compressing where inline transfer. When inline transfer, compress transferred data of file whose @@ -56,23 +55,12 @@ If it is nil, no compression at all will be applied." :group 'tramp :type '(choice (const nil) integer)) -;;;###tramp-autoload (defcustom tramp-copy-size-limit 10240 "Maximum file size where inline copying is preferred to an out-of-the-band copy. If it is nil, out-of-the-band copy will be used without a check." :group 'tramp :type '(choice (const nil) integer)) -;;;###tramp-autoload -(defcustom tramp-terminal-type "dumb" - "Value of TERM environment variable for logging in to remote host. -Because Tramp wants to parse the output of the remote shell, it is easily -confused by ANSI color escape sequences and suchlike. Often, shell init -files conditionalize this setup based on the TERM environment variable." - :group 'tramp - :type 'string) - -;;;###tramp-autoload (defcustom tramp-histfile-override "~/.tramp_history" "When invoking a shell, override the HISTFILE with this value. When setting to a string, it redirects the shell history to that @@ -115,7 +103,6 @@ detected as prompt when being sent on echoing hosts, therefore.") (defconst tramp-end-of-heredoc (md5 tramp-end-of-output) "String used to recognize end of heredoc strings.") -;;;###tramp-autoload (defcustom tramp-use-ssh-controlmaster-options t "Whether to use `tramp-ssh-controlmaster-options'. Set it to nil, if you use Control* or Proxy* options in your ssh @@ -477,70 +464,6 @@ The string is used in `tramp-methods'.") (tramp-set-completion-function "psftp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh)) -;; "getconf PATH" yields: -;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin -;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin -;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin -;; FreeBSD, DragonFly: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! -;; FreeBSD 12.1, Darwin: /usr/bin:/bin:/usr/sbin:/sbin -;; IRIX64: /usr/bin -;; QNAP QTS: --- -;; Hydra: /run/current-system/sw/bin:/bin:/usr/bin -;;;###tramp-autoload -(defcustom tramp-remote-path - '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" - "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" - "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" - "/opt/bin" "/opt/sbin" "/opt/local/bin") - "List of directories to search for executables on remote host. -For every remote host, this variable will be set buffer local, -keeping the list of existing directories on that host. - -You can use \"~\" in this list, but when searching for a shell which groks -tilde expansion, all directory names starting with \"~\" will be ignored. - -`Default Directories' represent the list of directories given by -the command \"getconf PATH\". It is recommended to use this -entry on head of this list, because these are the default -directories for POSIX compatible commands. On remote hosts which -do not offer the getconf command (like cygwin), the value -\"/bin:/usr/bin\" is used instead. This entry is represented in -the list by the special value `tramp-default-remote-path'. - -`Private Directories' are the settings of the $PATH environment, -as given in your `~/.profile'. This entry is represented in -the list by the special value `tramp-own-remote-path'." - :group 'tramp - :type '(repeat (choice - (const :tag "Default Directories" tramp-default-remote-path) - (const :tag "Private Directories" tramp-own-remote-path) - (string :tag "Directory")))) - -;;;###tramp-autoload -(defcustom tramp-remote-process-environment - '("ENV=''" "TMOUT=0" "LC_CTYPE=''" - "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" - "autocorrect=" "correct=") - "List of environment variables to be set on the remote host. - -Each element should be a string of the form ENVVARNAME=VALUE. An -entry ENVVARNAME= disables the corresponding environment variable, -which might have been set in the init files like ~/.profile. - -Special handling is applied to some environment variables, -which should not be set here: - -The PATH environment variable should be set via `tramp-remote-path'. - -The TERM environment variable should be set via `tramp-terminal-type'. - -The INSIDE_EMACS environment variable will automatically be set -based on the Tramp and Emacs versions, and should not be set here." - :group 'tramp - :version "26.1" - :type '(repeat string)) - -;;;###tramp-autoload (defcustom tramp-sh-extra-args '(("/bash\\'" . "-noediting -norc -noprofile") ("/zsh\\'" . "-f +Z -V")) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 69359553e44..6fbf08801e8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -60,20 +60,17 @@ tramp-smb-method '((tramp-parse-netrc "~/.netrc")))) -;;;###tramp-autoload (defcustom tramp-smb-program "smbclient" "Name of SMB client to run." :group 'tramp :type 'string) -;;;###tramp-autoload (defcustom tramp-smb-acl-program "smbcacls" "Name of SMB acls to run." :group 'tramp :type 'string :version "24.4") -;;;###tramp-autoload (defcustom tramp-smb-conf null-device "Path of the \"smb.conf\" file. If it is nil, no \"smb.conf\" will be added to the `tramp-smb-program' @@ -81,7 +78,6 @@ call, letting the SMB client use the default one." :group 'tramp :type '(choice (const nil) (file :must-match t))) -;;;###tramp-autoload (defcustom tramp-smb-options nil "List of additional options. They are added to the `tramp-smb-program' call via \"--option '...'\". @@ -305,7 +301,6 @@ See `tramp-actions-before-shell' for more info.") Operations not mentioned here will be handled by the default Emacs primitives.") ;; Options for remote processes via winexe. -;;;###tramp-autoload (defcustom tramp-smb-winexe-program "winexe" "Name of winexe client to run. If it isn't found in the local $PATH, the absolute path of winexe @@ -314,7 +309,6 @@ shall be given. This is needed for remote processes." :type 'string :version "24.3") -;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command "powershell.exe" "Shell to be used for processes on remote machines. This must be Powershell V2 compatible." @@ -322,7 +316,6 @@ This must be Powershell V2 compatible." :type 'string :version "24.3") -;;;###tramp-autoload (defcustom tramp-smb-winexe-shell-command-switch "-file -" "Command switch used together with `tramp-smb-winexe-shell-command'. This can be used to disable echo etc." diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 2a00d5ce678..c4a36fe2a3a 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -40,7 +40,6 @@ (defconst tramp-sshfs-method "sshfs" "Tramp method for sshfs mounts.") -;;;###tramp-autoload (defcustom tramp-sshfs-program "sshfs" "The sshfs mount command." :group 'tramp diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index da779d3386f..8141f026f74 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -660,6 +660,14 @@ The regexp should match at end of buffer. See also `tramp-yesno-prompt-regexp'." :type 'regexp) +(defcustom tramp-terminal-type "dumb" + "Value of TERM environment variable for logging in to remote host. +Because Tramp wants to parse the output of the remote shell, it is easily +confused by ANSI color escape sequences and suchlike. Often, shell init +files conditionalize this setup based on the TERM environment variable." + :group 'tramp + :type 'string) + (defcustom tramp-terminal-prompt-regexp (concat "\\(" "TERM = (.*)" @@ -1243,6 +1251,67 @@ let-bind this variable." :version "24.4" :type '(choice (const nil) integer)) +;; "getconf PATH" yields: +;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin +;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin +;; GNU/Linux (Debian, Suse, RHEL): /bin:/usr/bin +;; FreeBSD, DragonFly: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! +;; FreeBSD 12.1, Darwin: /usr/bin:/bin:/usr/sbin:/sbin +;; IRIX64: /usr/bin +;; QNAP QTS: --- +;; Hydra: /run/current-system/sw/bin:/bin:/usr/bin +(defcustom tramp-remote-path + '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" + "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" + "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" + "/opt/bin" "/opt/sbin" "/opt/local/bin") + "List of directories to search for executables on remote host. +For every remote host, this variable will be set buffer local, +keeping the list of existing directories on that host. + +You can use \"~\" in this list, but when searching for a shell which groks +tilde expansion, all directory names starting with \"~\" will be ignored. + +`Default Directories' represent the list of directories given by +the command \"getconf PATH\". It is recommended to use this +entry on head of this list, because these are the default +directories for POSIX compatible commands. On remote hosts which +do not offer the getconf command (like cygwin), the value +\"/bin:/usr/bin\" is used instead. This entry is represented in +the list by the special value `tramp-default-remote-path'. + +`Private Directories' are the settings of the $PATH environment, +as given in your `~/.profile'. This entry is represented in +the list by the special value `tramp-own-remote-path'." + :group 'tramp + :type '(repeat (choice + (const :tag "Default Directories" tramp-default-remote-path) + (const :tag "Private Directories" tramp-own-remote-path) + (string :tag "Directory")))) + +(defcustom tramp-remote-process-environment + '("ENV=''" "TMOUT=0" "LC_CTYPE=''" + "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" + "autocorrect=" "correct=") + "List of environment variables to be set on the remote host. + +Each element should be a string of the form ENVVARNAME=VALUE. An +entry ENVVARNAME= disables the corresponding environment variable, +which might have been set in the init files like ~/.profile. + +Special handling is applied to some environment variables, +which should not be set here: + +The PATH environment variable should be set via `tramp-remote-path'. + +The TERM environment variable should be set via `tramp-terminal-type'. + +The INSIDE_EMACS environment variable will automatically be set +based on the Tramp and Emacs versions, and should not be set here." + :group 'tramp + :version "26.1" + :type '(repeat string)) + (defcustom tramp-completion-reread-directory-timeout 10 "Defines seconds since last remote command before rereading a directory. A remote directory might have changed its contents. In order to -- cgit v1.2.3 From 518312346d9440d18e224231cb645cb3aaf373ba Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 19 Apr 2021 11:52:48 +0200 Subject: Add Tramp recompilation * doc/misc/tramp.texi (Frequently Asked Questions): Refer to GNU ELPA Tramp README. * lisp/net/tramp-cmds.el (tramp-recompile-elpa-command-completion-p) (tramp-recompile-elpa): New defuns. Add property `completion-predicate'. --- doc/misc/tramp.texi | 24 +++++------------------- lisp/net/tramp-cmds.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 40245acb8e5..e0f648fbd97 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -5095,34 +5095,20 @@ two forms in your @file{~/.emacs} after loading the @code{tramp} and @item I get a warning @samp{Tramp has been compiled with Emacs a.b, this is Emacs c.d} +@item +I get an error @samp{tramp-file-name-handler: Invalid function: +tramp-compat-with-mutex} @value{tramp} comes with compatibility code for different Emacs versions. When you see this warning, you don't use the Emacs built-in version of @value{tramp}. In case you have installed @value{tramp} -from GNU ELPA, you must delete and reinstall it. +from GNU ELPA, see the package README file for instructions how to +recompile it. @ifset installchapter In case you have installed it from its Git repository, @ref{Recompilation}. @end ifset -@item -I get an error @samp{tramp-file-name-handler: Invalid function: -tramp-compat-with-mutex} - -Likely, you have a running Emacs session with loaded @value{tramp}, -and you try to upgrade it to another version from GNU ELPA. Since -@value{tramp} is not forward compatible, you must unload / reload it. -Try the following steps: - -@example -@kbd{M-x tramp-unload-tramp @key{RET}} -@kbd{M-x load-library @key{RET} tramp @key{RET}} -@end example - -If this doesn't work, you must restart Emacs with proper -@code{load-path} for the new @value{tramp} version. - - @item I get an error @samp{Remote file error: Forbidden reentrant call of Tramp} diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index d208f0e044a..6342cf52873 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -472,6 +472,48 @@ For details, see `tramp-rename-files'." (function-put #'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p) +;; This function takes action since Emacs 28.1, when +;; `read-extended-command-predicate' is set to +;; `command-completion-default-include-p'. +;;;###tramp-autoload +(defun tramp-recompile-elpa-command-completion-p (_symbol _buffer) + "A predicate for `tramp-recompile-elpa'. +It is completed by \"M-x TAB\" only if package.el is loaded, and +Tramp is an installed ELPA package." + ;; We cannot apply `package-installed-p', this would also return the + ;; builtin package. + (tramp-compat-funcall 'package--user-installed-p 'tramp)) + +;;;###tramp-autoload +(defun tramp-recompile-elpa () + "Recompile the installed Tramp ELPA package. +This is needed if there are compatibility problems." + ;; (declare (completion tramp-recompile-elpa-command-completion-p)) + (interactive) + ;; We expect just one Tramp package is installed. + (when-let + ((dir (tramp-compat-funcall + 'package-desc-dir + (car (alist-get 'tramp (bound-and-true-p package-alist)))))) + (dolist (elc (directory-files dir 'full "\\.elc$")) + (delete-file elc)) + (with-current-buffer (get-buffer-create byte-compile-log-buffer) + (let ((inhibit-read-only t)) + (compilation-mode) + (goto-char (point-max)) + (insert "\f\n") + (call-process + (expand-file-name invocation-name invocation-directory) nil t t + "-Q" "-batch" "-L" dir + "--eval" (format "(byte-recompile-directory %S 0 t)" dir)) + (message "Package `tramp' recompiled."))))) + +;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form. +;;;###tramp-autoload +(function-put + #'tramp-recompile-elpa 'completion-predicate + #'tramp-recompile-elpa-command-completion-p) + ;; Tramp version is useful in a number of situations. ;;;###tramp-autoload -- cgit v1.2.3 From 5d287b4605d11dfbe56f77c719942198a807ba58 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 23 Apr 2021 19:57:50 +0200 Subject: * lisp/net/tramp-cmds.el (tramp-recompile-elpa-command-completion-p): Check, whether Tramp has a package description. --- lisp/net/tramp-cmds.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 6342cf52873..a3cf6f3211a 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -482,7 +482,8 @@ It is completed by \"M-x TAB\" only if package.el is loaded, and Tramp is an installed ELPA package." ;; We cannot apply `package-installed-p', this would also return the ;; builtin package. - (tramp-compat-funcall 'package--user-installed-p 'tramp)) + (and (assq 'tramp (bound-and-true-p package-alist)) + (tramp-compat-funcall 'package--user-installed-p 'tramp))) ;;;###tramp-autoload (defun tramp-recompile-elpa () -- cgit v1.2.3 From 12bab2092045876a8193402c9f69af196ea22969 Mon Sep 17 00:00:00 2001 From: Mattias EngdegĂ„rd Date: Thu, 6 May 2021 15:50:39 +0200 Subject: Tidy file-matching regexps and remove some ineffective backslashes * lisp/emacs-lisp/package.el (package--delete-directory): * lisp/net/tramp-cmds.el (tramp-recompile-elpa): Escape dot; replace $ with \'. * lisp/help.el (help-for-help): * lisp/transient.el (transient-font-lock-keywords): Remove useless backslashes. --- lisp/emacs-lisp/package.el | 2 +- lisp/help.el | 2 +- lisp/net/tramp-cmds.el | 2 +- lisp/transient.el | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e1339177519..b68ebfbd887 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2267,7 +2267,7 @@ Clean-up the corresponding .eln files if Emacs is native compiled." (when (featurep 'native-compile) (cl-loop - for file in (directory-files-recursively dir ".el\\'") + for file in (directory-files-recursively dir "\\.el\\'") do (comp-clean-up-stale-eln (comp-el-to-eln-filename file)))) (delete-directory dir t)) diff --git a/lisp/help.el b/lisp/help.el index e70041aea4b..babaf4adc75 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -233,7 +233,7 @@ Do not call this in the scope of `with-help-window'." (make-help-screen help-for-help (purecopy "Type a help option: [abcCdefFgiIkKlLmnprstvw.] C-[cdefmnoptw] or ?") (concat - "\(Type " + "(Type " (help--key-description-fontified (kbd "")) " or " (help--key-description-fontified (kbd "")) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index a3cf6f3211a..1572c2f3e3c 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -496,7 +496,7 @@ This is needed if there are compatibility problems." ((dir (tramp-compat-funcall 'package-desc-dir (car (alist-get 'tramp (bound-and-true-p package-alist)))))) - (dolist (elc (directory-files dir 'full "\\.elc$")) + (dolist (elc (directory-files dir 'full "\\.elc\\'")) (delete-file elc)) (with-current-buffer (get-buffer-create byte-compile-log-buffer) (let ((inhibit-read-only t)) diff --git a/lisp/transient.el b/lisp/transient.el index 6e7b5ea876a..2ce7b7c30e1 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -3569,7 +3569,7 @@ we stop there." "transient-define-argument" "transient-define-suffix") t) - "\\_>[ \t'\(]*" + "\\_>[ \t'(]*" "\\(\\(?:\\sw\\|\\s_\\)+\\)?") (1 'font-lock-keyword-face) (2 'font-lock-function-name-face nil t))))) -- cgit v1.2.3 From c9773379c1a598493aafcf18e4b2f2ebe579937b Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 13 May 2021 16:46:17 +0200 Subject: Improve Tramp traces * lisp/net/tramp-cmds.el (tramp-list-tramp-buffers): List also trace buffers. * lisp/net/tramp.el (tramp-buffer-name): Add `tramp-suppress-trace' property. (tramp-get-debug-file-name): Fix docstring. (tramp-trace-buffer-name): New defun. (tramp-trace-functions): New defvar. (tramp-debug-message): Obey also `tramp-trace-functions'. * test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case): Handle trace buffer accordingly. --- lisp/net/tramp-cmds.el | 4 +++- lisp/net/tramp.el | 24 +++++++++++++++++++----- test/lisp/net/tramp-tests.el | 16 ++++++++-------- 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 1572c2f3e3c..d30d22021a5 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -57,7 +57,9 @@ SYNTAX can be one of the symbols `default' (default), (all-completions "*tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))) (all-completions - "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))))) + "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))) + (all-completions + "*trace tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list)))))) (defun tramp-list-remote-buffers () "Return a list of all buffers with remote `default-directory'." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9fec1514221..62df2890cb1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1665,6 +1665,8 @@ See `tramp-dissect-file-name' for details." (format "*tramp/%s %s@%s*" method user-domain host-port) (format "*tramp/%s %s*" method host-port)))) +(put #'tramp-buffer-name 'tramp-suppress-trace t) + (defun tramp-make-tramp-file-name (&rest args) "Construct a Tramp file name from ARGS. @@ -1889,13 +1891,22 @@ The outline level is equal to the verbosity of the Tramp message." (put #'tramp-get-debug-buffer 'tramp-suppress-trace t) (defun tramp-get-debug-file-name (vec) - "Get the debug buffer for VEC." + "Get the debug file name for VEC." (expand-file-name (tramp-compat-string-replace "/" " " (tramp-debug-buffer-name vec)) (tramp-compat-temporary-file-directory))) (put #'tramp-get-debug-file-name 'tramp-suppress-trace t) +(defun tramp-trace-buffer-name (vec) + "A name for the trace buffer for VEC." + (tramp-compat-string-replace "debug" "trace" (tramp-debug-buffer-name vec))) + +(put #'tramp-trace-buffer-name 'tramp-suppress-trace t) + +(defvar tramp-trace-functions nil + "A list of non-Tramp functions to be trace with tramp-verbose > 10.") + (defun tramp-debug-message (vec fmt-string &rest arguments) "Append message to debug buffer of VEC. Message is formatted with FMT-STRING as control string and the remaining @@ -1922,10 +1933,13 @@ ARGUMENTS to actually emit the message (if applicable)." (or tramp-repository-version ""))))) ;; Traces. (when (>= tramp-verbose 11) - (dolist (elt (all-completions "tramp-" obarray 'functionp)) - (let ((fn (intern elt))) - (unless (get fn 'tramp-suppress-trace) - (trace-function-background fn))))) + (dolist + (elt + (append + (mapcar #'intern (all-completions "tramp-" obarray 'functionp)) + tramp-trace-functions)) + (unless (get elt 'tramp-suppress-trace) + (trace-function-background elt)))) ;; Delete debug file. (when (and tramp-debug-to-file (tramp-get-debug-file-name vec)) (ignore-errors (delete-file (tramp-get-debug-file-name vec))))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 52480bac7ec..a045b9c62f7 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -179,6 +179,11 @@ The temporary file is not created." "Whether `tramp--test-instrument-test-case' run. This shall used dynamically bound only.") +;; When `tramp-verbose' is greater than 10, and you want to trace +;; other functions as well, do something like +;; (let ((tramp-trace-functions '(file-name-non-special))) +;; (tramp--test-instrument-test-case 11 +;; ...)) (defmacro tramp--test-instrument-test-case (verbose &rest body) "Run BODY with `tramp-verbose' equal VERBOSE. Print the content of the Tramp connection and debug buffers, if @@ -187,8 +192,7 @@ is greater than 10. `should-error' is not handled properly. BODY shall not contain a timeout." (declare (indent 1) (debug (natnump body))) `(let* ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0))) - (trace-buffer - (when (> tramp-verbose 10) (generate-new-buffer " *temp*"))) + (trace-buffer (tramp-trace-buffer-name tramp-test-vec)) (debug-ignored-errors (append '("^make-symbolic-link not supported$" @@ -198,13 +202,9 @@ is greater than 10. (unwind-protect (let ((tramp--test-instrument-test-case-p t)) ,@body) ;; Unwind forms. - (when trace-buffer - (untrace-all)) (when (and (null tramp--test-instrument-test-case-p) (> tramp-verbose 3)) - (dolist - (buf (append - (tramp-list-tramp-buffers) - (and trace-buffer (list (get-buffer trace-buffer))))) + (untrace-all) + (dolist (buf (tramp-list-tramp-buffers)) (with-current-buffer buf (message ";; %s\n%s" buf (buffer-string))) (kill-buffer buf)))))) -- cgit v1.2.3 From 244acc5a057b0d6ff03754af14d71808b6f20233 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 11 Aug 2021 15:34:43 +0200 Subject: Replace some `string-match-p' calls in Tramp * lisp/net/tramp.el (tramp-debug-message, tramp-set-completion-function) (tramp-get-completion-methods, tramp-get-completion-user-host): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process) (tramp-open-connection-setup-interactive-shell) (tramp-convert-file-attributes): Use `string-prefix-p'. * lisp/net/tramp.el (tramp-dissect-file-name) (tramp-progress-reporter-update, tramp-handle-insert-directory): * lisp/net/tramp-cache.el (tramp-get-hash-table) (tramp-flush-directory-properties): * lisp/net/tramp-cmds.el (tramp-append-tramp-buffers): * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory) (tramp-call-local-coding-command, tramp-get-inline-coding): * lisp/net/tramp-smb.el (tramp-smb-handle-file-attributes) (tramp-smb-handle-file-name-all-completions) (tramp-smb-handle-file-writable-p) (tramp-smb-handle-insert-directory) (tramp-smb-handle-start-file-process, ) (tramp-smb-read-file-entry): Use `tramp-compat-string-search'. --- lisp/net/tramp-adb.el | 2 +- lisp/net/tramp-cache.el | 6 +++--- lisp/net/tramp-cmds.el | 2 +- lisp/net/tramp-sh.el | 37 +++++++++++++++++++------------------ lisp/net/tramp-smb.el | 26 +++++++++++++------------- lisp/net/tramp.el | 25 ++++++++++--------------- 6 files changed, 47 insertions(+), 51 deletions(-) (limited to 'lisp/net/tramp-cmds.el') diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 5e0accc142a..2f84312f077 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1065,7 +1065,7 @@ implementation will be used." p)))) ;; Save exit. - (if (string-match-p tramp-temp-buffer-name (buffer-name)) + (if (string-prefix-p tramp-temp-buffer-name (buffer-name)) (ignore-errors (set-process-buffer (tramp-get-connection-process v) nil) (kill-buffer (current-buffer))) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index fcfad012ec8..5a00915f4f0 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -125,7 +125,7 @@ If KEY is `tramp-cache-undefined', don't create anything, and return nil." (puthash key (make-hash-table :test #'equal) tramp-cache-data))) (when (tramp-file-name-p key) (dolist (elt tramp-connection-properties) - (when (string-match-p + (when (tramp-compat-string-search (or (nth 0 elt) "") (tramp-make-tramp-file-name key 'noloc 'nohop)) (tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))) @@ -268,8 +268,8 @@ Remove also properties of all files in subdirectories." (dolist (key (hash-table-keys tramp-cache-data)) (when (and (tramp-file-name-p key) (stringp (tramp-file-name-localname key)) - (string-match-p (regexp-quote directory) - (tramp-file-name-localname key))) + (tramp-compat-string-search + directory (tramp-file-name-localname key))) (remhash key tramp-cache-data))) ;; Remove file properties of symlinks. (when (and (stringp truename) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index d30d22021a5..6278fd302af 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -672,7 +672,7 @@ buffer in your bug report. (insert "\nload-path shadows:\n==================\n") (ignore-errors (mapc - (lambda (x) (when (string-match-p "tramp" x) (insert x "\n"))) + (lambda (x) (when (tramp-compat-string-search "tramp" x) (insert x "\n"))) (split-string (list-load-path-shadows t) "\n"))) ;; Append buffers only when we are in message mode. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c3b8df9e579..fad07d87c51 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2603,8 +2603,8 @@ The method used must be an out-of-band method." (save-restriction (narrow-to-region beg-marker end-marker) ;; Some busyboxes are reluctant to discard colors. - (unless - (string-match-p "color" (tramp-get-connection-property v "ls" "")) + (unless (tramp-compat-string-search + "color" (tramp-get-connection-property v "ls" "")) (goto-char (point-min)) (while (re-search-forward tramp-display-escape-sequence-regexp nil t) (replace-match ""))) @@ -2958,7 +2958,7 @@ implementation will be used." p))) ;; Save exit. - (if (string-match-p tramp-temp-buffer-name (buffer-name)) + (if (string-prefix-p tramp-temp-buffer-name (buffer-name)) (ignore-errors (set-process-buffer p nil) (kill-buffer (current-buffer))) @@ -4309,7 +4309,7 @@ process to set up. VEC specifies the connection." ;; Use MULE to select the right EOL convention for communicating ;; with the process. (let ((cs (or (and (memq 'utf-8-hfs (coding-system-list)) - (string-match-p "^Darwin" uname) + (string-prefix-p "Darwin" uname) (cons 'utf-8-hfs 'utf-8-hfs)) (and (memq 'utf-8 (coding-system-list)) (string-match-p "utf-?8" (tramp-get-remote-locale vec)) @@ -4322,7 +4322,7 @@ process to set up. VEC specifies the connection." cs-encode (or (cdr cs) 'undecided) cs-encode (coding-system-change-eol-conversion - cs-encode (if (string-match-p "^Darwin" uname) 'mac 'unix))) + cs-encode (if (string-prefix-p "Darwin" uname) 'mac 'unix))) (tramp-send-command vec "(echo foo ; echo bar)" t) (goto-char (point-min)) (when (search-forward "\r" nil t) @@ -4372,7 +4372,7 @@ process to set up. VEC specifies the connection." ;; IRIX64 bash expands "!" even when in single quotes. This ;; destroys our shell functions, we must disable it. See ;; . - (when (string-match-p "^IRIX64" uname) + (when (string-prefix-p "IRIX64" uname) (tramp-send-command vec "set +H" t)) ;; Disable tab expansion. @@ -4628,12 +4628,12 @@ means standard output and thus the current buffer), or nil (which means discard it)." (tramp-call-process nil tramp-encoding-shell - (when (and input (not (string-match-p "%s" cmd))) input) + (when (and input (not (tramp-compat-string-search "%s" cmd))) input) (if (eq output t) t nil) nil tramp-encoding-command-switch (concat - (if (string-match-p "%s" cmd) (format cmd input) cmd) + (if (tramp-compat-string-search "%s" cmd) (format cmd input) cmd) (if (stringp output) (concat " >" output) "")))) (defconst tramp-inline-compress-commands @@ -5223,7 +5223,7 @@ Return ATTR." (when (stringp (car attr)) (aset (nth 8 attr) 0 ?l))) ;; Convert directory indication bit. - (when (string-match-p "^d" (nth 8 attr)) + (when (string-prefix-p "d" (nth 8 attr)) (setcar attr t)) ;; Convert symlink from `tramp-do-file-attributes-with-stat'. ;; Decode also multibyte string. @@ -5803,12 +5803,13 @@ function cell is returned to be applied on a buffer." (with-tramp-connection-property (tramp-get-process vec) prop (tramp-find-inline-encoding vec) (tramp-get-connection-property (tramp-get-process vec) prop nil))) - (prop1 (if (string-match-p "encoding" prop) + (prop1 (if (tramp-compat-string-search "encoding" prop) "inline-compress" "inline-decompress")) compress) ;; The connection property might have been cached. So we must ;; send the script to the remote side - maybe. - (when (and coding (symbolp coding) (string-match-p "remote" prop)) + (when (and coding (symbolp coding) + (tramp-compat-string-search "remote" prop)) (let ((name (symbol-name coding))) (while (string-match "-" name) (setq name (replace-match "_" nil t name))) @@ -5820,7 +5821,7 @@ function cell is returned to be applied on a buffer." ;; Return the value. (cond ((and compress (symbolp coding)) - (if (string-match-p "decompress" prop1) + (if (tramp-compat-string-search "decompress" prop1) `(lambda (beg end) (,coding beg end) (let ((coding-system-for-write 'binary) @@ -5839,16 +5840,16 @@ function cell is returned to be applied on a buffer." (,coding (point-min) (point-max))))) ((symbolp coding) coding) - ((and compress (string-match-p "decoding" prop)) + ((and compress (tramp-compat-string-search "decoding" prop)) (format ;; Windows shells need the program file name after ;; the pipe symbol be quoted if they use forward ;; slashes as directory separators. (cond - ((and (string-match-p "local" prop) + ((and (tramp-compat-string-search "local" prop) (eq system-type 'windows-nt)) "(%s | \"%s\")") - ((string-match-p "local" prop) "(%s | %s)") + ((tramp-compat-string-search "local" prop) "(%s | %s)") (t "(%s | %s >%%s)")) coding compress)) (compress @@ -5856,14 +5857,14 @@ function cell is returned to be applied on a buffer." ;; Windows shells need the program file name after ;; the pipe symbol be quoted if they use forward ;; slashes as directory separators. - (if (and (string-match-p "local" prop) + (if (and (tramp-compat-string-search "local" prop) (eq system-type 'windows-nt)) "(%s <%%s | \"%s\")" "(%s <%%s | %s)") compress coding)) - ((string-match-p "decoding" prop) + ((tramp-compat-string-search "decoding" prop) (cond - ((string-match-p "local" prop) (format "%s" coding)) + ((tramp-compat-string-search "local" prop) (format "%s" coding)) (t (format "%s >%%s" coding)))) (t (format "%s <%%s" coding))))))) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 3d5be61d3f0..69372449172 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -849,7 +849,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; Check result. (when entry - (list (and (string-match-p "d" (nth 1 entry)) + (list (and (tramp-compat-string-search "d" (nth 1 entry)) t) ;0 file type -1 ;1 link count uid ;2 uid @@ -982,7 +982,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (mapcar (lambda (x) (list - (if (string-match-p "d" (nth 1 x)) + (if (tramp-compat-string-search "d" (nth 1 x)) (file-name-as-directory (nth 0 x)) (nth 0 x)))) (tramp-smb-get-file-entries directory))))))) @@ -1021,7 +1021,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (defun tramp-smb-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." (if (file-exists-p filename) - (string-match-p + (tramp-compat-string-search "w" (or (tramp-compat-file-attribute-modes (file-attributes filename)) "")) (let ((dir (file-name-directory filename))) @@ -1076,9 +1076,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; Check for matching entries. (mapcar (lambda (x) - (when (string-match-p - (format "^%s" base) (nth 0 x)) - x)) + (when (string-match-p (format "^%s" base) (nth 0 x)) x)) entries) ;; We just need the only and only entry FILENAME. (list (assoc base entries))))) @@ -1088,14 +1086,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (sort entries (lambda (x y) - (if (string-match-p "t" switches) + (if (tramp-compat-string-search "t" switches) ;; Sort by date. (time-less-p (nth 3 y) (nth 3 x)) ;; Sort by name. (string-lessp (nth 0 x) (nth 0 y)))))) ;; Handle "-F" switch. - (when (string-match-p "F" switches) + (when (tramp-compat-string-search "F" switches) (mapc (lambda (x) (unless (zerop (length (car x))) @@ -1124,7 +1122,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (expand-file-name (nth 0 x) (file-name-directory filename)) 'string))))) - (when (string-match-p "l" switches) + (when (tramp-compat-string-search "l" switches) (insert (format "%10s %3d %-8s %-8s %8s %s " @@ -1153,7 +1151,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (put-text-property start (point) 'dired-filename t)) ;; Insert symlink. - (when (and (string-match-p "l" switches) + (when (and (tramp-compat-string-search "l" switches) (stringp (tramp-compat-file-attribute-type attr))) (insert " -> " (tramp-compat-file-attribute-type attr)))) @@ -1551,7 +1549,7 @@ component is used as the target of the symlink." ;; Save exit. (with-current-buffer (tramp-get-connection-buffer v) - (if (string-match-p tramp-temp-buffer-name (buffer-name)) + (if (tramp-compat-string-search tramp-temp-buffer-name (buffer-name)) (progn (set-process-buffer (tramp-get-connection-process v) nil) (kill-buffer (current-buffer))) @@ -1857,10 +1855,12 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)." mode (or (match-string 1 line) "") mode (format "%s%s" - (if (string-match-p "D" mode) "d" "-") + (if (tramp-compat-string-search "D" mode) "d" "-") (mapconcat (lambda (_x) "") " " - (concat "r" (if (string-match-p "R" mode) "-" "w") "x"))) + (format + "r%sx" + (if (tramp-compat-string-search "R" mode) "-" "w")))) line (substring line 0 -6)) (cl-return)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fd426960fd2..6fc0ac8e1ef 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1625,7 +1625,8 @@ default values are used." (setq v (tramp-dissect-hop-name hop) hop (and hop (tramp-make-tramp-hop-name v)))) (let ((tramp-default-host - (or (and v (not (string-match-p "%h" (tramp-file-name-host v))) + (or (and v (not (tramp-compat-string-search + "%h" (tramp-file-name-host v))) (tramp-file-name-host v)) tramp-default-host))) (setq method (tramp-find-method method user host) @@ -1973,7 +1974,7 @@ ARGUMENTS to actually emit the message (if applicable)." (if (not btf) (setq fn "") (and (symbolp btf) (setq fn (symbol-name btf)) - (or (not (string-match-p "^tramp" fn)) + (or (not (string-prefix-p "tramp" fn)) (get btf 'tramp-suppress-trace)) (setq fn nil)) (setq btn (1+ btn)))) @@ -2225,7 +2226,7 @@ If VAR is nil, then we bind `v' to the structure and `method', `user', "Report progress of an operation for Tramp." (let* ((parameters (cdr reporter)) (message (aref parameters 3))) - (when (string-match-p message (or (current-message) "")) + (when (tramp-compat-string-search message (or (current-message) "")) (tramp-compat-progress-reporter-update reporter value suffix)))) (defmacro with-tramp-progress-reporter (vec level message &rest body) @@ -2339,7 +2340,7 @@ Example: (unless (and (functionp (nth 0 (car v))) (cond ;; Windows registry. - ((string-match-p "^HKEY_CURRENT_USER" (nth 1 (car v))) + ((string-prefix-p "HKEY_CURRENT_USER" (nth 1 (car v))) (and (memq system-type '(cygwin windows-nt)) (zerop (tramp-call-process @@ -2998,8 +2999,7 @@ remote host and localname (filename on remote host)." "Return all method completions for PARTIAL-METHOD." (mapcar (lambda (method) - (and method - (string-match-p (concat "^" (regexp-quote partial-method)) method) + (and method (string-prefix-p partial-method method) (tramp-completion-make-tramp-file-name method nil nil nil))) (mapcar #'car tramp-methods))) @@ -3011,8 +3011,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." (cond ((and partial-user partial-host) - (if (and host - (string-match-p (concat "^" (regexp-quote partial-host)) host) + (if (and host (string-prefix-p partial-host host) (string-equal partial-user (or user partial-user))) (setq user partial-user) (setq user nil @@ -3020,16 +3019,12 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." (partial-user (setq host nil) - (unless - (and user - (string-match-p (concat "^" (regexp-quote partial-user)) user)) + (unless (and user (string-prefix-p partial-user user)) (setq user nil))) (partial-host (setq user nil) - (unless - (and host - (string-match-p (concat "^" (regexp-quote partial-host)) host)) + (unless (and host (string-prefix-p partial-host host)) (setq host nil))) (t (setq user nil @@ -3707,7 +3702,7 @@ User is always nil." (list filename switches wildcard full-directory-p)) ;; `ls-lisp' always returns full listings. We must remove ;; superfluous parts. - (unless (string-match-p "l" switches) + (unless (tramp-compat-string-search "l" switches) (save-excursion (goto-char (point-min)) (while (setq start -- cgit v1.2.3