commit 52f3fe46a35df28cc7a07c0a3f551e67760455b2 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Thu Dec 9 11:40:39 2021 +0800 Fix jumping cursor during interpolated scrolls * lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down-page): Go to next position before setting start or vscroll. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 2bef8ca5b0..f21cdaed3d 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -459,6 +459,14 @@ the height of the current window." (set-window-vscroll nil (+ (window-vscroll nil t) delta) t) + (when (and (or (< (point) next-pos)) + (let ((pos-visibility (pos-visible-in-window-p next-pos nil t))) + (and pos-visibility + (or (eq (length pos-visibility) 2) + (when-let* ((posn (posn-at-point next-pos))) + (> (cdr (posn-object-width-height posn)) + usable-height)))))) + (goto-char next-pos)) (set-window-start nil (if (zerop (window-hscroll)) desired-start (save-excursion @@ -466,15 +474,7 @@ the height of the current window." (beginning-of-visual-line) (point))) t) - (set-window-vscroll nil desired-vscroll t)) - (if (and (or (< (point) next-pos)) - (let ((pos-visibility (pos-visible-in-window-p next-pos nil t))) - (and pos-visibility - (or (eq (length pos-visibility) 2) - (when-let* ((posn (posn-at-point next-pos))) - (> (cdr (posn-object-width-height posn)) - usable-height)))))) - (goto-char next-pos)))) + (set-window-vscroll nil desired-vscroll t)))) (defun pixel-scroll-precision-scroll-down (delta) "Scroll the current window down by DELTA pixels." commit bb1252bdb33c2ccb765fd3dc4cb94e508f13a0c6 Author: Po Lu Date: Thu Dec 9 11:11:26 2021 +0800 Allow customizing step between each interpolated scroll * lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): Use new option. (pixel-scroll-precision-interpolation-between-scroll): New user option. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 94c14d50dc..2bef8ca5b0 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -153,6 +153,12 @@ Nil means to not interpolate such scrolls." :type 'float :version "29.1") +(defcustom pixel-scroll-precision-interpolation-between-scroll 0.001 + "The number of seconds between each step of an interpolated scroll." + :group 'mouse + :type 'float + :version "29.1") + (defun pixel-scroll-in-rush-p () "Return non-nil if next scroll should be non-smooth. When scrolling request is delivered soon after the previous one, @@ -546,7 +552,7 @@ animation." (factor pixel-scroll-precision-interpolation-factor) (last-time (float-time)) (time-elapsed 0.0) - (between-scroll 0.001) + (between-scroll pixel-scroll-precision-interpolation-between-scroll) (rem (window-parameter nil 'interpolated-scroll-remainder)) (time (window-parameter nil 'interpolated-scroll-remainder-time))) (when (and rem time commit dae4fc738a27cd449b90a01d2793dd36316f3435 Author: Stefan Kangas Date: Thu Dec 9 03:28:19 2021 +0100 image-dired: Show image info in header line * lisp/image-dired.el (image-dired-update-header-line): New function to show image information in the header line. (image-dired-display-thumb-properties): Make obsolete. (image-dired-track-thumbnail) (image-dired--display-thumb-properties-fun) (image-dired-forward-image, image-dired-next-line) (image-dired-previous-line, image-dired-beginning-of-buffer) (image-dired-end-of-buffer, image-dired-read-comment): Use image-dired-update-header-line instead of image-dired-display-thumb-properties. diff --git a/etc/NEWS b/etc/NEWS index 9eee04b339..0fee98d119 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -616,6 +616,10 @@ If this option is non-nil (the default), marking, unmarking or flagging an image in either the thumbnail or display buffer shows the next image. +--- +*** Now shows image information in the header line. +This replaces the message shown at the bottom of the screen. + +++ *** 'image-dired-show-all-from-dir-max-files' has been increased to 500. This option controls asking for confirmation when starting Image-Dired diff --git a/lisp/image-dired.el b/lisp/image-dired.el index c5cc586f25..22e725c216 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1282,7 +1282,7 @@ but the other way around." (when found (if (setq window (image-dired-thumbnail-window)) (set-window-point window (point))) - (image-dired-display-thumb-properties)))))) + (image-dired-update-header-line)))))) (defun image-dired-dired-next-line (&optional arg) "Call `dired-next-line', then track thumbnail. @@ -1309,7 +1309,7 @@ With prefix argument, move ARG lines." (when (and (equal (current-buffer) old-buf) (= (point) old-point)) (ignore-errors - (image-dired-display-thumb-properties)))))) + (image-dired-update-header-line)))))) (defun image-dired-forward-image (&optional arg wrap-around) "Move to next image and display properties. @@ -1332,13 +1332,13 @@ point is on the last image, move to the last one and vice versa." (setq pos (point)) (image-dired-image-at-point-p))) (progn (goto-char pos) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (if wrap-around (progn (goto-char (if (> arg 0) (point-min) ;; There are two spaces after the last image. (- (point-max) 2))) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (message "At %s image" (if (> arg 0) "last" "first")) (run-at-time 1 nil (image-dired--display-thumb-properties-fun)))))) (when image-dired-track-movement @@ -1363,7 +1363,7 @@ On reaching end or beginning of buffer, stop and show a message." (image-dired-backward-image)) (if image-dired-track-movement (image-dired-track-original-file)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (defun image-dired-previous-line () @@ -1380,7 +1380,7 @@ On reaching end or beginning of buffer, stop and show a message." (image-dired-backward-image)) (if image-dired-track-movement (image-dired-track-original-file)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (defun image-dired-beginning-of-buffer () "Move to the first image in the buffer and display properties." @@ -1391,7 +1391,7 @@ On reaching end or beginning of buffer, stop and show a message." (forward-char 1)) (when image-dired-track-movement (image-dired-track-original-file)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (defun image-dired-end-of-buffer () "Move to the last image in the buffer and display properties." @@ -1402,7 +1402,7 @@ On reaching end or beginning of buffer, stop and show a message." (forward-char -1)) (when image-dired-track-movement (image-dired-track-original-file)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (defun image-dired-format-properties-string (buf file props comment) "Format display properties. @@ -1417,21 +1417,23 @@ comment." (cons ?t (or props "")) (cons ?c (or comment ""))))) -(defun image-dired-display-thumb-properties () - "Display thumbnail properties in the echo area." - (if (not (eobp)) - (let ((file-name (file-name-nondirectory (image-dired-original-file-name))) - (dired-buf (buffer-name (image-dired-associated-dired-buffer))) - (props (mapconcat #'identity (get-text-property (point) 'tags) ", ")) - (comment (get-text-property (point) 'comment)) - (message-log-max nil)) - (if file-name - (message "%s" - (image-dired-format-properties-string - dired-buf - file-name - props - comment)))))) +(defun image-dired-update-header-line () + "Update image information in the header line." + (when (and (not (eobp)) + (memq major-mode '(image-dired-thumbnail-mode + image-dired-display-image-mode))) + (let ((file-name (file-name-nondirectory (image-dired-original-file-name))) + (dired-buf (buffer-name (image-dired-associated-dired-buffer))) + (props (mapconcat #'identity (get-text-property (point) 'tags) ", ")) + (comment (get-text-property (point) 'comment)) + (message-log-max nil)) + (if file-name + (setq header-line-format + (image-dired-format-properties-string + dired-buf + file-name + props + comment)))))) (defun image-dired-dired-file-marked-p (&optional marker) "In Dired, return t if file on current line is marked. @@ -2231,7 +2233,7 @@ FILE-COMMENTS is an alist on the following form: (comment (image-dired-read-comment file))) (image-dired-write-comments (list (cons file comment))) (image-dired-update-property 'comment comment)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) (defun image-dired-read-comment (&optional file) "Read comment for an image. @@ -2324,7 +2326,7 @@ non-nil." (image-dired-backward-image)) (if image-dired-track-movement (image-dired-track-original-file)) - (image-dired-display-thumb-properties)) + (image-dired-update-header-line)) @@ -3015,6 +3017,11 @@ Dired." (cons (list tag file) (cdr image-dired-tag-file-list)))) (setq image-dired-tag-file-list (list (list tag file)))))) +(defun image-dired-display-thumb-properties () + "Display thumbnail properties in the echo area." + (declare (obsolete image-dired-update-header-line "29.1")) + (image-dired-update-header-line)) + (defvar image-dired-slideshow-count 0 "Keeping track on number of images in slideshow.") (make-obsolete-variable 'image-dired-slideshow-count "no longer used." "29.1") commit 63f07ea22f3954c2154d831017caf494911cb515 Author: Stefan Kangas Date: Thu Dec 9 00:57:34 2021 +0100 image-dired: Go to next image when marking * lisp/image-dired.el (image-dired-marking-shows-next): New user option to show the next image after marking, unmarking or flagging an image. (image-dired--do-mark-command): New macro. (image-dired-mark-thumb-original-file) (image-dired-unmark-thumb-original-file) (image-dired-flag-thumb-original-file) (image-dired-toggle-mark-thumb-original-file) (image-dired-unmark-all-marks): Use above new macro. diff --git a/etc/NEWS b/etc/NEWS index b9134d850e..9eee04b339 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -610,6 +610,12 @@ The command 'bookmark-set' (bound to 'C-x r m') is now supported in the thumbnail view, and will create a bookmark that opens the current directory in Image-Dired. +--- +*** New user option 'image-dired-marking-shows-next'. +If this option is non-nil (the default), marking, unmarking or +flagging an image in either the thumbnail or display buffer shows the +next image. + +++ *** 'image-dired-show-all-from-dir-max-files' has been increased to 500. This option controls asking for confirmation when starting Image-Dired diff --git a/lisp/image-dired.el b/lisp/image-dired.el index e1c794472b..c5cc586f25 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -490,6 +490,17 @@ variable is nil, it will never ask." (const :tag "Disable warning" nil)) :version "29.1") +(defcustom image-dired-marking-shows-next t + "If non-nil, marking, unmarking or flagging an image shows the next image. + +This affects the following commands: +\\ + `image-dired-flag-thumb-original-file' (bound to \\[image-dired-flag-thumb-original-file]) + `image-dired-mark-thumb-original-file' (bound to \\[image-dired-mark-thumb-original-file]) + `image-dired-unmark-thumb-original-file' (bound to \\[image-dired-unmark-thumb-original-file])" + :type 'boolean + :version "29.1") + ;;; Util functions @@ -1459,46 +1470,53 @@ Should be called from commands in `image-dired-thumbnail-mode'." ,@body (image-dired-thumb-update-marks)))))) +(defmacro image-dired--do-mark-command (maybe-next &rest body) + "Helper macro for the mark, unmark and flag commands. +Run BODY in Dired buffer. +If optional argument MAYBE-NEXT is non-nil, show next image +according to `image-dired-marking-shows-next'." + (declare (indent defun) (debug t)) + `(image-dired--with-thumbnail-buffer + (image-dired--on-file-in-dired-buffer + ,@body) + ,(when maybe-next + '(if image-dired-marking-shows-next + (image-dired-display-next-thumbnail-original) + (image-dired-next-line))))) + (defun image-dired-mark-thumb-original-file () "Mark original image file in associated Dired buffer." (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) - (image-dired--with-thumbnail-buffer - (image-dired--on-file-in-dired-buffer - (dired-mark 1)) - (image-dired-forward-image))) + (image-dired--do-mark-command t + (dired-mark 1))) (defun image-dired-unmark-thumb-original-file () "Unmark original image file in associated Dired buffer." (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) - (image-dired--with-thumbnail-buffer - (image-dired--on-file-in-dired-buffer - (dired-unmark 1)) - (image-dired-forward-image))) + (image-dired--do-mark-command t + (dired-unmark 1))) (defun image-dired-flag-thumb-original-file () "Flag original image file for deletion in associated Dired buffer." (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) - (image-dired--with-thumbnail-buffer - (image-dired--on-file-in-dired-buffer - (dired-flag-file-deletion 1)) - (image-dired-forward-image))) + (image-dired--do-mark-command t + (dired-flag-file-deletion 1))) (defun image-dired-toggle-mark-thumb-original-file () "Toggle mark on original image file in associated Dired buffer." (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) - (image-dired--with-thumbnail-buffer - (image-dired--on-file-in-dired-buffer - (if (image-dired-dired-file-marked-p) - (dired-unmark 1) - (dired-mark 1))))) + (image-dired--do-mark-command nil + (if (image-dired-dired-file-marked-p) + (dired-unmark 1) + (dired-mark 1)))) (defun image-dired-unmark-all-marks () "Remove all marks from all files in associated Dired buffer. Also update the marks in the thumbnail buffer." (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode) + (image-dired--do-mark-command nil + (dired-unmark-all-marks)) (image-dired--with-thumbnail-buffer - (with-current-buffer (image-dired-associated-dired-buffer) - (dired-unmark-all-marks)) (image-dired-thumb-update-marks))) (defun image-dired-jump-original-dired-buffer () commit 929a8010aca1a9ce8b740ef7e06b21abeb3466d9 Author: Stefan Kangas Date: Thu Dec 9 00:01:23 2021 +0100 image-dired: Remove some TODOs To the extent that these TODOs are relevant or useful, it would be better to add such features to image-mode directly. * lisp/image-dired.el: Remove some TODOs. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index d75ccfece1..e1c794472b 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -103,9 +103,6 @@ ;; TODO ;; ==== ;; -;; * Some sort of auto-rotate function based on rotate info in the -;; EXIF data. -;; ;; * Investigate if it is possible to also write the tags to the image ;; files. ;; @@ -114,12 +111,6 @@ ;; ;; * From thumbs.el: Add setroot function. ;; -;; * From thumbs.el: Add image resizing, if useful (image-dired's automatic -;; "image fit" might be enough) -;; -;; * From thumbs.el: Add the "modify" commands (emboss, negate, -;; monochrome etc). -;; ;; * Add `image-dired-display-thumbs-ring' and functions to cycle that. Find out ;; which is best, saving old batch just before inserting new, or ;; saving the current batch in the ring when inserting it. Adding commit c6bf11c281553121aaf0fc8686c75bd15dcb3a92 Author: Stefan Monnier Date: Wed Dec 8 16:58:24 2021 -0500 * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-named-let): New test diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index d836950600..821b6770ba 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -676,7 +676,7 @@ (buffer-string)) "foo\n"))) -(ert-deftest test-add-display-text-property () +(ert-deftest subr-x-test-add-display-text-property () (with-temp-buffer (insert "Foo bar zot gazonk") (add-display-text-property 4 8 'height 2.0) @@ -694,5 +694,23 @@ [(raise 0.5) (height 2.0)])) (should (equal (get-text-property 9 'display) '(raise 0.5))))) +(ert-deftest subr-x-named-let () + (let ((funs ())) + (named-let loop + ((rest '(1 42 3)) + (sum 0)) + (when rest + ;; Here, we make sure that the variables are distinct in every + ;; iteration, since a naive tail-call optimization would tend to end up + ;; with a single `sum' variable being shared by all the closures. + (push (lambda () sum) funs) + ;; Here we add a dummy `sum' variable which shadows the `sum' iteration + ;; variable since a naive tail-call optimization could also trip here + ;; thinking it can `(setq sum ...)' to set the iteration + ;; variable's value. + (let ((sum sum)) + (loop (cdr rest) (+ sum (car rest)))))) + (should (equal (mapcar #'funcall funs) '(43 1 0))))) + (provide 'subr-x-tests) ;;; subr-x-tests.el ends here commit 3a0e0187b711db69df48e16b35a577f046cf38b1 Author: Stefan Monnier Date: Wed Dec 8 16:22:24 2021 -0500 * test/lisp/emacs-lisp/cl-macs-tests.el: Avoid `with-suppressed-warnings` * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--progv): Use a proper namespace prefix for the global vars. diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 7c3afefaad..13da60ec45 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -668,13 +668,13 @@ collection clause." #'len)) (`(function (lambda (,_ ,_) . ,_)) t)))) -(with-suppressed-warnings ((lexical test) (lexical test1) (lexical test2)) - (defvar test) - (defvar test1) - (defvar test2)) (ert-deftest cl-macs--progv () - (should (= (cl-progv '(test test) '(1 2) test) 2)) - (should (equal (cl-progv '(test1 test2) '(1 2) (list test1 test2)) + (defvar cl-macs--test) + (defvar cl-macs--test1) + (defvar cl-macs--test2) + (should (= (cl-progv '(cl-macs--test cl-macs--test) '(1 2) cl-macs--test) 2)) + (should (equal (cl-progv '(cl-macs--test1 cl-macs--test2) '(1 2) + (list cl-macs--test1 cl-macs--test2)) '(1 2)))) ;;; cl-macs-tests.el ends here commit aa3434369e0b9aeb15e5802a5e2cee598e6c01e2 Author: Stefan Monnier Date: Wed Dec 8 16:14:03 2021 -0500 lisp/mouse.el: Fix some lambdas quoted with ` or ' Also prefer #' to quote named functions. * lisp/mouse.el (minor-mode-menu-from-indicator, context-menu-entry) ([C-down-mouse-3]): Don't abuse lambda lists for functions. (context-menu-mode): Remove redundant `:group`. (mouse-drag-line): Remove unused var `draggable`. (mouse-yank-primary): Make it work for non-mouse events. diff --git a/lisp/mouse.el b/lisp/mouse.el index 13dda5ca88..11fdd3f639 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -184,8 +184,8 @@ items `Turn Off' and `Help'." "-" " " (format "%S" minor-mode)))) (turn-off menu-item "Turn off minor mode" ,mm-fun) (help menu-item "Help for minor mode" - (lambda () (interactive) - (describe-function ',mm-fun))))))) + ,(lambda () (interactive) + (describe-function mm-fun))))))) (if menu (popup-menu menu) (message "No menu available"))))) @@ -271,7 +271,7 @@ not it is actually displayed." ;; FIXME: We have a problem here: we have to use the global/local/minor ;; so they're displayed in the expected order, but later on in the command ;; loop, they're actually looked up in the opposite order. - (apply 'append + (apply #'append global-menu local-menu minor-mode-menus))) @@ -525,7 +525,7 @@ Some context functions add menu items below the separator." (defvar context-menu-entry `(menu-item ,(purecopy "Context Menu") ,(make-sparse-keymap) - :filter (lambda (_) (context-menu-map))) + :filter ,(lambda (_) (context-menu-map))) "Menu item that creates the context menu and can be bound to a mouse key.") (defvar context-menu-mode-map @@ -546,7 +546,7 @@ Some context functions add menu items below the separator." When Context Menu mode is enabled, clicking the mouse button down-mouse-3 activates the menu whose contents depends on its surrounding context." - :global t :group 'mouse) + :global t) (defun context-menu-open () "Start key navigation of the context menu. @@ -558,7 +558,7 @@ This is the keyboard interface to \\[context-menu-map]." (call-interactively map) (popup-menu map (point))))) -(global-set-key [S-f10] 'context-menu-open) +(global-set-key [S-f10] #'context-menu-open) (defun mark-thing-at-mouse (click thing) "Activate the region around THING found near the mouse CLICK." @@ -613,7 +613,7 @@ This command must be bound to a mouse click." (or (eq frame oframe) (set-mouse-position (selected-frame) (1- (frame-width)) 0)))) -(define-obsolete-function-alias 'mouse-tear-off-window 'tear-off-window "24.4") +(define-obsolete-function-alias 'mouse-tear-off-window #'tear-off-window "24.4") (defun tear-off-window (click) "Delete the selected window, and create a new frame displaying its buffer." (interactive (list last-nonmenu-event)) @@ -689,7 +689,6 @@ must be one of the symbols `header', `mode', or `vertical'." ;; previously sampled position. The difference of `position' ;; and `last-position' determines the size change of WINDOW. (last-position position) - (draggable t) posn-window growth dragged) ;; Decide on whether we are allowed to track at all and whose ;; window's edge we drag. @@ -742,7 +741,7 @@ must be one of the symbols `header', `mode', or `vertical'." (setq dragged t) (adjust-window-trailing-edge window growth t t)) (setq last-position position)) - (draggable + (t ;; Drag bottom edge of `window'. (setq start (event-start event)) ;; Set `posn-window' to the window where `event' was recorded. @@ -1842,7 +1841,7 @@ If MODE is 2 then do the same for lines." event))) (setcar last new) (if (and (not (equal modifiers old-modifiers)) - (key-binding (apply 'vector events))) + (key-binding (apply #'vector events))) t (setcar last event) nil))) @@ -1896,12 +1895,12 @@ regardless of where you click." (setq mouse-selection-click-count 0) (yank arg)) -(defun mouse-yank-primary (click) - "Insert the primary selection at the position clicked on. +(defun mouse-yank-primary (&optional event) + "Insert the primary selection, Move point to the end of the inserted text, and set mark at beginning. If `mouse-yank-at-point' is non-nil, insert at point -regardless of where you click." - (interactive "e") +otherwise insert it at the position of EVENT." + (interactive (list last-nonmenu-event)) ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) ;; Without this, confusing things happen upon e.g. inserting into @@ -1909,7 +1908,7 @@ regardless of where you click." (when select-active-regions (let (select-active-regions) (deactivate-mark))) - (or mouse-yank-at-point (mouse-set-point click)) + (or mouse-yank-at-point (mouse-set-point event)) (let ((primary (gui-get-primary-selection))) (push-mark) (insert-for-yank primary))) @@ -2049,11 +2048,11 @@ if `mouse-drag-copy-region' is non-nil)." (setq mouse-save-then-kill-posn click-pt))))) -(global-set-key [M-mouse-1] 'mouse-start-secondary) -(global-set-key [M-drag-mouse-1] 'mouse-set-secondary) -(global-set-key [M-down-mouse-1] 'mouse-drag-secondary) -(global-set-key [M-mouse-3] 'mouse-secondary-save-then-kill) -(global-set-key [M-mouse-2] 'mouse-yank-secondary) +(global-set-key [M-mouse-1] #'mouse-start-secondary) +(global-set-key [M-drag-mouse-1] #'mouse-set-secondary) +(global-set-key [M-down-mouse-1] #'mouse-drag-secondary) +(global-set-key [M-mouse-3] #'mouse-secondary-save-then-kill) +(global-set-key [M-mouse-2] #'mouse-yank-secondary) (defconst mouse-secondary-overlay (let ((ol (make-overlay (point-min) (point-min)))) @@ -3213,78 +3212,78 @@ is copied instead of being cut." ;;; Bindings for mouse commands. -(global-set-key [down-mouse-1] 'mouse-drag-region) -(global-set-key [mouse-1] 'mouse-set-point) -(global-set-key [drag-mouse-1] 'mouse-set-region) +(global-set-key [down-mouse-1] #'mouse-drag-region) +(global-set-key [mouse-1] #'mouse-set-point) +(global-set-key [drag-mouse-1] #'mouse-set-region) (defun mouse--strip-first-event (_prompt) (substring (this-single-command-raw-keys) 1)) -(define-key function-key-map [left-fringe mouse-1] 'mouse--strip-first-event) -(define-key function-key-map [right-fringe mouse-1] 'mouse--strip-first-event) +(define-key function-key-map [left-fringe mouse-1] #'mouse--strip-first-event) +(define-key function-key-map [right-fringe mouse-1] #'mouse--strip-first-event) -(global-set-key [mouse-2] 'mouse-yank-primary) +(global-set-key [mouse-2] #'mouse-yank-primary) ;; Allow yanking also when the corresponding cursor is "in the fringe". -(define-key function-key-map [right-fringe mouse-2] 'mouse--strip-first-event) -(define-key function-key-map [left-fringe mouse-2] 'mouse--strip-first-event) -(global-set-key [mouse-3] 'mouse-save-then-kill) -(define-key function-key-map [right-fringe mouse-3] 'mouse--strip-first-event) -(define-key function-key-map [left-fringe mouse-3] 'mouse--strip-first-event) +(define-key function-key-map [right-fringe mouse-2] #'mouse--strip-first-event) +(define-key function-key-map [left-fringe mouse-2] #'mouse--strip-first-event) +(global-set-key [mouse-3] #'mouse-save-then-kill) +(define-key function-key-map [right-fringe mouse-3] #'mouse--strip-first-event) +(define-key function-key-map [left-fringe mouse-3] #'mouse--strip-first-event) ;; By binding these to down-going events, we let the user use the up-going ;; event to make the selection, saving a click. -(global-set-key [C-down-mouse-1] 'mouse-buffer-menu) +(global-set-key [C-down-mouse-1] #'mouse-buffer-menu) (if (not (eq system-type 'ms-dos)) - (global-set-key [S-down-mouse-1] 'mouse-appearance-menu)) + (global-set-key [S-down-mouse-1] #'mouse-appearance-menu)) ;; C-down-mouse-2 is bound in facemenu.el. (global-set-key [C-down-mouse-3] `(menu-item ,(purecopy "Menu Bar") ignore - :filter (lambda (_) - (if (zerop (or (frame-parameter nil 'menu-bar-lines) 0)) - (mouse-menu-bar-map) - (mouse-menu-major-mode-map))))) + :filter ,(lambda (_) + (if (zerop (or (frame-parameter nil 'menu-bar-lines) 0)) + (mouse-menu-bar-map) + (mouse-menu-major-mode-map))))) ;; Binding mouse-1 to mouse-select-window when on mode-, header-, or ;; vertical-line prevents Emacs from signaling an error when the mouse ;; button is released after dragging these lines, on non-toolkit ;; versions. -(global-set-key [header-line down-mouse-1] 'mouse-drag-header-line) -(global-set-key [header-line mouse-1] 'mouse-select-window) -(global-set-key [tab-line down-mouse-1] 'mouse-drag-tab-line) -(global-set-key [tab-line mouse-1] 'mouse-select-window) +(global-set-key [header-line down-mouse-1] #'mouse-drag-header-line) +(global-set-key [header-line mouse-1] #'mouse-select-window) +(global-set-key [tab-line down-mouse-1] #'mouse-drag-tab-line) +(global-set-key [tab-line mouse-1] #'mouse-select-window) ;; (global-set-key [mode-line drag-mouse-1] 'mouse-select-window) -(global-set-key [mode-line down-mouse-1] 'mouse-drag-mode-line) -(global-set-key [mode-line mouse-1] 'mouse-select-window) -(global-set-key [mode-line mouse-2] 'mouse-delete-other-windows) -(global-set-key [mode-line mouse-3] 'mouse-delete-window) -(global-set-key [mode-line C-mouse-2] 'mouse-split-window-horizontally) -(global-set-key [vertical-scroll-bar C-mouse-2] 'mouse-split-window-vertically) -(global-set-key [horizontal-scroll-bar C-mouse-2] 'mouse-split-window-horizontally) -(global-set-key [vertical-line down-mouse-1] 'mouse-drag-vertical-line) -(global-set-key [vertical-line mouse-1] 'mouse-select-window) -(global-set-key [vertical-line C-mouse-2] 'mouse-split-window-vertically) -(global-set-key [right-divider down-mouse-1] 'mouse-drag-vertical-line) -(global-set-key [right-divider mouse-1] 'ignore) -(global-set-key [right-divider C-mouse-2] 'mouse-split-window-vertically) -(global-set-key [bottom-divider down-mouse-1] 'mouse-drag-mode-line) -(global-set-key [bottom-divider mouse-1] 'ignore) -(global-set-key [bottom-divider C-mouse-2] 'mouse-split-window-horizontally) -(global-set-key [left-edge down-mouse-1] 'mouse-drag-left-edge) -(global-set-key [left-edge mouse-1] 'ignore) -(global-set-key [top-left-corner down-mouse-1] 'mouse-drag-top-left-corner) -(global-set-key [top-left-corner mouse-1] 'ignore) -(global-set-key [top-edge down-mouse-1] 'mouse-drag-top-edge) -(global-set-key [top-edge mouse-1] 'ignore) -(global-set-key [top-right-corner down-mouse-1] 'mouse-drag-top-right-corner) -(global-set-key [top-right-corner mouse-1] 'ignore) -(global-set-key [right-edge down-mouse-1] 'mouse-drag-right-edge) -(global-set-key [right-edge mouse-1] 'ignore) -(global-set-key [bottom-right-corner down-mouse-1] 'mouse-drag-bottom-right-corner) -(global-set-key [bottom-right-corner mouse-1] 'ignore) -(global-set-key [bottom-edge down-mouse-1] 'mouse-drag-bottom-edge) -(global-set-key [bottom-edge mouse-1] 'ignore) -(global-set-key [bottom-left-corner down-mouse-1] 'mouse-drag-bottom-left-corner) -(global-set-key [bottom-left-corner mouse-1] 'ignore) +(global-set-key [mode-line down-mouse-1] #'mouse-drag-mode-line) +(global-set-key [mode-line mouse-1] #'mouse-select-window) +(global-set-key [mode-line mouse-2] #'mouse-delete-other-windows) +(global-set-key [mode-line mouse-3] #'mouse-delete-window) +(global-set-key [mode-line C-mouse-2] #'mouse-split-window-horizontally) +(global-set-key [vertical-scroll-bar C-mouse-2] #'mouse-split-window-vertically) +(global-set-key [horizontal-scroll-bar C-mouse-2] #'mouse-split-window-horizontally) +(global-set-key [vertical-line down-mouse-1] #'mouse-drag-vertical-line) +(global-set-key [vertical-line mouse-1] #'mouse-select-window) +(global-set-key [vertical-line C-mouse-2] #'mouse-split-window-vertically) +(global-set-key [right-divider down-mouse-1] #'mouse-drag-vertical-line) +(global-set-key [right-divider mouse-1] #'ignore) +(global-set-key [right-divider C-mouse-2] #'mouse-split-window-vertically) +(global-set-key [bottom-divider down-mouse-1] #'mouse-drag-mode-line) +(global-set-key [bottom-divider mouse-1] #'ignore) +(global-set-key [bottom-divider C-mouse-2] #'mouse-split-window-horizontally) +(global-set-key [left-edge down-mouse-1] #'mouse-drag-left-edge) +(global-set-key [left-edge mouse-1] #'ignore) +(global-set-key [top-left-corner down-mouse-1] #'mouse-drag-top-left-corner) +(global-set-key [top-left-corner mouse-1] #'ignore) +(global-set-key [top-edge down-mouse-1] #'mouse-drag-top-edge) +(global-set-key [top-edge mouse-1] #'ignore) +(global-set-key [top-right-corner down-mouse-1] #'mouse-drag-top-right-corner) +(global-set-key [top-right-corner mouse-1] #'ignore) +(global-set-key [right-edge down-mouse-1] #'mouse-drag-right-edge) +(global-set-key [right-edge mouse-1] #'ignore) +(global-set-key [bottom-right-corner down-mouse-1] #'mouse-drag-bottom-right-corner) +(global-set-key [bottom-right-corner mouse-1] #'ignore) +(global-set-key [bottom-edge down-mouse-1] #'mouse-drag-bottom-edge) +(global-set-key [bottom-edge mouse-1] #'ignore) +(global-set-key [bottom-left-corner down-mouse-1] #'mouse-drag-bottom-left-corner) +(global-set-key [bottom-left-corner mouse-1] #'ignore) (provide 'mouse) commit 00d107ebead8d710cbe339d9af717e6eb2f9f2ff Author: Juri Linkov Date: Wed Dec 8 22:31:55 2021 +0200 * lisp/mouse.el (context-menu-entry): Bind to make-sparse-keymap, not ignore. Then where-is-internal does not run context-menu-map from the :filter, and no context menu functions are called by e.g. describe-mode in wrong buffer (bug#9923) diff --git a/lisp/mouse.el b/lisp/mouse.el index 459cce4cd9..13dda5ca88 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -524,7 +524,7 @@ Some context functions add menu items below the separator." menu) (defvar context-menu-entry - `(menu-item ,(purecopy "Context Menu") ignore + `(menu-item ,(purecopy "Context Menu") ,(make-sparse-keymap) :filter (lambda (_) (context-menu-map))) "Menu item that creates the context menu and can be bound to a mouse key.") commit 6cf358d7a270ce6fc7d032187fe042a9bf234240 Author: Stefan Kangas Date: Wed Dec 8 17:15:28 2021 +0100 Define some more keymaps in one step * lisp/calc/calc-store.el (calc-var-name-map): * lisp/mail/rmailsum.el (rmail-summary-edit-map): * lisp/speedbar.el (speedbar-buffers-key-map): Define in one step. * lisp/progmodes/ebrowse.el (ebrowse-global-submap-4) (ebrowse-global-submap-5): Define in one step and use defvar-keymap. diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index de2f18f394..817b50951d 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -163,19 +163,19 @@ tag (and (not val) 1)) (message "Variable \"%s\" changed" (calc-var-name var))))))) -(defvar calc-var-name-map nil "Keymap for reading Calc variable names.") -(if calc-var-name-map - () - (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map)) - (define-key calc-var-name-map " " 'self-insert-command) - (mapc (lambda (x) - (define-key calc-var-name-map (char-to-string x) - 'calcVar-digit)) - "0123456789") - (mapc (lambda (x) - (define-key calc-var-name-map (char-to-string x) - 'calcVar-oper)) - "+-*/^|")) +(defvar calc-var-name-map + (let ((map (copy-keymap minibuffer-local-completion-map))) + (define-key map " " #'self-insert-command) + (mapc (lambda (x) + (define-key map (char-to-string x) + #'calcVar-digit)) + "0123456789") + (mapc (lambda (x) + (define-key map (char-to-string x) + #'calcVar-oper)) + "+-*/^|") + map) + "Keymap for reading Calc variable names.") (defvar calc-store-opers) diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el index 9dd9573a9f..8fc3fc095c 100644 --- a/lisp/mail/rmailsum.el +++ b/lisp/mail/rmailsum.el @@ -1480,13 +1480,11 @@ argument says to read a file name and use that file as the inbox." (declare-function rmail-output-read-file-name "rmailout" ()) (declare-function mail-send-and-exit "sendmail" (&optional arg)) -(defvar rmail-summary-edit-map nil) -(if rmail-summary-edit-map - nil - (setq rmail-summary-edit-map - (nconc (make-sparse-keymap) text-mode-map)) - (define-key rmail-summary-edit-map "\C-c\C-c" 'rmail-cease-edit) - (define-key rmail-summary-edit-map "\C-c\C-]" 'rmail-abort-edit)) +(defvar rmail-summary-edit-map + (let ((map (nconc (make-sparse-keymap) text-mode-map))) + (define-key map "\C-c\C-c" #'rmail-cease-edit) + (define-key map "\C-c\C-]" #'rmail-abort-edit) + map)) (defun rmail-summary-edit-current-message () "Edit the contents of this message." diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 6e416d064a..0713370da3 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -4045,23 +4045,27 @@ NUMBER-OF-STATIC-VARIABLES:" (defvar ebrowse-global-map nil "Keymap for Ebrowse commands.") - (defvar ebrowse-global-prefix-key "\C-c\C-m" "Prefix key for Ebrowse commands.") - -(defvar ebrowse-global-submap-4 nil - "Keymap used for `ebrowse-global-prefix' followed by `4'.") - - -(defvar ebrowse-global-submap-5 nil - "Keymap used for `ebrowse-global-prefix' followed by `5'.") - +(defvar-keymap ebrowse-global-submap-4 + :doc "Keymap used for `ebrowse-global-prefix' followed by `4'." + "." #'ebrowse-tags-find-definition-other-window + "f" #'ebrowse-tags-find-definition-other-window + "v" #'ebrowse-tags-find-declaration-other-window + "F" #'ebrowse-tags-view-definition-other-window + "V" #'ebrowse-tags-view-declaration-other-window) + +(defvar-keymap ebrowse-global-submap-5 + :doc "Keymap used for `ebrowse-global-prefix' followed by `5'." + "." #'ebrowse-tags-find-definition-other-frame + "f" #'ebrowse-tags-find-definition-other-frame + "v" #'ebrowse-tags-find-declaration-other-frame + "F" #'ebrowse-tags-view-definition-other-frame + "V" #'ebrowse-tags-view-declaration-other-frame) (unless ebrowse-global-map (setq ebrowse-global-map (make-sparse-keymap)) - (setq ebrowse-global-submap-4 (make-sparse-keymap)) - (setq ebrowse-global-submap-5 (make-sparse-keymap)) (define-key ebrowse-global-map "a" 'ebrowse-tags-apropos) (define-key ebrowse-global-map "b" 'ebrowse-pop-to-browser-buffer) (define-key ebrowse-global-map "-" 'ebrowse-back-in-position-stack) @@ -4082,17 +4086,7 @@ NUMBER-OF-STATIC-VARIABLES:" (define-key ebrowse-global-map " " 'ebrowse-electric-buffer-list) (define-key ebrowse-global-map "\t" 'ebrowse-tags-complete-symbol) (define-key ebrowse-global-map "4" ebrowse-global-submap-4) - (define-key ebrowse-global-submap-4 "." 'ebrowse-tags-find-definition-other-window) - (define-key ebrowse-global-submap-4 "f" 'ebrowse-tags-find-definition-other-window) - (define-key ebrowse-global-submap-4 "v" 'ebrowse-tags-find-declaration-other-window) - (define-key ebrowse-global-submap-4 "F" 'ebrowse-tags-view-definition-other-window) - (define-key ebrowse-global-submap-4 "V" 'ebrowse-tags-view-declaration-other-window) (define-key ebrowse-global-map "5" ebrowse-global-submap-5) - (define-key ebrowse-global-submap-5 "." 'ebrowse-tags-find-definition-other-frame) - (define-key ebrowse-global-submap-5 "f" 'ebrowse-tags-find-definition-other-frame) - (define-key ebrowse-global-submap-5 "v" 'ebrowse-tags-find-declaration-other-frame) - (define-key ebrowse-global-submap-5 "F" 'ebrowse-tags-view-definition-other-frame) - (define-key ebrowse-global-submap-5 "V" 'ebrowse-tags-view-declaration-other-frame) (define-key global-map ebrowse-global-prefix-key ebrowse-global-map)) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 3cc3e27606..cfa96608bf 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -3694,27 +3694,21 @@ regular expression EXPR." ;;; BUFFER DISPLAY mode. ;; -(defvar speedbar-buffers-key-map nil +(defvar speedbar-buffers-key-map + (let ((map (speedbar-make-specialized-keymap))) + ;; Basic tree features + (define-key map "e" #'speedbar-edit-line) + (define-key map "\C-m" #'speedbar-edit-line) + (define-key map "+" #'speedbar-expand-line) + (define-key map "=" #'speedbar-expand-line) + (define-key map "-" #'speedbar-contract-line) + (define-key map " " #'speedbar-toggle-line-expansion) + ;; Buffer specific keybindings + (define-key map "k" #'speedbar-buffer-kill-buffer) + (define-key map "r" #'speedbar-buffer-revert-buffer) + map) "Keymap used when in the buffers display mode.") -(if speedbar-buffers-key-map - nil - (setq speedbar-buffers-key-map (speedbar-make-specialized-keymap)) - - ;; Basic tree features - (define-key speedbar-buffers-key-map "e" 'speedbar-edit-line) - (define-key speedbar-buffers-key-map "\C-m" 'speedbar-edit-line) - (define-key speedbar-buffers-key-map "+" 'speedbar-expand-line) - (define-key speedbar-buffers-key-map "=" 'speedbar-expand-line) - (define-key speedbar-buffers-key-map "-" 'speedbar-contract-line) - (define-key speedbar-buffers-key-map " " 'speedbar-toggle-line-expansion) - - ;; Buffer specific keybindings - (define-key speedbar-buffers-key-map "k" 'speedbar-buffer-kill-buffer) - (define-key speedbar-buffers-key-map "r" 'speedbar-buffer-revert-buffer) - - ) - (defvar speedbar-buffer-easymenu-definition '(["Jump to buffer" speedbar-edit-line t] ["Expand File Tags" speedbar-expand-line commit 5922c972cd1ab7b52f10552a94bbbbe488a58ae0 Author: Stefan Kangas Date: Wed Dec 8 17:48:13 2021 +0100 ; * lisp/calc/calc-ext.el: Fix warnings in my last commit. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 83afdb7718..93ba8c4b6b 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1267,22 +1267,22 @@ calc-kill calc-kill-region calc-yank)))) (defvar-keymap calc-help-map - "b" #'calc-describe-bindings - "c" #'calc-describe-key-briefly - "f" #'calc-describe-function - "h" #'calc-full-help - "i" #'calc-info - "k" #'calc-describe-key - "n" #'calc-view-news - "s" #'calc-info-summary - "t" #'calc-tutorial - "v" #'calc-describe-variable - "C-c" #'calc-describe-copying - "C-d" #'calc-describe-distribution - "C-n" #'calc-view-news - "C-w" #'calc-describe-no-warranty - "?" #'calc-help-for-help - "C-h" #'calc-help-for-help) + "b" 'calc-describe-bindings + "c" 'calc-describe-key-briefly + "f" 'calc-describe-function + "h" 'calc-full-help + "i" 'calc-info + "k" 'calc-describe-key + "n" 'calc-view-news + "s" 'calc-info-summary + "t" 'calc-tutorial + "v" 'calc-describe-variable + "C-c" 'calc-describe-copying + "C-d" 'calc-describe-distribution + "C-n" 'calc-view-news + "C-w" 'calc-describe-no-warranty + "?" 'calc-help-for-help + "C-h" 'calc-help-for-help) (defvar calc-prefix-help-retry nil) (defvar calc-prefix-help-phase 0) commit 1ea5b821452143562edb46dd8afa7696a801e153 Author: Stefan Kangas Date: Wed Dec 8 13:30:23 2021 +0100 Define calc-help-map in one step * lisp/calc/calc-ext.el (calc-help-map): Define in one step and convert to defvar-keymap. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index dbe2f689d8..83afdb7718 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1266,27 +1266,23 @@ calc-kill calc-kill-region calc-yank)))) (math-normalize val))))) -(defvar calc-help-map nil) - -(if calc-help-map - nil - (setq calc-help-map (make-keymap)) - (define-key calc-help-map "b" 'calc-describe-bindings) - (define-key calc-help-map "c" 'calc-describe-key-briefly) - (define-key calc-help-map "f" 'calc-describe-function) - (define-key calc-help-map "h" 'calc-full-help) - (define-key calc-help-map "i" 'calc-info) - (define-key calc-help-map "k" 'calc-describe-key) - (define-key calc-help-map "n" 'calc-view-news) - (define-key calc-help-map "s" 'calc-info-summary) - (define-key calc-help-map "t" 'calc-tutorial) - (define-key calc-help-map "v" 'calc-describe-variable) - (define-key calc-help-map "\C-c" 'calc-describe-copying) - (define-key calc-help-map "\C-d" 'calc-describe-distribution) - (define-key calc-help-map "\C-n" 'calc-view-news) - (define-key calc-help-map "\C-w" 'calc-describe-no-warranty) - (define-key calc-help-map "?" 'calc-help-for-help) - (define-key calc-help-map "\C-h" 'calc-help-for-help)) +(defvar-keymap calc-help-map + "b" #'calc-describe-bindings + "c" #'calc-describe-key-briefly + "f" #'calc-describe-function + "h" #'calc-full-help + "i" #'calc-info + "k" #'calc-describe-key + "n" #'calc-view-news + "s" #'calc-info-summary + "t" #'calc-tutorial + "v" #'calc-describe-variable + "C-c" #'calc-describe-copying + "C-d" #'calc-describe-distribution + "C-n" #'calc-view-news + "C-w" #'calc-describe-no-warranty + "?" #'calc-help-for-help + "C-h" #'calc-help-for-help) (defvar calc-prefix-help-retry nil) (defvar calc-prefix-help-phase 0) commit ed03b2f30172819d973d9d6cef0851d5a1249ef0 Author: Stefan Kangas Date: Wed Dec 8 13:22:21 2021 +0100 Convert shortdoc-mode-map to defvar-keymap * lisp/emacs-lisp/shortdoc.el (shortdoc-mode-map): Convert to defvar-keymap. diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index ba08e68af5..5c51e257eb 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1423,14 +1423,12 @@ Example: (setq slist (cdr slist))) (setcdr slist (cons elem (cdr slist)))))) -(defvar shortdoc-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "n") 'shortdoc-next) - (define-key map (kbd "p") 'shortdoc-previous) - (define-key map (kbd "C-c C-n") 'shortdoc-next-section) - (define-key map (kbd "C-c C-p") 'shortdoc-previous-section) - map) - "Keymap for `shortdoc-mode'.") +(defvar-keymap shortdoc-mode-map + :doc "Keymap for `shortdoc-mode'." + "n" #'shortdoc-next + "p" #'shortdoc-previous + "C-c C-n" #'shortdoc-next-section + "C-c C-p" #'shortdoc-previous-section) (define-derived-mode shortdoc-mode special-mode "shortdoc" "Mode for shortdoc." commit e6e62eedd77d3fee5fa687c155c4905c5ad51a99 Merge: 05af96456c 0a2507ff90 Author: Stefan Kangas Date: Wed Dec 8 13:04:14 2021 +0100 ; Merge from origin/emacs-28 The following commit was skipped: 0a2507ff90 Backport: Make a more robust check in Tramp using scripts commit 05af96456c0c056b61be30e53e2592a8d155de54 Merge: 58cf601aad ce5bca4913 Author: Stefan Kangas Date: Wed Dec 8 13:04:14 2021 +0100 Merge from origin/emacs-28 ce5bca4913 Document native-comp-async-report-warning-errors more 1933cd5307 Doc fix; Epiphany has been renamed to GNOME Web b80d7568e4 * lisp/dired-aux.el (dired-check-process): Doc fix. (Bug#... 0f30227f97 ; * lisp/net/browse-url.el (browse-url-epiphany): Fix typo. d34009db66 Remove dead link from newsticker # Conflicts: # lisp/net/browse-url.el commit 58cf601aada8cc80663c4e5e9a69ac7ce7f70b51 Author: Po Lu Date: Wed Dec 8 19:44:50 2021 +0800 Fix coarse scroll deltas on macOS * src/nsterm.m (- mouseDown): Multiply deltas as appropriate. diff --git a/src/nsterm.m b/src/nsterm.m index 5c19b0cab8..5d39be3a87 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6658,8 +6658,10 @@ - (void)mouseDown: (NSEvent *)theEvent ? ceil (fabs (delta)) : 1; scrollUp = delta > 0; - x = [theEvent scrollingDeltaX]; - y = [theEvent scrollingDeltaY]; + x = ([theEvent scrollingDeltaX] + * FRAME_COLUMN_WIDTH (emacsframe)); + y = ([theEvent scrollingDeltaY] + * FRAME_LINE_HEIGHT (emacsframe)); } if (lines == 0 && mwheel_coalesce_scroll_events) commit f10d4b31d6d9cc370597a32da4a88ac2d63e7bab Author: Po Lu Date: Wed Dec 8 18:36:18 2021 +0800 Clear scroll interpolation when interpolated scroll completes * lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): Set saved interpolation to nil upon completion. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index b322bf9a53..94c14d50dc 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -550,7 +550,8 @@ animation." (rem (window-parameter nil 'interpolated-scroll-remainder)) (time (window-parameter nil 'interpolated-scroll-remainder-time))) (when (and rem time - (< (- (float-time) time) 1.0)) + (< (- (float-time) time) 1.0) + (eq (< delta 0) (< rem 0))) (setq delta (+ delta rem))) (while-no-input (unwind-protect @@ -568,11 +569,18 @@ animation." (ceiling (* (* delta factor) (/ between-scroll total-time))))) (setq last-time (float-time))) - (when (< percentage 1) - (set-window-parameter nil 'interpolated-scroll-remainder - (* delta (- 1 percentage))) - (set-window-parameter nil 'interpolated-scroll-remainder-time - (float-time))))))) + (if (< percentage 1) + (progn + (set-window-parameter nil 'interpolated-scroll-remainder + (* delta (- 1 percentage))) + (set-window-parameter nil 'interpolated-scroll-remainder-time + (float-time))) + (set-window-parameter nil + 'interpolated-scroll-remainder + nil) + (set-window-parameter nil + 'interpolated-scroll-remainder-time + nil)))))) (defun pixel-scroll-precision-scroll-up (delta) "Scroll the current window up by DELTA pixels." commit d8c383b25edce88a0812edafc349e360d8d03dc9 Author: Po Lu Date: Wed Dec 8 18:29:05 2021 +0800 Improve precision scroll interpolation * lisp/pixel-scroll.el (pixel-scroll-precision-interpolation-total-time) (pixel-scroll-precision-interpolation-factor): Add better default values. (pixel-scroll-precision-interpolate): Save deltas and run loop inside `while-no-input' instead. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index af21f365b3..b322bf9a53 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -141,13 +141,13 @@ Nil means to not interpolate such scrolls." number) :version "29.1") -(defcustom pixel-scroll-precision-interpolation-total-time 0.01 +(defcustom pixel-scroll-precision-interpolation-total-time 0.1 "The total time in seconds to spend interpolating a large scroll." :group 'mouse :type 'float :version "29.1") -(defcustom pixel-scroll-precision-interpolation-factor 2.0 +(defcustom pixel-scroll-precision-interpolation-factor 4.0 "A factor to apply to the distance of an interpolated scroll." :group 'mouse :type 'float @@ -544,20 +544,35 @@ animation." (let ((percentage 0) (total-time pixel-scroll-precision-interpolation-total-time) (factor pixel-scroll-precision-interpolation-factor) + (last-time (float-time)) (time-elapsed 0.0) - (between-scroll 0.001)) - (while (< percentage 1) - (sit-for between-scroll) - (setq time-elapsed (+ time-elapsed between-scroll) - percentage (/ time-elapsed total-time)) - (if (< delta 0) - (pixel-scroll-precision-scroll-down - (ceiling (abs (* (* delta factor) - (/ between-scroll total-time))))) - (pixel-scroll-precision-scroll-up - (ceiling (* (* delta factor) - (/ between-scroll total-time))))) - (redisplay t)))) + (between-scroll 0.001) + (rem (window-parameter nil 'interpolated-scroll-remainder)) + (time (window-parameter nil 'interpolated-scroll-remainder-time))) + (when (and rem time + (< (- (float-time) time) 1.0)) + (setq delta (+ delta rem))) + (while-no-input + (unwind-protect + (while (< percentage 1) + (redisplay t) + (sleep-for between-scroll) + (setq time-elapsed (+ time-elapsed + (- (float-time) last-time)) + percentage (/ time-elapsed total-time)) + (if (< delta 0) + (pixel-scroll-precision-scroll-down + (ceiling (abs (* (* delta factor) + (/ between-scroll total-time))))) + (pixel-scroll-precision-scroll-up + (ceiling (* (* delta factor) + (/ between-scroll total-time))))) + (setq last-time (float-time))) + (when (< percentage 1) + (set-window-parameter nil 'interpolated-scroll-remainder + (* delta (- 1 percentage))) + (set-window-parameter nil 'interpolated-scroll-remainder-time + (float-time))))))) (defun pixel-scroll-precision-scroll-up (delta) "Scroll the current window up by DELTA pixels." commit d5a6dd1f8cd1faf674f6fac3d70e21871f442bc1 Author: Michael Albinus Date: Wed Dec 8 10:20:42 2021 +0100 ; * etc/NEWS: Fix typos. diff --git a/etc/NEWS b/etc/NEWS index e8e0c910ef..b9134d850e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -85,8 +85,8 @@ To get the old monospaced mode line back, customize the 'mode-line-active' and 'mode-line-inactive' faces not to inherit from the 'variable-pitch' face, or add this to your "~/.emacs": - (set-face-attribute 'mode-line-active nil :inherit 'mode-line) - (set-face-attribute 'mode-line-inactive nil :inherit 'mode-line) + (set-face-attribute 'mode-line-active nil :inherit 'mode-line) + (set-face-attribute 'mode-line-inactive nil :inherit 'mode-line) * Changes in Emacs 29.1 @@ -556,8 +556,8 @@ user options that are no longer needed are now obsolete: *** Navigation and marking commands now work in image display buffer. The following new bindings have been added: - n / SPC image-dired-display-previous-thumbnail-original - p / DEL image-dired-display-next-thumbnail-original + n / SPC image-dired-display-next-thumbnail-original + p / DEL image-dired-display-previous-thumbnail-original m image-dired-mark-thumb-original-file d image-dired-flag-thumb-original-file u image-dired-unmark-thumb-original-file @@ -718,10 +718,11 @@ Emacs buffers, like indentation and the like. The new ert function * Incompatible Lisp Changes in Emacs 29.1 -** User option 'mail-source-ignore-errors' is now obsolete +** User option 'mail-source-ignore-errors' is now obsolete. The whole mechanism for prompting users to continue in case of mail-source errors has been removed, so this option is no longer needed. + ** Fonts --- commit 0a2507ff9095bb725e8c30017c413840c11ff132 Author: Michael Albinus Date: Tue Dec 7 16:20:13 2021 +0100 Backport: Make a more robust check in Tramp using scripts * lisp/net/tramp-sh.el (tramp-find-inline-encoding): Check, whether scripts in `tramp-remote-coding-commands' are expandable. (cherry picked from commit 1d0a60113fd155c77ef5ea4ea44fcba3504adcbf) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6f3b324522..21217381f1 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4585,6 +4585,8 @@ Goes through the list `tramp-local-coding-commands' and (value (symbol-value rem-enc))) (while (string-match "-" name) (setq name (replace-match "_" nil t name))) + (unless (tramp-expand-script vec value) + (throw 'wont-work-remote nil)) (tramp-maybe-send-script vec value name) (setq rem-enc name))) (tramp-message @@ -4602,6 +4604,8 @@ Goes through the list `tramp-local-coding-commands' and (value (symbol-value rem-dec))) (while (string-match "-" name) (setq name (replace-match "_" nil t name))) + (unless (tramp-expand-script vec value) + (throw 'wont-work-remote nil)) (tramp-maybe-send-script vec value name) (setq rem-dec name))) (tramp-message commit ce5bca491344520cab2cdd998441761765fc66f3 Author: Robert Pluim Date: Tue Dec 7 18:43:01 2021 +0100 Document native-comp-async-report-warning-errors more The docstring has a description of how fix problems in lisp code detected by native compilation, but not the Emacs Lisp manual, so document it there as well. * doc/lispref/compile.texi (Native-Compilation Functions): Refer to 'native-comp-async-report-warning-errors' (Native-Compilation Variables): Explain potential cause of warnings from native compilation. diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 523758c10f..1ca1f66b95 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -924,7 +924,11 @@ of the main Emacs process. This leaves the main Emacs process free to use while the compilation runs in the background. This is the method used by Emacs to natively-compile any Lisp file or byte-compiled Lisp file that is loaded into Emacs, when no natively-compiled file for it -is available. +is available. Note that because of this use of a subprocess, native +compilation may produce warning and errors which byte-compilation does +not, and lisp code may thus need to be modified to work correctly. See +@code{native-comp-async-report-warnings-errors} in @pxref{Native-Compilation +Variables} for more details. @defun native-compile-async files &optional recursively load selector This function compiles the named @var{files} asynchronously. The @@ -1038,6 +1042,12 @@ Emacs session in a buffer named @file{*Warnings*}. The default value @code{t} means display the resulting buffer. To log warnings without popping up the @file{*Warnings*} buffer, set this variable to @code{silent}. + + A common cause for asynchronous native-compilation to produce +warnings is compiling a file that is missing some @code{require} of a +necessary feature. The feature may be loaded into the main emacs, but +because native compilation always starts from a subprocess with a +pristine environment, that may not be true for the subprocess. @end defopt @defopt native-comp-async-query-on-exit commit 1933cd5307e1b6c628d2123533e27fc2bc436fcc Author: Stefan Kangas Date: Tue Dec 7 18:57:48 2021 +0100 Doc fix; Epiphany has been renamed to GNOME Web * lisp/net/browse-url.el: Doc fix; Epiphany is called GNOME Web since GNOME 3.4, released in 2012. Ref: https://help.gnome.org/misc/release-notes/3.4/ diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index cc7582e06a..4ae56864c5 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -38,7 +38,7 @@ ;; browse-url-firefox Firefox Don't know (tried with 1.0.1) ;; browse-url-chrome Chrome 47.0.2526.111 ;; browse-url-chromium Chromium 3.0 -;; browse-url-epiphany Epiphany Don't know +;; browse-url-epiphany GNOME Web (Epiphany) Don't know ;; browse-url-w3 w3 0 ;; browse-url-text-* Any text browser 0 ;; browse-url-generic arbitrary @@ -155,7 +155,7 @@ (function-item :tag "Firefox" :value browse-url-firefox) (function-item :tag "Google Chrome" :value browse-url-chrome) (function-item :tag "Chromium" :value browse-url-chromium) - (function-item :tag "Epiphany" :value browse-url-epiphany) + (function-item :tag "GNOME Web (Epiphany)" :value browse-url-epiphany) (function-item :tag "Text browser in an xterm window" :value browse-url-text-xterm) (function-item :tag "Text browser in an Emacs window" @@ -353,15 +353,15 @@ Defaults to the value of `browse-url-galeon-arguments' at the time (make-obsolete-variable 'browse-url-galeon-startup-arguments nil "25.1") (defcustom browse-url-epiphany-program "epiphany" - "The name by which to invoke Epiphany." + "The name by which to invoke GNOME Web (Epiphany)." :type 'string) (defcustom browse-url-epiphany-arguments nil - "A list of strings to pass to Epiphany as arguments." + "A list of strings to pass to GNOME Web (Epiphany) as arguments." :type '(repeat (string :tag "Argument"))) (defcustom browse-url-epiphany-startup-arguments browse-url-epiphany-arguments - "A list of strings to pass to Epiphany when it starts up. + "A list of strings to pass to GNOME Web (Epiphany) when it starts up. Defaults to the value of `browse-url-epiphany-arguments' at the time `browse-url' is loaded." :type '(repeat (string :tag "Argument"))) @@ -1329,12 +1329,12 @@ used instead of `browse-url-new-window-flag'." (append browse-url-galeon-startup-arguments (list url)))))) (defun browse-url-epiphany (url &optional new-window) - "Ask the Epiphany WWW browser to load URL. + "Ask the GNOME Web (Epiphany) WWW browser to load URL. Default to the URL around or before point. The strings in variable -`browse-url-epiphany-arguments' are also passed to Epiphany. +`browse-url-epiphany-arguments' are also passed to GNOME Web. When called interactively, if variable `browse-url-new-window-flag' is -non-nil, load the document in a new Epiphany window, otherwise use a +non-nil, load the document in a new GNOME Web window, otherwise use a random existing one. A non-nil interactive prefix argument reverses the effect of `browse-url-new-window-flag'. @@ -1366,10 +1366,10 @@ used instead of `browse-url-new-window-flag'." (function-put 'browse-url-epiphany 'browse-url-browser-kind 'external) (defun browse-url-epiphany-sentinel (process url) - "Handle a change to the process communicating with Epiphany." + "Handle a change to the process communicating with GNOME Web (Epiphany)." (or (eq (process-exit-status process) 0) (let* ((process-environment (browse-url-process-environment))) - ;; Epiphany is not running - start it + ;; GNOME Web is not running - start it (message "Starting %s..." browse-url-epiphany-program) (apply #'start-process (concat "epiphany " url) nil browse-url-epiphany-program commit b80d7568e410a2d2b76214b8ae5f0020d18dab46 Author: Eli Zaretskii Date: Tue Dec 7 19:46:15 2021 +0200 * lisp/dired-aux.el (dired-check-process): Doc fix. (Bug#52337) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 32375ac525..8adda9a272 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -992,12 +992,14 @@ prompted for the shell command to use interactively." (defun dired-check-process (msg program &rest arguments) - "Display MSG while running PROGRAM, and check for output. -Remaining arguments are strings passed as command arguments to PROGRAM. -On error, insert output -in a log buffer and return the offending ARGUMENTS or PROGRAM. -Caller can cons up a list of failed args. -Else returns nil for success." + "Display MSG, then run PROGRAM, and log any error messages from it. +ARGUMENTS should be strings to be passed to PROGRAM as command-line +arguments. + +If PROGRAM exits successfully, display \"MSG...done\" and return nil. +If PROGRAM exits abnormally, save in `dired-log-buffer' the command +that invoked PROGRAM and the messages it emitted, and return either +the offending ARGUMENTS or PROGRAM if no ARGUMENTS were provided." (let (err-buffer err (dir default-directory)) (message "%s..." msg) (save-excursion commit 0f30227f97d141ee8fd274690cc0d7cb3a514285 Author: Stefan Kangas Date: Tue Dec 7 18:37:47 2021 +0100 ; * lisp/net/browse-url.el (browse-url-epiphany): Fix typo. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 50d11b4b72..cc7582e06a 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1331,7 +1331,7 @@ used instead of `browse-url-new-window-flag'." (defun browse-url-epiphany (url &optional new-window) "Ask the Epiphany WWW browser to load URL. Default to the URL around or before point. The strings in variable -`browse-url-galeon-arguments' are also passed to Epiphany. +`browse-url-epiphany-arguments' are also passed to Epiphany. When called interactively, if variable `browse-url-new-window-flag' is non-nil, load the document in a new Epiphany window, otherwise use a commit d34009db66c5b0cd3730e991d813582414d0536f Author: Stefan Kangas Date: Tue Dec 7 18:37:18 2021 +0100 Remove dead link from newsticker * lisp/net/newst-backend.el (newsticker--parse-rss-0.91): * lisp/net/newsticker.el: Remove dead link. diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 27ea713d0e..c7a87a6cc1 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1211,8 +1211,7 @@ URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'" Return value as well as arguments NAME, TIME, and TOPNODE are the same as in `newsticker--parse-atom-1.0'. -For the RSS 0.91 specification see URL `http://backend.userland.com/rss091' -or URL `http://my.netscape.com/publish/formats/rss-spec-0.91.html'." +For the RSS 0.91 specification see URL `http://backend.userland.com/rss091'." (newsticker--debug-msg "Parsing RSS 0.91 feed %s" name) (let* ((channelnode (car (xml-get-children topnode 'channel))) is-new-feed has-new-items) diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el index 34e94acd12..c1714218be 100644 --- a/lisp/net/newsticker.el +++ b/lisp/net/newsticker.el @@ -43,8 +43,7 @@ ;; are contained in "RSS" (RDF Site Summary) or "Atom" files. Newsticker ;; should work with the following RSS formats: ;; * RSS 0.91 -;; (see http://backend.userland.com/rss091 or -;; http://my.netscape.com/publish/formats/rss-spec-0.91.html) +;; (see http://backend.userland.com/rss091) ;; * RSS 0.92 ;; (see http://backend.userland.com/rss092) ;; * RSS 1.0