commit dcf84bce2500ad2c632ae1d19d6b93324f55e25e (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Mon Aug 23 10:33:36 2021 +0300 * lisp/mouse.el (context-menu-toolbar): New function. (context-menu-functions): Add context-menu-toolbar to choice. (context-menu-region): Bind "Paste" to mouse-yank-at-click instead of mouse-yank-primary. https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00735.html diff --git a/lisp/mouse.el b/lisp/mouse.el index 6332d9fcec..28996e373d 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -289,6 +289,7 @@ the same menu with changes such as added new menu items." :type '(repeat (choice (function-item context-menu-undo) (function-item context-menu-region) + (function-item context-menu-toolbar) (function-item context-menu-global) (function-item context-menu-local) (function-item context-menu-minor) @@ -313,6 +314,17 @@ the same menu with changes such as added new menu items." (setq menu (funcall context-menu-filter-function menu))) menu)) +(defun context-menu-toolbar (menu) + "Tool bar menu items." + (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) + (define-key-after menu [separator-toolbar] menu-bar-separator) + (map-keymap (lambda (key binding) + (when (consp binding) + (define-key-after menu (vector key) + (copy-sequence binding)))) + (lookup-key global-map [tool-bar])) + menu) + (defun context-menu-global (menu) "Global submenus." (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) @@ -396,7 +408,7 @@ the same menu with changes such as added new menu items." "\\[ns-copy-including-secondary]" "\\[kill-ring-save]"))) (define-key-after menu [paste] - `(menu-item "Paste" mouse-yank-primary + `(menu-item "Paste" mouse-yank-at-click :visible (funcall ',(lambda () (and (or commit 8c62871829f873d83855d33e01eeb0b6626e87f1 Author: Lars Ingebrigtsen Date: Mon Aug 23 03:53:41 2021 +0200 Clarify :stderr in the make-process doc string * src/process.c (Fmake_process): Elaborate upon what :stderr does (bug#50166). diff --git a/src/process.c b/src/process.c index c3186eed75..bfca165fca 100644 --- a/src/process.c +++ b/src/process.c @@ -1718,7 +1718,10 @@ to use a pty, or nil to use the default specified through :stderr STDERR -- STDERR is either a buffer or a pipe process attached to the standard error of subprocess. Specifying this implies `:connection-type' is set to `pipe'. If STDERR is nil, standard error -is mixed with standard output and sent to BUFFER or FILTER. +is mixed with standard output and sent to BUFFER or FILTER. (Note +that specifying :stderr will create a new, separate (but associated) +process, with its own filter and sentinel. See +Info node `(elisp) Asynchronous Processes' for more details.) :file-handler FILE-HANDLER -- If FILE-HANDLER is non-nil, then look for a file name handler for the current buffer's `default-directory' commit fb65b14b32bdbac9ca05b3e7b56eaaaf4a8800df Author: Lars Ingebrigtsen Date: Mon Aug 23 02:25:49 2021 +0200 Update NEWS tagging for modules and parse-time-string diff --git a/etc/NEWS b/etc/NEWS index 80185a5d71..4daeecda78 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3624,32 +3624,39 @@ displaying data "smushed together" on the mode line. ** Changes in handling dynamic modules ++++ *** The module header 'emacs-module.h' now contains type aliases 'emacs_function' and 'emacs_finalizer' for module functions and finalizers, respectively. ++++ *** Module functions can now be made interactive. Use 'make_interactive' to give a module function an interactive specification. ++++ *** Module functions can now install an optional finalizer that is called when the function object is garbage-collected. Use 'set_function_finalizer' to set the finalizer and 'get_function_finalizer' to retrieve it. ++++ *** Modules can now open a channel to an existing pipe process using the new module function 'open_channel'. Modules can use this functionality to asynchronously send data back to Emacs. ++++ *** A new module API 'make_unibyte_string' is provided. It can be used to create Lisp strings with arbitrary byte sequences (a.k.a. "raw bytes"). ++++ ** 'file-modes', 'set-file-modes', and 'set-file-times' now have an optional argument specifying whether to follow symbolic links. -** 'parse-time-string' can now parse ISO 8601 format strings, -such as "2020-01-15T16:12:21-08:00". ++++ +** 'parse-time-string' can now parse ISO 8601 format strings. +These are on the format "2020-01-15T16:12:21-08:00". --- ** The new function 'decoded-time-period' has been added. commit cc2c150636e63aba4cd6f3c3d63a38072dd63018 Author: Lars Ingebrigtsen Date: Mon Aug 23 02:13:40 2021 +0200 Document `dlet' * doc/lispref/variables.texi (Local Variables): Document `dlet'. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 9356fb9f69..8a11154b73 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -284,6 +284,20 @@ being run once: (remove-hook 'post-command-hook hookfun)))) (add-hook 'post-command-hook hookfun)) @end lisp +@end defspec + +@defspec dlet (bindings@dots{}) forms@dots{} +This special form is like @code{let}, but it binds all variables +dynamically. This is rarely useful---you usually want to bind normal +variables lexically, and special variables (i.e., variables that are +defined with @code{defvar}) dynamically, and this is what @code{let} +does. + +@code{dlet} can be useful when interfacing with old code that assumes +that certain variables are dynamically bound, but it's impractical to +@code{defvar} these variables. @code{dlet} will temporarily make the +bound variables special, execute the forms, and then make the +variables non-special again. @end defspec Here is a complete list of the other facilities that create local diff --git a/etc/NEWS b/etc/NEWS index 1866ed0d6d..80185a5d71 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3594,8 +3594,10 @@ supporting Lisp files when 'require' is unsuitable. ** New function 'file-modes-number-to-symbolic' to convert a numeric file mode specification into symbolic form. ++++ ** New macro 'dlet' to dynamically bind variables. +--- ** The variable 'force-new-style-backquotes' has been removed. This removes the final remaining trace of old-style backquotes. commit 4015fb6e694d2a2593a3db3b65704d783035f46e Author: Lars Ingebrigtsen Date: Mon Aug 23 02:04:55 2021 +0200 Improve byte-compile-warnings doc string * lisp/emacs-lisp/bytecomp.el (byte-compile-warnings): Mention 'byte-compile-docstring-max-column'. diff --git a/etc/NEWS b/etc/NEWS index 3793bc4626..1866ed0d6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3736,10 +3736,11 @@ file can affect code in another. For details, see the manual section *** 'byte-recompile-directory' can now compile symlinked ".el" files. This is achieved by giving a non-nil FOLLOW-SYMLINKS parameter. +--- *** The byte-compiler now warns about too wide documentation strings. By default, it will warn if a documentation string is wider than the -largest of 80 characters or 'fill-column'. This is controlled by the -new user option 'byte-compile-docstring-max-column'. +largest of 'byte-compile-docstring-max-column' or 'fill-column' +characters. +++ *** 'byte-compile-file' optional argument LOAD is now obsolete. @@ -3788,6 +3789,7 @@ presented to users or passed on to other applications. ** 'start-process-shell-command' and 'start-file-process-shell-command' do not support the old calling conventions any longer. +--- ** Functions operating on local file names now check that the file names don't contain any NUL bytes. This avoids subtle bugs caused by silently using only the part of the file name until the first NUL byte. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7bd642d2b2..145cdbaa6e 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -322,8 +322,9 @@ Elements of the list may be: make-local calls to make-variable-buffer-local that may be incorrect. mapcar mapcar called for effect. constants let-binding of, or assignment to, constants/nonvariables. - docstrings docstrings that are too wide (longer than 80 characters, - or `fill-column', whichever is bigger) + docstrings docstrings that are too wide (longer than + `byte-compile-docstring-max-column' or + `fill-column' characters, whichever is bigger). suspicious constructs that usually don't do what the coder wanted. If the list begins with `not', then the remaining elements specify warnings to commit 5d32630f792f7d0ebbabb20ede076920cb2096a1 Author: Lars Ingebrigtsen Date: Mon Aug 23 01:52:16 2021 +0200 Do command mode markup in xwidget.el diff --git a/etc/NEWS b/etc/NEWS index abef0ffcd0..3793bc4626 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3833,12 +3833,14 @@ If Emacs was built with xwidget support, you can access the embedded webkit browser with 'M-x xwidget-webkit-browse-url'. Viewing two instances of xwidget webkit is not supported. +--- *** Downloading files from xwidget-webkit is now supported. The new variable 'xwidget-webkit-download-dir' says where to download to. -*** New functions for xwidget-webkit mode -'xwidget-webkit-clone-and-split-below', -'xwidget-webkit-clone-and-split-right'. +--- +*** New command 'xwidget-webkit-clone-and-split-below'. +*** New command 'xwidget-webkit-clone-and-split-right'. +These are used in 'xwidget-webkit-mode'. --- *** New variable 'xwidget-webkit-enable-plugins'. diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 33d30d349d..f8cb7a7add 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -95,9 +95,7 @@ NEW-SESSION specifies whether to create a new xwidget-webkit session. Interactively, URL defaults to the string looking like a url around point." (interactive (progn (require 'browse-url) - (browse-url-interactive-arg "xwidget-webkit URL: " - ;;(xwidget-webkit-current-url) - ))) + (browse-url-interactive-arg "xwidget-webkit URL: "))) (or (featurep 'xwidget-internal) (user-error "Your Emacs was not compiled with xwidgets support")) (when (stringp url) @@ -112,7 +110,7 @@ Interactively, URL defaults to the string looking like a url around point." "Clone current URL into a new widget place in new window below. Get the URL of current session, then browse to the URL in `split-window-below' with a new xwidget webkit session." - (interactive) + (interactive nil xwidget-webkit-mode) (let ((url (xwidget-webkit-current-url))) (with-selected-window (split-window-below) (xwidget-webkit-new-session url)))) @@ -121,7 +119,7 @@ in `split-window-below' with a new xwidget webkit session." "Clone current URL into a new widget place in new window right. Get the URL of current session, then browse to the URL in `split-window-right' with a new xwidget webkit session." - (interactive) + (interactive nil xwidget-webkit-mode) (let ((url (xwidget-webkit-current-url))) (with-selected-window (split-window-right) (xwidget-webkit-new-session url)))) @@ -168,12 +166,12 @@ in `split-window-right' with a new xwidget webkit session." (defun xwidget-webkit-zoom-in () "Increase webkit view zoom factor." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-zoom (xwidget-webkit-current-session) 0.1)) (defun xwidget-webkit-zoom-out () "Decrease webkit view zoom factor." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-zoom (xwidget-webkit-current-session) -0.1)) (defun xwidget-webkit-scroll-up (&optional arg) @@ -181,7 +179,7 @@ in `split-window-right' with a new xwidget webkit session." Stop if bottom of page is reached. Interactively, ARG is the prefix numeric argument. Negative ARG scrolls down." - (interactive "P") + (interactive "P" xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) (format "window.scrollBy(0, %d);" @@ -192,7 +190,7 @@ Negative ARG scrolls down." Stop if top of page is reached. Interactively, ARG is the prefix numeric argument. Negative ARG scrolls up." - (interactive "P") + (interactive "P" xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) (format "window.scrollBy(0, -%d);" @@ -203,7 +201,7 @@ Negative ARG scrolls up." The height of line is calculated with `window-font-height'. Stop if the bottom edge of the page is reached. If N is omitted or nil, scroll up by one line." - (interactive "p") + (interactive "p" xwidget-webkit-mode) (xwidget-webkit-scroll-up (* n (window-font-height)))) (defun xwidget-webkit-scroll-down-line (&optional n) @@ -211,14 +209,14 @@ If N is omitted or nil, scroll up by one line." The height of line is calculated with `window-font-height'. Stop if the top edge of the page is reached. If N is omitted or nil, scroll down by one line." - (interactive "p") + (interactive "p" xwidget-webkit-mode) (xwidget-webkit-scroll-down (* n (window-font-height)))) (defun xwidget-webkit-scroll-forward (&optional n) "Scroll webkit horizontally by N chars. The width of char is calculated with `window-font-width'. If N is omitted or nil, scroll forwards by one char." - (interactive "p") + (interactive "p" xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) (format "window.scrollBy(%d, 0);" @@ -228,7 +226,7 @@ If N is omitted or nil, scroll forwards by one char." "Scroll webkit back by N chars. The width of char is calculated with `window-font-width'. If N is omitted or nil, scroll backwards by one char." - (interactive "p") + (interactive "p" xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) (format "window.scrollBy(-%d, 0);" @@ -236,14 +234,14 @@ If N is omitted or nil, scroll backwards by one char." (defun xwidget-webkit-scroll-top () "Scroll webkit to the very top." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) "window.scrollTo(pageXOffset, 0);")) (defun xwidget-webkit-scroll-bottom () "Scroll webkit to the very bottom." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-execute-script (xwidget-webkit-current-session) "window.scrollTo(pageXOffset, window.document.body.scrollHeight);")) @@ -261,7 +259,7 @@ If N is omitted or nil, scroll backwards by one char." (defun xwidget-event-handler () "Receive xwidget event." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-log "stuff happened to xwidget %S" last-input-event) (let* ((xwidget-event-type (nth 1 last-input-event)) @@ -308,8 +306,8 @@ If non-nil, plugins are enabled. Otherwise, disabled." :type 'boolean :version "28.1")) -(define-derived-mode xwidget-webkit-mode - special-mode "xwidget-webkit" "Xwidget webkit view mode." +(define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit" + "Xwidget webkit view mode." (setq buffer-read-only t) (setq-local bookmark-make-record-function #'xwidget-webkit-bookmark-make-record) @@ -422,7 +420,7 @@ function findactiveelement(doc){ (defun xwidget-webkit-insert-string () "Insert string into the active field in the current webkit widget." ;; Read out the string in the field first and provide for edit. - (interactive) + (interactive nil xwidget-webkit-mode) ;; As the prompt differs on JavaScript execution results, ;; the function must handle the prompt itself. (let ((xww (xwidget-webkit-current-session))) @@ -458,7 +456,7 @@ XW is the xwidget identifier, TEXT is retrieved from the webkit." (defun xwidget-webkit-end-edit-textarea () "End editing of a webkit text area." - (interactive) + (interactive nil xwidget-webkit-mode) (goto-char (point-min)) (while (search-forward "\n" nil t) (replace-match "\\n" nil t)) @@ -474,7 +472,8 @@ XW is the xwidget identifier, TEXT is retrieved from the webkit." The ELEMENT-SELECTOR must be a valid CSS selector. For example, use this to display an anchor." (interactive (list (xwidget-webkit-current-session) - (read-string "Element selector: "))) + (read-string "Element selector: ")) + xwidget-webkit-mode) (xwidget-webkit-execute-script xw (format " @@ -490,7 +489,8 @@ use this to display an anchor." "Make webkit xwidget XW show a named element ELEMENT-NAME. For example, use this to display an anchor." (interactive (list (xwidget-webkit-current-session) - (read-string "Element name: "))) + (read-string "Element name: ")) + xwidget-webkit-mode) ;; TODO: This needs to be interfaced into browse-url somehow. The ;; tricky part is that we need to do this in two steps: A: load the ;; base url, wait for load signal to arrive B: navigate to the @@ -510,7 +510,8 @@ For example, use this to display an anchor." "Make webkit xwidget XW show an id-element ELEMENT-ID. For example, use this to display an anchor." (interactive (list (xwidget-webkit-current-session) - (read-string "Element id: "))) + (read-string "Element id: ")) + xwidget-webkit-mode) (xwidget-webkit-execute-script xw (format " @@ -526,7 +527,8 @@ For example, use this to display an anchor." "Make webkit xwidget XW show a name or element id ELEMENT-ID. For example, use this to display an anchor." (interactive (list (xwidget-webkit-current-session) - (read-string "Name or element id: "))) + (read-string "Name or element id: ")) + xwidget-webkit-mode) (xwidget-webkit-execute-script xw (format " @@ -541,12 +543,12 @@ For example, use this to display an anchor." (defun xwidget-webkit-adjust-size-to-content () "Adjust webkit to content size." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-adjust-size-to-content (xwidget-webkit-current-session))) (defun xwidget-webkit-adjust-size-dispatch () "Adjust size according to mode." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-adjust-size-to-window (xwidget-webkit-current-session)) ;; The recenter is intended to correct a visual glitch. ;; It errors out if the buffer isn't visible, but then we don't get @@ -575,12 +577,12 @@ For example, use this to display an anchor." (defun xwidget-webkit-adjust-size (w h) "Manually set webkit size to width W, height H." ;; TODO shouldn't be tied to the webkit xwidget - (interactive "nWidth:\nnHeight:\n") + (interactive "nWidth:\nnHeight:\n" xwidget-webkit-mode) (xwidget-resize (xwidget-webkit-current-session) w h)) (defun xwidget-webkit-fit-width () "Adjust width of webkit to window width." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-adjust-size (- (nth 2 (window-inside-pixel-edges)) (car (window-inside-pixel-edges))) 1000)) @@ -632,22 +634,22 @@ For example, use this to display an anchor." (defun xwidget-webkit-back () "Go back to previous URL in xwidget webkit buffer." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-goto-history (xwidget-webkit-current-session) -1)) (defun xwidget-webkit-forward () "Go forward in history." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-goto-history (xwidget-webkit-current-session) 1)) (defun xwidget-webkit-reload () "Reload current URL." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-goto-history (xwidget-webkit-current-session) 0)) (defun xwidget-webkit-current-url () "Display the current xwidget webkit URL and place it on the `kill-ring'." - (interactive) + (interactive nil xwidget-webkit-mode) (let ((url (xwidget-webkit-uri (xwidget-webkit-current-session)))) (message "URL: %s" (kill-new (or url ""))))) @@ -661,7 +663,7 @@ For example, use this to display an anchor." (defun xwidget-webkit-copy-selection-as-kill () "Get the webkit selection and put it on the `kill-ring'." - (interactive) + (interactive nil xwidget-webkit-mode) (xwidget-webkit-get-selection #'kill-new)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; commit 98e1752f9d7a36529c67550a5773235c120ee6aa Author: Lars Ingebrigtsen Date: Mon Aug 23 01:45:10 2021 +0200 Make xwidget-webkit-enable-plugins a defcustom * lisp/xwidget.el (xwidget-webkit-enable-plugins): Make into defcustom. diff --git a/etc/NEWS b/etc/NEWS index 86139100ca..abef0ffcd0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3840,7 +3840,10 @@ The new variable 'xwidget-webkit-download-dir' says where to download to. 'xwidget-webkit-clone-and-split-below', 'xwidget-webkit-clone-and-split-right'. +--- *** New variable 'xwidget-webkit-enable-plugins'. +If non-nil, enable plugins in xwidget. (This is only available on +macOS.) +++ ** On macOS, Emacs can now load dynamic modules with a ".dylib" suffix. diff --git a/lisp/xwidget.el b/lisp/xwidget.el index b8df55090a..33d30d349d 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -302,9 +302,11 @@ XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget." (defvar bookmark-make-record-function) (when (memq window-system '(mac ns)) - (defvar xwidget-webkit-enable-plugins nil + (defcustom xwidget-webkit-enable-plugins nil "Enable plugins for xwidget webkit. -If non-nil, plugins are enabled. Otherwise, disabled.")) +If non-nil, plugins are enabled. Otherwise, disabled." + :type 'boolean + :version "28.1")) (define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit" "Xwidget webkit view mode." commit ff2124d2979ee9ba5b8e22147fa8ccaa00e2cc4f Author: Basil L. Contovounesios Date: Sat Aug 21 22:55:58 2021 +0100 Fix recent parse-partial-sexp argument validation * src/syntax.c (parse-partial-sexp): Also handle markers as arguments (bug#49944). Tweak error message to follow conventions in "(elisp) Signaling Errors". diff --git a/src/syntax.c b/src/syntax.c index adc0da730e..057a4c3b1f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3595,8 +3595,8 @@ Sixth arg COMMENTSTOP non-nil means stop after the start of a comment. else target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth. */ - if (XFIXNUM (to) < XFIXNUM (from)) - error ("End position should be larger than start position."); + if (fix_position (to) < fix_position (from)) + error ("End position is smaller than start position"); validate_region (&from, &to); internalize_parse_state (oldstate, &state); commit 6c007668b38f06824004da466e97a96533f6344b Author: Andrea Corallo Date: Sun Aug 22 22:08:37 2021 +0100 Set a unique ID for eln files on macOS (bug#45934) * src/comp.c (Fcomp__compile_ctxt_to_file): Set gcc's -install_name parameter to the real filename. diff --git a/src/comp.c b/src/comp.c index c380346482..74a5337f8d 100644 --- a/src/comp.c +++ b/src/comp.c @@ -4490,6 +4490,15 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL, comp.speed < 0 ? 0 : (comp.speed > 3 ? 3 : comp.speed)); + + /* On MacOS set a unique dylib ID. */ +#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ + && defined (DARWIN_OS) + gcc_jit_context_add_driver_option (comp.ctxt, "-install_name"); + gcc_jit_context_add_driver_option ( + comp.ctxt, SSDATA (Ffile_name_nondirectory (filename))); +#endif + comp.d_default_idx = CALL1I (comp-data-container-idx, CALL1I (comp-ctxt-d-default, Vcomp_ctxt)); comp.d_impure_idx = commit 48d49694539beae5270ca49eae2d5419938a906e Author: Masahiro Nakamura Date: Sun Aug 22 10:13:58 2021 +0900 Set label for NSToolbarItem (bug#50159) * src/nsmenu.m (update_frame_tool_bar): Get label text and pass it to ... ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): ... this that sets label for NSToolbarItem. * src/nsterm.h ([EmacsToolbar addDisplayItemWithImage:idx:tag:labelText:helpText:enabled:]): Add labelText argument. diff --git a/src/nsmenu.m b/src/nsmenu.m index fe4f825832..3493e4e131 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1033,6 +1033,8 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item ptrdiff_t img_id; struct image *img; Lisp_Object image; + Lisp_Object labelObj; + const char *labelText; Lisp_Object helpObj; const char *helpText; @@ -1059,6 +1061,8 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item { idx = -1; } + labelObj = TOOLPROP (TOOL_BAR_ITEM_LABEL); + labelText = NILP (labelObj) ? "" : SSDATA (labelObj); helpObj = TOOLPROP (TOOL_BAR_ITEM_HELP); if (NILP (helpObj)) helpObj = TOOLPROP (TOOL_BAR_ITEM_CAPTION); @@ -1084,6 +1088,7 @@ - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item [toolbar addDisplayItemWithImage: img->pixmap idx: k++ tag: i + labelText: labelText helpText: helpText enabled: enabled_p]; #undef TOOLPROP @@ -1188,6 +1193,7 @@ - (BOOL) changed - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx tag: (int)tag + labelText: (const char *)label helpText: (const char *)help enabled: (BOOL)enabled { @@ -1205,6 +1211,7 @@ - (void) addDisplayItemWithImage: (EmacsImage *)img item = [[[NSToolbarItem alloc] initWithItemIdentifier: identifier] autorelease]; [item setImage: img]; + [item setLabel: [NSString stringWithUTF8String: label]]; [item setToolTip: [NSString stringWithUTF8String: help]]; [item setTarget: emacsView]; [item setAction: @selector (toolbarClicked:)]; diff --git a/src/nsterm.h b/src/nsterm.h index 404c714005..6d4ea77121 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -548,6 +548,7 @@ typedef id instancetype; - (void) addDisplayItemWithImage: (EmacsImage *)img idx: (int)idx tag: (int)tag + labelText: (const char *)label helpText: (const char *)help enabled: (BOOL)enabled; commit f405756811741b805c2833aa941d23bfd0f36919 Author: Michael Albinus Date: Sun Aug 22 20:44:54 2021 +0200 Implement `copy-directory-create-symlink' for remote files * lisp/net/tramp-sh.el (tramp-sh-handle-copy-directory): Implement `copy-directory-create-symlink'. (Bug#10897) * test/lisp/net/tramp-tests.el (tramp-test15-copy-directory): Extend test. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f00434c146..9dcf55340c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1861,37 +1861,44 @@ ID-FORMAT valid values are `string' and `integer'." (with-parsed-tramp-file-name (if t1 dirname newname) nil (unless (file-exists-p dirname) (tramp-compat-file-missing v dirname)) - (if (and (not copy-contents) - (tramp-get-method-parameter v 'tramp-copy-recursive) - ;; When DIRNAME and NEWNAME are remote, they must have - ;; the same method. - (or (null t1) (null t2) - (string-equal - (tramp-file-name-method (tramp-dissect-file-name dirname)) - (tramp-file-name-method - (tramp-dissect-file-name newname))))) - ;; scp or rsync DTRT. - (progn - (when (and (file-directory-p newname) - (not (directory-name-p newname))) - (tramp-error v 'file-already-exists newname)) - (setq dirname (directory-file-name (expand-file-name dirname)) - newname (directory-file-name (expand-file-name newname))) - (when (and (file-directory-p newname) - (not (string-equal (file-name-nondirectory dirname) - (file-name-nondirectory newname)))) - (setq newname - (expand-file-name - (file-name-nondirectory dirname) newname))) - (unless (file-directory-p (file-name-directory newname)) + + ;; `copy-directory-create-symlink' exists since Emacs 28.1. + (if (and (bound-and-true-p copy-directory-create-symlink) + (file-symlink-p dirname) + (tramp-equal-remote dirname newname)) + (make-symbolic-link (file-symlink-p dirname) newname) + + (if (and (not copy-contents) + (tramp-get-method-parameter v 'tramp-copy-recursive) + ;; When DIRNAME and NEWNAME are remote, they must + ;; have the same method. + (or (null t1) (null t2) + (string-equal + (tramp-file-name-method (tramp-dissect-file-name dirname)) + (tramp-file-name-method + (tramp-dissect-file-name newname))))) + ;; scp or rsync DTRT. + (progn + (when (and (file-directory-p newname) + (not (directory-name-p newname))) + (tramp-error v 'file-already-exists newname)) + (setq dirname (directory-file-name (expand-file-name dirname)) + newname (directory-file-name (expand-file-name newname))) + (when (and (file-directory-p newname) + (not (string-equal (file-name-nondirectory dirname) + (file-name-nondirectory newname)))) + (setq newname + (expand-file-name + (file-name-nondirectory dirname) newname))) + (unless (file-directory-p (file-name-directory newname)) (make-directory (file-name-directory newname) parents)) - (tramp-do-copy-or-rename-file-out-of-band - 'copy dirname newname 'ok-if-already-exists keep-date)) + (tramp-do-copy-or-rename-file-out-of-band + 'copy dirname newname 'ok-if-already-exists keep-date)) - ;; We must do it file-wise. - (tramp-run-real-handler - #'copy-directory - (list dirname newname keep-date parents copy-contents))) + ;; We must do it file-wise. + (tramp-run-real-handler + #'copy-directory + (list dirname newname keep-date parents copy-contents)))) ;; When newname did exist, we have wrong cached values. (when t2 diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ee0601fe20..4e409fcbf0 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2866,7 +2866,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (file-name-nondirectory tmp-name1) tmp-name2)) (tmp-name4 (expand-file-name "foo" tmp-name1)) (tmp-name5 (expand-file-name "foo" tmp-name2)) - (tmp-name6 (expand-file-name "foo" tmp-name3))) + (tmp-name6 (expand-file-name "foo" tmp-name3)) + (tmp-name7 (tramp--test-make-temp-name nil quoted))) ;; Copy complete directory. (unwind-protect @@ -2922,7 +2923,32 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ;; Cleanup. (ignore-errors (delete-directory tmp-name1 'recursive) - (delete-directory tmp-name2 'recursive)))))) + (delete-directory tmp-name2 'recursive))) + + ;; Copy symlink to directory. Implemented since Emacs 28.1. + (when (and (tramp--test-emacs28-p) (tramp--test-sh-p)) + (dolist (copy-directory-create-symlink '(nil t)) + (unwind-protect + (progn + ;; Copy empty directory. + (make-directory tmp-name1) + (write-region "foo" nil tmp-name4) + (make-symbolic-link tmp-name1 tmp-name7) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name4)) + (should (file-symlink-p tmp-name7)) + (copy-directory tmp-name7 tmp-name2) + (if copy-directory-create-symlink + (should + (string-equal + (file-symlink-p tmp-name2) (file-symlink-p tmp-name7))) + (should (file-directory-p tmp-name2)))) + + ;; Cleanup. + (ignore-errors + (delete-directory tmp-name1 'recursive) + (delete-directory tmp-name2 'recursive) + (delete-directory tmp-name7 'recursive)))))))) (ert-deftest tramp-test16-directory-files () "Check `directory-files'." commit 1afe59f7f888fd80e9bbad502d96e5e2ee9feb4c Author: João Távora Date: Sun Aug 22 16:36:26 2021 +0100 Double check completions-group customization variable in Icomplete bug#48545 * lisp/icomplete.el (icomplete--augment): Double check completions-group. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 03616f9b6a..0fa5f36734 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -760,7 +760,8 @@ by `group-function''s second \"transformation\" protocol." (plist-get completion-extra-properties :affixation-function))) (ann-fun (or (completion-metadata-get md 'annotation-function) (plist-get completion-extra-properties :annotation-function))) - (grp-fun (completion-metadata-get md 'group-function)) + (grp-fun (and completions-group + (completion-metadata-get md 'group-function))) (annotated (cond (aff-fun (funcall aff-fun prospects)) commit ba852512f23fdab674086e35d4207e3970dd0912 Author: João Távora Date: Sun Aug 22 15:56:36 2021 +0100 Don't mess up grouping in completion-all-sorted-completions The default sorting order will mess up the naturally grouped order of the candidates in the table that specified the group-function. As seen in xref.el when (setq xref-show-definitions-function 'xref-show-definitions-completing-read) (setq completions-group t) M-x fido-mode Also partially seen with C-x 8 RET (M-x insert-char) with (setq read-char-by-name-sort 'code) bug#48545 * lisp/minibuffer.el (completion-all-sorted-completions): Don't use default sort if there's a group-function in the table. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ffcd5d88ab..89d3a2a09d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1496,7 +1496,8 @@ Remove completion BASE prefix string from history elements." base-size md minibuffer-completion-table minibuffer-completion-predicate)) - (sort-fun (completion-metadata-get all-md 'cycle-sort-function))) + (sort-fun (completion-metadata-get all-md 'cycle-sort-function)) + (group-fun (completion-metadata-get all-md 'group-function))) (when last (setcdr last nil) @@ -1506,17 +1507,25 @@ Remove completion BASE prefix string from history elements." (setq all (delete-dups all)) (setq last (last all)) - (if sort-fun - (setq all (funcall sort-fun all)) - ;; Sort first by length and alphabetically. + (cond + (sort-fun (setq all (funcall sort-fun all))) + ((and completions-group group-fun) + ;; TODO: experiment with re-grouping here. Might be slow + ;; if the group-fun (given by the table and out of our + ;; control) is slow and/or allocates too much. + ) + (t + ;; If the table doesn't stipulate a sorting function or a + ;; group function, sort first by length and + ;; alphabetically. (setq all (minibuffer--sort-by-length-alpha all)) - ;; Sort by history position, put the default, if it + ;; Then sort by history position, and put the default, if it ;; exists, on top. (when (minibufferp) (setq all (minibuffer--sort-by-position (minibuffer--sort-preprocess-history (substring string 0 base-size)) - all)))) + all))))) ;; Cache the result. This is not just for speed, but also so that ;; repeated calls to minibuffer-force-complete can cycle through commit 06c3a321e3cb7a7602fadf1817721a8f1b759604 Author: Lars Ingebrigtsen Date: Sun Aug 22 16:58:19 2021 +0200 Revert "Fix dired switch (that contain quotes and spaces) parsing" This reverts commit 04f723dec944eaa7b5e99373840a8bf920ba5fdd. The dired switches are documented to not follow shell syntax, but instead uses a lisp-in-string-form kind of quoting. diff --git a/lisp/files.el b/lisp/files.el index ba362827ee..e519a8ea8b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7501,7 +7501,7 @@ normally equivalent short `-D' option is just passed on to (unless (equal switches "") ;; Split the switches at any spaces so we can ;; pass separate options as separate args. - (split-string-shell-command switches))) + (split-string-and-unquote switches))) ;; Avoid lossage if FILE starts with `-'. '("--") (list file)))))) commit 16bb524a5e2e2b8ddd3bd705972b9f7502f7f1ab Author: Colin Woodbury Date: Sun Aug 22 16:27:12 2021 +0200 Don't echo empty string in file-name-with-extension * lisp/files.el (file-name-with-extension): Avoid echoing a filename string known to be empty (bug#50149). diff --git a/lisp/files.el b/lisp/files.el index f0baa4fac6..ba362827ee 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5033,7 +5033,7 @@ FILENAME has the format of a directory. See also `file-name-sans-extension'." (let ((extn (string-trim-left extension "[.]"))) (cond ((string-empty-p filename) - (error "Empty filename: %s" filename)) + (error "Empty filename")) ((string-empty-p extn) (error "Malformed extension: %s" extension)) ((directory-name-p filename) commit 5b55659baebd314a00e0219e65e356a9acdbc40a Author: Omar Polo Date: Sun Aug 22 16:23:54 2021 +0200 Avoid using %n in emacsclient * lib-src/emacsclient.c (local_sockname): Avoid using %n (bug#50155). diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 8346524a3e..018e81e422 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1401,10 +1401,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen, /* Put the full address name into the buffer, since the caller might need it for diagnostics. But don't overrun the buffer. */ uintmax_t uidmax = uid; - int emacsdirlen; int suffixlen = snprintf (sockname + tmpdirlen, socknamesize - tmpdirlen, - "/emacs%"PRIuMAX"%n/%s", uidmax, &emacsdirlen, - server_name); + "/emacs%"PRIuMAX"/%s", uidmax, server_name); if (! (0 <= suffixlen && suffixlen < socknamesize - tmpdirlen)) return ENAMETOOLONG; @@ -1412,7 +1410,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen, this user's directory and does not let others write to it; this fends off some symlink attacks. To avoid races, keep the parent directory open while checking. */ - char *emacsdirend = sockname + tmpdirlen + emacsdirlen; + char *emacsdirend = sockname + tmpdirlen + suffixlen - + strlen(server_name) - 1; *emacsdirend = '\0'; int dir = openat (AT_FDCWD, sockname, O_PATH | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); commit e8e78809ba701eb8031120697bb9b3383473b86c Author: Michael Albinus Date: Sun Aug 22 14:50:19 2021 +0200 Some adaptions for Tramp's security key detection. * lisp/net/tramp.el (tramp-security-key-timeout-regexp): New defcustom. (tramp-action-show-and-confirm-message): Don't use timeout, check for the timeout message of the ssh command. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 83df05c24b..b687eb7653 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -714,6 +714,13 @@ The regexp should match at end of buffer." :version "28.1" :type 'regexp) +(defcustom tramp-security-key-timeout-regexp + "^\r*sign_and_send_pubkey: signing failed for .*[\r\n]*" + "Regular expression matching security key timeout message. +The regexp should match at end of buffer." + :version "28.1" + :type 'regexp) + (defcustom tramp-operation-not-permitted-regexp (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*" (regexp-opt '("Operation not permitted") t)) @@ -4692,16 +4699,21 @@ The terminal type can be configured with `tramp-terminal-type'." "Show the user a message for confirmation. Wait, until the connection buffer changes." (with-current-buffer (process-buffer proc) - (let ((stimers (with-timeout-suspend))) + (let ((stimers (with-timeout-suspend)) + (cursor-in-echo-area t) + set-message-function clear-message-function) (tramp-message vec 6 "\n%s" (buffer-string)) - (goto-char (point-min)) (tramp-check-for-regexp proc tramp-process-action-regexp) (with-temp-message (replace-regexp-in-string "[\r\n]" "" (match-string 0)) - (redisplay 'force) ;; Hide message in buffer. (narrow-to-region (point-max) (point-max)) ;; Wait for new output. - (tramp-wait-for-regexp proc 30 tramp-security-key-confirmed-regexp)) + (while (not (ignore-error 'file-error + (tramp-wait-for-regexp + proc 0.1 tramp-security-key-confirmed-regexp))) + (when (tramp-check-for-regexp proc tramp-security-key-timeout-regexp) + (throw 'tramp-action 'timeout)) + (redisplay 'force))) ;; Reenable the timers. (with-timeout-unsuspend stimers))) t) commit 7f5f99f2a081c71a94f3ba627d5ab1d443c27e3f Author: Mattias Engdegård Date: Sun Aug 22 10:56:39 2021 +0200 Make Qhide declaration non-target-specific * src/xfns.c (syms_of_xfns): Move DEFSYM from here... * src/menu.c (syms_of_menu): ... to here. This fixes the NS build after dd7d966eb40b. diff --git a/src/menu.c b/src/menu.c index 4edd4ce33f..d43360ec4e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1579,6 +1579,8 @@ syms_of_menu (void) menu_items = Qnil; staticpro (&menu_items); + DEFSYM (Qhide, "hide"); + defsubr (&Sx_popup_menu); defsubr (&Sx_popup_dialog); defsubr (&Smenu_bar_menu_at_x_y); diff --git a/src/xfns.c b/src/xfns.c index 81349d0b50..0d0335c299 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -7836,7 +7836,6 @@ syms_of_xfns (void) DEFSYM (Qfont_parameter, "font-parameter"); DEFSYM (Qmono, "mono"); DEFSYM (Qassq_delete_all, "assq-delete-all"); - DEFSYM (Qhide, "hide"); DEFSYM (Qresize_mode, "resize-mode"); #ifdef USE_CAIRO commit 6984eea510a579a25bd7811f6d13e1bf2b4a35cb Author: Ergus Date: Sun Aug 22 11:56:01 2021 +0300 * lisp/mouse.el (context-menu-mode-map): New variable. (context-menu--saved-bindings, context-menu--bind-mouse) (context-menu--restore-bindings): Remove. (context-menu-mode): Don't use removed functions. diff --git a/lisp/mouse.el b/lisp/mouse.el index 7cdea34d86..6332d9fcec 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -440,42 +440,22 @@ the same menu with changes such as added new menu items." `(menu-item ,(purecopy "Context Menu") ignore :filter (lambda (_) (context-menu-map)))) -(defvar context-menu--saved-bindings nil - "Alist of bindings to restore when `context-menu-mode' is disabled.") - -(defun context-menu--bind-mouse (click-sym down-sym) - "Enable `context-menu-mode' mouse bindings. -CLICK-SYM and DOWN-SYM are the mouse click and down key symbols to use." - (let ((click (vector click-sym)) - (down (vector down-sym))) - (push (cons click-sym (global-key-binding click)) - context-menu--saved-bindings) - (global-unset-key click) - (push (cons down-sym (global-key-binding down)) - context-menu--saved-bindings) - (global-set-key down context-menu-entry))) - -(defun context-menu--restore-bindings () - "Restore saved `context-menu-mode' bindings." - (pcase-dolist (`(,sym . ,binding) context-menu--saved-bindings) - (let ((key (vector sym))) - (if binding - (global-set-key key binding) - (global-unset-key key))))) +(defvar context-menu-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-3] nil) + (define-key map [down-mouse-3] context-menu-entry) + (when (featurep 'ns) + (define-key map [C-mouse-1] nil) + (define-key map [C-down-mouse-1] context-menu-entry)) + map) + "Context Menu mode map.") (define-minor-mode context-menu-mode "Toggle Context Menu mode. 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 - (if context-menu-mode - (progn - (setq context-menu--saved-bindings nil) - (context-menu--bind-mouse 'mouse-3 'down-mouse-3) - (when (featurep 'ns) - (context-menu--bind-mouse 'C-mouse-1 'C-down-mouse-1))) - (context-menu--restore-bindings))) + :global t :group 'mouse) ;; Commands that operate on windows. commit dd7d966eb40b58a221ea29930582b8173ea87ee2 Author: Juri Linkov Date: Sun Aug 22 11:44:55 2021 +0300 Don't show menu titles with the text property 'hide' (bug#50067) * lisp/mouse.el (context-menu-map): Add menu title "Context Menu" propertized with the text property 'hide'. * src/menu.c (x_popup_menu_1): Don't show the title with the non-nil text property 'hide' on GTK and NS. diff --git a/lisp/mouse.el b/lisp/mouse.el index 3441a4787e..7cdea34d86 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -304,7 +304,7 @@ the same menu with changes such as added new menu items." (defun context-menu-map () "Return composite menu map." - (let ((menu (make-sparse-keymap))) + (let ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))) (run-hook-wrapped 'context-menu-functions (lambda (fun) (setq menu (funcall fun menu)) diff --git a/src/menu.c b/src/menu.c index e441d22ea0..4edd4ce33f 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1284,6 +1284,14 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) /* Search for a string appearing directly as an element of the keymap. That string is the title of the menu. */ prompt = Fkeymap_prompt (keymap); + +#if defined (USE_GTK) || defined (HAVE_NS) + if (STRINGP (prompt) + && SCHARS (prompt) > 0 + && !NILP (Fget_text_property (make_fixnum (0), Qhide, prompt))) + title = Qnil; + else +#endif if (!NILP (prompt)) title = prompt; commit 654e096b09378b2b0d1cdc9b8c0634bf5f3c9306 Author: Eli Zaretskii Date: Sun Aug 22 11:42:05 2021 +0300 ; * lisp/emacs-lisp/comp.el (native-comp-async-cu-done-functions): Doc fix. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 7bbe63c3e1..7d2d36d103 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -116,9 +116,9 @@ or one if there's just one execution unit." :version "28.1") (defcustom native-comp-async-cu-done-functions nil - "List of functions to call after asynchronously compiling one compilation unit. -Called with one argument FILE, the filename used as input to -compilation." + "List of functions to call when asynchronous compilation of a file is done. +Each function is called with one argument FILE, the filename whose +compilation has completed." :type 'hook :version "28.1")