commit 4ba9024d44566e47d9624e3316eab7b936fd141f (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Tue May 4 09:57:30 2021 +0200 Ensure updating the animated image in all windows * lisp/image.el (image-show-frame): Simplify the window update -- pass in the buffer, which is a noop if the buffer isn't displayed. diff --git a/lisp/image.el b/lisp/image.el index 643f9ddf83..ee15294031 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -875,9 +875,7 @@ do not check N is within the range of frames present in the image." (setq n (min n (1- (car (plist-get (cdr image) :animate-multi-frame-data))))))) (plist-put (cdr image) :index n) - (when-let ((window - (get-buffer-window (plist-get (cdr image) :animate-buffer) t))) - (force-window-update window))) + (force-window-update (plist-get (cdr image) :animate-buffer))) (defun image-animate-get-speed (image) "Return the speed factor for animating IMAGE." commit 8a4bb6b0560ef3f4890789a574488f7cf69ee237 Author: Martin Rudalics Date: Tue May 4 09:17:11 2021 +0200 Fix a problem with x_set_tab_bar_lines (Bug#46827) * src/xfns.c (x_set_tab_bar_lines): Call x_change_tab_bar_height only if the number of tab bar lines changed from or to zero (Bug#46827). * src/xterm.c (x_make_frame_visible): Make frame_size_history update less noisy by doing it only if the frame wasn't visible before. diff --git a/src/xfns.c b/src/xfns.c index 2c95065d3e..782e0a483c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1608,13 +1608,15 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) /* Set the number of lines used for the tab bar of frame F to VALUE. VALUE not an integer, or < 0 means set the lines to zero. OLDVAL - is the old number of tab bar lines. This function changes the + is the old number of tab bar lines. This function may change the height of all windows on frame F to match the new tab bar height. - The frame's height doesn't change. */ + The frame's height may change if frame_inhibit_implied_resize was + set accordingly. */ static void x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) { + int olines = FRAME_TAB_BAR_LINES (f); int nlines; /* Treat tab bars like menu bars. */ @@ -1627,7 +1629,8 @@ x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) else nlines = 0; - x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); + if (nlines != olines && (olines == 0 || nlines == 0)) + x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f)); } diff --git a/src/xterm.c b/src/xterm.c index 189e3a47ee..88a393cc6c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11823,12 +11823,14 @@ x_make_frame_visible (struct frame *f) poll_suppress_count = old_poll_suppress_count; #endif - if (CONSP (frame_size_history)) - frame_size_history_plain - (f, build_string ("x_make_frame_visible")); + if (!FRAME_VISIBLE_P (f)) + { + if (CONSP (frame_size_history)) + frame_size_history_plain + (f, build_string ("x_make_frame_visible")); - if (! FRAME_VISIBLE_P (f)) - x_wait_for_event (f, MapNotify); + x_wait_for_event (f, MapNotify); + } } } commit 131e874d143167508cf4a210bfc53e44ecca3195 Author: Stefan Kangas Date: Tue May 4 00:59:10 2021 +0200 ; * etc/NEWS: Fix typo. diff --git a/etc/NEWS b/etc/NEWS index c2db98ae45..c5e61a56ea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1082,7 +1082,7 @@ defaulting to active region when used interactively. ** The old non-SMIE indentation of 'sh-mode' has been removed. --- -** The 'list-bookmark' menu is now based on 'tabulated-list-mode'. +** The 'list-bookmarks' menu is now based on 'tabulated-list-mode'. The interactive bookmark list will now benefit from features in 'tabulated-list-mode' like sorting columns or changing column width. commit 3c4619edeb0994c4a62cbb149029dfda0811fb57 Author: Philip K Date: Mon May 3 11:35:41 2021 +0200 project--buffer-list: Avoid Tramp buffers when possible * project.el (project--buffer-list): Add file-remote-p check. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index d47d9d77e6..33827136a1 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1120,11 +1120,14 @@ current project, it will be killed." (defun project--buffer-list (pr) "Return the list of all buffers in project PR." - (let (bufs) + (let ((remote-project-p (file-remote-p (project-root pr))) + bufs) (dolist (buf (buffer-list)) - (when (equal pr - (with-current-buffer buf - (project-current))) + (when (and (let ((remote (file-remote-p (buffer-local-value 'default-directory buf)))) + (if remote-project-p remote (not remote))) + (equal pr + (with-current-buffer buf + (project-current)))) (push buf bufs))) (nreverse bufs))) commit 824d1a57ec8e7c90b01af6665de5a114529170df Author: Michael Albinus Date: Mon May 3 16:52:18 2021 +0200 Fix unquoting of file names in subprocesses (Bug#48177) * lisp/files.el (file-name-non-special): Improve handling of inhibit-file-name-handlers. * src/callproc.c (Fcall_process, call_process): Unquote infile, error_file and output_file. (Bug#48177) * test/lisp/files-tests.el (files-tests-file-name-non-special--subprocess) (files-tests-file-name-non-special-file-name-all-completions) (files-tests-file-name-non-special-file-name-completion): Adapt tests. diff --git a/lisp/files.el b/lisp/files.el index 8e8fbac8dc..2c5017a2fd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7439,7 +7439,11 @@ only these files will be asked to be saved." ;; might be bound to different file name handlers, we still ;; need this. (saved-file-name-handler-alist file-name-handler-alist) - file-name-handler-alist + (inhibit-file-name-handlers + (cons 'file-name-non-special + (and (eq inhibit-file-name-operation operation) + inhibit-file-name-handlers))) + (inhibit-file-name-operation operation) ;; Some operations respect file name handlers in ;; `default-directory'. Because core function like ;; `call-process' don't care about file name handlers in diff --git a/src/callproc.c b/src/callproc.c index 5aa2cbafb4..e44e243680 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -276,6 +276,9 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) * else infile = build_string (NULL_DEVICE); + /* Remove "/:" from INFILE. */ + infile = remove_slash_colon (infile); + encoded_infile = ENCODE_FILE (infile); filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0); @@ -439,9 +442,15 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, current_dir = encode_current_directory (); if (STRINGP (error_file)) - error_file = ENCODE_FILE (error_file); + { + error_file = remove_slash_colon (error_file); + error_file = ENCODE_FILE (error_file); + } if (STRINGP (output_file)) - output_file = ENCODE_FILE (output_file); + { + output_file = remove_slash_colon (output_file); + output_file = ENCODE_FILE (output_file); + } display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 33716577a1..921e2c80f3 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -302,12 +302,15 @@ be $HOME." (file-name-unquote temporary-file-directory)))))) (ert-deftest files-tests-file-name-non-special--subprocess () - "Check that Bug#25949 is fixed." - (skip-unless (executable-find "true")) - (let ((default-directory (file-name-quote temporary-file-directory))) - (should (zerop (process-file "true"))) - (should (processp (start-file-process "foo" nil "true"))) - (should (zerop (shell-command "true"))))) + "Check that Bug#25949 and Bug#48177 are fixed." + (skip-unless (and (executable-find "true") (file-exists-p null-device))) + (let ((default-directory (file-name-quote temporary-file-directory)) + (true (file-name-quote (executable-find "true"))) + (null (file-name-quote null-device))) + (should (zerop (process-file true null `((:file ,null) ,null)))) + (should (processp (start-file-process "foo" nil true))) + (should (zerop (shell-command true))) + (should (processp (make-process :name "foo" :command `(,true)))))) (defmacro files-tests--with-advice (symbol where function &rest body) (declare (indent 3)) @@ -715,9 +718,8 @@ unquoted file names." (file (file-name-nondirectory tmpfile)) (nospecial-file (file-name-nondirectory nospecial))) (should-not (string-equal file nospecial-file)) - (should-not (equal (file-name-all-completions - nospecial-file nospecial-tempdir) - (file-name-all-completions file tmpdir))) + (should (equal (file-name-all-completions nospecial-file nospecial-tempdir) + (file-name-all-completions file tmpdir))) (should (equal (file-name-all-completions file nospecial-tempdir) (file-name-all-completions file tmpdir))) (should (equal (file-name-all-completions nospecial-file tmpdir) @@ -759,8 +761,8 @@ unquoted file names." (file (file-name-nondirectory tmpfile)) (nospecial-file (file-name-nondirectory nospecial))) (should-not (string-equal file nospecial-file)) - (should-not (equal (file-name-completion nospecial-file nospecial-tempdir) - (file-name-completion file tmpdir))) + (should (equal (file-name-completion nospecial-file nospecial-tempdir) + (file-name-completion file tmpdir))) (should (equal (file-name-completion file nospecial-tempdir) (file-name-completion file tmpdir))) (should (equal (file-name-completion nospecial-file tmpdir) commit 46b7ce0e9c77da436a139a2a44fab3cb2bcc7649 Author: Mauro Aranda Date: Mon May 3 10:54:28 2021 -0300 ; * etc/tutorials/TUTORIAL.es: Fix grammar in recent change diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es index 0bd061488c..a92604ccb9 100644 --- a/etc/tutorials/TUTORIAL.es +++ b/etc/tutorials/TUTORIAL.es @@ -1091,7 +1091,7 @@ ayuda, y entonces teclear C-x 1. Aquí hay algunas otras opciones útiles de C-h: - C-h x Describe un comando. Usted teclea el nombre de la + C-h x Describe un comando. Usted teclea el nombre del comando. >> Intente teclear C-h x previous-line . commit 4fdebc016c3b821fcd9556807dce3781fe6b6c41 Author: Alan Third Date: Sun May 2 22:38:13 2021 +0100 Fix incorrect resizing behaviour on macOS (bug#48157, bug#48162) * src/nsterm.m ([EmacsView viewDidResize:]): The drawing buffer can be resized independently of Emacs's idea of the frame size. Co-authored-by: martin rudalics diff --git a/src/nsterm.m b/src/nsterm.m index 6e7ab1266b..bb20886ab1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7303,16 +7303,34 @@ - (void)viewDidResize:(NSNotification *)notification NSTRACE ("[EmacsView viewDidResize]"); +#ifdef NS_DRAW_TO_BUFFER + /* If the buffer size doesn't match the view's backing size, destroy + the buffer and let it be recreated at the correct size later. */ + if ([self wantsUpdateLayer] && surface) + { + NSRect surfaceRect = {{0, 0}, [surface getSize]}; + NSRect frameRect = [[self window] convertRectToBacking:frame]; + + if (!NSEqualRects (frameRect, surfaceRect)) + { + [surface release]; + surface = nil; + + [self setNeedsDisplay:YES]; + } + } +#endif + neww = (int)NSWidth (frame); newh = (int)NSHeight (frame); oldw = FRAME_PIXEL_WIDTH (emacsframe); oldh = FRAME_PIXEL_HEIGHT (emacsframe); /* Don't want to do anything when the view size hasn't changed. */ - if ((oldh == newh && oldw == neww) - || (emacsframe->new_size_p - && newh == emacsframe->new_height - && neww == emacsframe->new_width)) + if (emacsframe->new_size_p + ? (newh == emacsframe->new_height + && neww == emacsframe->new_width) + : (oldh == newh && oldw == neww)) { NSTRACE_MSG ("No change"); return; @@ -7321,16 +7339,6 @@ - (void)viewDidResize:(NSNotification *)notification NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); -#ifdef NS_DRAW_TO_BUFFER - if ([self wantsUpdateLayer]) - { - [surface release]; - surface = nil; - - [self setNeedsDisplay:YES]; - } -#endif - change_frame_size (emacsframe, neww, newh, false, YES, false); SET_FRAME_GARBAGED (emacsframe); commit 1dafab893652c42be807e9a44005413cb7915f81 Author: Lars Ingebrigtsen Date: Mon May 3 12:21:11 2021 +0200 ediff shouldn't alter the kill ring when copying a diff * lisp/vc/ediff-util.el (ediff-copy-diff, ediff-pop-diff): Don't alter the kill ring (bug#47881). diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 1c78490870..b2b92b17e2 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -2002,9 +2002,8 @@ ARG is a prefix argument. If nil, copy the current difference region." (goto-char reg-to-delete-end) (insert reg-to-copy) - (if (> reg-to-delete-end reg-to-delete-beg) - (kill-region reg-to-delete-beg reg-to-delete-end)) - )) + (when (> reg-to-delete-end reg-to-delete-beg) + (delete-region reg-to-delete-beg reg-to-delete-end)))) (or batch-invocation (setq messg @@ -2105,8 +2104,8 @@ ARG is a prefix argument. If nil, copy the current difference region." (goto-char reg-end) (insert saved-diff) - (if (> reg-end reg-beg) - (kill-region reg-beg reg-end)) + (when (> reg-end reg-beg) + (delete-region reg-beg reg-end)) (setq recovered t) )) commit 1fa1f3184a96cbf51aed68ed1e1c6eb799dcfc27 Author: Lars Ingebrigtsen Date: Mon May 3 11:51:53 2021 +0200 Speed up animation of non-displayed buffers * lisp/image.el (image-show-frame): Don't force an update if the buffer with the animation isn't in a window (bug#47895). Also just update the window in question. diff --git a/lisp/image.el b/lisp/image.el index 5e84536b66..643f9ddf83 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -875,7 +875,9 @@ do not check N is within the range of frames present in the image." (setq n (min n (1- (car (plist-get (cdr image) :animate-multi-frame-data))))))) (plist-put (cdr image) :index n) - (force-window-update)) + (when-let ((window + (get-buffer-window (plist-get (cdr image) :animate-buffer) t))) + (force-window-update window))) (defun image-animate-get-speed (image) "Return the speed factor for animating IMAGE." commit 4aa4a8f9525efa6453816aa588ad178b01df554d Author: Lars Ingebrigtsen Date: Mon May 3 11:45:22 2021 +0200 Speed up animation of non-displayed images * lisp/image.el (image-animate): Only compute the animation data once -- this avoids recomputing the image on every iteration when the image is not displayed (bug#47895). diff --git a/lisp/image.el b/lisp/image.el index 610d020aab..5e84536b66 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -839,6 +839,9 @@ number, play until that number of seconds has elapsed." (cancel-timer timer)) (plist-put (cdr image) :animate-buffer (current-buffer)) (plist-put (cdr image) :animate-tardiness 0) + ;; Stash the data about the animation here so that we don't + ;; trigger image recomputation unnecessarily later. + (plist-put (cdr image) :animate-multi-frame-data animation) (run-with-timer 0.2 nil #'image-animate-timeout image (or index 0) (car animation) 0 limit (+ (float-time) 0.2))))) @@ -869,7 +872,8 @@ Frames are indexed from 0. Optional argument NOCHECK non-nil means do not check N is within the range of frames present in the image." (unless nocheck (if (< n 0) (setq n 0) - (setq n (min n (1- (car (image-multi-frame-p image))))))) + (setq n (min n (1- (car (plist-get (cdr image) + :animate-multi-frame-data))))))) (plist-put (cdr image) :index n) (force-window-update)) @@ -917,11 +921,11 @@ for the animation speed. A negative value means to animate in reverse." (image-show-frame image n t) (let* ((speed (image-animate-get-speed image)) (time (current-time)) - (animation (image-multi-frame-p image)) (time-to-load-image (time-since time)) - (stated-delay-time (/ (or (cdr animation) - image-default-frame-delay) - (float (abs speed)))) + (stated-delay-time + (/ (or (cdr (plist-get (cdr image) :animate-multi-frame-data)) + image-default-frame-delay) + (float (abs speed)))) ;; Subtract off the time we took to load the image from the ;; stated delay time. (delay (max (float-time (time-subtract stated-delay-time commit eddb00c5bf9ed51bd0b6ea4ff1613f8af6e3cbdd Author: Lars Ingebrigtsen Date: Mon May 3 10:45:30 2021 +0200 Note that function symbols are preferred in `add-hook' * lisp/subr.el (add-hook): Note that FUNCTION should preferably be a symbol (bug#47992). diff --git a/lisp/subr.el b/lisp/subr.el index 964eb8f8ca..7a055f2ba1 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1815,9 +1815,15 @@ This makes the hook buffer-local, and it makes t a member of the buffer-local value. That acts as a flag to run the hook functions of the global value as well as in the local value. -HOOK should be a symbol, and FUNCTION may be any valid function. If -HOOK is void, it is first set to nil. If HOOK's value is a single -function, it is changed to a list of functions." +HOOK should be a symbol. If HOOK is void, it is first set to +nil. If HOOK's value is a single function, it is changed to a +list of functions. + +FUNCTION may be any valid function, but it's recommended to use a +function symbol and not a lambda form. Using a symbol will +ensure that the function is not re-added if the function is +edited, and using lambda forms may also have a negative +performance impact when running `add-hook' and `remove-hook'." (or (boundp hook) (set hook nil)) (or (default-boundp hook) (set-default hook nil)) (unless (numberp depth) (setq depth (if depth 90 0)))