aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-04-07 16:29:32 +0200
committerMattias EngdegÄrd2023-04-07 19:08:33 +0200
commit7c0c2b1bb539424af1bb72bd9caefedd66cfd3da (patch)
treed17e18d4bf8407c818985e29f22c5bb8b3d1717a
parent211618293d9fd620f9f8971090e049d98c05f546 (diff)
downloademacs-7c0c2b1bb539424af1bb72bd9caefedd66cfd3da.tar.gz
emacs-7c0c2b1bb539424af1bb72bd9caefedd66cfd3da.zip
Remove useless unwind-protect forms, or make them useful as intended
* lisp/imenu.el (imenu--generic-function): * lisp/mail/yenc.el (yenc-decode-region): * lisp/textmodes/table.el (table-recognize-region): * test/lisp/dired-tests.el (dired-test-directory-files): * test/lisp/hl-line-tests.el (hl-line-tests-sticky): Fix unwind-protect bracketing mistakes that caused the unwind code to be misplaced. * lisp/strokes.el (strokes-read-stroke): Fix a bracketing mistake that misplaced the unwind code, and another one that misplaced the else-clause of an `if` form. * test/lisp/gnus/mml-sec-tests.el (mml-secure-test-fixture): Fix a bracketing mistake that misplaced the unwind code, and remove superfluous condition-case. * lisp/mwheel.el (mouse-wheel-global-text-scale): * lisp/speedbar.el (speedbar-stealthy-updates) (speedbar-fetch-dynamic-etags): * lisp/emacs-lisp/edebug.el (edebug--recursive-edit): * lisp/emacs-lisp/package.el (package--read-pkg-desc): * lisp/cedet/semantic.el (semantic-refresh-tags-safe): * lisp/emulation/viper-cmd.el (viper-escape-to-state): * lisp/emulation/viper-cmd.el (viper-file-add-suffix): * lisp/gnus/mail-source.el (mail-source-movemail): * lisp/mail/feedmail.el (feedmail-send-it-immediately) (feedmail-deduce-address-list): * lisp/mail/mailclient.el (mailclient-send-it): * lisp/mail/smtpmail.el (smtpmail-deduce-address-list): * lisp/mh-e/mh-print.el (mh-ps-print-range): * lisp/textmodes/reftex-index.el (reftex-index-this-phrase): * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-batch): (ert-test-run-tests-batch-expensive): Remove unwind-protect forms that are apparently useless, some since a prior edit that removed their purpose, some since their first appearance. * test/lisp/subr-tests.el (subr-test--frames-2): Insert dummy unwind form in backtrace test code.
-rw-r--r--lisp/cedet/semantic.el27
-rw-r--r--lisp/emacs-lisp/edebug.el148
-rw-r--r--lisp/emacs-lisp/package.el17
-rw-r--r--lisp/emulation/viper-cmd.el36
-rw-r--r--lisp/gnus/mail-source.el87
-rw-r--r--lisp/imenu.el4
-rw-r--r--lisp/mail/feedmail.el78
-rw-r--r--lisp/mail/mailclient.el193
-rw-r--r--lisp/mail/smtpmail.el87
-rw-r--r--lisp/mail/yenc.el4
-rw-r--r--lisp/mh-e/mh-print.el3
-rw-r--r--lisp/mwheel.el13
-rw-r--r--lisp/speedbar.el75
-rw-r--r--lisp/strokes.el42
-rw-r--r--lisp/textmodes/reftex-index.el27
-rw-r--r--lisp/textmodes/table.el4
-rw-r--r--test/lisp/dired-tests.el4
-rw-r--r--test/lisp/emacs-lisp/ert-tests.el28
-rw-r--r--test/lisp/gnus/mml-sec-tests.el51
-rw-r--r--test/lisp/hl-line-tests.el8
-rw-r--r--test/lisp/subr-tests.el3
21 files changed, 457 insertions, 482 deletions
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 1c9228b0123..0c15a2a453e 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -618,21 +618,18 @@ Does nothing if the current buffer doesn't need reparsing."
618 (lexically-safe t) 618 (lexically-safe t)
619 ) 619 )
620 620
621 (unwind-protect 621 ;; Perform the parsing.
622 ;; Perform the parsing. 622 (when (semantic-lex-catch-errors safe-refresh
623 (progn 623 (save-excursion (semantic-fetch-tags))
624 (when (semantic-lex-catch-errors safe-refresh 624 nil)
625 (save-excursion (semantic-fetch-tags)) 625 ;; If we are here, it is because the lexical step failed,
626 nil) 626 ;; probably due to unterminated lists or something like that.
627 ;; If we are here, it is because the lexical step failed, 627
628 ;; probably due to unterminated lists or something like that. 628 ;; We do nothing, and just wait for the next idle timer
629 629 ;; to go off. In the meantime, remember this, and make sure
630 ;; We do nothing, and just wait for the next idle timer 630 ;; no other idle services can get executed.
631 ;; to go off. In the meantime, remember this, and make sure 631 (setq lexically-safe nil))
632 ;; no other idle services can get executed. 632
633 (setq lexically-safe nil))
634 )
635 )
636 ;; Return if we are lexically safe 633 ;; Return if we are lexically safe
637 lexically-safe)))) 634 lexically-safe))))
638 635
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 552526b6efc..9a06807bcdc 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -2853,81 +2853,81 @@ See `edebug-behavior-alist' for implementations.")
2853 edebug-inside-windows 2853 edebug-inside-windows
2854 ) 2854 )
2855 2855
2856 (unwind-protect
2857 (let (
2858 ;; Declare global values local but using the same global value.
2859 ;; We could set these to the values for previous edebug call.
2860 (last-command last-command)
2861 (this-command this-command)
2862 (current-prefix-arg nil)
2863
2864 (last-input-event nil)
2865 (last-command-event nil)
2866 (last-event-frame nil)
2867 (last-nonmenu-event nil)
2868 (track-mouse nil)
2869
2870 (standard-output t)
2871 (standard-input t)
2872
2873 ;; Don't keep reading from an executing kbd macro
2874 ;; within edebug unless edebug-continue-kbd-macro is
2875 ;; non-nil. Again, local binding may not be best.
2876 (executing-kbd-macro
2877 (if edebug-continue-kbd-macro executing-kbd-macro))
2878
2879 ;; Don't get confused by the user's keymap changes.
2880 (overriding-local-map nil)
2881 (overriding-terminal-local-map nil)
2882 ;; Override other minor modes that may bind the keys
2883 ;; edebug uses.
2884 (minor-mode-overriding-map-alist
2885 (list (cons 'edebug-mode edebug-mode-map)))
2886
2887 ;; Bind again to outside values.
2888 (debug-on-error edebug-outside-debug-on-error)
2889 (debug-on-quit edebug-outside-debug-on-quit)
2890
2891 ;; Don't keep defining a kbd macro.
2892 (defining-kbd-macro
2893 (if edebug-continue-kbd-macro defining-kbd-macro))
2894
2895 ;; others??
2896 )
2897 2856
2898 (if (and (eq edebug-execution-mode 'go) 2857 (let (
2899 (not (memq arg-mode '(after error)))) 2858 ;; Declare global values local but using the same global value.
2900 (message "Break")) 2859 ;; We could set these to the values for previous edebug call.
2901 2860 (last-command last-command)
2902 (setq signal-hook-function nil) 2861 (this-command this-command)
2903 2862 (current-prefix-arg nil)
2904 (edebug-mode 1) 2863
2905 (unwind-protect 2864 (last-input-event nil)
2906 (recursive-edit) ; <<<<<<<<<< Recursive edit 2865 (last-command-event nil)
2907 2866 (last-event-frame nil)
2908 ;; Do the following, even if quit occurs. 2867 (last-nonmenu-event nil)
2909 (setq signal-hook-function #'edebug-signal) 2868 (track-mouse nil)
2910 (if edebug-backtrace-buffer 2869
2911 (kill-buffer edebug-backtrace-buffer)) 2870 (standard-output t)
2912 2871 (standard-input t)
2913 ;; Remember selected-window after recursive-edit. 2872
2914 ;; (setq edebug-inside-window (selected-window)) 2873 ;; Don't keep reading from an executing kbd macro
2915 2874 ;; within edebug unless edebug-continue-kbd-macro is
2916 (set-match-data edebug-outside-match-data) 2875 ;; non-nil. Again, local binding may not be best.
2917 2876 (executing-kbd-macro
2918 ;; Recursive edit may have changed buffers, 2877 (if edebug-continue-kbd-macro executing-kbd-macro))
2919 ;; so set it back before exiting let. 2878
2920 (if (buffer-name edebug-buffer) ; if it still exists 2879 ;; Don't get confused by the user's keymap changes.
2921 (progn 2880 (overriding-local-map nil)
2922 (set-buffer edebug-buffer) 2881 (overriding-terminal-local-map nil)
2923 (when (memq edebug-execution-mode '(go Go-nonstop)) 2882 ;; Override other minor modes that may bind the keys
2924 (edebug-overlay-arrow) 2883 ;; edebug uses.
2925 (sit-for 0)) 2884 (minor-mode-overriding-map-alist
2926 (edebug-mode -1)) 2885 (list (cons 'edebug-mode edebug-mode-map)))
2927 ;; gotta have a buffer to let its buffer local variables be set 2886
2928 (get-buffer-create " bogus edebug buffer")) 2887 ;; Bind again to outside values.
2929 ));; inner let 2888 (debug-on-error edebug-outside-debug-on-error)
2930 ))) 2889 (debug-on-quit edebug-outside-debug-on-quit)
2890
2891 ;; Don't keep defining a kbd macro.
2892 (defining-kbd-macro
2893 (if edebug-continue-kbd-macro defining-kbd-macro))
2894
2895 ;; others??
2896 )
2897
2898 (if (and (eq edebug-execution-mode 'go)
2899 (not (memq arg-mode '(after error))))
2900 (message "Break"))
2901
2902 (setq signal-hook-function nil)
2903
2904 (edebug-mode 1)
2905 (unwind-protect
2906 (recursive-edit) ; <<<<<<<<<< Recursive edit
2907
2908 ;; Do the following, even if quit occurs.
2909 (setq signal-hook-function #'edebug-signal)
2910 (if edebug-backtrace-buffer
2911 (kill-buffer edebug-backtrace-buffer))
2912
2913 ;; Remember selected-window after recursive-edit.
2914 ;; (setq edebug-inside-window (selected-window))
2915
2916 (set-match-data edebug-outside-match-data)
2917
2918 ;; Recursive edit may have changed buffers,
2919 ;; so set it back before exiting let.
2920 (if (buffer-name edebug-buffer) ; if it still exists
2921 (progn
2922 (set-buffer edebug-buffer)
2923 (when (memq edebug-execution-mode '(go Go-nonstop))
2924 (edebug-overlay-arrow)
2925 (sit-for 0))
2926 (edebug-mode -1))
2927 ;; gotta have a buffer to let its buffer local variables be set
2928 (get-buffer-create " bogus edebug buffer"))
2929 ));; inner let
2930 ))
2931 2931
2932 2932
2933;;; Display related functions 2933;;; Display related functions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0258ed52bee..685f983e285 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1218,15 +1218,14 @@ boundaries."
1218 "Read a `define-package' form in current buffer. 1218 "Read a `define-package' form in current buffer.
1219Return the pkg-desc, with desc-kind set to KIND." 1219Return the pkg-desc, with desc-kind set to KIND."
1220 (goto-char (point-min)) 1220 (goto-char (point-min))
1221 (unwind-protect 1221 (let* ((pkg-def-parsed (read (current-buffer)))
1222 (let* ((pkg-def-parsed (read (current-buffer))) 1222 (pkg-desc
1223 (pkg-desc 1223 (when (eq (car pkg-def-parsed) 'define-package)
1224 (when (eq (car pkg-def-parsed) 'define-package) 1224 (apply #'package-desc-from-define
1225 (apply #'package-desc-from-define 1225 (append (cdr pkg-def-parsed))))))
1226 (append (cdr pkg-def-parsed)))))) 1226 (when pkg-desc
1227 (when pkg-desc 1227 (setf (package-desc-kind pkg-desc) kind)
1228 (setf (package-desc-kind pkg-desc) kind) 1228 pkg-desc)))
1229 pkg-desc))))
1230 1229
1231(declare-function tar-get-file-descriptor "tar-mode" (file)) 1230(declare-function tar-get-file-descriptor "tar-mode" (file))
1232(declare-function tar--extract "tar-mode" (descriptor)) 1231(declare-function tar--extract "tar-mode" (descriptor))
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 2a37c383f81..c0aa9dd7b46 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -722,16 +722,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
722 (let (viper-vi-kbd-minor-mode 722 (let (viper-vi-kbd-minor-mode
723 viper-insert-kbd-minor-mode 723 viper-insert-kbd-minor-mode
724 viper-emacs-kbd-minor-mode) 724 viper-emacs-kbd-minor-mode)
725 (unwind-protect 725 (setq com (key-binding (setq key (read-key-sequence nil))))
726 (progn 726 ;; In case of binding indirection--chase definitions.
727 (setq com 727 ;; Have to do it here because we execute this command under
728 (key-binding (setq key (read-key-sequence nil)))) 728 ;; different keymaps, so command-execute may not do the
729 ;; In case of binding indirection--chase definitions. 729 ;; right thing there
730 ;; Have to do it here because we execute this command under 730 (while (vectorp com) (setq com (key-binding com)))
731 ;; different keymaps, so command-execute may not do the
732 ;; right thing there
733 (while (vectorp com) (setq com (key-binding com))))
734 nil)
735 ;; Execute command com in the original Viper state, not in state 731 ;; Execute command com in the original Viper state, not in state
736 ;; `state'. Otherwise, if we switch buffers while executing the 732 ;; `state'. Otherwise, if we switch buffers while executing the
737 ;; escaped to command, Viper's mode vars will remain those of 733 ;; escaped to command, Viper's mode vars will remain those of
@@ -1950,16 +1946,16 @@ To turn this feature off, set this variable to nil."
1950 (if found 1946 (if found
1951 () 1947 ()
1952 (viper-tmp-insert-at-eob " [Please complete file name]") 1948 (viper-tmp-insert-at-eob " [Please complete file name]")
1953 (unwind-protect 1949
1954 (while (not (memq cmd 1950 (while (not (memq cmd
1955 '(exit-minibuffer viper-exit-minibuffer))) 1951 '(exit-minibuffer viper-exit-minibuffer)))
1956 (setq cmd 1952 (setq cmd
1957 (key-binding (setq key (read-key-sequence nil)))) 1953 (key-binding (setq key (read-key-sequence nil))))
1958 (cond ((eq cmd 'self-insert-command) 1954 (cond ((eq cmd 'self-insert-command)
1959 (insert key)) 1955 (insert key))
1960 ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) 1956 ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
1961 nil) 1957 nil)
1962 (t (command-execute cmd)))))))))) 1958 (t (command-execute cmd)))))))))
1963 1959
1964 1960
1965(defun viper-minibuffer-trim-tail () 1961(defun viper-minibuffer-trim-tail ()
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 639a29582b3..582c598ac22 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -658,50 +658,49 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
658 ;; If getting from mail spool directory, use movemail to move 658 ;; If getting from mail spool directory, use movemail to move
659 ;; rather than just renaming, so as to interlock with the 659 ;; rather than just renaming, so as to interlock with the
660 ;; mailer. 660 ;; mailer.
661 (unwind-protect 661 (save-excursion
662 (save-excursion 662 (setq errors (generate-new-buffer " *mail source loss*"))
663 (setq errors (generate-new-buffer " *mail source loss*")) 663 (let ((default-directory "/"))
664 (let ((default-directory "/")) 664 (setq result
665 (setq result 665 ;; call-process looks in exec-path, which
666 ;; call-process looks in exec-path, which 666 ;; contains exec-directory, so will find
667 ;; contains exec-directory, so will find 667 ;; Mailutils movemail if it exists, else it will
668 ;; Mailutils movemail if it exists, else it will 668 ;; find "our" movemail in exec-directory.
669 ;; find "our" movemail in exec-directory. 669 ;; Bug#31737
670 ;; Bug#31737 670 (apply
671 (apply 671 #'call-process
672 #'call-process 672 (append
673 (append 673 (list
674 (list 674 mail-source-movemail-program
675 mail-source-movemail-program 675 nil errors nil from to)))))
676 nil errors nil from to))))) 676 (when (file-exists-p to)
677 (when (file-exists-p to) 677 (set-file-modes to mail-source-default-file-modes 'nofollow))
678 (set-file-modes to mail-source-default-file-modes 'nofollow)) 678 (if (and (or (not (buffer-modified-p errors))
679 (if (and (or (not (buffer-modified-p errors)) 679 (zerop (buffer-size errors)))
680 (zerop (buffer-size errors))) 680 (and (numberp result)
681 (and (numberp result) 681 (zerop result)))
682 (zerop result))) 682 ;; No output => movemail won.
683 ;; No output => movemail won. 683 t
684 t 684 (set-buffer errors)
685 (set-buffer errors) 685 ;; There may be a warning about older revisions. We
686 ;; There may be a warning about older revisions. We 686 ;; ignore that.
687 ;; ignore that. 687 (goto-char (point-min))
688 (goto-char (point-min)) 688 (if (search-forward "older revision" nil t)
689 (if (search-forward "older revision" nil t) 689 t
690 t 690 ;; Probably a real error.
691 ;; Probably a real error. 691 (subst-char-in-region (point-min) (point-max) ?\n ?\ )
692 (subst-char-in-region (point-min) (point-max) ?\n ?\ ) 692 (goto-char (point-max))
693 (goto-char (point-max)) 693 (skip-chars-backward " \t")
694 (skip-chars-backward " \t") 694 (delete-region (point) (point-max))
695 (delete-region (point) (point-max)) 695 (goto-char (point-min))
696 (goto-char (point-min)) 696 (when (looking-at "movemail: ")
697 (when (looking-at "movemail: ") 697 (delete-region (point-min) (match-end 0)))
698 (delete-region (point-min) (match-end 0))) 698 ;; Result may be a signal description string.
699 ;; Result may be a signal description string. 699 (unless (yes-or-no-p
700 (unless (yes-or-no-p 700 (format "movemail: %s (%s return). Continue? "
701 (format "movemail: %s (%s return). Continue? " 701 (buffer-string) result))
702 (buffer-string) result)) 702 (error "%s" (buffer-string)))
703 (error "%s" (buffer-string))) 703 (setq to nil))))))
704 (setq to nil)))))))
705 (when (buffer-live-p errors) 704 (when (buffer-live-p errors)
706 (kill-buffer errors)) 705 (kill-buffer errors))
707 ;; Return whether we moved successfully or not. 706 ;; Return whether we moved successfully or not.
diff --git a/lisp/imenu.el b/lisp/imenu.el
index fd23a65c7b3..c51824b7ef3 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -674,8 +674,8 @@ depending on PATTERNS."
674 (cons item (cdr menu))))) 674 (cons item (cdr menu)))))
675 ;; Go to the start of the match, to make sure we 675 ;; Go to the start of the match, to make sure we
676 ;; keep making progress backwards. 676 ;; keep making progress backwards.
677 (goto-char start)))) 677 (goto-char start)))))
678 (set-syntax-table old-table))) 678 (set-syntax-table old-table))
679 ;; Sort each submenu by position. 679 ;; Sort each submenu by position.
680 ;; This is in case one submenu gets items from two different regexps. 680 ;; This is in case one submenu gets items from two different regexps.
681 (dolist (item index-alist) 681 (dolist (item index-alist)
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 97d20cca151..165aafae1f7 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -2511,22 +2511,20 @@ mapped to mostly alphanumerics for safety."
2511 feedmail-force-binary-write) 2511 feedmail-force-binary-write)
2512 'no-conversion 2512 'no-conversion
2513 coding-system-for-write))) 2513 coding-system-for-write)))
2514 (unwind-protect 2514 (insert fcc)
2515 (progn 2515 (unless feedmail-nuke-bcc-in-fcc
2516 (insert fcc) 2516 (if bcc-holder (insert bcc-holder))
2517 (unless feedmail-nuke-bcc-in-fcc 2517 (if resent-bcc-holder
2518 (if bcc-holder (insert bcc-holder)) 2518 (insert resent-bcc-holder)))
2519 (if resent-bcc-holder 2519
2520 (insert resent-bcc-holder))) 2520 (run-hooks 'feedmail-before-fcc-hook)
2521 2521
2522 (run-hooks 'feedmail-before-fcc-hook) 2522 (when feedmail-nuke-body-in-fcc
2523 2523 (goto-char eoh-marker)
2524 (when feedmail-nuke-body-in-fcc 2524 (if (natnump feedmail-nuke-body-in-fcc)
2525 (goto-char eoh-marker) 2525 (forward-line feedmail-nuke-body-in-fcc))
2526 (if (natnump feedmail-nuke-body-in-fcc) 2526 (delete-region (point) (point-max)))
2527 (forward-line feedmail-nuke-body-in-fcc)) 2527 (mail-do-fcc eoh-marker))))
2528 (delete-region (point) (point-max)))
2529 (mail-do-fcc eoh-marker))))))
2530 ;; User bailed out of one-last-look. 2528 ;; User bailed out of one-last-look.
2531 (if feedmail-queue-runner-is-active 2529 (if feedmail-queue-runner-is-active
2532 (throw 'skip-me-q 'skip-me-q) 2530 (throw 'skip-me-q 'skip-me-q)
@@ -3046,30 +3044,30 @@ been weeded out."
3046 (address-blob) 3044 (address-blob)
3047 (this-line) 3045 (this-line)
3048 (this-line-end)) 3046 (this-line-end))
3049 (unwind-protect 3047
3050 (with-current-buffer (get-buffer-create " *FQM scratch*") 3048 (with-current-buffer (get-buffer-create " *FQM scratch*")
3051 (erase-buffer) 3049 (erase-buffer)
3052 (insert-buffer-substring message-buffer header-start header-end) 3050 (insert-buffer-substring message-buffer header-start header-end)
3053 (goto-char (point-min)) 3051 (goto-char (point-min))
3054 (let ((case-fold-search t)) 3052 (let ((case-fold-search t))
3055 (while (re-search-forward addr-regexp (point-max) t) 3053 (while (re-search-forward addr-regexp (point-max) t)
3056 (replace-match "") 3054 (replace-match "")
3057 (setq this-line (match-beginning 0)) 3055 (setq this-line (match-beginning 0))
3058 (forward-line 1) 3056 (forward-line 1)
3059 ;; get any continuation lines 3057 ;; get any continuation lines
3060 (while (and (looking-at "^[ \t]+") (< (point) (point-max))) 3058 (while (and (looking-at "^[ \t]+") (< (point) (point-max)))
3061 (forward-line 1)) 3059 (forward-line 1))
3062 (setq this-line-end (point-marker)) 3060 (setq this-line-end (point-marker))
3063 ;; only keep if we don't have it already 3061 ;; only keep if we don't have it already
3064 (setq address-blob 3062 (setq address-blob
3065 (mail-strip-quoted-names (buffer-substring-no-properties this-line this-line-end))) 3063 (mail-strip-quoted-names (buffer-substring-no-properties this-line this-line-end)))
3066 (while (string-match "\\([, \t\n\r]*\\)\\([^, \t\n\r]+\\)" address-blob) 3064 (while (string-match "\\([, \t\n\r]*\\)\\([^, \t\n\r]+\\)" address-blob)
3067 (setq simple-address (substring address-blob (match-beginning 2) (match-end 2))) 3065 (setq simple-address (substring address-blob (match-beginning 2) (match-end 2)))
3068 (setq address-blob (replace-match "" t t address-blob)) 3066 (setq address-blob (replace-match "" t t address-blob))
3069 (if (not (member simple-address address-list)) 3067 (if (not (member simple-address address-list))
3070 (push simple-address address-list))) 3068 (push simple-address address-list)))
3071 )) 3069 ))
3072 (kill-buffer nil))) 3070 (kill-buffer nil))
3073 (identity address-list))) 3071 (identity address-list)))
3074 3072
3075 3073
diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index 21ddef4b0fd..613541e5dc4 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -111,104 +111,103 @@ The mail client is taken to be the handler of mailto URLs."
111 (let ((case-fold-search nil) 111 (let ((case-fold-search nil)
112 delimline 112 delimline
113 (mailbuf (current-buffer))) 113 (mailbuf (current-buffer)))
114 (unwind-protect 114 (with-temp-buffer
115 (with-temp-buffer 115 (insert-buffer-substring mailbuf)
116 (insert-buffer-substring mailbuf) 116 ;; Move to header delimiter
117 ;; Move to header delimiter 117 (mail-sendmail-undelimit-header)
118 (mail-sendmail-undelimit-header) 118 (setq delimline (point-marker))
119 (setq delimline (point-marker)) 119 (if mail-aliases
120 (if mail-aliases 120 (expand-mail-aliases (point-min) delimline))
121 (expand-mail-aliases (point-min) delimline)) 121 (goto-char (point-min))
122 (goto-char (point-min)) 122 ;; ignore any blank lines in the header
123 ;; ignore any blank lines in the header 123 (while (and (re-search-forward "\n\n\n*" delimline t)
124 (while (and (re-search-forward "\n\n\n*" delimline t) 124 (< (point) delimline))
125 (< (point) delimline)) 125 (replace-match "\n"))
126 (replace-match "\n")) 126 (let ((case-fold-search t)
127 (let ((case-fold-search t) 127 (mime-charset-pattern
128 (mime-charset-pattern
129 (concat
130 "^content-type:[ \t]*text/plain;"
131 "\\(?:[ \t\n]*\\(?:format\\|delsp\\)=\"?[-a-z0-9]+\"?;\\)*"
132 "[ \t\n]*charset=\"?\\([^ \t\n\";]+\\)\"?"))
133 coding-system
134 character-coding
135 ;; Use the external browser function to send the
136 ;; message.
137 (browse-url-default-handlers nil))
138 ;; initialize limiter
139 (setq mailclient-delim-static "?")
140 ;; construct and call up mailto URL
141 (browse-url
142 (concat 128 (concat
143 (save-excursion 129 "^content-type:[ \t]*text/plain;"
144 (narrow-to-region (point-min) delimline) 130 "\\(?:[ \t\n]*\\(?:format\\|delsp\\)=\"?[-a-z0-9]+\"?;\\)*"
145 ;; We can't send multipart/* messages (i. e. with 131 "[ \t\n]*charset=\"?\\([^ \t\n\";]+\\)\"?"))
146 ;; attachments or the like) via this method. 132 coding-system
147 (when-let ((type (mail-fetch-field "content-type"))) 133 character-coding
148 (when (and (string-match "multipart" 134 ;; Use the external browser function to send the
149 (car (mail-header-parse-content-type 135 ;; message.
150 type))) 136 (browse-url-default-handlers nil))
151 (not (y-or-n-p "Message with attachments can't be sent via mailclient; continue anyway?"))) 137 ;; initialize limiter
152 (error "Choose a different `send-mail-function' to send attachments"))) 138 (setq mailclient-delim-static "?")
153 (goto-char (point-min)) 139 ;; construct and call up mailto URL
154 (setq coding-system 140 (browse-url
155 (if (re-search-forward mime-charset-pattern nil t) 141 (concat
156 (coding-system-from-name (match-string 1)) 142 (save-excursion
157 'undecided)) 143 (narrow-to-region (point-min) delimline)
158 (setq character-coding 144 ;; We can't send multipart/* messages (i. e. with
159 (mail-fetch-field "content-transfer-encoding")) 145 ;; attachments or the like) via this method.
160 (when character-coding 146 (when-let ((type (mail-fetch-field "content-type")))
161 (setq character-coding (downcase character-coding))) 147 (when (and (string-match "multipart"
162 (concat 148 (car (mail-header-parse-content-type
163 "mailto:" 149 type)))
164 ;; Some of the headers according to RFC 822 (or later). 150 (not (y-or-n-p "Message with attachments can't be sent via mailclient; continue anyway?")))
165 (mailclient-gather-addresses "To" 151 (error "Choose a different `send-mail-function' to send attachments")))
166 'drop-first-name) 152 (goto-char (point-min))
167 (mailclient-gather-addresses "cc" ) 153 (setq coding-system
168 (mailclient-gather-addresses "bcc" ) 154 (if (re-search-forward mime-charset-pattern nil t)
169 (mailclient-gather-addresses "Resent-To" ) 155 (coding-system-from-name (match-string 1))
170 (mailclient-gather-addresses "Resent-cc" ) 156 'undecided))
171 (mailclient-gather-addresses "Resent-bcc" ) 157 (setq character-coding
172 (mailclient-gather-addresses "Reply-To" ) 158 (mail-fetch-field "content-transfer-encoding"))
173 ;; The From field is not honored for now: it's 159 (when character-coding
174 ;; not necessarily configured. The mail client 160 (setq character-coding (downcase character-coding)))
175 ;; knows the user's address(es) 161 (concat
176 ;; (mailclient-gather-addresses "From" ) 162 "mailto:"
177 ;; subject line 163 ;; Some of the headers according to RFC 822 (or later).
178 (let ((subj (mail-fetch-field "Subject" nil t))) 164 (mailclient-gather-addresses "To"
179 (widen) ;; so we can read the body later on 165 'drop-first-name)
180 (if subj ;; if non-blank 166 (mailclient-gather-addresses "cc" )
181 ;; the mail client will deal with 167 (mailclient-gather-addresses "bcc" )
182 ;; warning the user etc. 168 (mailclient-gather-addresses "Resent-To" )
183 (concat (mailclient-url-delim) "subject=" 169 (mailclient-gather-addresses "Resent-cc" )
184 (mailclient-encode-string-as-url subj)) 170 (mailclient-gather-addresses "Resent-bcc" )
185 "")))) 171 (mailclient-gather-addresses "Reply-To" )
186 ;; body 172 ;; The From field is not honored for now: it's
187 (mailclient-url-delim) "body=" 173 ;; not necessarily configured. The mail client
188 (progn 174 ;; knows the user's address(es)
189 (delete-region (point-min) delimline) 175 ;; (mailclient-gather-addresses "From" )
190 (unless (null character-coding) 176 ;; subject line
191 ;; mailto: and clipboard need UTF-8 and cannot deal with 177 (let ((subj (mail-fetch-field "Subject" nil t)))
192 ;; Content-Transfer-Encoding or Content-Type. 178 (widen) ;; so we can read the body later on
193 ;; FIXME: There is code duplication here with rmail.el. 179 (if subj ;; if non-blank
194 (set-buffer-multibyte nil) 180 ;; the mail client will deal with
195 (cond 181 ;; warning the user etc.
196 ((string= character-coding "base64") 182 (concat (mailclient-url-delim) "subject="
197 (base64-decode-region (point-min) (point-max))) 183 (mailclient-encode-string-as-url subj))
198 ((string= character-coding "quoted-printable") 184 ""))))
199 (mail-unquote-printable-region (point-min) (point-max) 185 ;; body
200 nil nil t)) 186 (mailclient-url-delim) "body="
201 (t (error "Unsupported Content-Transfer-Encoding: %s" 187 (progn
202 character-coding))) 188 (delete-region (point-min) delimline)
203 (decode-coding-region (point-min) (point-max) coding-system)) 189 (unless (null character-coding)
204 (mailclient-encode-string-as-url 190 ;; mailto: and clipboard need UTF-8 and cannot deal with
205 (if mailclient-place-body-on-clipboard-flag 191 ;; Content-Transfer-Encoding or Content-Type.
206 (progn 192 ;; FIXME: There is code duplication here with rmail.el.
207 (clipboard-kill-ring-save (point-min) (point-max)) 193 (set-buffer-multibyte nil)
208 (concat 194 (cond
209 "*** E-Mail body has been placed on clipboard, " 195 ((string= character-coding "base64")
210 "please paste it here! ***")) 196 (base64-decode-region (point-min) (point-max)))
211 (buffer-string))))))))))) 197 ((string= character-coding "quoted-printable")
198 (mail-unquote-printable-region (point-min) (point-max)
199 nil nil t))
200 (t (error "Unsupported Content-Transfer-Encoding: %s"
201 character-coding)))
202 (decode-coding-region (point-min) (point-max) coding-system))
203 (mailclient-encode-string-as-url
204 (if mailclient-place-body-on-clipboard-flag
205 (progn
206 (clipboard-kill-ring-save (point-min) (point-max))
207 (concat
208 "*** E-Mail body has been placed on clipboard, "
209 "please paste it here! ***"))
210 (buffer-string))))))))))
212 211
213(provide 'mailclient) 212(provide 'mailclient)
214 213
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f0aa0c6ecf5..78688d170cc 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -1068,52 +1068,51 @@ Returns an error if the server cannot be contacted."
1068 1068
1069(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end) 1069(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)
1070 "Get address list suitable for smtp RCPT TO: <address>." 1070 "Get address list suitable for smtp RCPT TO: <address>."
1071 (unwind-protect 1071 (with-current-buffer smtpmail-address-buffer
1072 (with-current-buffer smtpmail-address-buffer 1072 (erase-buffer)
1073 (erase-buffer) 1073 (let ((case-fold-search t)
1074 (let ((case-fold-search t) 1074 (simple-address-list "")
1075 (simple-address-list "") 1075 this-line
1076 this-line 1076 this-line-end
1077 this-line-end 1077 addr-regexp)
1078 addr-regexp) 1078 (insert-buffer-substring smtpmail-text-buffer header-start header-end)
1079 (insert-buffer-substring smtpmail-text-buffer header-start header-end) 1079 (goto-char (point-min))
1080 (goto-char (point-min)) 1080 ;; RESENT-* fields should stop processing of regular fields.
1081 ;; RESENT-* fields should stop processing of regular fields. 1081 (save-excursion
1082 (save-excursion 1082 (setq addr-regexp
1083 (setq addr-regexp 1083 (if (re-search-forward "^Resent-\\(To\\|Cc\\|Bcc\\):"
1084 (if (re-search-forward "^Resent-\\(To\\|Cc\\|Bcc\\):" 1084 header-end t)
1085 header-end t) 1085 "^Resent-\\(To\\|Cc\\|Bcc\\):"
1086 "^Resent-\\(To\\|Cc\\|Bcc\\):" 1086 "^\\(To:\\|Cc:\\|Bcc:\\)")))
1087 "^\\(To:\\|Cc:\\|Bcc:\\)"))) 1087
1088 1088 (while (re-search-forward addr-regexp header-end t)
1089 (while (re-search-forward addr-regexp header-end t) 1089 (replace-match "")
1090 (replace-match "") 1090 (setq this-line (match-beginning 0))
1091 (setq this-line (match-beginning 0)) 1091 (forward-line 1)
1092 (forward-line 1) 1092 ;; get any continuation lines
1093 ;; get any continuation lines 1093 (while (and (looking-at "^[ \t]+") (< (point) header-end))
1094 (while (and (looking-at "^[ \t]+") (< (point) header-end)) 1094 (forward-line 1))
1095 (forward-line 1)) 1095 (setq this-line-end (point-marker))
1096 (setq this-line-end (point-marker)) 1096 (setq simple-address-list
1097 (setq simple-address-list 1097 (concat simple-address-list " "
1098 (concat simple-address-list " " 1098 (mail-strip-quoted-names (buffer-substring this-line this-line-end)))))
1099 (mail-strip-quoted-names (buffer-substring this-line this-line-end))))) 1099 (erase-buffer)
1100 (erase-buffer) 1100 (insert " " simple-address-list "\n")
1101 (insert " " simple-address-list "\n") 1101 (subst-char-in-region (point-min) (point-max) 10 ? t) ; newline --> blank
1102 (subst-char-in-region (point-min) (point-max) 10 ? t) ; newline --> blank 1102 (subst-char-in-region (point-min) (point-max) ?, ? t) ; comma --> blank
1103 (subst-char-in-region (point-min) (point-max) ?, ? t) ; comma --> blank 1103 (subst-char-in-region (point-min) (point-max) 9 ? t) ; tab --> blank
1104 (subst-char-in-region (point-min) (point-max) 9 ? t) ; tab --> blank
1105 1104
1106 (goto-char (point-min)) 1105 (goto-char (point-min))
1107 ;; tidiness in case hook is not robust when it looks at this 1106 ;; tidiness in case hook is not robust when it looks at this
1108 (while (re-search-forward "[ \t]+" header-end t) (replace-match " ")) 1107 (while (re-search-forward "[ \t]+" header-end t) (replace-match " "))
1109 1108
1110 (goto-char (point-min)) 1109 (goto-char (point-min))
1111 (let (recipient-address-list) 1110 (let (recipient-address-list)
1112 (while (re-search-forward " \\([^ ]+\\) " (point-max) t) 1111 (while (re-search-forward " \\([^ ]+\\) " (point-max) t)
1113 (backward-char 1) 1112 (backward-char 1)
1114 (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1)) 1113 (setq recipient-address-list (cons (buffer-substring (match-beginning 1) (match-end 1))
1115 recipient-address-list))) 1114 recipient-address-list)))
1116 (setq smtpmail-recipient-address-list recipient-address-list)))))) 1115 (setq smtpmail-recipient-address-list recipient-address-list)))))
1117 1116
1118(defun smtpmail-do-bcc (header-end) 1117(defun smtpmail-do-bcc (header-end)
1119 "Delete [Resent-]Bcc: and their continuation lines from the header area. 1118 "Delete [Resent-]Bcc: and their continuation lines from the header area.
diff --git a/lisp/mail/yenc.el b/lisp/mail/yenc.el
index de1e1ee283a..a836f5b71bd 100644
--- a/lisp/mail/yenc.el
+++ b/lisp/mail/yenc.el
@@ -111,8 +111,8 @@
111 (message "Warning: Size mismatch while decoding.")) 111 (message "Warning: Size mismatch while decoding."))
112 (goto-char start) 112 (goto-char start)
113 (delete-region start end) 113 (delete-region start end)
114 (insert-buffer-substring work-buffer)))) 114 (insert-buffer-substring work-buffer)))))
115 (and work-buffer (kill-buffer work-buffer)))))) 115 (and work-buffer (kill-buffer work-buffer)))))
116 116
117;;;###autoload 117;;;###autoload
118(defun yenc-extract-filename () 118(defun yenc-extract-filename ()
diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el
index 76116010b33..eeea94a69e5 100644
--- a/lisp/mh-e/mh-print.el
+++ b/lisp/mh-e/mh-print.el
@@ -79,8 +79,7 @@ commands \\[mh-ps-print-toggle-color] and
79This is the function that actually does the work. 79This is the function that actually does the work.
80If FILE is nil, then the messages are spooled to the printer." 80If FILE is nil, then the messages are spooled to the printer."
81 (mh-iterate-on-range msg range 81 (mh-iterate-on-range msg range
82 (unwind-protect 82 (mh-ps-spool-msg msg)
83 (mh-ps-spool-msg msg))
84 (mh-notate msg mh-note-printed mh-cmd-note)) 83 (mh-notate msg mh-note-printed mh-cmd-note))
85 (ps-despool file)) 84 (ps-despool file))
86 85
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 1be52d24e34..caa74159ecd 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -447,13 +447,12 @@ See also `text-scale-adjust'."
447This invokes `global-text-scale-adjust', which see." 447This invokes `global-text-scale-adjust', which see."
448 (interactive (list last-input-event)) 448 (interactive (list last-input-event))
449 (let ((button (mwheel-event-button event))) 449 (let ((button (mwheel-event-button event)))
450 (unwind-protect 450 (cond ((memq button (list mouse-wheel-down-event
451 (cond ((memq button (list mouse-wheel-down-event 451 mouse-wheel-down-alternate-event))
452 mouse-wheel-down-alternate-event)) 452 (global-text-scale-adjust 1))
453 (global-text-scale-adjust 1)) 453 ((memq button (list mouse-wheel-up-event
454 ((memq button (list mouse-wheel-up-event 454 mouse-wheel-up-alternate-event))
455 mouse-wheel-up-alternate-event)) 455 (global-text-scale-adjust -1)))))
456 (global-text-scale-adjust -1))))))
457 456
458(defun mouse-wheel--add-binding (key fun) 457(defun mouse-wheel--add-binding (key fun)
459 "Bind mouse wheel button KEY to function FUN. 458 "Bind mouse wheel button KEY to function FUN.
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 60113ca1410..29f351ca021 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -2591,13 +2591,12 @@ interrupted by the user."
2591 (if (not speedbar-stealthy-update-recurse) 2591 (if (not speedbar-stealthy-update-recurse)
2592 (let ((l (speedbar-initial-stealthy-functions)) 2592 (let ((l (speedbar-initial-stealthy-functions))
2593 (speedbar-stealthy-update-recurse t)) 2593 (speedbar-stealthy-update-recurse t))
2594 (unwind-protect 2594 (speedbar-with-writable
2595 (speedbar-with-writable 2595 (while (and l (funcall (car l)))
2596 (while (and l (funcall (car l))) 2596 ;;(sit-for 0)
2597 ;;(sit-for 0) 2597 (setq l (cdr l))))
2598 (setq l (cdr l)))) 2598 ;;(dframe-message "Exit with %S" (car l))
2599 ;;(dframe-message "Exit with %S" (car l)) 2599 )))
2600 ))))
2601 2600
2602(defun speedbar-reset-scanners () 2601(defun speedbar-reset-scanners ()
2603 "Reset any variables used by functions in the stealthy list as state. 2602 "Reset any variables used by functions in the stealthy list as state.
@@ -3572,38 +3571,36 @@ value is \"show\" then toggle the value of
3572 "For FILE, run etags and create a list of symbols extracted. 3571 "For FILE, run etags and create a list of symbols extracted.
3573Each symbol will be associated with its line position in FILE." 3572Each symbol will be associated with its line position in FILE."
3574 (let ((newlist nil)) 3573 (let ((newlist nil))
3575 (unwind-protect 3574 (save-excursion
3576 (save-excursion 3575 (if (get-buffer "*etags tmp*")
3577 (if (get-buffer "*etags tmp*") 3576 (kill-buffer "*etags tmp*")) ;kill to clean it up
3578 (kill-buffer "*etags tmp*")) ;kill to clean it up 3577 (if (<= 1 speedbar-verbosity-level)
3579 (if (<= 1 speedbar-verbosity-level) 3578 (dframe-message "Fetching etags..."))
3580 (dframe-message "Fetching etags...")) 3579 (set-buffer (get-buffer-create "*etags tmp*"))
3581 (set-buffer (get-buffer-create "*etags tmp*")) 3580 (apply 'call-process speedbar-fetch-etags-command nil
3582 (apply 'call-process speedbar-fetch-etags-command nil 3581 (current-buffer) nil
3583 (current-buffer) nil 3582 (append speedbar-fetch-etags-arguments (list file)))
3584 (append speedbar-fetch-etags-arguments (list file))) 3583 (goto-char (point-min))
3585 (goto-char (point-min)) 3584 (if (<= 1 speedbar-verbosity-level)
3586 (if (<= 1 speedbar-verbosity-level) 3585 (dframe-message "Fetching etags..."))
3587 (dframe-message "Fetching etags...")) 3586 (let ((expr
3588 (let ((expr 3587 (let ((exprlst speedbar-fetch-etags-parse-list)
3589 (let ((exprlst speedbar-fetch-etags-parse-list) 3588 (ans nil))
3590 (ans nil)) 3589 (while (and (not ans) exprlst)
3591 (while (and (not ans) exprlst) 3590 (if (string-match (car (car exprlst)) file)
3592 (if (string-match (car (car exprlst)) file) 3591 (setq ans (car exprlst)))
3593 (setq ans (car exprlst))) 3592 (setq exprlst (cdr exprlst)))
3594 (setq exprlst (cdr exprlst))) 3593 (cdr ans))))
3595 (cdr ans)))) 3594 (if expr
3596 (if expr 3595 (let (tnl)
3597 (let (tnl) 3596 (set-buffer (get-buffer-create "*etags tmp*"))
3598 (set-buffer (get-buffer-create "*etags tmp*")) 3597 (while (not (save-excursion (end-of-line) (eobp)))
3599 (while (not (save-excursion (end-of-line) (eobp))) 3598 (save-excursion
3600 (save-excursion 3599 (setq tnl (speedbar-extract-one-symbol expr)))
3601 (setq tnl (speedbar-extract-one-symbol expr))) 3600 (if tnl (setq newlist (cons tnl newlist)))
3602 (if tnl (setq newlist (cons tnl newlist))) 3601 (forward-line 1)))
3603 (forward-line 1))) 3602 (dframe-message
3604 (dframe-message 3603 "Sorry, no support for a file of that extension"))))
3605 "Sorry, no support for a file of that extension"))))
3606 )
3607 (if speedbar-sort-tags 3604 (if speedbar-sort-tags
3608 (sort newlist (lambda (a b) (string< (car a) (car b)))) 3605 (sort newlist (lambda (a b) (string< (car a) (car b))))
3609 (reverse newlist)))) 3606 (reverse newlist))))
diff --git a/lisp/strokes.el b/lisp/strokes.el
index fe244d448d8..293bdf0f369 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -760,27 +760,27 @@ Optional EVENT is acceptable as the starting event of the stroke."
760 (setq safe-to-draw-p t)) 760 (setq safe-to-draw-p t))
761 (push (cdr (mouse-pixel-position)) 761 (push (cdr (mouse-pixel-position))
762 pix-locs))) 762 pix-locs)))
763 (setq event (read--potential-mouse-event))))) 763 (setq event (read--potential-mouse-event))))
764 ;; protected 764 ;; protected
765 ;; clean up strokes buffer and then bury it. 765 ;; clean up strokes buffer and then bury it.
766 (when (equal (buffer-name) strokes-buffer-name) 766 (when (equal (buffer-name) strokes-buffer-name)
767 (subst-char-in-region (point-min) (point-max) 767 (subst-char-in-region (point-min) (point-max)
768 strokes-character ?\s) 768 strokes-character ?\s)
769 (goto-char (point-min)) 769 (goto-char (point-min))
770 (bury-buffer)))) 770 (bury-buffer))))
771 ;; Otherwise, don't use strokes buffer and read stroke silently 771 ;; Otherwise, don't use strokes buffer and read stroke silently
772 (when prompt 772 (when prompt
773 (message "%s" prompt) 773 (message "%s" prompt)
774 (setq event (read--potential-mouse-event)) 774 (setq event (read--potential-mouse-event))
775 (or (strokes-button-press-event-p event) 775 (or (strokes-button-press-event-p event)
776 (error "You must draw with the mouse"))) 776 (error "You must draw with the mouse")))
777 (track-mouse 777 (track-mouse
778 (or event (setq event (read--potential-mouse-event))) 778 (or event (setq event (read--potential-mouse-event)))
779 (while (not (strokes-button-release-event-p event)) 779 (while (not (strokes-button-release-event-p event))
780 (if (strokes-mouse-event-p event) 780 (if (strokes-mouse-event-p event)
781 (push (cdr (mouse-pixel-position)) 781 (push (cdr (mouse-pixel-position))
782 pix-locs)) 782 pix-locs))
783 (setq event (read--potential-mouse-event)))) 783 (setq event (read--potential-mouse-event)))))
784 (setq grid-locs (strokes-renormalize-to-grid (nreverse pix-locs))) 784 (setq grid-locs (strokes-renormalize-to-grid (nreverse pix-locs)))
785 (strokes-fill-stroke 785 (strokes-fill-stroke
786 (strokes-eliminate-consecutive-redundancies grid-locs))))) 786 (strokes-eliminate-consecutive-redundancies grid-locs)))))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 778591a8069..c7a297d5dac 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1445,20 +1445,19 @@ match, the user will be asked to confirm the replacement."
1445 (as-words reftex-index-phrases-search-whole-words)) 1445 (as-words reftex-index-phrases-search-whole-words))
1446 (unless macro-data 1446 (unless macro-data
1447 (error "No macro associated with key %c" char)) 1447 (error "No macro associated with key %c" char))
1448 (unwind-protect 1448 (let ((overlay-arrow-string "=>")
1449 (let ((overlay-arrow-string "=>") 1449 (overlay-arrow-position
1450 (overlay-arrow-position 1450 reftex-index-phrases-marker)
1451 reftex-index-phrases-marker) 1451 (replace-count 0))
1452 (replace-count 0)) 1452 ;; Show the overlay arrow
1453 ;; Show the overlay arrow 1453 (move-marker reftex-index-phrases-marker
1454 (move-marker reftex-index-phrases-marker 1454 (match-beginning 0) (current-buffer))
1455 (match-beginning 0) (current-buffer)) 1455 ;; Start the query-replace
1456 ;; Start the query-replace 1456 (reftex-query-index-phrase-globally
1457 (reftex-query-index-phrase-globally 1457 files phrase macro-fmt
1458 files phrase macro-fmt 1458 index-key repeat as-words)
1459 index-key repeat as-words) 1459 (message "%s replaced"
1460 (message "%s replaced" 1460 (reftex-number replace-count "occurrence")))))
1461 (reftex-number replace-count "occurrence"))))))
1462 (t (error "Cannot parse this line"))))) 1461 (t (error "Cannot parse this line")))))
1463 1462
1464(defun reftex-index-all-phrases () 1463(defun reftex-index-all-phrases ()
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 2271d83eff5..50c3f461bcc 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -1935,8 +1935,8 @@ specific features."
1935 (if (and cell table-detect-cell-alignment) 1935 (if (and cell table-detect-cell-alignment)
1936 (table--detect-cell-alignment cell))) 1936 (table--detect-cell-alignment cell)))
1937 (unless (re-search-forward border end t) 1937 (unless (re-search-forward border end t)
1938 (goto-char end)))))))))) 1938 (goto-char end))))))
1939 (restore-buffer-modified-p modified-flag))) 1939 (restore-buffer-modified-p modified-flag)))))))
1940 1940
1941;;;###autoload 1941;;;###autoload
1942(defun table-unrecognize-region (beg end) 1942(defun table-unrecognize-region (beg end)
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 347bdfc0d7b..0701b229edd 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -477,9 +477,9 @@
477 ;;(should (= 0 (length (directory-files testdir nil "[0-9]" t -1)))) 477 ;;(should (= 0 (length (directory-files testdir nil "[0-9]" t -1))))
478 (should (= 5 (length (directory-files testdir nil "[0-9]" t)))) 478 (should (= 5 (length (directory-files testdir nil "[0-9]" t))))
479 (should (= 5 (length (directory-files testdir nil "[0-9]" t 50)))) 479 (should (= 5 (length (directory-files testdir nil "[0-9]" t 50))))
480 (should-not (directory-empty-p testdir))) 480 (should-not (directory-empty-p testdir))))
481 481
482 (delete-directory testdir t))))) 482 (delete-directory testdir t))))
483 483
484(ert-deftest dired-test-directory-files-and-attributes () 484(ert-deftest dired-test-directory-files-and-attributes ()
485 "Test for `directory-files-and-attributes'." 485 "Test for `directory-files-and-attributes'."
diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el
index 3e499fc6f59..7713a0f6e38 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -577,13 +577,12 @@ This macro is used to test if macroexpansion in `should' works."
577 (lambda (format-string &rest args) 577 (lambda (format-string &rest args)
578 (push (apply #'format format-string args) messages)))) 578 (push (apply #'format format-string args) messages))))
579 (save-window-excursion 579 (save-window-excursion
580 (unwind-protect 580 (let ((case-fold-search nil)
581 (let ((case-fold-search nil) 581 (ert-batch-backtrace-right-margin nil)
582 (ert-batch-backtrace-right-margin nil) 582 (ert-batch-print-level 10)
583 (ert-batch-print-level 10) 583 (ert-batch-print-length 11))
584 (ert-batch-print-length 11)) 584 (ert-run-tests-batch
585 (ert-run-tests-batch 585 `(member ,failing-test-1 ,failing-test-2)))))
586 `(member ,failing-test-1 ,failing-test-2))))))
587 (let ((long-text "(different-types[ \t\n]+(1 1 1 1 1 1 1 1 1 1 1)[ \t\n]+1)))[ \t\n]*$") 586 (let ((long-text "(different-types[ \t\n]+(1 1 1 1 1 1 1 1 1 1 1)[ \t\n]+1)))[ \t\n]*$")
588 (complex-text "(different-types[ \t\n]+((:1[ \t\n]+(:2[ \t\n]+(:3[ \t\n]+(:4[ \t\n]+(:5[ \t\n]+(:6[ \t\n]+\"abc\")))))))[ \t\n]+1)))[ \t\n]*$") 587 (complex-text "(different-types[ \t\n]+((:1[ \t\n]+(:2[ \t\n]+(:3[ \t\n]+(:4[ \t\n]+(:5[ \t\n]+(:6[ \t\n]+\"abc\")))))))[ \t\n]+1)))[ \t\n]*$")
589 found-long 588 found-long
@@ -609,14 +608,13 @@ This macro is used to test if macroexpansion in `should' works."
609 (lambda (format-string &rest args) 608 (lambda (format-string &rest args)
610 (push (apply #'format format-string args) messages)))) 609 (push (apply #'format format-string args) messages))))
611 (save-window-excursion 610 (save-window-excursion
612 (unwind-protect 611 (let ((case-fold-search nil)
613 (let ((case-fold-search nil) 612 (ert-batch-backtrace-right-margin nil)
614 (ert-batch-backtrace-right-margin nil) 613 (ert-batch-backtrace-line-length nil)
615 (ert-batch-backtrace-line-length nil) 614 (ert-batch-print-level 6)
616 (ert-batch-print-level 6) 615 (ert-batch-print-length 11))
617 (ert-batch-print-length 11)) 616 (ert-run-tests-batch
618 (ert-run-tests-batch 617 `(member ,failing-test-1)))))
619 `(member ,failing-test-1))))))
620 (let ((frame "ert-fail(((should (equal complex-list 1)) :form (equal ((:1 (:2 (:3 (:4 (:5 (:6 \"abc\"))))))) 1) :value nil :explanation (different-types ((:1 (:2 (:3 (:4 (:5 (:6 \"abc\"))))))) 1)))") 618 (let ((frame "ert-fail(((should (equal complex-list 1)) :form (equal ((:1 (:2 (:3 (:4 (:5 (:6 \"abc\"))))))) 1) :value nil :explanation (different-types ((:1 (:2 (:3 (:4 (:5 (:6 \"abc\"))))))) 1)))")
621 found-frame) 619 found-frame)
622 (cl-loop for msg in (reverse messages) 620 (cl-loop for msg in (reverse messages)
diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el
index 37e84c148af..a5dadf21c8c 100644
--- a/test/lisp/gnus/mml-sec-tests.el
+++ b/test/lisp/gnus/mml-sec-tests.el
@@ -66,34 +66,29 @@ This fixture temporarily unsets GPG_AGENT_INFO to enable passphrase tests,
66which will neither work with gpgsm nor GnuPG 2.1 any longer, I guess. 66which will neither work with gpgsm nor GnuPG 2.1 any longer, I guess.
67Actually, I'm not sure why people would want to cache passwords in Emacs 67Actually, I'm not sure why people would want to cache passwords in Emacs
68instead of gpg-agent." 68instead of gpg-agent."
69 (unwind-protect 69 (let ((agent-info (getenv "GPG_AGENT_INFO"))
70 (let ((agent-info (getenv "GPG_AGENT_INFO")) 70 (gpghome (getenv "GNUPGHOME")))
71 (gpghome (getenv "GNUPGHOME"))) 71 (unwind-protect
72 (condition-case error 72 (let ((epg-gpg-home-directory (ert-resource-directory))
73 (let ((epg-gpg-home-directory (ert-resource-directory)) 73 (mml-smime-use 'epg)
74 (mml-smime-use 'epg) 74 ;; Create debug output in empty epg-debug-buffer.
75 ;; Create debug output in empty epg-debug-buffer. 75 (epg-debug t)
76 (epg-debug t) 76 (epg-debug-buffer (get-buffer-create " *epg-test*"))
77 (epg-debug-buffer (get-buffer-create " *epg-test*")) 77 (mml-secure-fail-when-key-problem (not interactive)))
78 (mml-secure-fail-when-key-problem (not interactive))) 78 (with-current-buffer epg-debug-buffer
79 (with-current-buffer epg-debug-buffer 79 (erase-buffer))
80 (erase-buffer)) 80 ;; Unset GPG_AGENT_INFO to enable passphrase caching inside Emacs.
81 ;; Unset GPG_AGENT_INFO to enable passphrase caching inside Emacs. 81 ;; Just for testing. Jens does not recommend this for daily use.
82 ;; Just for testing. Jens does not recommend this for daily use. 82 (setenv "GPG_AGENT_INFO")
83 (setenv "GPG_AGENT_INFO") 83 ;; Set GNUPGHOME as gpg-agent started by gpgsm does
84 ;; Set GNUPGHOME as gpg-agent started by gpgsm does 84 ;; not look in the proper places otherwise, see:
85 ;; not look in the proper places otherwise, see: 85 ;; https://bugs.gnupg.org/gnupg/issue2126
86 ;; https://bugs.gnupg.org/gnupg/issue2126 86 (setenv "GNUPGHOME" epg-gpg-home-directory)
87 (setenv "GNUPGHOME" epg-gpg-home-directory) 87 (unwind-protect
88 (unwind-protect 88 (funcall body)
89 (funcall body) 89 (mml-sec-test--kill-gpg-agent)))
90 (mml-sec-test--kill-gpg-agent))) 90 (setenv "GPG_AGENT_INFO" agent-info)
91 (error 91 (setenv "GNUPGHOME" gpghome))))
92 (setenv "GPG_AGENT_INFO" agent-info)
93 (setenv "GNUPGHOME" gpghome)
94 (signal (car error) (cdr error))))
95 (setenv "GPG_AGENT_INFO" agent-info)
96 (setenv "GNUPGHOME" gpghome))))
97 92
98(defun mml-secure-test-message-setup (method to from &optional text bcc) 93(defun mml-secure-test-message-setup (method to from &optional text bcc)
99 "Setup a buffer with MML METHOD, TO, and FROM headers. 94 "Setup a buffer with MML METHOD, TO, and FROM headers.
diff --git a/test/lisp/hl-line-tests.el b/test/lisp/hl-line-tests.el
index 56924ff8e3e..9c120e0d7ff 100644
--- a/test/lisp/hl-line-tests.el
+++ b/test/lisp/hl-line-tests.el
@@ -104,10 +104,10 @@
104 (run-hooks 'post-command-hook) 104 (run-hooks 'post-command-hook)
105 (should (hl-line-tests-verify 257 t)) 105 (should (hl-line-tests-verify 257 t))
106 (with-current-buffer second-buffer 106 (with-current-buffer second-buffer
107 (should (hl-line-tests-verify 999 nil))))) 107 (should (hl-line-tests-verify 999 nil))))
108 (let (kill-buffer-query-functions) 108 (let (kill-buffer-query-functions)
109 (ignore-errors (kill-buffer first-buffer)) 109 (ignore-errors (kill-buffer first-buffer))
110 (ignore-errors (kill-buffer second-buffer))))) 110 (ignore-errors (kill-buffer second-buffer))))))
111 111
112(provide 'hl-line-tests) 112(provide 'hl-line-tests)
113 113
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 050ee22ac18..8f46c2af136 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -579,7 +579,8 @@
579 (cons (mapcar (pcase-lambda (`(,evald ,func ,args ,_)) 579 (cons (mapcar (pcase-lambda (`(,evald ,func ,args ,_))
580 `(,evald ,func ,@args)) 580 `(,evald ,func ,@args))
581 (backtrace-frames base)) 581 (backtrace-frames base))
582 (subr-test--backtrace-frames-with-backtrace-frame base)))))) 582 (subr-test--backtrace-frames-with-backtrace-frame base))
583 (sit-for 0))))) ; dummy unwind form
583 584
584(defun subr-test--frames-1 (base) 585(defun subr-test--frames-1 (base)
585 (subr-test--frames-2 base)) 586 (subr-test--frames-2 base))