summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-11-02 21:01:04 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-11-02 21:01:04 -0700
commitc66a3944edca6150c9252e15a0ea75c96225481b (patch)
tree888bfa31967a17c174ba61d0a8547dd64658060a /lisp
parent770f245cdf2cf9e74e49bb32afb77562d9b1ad6d (diff)
parent7f089aa5f6d208209b2cfef8e0d3d9530e191248 (diff)
downloademacs-c66a3944edca6150c9252e15a0ea75c96225481b.tar.gz
Merge from origin/emacs-26
7f089aa5f6 Require seq in rmc.el 53aaad1dfc Make an example code introduced in the Gnus info work (bug... 7b29db222f Enable gnus-read-ephemeral-* to run multiple times (bug#29... 015f0bb2d8 Port thread.c to OpenBSD ARM ad68bbd0da Fix another "wrong side of point" error in CC Mode. 646e56e150 Fix Bug#28959 685fd77959 Fix duplicate .o file on QNX e562356c3f Fix two js indentation problems b8cf159bbc Update documentation for windows build 46540a1c7a Fix a "wrong side of point" error in CC Mode. Fixes bug #... 57ca409111 Fix autoload of flymake from elisp-mode during bootstrap (... aee0bc8775 Fix non-native fullscreen on NS (bug#28872) d6c1a9cb8a ; Fix author email address in test/lisp/url/url-tramp-test... 761c630766 Fix Bug#28982 628b653209 Fix windows build errors e8a06a5f9a Fix compile warning for non-w32 builds 0c536a20fb Display commit in package description, if available (Bug#2... 1d83257a1d Port to QNX 19667f44ef * configure.ac: Tweak libcurses diagnostic. 3fc05cfaec Scripts to automate windows binary distribution 928a106939 Fix Edebug specs for map-let and with-maps-do 46f2ee0d4c * test/lisp/net/tramp-tests.el (tramp-test41-delay-load): ... b51009d7f0 * admin/authors.el (authors-canonical-author-name): Ignore... a015db90e3 * test/lisp/progmodes/sql-tests.el (sql-tests-postgres-lis... 529a9c09d3 Further work on Bug#28889 c6deabaf4d Improve Tramp backward compatibility 8093e82e42 Improve backward compatibility of tramp-tests.el 46cdc01daa Fix some ‘window-normalize-’ prefixed functions (Bug#28947) 6360611457 Port to OpenIndiana a012ec766c Don't fill keywords after Emacs Lisp docstring b7c4aa951c Refactor c-forward-token-2 with new function c-forward-ove... 3aee7be62e Avoid unnecessary rounding errors in timestamps 2bfa42855b Fix xdg timestamp error on 32-bit Emacs 237e96bc52 Test that advice doesn't trigger bytecomp warnings (Bug#28... d719ea6ad5 Another fix for unsafe directory error message (Bug#865) b060e091c3 Handle https url for debbugs mbox (Bug#28831) 9e4265ef91 Ignore string properties when saving eshell history (Bug#2... 0f286ca85a Fix Bug#28889
Diffstat (limited to 'lisp')
-rw-r--r--lisp/desktop.el3
-rw-r--r--lisp/ecomplete.el2
-rw-r--r--lisp/emacs-lisp/lisp-mode.el11
-rw-r--r--lisp/emacs-lisp/map.el3
-rw-r--r--lisp/emacs-lisp/package.el3
-rw-r--r--lisp/emacs-lisp/rmc.el2
-rw-r--r--lisp/epg.el5
-rw-r--r--lisp/eshell/em-hist.el5
-rw-r--r--lisp/files.el31
-rw-r--r--lisp/gnus/gnus-group.el17
-rw-r--r--lisp/image-dired.el15
-rw-r--r--lisp/info.el2
-rw-r--r--lisp/kmacro.el1
-rw-r--r--lisp/loadup.el1
-rw-r--r--lisp/ls-lisp.el7
-rw-r--r--lisp/net/ange-ftp.el4
-rw-r--r--lisp/net/rcirc.el2
-rw-r--r--lisp/net/tramp-compat.el6
-rw-r--r--lisp/net/tramp.el127
-rw-r--r--lisp/progmodes/cc-cmds.el2
-rw-r--r--lisp/progmodes/cc-engine.el120
-rw-r--r--lisp/progmodes/cc-fonts.el21
-rw-r--r--lisp/progmodes/js.el21
-rw-r--r--lisp/replace.el1
-rw-r--r--lisp/server.el5
-rw-r--r--lisp/textmodes/remember.el2
-rw-r--r--lisp/url/url-cookie.el2
-rw-r--r--lisp/url/url-tramp.el58
-rw-r--r--lisp/window.el46
-rw-r--r--lisp/xdg.el4
30 files changed, 301 insertions, 228 deletions
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 66e2aef9798..0aa5dcfe8a3 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1046,7 +1046,8 @@ without further confirmation."
(or (not new-modtime) ; nothing to overwrite
(equal desktop-file-modtime new-modtime)
(yes-or-no-p (if desktop-file-modtime
- (if (> (float-time new-modtime) (float-time desktop-file-modtime))
+ (if (time-less-p desktop-file-modtime
+ new-modtime)
"Desktop file is more recent than the one loaded. Save anyway? "
"Desktop file isn't the one loaded. Overwrite it? ")
"Current desktop was not loaded from a file. Overwrite this desktop file? "))
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el
index ed23d9f5cc2..014b4b21122 100644
--- a/lisp/ecomplete.el
+++ b/lisp/ecomplete.el
@@ -55,7 +55,7 @@
(defun ecomplete-add-item (type key text)
(let ((elems (assq type ecomplete-database))
- (now (string-to-number (format "%.0f" (float-time))))
+ (now (string-to-number (format-time-string "%s")))
entry)
(unless elems
(push (setq elems (list type)) ecomplete-database))
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index aeeea2178b3..7d38052fd40 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1269,7 +1269,8 @@ and initial semicolons."
;; case). The `;' and `:' stop the paragraph being filled at following
;; comment lines and at keywords (e.g., in `defcustom'). Left parens are
;; escaped to keep font-locking, filling, & paren matching in the source
- ;; file happy.
+ ;; file happy. The `:' must be preceded by whitespace so that keywords
+ ;; inside of the docstring don't start new paragraphs (Bug#7751).
;;
;; `paragraph-separate': A clever regexp distinguishes the first line of
;; a docstring and identifies it as a paragraph separator, so that it
@@ -1282,13 +1283,7 @@ and initial semicolons."
;; `emacs-lisp-docstring-fill-column' if that value is an integer.
(let ((paragraph-start
(concat paragraph-start
- (format "\\|\\s-*\\([(;%s\"]\\|`(\\|#'(\\)"
- ;; If we're inside a string (like the doc
- ;; string), don't consider a colon to be
- ;; a paragraph-start character.
- (if (nth 3 (syntax-ppss))
- ""
- ":"))))
+ "\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)"))
(paragraph-separate
(concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
(fill-column (if (and (integerp emacs-lisp-docstring-fill-column)
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index 0f9a74422b4..2a3e1d0a4b0 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -73,7 +73,8 @@ KEYS can also be a list of (KEY VARNAME) pairs, in which case
KEY is an unquoted form.
MAP can be a list, hash-table or array."
- (declare (indent 2) (debug t))
+ (declare (indent 2)
+ (debug ((&rest &or symbolp ([form symbolp])) form body)))
`(pcase-let ((,(map--make-pcase-patterns keys) ,map))
,@body))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 3c34caa17d4..68ca1972d1e 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2260,6 +2260,7 @@ Otherwise no newline is inserted."
(archive (if desc (package-desc-archive desc)))
(extras (and desc (package-desc-extras desc)))
(homepage (cdr (assoc :url extras)))
+ (commit (cdr (assoc :commit extras)))
(keywords (if desc (package-desc--keywords desc)))
(built-in (eq pkg-dir 'builtin))
(installable (and archive (not built-in)))
@@ -2332,6 +2333,8 @@ Otherwise no newline is inserted."
(and version
(package--print-help-section "Version"
(package-version-join version)))
+ (when commit
+ (package--print-help-section "Commit" commit))
(when desc
(package--print-help-section "Summary"
(package-desc-summary desc)))
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 0be6971992c..ca11c596638 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -23,6 +23,8 @@
;;; Code:
+(require 'seq)
+
;;;###autoload
(defun read-multiple-choice (prompt choices)
"Ask user a multiple choice question.
diff --git a/lisp/epg.el b/lisp/epg.el
index 407b0f5d5d3..fee6ad75119 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -757,9 +757,8 @@ callback data (if any)."
;; Restore Emacs frame on text terminal, when pinentry-curses has terminated.
(if (with-current-buffer (process-buffer (epg-context-process context))
(and epg-agent-file
- (> (float-time (or (nth 5 (file-attributes epg-agent-file))
- '(0 0 0 0)))
- (float-time epg-agent-mtime))))
+ (time-less-p epg-agent-mtime
+ (or (nth 5 (file-attributes epg-agent-file)) 0))))
(redraw-frame))
(epg-context-set-result-for
context 'error
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 1ab3c60b2c7..8084c126530 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -444,7 +444,6 @@ line, with the most recent command last. See also
(ignore-dups eshell-hist-ignoredups))
(with-temp-buffer
(insert-file-contents file)
- ;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(while (and (< count size)
@@ -488,7 +487,9 @@ See also `eshell-read-history'."
(while (> index 0)
(setq index (1- index))
(let ((start (point)))
- (insert (ring-ref ring index) ?\n)
+ ;; Remove properties before inserting, to avoid trouble
+ ;; with read-only strings (Bug#28700).
+ (insert (substring-no-properties (ring-ref ring index)) ?\n)
(subst-char-in-region start (1- (point)) ?\n ?\177)))
(eshell-with-private-file-modes
(write-region (point-min) (point-max) file append
diff --git a/lisp/files.el b/lisp/files.el
index 666654da2c9..cda2c1abd5e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3947,11 +3947,12 @@ This function returns either:
;; The entry MTIME should match the most recent
;; MTIME among matching files.
(and cached-files
- (= (float-time (nth 2 dir-elt))
- (apply #'max (mapcar (lambda (f)
- (float-time
- (nth 5 (file-attributes f))))
- cached-files))))))
+ (equal (nth 2 dir-elt)
+ (let ((latest 0))
+ (dolist (f cached-files latest)
+ (let ((f-time (nth 5 (file-attributes f))))
+ (if (time-less-p latest f-time)
+ (setq latest f-time)))))))))
;; This cache entry is OK.
dir-elt
;; This cache entry is invalid; clear it.
@@ -3973,10 +3974,15 @@ Return the new class name, which is a symbol named DIR."
(let* ((class-name (intern dir))
(files (dir-locals--all-files dir))
(read-circle nil)
- (success nil)
+ ;; If there was a problem, use the values we could get but
+ ;; don't let the cache prevent future reads.
+ (latest 0) (success 0)
(variables))
(with-demoted-errors "Error reading dir-locals: %S"
(dolist (file files)
+ (let ((file-time (nth 5 (file-attributes file))))
+ (if (time-less-p latest file-time)
+ (setq latest file-time)))
(with-temp-buffer
(insert-file-contents file)
(condition-case-unless-debug nil
@@ -3985,18 +3991,9 @@ Return the new class name, which is a symbol named DIR."
variables
(read (current-buffer))))
(end-of-file nil))))
- (setq success t))
+ (setq success latest))
(dir-locals-set-class-variables class-name variables)
- (dir-locals-set-directory-class
- dir class-name
- (seconds-to-time
- (if success
- (apply #'max (mapcar (lambda (file)
- (float-time (nth 5 (file-attributes file))))
- files))
- ;; If there was a problem, use the values we could get but
- ;; don't let the cache prevent future reads.
- 0)))
+ (dir-locals-set-directory-class dir class-name success)
class-name))
(define-obsolete-function-alias 'dir-locals-read-from-file
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 1174f90e1ad..89f17316cf1 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2373,7 +2373,10 @@ specified by `gnus-gmane-group-download-format'."
(with-temp-file tmpfile
(url-insert-file-contents
(format gnus-gmane-group-download-format
- group start (+ start range)))
+ group start (+ start range))
+ t)
+ ;; `url-insert-file-contents' sets this because of the 2nd arg.
+ (setq buffer-file-name nil)
(write-region (point-min) (point-max) tmpfile)
(gnus-group-read-ephemeral-group
(format "nndoc+ephemeral:%s.start-%s.range-%s" group start range)
@@ -2463,13 +2466,11 @@ the bug number, and browsing the URL must return mbox output."
(if (and (not gnus-plugged)
(file-exists-p file))
(insert-file-contents file)
- (url-insert-file-contents (format mbox-url id)))))
+ (url-insert-file-contents (format mbox-url id) t))))
;; Add the debbugs address so that we can respond to reports easily.
(let ((address
(format "%s@%s" (car ids)
- (replace-regexp-in-string
- "/.*$" ""
- (replace-regexp-in-string "^http://" "" mbox-url)))))
+ (url-host (url-generic-parse-url mbox-url)))))
(goto-char (point-min))
(while (re-search-forward (concat "^" message-unix-mail-delimiter)
nil t)
@@ -2490,7 +2491,9 @@ the bug number, and browsing the URL must return mbox output."
(insert ", " address))
(insert "To: " address "\n")))
(goto-char (point-max))
- (widen)))))
+ (widen)))
+ ;; `url-insert-file-contents' sets this because of the 2nd arg.
+ (setq buffer-file-name nil)))
(gnus-group-read-ephemeral-group
(format "nndoc+ephemeral:bug#%s"
(mapconcat 'number-to-string ids ","))
@@ -2514,6 +2517,8 @@ the bug number, and browsing the URL must return mbox output."
(interactive (list (string-to-number
(read-string "Enter bug number: "
(thing-at-point 'word) nil))))
+ (when (stringp ids)
+ (setq ids (string-to-number ids)))
(unless (listp ids)
(setq ids (list ids)))
(gnus-read-ephemeral-bug-group
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 30ecc2befc7..175d9df5e8c 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -582,10 +582,11 @@ Create the thumbnails directory if it does not exist."
"Return the image descriptor for a thumbnail of image file FILE."
(unless (string-match (image-file-name-regexp) file)
(error "%s is not a valid image file" file))
- (let ((thumb-file (image-dired-thumb-name file)))
- (unless (and (file-exists-p thumb-file)
- (<= (float-time (nth 5 (file-attributes file)))
- (float-time (nth 5 (file-attributes thumb-file)))))
+ (let* ((thumb-file (image-dired-thumb-name file))
+ (thumb-attr (file-attributes thumb-file)))
+ (when (or (not thumb-attr)
+ (time-less-p (nth 5 thumb-attr)
+ (nth 5 (file-attributes file))))
(image-dired-create-thumb file thumb-file))
(create-image thumb-file)
;; (list 'image :type 'jpeg
@@ -748,10 +749,8 @@ Increase at own risk.")
'image-dired-cmd-create-thumbnail-program)
(let* ((width (int-to-string (image-dired-thumb-size 'width)))
(height (int-to-string (image-dired-thumb-size 'height)))
- (modif-time
- (format "%.0f"
- (ffloor (float-time
- (nth 5 (file-attributes original-file))))))
+ (modif-time (format-time-string
+ "%s" (nth 5 (file-attributes original-file))))
(thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
thumbnail-file))
(spec
diff --git a/lisp/info.el b/lisp/info.el
index 6f87adb04e8..e2f9953f7c7 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -649,7 +649,7 @@ Do the right thing if the file has been compressed or zipped."
(attribs-new (and (stringp fullname) (file-attributes fullname)))
(modtime-new (and attribs-new (nth 5 attribs-new))))
(when (and modtime-old modtime-new
- (> (float-time modtime-new) (float-time modtime-old)))
+ (time-less-p modtime-old modtime-new))
(setq Info-index-nodes (remove (assoc (or Info-current-file filename)
Info-index-nodes)
Info-index-nodes))
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 4abc571db44..5729f2fc8d3 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -111,6 +111,7 @@
;;; Code:
;; Customization:
+(require 'replace)
(defgroup kmacro nil
"Simplified keyboard macro user interface."
diff --git a/lisp/loadup.el b/lisp/loadup.el
index d048f0736be..40e5651aa1d 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -76,6 +76,7 @@
(setq max-lisp-eval-depth 2200)
(setq load-path (list (expand-file-name "." dir)
(expand-file-name "emacs-lisp" dir)
+ (expand-file-name "progmodes" dir)
(expand-file-name "language" dir)
(expand-file-name "international" dir)
(expand-file-name "textmodes" dir)
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 280e7f4bc3e..caddc7f760b 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -567,6 +567,8 @@ Responds to the window width as ls should but may not!"
(setq list (cdr list)))
result))
+(defvar w32-collate-ignore-punctuation) ; Declare for non-w32 builds.
+
(defsubst ls-lisp-string-lessp (s1 s2)
"Return t if string S1 should sort before string S2.
Case is significant if `ls-lisp-ignore-case' is nil.
@@ -861,7 +863,7 @@ Use the same method as ls to decide whether to show time-of-day or year,
depending on distance between file date and the current time.
All ls time options, namely c, t and u, are handled."
(let* ((time (nth (or time-index 5) file-attr)) ; default is last modtime
- (diff (- (float-time time) (float-time)))
+ (diff (time-subtract time nil))
;; Consider a time to be recent if it is within the past six
;; months. A Gregorian year has 365.2425 * 24 * 60 * 60 ==
;; 31556952 seconds on the average, and half of that is 15778476.
@@ -878,7 +880,8 @@ All ls time options, namely c, t and u, are handled."
(if (member locale '("C" "POSIX"))
(setq locale nil))
(format-time-string
- (if (and (<= past-cutoff diff) (<= diff 0))
+ (if (and (not (time-less-p diff past-cutoff))
+ (not (time-less-p 0 diff)))
(if (and locale (not ls-lisp-use-localized-time-format))
"%m-%d %H:%M"
(nth 0 ls-lisp-format-time-list))
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 73f62c85519..cf65e10e510 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3479,7 +3479,7 @@ system TYPE.")
(f2-mt (nth 5 (file-attributes f2))))
(cond ((null f1-mt) nil)
((null f2-mt) t)
- (t (> (float-time f1-mt) (float-time f2-mt)))))
+ (t (time-less-p f2-mt f1-mt))))
(ange-ftp-real-file-newer-than-file-p f1 f2))))
(defun ange-ftp-file-writable-p (file)
@@ -3561,7 +3561,7 @@ Value is (0 0) if the modification time cannot be determined."
(let ((file-mdtm (ange-ftp-file-modtime name))
(buf-mdtm (with-current-buffer buf (visited-file-modtime))))
(or (zerop (car file-mdtm))
- (<= (float-time file-mdtm) (float-time buf-mdtm))))
+ (not (time-less-p buf-mdtm file-mdtm))))
(ange-ftp-real-verify-visited-file-modtime buf))))
(defun ange-ftp-file-size (file &optional ascii-mode)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 5c785daa8a2..3b6b6c8c807 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2333,7 +2333,7 @@ With a prefix arg, prompt for new topic."
(defun rcirc-ctcp-sender-PING (process target _request)
"Send a CTCP PING message to TARGET."
- (let ((timestamp (format "%.0f" (float-time))))
+ (let ((timestamp (format-time-string "%s")))
(rcirc-send-ctcp process target "PING" timestamp)))
(defun rcirc-cmd-me (args &optional process target)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 214ad040a17..9326f7b1864 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -235,6 +235,12 @@ If NAME is a remote file name, the local part of NAME is unquoted."
((eq tramp-syntax 'sep) 'separate)
(t tramp-syntax)))
+;; `cl-struct-slot-info' has been introduced with Emacs 25.
+(defmacro tramp-compat-tramp-file-name-slots ()
+ (if (fboundp 'cl-struct-slot-info)
+ `(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))
+ `(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots)))))
+
(provide 'tramp-compat)
;;; TODO:
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c8b6e68f719..e300b3a58ed 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -660,7 +660,7 @@ Useful for \"rsync\" like methods.")
(make-variable-buffer-local 'tramp-temp-buffer-file-name)
(put 'tramp-temp-buffer-file-name 'permanent-local t)
-;;;###autoload
+;;;###tramp-autoload
(defcustom tramp-syntax 'default
"Tramp filename syntax to be used.
@@ -674,48 +674,54 @@ Do not change the value by `setq', it must be changed only by
`custom-set-variables'. See also `tramp-change-syntax'."
:group 'tramp
:version "26.1"
- :package-version '(Tramp . "2.3.2")
+ :package-version '(Tramp . "2.3.3")
:type '(choice (const :tag "Default" default)
(const :tag "Ange-FTP" simplified)
(const :tag "XEmacs" separate))
:require 'tramp
:initialize 'custom-initialize-set
- :set (lambda (symbol value)
- ;; Check allowed values.
- (unless (memq value (tramp-syntax-values))
- (tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
- ;; Cleanup existing buffers.
- (unless (eq (symbol-value symbol) value)
- (tramp-cleanup-all-buffers))
- ;; Set the value:
- (set-default symbol value)
- ;; Reset the depending variables.
- (with-no-warnings
- (setq tramp-prefix-format (tramp-build-prefix-format)
- tramp-prefix-regexp (tramp-build-prefix-regexp)
- tramp-method-regexp (tramp-build-method-regexp)
- tramp-postfix-method-format (tramp-build-postfix-method-format)
- tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
- tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
- tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
- tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
- tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
- tramp-postfix-host-format (tramp-build-postfix-host-format)
- tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
- tramp-remote-file-name-spec-regexp
- (tramp-build-remote-file-name-spec-regexp)
- tramp-file-name-structure (tramp-build-file-name-structure)
- tramp-file-name-regexp (tramp-build-file-name-regexp)
- tramp-completion-file-name-regexp
- (tramp-build-completion-file-name-regexp)))
- ;; Rearrange file name handlers.
- (tramp-register-file-name-handlers)))
+ :set 'tramp-set-syntax)
+
+(defun tramp-set-syntax (symbol value)
+ "Set SYMBOL to value VALUE.
+Used in user option `tramp-syntax'. There are further variables
+to be set, depending on VALUE."
+ ;; Check allowed values.
+ (unless (memq value (tramp-syntax-values))
+ (tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
+ ;; Cleanup existing buffers.
+ (unless (eq (symbol-value symbol) value)
+ (tramp-cleanup-all-buffers))
+ ;; Set the value:
+ (set-default symbol value)
+ ;; Reset the depending variables.
+ (with-no-warnings
+ (setq tramp-prefix-format (tramp-build-prefix-format)
+ tramp-prefix-regexp (tramp-build-prefix-regexp)
+ tramp-method-regexp (tramp-build-method-regexp)
+ tramp-postfix-method-format (tramp-build-postfix-method-format)
+ tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
+ tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
+ tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
+ tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
+ tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
+ tramp-postfix-host-format (tramp-build-postfix-host-format)
+ tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
+ tramp-remote-file-name-spec-regexp
+ (tramp-build-remote-file-name-spec-regexp)
+ tramp-file-name-structure (tramp-build-file-name-structure)
+ tramp-file-name-regexp (tramp-build-file-name-regexp)
+ tramp-completion-file-name-regexp
+ (tramp-build-completion-file-name-regexp)))
+ ;; Rearrange file name handlers.
+ (tramp-register-file-name-handlers))
;; Initialize the Tramp syntax variables. We want to override initial
-;; values of `tramp-file-name-regexp' and
-;; `tramp-completion-file-name-regexp'.
+;; value of `tramp-file-name-regexp'. Other Tramp syntax variables
+;; must be initialized as well to proper values. We do not call
+;; `custom-set-variable', this would load Tramp via custom.el.
(eval-after-load 'tramp
- '(custom-set-variables `(tramp-syntax ',(tramp-compat-tramp-syntax))))
+ '(tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
(defun tramp-syntax-values ()
"Return possible values of `tramp-syntax', a list"
@@ -978,7 +984,6 @@ This regexp should match Tramp file names but no other file
names. When calling `tramp-register-file-name-handlers', the
initial value is overwritten by the car of `tramp-file-name-structure'.")
-;;;###autoload
(defconst tramp-completion-file-name-regexp-default
(concat
"\\`/\\("
@@ -1042,10 +1047,19 @@ updated after changing this variable.
Also see `tramp-file-name-structure'.")
;;;###autoload
-(defconst tramp-initial-completion-file-name-regexp
- tramp-completion-file-name-regexp-default
- "Value for `tramp-completion-file-name-regexp' for autoload.
-It must match the initial `tramp-syntax' settings.")
+(defconst tramp-autoload-file-name-regexp
+ (concat
+ "\\`/"
+ (if (memq system-type '(cygwin windows-nt))
+ ;; The method is either "-", or at least two characters.
+ "\\(-\\|[^/|:]\\{2,\\}\\)"
+ ;; At least one character for method.
+ "[^/|:]+")
+ ":\\'")
+ "Regular expression matching file names handled by Tramp autoload.
+It must match the initial `tramp-syntax' settings. It should not
+match file names at root of the underlying local file system,
+like \"/sys\" or \"/C:\".")
;; Chunked sending kludge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
@@ -1186,7 +1200,6 @@ means to use always cached values for the directory contents."
(defvar tramp-current-connection nil
"Last connection timestamp.")
-;;;###autoload
(defconst tramp-completion-file-name-handler-alist
'((file-name-all-completions
. tramp-completion-handle-file-name-all-completions)
@@ -1740,20 +1753,20 @@ Second arg VAR is a symbol. It is used as a variable name to hold
the filename structure. It is also used as a prefix for the variables
holding the components. For example, if VAR is the symbol `foo', then
`foo' will be bound to the whole structure, `foo-method' will be bound to
-the method component, and so on for `foo-user', `foo-host', `foo-localname',
-`foo-hop'.
+the method component, and so on for `foo-user', `foo-domain', `foo-host',
+`foo-port', `foo-localname', `foo-hop'.
Remaining args are Lisp expressions to be evaluated (inside an implicit
`progn').
If VAR is nil, then we bind `v' to the structure and `method', `user',
-`host', `localname', `hop' to the components."
+`domain', `host', `port', `localname', `hop' to the components."
(let ((bindings
(mapcar (lambda (elem)
`(,(if var (intern (format "%s-%s" var elem)) elem)
(,(intern (format "tramp-file-name-%s" elem))
,(or var 'v))))
- '(method user domain host port localname hop))))
+ `,(tramp-compat-tramp-file-name-slots))))
`(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
,@bindings)
;; We don't know which of those vars will be used, so we bind them all,
@@ -2281,7 +2294,6 @@ Falls back to normal file name handler if no Tramp file name handler exists."
;; we don't do anything.
(tramp-run-real-handler operation args))))
-;;;###autoload
(defun tramp-completion-file-name-handler (operation &rest args)
"Invoke Tramp file name completion handler.
Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2304,17 +2316,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
(progn (defun tramp-register-autoload-file-name-handlers ()
"Add Tramp file name handlers to `file-name-handler-alist' during autoload."
(add-to-list 'file-name-handler-alist
- (cons tramp-initial-file-name-regexp
+ (cons tramp-autoload-file-name-regexp
'tramp-autoload-file-name-handler))
- (put 'tramp-autoload-file-name-handler 'safe-magic t)
-
- (add-to-list 'file-name-handler-alist
- (cons tramp-initial-completion-file-name-regexp
- 'tramp-completion-file-name-handler))
- (put 'tramp-completion-file-name-handler 'safe-magic t)
- ;; Mark `operations' the handler is responsible for.
- (put 'tramp-completion-file-name-handler 'operations
- (mapcar 'car tramp-completion-file-name-handler-alist))))
+ (put 'tramp-autoload-file-name-handler 'safe-magic t)))
;;;###autoload
(tramp-register-autoload-file-name-handlers)
@@ -2455,7 +2459,8 @@ not in completion mode."
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
-;; tramp-file-name structures. For all of them we return possible completions.
+;; `tramp-file-name' structures. For all of them we return possible
+;; completions.
(defun tramp-completion-handle-file-name-all-completions (filename directory)
"Like `file-name-all-completions' for partial Tramp files."
@@ -2536,9 +2541,9 @@ not in completion mode."
(tramp-connectable-p (expand-file-name filename directory)))
(lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
-;; I misuse a little bit the tramp-file-name structure in order to
+;; I misuse a little bit the `tramp-file-name' structure in order to
;; handle completion possibilities for partial methods / user names /
-;; host names. Return value is a list of tramp-file-name structures
+;; host names. Return value is a list of `tramp-file-name' structures
;; according to possible completions. If "localname" is non-nil it
;; means there shouldn't be a completion anymore.
@@ -3221,9 +3226,9 @@ User is always nil."
(car x)
(if (and (stringp (cdr x))
(file-name-absolute-p (cdr x))
- (not (tramp-file-name-p (cdr x))))
+ (not (tramp-tramp-file-p (cdr x))))
(tramp-make-tramp-file-name
- method user domain host port (cdr x))
+ method user domain host port (cdr x) hop)
(cdr x))))
tramp-backup-directory-alist)
backup-directory-alist)))
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 5c8bbebf31b..ca64b544200 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1852,7 +1852,7 @@ with a brace block."
;; struct, union, enum, or similar:
((looking-at c-type-prefix-key)
(let ((key-pos (point)))
- (c-forward-token-2 1) ; over "struct ".
+ (c-forward-over-token-and-ws) ; over "struct ".
(cond
((looking-at c-symbol-key) ; "struct foo { ..."
(buffer-substring-no-properties key-pos (match-end 0)))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 37928357526..457f95f2ca3 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -4297,6 +4297,47 @@ comment at the start of cc-engine.el for more info."
"\\w\\|\\s_\\|\\s\"\\|\\s|"
"\\w\\|\\s_\\|\\s\""))
+(defun c-forward-over-token-and-ws (&optional balanced)
+ "Move forward over a token and any following whitespace
+Return t if we moved, nil otherwise (i.e. we were at EOB, or a
+non-token or BALANCED is non-nil and we can't move). If we
+are at syntactic whitespace, move over this in place of a token.
+
+If BALANCED is non-nil move over any balanced parens we are at, and never move
+out of an enclosing paren.
+
+This function differs from `c-forward-token-2' in that it will move forward
+over the final token in a buffer, up to EOB."
+ (let ((jump-syntax (if balanced
+ c-jump-syntax-balanced
+ c-jump-syntax-unbalanced))
+ (here (point)))
+ (when
+ (condition-case nil
+ (cond
+ ((/= (point)
+ (progn (c-forward-syntactic-ws) (point)))
+ ;; If we're at whitespace, count this as the token.
+ t)
+ ((eobp) nil)
+ ((looking-at jump-syntax)
+ (goto-char (scan-sexps (point) 1))
+ t)
+ ((looking-at c-nonsymbol-token-regexp)
+ (goto-char (match-end 0))
+ t)
+ ((save-restriction
+ (widen)
+ (looking-at c-nonsymbol-token-regexp))
+ nil)
+ (t
+ (forward-char)
+ t))
+ (error (goto-char here)
+ nil))
+ (c-forward-syntactic-ws)
+ t)))
+
(defun c-forward-token-2 (&optional count balanced limit)
"Move forward by tokens.
A token is defined as all symbols and identifiers which aren't
@@ -4326,15 +4367,11 @@ comment at the start of cc-engine.el for more info."
(if (< count 0)
(- (c-backward-token-2 (- count) balanced limit))
- (let ((jump-syntax (if balanced
- c-jump-syntax-balanced
- c-jump-syntax-unbalanced))
- (last (point))
- (prev (point)))
-
- (if (zerop count)
- ;; If count is zero we should jump if in the middle of a token.
- (c-end-of-current-token))
+ (let ((here (point))
+ (last (point)))
+ (when (zerop count)
+ ;; If count is zero we should jump if in the middle of a token.
+ (c-end-of-current-token))
(save-restriction
(if limit (narrow-to-region (point-min) limit))
@@ -4348,43 +4385,15 @@ comment at the start of cc-engine.el for more info."
;; Moved out of bounds. Make sure the returned count isn't zero.
(progn
(if (zerop count) (setq count 1))
- (goto-char last))
-
- ;; Use `condition-case' to avoid having the limit tests
- ;; inside the loop.
- (condition-case nil
- (while (and
- (> count 0)
- (progn
- (setq last (point))
- (cond ((looking-at jump-syntax)
- (goto-char (scan-sexps (point) 1))
- t)
- ((looking-at c-nonsymbol-token-regexp)
- (goto-char (match-end 0))
- t)
- ;; `c-nonsymbol-token-regexp' above should always
- ;; match if there are correct tokens. Try to
- ;; widen to see if the limit was set in the
- ;; middle of one, else fall back to treating
- ;; the offending thing as a one character token.
- ((and limit
- (save-restriction
- (widen)
- (looking-at c-nonsymbol-token-regexp)))
- nil)
- (t
- (forward-char)
- t))))
- (c-forward-syntactic-ws)
- (setq prev last
- count (1- count)))
- (error (goto-char last)))
-
- (when (eobp)
- (goto-char prev)
- (setq count (1+ count)))))
-
+ (goto-char here))
+ (while (and
+ (> count 0)
+ (c-forward-over-token-and-ws balanced)
+ (not (eobp)))
+ (setq last (point)
+ count (1- count)))
+ (if (eobp)
+ (goto-char last))))
count)))
(defun c-backward-token-2 (&optional count balanced limit)
@@ -6424,7 +6433,8 @@ comment at the start of cc-engine.el for more info."
(not (eq (c-get-char-property (point) 'c-type)
'c-decl-arg-start)))))))
(or (c-forward-<>-arglist nil)
- (c-forward-token-2)))))
+ (c-forward-over-token-and-ws)
+ (goto-char c-new-END)))))
;; Functions to handle C++ raw strings.
@@ -7142,7 +7152,7 @@ comment at the start of cc-engine.el for more info."
(let ((c-promote-possible-types t)
(c-record-found-types t))
(c-forward-type))
- (c-forward-token-2))))
+ (c-forward-over-token-and-ws))))
(c-forward-syntactic-ws)
@@ -8102,12 +8112,14 @@ comment at the start of cc-engine.el for more info."
;; initializing brace lists.
(let (found)
(while
- (and (progn
+ (and (< (point) limit)
+ (progn
;; In the next loop, we keep searching forward whilst
;; we find ":"s which aren't single colons inside C++
;; "for" statements.
(while
(and
+ (< (point) limit)
(setq found
(c-syntactic-re-search-forward
"[;:,]\\|\\s)\\|\\(=\\|\\s(\\)"
@@ -8129,7 +8141,7 @@ comment at the start of cc-engine.el for more info."
(c-go-up-list-forward))
(setq brackets-after-id t))
(when found (backward-char))
- t))
+ (<= (point) limit)))
(list id-start id-end brackets-after-id (match-beginning 1) decorated)
(goto-char here)
@@ -9722,8 +9734,8 @@ comment at the start of cc-engine.el for more info."
;; identifiers?
(progn
(goto-char before-lparen)
- (c-forward-token-2) ; to first token inside parens
(and
+ (c-forward-over-token-and-ws) ; to first token inside parens
(setq id-start (c-on-identifier)) ; Must be at least one.
(catch 'id-list
(while
@@ -9735,7 +9747,7 @@ comment at the start of cc-engine.el for more info."
ids)
(c-forward-syntactic-ws)
(eq (char-after) ?\,))
- (c-forward-token-2)
+ (c-forward-over-token-and-ws)
(unless (setq id-start (c-on-identifier))
(throw 'id-list nil)))
(eq (char-after) ?\)))))
@@ -10525,10 +10537,10 @@ comment at the start of cc-engine.el for more info."
((and after-type-id-pos
(save-excursion
(when (eq (char-after) ?\;)
- (c-forward-token-2 1 t))
+ (c-forward-over-token-and-ws t))
(setq bufpos (point))
(when (looking-at c-opt-<>-sexp-key)
- (c-forward-token-2)
+ (c-forward-over-token-and-ws)
(when (and (eq (char-after) ?<)
(c-get-char-property (point) 'syntax-table))
(c-go-list-forward nil after-type-id-pos)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 02b685d240d..d352e5b08c9 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -292,12 +292,17 @@
nil)))))
res))))
- (defun c-make-font-lock-search-form (regexp highlights)
+ (defun c-make-font-lock-search-form (regexp highlights &optional check-point)
;; Return a lisp form which will fontify every occurrence of REGEXP
;; (a regular expression, NOT a function) between POINT and `limit'
;; with HIGHLIGHTS, a list of highlighters as specified on page
- ;; "Search-based Fontification" in the elisp manual.
- `(while (re-search-forward ,regexp limit t)
+ ;; "Search-based Fontification" in the elisp manual. If CHECK-POINT
+ ;; is non-nil, we will check (< (point) limit) in the main loop.
+ `(while
+ ,(if check-point
+ `(and (< (point) limit)
+ (re-search-forward ,regexp limit t))
+ `(re-search-forward ,regexp limit t))
(unless (progn
(goto-char (match-beginning 0))
(c-skip-comments-and-strings limit))
@@ -476,7 +481,9 @@
,(c-make-font-lock-search-form
regexp highlights)))))
state-stanzas)
- ,(c-make-font-lock-search-form (car normal) (cdr normal))
+ ;; In the next form, check that point hasn't been moved beyond
+ ;; `limit' in any of the above stanzas.
+ ,(c-make-font-lock-search-form (car normal) (cdr normal) t)
nil))))
; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
@@ -1062,7 +1069,7 @@ casts and declarations are fontified. Used on level 2 and higher."
;; The following `while' fontifies a single declarator id each time round.
;; It loops only when LIST is non-nil.
(while
- (and pos (setq decl-res (c-forward-declarator limit)))
+ (and pos (setq decl-res (c-forward-declarator)))
(setq next-pos (point)
id-start (car decl-res)
id-face (if (and (eq (char-after) ?\()
@@ -1091,7 +1098,7 @@ casts and declarations are fontified. Used on level 2 and higher."
(throw 'is-function nil))
((not (eq got-type 'maybe))
(throw 'is-function t)))
- (c-forward-declarator limit t)
+ (c-forward-declarator nil t)
(eq (char-after) ?,))
(forward-char)
(c-forward-syntactic-ws))
@@ -1730,7 +1737,7 @@ casts and declarations are fontified. Used on level 2 and higher."
(c-syntactic-skip-backward "^;{}" decl-search-lim)
(c-forward-syntactic-ws)
(setq in-typedef (looking-at c-typedef-key))
- (if in-typedef (c-forward-token-2))
+ (if in-typedef (c-forward-over-token-and-ws))
(when (and c-opt-block-decls-with-vars-key
(looking-at c-opt-block-decls-with-vars-key))
(goto-char ps-elt)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 2bbacf7bae4..1f86909362e 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1834,10 +1834,15 @@ This performs fontification according to `js--class-styles'."
(save-excursion
(back-to-indentation)
(if (js--looking-at-operator-p)
- (or (not (memq (char-after) '(?- ?+)))
- (progn
- (forward-comment (- (point)))
- (not (memq (char-before) '(?, ?\[ ?\()))))
+ (if (eq (char-after) ?/)
+ (prog1
+ (not (nth 3 (syntax-ppss (1+ (point)))))
+ (forward-char -1))
+ (or
+ (not (memq (char-after) '(?- ?+)))
+ (progn
+ (forward-comment (- (point)))
+ (not (memq (char-before) '(?, ?\[ ?\())))))
(and (js--find-newline-backward)
(progn
(skip-chars-backward " \t")
@@ -1972,8 +1977,12 @@ statement spanning multiple lines; otherwise, return nil."
(save-excursion
(back-to-indentation)
(when (not (looking-at js--declaration-keyword-re))
- (when (looking-at js--indent-operator-re)
- (goto-char (match-end 0)))
+ (let ((pt (point)))
+ (when (looking-at js--indent-operator-re)
+ (goto-char (match-end 0)))
+ ;; The "operator" is probably a regexp literal opener.
+ (when (nth 3 (syntax-ppss))
+ (goto-char pt)))
(while (and (not at-opening-bracket)
(not (bobp))
(let ((pos (point)))
diff --git a/lisp/replace.el b/lisp/replace.el
index a5548f461d8..cdaeb9240ad 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -28,6 +28,7 @@
;;; Code:
+(require 'text-mode)
(eval-when-compile (require 'cl-lib))
(defcustom case-replace t
diff --git a/lisp/server.el b/lisp/server.el
index 33800a98682..4c591a5ee7c 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -546,14 +546,15 @@ See variable `server-auth-dir' for details."
;; group recorded as the owner.
(/= uid 544) (/= (user-uid) 500)))
(format "it is not owned by you (owner = %s (%d))"
- (user-full-name (user-uid)) (user-uid)))
+ (user-full-name uid) uid))
(w32 nil) ; on NTFS?
((/= 0 (logand ?\077 (file-modes dir)))
(format "it is accessible by others (%03o)"
(file-modes dir)))
(t nil))))
(when unsafe
- (error "`%s' is not a safe directory because %s" dir unsafe)))))
+ (error "`%s' is not a safe directory because %s"
+ (expand-file-name dir) unsafe)))))
(defun server-generate-key ()
"Generate and return a random authentication key.
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index dafc0b2dca6..7300af06f49 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -349,7 +349,7 @@ In which case `remember-mailbox' should be the name of the mailbox.
Each piece of pseudo-mail created will have an `X-Todo-Priority'
field, for the purpose of appropriate splitting."
(let ((who (read-string "Who is this item related to? "))
- (moment (format "%.0f" (float-time)))
+ (moment (format-time-string "%s"))
(desc (remember-buffer-desc))
(text (buffer-string)))
(with-temp-buffer
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 0a3103264d9..fbd905b8bc7 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -210,7 +210,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
(let ((exp (url-cookie-expires cookie)))
(and (> (length exp) 0)
(condition-case ()
- (> (float-time) (float-time (date-to-time exp)))
+ (time-less-p nil (date-to-time exp))
(error nil)))))
(defun url-cookie-retrieve (host &optional localpart secure)
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el
index c28cf6c23a1..0b07bd0d1aa 100644
--- a/lisp/url/url-tramp.el
+++ b/lisp/url/url-tramp.el
@@ -37,33 +37,41 @@ They must also be covered by `url-handler-regexp'."
:type '(repeat string))
(defun url-tramp-convert-url-to-tramp (url)
- "Convert URL to a Tramp file name."
- (let ((obj (url-generic-parse-url (and (stringp url) url))))
- (if (member (url-type obj) url-tramp-protocols)
- (progn
- (if (url-password obj)
- (password-cache-add
- (tramp-make-tramp-file-name
- (url-type obj) (url-user obj) (url-host obj) "")
- (url-password obj))
- (tramp-make-tramp-file-name
- (url-type obj) (url-user obj) (url-host obj) (url-filename obj))))
- url)))
+ "Convert URL to a Tramp file name.
+If URL contains a password, it will be added to the `password-data' cache.
+In case URL is not convertable, nil is returned."
+ (let* ((obj (url-generic-parse-url (and (stringp url) url)))
+ (port
+ (and (natnump (url-portspec obj))
+ (number-to-string (url-portspec obj)))))
+ (when (member (url-type obj) url-tramp-protocols)
+ (when (url-password obj)
+ (password-cache-add
+ (tramp-make-tramp-file-name
+ (url-type obj) (url-user obj) nil
+ (url-host obj) port "")
+ (url-password obj)))
+ (tramp-make-tramp-file-name
+ (url-type obj) (url-user obj) nil
+ (url-host obj) port (url-filename obj)))))
(defun url-tramp-convert-tramp-to-url (file)
- "Convert FILE, a Tramp file name, to a URL."
- (let ((obj (ignore-errors (tramp-dissect-file-name file))))
- (if (member (tramp-file-name-method obj) url-tramp-protocols)
- (url-recreate-url
- (url-parse-make-urlobj
- (tramp-file-name-method obj)
- (tramp-file-name-user obj)
- nil ; password.
- (tramp-file-name-host obj)
- nil ; port.
- (tramp-file-name-localname obj)
- nil nil t)) ; target attributes fullness.
- file)))
+ "Convert FILE, a Tramp file name, to a URL.
+In case FILE is not convertable, nil is returned."
+ (let* ((obj (ignore-errors (tramp-dissect-file-name file)))
+ (port
+ (and (stringp (tramp-file-name-port obj))
+ (string-to-number (tramp-file-name-port obj)))))
+ (when (member (tramp-file-name-method obj) url-tramp-protocols)
+ (url-recreate-url
+ (url-parse-make-urlobj
+ (tramp-file-name-method obj)
+ (tramp-file-name-user obj)
+ nil ; password.
+ (tramp-file-name-host obj)
+ port
+ (tramp-file-name-localname obj)
+ nil nil t))))) ; target attributes fullness.
;;;###autoload
(defun url-tramp-file-handler (operation &rest args)
diff --git a/lisp/window.el b/lisp/window.el
index 5ba9a305f96..c0a9ecd093c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -320,22 +320,34 @@ WINDOW can be any window."
(defun window-normalize-buffer (buffer-or-name)
"Return buffer specified by BUFFER-OR-NAME.
-BUFFER-OR-NAME must be either a buffer or a string naming a live
-buffer and defaults to the current buffer."
- (cond
- ((not buffer-or-name)
- (current-buffer))
- ((bufferp buffer-or-name)
- (if (buffer-live-p buffer-or-name)
- buffer-or-name
- (error "Buffer %s is not a live buffer" buffer-or-name)))
- ((get-buffer buffer-or-name))
- (t
- (error "No such buffer %s" buffer-or-name))))
+BUFFER-OR-NAME must be a live buffer, a string naming a live
+buffer or nil which means to return the current buffer.
+
+This function is commonly used to process the (usually optional)
+\"BUFFER-OR-NAME\" argument of window related functions where nil
+stands for the current buffer."
+ (let ((buffer
+ (cond
+ ((not buffer-or-name)
+ (current-buffer))
+ ((bufferp buffer-or-name)
+ buffer-or-name)
+ ((stringp buffer-or-name)
+ (get-buffer buffer-or-name))
+ (t
+ (error "No such buffer %s" buffer-or-name)))))
+ (if (buffer-live-p buffer)
+ buffer
+ (error "No such live buffer %s" buffer-or-name))))
(defun window-normalize-frame (frame)
"Return frame specified by FRAME.
-FRAME must be a live frame and defaults to the selected frame."
+FRAME must be a live frame or nil which means to return the
+selected frame.
+
+This function is commonly used to process the (usually optional)
+\"FRAME\" argument of window and frame related functions where
+nil stands for the selected frame."
(if frame
(if (frame-live-p frame)
frame
@@ -343,11 +355,15 @@ FRAME must be a live frame and defaults to the selected frame."
(selected-frame)))
(defun window-normalize-window (window &optional live-only)
- "Return the window specified by WINDOW.
+ "Return window specified by WINDOW.
If WINDOW is nil, return the selected window. Otherwise, if
WINDOW is a live or an internal window, return WINDOW; if
LIVE-ONLY is non-nil, return WINDOW for a live window only.
-Otherwise, signal an error."
+Otherwise, signal an error.
+
+This function is commonly used to process the (usually optional)
+\"WINDOW\" argument of window related functions where nil stands
+for the selected window."
(cond
((null window)
(selected-window))
diff --git a/lisp/xdg.el b/lisp/xdg.el
index 4250faaeb4b..9edc3d2629c 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -94,8 +94,8 @@ file:///foo/bar.jpg"
(concat (md5 (xdg-thumb-uri filename)) ".png"))
(defun xdg-thumb-mtime (filename)
- "Return modification time of FILENAME as integral seconds from the epoch."
- (floor (float-time (nth 5 (file-attributes filename)))))
+ "Return modification time of FILENAME as an Emacs timestamp."
+ (file-attribute-modification-time (file-attributes filename)))
;; XDG User Directories