aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2017-09-25 11:19:07 -0700
committerPaul Eggert2017-09-25 11:19:07 -0700
commitabcb2e62dae6aa26308f7ac9efc89247f89cbe65 (patch)
treefd2c052c3ec67555b0a92dc86da7ecba9b1ab3f6 /lisp
parent0bd61c212fe53fb843a10da9a2da88e110d3785a (diff)
parent49cd561dc62ea6b3fbedab7aef0f020733f4cf09 (diff)
downloademacs-abcb2e62dae6aa26308f7ac9efc89247f89cbe65.tar.gz
emacs-abcb2e62dae6aa26308f7ac9efc89247f89cbe65.zip
Merge from origin/emacs-26
49cd561dc6 * test/lisp/tramp-tests.el (tramp-test21-file-links): Spec... b719f6b20b Loosen strict parsing requirement for desktop files c7a0c13777 * lisp/xdg.el (xdg-thumb-uri): Fix doc string. dc6b3560e5 Fix documentation of `make-frame' and related variables an... 3d3778d82a Accept new `always' value for option `buffer-offer-save' 638f64c40a Improve new NS scrolling variable names d93301242f Document 'replace-buffer-contents' in the manual. 00e4e3e9d2 Fix undecorated frame resizing issues on NS (bug#28512) 820739bbb5 ; * doc/emacs/display.texi (Display Custom): Fix wording. f2b2201594 ; Spelling and URL fixes 0e143b1fc5 Documentation improvements for 'display-line-numbers' f656ccdb43 ; Fix typo d64da52d57 Fix last change in bat-mode.el 908af46abd Fix restoring in GUI sessions desktop saved in TTY sessions 51cbd85454 Improve syntax highlighting in bat-mode 0273916618 Document the 'list-FOO' convention d24ec58540 Expose viewing conditions in CAM02-UCS metric a81d5a3d3f Revert "Set frame size to actual requested size (bug#18215)" 0bf066d4b2 Add tests for Edebug 68baca3ee1 Catch more messages in ert-with-message-capture 28e0c410c9 ; * lisp/mouse.el (secondary-selection-exist-p): Doc fix. 31e1d9ef2f Support setting region from secondary selection and vice v... 047f02f00f Fix new copy-directory bug with empty dirs fbd15836af * doc/lispref/strings.texi (Formatting Strings): Improve i... f16a8d5dbd Fix 2 testsuite tests for MS-Windows 965cffd89c Rename timer-list to list-timers a5fec62b51 Provide native touchpad scrolling on macOS 7b3d1c6beb Fix MinGW64 build broken by recent MinGW64 import libraries c83d0c5fdf Fix crashes in 'move-point-visually' in minibuffer windows 7f3d5f929d * src/emacs.c (usage_message): Don't mention 'find-file'. 6845282200 Fix a minor inaccuracy in the Emacs manual 74d7bb9498 Fix errors in flyspell-post-command-hook 40fdbb01d0 Work on Tramp's file-truename 1a01423b3c Fix bug with make-directory on MS-Windows root 066efb8666 Fix log-view-diff-common when point is after last entry 3f006b56cd Adapt fileio-tests--symlink-failure to Cygwin ee512e9a82 Ignore buffers whose name begins with a space in save-some... 9e1b5bd92c Improve tramp-interrupt-process robustness 8d4223e61b Minor Tramp doc update 331d0e520f Fix gensym 466df76f7d Cleanup in files-tests.el 6359fe630a Remove old cl-assert calls in 'newline' 059184e645 Avoid crash with C-g C-g in GC 541006c536 Fix format-time-string %Z bug with negative tz 679e05eeb9 message-citation-line-format %Z is now tz name 4e8888d438 Use doc-view or pdf-tools on any window-system 5f28f0db73 Fix bug with min and max and NaNs 37b5e661d2 Fix recently-introduced copy-directory bug 6bbbc38b34 Merge from Gnulib 57249fb297 Fix compatibility problem in Tramp 411bec82c4 Avoid GCC 7 compilation warning in eval.c 34a6774daa ; Partially revert c3445aed5194
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/cal-tex.el2
-rw-r--r--lisp/emacs-lisp/ert-x.el57
-rw-r--r--lisp/emacs-lisp/subr-x.el2
-rw-r--r--lisp/emacs-lisp/timer-list.el6
-rw-r--r--lisp/files.el42
-rw-r--r--lisp/frame.el20
-rw-r--r--lisp/frameset.el13
-rw-r--r--lisp/gnus/message.el1
-rw-r--r--lisp/mouse.el28
-rw-r--r--lisp/mwheel.el1
-rw-r--r--lisp/net/mailcap.el6
-rw-r--r--lisp/net/tramp-adb.el2
-rw-r--r--lisp/net/tramp-compat.el33
-rw-r--r--lisp/net/tramp-sh.el28
-rw-r--r--lisp/net/tramp-smb.el10
-rw-r--r--lisp/net/tramp.el33
-rw-r--r--lisp/org/ChangeLog.14
-rw-r--r--lisp/progmodes/bat-mode.el6
-rw-r--r--lisp/simple.el39
-rw-r--r--lisp/subr.el7
-rw-r--r--lisp/term/ns-win.el19
-rw-r--r--lisp/textmodes/ispell.el6
-rw-r--r--lisp/vc/log-view.el14
-rw-r--r--lisp/xdg.el4
24 files changed, 245 insertions, 138 deletions
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index 72db03e5e60..1d295606f23 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -266,7 +266,7 @@ specified in ARGS. When ARGS is omitted, by default the option
266\"12pt,a4paper\" is passed. When ARGS has any other value, then 266\"12pt,a4paper\" is passed. When ARGS has any other value, then
267no option is passed to the class. 267no option is passed to the class.
268 268
269Insert the \"\\usepacakge{geometry}\" directive when ARGS 269Insert the \"\\usepackage{geometry}\" directive when ARGS
270contains the \"landscape\" string." 270contains the \"landscape\" string."
271 (set-buffer (generate-new-buffer cal-tex-buffer)) 271 (set-buffer (generate-new-buffer cal-tex-buffer))
272 (save-match-data 272 (save-match-data
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index 6d9a7d9211a..71d46c11077 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -286,27 +286,60 @@ BUFFER defaults to current buffer. Does not modify BUFFER."
286 286
287 287
288(defmacro ert-with-message-capture (var &rest body) 288(defmacro ert-with-message-capture (var &rest body)
289 "Execute BODY while collecting anything written with `message' in VAR. 289 "Execute BODY while collecting messages in VAR.
290 290
291Capture all messages produced by `message' when it is called from 291Capture messages issued by Lisp code and concatenate them
292Lisp, and concatenate them separated by newlines into one string. 292separated by newlines into one string. This includes messages
293written by `message' as well as objects printed by `print',
294`prin1' and `princ' to the echo area. Messages issued from C
295code using the above mentioned functions will not be captured.
293 296
294This is useful for separating the issuance of messages by the 297This is useful for separating the issuance of messages by the
295code under test from the behavior of the *Messages* buffer." 298code under test from the behavior of the *Messages* buffer."
296 (declare (debug (symbolp body)) 299 (declare (debug (symbolp body))
297 (indent 1)) 300 (indent 1))
298 (let ((g-advice (gensym))) 301 (let ((g-message-advice (gensym))
302 (g-print-advice (gensym))
303 (g-collector (gensym)))
299 `(let* ((,var "") 304 `(let* ((,var "")
300 (,g-advice (lambda (func &rest args) 305 (,g-collector (lambda (msg) (setq ,var (concat ,var msg))))
301 (if (or (null args) (equal (car args) "")) 306 (,g-message-advice (ert--make-message-advice ,g-collector))
302 (apply func args) 307 (,g-print-advice (ert--make-print-advice ,g-collector)))
303 (let ((msg (apply #'format-message args))) 308 (advice-add 'message :around ,g-message-advice)
304 (setq ,var (concat ,var msg "\n")) 309 (advice-add 'prin1 :around ,g-print-advice)
305 (funcall func "%s" msg)))))) 310 (advice-add 'princ :around ,g-print-advice)
306 (advice-add 'message :around ,g-advice) 311 (advice-add 'print :around ,g-print-advice)
307 (unwind-protect 312 (unwind-protect
308 (progn ,@body) 313 (progn ,@body)
309 (advice-remove 'message ,g-advice))))) 314 (advice-remove 'print ,g-print-advice)
315 (advice-remove 'princ ,g-print-advice)
316 (advice-remove 'prin1 ,g-print-advice)
317 (advice-remove 'message ,g-message-advice)))))
318
319(defun ert--make-message-advice (collector)
320 "Create around advice for `message' for `ert-collect-messages'.
321COLLECTOR will be called with the message before it is passed
322to the real `message'."
323 (lambda (func &rest args)
324 (if (or (null args) (equal (car args) ""))
325 (apply func args)
326 (let ((msg (apply #'format-message args)))
327 (funcall collector (concat msg "\n"))
328 (funcall func "%s" msg)))))
329
330(defun ert--make-print-advice (collector)
331 "Create around advice for print functions for `ert-collect-messages'.
332The created advice function will just call the original function
333unless the output is going to the echo area (when PRINTCHARFUN is
334t or PRINTCHARFUN is nil and `standard-output' is t). If the
335output is destined for the echo area, the advice function will
336convert it to a string and pass it to COLLECTOR first."
337 (lambda (func object &optional printcharfun)
338 (if (not (eq t (or printcharfun standard-output)))
339 (funcall func object printcharfun)
340 (funcall collector (with-output-to-string
341 (funcall func object)))
342 (funcall func object printcharfun))))
310 343
311 344
312(provide 'ert-x) 345(provide 'ert-x)
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 077ad22c75d..edba6550fa2 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -128,7 +128,7 @@ binding value is nil. If all are non-nil, the value of THEN is
128returned, or the last form in ELSE is returned. 128returned, or the last form in ELSE is returned.
129 129
130Each element of VARLIST is a list (SYMBOL VALUEFORM) which binds 130Each element of VARLIST is a list (SYMBOL VALUEFORM) which binds
131SYMBOL to the value of VALUEFORM). An element can additionally 131SYMBOL to the value of VALUEFORM. An element can additionally
132be of the form (VALUEFORM), which is evaluated and checked for 132be of the form (VALUEFORM), which is evaluated and checked for
133nil; i.e. SYMBOL can be omitted if only the test result is of 133nil; i.e. SYMBOL can be omitted if only the test result is of
134interest." 134interest."
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index 44a315f9806..69c67419835 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -25,7 +25,7 @@
25;;; Code: 25;;; Code:
26 26
27;;;###autoload 27;;;###autoload
28(defun timer-list (&optional _ignore-auto _nonconfirm) 28(defun list-timers (&optional _ignore-auto _nonconfirm)
29 "List all timers in a buffer." 29 "List all timers in a buffer."
30 (interactive) 30 (interactive)
31 (pop-to-buffer-same-window (get-buffer-create "*timer-list*")) 31 (pop-to-buffer-same-window (get-buffer-create "*timer-list*"))
@@ -67,7 +67,7 @@
67 (goto-char (point-min))) 67 (goto-char (point-min)))
68;; This command can be destructive if they don't know what they are 68;; This command can be destructive if they don't know what they are
69;; doing. Kids, don't try this at home! 69;; doing. Kids, don't try this at home!
70;;;###autoload (put 'timer-list 'disabled "Beware: manually canceling timers can ruin your Emacs session.") 70;;;###autoload (put 'list-timers 'disabled "Beware: manually canceling timers can ruin your Emacs session.")
71 71
72(defvar timer-list-mode-map 72(defvar timer-list-mode-map
73 (let ((map (make-sparse-keymap))) 73 (let ((map (make-sparse-keymap)))
@@ -84,7 +84,7 @@
84 (setq bidi-paragraph-direction 'left-to-right) 84 (setq bidi-paragraph-direction 'left-to-right)
85 (setq truncate-lines t) 85 (setq truncate-lines t)
86 (buffer-disable-undo) 86 (buffer-disable-undo)
87 (setq-local revert-buffer-function 'timer-list) 87 (setq-local revert-buffer-function #'list-timers)
88 (setq buffer-read-only t) 88 (setq buffer-read-only t)
89 (setq header-line-format 89 (setq header-line-format
90 (format "%4s %10s %8s %s" 90 (format "%4s %10s %8s %s"
diff --git a/lisp/files.el b/lisp/files.el
index fe7cb1a8a94..336bbc8648d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -150,8 +150,13 @@ Called with an absolute file name as argument, it returns t to enable backup.")
150(defcustom buffer-offer-save nil 150(defcustom buffer-offer-save nil
151 "Non-nil in a buffer means always offer to save buffer on exit. 151 "Non-nil in a buffer means always offer to save buffer on exit.
152Do so even if the buffer is not visiting a file. 152Do so even if the buffer is not visiting a file.
153Automatically local in all buffers." 153Automatically local in all buffers.
154 :type 'boolean 154
155Set to the symbol `always' to offer to save buffer whenever
156`save-some-buffers' is called."
157 :type '(choice (const :tag "Never" nil)
158 (const :tag "On Emacs exit" t)
159 (const :tag "Whenever save-some-buffers is called" always))
155 :group 'backup) 160 :group 'backup)
156(make-variable-buffer-local 'buffer-offer-save) 161(make-variable-buffer-local 'buffer-offer-save)
157(put 'buffer-offer-save 'permanent-local t) 162(put 'buffer-offer-save 'permanent-local t)
@@ -5190,12 +5195,9 @@ change the additional actions you can take on files."
5190 (not (buffer-base-buffer buffer)) 5195 (not (buffer-base-buffer buffer))
5191 (or 5196 (or
5192 (buffer-file-name buffer) 5197 (buffer-file-name buffer)
5193 (and pred 5198 (with-current-buffer buffer
5194 (progn 5199 (or (eq buffer-offer-save 'always)
5195 (set-buffer buffer) 5200 (and pred buffer-offer-save (> (buffer-size) 0)))))
5196 (and buffer-offer-save (> (buffer-size) 0))))
5197 (buffer-local-value
5198 'write-contents-functions buffer))
5199 (or (not (functionp pred)) 5201 (or (not (functionp pred))
5200 (with-current-buffer buffer (funcall pred))) 5202 (with-current-buffer buffer (funcall pred)))
5201 (if arg 5203 (if arg
@@ -5336,7 +5338,7 @@ instance of such commands."
5336 "Make directory DIR if it is not already a directory. Return nil." 5338 "Make directory DIR if it is not already a directory. Return nil."
5337 (condition-case err 5339 (condition-case err
5338 (make-directory-internal dir) 5340 (make-directory-internal dir)
5339 (file-already-exists 5341 (error
5340 (unless (file-directory-p dir) 5342 (unless (file-directory-p dir)
5341 (signal (car err) (cdr err)))))) 5343 (signal (car err) (cdr err))))))
5342 5344
@@ -5372,7 +5374,7 @@ raised."
5372 (while (progn 5374 (while (progn
5373 (setq parent (directory-file-name 5375 (setq parent (directory-file-name
5374 (file-name-directory dir))) 5376 (file-name-directory dir)))
5375 (condition-case err 5377 (condition-case ()
5376 (files--ensure-directory dir) 5378 (files--ensure-directory dir)
5377 (file-missing 5379 (file-missing
5378 ;; Do not loop if root does not exist (Bug#2309). 5380 ;; Do not loop if root does not exist (Bug#2309).
@@ -5544,16 +5546,14 @@ into NEWNAME instead."
5544 ;; If NEWNAME is not a directory name, create it; 5546 ;; If NEWNAME is not a directory name, create it;
5545 ;; that is where we will copy the files of DIRECTORY. 5547 ;; that is where we will copy the files of DIRECTORY.
5546 (make-directory newname parents)) 5548 (make-directory newname parents))
5547 ;; If NEWNAME is a directory name and COPY-CONTENTS 5549 ;; NEWNAME is a directory name. If COPY-CONTENTS is non-nil,
5548 ;; is nil, copy into NEWNAME/[DIRECTORY-BASENAME]. 5550 ;; create NEWNAME if it is not already a directory;
5549 ((not copy-contents) 5551 ;; otherwise, create NEWNAME/[DIRECTORY-BASENAME].
5550 (setq newname (concat newname 5552 ((if copy-contents
5551 (file-name-nondirectory directory))) 5553 (or parents (not (file-directory-p newname)))
5552 (and (file-exists-p newname) 5554 (setq newname (concat newname
5553 (not (file-directory-p newname)) 5555 (file-name-nondirectory directory))))
5554 (error "Cannot overwrite non-directory %s with a directory" 5556 (make-directory (directory-file-name newname) parents)))
5555 newname))
5556 (make-directory newname t)))
5557 5557
5558 ;; Copy recursively. 5558 ;; Copy recursively.
5559 (dolist (file 5559 (dolist (file
@@ -5565,7 +5565,7 @@ into NEWNAME instead."
5565 (filetype (car (file-attributes file)))) 5565 (filetype (car (file-attributes file))))
5566 (cond 5566 (cond
5567 ((eq filetype t) ; Directory but not a symlink. 5567 ((eq filetype t) ; Directory but not a symlink.
5568 (copy-directory file newname keep-time parents)) 5568 (copy-directory file target keep-time parents t))
5569 ((stringp filetype) ; Symbolic link 5569 ((stringp filetype) ; Symbolic link
5570 (make-symbolic-link filetype target t)) 5570 (make-symbolic-link filetype target t))
5571 ((copy-file file target t keep-time))))) 5571 ((copy-file file target t keep-time)))))
diff --git a/lisp/frame.el b/lisp/frame.el
index 5f0e97d5b07..76c1842455c 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -604,11 +604,12 @@ new frame."
604 (select-frame (make-frame)))) 604 (select-frame (make-frame))))
605 605
606(defvar before-make-frame-hook nil 606(defvar before-make-frame-hook nil
607 "Functions to run before a frame is created.") 607 "Functions to run before `make-frame' creates a new frame.")
608 608
609(defvar after-make-frame-functions nil 609(defvar after-make-frame-functions nil
610 "Functions to run after a frame is created. 610 "Functions to run after `make-frame' created a new frame.
611The functions are run with one arg, the newly created frame.") 611The functions are run with one argument, the newly created
612frame.")
612 613
613(defvar after-setting-font-hook nil 614(defvar after-setting-font-hook nil
614 "Functions to run after a frame's font has been changed.") 615 "Functions to run after a frame's font has been changed.")
@@ -617,7 +618,7 @@ The functions are run with one arg, the newly created frame.")
617(define-obsolete-function-alias 'new-frame 'make-frame "22.1") 618(define-obsolete-function-alias 'new-frame 'make-frame "22.1")
618 619
619(defvar frame-inherited-parameters '() 620(defvar frame-inherited-parameters '()
620 "Parameters `make-frame' copies from the `selected-frame' to the new frame.") 621 "Parameters `make-frame' copies from the selected to the new frame.")
621 622
622(defvar x-display-name) 623(defvar x-display-name)
623 624
@@ -632,9 +633,6 @@ form (NAME . VALUE), for example:
632 (width . NUMBER) The frame should be NUMBER characters in width. 633 (width . NUMBER) The frame should be NUMBER characters in width.
633 (height . NUMBER) The frame should be NUMBER text lines high. 634 (height . NUMBER) The frame should be NUMBER text lines high.
634 635
635You cannot specify either `width' or `height', you must specify
636neither or both.
637
638 (minibuffer . t) The frame should have a minibuffer. 636 (minibuffer . t) The frame should have a minibuffer.
639 (minibuffer . nil) The frame should have no minibuffer. 637 (minibuffer . nil) The frame should have no minibuffer.
640 (minibuffer . only) The frame should contain only a minibuffer. 638 (minibuffer . only) The frame should contain only a minibuffer.
@@ -650,10 +648,10 @@ neither or both.
650In addition, any parameter specified in `default-frame-alist', 648In addition, any parameter specified in `default-frame-alist',
651but not present in PARAMETERS, is applied. 649but not present in PARAMETERS, is applied.
652 650
653Before creating the frame (via `frame-creation-function-alist'), 651Before creating the frame (via `frame-creation-function'), this
654this function runs the hook `before-make-frame-hook'. After 652function runs the hook `before-make-frame-hook'. After creating
655creating the frame, it runs the hook `after-make-frame-functions' 653the frame, it runs the hook `after-make-frame-functions' with one
656with one arg, the newly created frame. 654argument, the newly created frame.
657 655
658If a display parameter is supplied and a window-system is not, 656If a display parameter is supplied and a window-system is not,
659guess the window-system from the display. 657guess the window-system from the display.
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 661f0aee273..593451a4d75 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -447,7 +447,7 @@ DO NOT MODIFY. See `frameset-filter-alist' for a full description.")
447 (buffer-predicate . :never) 447 (buffer-predicate . :never)
448 (buried-buffer-list . :never) 448 (buried-buffer-list . :never)
449 (delete-before . :never) 449 (delete-before . :never)
450 (font . frameset-filter-shelve-param) 450 (font . frameset-filter-font-param)
451 (foreground-color . frameset-filter-sanitize-color) 451 (foreground-color . frameset-filter-sanitize-color)
452 (fullscreen . frameset-filter-shelve-param) 452 (fullscreen . frameset-filter-shelve-param)
453 (GUI:font . frameset-filter-unshelve-param) 453 (GUI:font . frameset-filter-unshelve-param)
@@ -631,6 +631,17 @@ see `frameset-filter-alist'."
631 (setcdr found val) 631 (setcdr found val)
632 nil)))) 632 nil))))
633 633
634(defun frameset-filter-font-param (current filtered parameters saving
635 &optional prefix)
636 "When switching from a tty frame to a GUI frame, remove the FONT param.
637
638When switching from a GUI frame to a tty frame, behave
639as `frameset-filter-shelve-param' does."
640 (or saving
641 (if (frameset-switch-to-gui-p parameters)
642 (frameset-filter-shelve-param current filtered parameters saving
643 prefix))))
644
634(defun frameset-filter-iconified (_current _filtered parameters saving) 645(defun frameset-filter-iconified (_current _filtered parameters saving)
635 "Remove CURRENT when saving an iconified frame. 646 "Remove CURRENT when saving an iconified frame.
636This is used for positional parameters `left' and `top', which are 647This is used for positional parameters `left' and `top', which are
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 690dd28c8a4..a9e66cede16 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -991,7 +991,6 @@ are replaced:
991 %F The first name if present, e.g.: \"John\", else fall 991 %F The first name if present, e.g.: \"John\", else fall
992 back to the mail address. 992 back to the mail address.
993 %L The last name if present, e.g.: \"Doe\". 993 %L The last name if present, e.g.: \"Doe\".
994 %Z, %z The time zone in the numeric form, e.g.:\"+0000\".
995 994
996All other format specifiers are passed to `format-time-string' 995All other format specifiers are passed to `format-time-string'
997which is called using the date from the article your replying to, but 996which is called using the date from the article your replying to, but
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3f448f018a4..169d2632f4f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1916,6 +1916,34 @@ CLICK position, kill the secondary selection."
1916 (> (length str) 0) 1916 (> (length str) 0)
1917 (gui-set-selection 'SECONDARY str)))) 1917 (gui-set-selection 'SECONDARY str))))
1918 1918
1919(defun secondary-selection-exist-p ()
1920 "Return non-nil if the secondary selection exists in the current buffer."
1921 (memq mouse-secondary-overlay (overlays-in (point-min) (point-max))))
1922
1923(defun secondary-selection-to-region ()
1924 "Set beginning and end of the region to those of the secondary selection.
1925This puts mark and point at the beginning and the end of the
1926secondary selection, respectively. This works when the secondary
1927selection exists and the region does not exist in current buffer;
1928the secondary selection will be deleted afterward.
1929If the region is active, or the secondary selection doesn't exist,
1930this function does nothing."
1931 (when (and (not (region-active-p))
1932 (secondary-selection-exist-p))
1933 (let ((beg (overlay-start mouse-secondary-overlay))
1934 (end (overlay-end mouse-secondary-overlay)))
1935 (push-mark beg t t)
1936 (goto-char end))
1937 ;; Delete the secondary selection on current buffer.
1938 (delete-overlay mouse-secondary-overlay)))
1939
1940(defun secondary-selection-from-region ()
1941 "Set beginning and end of the secondary selection to those of the region.
1942When there is no region, this function does nothing."
1943 (when (region-active-p) ; Create the secondary selection from the region.
1944 (delete-overlay mouse-secondary-overlay) ; Delete the secondary selection even on a different buffer.
1945 (move-overlay mouse-secondary-overlay (region-beginning) (region-end))))
1946
1919 1947
1920(defcustom mouse-buffer-menu-maxlen 20 1948(defcustom mouse-buffer-menu-maxlen 20
1921 "Number of buffers in one pane (submenu) of the buffer menu. 1949 "Number of buffers in one pane (submenu) of the buffer menu.
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 2956ba55162..0c0dcb3beb1 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -232,6 +232,7 @@ non-Windows systems."
232 ;; When the double-mouse-N comes in, a mouse-N has been executed already, 232 ;; When the double-mouse-N comes in, a mouse-N has been executed already,
233 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...). 233 ;; So by adding things up we get a squaring up (1, 3, 6, 10, 15, ...).
234 (setq amt (* amt (event-click-count event)))) 234 (setq amt (* amt (event-click-count event))))
235 (when (numberp amt) (setq amt (* amt (event-line-count event))))
235 (unwind-protect 236 (unwind-protect
236 (let ((button (mwheel-event-button event))) 237 (let ((button (mwheel-event-button event)))
237 (cond ((eq button mouse-wheel-down-event) 238 (cond ((eq button mouse-wheel-down-event)
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index ed35c220ec5..86587466ef5 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -165,9 +165,13 @@ is consulted."
165 (type . "application/zip") 165 (type . "application/zip")
166 ("copiousoutput")) 166 ("copiousoutput"))
167 ("pdf" 167 ("pdf"
168 (viewer . pdf-view-mode)
169 (type . "application/pdf")
170 (test . window-system))
171 ("pdf"
168 (viewer . doc-view-mode) 172 (viewer . doc-view-mode)
169 (type . "application/pdf") 173 (type . "application/pdf")
170 (test . (eq window-system 'x))) 174 (test . window-system))
171 ("pdf" 175 ("pdf"
172 (viewer . "gv -safer %s") 176 (viewer . "gv -safer %s")
173 (type . "application/pdf") 177 (type . "application/pdf")
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index c22869d2cc2..760d020f672 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -740,7 +740,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
740 740
741 ;; Remote newname. 741 ;; Remote newname.
742 (when (and (file-directory-p newname) 742 (when (and (file-directory-p newname)
743 (directory-name-p newname)) 743 (tramp-compat-directory-name-p newname))
744 (setq newname 744 (setq newname
745 (expand-file-name 745 (expand-file-name
746 (file-name-nondirectory filename) newname))) 746 (file-name-nondirectory filename) newname)))
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 5d9a1fd1967..214ad040a17 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -23,8 +23,9 @@
23 23
24;;; Commentary: 24;;; Commentary:
25 25
26;; Tramp's main Emacs version for development is Emacs 26. This 26;; Tramp's main Emacs version for development is Emacs 27. This
27;; package provides compatibility functions for Emacs 24 and Emacs 25. 27;; package provides compatibility functions for Emacs 24, Emacs 25 and
28;; Emacs 26.
28 29
29;;; Code: 30;;; Code:
30 31
@@ -104,6 +105,10 @@ Add the extension of F, if existing."
104 'tramp-error vec-or-proc 105 'tramp-error vec-or-proc
105 (if (fboundp 'user-error) 'user-error 'error) format args)) 106 (if (fboundp 'user-error) 'user-error 'error) format args))
106 107
108;; `default-toplevel-value' has been declared in Emacs 24.4.
109(unless (fboundp 'default-toplevel-value)
110 (defalias 'default-toplevel-value 'symbol-value))
111
107;; `file-attribute-*' are introduced in Emacs 25.1. 112;; `file-attribute-*' are introduced in Emacs 25.1.
108 113
109(if (fboundp 'file-attribute-type) 114(if (fboundp 'file-attribute-type)
@@ -163,14 +168,23 @@ This is a floating point number if the size is too large for an integer."
163This is a string of ten letters or dashes as in ls -l." 168This is a string of ten letters or dashes as in ls -l."
164 (nth 8 attributes))) 169 (nth 8 attributes)))
165 170
166;; `default-toplevel-value' has been declared in Emacs 24.4.
167(unless (fboundp 'default-toplevel-value)
168 (defalias 'default-toplevel-value 'symbol-value))
169
170;; `format-message' is new in Emacs 25.1. 171;; `format-message' is new in Emacs 25.1.
171(unless (fboundp 'format-message) 172(unless (fboundp 'format-message)
172 (defalias 'format-message 'format)) 173 (defalias 'format-message 'format))
173 174
175;; `directory-name-p' is new in Emacs 25.1.
176(if (fboundp 'directory-name-p)
177 (defalias 'tramp-compat-directory-name-p 'directory-name-p)
178 (defsubst tramp-compat-directory-name-p (name)
179 "Return non-nil if NAME ends with a directory separator character."
180 (let ((len (length name))
181 (lastc ?.))
182 (if (> len 0)
183 (setq lastc (aref name (1- len))))
184 (or (= lastc ?/)
185 (and (memq system-type '(windows-nt ms-dos))
186 (= lastc ?\\))))))
187
174;; `file-missing' is introduced in Emacs 26.1. 188;; `file-missing' is introduced in Emacs 26.1.
175(defconst tramp-file-missing 189(defconst tramp-file-missing
176 (if (get 'file-missing 'error-conditions) 'file-missing 'file-error) 190 (if (get 'file-missing 'error-conditions) 'file-missing 'file-error)
@@ -221,13 +235,6 @@ If NAME is a remote file name, the local part of NAME is unquoted."
221 ((eq tramp-syntax 'sep) 'separate) 235 ((eq tramp-syntax 'sep) 'separate)
222 (t tramp-syntax))) 236 (t tramp-syntax)))
223 237
224;; Older Emacsen keep incompatible autoloaded values of `tramp-syntax'.
225(eval-after-load 'tramp
226 '(unless
227 (memq tramp-syntax (tramp-compat-funcall (quote tramp-syntax-values)))
228 (tramp-compat-funcall
229 (quote tramp-change-syntax) (tramp-compat-tramp-syntax))))
230
231(provide 'tramp-compat) 238(provide 'tramp-compat)
232 239
233;;; TODO: 240;;; TODO:
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 7df5aa3b7b0..a744a53ca42 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -613,7 +613,7 @@ use Cwd \"realpath\";
613 613
614sub myrealpath { 614sub myrealpath {
615 my ($file) = @_; 615 my ($file) = @_;
616 return realpath($file) if -e $file; 616 return realpath($file) if (-e $file || -l $file);
617} 617}
618 618
619sub recursive { 619sub recursive {
@@ -1139,12 +1139,7 @@ component is used as the target of the symlink."
1139 (tramp-shell-quote-argument localname))) 1139 (tramp-shell-quote-argument localname)))
1140 (with-current-buffer (tramp-get-connection-buffer v) 1140 (with-current-buffer (tramp-get-connection-buffer v)
1141 (goto-char (point-min)) 1141 (goto-char (point-min))
1142 (setq result (buffer-substring (point-min) (point-at-eol)))) 1142 (setq result (buffer-substring (point-min) (point-at-eol)))))
1143 (when (and (file-symlink-p filename)
1144 (string-equal result localname))
1145 (tramp-error
1146 v 'file-error
1147 "Apparent cycle of symbolic links for %s" filename)))
1148 1143
1149 ;; Use Perl implementation. 1144 ;; Use Perl implementation.
1150 ((and (tramp-get-remote-perl v) 1145 ((and (tramp-get-remote-perl v)
@@ -1198,16 +1193,6 @@ component is used as the target of the symlink."
1198 (setq numchase (1+ numchase)) 1193 (setq numchase (1+ numchase))
1199 (when (file-name-absolute-p symlink-target) 1194 (when (file-name-absolute-p symlink-target)
1200 (setq result nil)) 1195 (setq result nil))
1201 ;; If the symlink was absolute, we'll get a
1202 ;; string like "/user@host:/some/target";
1203 ;; extract the "/some/target" part from it.
1204 (when (tramp-tramp-file-p symlink-target)
1205 (unless (tramp-equal-remote filename symlink-target)
1206 (tramp-error
1207 v 'file-error
1208 "Symlink target `%s' on wrong host"
1209 symlink-target))
1210 (setq symlink-target localname))
1211 (setq steps 1196 (setq steps
1212 (append 1197 (append
1213 (split-string symlink-target "/" 'omit) steps))) 1198 (split-string symlink-target "/" 'omit) steps)))
@@ -1226,6 +1211,13 @@ component is used as the target of the symlink."
1226 "/")) 1211 "/"))
1227 (when (string= "" result) 1212 (when (string= "" result)
1228 (setq result "/"))))) 1213 (setq result "/")))))
1214
1215 ;; Detect cycle.
1216 (when (and (file-symlink-p filename)
1217 (string-equal result localname))
1218 (tramp-error
1219 v 'file-error
1220 "Apparent cycle of symbolic links for %s" filename))
1229 ;; If the resulting localname looks remote, we must quote it 1221 ;; If the resulting localname looks remote, we must quote it
1230 ;; for security reasons. 1222 ;; for security reasons.
1231 (when (or quoted (file-remote-p result)) 1223 (when (or quoted (file-remote-p result))
@@ -1985,7 +1977,7 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
1985 ;; scp or rsync DTRT. 1977 ;; scp or rsync DTRT.
1986 (progn 1978 (progn
1987 (when (and (file-directory-p newname) 1979 (when (and (file-directory-p newname)
1988 (not (directory-name-p newname))) 1980 (not (tramp-compat-directory-name-p newname)))
1989 (tramp-error v 'file-already-exists newname)) 1981 (tramp-error v 'file-already-exists newname))
1990 (setq dirname (directory-file-name (expand-file-name dirname)) 1982 (setq dirname (directory-file-name (expand-file-name dirname))
1991 newname (directory-file-name (expand-file-name newname))) 1983 newname (directory-file-name (expand-file-name newname)))
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 49695666707..35aa8110946 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -415,7 +415,7 @@ pass to the OPERATION."
415 (with-tramp-progress-reporter 415 (with-tramp-progress-reporter
416 v 0 (format "Copying %s to %s" dirname newname) 416 v 0 (format "Copying %s to %s" dirname newname)
417 (when (and (file-directory-p newname) 417 (when (and (file-directory-p newname)
418 (not (directory-name-p newname))) 418 (not (tramp-compat-directory-name-p newname)))
419 (tramp-error v 'file-already-exists newname)) 419 (tramp-error v 'file-already-exists newname))
420 (cond 420 (cond
421 ;; We must use a local temporary directory. 421 ;; We must use a local temporary directory.
@@ -535,7 +535,7 @@ pass to the OPERATION."
535 ;; Reset the transfer process properties. 535 ;; Reset the transfer process properties.
536 (tramp-set-connection-property v "process-name" nil) 536 (tramp-set-connection-property v "process-name" nil)
537 (tramp-set-connection-property v "process-buffer" nil) 537 (tramp-set-connection-property v "process-buffer" nil)
538 (when t1 (delete-directory tmpdir 'recurse)))) 538 (when t1 (delete-directory tmpdir 'recursive))))
539 539
540 ;; Handle KEEP-DATE argument. 540 ;; Handle KEEP-DATE argument.
541 (when keep-date 541 (when keep-date
@@ -586,7 +586,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
586 586
587 ;; Remote newname. 587 ;; Remote newname.
588 (when (and (file-directory-p newname) 588 (when (and (file-directory-p newname)
589 (directory-name-p newname)) 589 (tramp-compat-directory-name-p newname))
590 (setq newname 590 (setq newname
591 (expand-file-name (file-name-nondirectory filename) newname))) 591 (expand-file-name (file-name-nondirectory filename) newname)))
592 592
@@ -1583,6 +1583,10 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
1583 "Read entries which match DIRECTORY. 1583 "Read entries which match DIRECTORY.
1584Either the shares are listed, or the `dir' command is executed. 1584Either the shares are listed, or the `dir' command is executed.
1585Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)." 1585Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
1586 ;; If CIFS capabilities are enabled, symlinks are not listed
1587 ;; by `dir'. This is a consequence of
1588 ;; <https://www.samba.org/samba/news/symlink_attack.html>. See also
1589 ;; <https://bugzilla.samba.org/show_bug.cgi?id=5116>.
1586 (with-parsed-tramp-file-name (file-name-as-directory directory) nil 1590 (with-parsed-tramp-file-name (file-name-as-directory directory) nil
1587 (setq localname (or localname "/")) 1591 (setq localname (or localname "/"))
1588 (with-tramp-file-property v localname "file-entries" 1592 (with-tramp-file-property v localname "file-entries"
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 45776078be3..3573eeb7d49 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3169,7 +3169,7 @@ User is always nil."
3169 3169
3170(defun tramp-handle-file-truename (filename) 3170(defun tramp-handle-file-truename (filename)
3171 "Like `file-truename' for Tramp files." 3171 "Like `file-truename' for Tramp files."
3172 (let ((result filename) 3172 (let ((result (expand-file-name filename))
3173 (numchase 0) 3173 (numchase 0)
3174 ;; Don't make the following value larger than 3174 ;; Don't make the following value larger than
3175 ;; necessary. People expect an error message in a 3175 ;; necessary. People expect an error message in a
@@ -3180,7 +3180,7 @@ User is always nil."
3180 symlink-target) 3180 symlink-target)
3181 (format 3181 (format
3182 "%s%s" 3182 "%s%s"
3183 (with-parsed-tramp-file-name (expand-file-name result) v1 3183 (with-parsed-tramp-file-name result v1
3184 (with-tramp-file-property v1 v1-localname "file-truename" 3184 (with-tramp-file-property v1 v1-localname "file-truename"
3185 (while (and (setq symlink-target (file-symlink-p result)) 3185 (while (and (setq symlink-target (file-symlink-p result))
3186 (< numchase numchase-limit)) 3186 (< numchase numchase-limit))
@@ -3850,7 +3850,7 @@ Erase echoed commands if exists."
3850 (min (+ (point-min) tramp-echo-mark-marker-length) 3850 (min (+ (point-min) tramp-echo-mark-marker-length)
3851 (point-max)))))) 3851 (point-max))))))
3852 ;; No echo to be handled, now we can look for the regexp. 3852 ;; No echo to be handled, now we can look for the regexp.
3853 ;; Sometimes, lines are much to long, and we run into a "Stack 3853 ;; Sometimes, lines are much too long, and we run into a "Stack
3854 ;; overflow in regexp matcher". For example, //DIRED// lines of 3854 ;; overflow in regexp matcher". For example, //DIRED// lines of
3855 ;; directory listings with some thousand files. Therefore, we 3855 ;; directory listings with some thousand files. Therefore, we
3856 ;; look from the end. 3856 ;; look from the end.
@@ -4547,16 +4547,23 @@ Only works for Bourne-like shells."
4547 (t process))) 4547 (t process)))
4548 pid) 4548 pid)
4549 ;; If it's a Tramp process, send the INT signal remotely. 4549 ;; If it's a Tramp process, send the INT signal remotely.
4550 (when (and (processp proc) (process-live-p proc) 4550 (when (and (processp proc) (setq pid (process-get proc 'remote-pid)))
4551 (setq pid (process-get proc 'remote-pid))) 4551 (if (not (process-live-p proc))
4552 (tramp-message proc 5 "Interrupt process %s with pid %s" proc pid) 4552 (tramp-error proc 'error "Process %s is not active" proc)
4553 ;; This is for tramp-sh.el. Other backends do not support this (yet). 4553 (tramp-message proc 5 "Interrupt process %s with pid %s" proc pid)
4554 (tramp-compat-funcall 4554 ;; This is for tramp-sh.el. Other backends do not support this (yet).
4555 'tramp-send-command 4555 (tramp-compat-funcall
4556 (tramp-get-connection-property proc "vector" nil) 4556 'tramp-send-command
4557 (format "kill -2 %d" pid)) 4557 (tramp-get-connection-property proc "vector" nil)
4558 ;; Report success. 4558 (format "kill -2 %d" pid))
4559 proc))) 4559 ;; Wait, until the process has disappeared.
4560 (with-timeout
4561 (1 (tramp-error proc 'error "Process %s did not interrupt" proc))
4562 (while (process-live-p proc)
4563 ;; We cannot run `tramp-accept-process-output', it blocks timers.
4564 (accept-process-output proc 0.1)))
4565 ;; Report success.
4566 proc))))
4560 4567
4561;; `interrupt-process-functions' exists since Emacs 26.1. 4568;; `interrupt-process-functions' exists since Emacs 26.1.
4562(when (boundp 'interrupt-process-functions) 4569(when (boundp 'interrupt-process-functions)
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index 366a3ee9fcd..ee50f6fb040 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -5015,10 +5015,10 @@
5015 * ox-latex.el (org-latex-listings): Update docstring. 5015 * ox-latex.el (org-latex-listings): Update docstring.
5016 5016
5017 * org-pcomplete.el (pcomplete/org-mode/file-option/options): 5017 * org-pcomplete.el (pcomplete/org-mode/file-option/options):
5018 Apply changes to export back-end definiton. 5018 Apply changes to export back-end definition.
5019 5019
5020 * org.el (org-get-export-keywords): Apply changes to export 5020 * org.el (org-get-export-keywords): Apply changes to export
5021 back-end definiton. 5021 back-end definition.
5022 5022
5023 * ox-html.el (org-html--format-toc-headline): Make use of 5023 * ox-html.el (org-html--format-toc-headline): Make use of
5024 anonymous back-ends. 5024 anonymous back-ends.
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index f4852fe5b6b..102c3186200 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -84,11 +84,11 @@
84 . 'bat-label-face) 84 . 'bat-label-face)
85 ("\\_<\\(defined\\|set\\)\\_>[ \t]*\\(\\(\\sw\\|\\s_\\)+\\)" 85 ("\\_<\\(defined\\|set\\)\\_>[ \t]*\\(\\(\\sw\\|\\s_\\)+\\)"
86 (2 font-lock-variable-name-face)) 86 (2 font-lock-variable-name-face))
87 ("%\\(\\(\\sw\\|\\s_\\)+\\)%" 87 ("%\\([^%~ \n]+\\)%?"
88 (1 font-lock-variable-name-face)) 88 (1 font-lock-variable-name-face))
89 ("!\\(\\(\\sw\\|\\s_\\)+\\)!" ; delayed-expansion !variable! 89 ("!\\([^!%~ \n]+\\)!?" ; delayed-expansion !variable!
90 (1 font-lock-variable-name-face)) 90 (1 font-lock-variable-name-face))
91 ("%%\\(?:~[adfnpstxz]*\\(?:\\$\\(\\(?:\\sw\\|\\s_\\)+\\):\\)?\\)?\\([]!#$&-:?-[_-{}~]\\)" 91 ("%%\\(?:~[adfnpstxz]*\\(?:\\$\\(\\(?:\\sw\\|\\s_\\|_\\)+\\):\\)?\\)?\\([]!#$&-:?-[_-{}~]\\)"
92 (1 font-lock-variable-name-face nil t) ; PATH expansion 92 (1 font-lock-variable-name-face nil t) ; PATH expansion
93 (2 font-lock-variable-name-face)) ; iteration variable or positional parameter 93 (2 font-lock-variable-name-face)) ; iteration variable or positional parameter
94 ("[ =][-/]+\\(\\w+\\)" 94 ("[ =][-/]+\\(\\w+\\)"
diff --git a/lisp/simple.el b/lisp/simple.el
index 1ffe1810672..4e42fd52415 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -434,10 +434,6 @@ A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'."
434 ;; Do the rest in post-self-insert-hook, because we want to do it 434 ;; Do the rest in post-self-insert-hook, because we want to do it
435 ;; *before* other functions on that hook. 435 ;; *before* other functions on that hook.
436 (lambda () 436 (lambda ()
437 ;; We are not going to insert any newlines if arg is
438 ;; non-positive.
439 (or (and (numberp arg) (<= arg 0))
440 (cl-assert (eq ?\n (char-before))))
441 ;; Mark the newline(s) `hard'. 437 ;; Mark the newline(s) `hard'.
442 (if use-hard-newlines 438 (if use-hard-newlines
443 (set-hard-newline-properties 439 (set-hard-newline-properties
@@ -456,25 +452,22 @@ A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'."
456 ;; starts a page. 452 ;; starts a page.
457 (or was-page-start 453 (or was-page-start
458 (move-to-left-margin nil t))))) 454 (move-to-left-margin nil t)))))
459 (unwind-protect 455 (if (not interactive)
460 (if (not interactive) 456 ;; FIXME: For non-interactive uses, many calls actually
461 ;; FIXME: For non-interactive uses, many calls actually 457 ;; just want (insert "\n"), so maybe we should do just
462 ;; just want (insert "\n"), so maybe we should do just 458 ;; that, so as to avoid the risk of filling or running
463 ;; that, so as to avoid the risk of filling or running 459 ;; abbrevs unexpectedly.
464 ;; abbrevs unexpectedly. 460 (let ((post-self-insert-hook (list postproc)))
465 (let ((post-self-insert-hook (list postproc))) 461 (self-insert-command arg))
466 (self-insert-command arg)) 462 (unwind-protect
467 (unwind-protect 463 (progn
468 (progn 464 (add-hook 'post-self-insert-hook postproc nil t)
469 (add-hook 'post-self-insert-hook postproc nil t) 465 (self-insert-command arg))
470 (self-insert-command arg)) 466 ;; We first used let-binding to protect the hook, but that
471 ;; We first used let-binding to protect the hook, but that 467 ;; was naive since add-hook affects the symbol-default
472 ;; was naive since add-hook affects the symbol-default 468 ;; value of the variable, whereas the let-binding might
473 ;; value of the variable, whereas the let-binding might 469 ;; only protect the buffer-local value.
474 ;; only protect the buffer-local value. 470 (remove-hook 'post-self-insert-hook postproc t))))
475 (remove-hook 'post-self-insert-hook postproc t)))
476 (cl-assert (not (member postproc post-self-insert-hook)))
477 (cl-assert (not (member postproc (default-value 'post-self-insert-hook))))))
478 nil) 471 nil)
479 472
480(defun set-hard-newline-properties (from to) 473(defun set-hard-newline-properties (from to)
diff --git a/lisp/subr.el b/lisp/subr.el
index 79ae1f4830d..cf15ec287ff 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -289,7 +289,7 @@ The name is made by appending `gensym-counter' to PREFIX.
289PREFIX is a string, and defaults to \"g\"." 289PREFIX is a string, and defaults to \"g\"."
290 (let ((num (prog1 gensym-counter 290 (let ((num (prog1 gensym-counter
291 (setq gensym-counter (1+ gensym-counter))))) 291 (setq gensym-counter (1+ gensym-counter)))))
292 (make-symbol (format "%s%d" prefix num)))) 292 (make-symbol (format "%s%d" (or prefix "g") num))))
293 293
294(defun ignore (&rest _ignore) 294(defun ignore (&rest _ignore)
295 "Do nothing and return nil. 295 "Do nothing and return nil.
@@ -1270,6 +1270,11 @@ See `event-start' for a description of the value returned."
1270 "Return the multi-click count of EVENT, a click or drag event. 1270 "Return the multi-click count of EVENT, a click or drag event.
1271The return value is a positive integer." 1271The return value is a positive integer."
1272 (if (and (consp event) (integerp (nth 2 event))) (nth 2 event) 1)) 1272 (if (and (consp event) (integerp (nth 2 event))) (nth 2 event) 1))
1273
1274(defsubst event-line-count (event)
1275 "Return the line count of EVENT, a mousewheel event.
1276The return value is a positive integer."
1277 (if (and (consp event) (integerp (nth 3 event))) (nth 3 event) 1))
1273 1278
1274;;;; Extracting fields of the positions in an event. 1279;;;; Extracting fields of the positions in an event.
1275 1280
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 68b659bf751..bc211ea9589 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -736,6 +736,25 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
736(global-unset-key [horizontal-scroll-bar drag-mouse-1]) 736(global-unset-key [horizontal-scroll-bar drag-mouse-1])
737 737
738 738
739;;;; macOS-like defaults for trackpad and mouse wheel scrolling on
740;;;; macOS 10.7+.
741
742;; FIXME: This doesn't look right. Is there a better way to do this
743;; that keeps customize happy?
744(let ((appkit-version (progn
745 (string-match "^appkit-\\([^\s-]*\\)" ns-version-string)
746 (string-to-number (match-string 1 ns-version-string)))))
747 ;; Appkit 1138 ~= macOS 10.7.
748 (when (and (featurep 'cocoa) (>= appkit-version 1138))
749 (setq mouse-wheel-scroll-amount '(1 ((shift) . 5) ((control))))
750 (put 'mouse-wheel-scroll-amount 'customized-value
751 (list (custom-quote (symbol-value 'mouse-wheel-scroll-amount))))
752
753 (setq mouse-wheel-progressive-speed nil)
754 (put 'mouse-wheel-progressive-speed 'customized-value
755 (list (custom-quote (symbol-value 'mouse-wheel-progressive-speed))))))
756
757
739;;;; Color support. 758;;;; Color support.
740 759
741;; Functions for color panel + drag 760;; Functions for color panel + drag
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 0c0a51e7df0..6a169622f52 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1492,8 +1492,10 @@ This is passed to the Ispell process using the `-p' switch.")
1492 (assoc ispell-current-dictionary ispell-local-dictionary-alist) 1492 (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1493 (assoc ispell-current-dictionary ispell-dictionary-alist) 1493 (assoc ispell-current-dictionary ispell-dictionary-alist)
1494 (error "No data for dictionary \"%s\" in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'" 1494 (error "No data for dictionary \"%s\" in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'"
1495 ispell-current-dictionary)))) 1495 ispell-current-dictionary)))
1496 (decode-coding-string (nth n slot) (ispell-get-coding-system) t))) 1496 (str (nth n slot)))
1497 (if (stringp str)
1498 (decode-coding-string str (ispell-get-coding-system) t))))
1497 1499
1498(defun ispell-get-casechars () 1500(defun ispell-get-casechars ()
1499 (ispell-get-decoded-string 1)) 1501 (ispell-get-decoded-string 1))
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 52f56ed990f..d6963d0a1b9 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -608,10 +608,16 @@ considered file(s)."
608 (log-view-diff-common beg end t))) 608 (log-view-diff-common beg end t)))
609 609
610(defun log-view-diff-common (beg end &optional whole-changeset) 610(defun log-view-diff-common (beg end &optional whole-changeset)
611 (let ((to (log-view-current-tag beg)) 611 (let* ((to (log-view-current-tag beg))
612 (fr (log-view-current-tag end))) 612 (fr-entry (log-view-current-entry end))
613 (when (string-equal fr to) 613 (fr (cadr fr-entry)))
614 ;; TO and FR are the same, look at the previous revision. 614 ;; When TO and FR are the same, or when point is on a line after
615 ;; the last entry, look at the previous revision.
616 (when (or (string-equal fr to)
617 (>= (point)
618 (save-excursion
619 (goto-char (car fr-entry))
620 (forward-line))))
615 (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr))) 621 (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
616 (vc-diff-internal 622 (vc-diff-internal
617 t (list log-view-vc-backend 623 t (list log-view-vc-backend
diff --git a/lisp/xdg.el b/lisp/xdg.el
index e94fa8ec924..76106f42586 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -84,7 +84,7 @@
84 84
85(defun xdg-thumb-uri (filename) 85(defun xdg-thumb-uri (filename)
86 "Return the canonical URI for FILENAME. 86 "Return the canonical URI for FILENAME.
87If FILENAME has absolute path /foo/bar.jpg, its canonical URI is 87If FILENAME has absolute file name /foo/bar.jpg, its canonical URI is
88file:///foo/bar.jpg" 88file:///foo/bar.jpg"
89 (concat "file://" (expand-file-name filename))) 89 (concat "file://" (expand-file-name filename)))
90 90
@@ -197,8 +197,6 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"."
197 (unless (looking-at xdg-desktop-group-regexp) 197 (unless (looking-at xdg-desktop-group-regexp)
198 (error "Expected group name! Instead saw: %s" 198 (error "Expected group name! Instead saw: %s"
199 (buffer-substring (point) (point-at-eol)))) 199 (buffer-substring (point) (point-at-eol))))
200 (unless (equal (match-string 1) "Desktop Entry")
201 (error "Wrong first group: %s" (match-string 1)))
202 (when group 200 (when group
203 (while (and (re-search-forward xdg-desktop-group-regexp nil t) 201 (while (and (re-search-forward xdg-desktop-group-regexp nil t)
204 (not (equal (match-string 1) group))))) 202 (not (equal (match-string 1) group)))))