diff options
author | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:40:28 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2015-12-29 21:40:28 -0800 |
commit | 9f2f14a0725211b13a744573344636b57b9c98b9 (patch) | |
tree | 7190e0fb3d4aa06018d8cf997f06b806fb09a9c8 /lisp/net | |
parent | d259328fb87db8cc67d52771efcfa653e52c5b71 (diff) | |
parent | e823c34072bf045800d91e12c7ddb61fa23c6e30 (diff) | |
download | emacs-9f2f14a0725211b13a744573344636b57b9c98b9.tar.gz |
Merge emacs-25 into master (using imerge)
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/ange-ftp.el | 2 | ||||
-rw-r--r-- | lisp/net/browse-url.el | 40 | ||||
-rw-r--r-- | lisp/net/eudc-export.el | 28 | ||||
-rw-r--r-- | lisp/net/eudc-vars.el | 9 | ||||
-rw-r--r-- | lisp/net/eudc.el | 12 | ||||
-rw-r--r-- | lisp/net/eudcb-bbdb.el | 10 | ||||
-rw-r--r-- | lisp/net/eudcb-ph.el | 244 | ||||
-rw-r--r-- | lisp/net/eww.el | 34 | ||||
-rw-r--r-- | lisp/net/gnutls.el | 15 | ||||
-rw-r--r-- | lisp/net/imap.el | 123 | ||||
-rw-r--r-- | lisp/net/mairix.el | 2 | ||||
-rw-r--r-- | lisp/net/net-utils.el | 35 | ||||
-rw-r--r-- | lisp/net/newst-backend.el | 10 | ||||
-rw-r--r-- | lisp/net/newst-plainview.el | 12 | ||||
-rw-r--r-- | lisp/net/newst-treeview.el | 50 | ||||
-rw-r--r-- | lisp/net/rcirc.el | 2 | ||||
-rw-r--r-- | lisp/net/sasl-scram-rfc.el | 1 | ||||
-rw-r--r-- | lisp/net/shr.el | 3 | ||||
-rw-r--r-- | lisp/net/soap-client.el | 4 | ||||
-rw-r--r-- | lisp/net/tls.el | 24 | ||||
-rw-r--r-- | lisp/net/tramp-compat.el | 3 | ||||
-rw-r--r-- | lisp/net/tramp-gvfs.el | 13 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 175 | ||||
-rw-r--r-- | lisp/net/tramp.el | 8 | ||||
-rw-r--r-- | lisp/net/trampver.el | 5 |
25 files changed, 314 insertions, 550 deletions
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 4f7fa3b8f39..7fbf7f3650f 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -3863,7 +3863,7 @@ If VERBOSE-P is non-nil, print progress report in the echo area. FILES is a list of files to copy in the form (from-file to-file ok-if-already-exists keep-date) E.g., - (ange-ftp-copy-files-async t nil t '((\"a\" \"b\" t t) (\"c\" \"d\" t t)))" + (ange-ftp-copy-files-async t nil t \\='((\"a\" \"b\" t t) (\"c\" \"d\" t t)))" (unless okay-p (error "%s: %s" 'ange-ftp-copy-files-async line)) (if files (let* ((ff (car files)) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 757e368317a..d232c8add13 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -419,11 +419,11 @@ commands reverses the effect of this variable." :group 'browse-url) (defcustom browse-url-filename-alist - `(("^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*" . "ftp://\\2/") + `(("^/\\(ftp@\\|anonymous@\\)?\\([^:/]+\\):/*" . "ftp://\\2/") ;; The above loses the username to avoid the browser prompting for ;; it in anonymous cases. If it's not anonymous the next regexp ;; applies. - ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") + ("^/\\([^:@/]+@\\)?\\([^:/]+\\):/*" . "ftp://\\1\\2/") ,@(if (memq system-type '(windows-nt ms-dos)) '(("^\\([a-zA-Z]:\\)[\\/]" . "file:///\\1/") ("^[\\/][\\/]+" . "file://"))) @@ -441,13 +441,13 @@ address to an HTTP URL: (setq browse-url-filename-alist \\='((\"/webmaster@webserver:/home/www/html/\" . \"http://www.acme.co.uk/\") - (\"^/\\(ftp@\\|anonymous@\\)?\\([^:]+\\):/*\" . \"ftp://\\2/\") - (\"^/\\([^:@]+@\\)?\\([^:]+\\):/*\" . \"ftp://\\1\\2/\") + (\"^/\\(ftp@\\|anonymous@\\)?\\([^:/]+\\):/*\" . \"ftp://\\2/\") + (\"^/\\([^:@/]+@\\)?\\([^:/]+\\):/*\" . \"ftp://\\1\\2/\") (\"^/+\" . \"file:/\")))" :type '(repeat (cons :format "%v" (regexp :tag "Regexp") (string :tag "Replacement"))) - :version "23.1" + :version "25.1" :group 'browse-url) (defcustom browse-url-save-file nil @@ -762,12 +762,17 @@ narrowed." (defun browse-url (url &rest args) "Ask a WWW browser to load URL. Prompt for a URL, defaulting to the URL at or before point. -The variable `browse-url-browser-function' says which browser to use. -If the URL is a mailto: URL, consult `browse-url-mailto-function' +Invokes a suitable browser function which does the actual job. +The variable `browse-url-browser-function' says which browser function to +use. If the URL is a mailto: URL, consult `browse-url-mailto-function' first, if that exists. -Passes any ARGS to the browser function. -The default is to pass `browse-url-new-window-flag'." +The additional ARGS are passed to the browser function. See the doc +strings of the actual functions, starting with `browse-url-browser-function', +for information about the significance of ARGS (most of the functions +ignore it). +If ARGS are omitted, the default is to pass `browse-url-new-window-flag' +as ARGS." (interactive (browse-url-interactive-arg "URL: ")) (unless (called-interactively-p 'interactive) (setq args (or args (list browse-url-new-window-flag)))) @@ -836,6 +841,8 @@ says which browser to use." (declare-function w32-shell-execute "w32fns.c") ;; Defined in C. (defun browse-url-default-windows-browser (url &optional _new-window) + "Invoke the MS-Windows system's default Web browser. +The optional NEW-WINDOW argument is not used." (interactive (browse-url-interactive-arg "URL: ")) (cond ((eq system-type 'ms-dos) (if dos-windows-version @@ -846,6 +853,8 @@ says which browser to use." (t (w32-shell-execute "open" url)))) (defun browse-url-default-macosx-browser (url &optional _new-window) + "Invoke the MacOS X system's default Web browser. +The optional NEW-WINDOW argument is not used" (interactive (browse-url-interactive-arg "URL: ")) (start-process (concat "open " url) nil "open" url)) @@ -880,8 +889,8 @@ non-nil, load the document in a new window, if possible, otherwise use a random existing one. A non-nil interactive prefix argument reverses the effect of `browse-url-new-window-flag'. -When called non-interactively, optional second argument NEW-WINDOW is -used instead of `browse-url-new-window-flag'." +When called non-interactively, optional second argument ARGS is used +instead of `browse-url-new-window-flag'." (apply (cond ((memq system-type '(windows-nt ms-dos cygwin)) @@ -1103,7 +1112,8 @@ instead of `browse-url-new-window-flag'." "Ask the Chromium WWW browser to load URL. Default to the URL around or before point. The strings in variable `browse-url-chromium-arguments' are also passed to -Chromium." +Chromium. +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))) @@ -1412,7 +1422,8 @@ The `browse-url-gnudoit-program' program is used with options given by URL defaults to the URL around or before point. This runs the text browser specified by `browse-url-text-browser'. in an Xterm window using the Xterm program named by `browse-url-xterm-program' -with possible additional arguments `browse-url-xterm-args'." +with possible additional arguments `browse-url-xterm-args'. +The optional argument NEW-WINDOW is not used." (interactive (browse-url-interactive-arg "Text browser URL: ")) (apply #'start-process `(,(concat browse-url-text-browser url) nil ,browse-url-xterm-program @@ -1560,7 +1571,8 @@ don't offer a form of remote control." ;;;###autoload (defun browse-url-kde (url &optional _new-window) "Ask the KDE WWW browser to load URL. -Default to the URL around or before point." +Default to the URL around or before point. +The optional argument NEW-WINDOW is not used." (interactive (browse-url-interactive-arg "KDE URL: ")) (message "Sending URL to KDE...") (apply #'start-process (concat "KDE " url) nil browse-url-kde-program diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el index c60911ff0c5..a9fac516745 100644 --- a/lisp/net/eudc-export.el +++ b/lisp/net/eudc-export.el @@ -86,12 +86,19 @@ 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 - bbdb-company - bbdb-net - bbdb-address - bbdb-phones - 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)) (or silent (bbdb-display-records (list bbdb-record)))))) @@ -160,8 +167,13 @@ LOCATION is used as the address location for bbdb." ;; External. (declare-function bbdb-parse-phone-number "ext:bbdb-com" (string &optional number-type)) +(declare-function bbdb-parse-phone "ext:bbdb-com" (string &optional style)) (declare-function bbdb-string-trim "ext:bbdb" (string)) +(defun eudc-bbdbify-company (&rest organizations) + "Return ORGANIZATIONS as a list compatible with BBDB." + organizations) + (defun eudc-bbdbify-phone (phone location) "Parse PHONE into a vector compatible with BBDB. PHONE is either a string supposedly containing a phone number or @@ -172,7 +184,9 @@ LOCATION is used as the phone location for BBDB." ((stringp phone) (let (phone-list) (condition-case err - (setq phone-list (bbdb-parse-phone-number phone)) + (setq phone-list (if (eudc--using-bbdb-3-or-newer-p) + (bbdb-parse-phone phone) + (bbdb-parse-phone-number phone))) (error (if (string= "phone number unparsable." (cadr err)) (if (not (y-or-n-p (format "BBDB claims %S to be unparsable--insert anyway? " phone))) diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index 8cffa8e466a..de7e25a66aa 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el @@ -50,7 +50,7 @@ instead." ;; Known protocols (used in completion) ;; Not to be mistaken with `eudc-supported-protocols' -(defvar eudc-known-protocols '(bbdb ph ldap)) +(defvar eudc-known-protocols '(bbdb ldap)) (defcustom eudc-server-hotlist nil "Directory servers to query. @@ -357,6 +357,10 @@ BBDB fields. SPECs are sexps which are evaluated: (symbol :tag "BBDB Field") (sexp :tag "Conversion Spec")))) +(make-obsolete-variable 'eudc-ph-bbdb-conversion-alist + "the EUDC PH/QI backend is obsolete." + "25.1") + ;;}}} ;;{{{ LDAP Custom Group @@ -369,7 +373,8 @@ BBDB fields. SPECs are sexps which are evaluated: '((name . cn) (net . mail) (address . (eudc-bbdbify-address postaladdress "Address")) - (phone . ((eudc-bbdbify-phone telephonenumber "Phone")))) + (phone . (eudc-bbdbify-phone telephonenumber "Phone")) + (company . (eudc-bbdbify-company o))) "A mapping from BBDB to LDAP attributes. This is a list of cons cells (BBDB-FIELD . SPEC-OR-LIST) where BBDB-FIELD is the name of a field that must be defined in your BBDB diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 7280d9d2625..25a26bdf029 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -107,6 +107,18 @@ ;; attribute name (defvar eudc-protocol-has-default-query-attributes nil) +(defvar bbdb-version) + +(defun eudc--using-bbdb-3-or-newer-p () + "Return non-nil if BBDB version is 3 or greater." + (or + ;; MELPA versions of BBDB may have a bad package version, but + ;; they're all version 3 or later. + (equal bbdb-version "@PACKAGE_VERSION@") + ;; Development versions of BBDB can have the format "X.YZ devo". + ;; Split the string just in case. + (version<= "3" (car (split-string bbdb-version))))) + (defun eudc-plist-member (plist prop) "Return t if PROP has a value specified in PLIST." (if (not (= 0 (% (length plist) 2))) diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el index 0545304b4a3..1972fc1939a 100644 --- a/lisp/net/eudcb-bbdb.el +++ b/lisp/net/eudcb-bbdb.el @@ -42,21 +42,13 @@ (defvar eudc-bbdb-current-query nil) (defvar eudc-bbdb-current-return-attributes nil) -(defvar bbdb-version) - (defun eudc-bbdb-field (field-symbol) "Convert FIELD-SYMBOL so that it is recognized by the current BBDB version. BBDB < 3 used `net'; BBDB >= 3 uses `mail'." ;; This just-in-time translation permits upgrading from BBDB 2 to ;; BBDB 3 without restarting Emacs. (if (and (eq field-symbol 'net) - (or - ;; MELPA versions of BBDB may have a bad package version, - ;; but they're all version 3 or later. - (equal bbdb-version "@PACKAGE_VERSION@") - ;; Development versions of BBDB can have the format "X.YZ - ;; devo". Split the string just in case. - (version<= "3" (car (split-string bbdb-version))))) + (eudc--using-bbdb-3-or-newer-p)) 'mail field-symbol)) diff --git a/lisp/net/eudcb-ph.el b/lisp/net/eudcb-ph.el deleted file mode 100644 index f144bf695f5..00000000000 --- a/lisp/net/eudcb-ph.el +++ /dev/null @@ -1,244 +0,0 @@ -;;; eudcb-ph.el --- Emacs Unified Directory Client - CCSO PH/QI Backend - -;; Copyright (C) 1998-2015 Free Software Foundation, Inc. - -;; Author: Oscar Figueiredo <oscar@cpe.fr> -;; Pavel Janík <Pavel@Janik.cz> -;; Maintainer: Thomas Fitzsimmons <fitzsim@fitzsim.org> -;; Keywords: comm -;; Package: eudc - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; This library provides specific CCSO PH/QI protocol support for the -;; Emacs Unified Directory Client package. - -;;; Code: - -(require 'eudc) - -;;{{{ Internal cooking - -(eudc-protocol-set 'eudc-bbdb-conversion-alist 'eudc-ph-bbdb-conversion-alist 'ph) -(eudc-protocol-set 'eudc-query-function 'eudc-ph-query-internal 'ph) -(eudc-protocol-set 'eudc-list-attributes-function 'eudc-ph-get-field-list 'ph) -(eudc-protocol-set 'eudc-protocol-has-default-query-attributes t 'ph) - -(defvar eudc-ph-process-buffer nil) -(defvar eudc-ph-read-point) - -(defconst eudc-ph-default-server-port 105 - "Default TCP port for CCSO PH/QI directory services.") - -(defun eudc-ph-query-internal (query &optional return-fields) - "Query the PH/QI server with QUERY. -QUERY can be a string NAME or a list made of strings NAME -and/or cons cells (KEY . VALUE) where KEYs should be valid -CCSO database keys. NAME is equivalent to (DEFAULT . NAME), -where DEFAULT is the default key of the database. -RETURN-FIELDS is a list of database fields to return, -defaulting to `eudc-default-return-attributes'." - (let (request) - (if (null return-fields) - (setq return-fields eudc-default-return-attributes)) - (if (eq 'all return-fields) - (setq return-fields '(all))) - (setq request - (concat "query " - (if (stringp query) - query - (mapconcat (function (lambda (elt) - (if (stringp elt) elt) - (format "%s=%s" (car elt) (cdr elt)))) - query - " ")) - (if return-fields - (concat " return " (mapconcat 'symbol-name return-fields " "))))) - (and (> (length request) 6) - (eudc-ph-do-request request) - (eudc-ph-parse-query-result return-fields)))) - -(defun eudc-ph-get-field-list (full-records) - "Return a list of valid field names for the current server. -If FULL-RECORDS is non-nil, full records including field description -are returned" - (interactive) - (eudc-ph-do-request "fields") - (if full-records - (eudc-ph-parse-query-result) - (mapcar #'caar (eudc-ph-parse-query-result)))) - -(defun eudc-ph-parse-query-result (&optional fields) - "Return a list of alists of key/values from in `eudc-ph-process-buffer'. -Fields not in FIELDS are discarded." - (let (record - records - line-regexp - current-key - key - value - ignore) - (save-excursion - (message "Parsing results...") - (set-buffer eudc-ph-process-buffer) - (goto-char (point-min)) - (while (re-search-forward "^\\(-[0-9]+\\):\\([0-9]+\\):" nil t) - (catch 'ignore - (setq line-regexp (concat "^\\(-[0-9]+\\):" (match-string 2) ":[ \t]*\\([-a-zA-Z_]*\\)?:[ \t]*\\(.*\\)$")) - (beginning-of-line) - (setq record nil - ignore nil - current-key nil) - (while (re-search-forward line-regexp nil t) - (catch 'skip-line - (if (string= "-508" (match-string 1)) - ;; A field is missing in this entry. Skip it or skip the - ;; whole record (see `eudc-strict-return-matches') - (if (not eudc-strict-return-matches) - (throw 'skip-line t) - (while (re-search-forward line-regexp nil t)) - (setq ignore t) - (throw 'ignore t))) - (setq key (and (not (string= (match-string 2) "")) - (intern (match-string 2))) - value (match-string 3)) - (if (and current-key - (eq key current-key)) - (setq key nil) - (setq current-key key)) - (if (or (null fields) - (eq 'all fields) - (memq current-key fields)) - (if key - (setq record (cons (cons key value) record)) ; New key - (setcdr (car record) (if (listp (cdar record)) - (append (cdar record) (list value)) - (list (cdar record) value)))))))) - (and (not ignore) - (or (null fields) - (eq 'all fields) - (setq record (nreverse record))) - (setq record (if (not (eq 'list eudc-duplicate-attribute-handling-method)) - (eudc-filter-duplicate-attributes record) - (list record))) - (setq records (append record records))))) - (message "Done") - records)) - -(defun eudc-ph-do-request (request) - "Send REQUEST to the server. -Wait for response and return the buffer containing it." - (let (process - buffer) - (unwind-protect - (progn - (message "Contacting server...") - (setq process (eudc-ph-open-session)) - (if process - (with-current-buffer (setq buffer (process-buffer process)) - (eudc-ph-send-command process request) - (message "Request sent, waiting for reply...") - (eudc-ph-read-response process)))) - (if process - (eudc-ph-close-session process))) - buffer)) - -(defun eudc-ph-open-session (&optional server) - "Open a connection to the given CCSO/QI SERVER. -SERVER is either a string naming the server or a list (NAME PORT)." - (let (process - host - port) - (catch 'done - (if (null server) - (setq server (or eudc-server - (call-interactively 'eudc-ph-set-server)))) - (string-match "\\(.*\\)\\(:\\(.*\\)\\)?" server) - (setq host (match-string 1 server)) - (setq port (or (match-string 3 server) - eudc-ph-default-server-port)) - (setq eudc-ph-process-buffer (get-buffer-create (format " *PH-%s*" host))) - (with-current-buffer eudc-ph-process-buffer - (erase-buffer) - (setq eudc-ph-read-point (point)) - (and (featurep 'xemacs) (featurep 'mule) - (set-buffer-file-coding-system 'binary t))) - (setq process (open-network-stream "ph" eudc-ph-process-buffer host port)) - (if (null process) - (throw 'done nil)) - (set-process-query-on-exit-flag process t) - process))) - -(defun eudc-ph-close-session (process) - (with-current-buffer (process-buffer process) - (eudc-ph-send-command process "quit") - (eudc-ph-read-response process) - (run-at-time 2 nil 'delete-process process))) - -(defun eudc-ph-send-command (process command) - (goto-char (point-max)) - (process-send-string process command) - (process-send-string process "\r\n") - ) - -(defun eudc-ph-read-response (process &optional return-response) - "Read a response from the PH/QI query process PROCESS. -Returns nil if response starts with an error code. If the -response is successful the return code or the response itself is returned -depending on RETURN-RESPONSE." - (let ((case-fold-search nil) - return-code - match-end) - (goto-char eudc-ph-read-point) - ;; CCSO protocol : response complete if status >= 200 - (while (not (re-search-forward "^\\(^[2-5].*\\):.*\n" nil t)) - (accept-process-output process) - (goto-char eudc-ph-read-point)) - (setq match-end (point)) - (goto-char eudc-ph-read-point) - (if (and (setq return-code (match-string 1)) - (setq return-code (string-to-number return-code)) - (>= (abs return-code) 300)) - (progn (setq eudc-ph-read-point match-end) nil) - (setq eudc-ph-read-point match-end) - (if return-response - (buffer-substring (point) match-end) - return-code)))) - -;;}}} - -;;{{{ High-level interfaces (interactive functions) - -(defun eudc-ph-customize () - "Customize the EUDC PH support." - (interactive) - (customize-group 'eudc-ph)) - -(defun eudc-ph-set-server (server) - "Set the PH server to SERVER." - (interactive "sNew PH/QI Server: ") - (message "Selected PH/QI server is now %s" server) - (eudc-set-server server 'ph)) - -;;}}} - -(eudc-register-protocol 'ph) - -(provide 'eudcb-ph) - -;;; eudcb-ph.el ends here diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7ec58f15028..107df24e865 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -93,7 +93,7 @@ desktop. Otherwise, such entries will be retained." (defcustom eww-restore-desktop nil "How to restore EWW buffers on `desktop-restore'. -If t or 'auto, the buffers will be reloaded automatically. +If t or `auto', the buffers will be reloaded automatically. If nil, buffers will require manual reload, and will contain the text specified in `eww-restore-reload-prompt' instead of the actual Web page contents." @@ -322,7 +322,8 @@ Currently this means either text/html or application/xhtml+xml." (or (cdr (assq 'charset (cdr content-type))) (eww-detect-charset (eww-html-p (car content-type))) "utf-8")))) - (data-buffer (current-buffer))) + (data-buffer (current-buffer)) + last-coding-system-used) ;; Save the https peer status. (with-current-buffer buffer (plist-put eww-data :peer (plist-get status :peer))) @@ -340,11 +341,13 @@ Currently this means either text/html or application/xhtml+xml." ((string-match-p "\\`image/" (car content-type)) (eww-display-image buffer)) (t - (eww-display-raw buffer encode))) + (eww-display-raw buffer (or encode charset 'utf-8)))) (with-current-buffer buffer (plist-put eww-data :url url) (eww-update-header-line-format) (setq eww-history-position 0) + (and last-coding-system-used + (set-buffer-file-coding-system last-coding-system-used)) (run-hooks 'eww-after-render-hook))) (kill-buffer data-buffer)))) @@ -390,17 +393,15 @@ Currently this means either text/html or application/xhtml+xml." (list 'base (list (cons 'href url)) (progn - (when (or (and encode - (not (eq charset encode))) - (not (eq charset 'utf-8))) - (condition-case nil - (decode-coding-region (point) (point-max) - (or encode charset)) - (coding-system-error nil))) + (setq encode (or encode charset 'utf-8)) + (condition-case nil + (decode-coding-region (point) (point-max) encode) + (coding-system-error nil)) (libxml-parse-html-region (point) (point-max)))))) (source (and (null document) (buffer-substring (point) (point-max))))) (with-current-buffer buffer + (setq bidi-paragraph-direction 'left-to-right) (plist-put eww-data :source source) (plist-put eww-data :dom document) (let ((inhibit-read-only t) @@ -529,11 +530,9 @@ Currently this means either text/html or application/xhtml+xml." (let ((inhibit-read-only t)) (erase-buffer) (insert data) - (unless (eq encode 'utf-8) - (encode-coding-region (point-min) (1+ (length data)) 'utf-8) - (condition-case nil - (decode-coding-region (point-min) (1+ (length data)) encode) - (coding-system-error nil)))) + (condition-case nil + (decode-coding-region (point-min) (1+ (length data)) encode) + (coding-system-error nil))) (goto-char (point-min))))) (defun eww-display-image (buffer) @@ -743,8 +742,7 @@ the like." (setq-local desktop-save-buffer #'eww-desktop-misc-data) ;; multi-page isearch support (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer) - (setq truncate-lines t - bidi-paragraph-direction 'left-to-right) + (setq truncate-lines t) (buffer-disable-undo) (setq buffer-read-only t)) @@ -1936,7 +1934,7 @@ Generally, the list should not include the (usually overly large) (defun eww-restore-desktop (file-name buffer-name misc-data) "Restore an eww buffer from its desktop file record. -If `eww-restore-desktop' is t or 'auto, this function will also +If `eww-restore-desktop' is t or `auto', this function will also initiate the retrieval of the respective URI in the background. Otherwise, the restored buffer will contain a prompt to do so by using \\[eww-reload]." diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index ccaef8aafac..a7321da854c 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -193,12 +193,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." ;; The gnutls library doesn't understand files delivered via ;; the special handlers, so ignore all files found via those. (file-name-handler-alist nil) - (trustfiles (or trustfiles - (delq nil - (mapcar (lambda (f) (and f (file-exists-p f) f)) - (if (functionp gnutls-trustfiles) - (funcall gnutls-trustfiles) - gnutls-trustfiles))))) + (trustfiles (or trustfiles (gnutls-trustfiles))) (priority-string (or priority-string (cond ((eq type 'gnutls-anon) @@ -251,6 +246,14 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." process)) +(defun gnutls-trustfiles () + "Return a list of usable trustfiles." + (delq nil + (mapcar (lambda (f) (and f (file-exists-p f) f)) + (if (functionp gnutls-trustfiles) + (funcall gnutls-trustfiles) + gnutls-trustfiles)))) + (declare-function gnutls-error-string "gnutls.c" (error)) (defun gnutls-message-maybe (doit format &rest params) diff --git a/lisp/net/imap.el b/lisp/net/imap.el index b559ff65908..cc89f475bba 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -74,8 +74,7 @@ ;; imap.el supports RFC1730/2060/RFC3501 (IMAP4/IMAP4rev1). The implemented ;; IMAP extensions are RFC2195 (CRAM-MD5), RFC2086 (ACL), RFC2342 ;; (NAMESPACE), RFC2359 (UIDPLUS), the IMAP-part of RFC2595 (STARTTLS, -;; LOGINDISABLED) (with use of external library starttls.el and -;; program starttls), and the GSSAPI / Kerberos V4 sections of RFC1731 +;; LOGINDISABLED), and the GSSAPI / Kerberos V4 sections of RFC1731 ;; (with use of external program `imtest'), and RFC2971 (ID). It also ;; takes advantage of the UNSELECT extension in Cyrus IMAPD. ;; @@ -140,8 +139,6 @@ (eval-and-compile ;; For Emacs <22.2 and XEmacs. (unless (fboundp 'declare-function) (defmacro declare-function (&rest _r))) - (autoload 'starttls-open-stream "starttls") - (autoload 'starttls-negotiate "starttls") (autoload 'sasl-find-mechanism "sasl") (autoload 'digest-md5-parse-digest-challenge "digest-md5") (autoload 'digest-md5-digest-response "digest-md5") @@ -151,8 +148,7 @@ (autoload 'utf7-encode "utf7") (autoload 'utf7-decode "utf7") (autoload 'format-spec "format-spec") - (autoload 'format-spec-make "format-spec") - (autoload 'open-tls-stream "tls")) + (autoload 'format-spec-make "format-spec")) ;; User variables. @@ -184,19 +180,6 @@ the list is tried until a successful connection is made." :group 'imap :type '(repeat string)) -(defcustom imap-ssl-program '("openssl s_client -quiet -ssl3 -connect %s:%p" - "openssl s_client -quiet -ssl2 -connect %s:%p" - "s_client -quiet -ssl3 -connect %s:%p" - "s_client -quiet -ssl2 -connect %s:%p") - "A string, or list of strings, containing commands for SSL connections. -Within a string, %s is replaced with the server address and %p with -port number on server. The program should accept IMAP commands on -stdin and return responses to stdout. Each entry in the list is tried -until a successful connection is made." - :group 'imap - :type '(choice string - (repeat string))) - (defcustom imap-shell-program '("ssh %s imapd" "rsh %s imapd" "ssh %g ssh %s imapd" @@ -293,7 +276,7 @@ Shorter values mean quicker response, but is more CPU intensive." '((gssapi imap-gssapi-stream-p imap-gssapi-open) (kerberos4 imap-kerberos4-stream-p imap-kerberos4-open) (tls imap-tls-p imap-tls-open) - (ssl imap-ssl-p imap-ssl-open) + (ssl imap-tls-p imap-tls-open) (network imap-network-p imap-network-open) (shell imap-shell-p imap-shell-open) (starttls imap-starttls-p imap-starttls-open)) @@ -453,7 +436,7 @@ second the status (OK, NO, BAD etc) of the command.") When non-nil, use an alternative UIDS form. Enabling appears to be required for some servers (e.g., Microsoft Exchange 2007) -which otherwise would trigger a response 'BAD The specified +which otherwise would trigger a response `BAD The specified message set is invalid.'. We don't unconditionally use this form, since this is said to be significantly inefficient. @@ -661,56 +644,6 @@ sure of changing the value of `foo'." nil))))) done)) -(defun imap-ssl-p (_buffer) - nil) - -(defun imap-ssl-open (name buffer server port) - "Open an SSL connection to SERVER." - (let ((cmds (if (listp imap-ssl-program) imap-ssl-program - (list imap-ssl-program))) - cmd done) - (while (and (not done) (setq cmd (pop cmds))) - (message "imap: Opening SSL connection with `%s'..." cmd) - (erase-buffer) - (let* ((port (or port imap-default-ssl-port)) - (coding-system-for-read imap-coding-system-for-read) - (coding-system-for-write imap-coding-system-for-write) - (process-connection-type imap-process-connection-type) - (set-process-query-on-exit-flag - (if (fboundp 'set-process-query-on-exit-flag) - 'set-process-query-on-exit-flag - 'process-kill-without-query)) - process) - (when (progn - (setq process (start-process - name buffer shell-file-name - shell-command-switch - (format-spec cmd - (format-spec-make - ?s server - ?p (number-to-string port))))) - (funcall set-process-query-on-exit-flag process nil) - process) - (with-current-buffer buffer - (goto-char (point-min)) - (while (and (memq (process-status process) '(open run)) - (set-buffer buffer) ;; XXX "blue moon" nntp.el bug - (goto-char (point-max)) - (forward-line -1) - (not (imap-parse-greeting))) - (accept-process-output process 1) - (sit-for 1)) - (imap-log buffer) - (erase-buffer) - (when (memq (process-status process) '(open run)) - (setq done process)))))) - (if done - (progn - (message "imap: Opening SSL connection with `%s'...done" cmd) - done) - (message "imap: Opening SSL connection with `%s'...failed" cmd) - nil))) - (defun imap-tls-p (_buffer) nil) @@ -718,7 +651,8 @@ sure of changing the value of `foo'." (let* ((port (or port imap-default-tls-port)) (coding-system-for-read imap-coding-system-for-read) (coding-system-for-write imap-coding-system-for-write) - (process (open-tls-stream name buffer server port))) + (process (open-network-stream name buffer server port + :type 'tls))) (when process (while (and (memq (process-status process) '(open run)) ;; FIXME: Per the "blue moon" comment, the process/buffer @@ -803,34 +737,23 @@ sure of changing the value of `foo'." (imap-capability 'STARTTLS buffer)) (defun imap-starttls-open (name buffer server port) + (message "imap: Connecting with STARTTLS...") (let* ((port (or port imap-default-port)) (coding-system-for-read imap-coding-system-for-read) (coding-system-for-write imap-coding-system-for-write) - (process (starttls-open-stream name buffer server port)) - done tls-info) - (message "imap: Connecting with STARTTLS...") - (when process - (while (and (memq (process-status process) '(open run)) - (set-buffer buffer) ;; XXX "blue moon" nntp.el bug - (goto-char (point-max)) - (forward-line -1) - (not (imap-parse-greeting))) - (accept-process-output process 1) - (sit-for 1)) - (imap-send-command "STARTTLS") - (while (and (memq (process-status process) '(open run)) - (set-buffer buffer) ;; XXX "blue moon" nntp.el bug - (goto-char (point-max)) - (forward-line -1) - (not (re-search-forward "[0-9]+ OK.*\r?\n" nil t))) - (accept-process-output process 1) - (sit-for 1)) - (imap-log buffer) - (when (and (setq tls-info (starttls-negotiate process)) - (memq (process-status process) '(open run))) - (setq done process))) - (if (stringp tls-info) - (message "imap: STARTTLS info: %s" tls-info)) + (process (open-network-stream + name buffer server port + :type 'starttls + :capability-command "1 CAPABILITY\r\n" + :always-query-capabilities t + :end-of-command "\r\n" + :success " OK " + :starttls-function + (lambda (capabilities) + (when (string-match-p "STARTTLS" capabilities) + "1 STARTTLS\r\n")))) + (done (and process + (memq (process-status process) '(open run))))) (message "imap: Connecting with STARTTLS...%s" (if done "done" "failed")) done)) @@ -1564,8 +1487,8 @@ returned, if ITEMS is a symbol only its value is returned." (defun imap-mailbox-status-asynch (mailbox items &optional buffer) "Send status item requests ITEMS on MAILBOX to server in BUFFER. ITEMS can be a symbol or a list of symbols, valid symbols are one of -the STATUS data items -- i.e. 'messages, 'recent, 'uidnext, 'uidvalidity -or 'unseen. The IMAP command tag is returned." +the STATUS data items -- i.e., `messages', `recent', `uidnext', `uidvalidity' +or `unseen'. The IMAP command tag is returned." (with-current-buffer (or buffer (current-buffer)) (imap-send-command (list "STATUS \"" (imap-utf7-encode mailbox) @@ -2966,8 +2889,6 @@ Return nil if no complete line has arrived." imap-error-text imap-kerberos4s-p imap-kerberos4-open - imap-ssl-p - imap-ssl-open imap-network-p imap-network-open imap-interactive-login diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el index a73b4dfa921..997e47b1ec2 100644 --- a/lisp/net/mairix.el +++ b/lisp/net/mairix.el @@ -211,7 +211,7 @@ nil for disabling this).") (defvar mairix-widget-other '(threads flags) "Other editable mairix commands when using customization widgets. -Currently there are 'threads and 'flags.") +Currently there are `threads' and `flags'.") ;;;; Internal variables diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el index c6d40b62415..643d312fc2b 100644 --- a/lisp/net/net-utils.el +++ b/lisp/net/net-utils.el @@ -35,15 +35,19 @@ ;; * Support connections to HOST/PORT, generally for debugging and the like. ;; In other words, for doing much the same thing as "telnet HOST PORT", and ;; then typing commands. -;; -;; PATHS -;; -;; On some systems, some of these programs are not in normal user path, -;; but rather in /sbin, /usr/sbin, and so on. - ;;; Code: +;; On some systems, programs like ifconfig are not in normal user +;; path, but rather in /sbin, /usr/sbin, etc (but non-root users can +;; still use them for queries). Actually the trend these +;; days is for /sbin to be a symlink to /usr/sbin, but we still need to +;; search both for older systems. +(defun net-utils--executable-find-sbin (command) + "Return absolute name of COMMAND if found in an sbin directory." + (let ((exec-path '("/sbin" "/usr/sbin" "/usr/local/sbin"))) + (executable-find command))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Customization Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -85,10 +89,13 @@ These options can be used to limit how many ICMP packets are emitted." (define-obsolete-variable-alias 'ipconfig-program 'ifconfig-program "22.2") (defcustom ifconfig-program - (if (eq system-type 'windows-nt) - "ipconfig" - "ifconfig") + (cond ((eq system-type 'windows-nt) "ipconfig") + ((executable-find "ifconfig") "ifconfig") + ((net-utils--executable-find-sbin "ifconfig")) + ((net-utils--executable-find-sbin "ip")) + (t "ip")) "Program to print network configuration information." + :version "25.1" ; add ip :group 'net-utils :type 'string) @@ -96,10 +103,12 @@ These options can be used to limit how many ICMP packets are emitted." 'ifconfig-program-options "22.2") (defcustom ifconfig-program-options - (list - (if (eq system-type 'windows-nt) - "/all" "-a")) + (cond ((string-match "ipconfig\\'" ifconfig-program) '("/all")) + ((string-match "ifconfig\\'" ifconfig-program) '("-a")) + ((string-match "ip\\'" ifconfig-program) '("addr"))) "Options for the ifconfig program." + :version "25.1" + :set-after '(ifconfig-program) :group 'net-utils :type '(repeat string)) @@ -126,7 +135,7 @@ These options can be used to limit how many ICMP packets are emitted." :group 'net-utils :type '(repeat string)) -(defcustom arp-program "arp" +(defcustom arp-program (or (net-utils--executable-find-sbin "arp") "arp") "Program to print IP to address translation tables." :group 'net-utils :type 'string) diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 072fd015b60..2bec11ee3a3 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -502,8 +502,8 @@ This is a list of the form where LABEL is a symbol. TITLE, DESCRIPTION, and LINK are strings. TIME is a time value as returned by `current-time'. -AGE is a symbol: 'new, 'old, 'immortal, and 'obsolete denote -ordinary news items, whereas 'feed denotes an item which is not a +AGE is a symbol: `new', `old', `immortal', and `obsolete' denote +ordinary news items, whereas `feed' denotes an item which is not a headline but describes the feed itself. INDEX denotes the original position of the item -- used for restoring the original order. PREFORMATTED-CONTENTS and PREFORMATTED-TITLE hold the @@ -1987,7 +1987,7 @@ Renders the HTML code in the region POS1 to POS2 using htmlr." (defun newsticker--cache-replace-age (data feed old-age new-age) "Mark all items in DATA in FEED which carry age OLD-AGE with NEW-AGE. -If FEED is 'any it applies to all feeds. If OLD-AGE is 'any, +If FEED is `any' it applies to all feeds. If OLD-AGE is `any', all marks are replaced by NEW-AGE. Removes all pre-formatted contents." (mapc (lambda (a-feed) (when (or (eq feed 'any) @@ -2038,7 +2038,7 @@ The properties which are checked are TITLE, DESC, LINK, AGE, and GUID. In general all properties must match in order to return a certain item, except for the following cases. -If AGE equals 'feed the TITLE, DESCription and LINK do not +If AGE equals `feed' the TITLE, DESCription and LINK do not matter. If DESC is nil it is ignored as well. If `newsticker-desc-comp-max' is non-nil, only the first `newsticker-desc-comp-max' characters of DESC are taken into @@ -2143,7 +2143,7 @@ which the item got." (defun newsticker--cache-remove (data feed-symbol age) "Remove all entries from DATA in the feed FEED-SYMBOL with AGE. -FEED-SYMBOL may be 'any. Entries from old feeds, which are no longer in +FEED-SYMBOL may be `any'. Entries from old feeds, which are no longer in `newsticker-url-list' or `newsticker-url-list-defaults', are removed as well." (let* ((pos data) diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el index 0cb5d8c6a2f..b4e569078a9 100644 --- a/lisp/net/newst-plainview.el +++ b/lisp/net/newst-plainview.el @@ -228,7 +228,7 @@ Each function is called after one of `newsticker-next-item', `newsticker-next-new-item', `newsticker-previous-item', `newsticker-previous-new-item' has been called. -The default value 'newsticker--buffer-make-item-completely-visible +The default value `newsticker--buffer-make-item-completely-visible' assures that the current item is always completely visible." :type 'hook :options '(newsticker--buffer-make-item-completely-visible) @@ -240,7 +240,7 @@ assures that the current item is always completely visible." Each function is called after one of `newsticker-next-feed', and `newsticker-previous-feed' has been called. -The default value 'newsticker--buffer-make-item-completely-visible +The default value `newsticker--buffer-make-item-completely-visible' assures that the current feed is completely visible." :type 'hook :options '(newsticker--buffer-make-item-completely-visible) @@ -251,7 +251,7 @@ assures that the current feed is completely visible." "List of functions run after the newsticker buffer has been updated. Each function is called after `newsticker-buffer-update' has been called. -The default value `\\='newsticker-w3m-show-inline-images' loads inline +The default value `newsticker-w3m-show-inline-images' loads inline images." :type 'hook :group 'newsticker-plainview-hooks) @@ -263,7 +263,7 @@ Each function is called after `newsticker-toggle-auto-narrow-to-feed' or `newsticker-toggle-auto-narrow-to-item' has been called. -The default value `\\='newsticker-w3m-show-inline-images' loads inline +The default value `newsticker-w3m-show-inline-images' loads inline images." :type 'hook :group 'newsticker-plainview-hooks) @@ -1524,8 +1524,8 @@ Scans the buffer between START and END." (defun newsticker--buffer-set-invisibility (start end) "Add invisibility properties according to nt-type property. -Scans the buffer between START and END. Sets the 'invisible -property to '(<nt-type>-<nt-age> <nt-type> <nt-age>)." +Scans the buffer between START and END. Sets the `invisible' +property to (<nt-type>-<nt-age> <nt-type> <nt-age>)." (save-excursion ;; reset invisibility settings (put-text-property start end 'invisible nil) diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el index 0c2df8897d7..4f81b864970 100644 --- a/lisp/net/newst-treeview.el +++ b/lisp/net/newst-treeview.el @@ -267,28 +267,34 @@ their id stays constant." "Render text between markers START and END." (if newsticker-html-renderer (condition-case error-data - (save-excursion - (set-marker-insertion-type end t) - ;; check whether it is necessary to call html renderer - ;; (regexp inspired by htmlr.el) - (goto-char start) - (when (re-search-forward - "</?[A-Za-z1-6]*\\|&#?[A-Za-z0-9]+;" end t) - ;; (message "%s" (newsticker--title item)) - (let ((w3m-fill-column (if newsticker-use-full-width - -1 fill-column)) - (w3-maximum-line-length - (if newsticker-use-full-width nil fill-column))) - (save-excursion - (funcall newsticker-html-renderer start end))) - ;;(cond ((eq newsticker-html-renderer 'w3m-region) - ;; (add-text-properties start end (list 'keymap - ;; w3m-minor-mode-map))) - ;;((eq newsticker-html-renderer 'w3-region) - ;;(add-text-properties start end (list 'keymap w3-mode-map)))) - (if (eq newsticker-html-renderer 'w3m-region) - (w3m-toggle-inline-images t)) - t)) + ;; Need to save selected window in order to prevent mixing + ;; up contents of the item buffer. This happens with shr + ;; which does some smart optimizations that apparently + ;; interfere with our own, maybe not-so-smart, optimizations. + (save-selected-window + (save-excursion + (set-marker-insertion-type end t) + ;; check whether it is necessary to call html renderer + ;; (regexp inspired by htmlr.el) + (goto-char start) + (when (re-search-forward + "</?[A-Za-z1-6]*\\|&#?[A-Za-z0-9]+;" end t) + ;; (message "%s" (newsticker--title item)) + (let ((w3m-fill-column (if newsticker-use-full-width + -1 fill-column)) + (w3-maximum-line-length + (if newsticker-use-full-width nil fill-column))) + (select-window (newsticker--treeview-item-window)) + (save-excursion + (funcall newsticker-html-renderer start end))) + ;;(cond ((eq newsticker-html-renderer 'w3m-region) + ;; (add-text-properties start end (list 'keymap + ;; w3m-minor-mode-map))) + ;;((eq newsticker-html-renderer 'w3-region) + ;;(add-text-properties start end (list 'keymap w3-mode-map)))) + (if (eq newsticker-html-renderer 'w3m-region) + (w3m-toggle-inline-images t)) + t))) (error (message "Error: HTML rendering failed: %s, %s" (car error-data) (cdr error-data)) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index d58f3ebd4ea..3539dcf91f4 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -320,7 +320,7 @@ Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT." (defcustom rcirc-decode-coding-system 'utf-8 "Coding system used to decode incoming irc messages. -Set to 'undecided if you want the encoding of the incoming +Set to `undecided' if you want the encoding of the incoming messages autodetected." :type 'coding-system :group 'rcirc) diff --git a/lisp/net/sasl-scram-rfc.el b/lisp/net/sasl-scram-rfc.el index 18d7a6bfa18..34d6ddbd679 100644 --- a/lisp/net/sasl-scram-rfc.el +++ b/lisp/net/sasl-scram-rfc.el @@ -3,6 +3,7 @@ ;; Copyright (C) 2014-2015 Free Software Foundation, Inc. ;; Author: Magnus Henoch <magnus.henoch@gmail.com> +;; Package: sasl ;; This file is part of GNU Emacs. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 0b80e81abbc..0effa93b197 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -257,7 +257,8 @@ DOM should be a parse tree as generated by (if (and (null shr-width) (not (shr--have-one-fringe-p))) (* (frame-char-width) 2) - 0)))))) + 0))))) + bidi-display-reordering) (shr-descend dom) (shr-fill-lines start (point)) (shr-remove-trailing-whitespace start (point)) diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index 71d42459974..790084a4862 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el @@ -58,7 +58,7 @@ (require 'mm-decode) (defsubst soap-warning (message &rest args) - "Display a warning MESSAGE with ARGS, using the 'soap-client warning type." + "Display a warning MESSAGE with ARGS, using the `soap-client' warning type." ;; Do not use #'format-message, to support older Emacs versions. (display-warning 'soap-client (apply #'format message args) :warning)) @@ -562,7 +562,7 @@ fractional seconds, and the DST (daylight savings time) field is replaced with DATATYPE, a symbol representing the XSD primitive datatype. This symbol can be used to determine which fields apply and which don't when it's not already clear from context. -For example a datatype of 'time means the year, month and day +For example a datatype of `time' means the year, month and day fields should be ignored. This function will throw an error if DATE-TIME-STRING represents diff --git a/lisp/net/tls.el b/lisp/net/tls.el index 48e6a42186c..72fb50ed923 100644 --- a/lisp/net/tls.el +++ b/lisp/net/tls.el @@ -44,6 +44,8 @@ ;;; Code: +(require 'gnutls) + (autoload 'format-spec "format-spec") (autoload 'format-spec-make "format-spec") @@ -74,9 +76,10 @@ and `gnutls-cli' (version 2.0.1) output." :type 'regexp :group 'tls) -(defcustom tls-program '("gnutls-cli --insecure -p %p %h" - "gnutls-cli --insecure -p %p %h --protocols ssl3" - "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") +(defcustom tls-program + '("gnutls-cli --x509cafile %t -p %p %h" + "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" + "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") "List of strings containing commands to start TLS stream to a host. Each entry in the list is tried until a connection is successful. %h is replaced with server hostname, %p with port to connect to. @@ -89,21 +92,17 @@ successful negotiation." :type '(choice (const :tag "Default list of commands" - ("gnutls-cli --insecure -p %p %h" - "gnutls-cli --insecure -p %p %h --protocols ssl3" - "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")) + ("gnutls-cli --x509cafile %t -p %p %h" + "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" + "openssl s_client -CAfile %t -connect %h:%p -no_ssl2 -ign_eof")) (list :tag "Choose commands" :value - ("gnutls-cli --insecure -p %p %h" - "gnutls-cli --insecure -p %p %h --protocols ssl3" + ("gnutls-cli --x509cafile %t -p %p %h" + "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") (set :inline t ;; FIXME: add brief `:tag "..."' descriptions. ;; (repeat :inline t :tag "Other" (string)) - ;; See `tls-checktrust': - (const "gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h") - (const "gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h --protocols ssl3") - (const "openssl s_client -connect %h:%p -CAfile /etc/ssl/certs/ca-certificates.crt -no_ssl2 -ign_eof") ;; No trust check: (const "gnutls-cli --insecure -p %p %h") (const "gnutls-cli --insecure -p %p %h --protocols ssl3") @@ -232,6 +231,7 @@ Fourth arg PORT is an integer specifying a port to connect to." (format-spec cmd (format-spec-make + ?t (car (gnutls-trustfiles)) ?h host ?p (if (integerp port) (int-to-string port) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index c57102881bf..b6d6796255b 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -600,7 +600,8 @@ and replace a sub-expression, e.g. Store the result in LIST and return it. LIST must be a proper list. Of several `equal' occurrences of an element in LIST, the first one is kept." - (cl-delete-duplicates list '(:test equal :from-end) nil))) + (tramp-compat-funcall + 'cl-delete-duplicates list '(:test equal :from-end) nil))) (add-hook 'tramp-unload-hook (lambda () diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c5a60751d5b..549d3b15abe 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1740,20 +1740,25 @@ be used." (list user host))) (zeroconf-list-services service))) +;; We use the TRIM argument of `split-string', which exist since Emacs +;; 24.4. I mask this for older Emacs versions, there is no harm. (defun tramp-gvfs-parse-device-names (service) "Return a list of (user host) tuples allowed to access. This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." (let ((result - (split-string - (shell-command-to-string (format "avahi-browse -trkp %s" service)) - "[\n\r]+" 'omit "^\\+;.*$"))) + (ignore-errors + (tramp-compat-funcall + 'split-string + (shell-command-to-string (format "avahi-browse -trkp %s" service)) + "[\n\r]+" 'omit "^\\+;.*$")))) (tramp-compat-delete-dups (mapcar (lambda (x) (let* ((list (split-string x ";")) (host (nth 6 list)) (port (nth 8 list)) - (text (split-string (nth 9 list) "\" \"" 'omit "\"")) + (text (tramp-compat-funcall + 'split-string (nth 9 list) "\" \"" 'omit "\"")) user) ; (when (and port (not (string-equal port "0"))) ; (setq host (format "%s%s%s" host tramp-prefix-port-regexp port))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f5ff6a7adec..0dd2440e5e0 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -486,6 +486,7 @@ The string is used in `tramp-methods'.") ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin ;; GNU/Linux (Debian, Suse): /bin:/usr/bin ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! +;; Darwin: /usr/bin:/bin:/usr/sbin:/sbin ;; IRIX64: /usr/bin ;;;###tramp-autoload (defcustom tramp-remote-path @@ -597,9 +598,14 @@ we have this shell function.") use File::Spec; use Cwd \"realpath\"; +sub myrealpath { + my ($file) = @_; + return realpath($file) if -e $file; +} + sub recursive { my ($volume, @dirs) = @_; - my $real = realpath(File::Spec->catpath( + my $real = myrealpath(File::Spec->catpath( $volume, File::Spec->catdir(@dirs), \"\")); if ($real) { my ($vol, $dir) = File::Spec->splitpath($real, 1); @@ -613,7 +619,7 @@ sub recursive { } } -$result = realpath($ARGV[0]); +$result = myrealpath($ARGV[0]); if (!$result) { my ($vol, $dir) = File::Spec->splitpath($ARGV[0], 1); ($vol, @dirs) = recursive($vol, File::Spec->splitdir($dir)); @@ -621,10 +627,7 @@ if (!$result) { $result = File::Spec->catpath($vol, File::Spec->catdir(@dirs), \"\"); } -if ($ARGV[0] =~ /\\/$/) { - $result = $result . \"/\"; -} - +$result =~ s/\"/\\\\\"/g; print \"\\\"$result\\\"\\n\"; ' \"$1\" 2>/dev/null" "Perl script to produce output suitable for use with `file-truename' @@ -1143,20 +1146,17 @@ target of the symlink differ." ;; Do it yourself. We bind `directory-sep-char' here for ;; XEmacs on Windows, which would otherwise use backslash. - (t (let* ((directory-sep-char ?/) - (steps (tramp-compat-split-string localname "/")) - (localnamedir (tramp-run-real-handler - 'file-name-as-directory (list localname))) - (is-dir (string= localname localnamedir)) - (thisstep nil) - (numchase 0) - ;; Don't make the following value larger than - ;; necessary. People expect an error message in - ;; a timely fashion when something is wrong; - ;; otherwise they might think that Emacs is hung. - ;; Of course, correctness has to come first. - (numchase-limit 20) - symlink-target) + (t (let ((directory-sep-char ?/) + (steps (tramp-compat-split-string localname "/")) + (thisstep nil) + (numchase 0) + ;; Don't make the following value larger than + ;; necessary. People expect an error message in a + ;; timely fashion when something is wrong; + ;; otherwise they might think that Emacs is hung. + ;; Of course, correctness has to come first. + (numchase-limit 20) + symlink-target) (while (and steps (< numchase numchase-limit)) (setq thisstep (pop steps)) (tramp-message @@ -1212,10 +1212,8 @@ target of the symlink differ." (if result (mapconcat 'identity (cons "" result) "/") "/")) - (when (and is-dir - (or (string= "" result) - (not (string= (substring result -1) "/")))) - (setq result (concat result "/")))))) + (when (string= "" result) + (setq result "/"))))) (tramp-message v 4 "True name of `%s' is `%s'" localname result) result)))) @@ -1276,11 +1274,15 @@ target of the symlink differ." (tramp-get-test-command vec) (tramp-shell-quote-argument localname) (tramp-get-ls-command vec) + (if (eq id-format 'integer) "-ildn" "-ild") ;; On systems which have no quoting style, file names ;; with special characters could fail. - (if (tramp-get-ls-command-with-quoting-style vec) - "--quoting-style=c" "") - (if (eq id-format 'integer) "-ildn" "-ild") + (cond + ((tramp-get-ls-command-with-quoting-style vec) + "--quoting-style=c") + ((tramp-get-ls-command-with-w-option vec) + "-w") + (t "")) (tramp-shell-quote-argument localname))) ;; Parse `ls -l' output ... (with-current-buffer (tramp-get-buffer vec) @@ -1837,10 +1839,14 @@ be non-negative integers." "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"") (tramp-shell-quote-argument localname) (tramp-get-ls-command vec) - ;; On systems which have no quoting style, file names with - ;; special characters could fail. - (if (tramp-get-ls-command-with-quoting-style vec) - "--quoting-style=shell" "") + ;; On systems which have no quoting style, file names with special + ;; characters could fail. + (cond + ((tramp-get-ls-command-with-quoting-style vec) + "--quoting-style=shell") + ((tramp-get-ls-command-with-w-option vec) + "-w") + (t "")) (tramp-get-remote-stat vec) tramp-stat-marker tramp-stat-marker tramp-stat-marker tramp-stat-marker @@ -4149,7 +4155,8 @@ seconds. If not, it produces an error message with the given ERROR-ARGS." "Set up an interactive shell. Mainly sets the prompt and the echo correctly. PROC is the shell process to set up. VEC specifies the connection." - (let ((tramp-end-of-output tramp-initial-end-of-output)) + (let ((tramp-end-of-output tramp-initial-end-of-output) + (case-fold-search t)) (tramp-open-shell vec (tramp-get-method-parameter vec 'tramp-remote-shell)) ;; Disable tab and echo expansion. @@ -4174,6 +4181,25 @@ process to set up. VEC specifies the connection." vec (format "PS1=%s PS2='' PS3='' PROMPT_COMMAND=''" (tramp-shell-quote-argument tramp-end-of-output)) t) + ;; Check whether the output of "uname -sr" has been changed. If + ;; yes, this is a strong indication that we must expire all + ;; connection properties. We start again with + ;; `tramp-maybe-open-connection', it will be caught there. + (tramp-message vec 5 "Checking system information") + (let ((old-uname (tramp-get-connection-property vec "uname" nil)) + (new-uname + (tramp-set-connection-property + vec "uname" + (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) + (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) + (tramp-message + vec 3 + "Connection reset, because remote host changed from `%s' to `%s'" + old-uname new-uname) + ;; We want to keep the password. + (tramp-cleanup-connection vec t t) + (throw 'uname-changed (tramp-maybe-open-connection vec)))) + ;; Try to set up the coding system correctly. ;; CCC this can't be the right way to do it. Hm. (tramp-message vec 5 "Determining coding system") @@ -4182,7 +4208,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 (coding-system-list)) - (string-match "utf8" (tramp-get-remote-locale vec)) + (string-match "utf-?8" (tramp-get-remote-locale vec)) (cons 'utf-8 'utf-8)) (tramp-compat-funcall 'process-coding-system proc) (cons 'undecided 'undecided))) @@ -4192,8 +4218,12 @@ process to set up. VEC specifies the connection." (setq cs-encode (cdr cs)) (unless cs-decode (setq cs-decode 'undecided)) (unless cs-encode (setq cs-encode 'undecided)) - (setq cs-encode (tramp-compat-coding-system-change-eol-conversion - cs-encode 'unix)) + (setq cs-encode + (tramp-compat-coding-system-change-eol-conversion + cs-encode + (if (string-match + "^Darwin" (tramp-get-connection-property vec "uname" "")) + 'mac 'unix))) (tramp-send-command vec "echo foo ; echo bar" t) (goto-char (point-min)) (when (search-forward "\r" nil t) @@ -4212,25 +4242,6 @@ process to set up. VEC specifies the connection." (tramp-send-command vec "set +o vi +o emacs" t) - ;; Check whether the output of "uname -sr" has been changed. If - ;; yes, this is a strong indication that we must expire all - ;; connection properties. We start again with - ;; `tramp-maybe-open-connection', it will be caught there. - (tramp-message vec 5 "Checking system information") - (let ((old-uname (tramp-get-connection-property vec "uname" nil)) - (new-uname - (tramp-set-connection-property - vec "uname" - (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) - (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) - (tramp-message - vec 3 - "Connection reset, because remote host changed from `%s' to `%s'" - old-uname new-uname) - ;; We want to keep the password. - (tramp-cleanup-connection vec t t) - (throw 'uname-changed (tramp-maybe-open-connection vec)))) - ;; Check whether the remote host suffers from buggy ;; `send-process-string'. This is known for FreeBSD (see comment in ;; `send_process', file process.c). I've tested sending 624 bytes @@ -4264,7 +4275,7 @@ process to set up. VEC specifies the connection." (tramp-find-shell vec) ;; Disable unexpected output. - (tramp-send-command vec "mesg n; biff n" t) + (tramp-send-command vec "mesg n 2>/dev/null; biff n 2>/dev/null" t) ;; IRIX64 bash expands "!" even when in single quotes. This ;; destroys our shell functions, we must disable it. See @@ -4277,6 +4288,10 @@ process to set up. VEC specifies the connection." (tramp-get-connection-property vec "uname" "")) (tramp-send-command vec "stty -oxtabs" t)) + ;; Set utf8 encoding. Needed for Mac OS X, for example. This is + ;; non-POSIX, so we must expect errors on some systems. + (tramp-send-command vec "stty iutf8 2>/dev/null" t) + ;; Set `remote-tty' process property. (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) (unless (zerop (length tty)) @@ -5295,21 +5310,26 @@ Return ATTR." ;; The login shell could return more than just the $PATH ;; string. So we use `tramp-end-of-heredoc' as marker. (when elt2 - (tramp-send-command-and-read - vec - (format - "%s %s %s 'echo %s \\\"$PATH\\\"'" - (tramp-get-method-parameter vec 'tramp-remote-shell) - (mapconcat - 'identity - (tramp-get-method-parameter vec 'tramp-remote-shell-login) - " ") - (mapconcat - 'identity - (tramp-get-method-parameter vec 'tramp-remote-shell-args) - " ") - (tramp-shell-quote-argument tramp-end-of-heredoc)) - nil (regexp-quote tramp-end-of-heredoc))))) + (or + (tramp-send-command-and-read + vec + (format + "%s %s %s 'echo %s \\\"$PATH\\\"'" + (tramp-get-method-parameter vec 'tramp-remote-shell) + (mapconcat + 'identity + (tramp-get-method-parameter vec 'tramp-remote-shell-login) + " ") + (mapconcat + 'identity + (tramp-get-method-parameter vec 'tramp-remote-shell-args) + " ") + (tramp-shell-quote-argument tramp-end-of-heredoc)) + 'noerror (regexp-quote tramp-end-of-heredoc)) + (progn + (tramp-message + vec 2 "Could not retrieve `tramp-own-remote-path'") + nil))))) ;; Replace place holder `tramp-default-remote-path'. (when elt1 @@ -5353,7 +5373,7 @@ Return ATTR." (defun tramp-get-remote-locale (vec) (with-tramp-connection-property vec "locale" (tramp-send-command vec "locale -a") - (let ((candidates '("en_US.utf8" "C.utf8")) + (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8")) locale) (with-current-buffer (tramp-get-connection-buffer vec) (while candidates @@ -5405,13 +5425,20 @@ Return ATTR." (save-match-data (with-tramp-connection-property vec "ls-quoting-style" (tramp-message vec 5 "Checking, whether `ls --quoting-style=shell' works") - ;; Some "ls" versions are sensible wrt the order of arguments, - ;; they fail when "-al" is after the "--dired" argument (for - ;; example on FreeBSD). (tramp-send-command-and-check vec (format "%s --quoting-style=shell -al /dev/null" (tramp-get-ls-command vec)))))) +(defun tramp-get-ls-command-with-w-option (vec) + (save-match-data + (with-tramp-connection-property vec "ls-w-option" + (tramp-message vec 5 "Checking, whether `ls -w' works") + ;; Option "-w" is available on BSD systems. No argument is + ;; given, because this could return wrong results in case "ls" + ;; supports the "-w NUM" argument, as for busyboxes. + (tramp-send-command-and-check + vec (format "%s -alw" (tramp-get-ls-command vec)))))) + (defun tramp-get-test-command (vec) (with-tramp-connection-property vec "test" (tramp-message vec 5 "Finding a suitable `test' command") diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 42a9e3d6710..b7f53095a8e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -694,8 +694,8 @@ Useful for \"rsync\" like methods.") It can have the following values: - 'ftp -- Ange-FTP respective EFS like syntax (GNU Emacs default) - 'sep -- Syntax as defined for XEmacs." + `ftp' -- Ange-FTP respective EFS like syntax (GNU Emacs default) + `sep' -- Syntax as defined for XEmacs." :group 'tramp :version "24.4" :type `(choice (const :tag ,(if (featurep 'xemacs) "EFS" "Ange-FTP") ftp) @@ -1291,8 +1291,8 @@ This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." (defun tramp-dissect-file-name (name &optional nodefault) "Return a `tramp-file-name' structure. -The structure consists of remote method, remote user, remote host -and localname (file name on remote host). If NODEFAULT is +The structure consists of remote method, remote user, remote host, +localname (file name on remote host) and hop. If NODEFAULT is non-nil, the file name parts are not expanded to their default values." (save-match-data diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 5c42f3a828a..f93cfc4e8ae 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -6,6 +6,7 @@ ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> ;; Keywords: comm, processes ;; Package: tramp +;; Version: 2.2.13.25.1 ;; This file is part of GNU Emacs. @@ -31,7 +32,7 @@ ;; should be changed only there. ;;;###tramp-autoload -(defconst tramp-version "2.2.13-pre" +(defconst tramp-version "2.2.13.25.1" "This version of Tramp.") ;;;###tramp-autoload @@ -62,7 +63,7 @@ (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" - (format "Tramp 2.2.13-pre is not fit for %s" + (format "Tramp 2.2.13.25.1 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version))))))) (unless (string-match "\\`ok\\'" x) (error "%s" x))) |