commit 6b3d69b16ed50c8a4dea1e3f1f9f231657e66590 (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Thu Jan 30 08:40:34 2025 +0100 Tramp cleanup * doc/misc/tramp.texi (Predefined connection information): Mention also "androidsu" as special case of "tmpdir". (Remote processes): Signals are not delivered to remote direct async processes. Say, that there are restrictions for transfer of binary data to remote direct async processes. * lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory): Simplify. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 3fef196219d..9aad087c510 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2388,9 +2388,9 @@ to a remote home directory, like @option{adb}, @option{rclone} and @item @t{"tmpdir"} The temporary directory on the remote host. If not specified, the -default value is @t{"/data/local/tmp"} for the @option{adb} method, -@t{"/C$/Temp"} for the @option{smb} method, and @t{"/tmp"} otherwise. -@xref{Temporary directory}. +default value is @t{"/data/local/tmp"} for the @option{adb} and +@option{androidsu} methods, @t{"/C$/Temp"} for the @option{smb} +method, and @t{"/tmp"} otherwise. @xref{Temporary directory}. @item @t{"posix"} @@ -4690,7 +4690,9 @@ It cannot be killed via @code{interrupt-process}. It does not report the remote terminal name via @code{process-tty-name}. @item -It does not set process property @code{remote-pid}. +It does not set process property @code{remote-pid}. Consequently, +signals cannot be sent to that remote process; they are sent to the +local process instead, which establishes the connection. @item It fails, when the command is too long. This can happen on @@ -4712,6 +4714,15 @@ by the connection property @t{"direct-async-process"}. This is still supported but deprecated, and it will be removed in a future @value{tramp} version. +@strong{Note}: For the @option{ssh} and @option{scp} methods, +@value{tramp} does not faithfully pass binary sequences on to the +process. You can change this by changing the respective connection +argument (@pxref{Predefined connection information}) via + +@lisp +(add-to-list 'tramp-connection-properties (list "/ssh:" "direct-async" t)) +@end lisp + @node Cleanup remote connections @section Cleanup remote connections diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index d432deee5d1..37c82e4922b 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -68,10 +68,10 @@ ;; Some properties are handled special: ;; -;; - Properties which start with a space, like " process-name", are -;; not saved in the file `tramp-persistency-file-name', although -;; being connection properties related to a `tramp-file-name' -;; structure. +;; - Ephemeral properties which start with a space, like +;; " process-name", are not saved in the file +;; `tramp-persistency-file-name', although being connection +;; properties related to a `tramp-file-name' structure. ;; ;; - Reusable properties, which should not be saved, are kept in the ;; process key retrieved by `tramp-get-process' (the main connection @@ -79,6 +79,7 @@ ;; recomputation when a new asynchronous process is created by ;; `make-process'. Examples are "unsafe-temporary-file", ;; "remote-path", "device" (tramp-adb.el) or "share" (tramp-gvfs.el). +;; FIXME: Shall they be converted to ephemeral connection properties? ;;; Code: diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 04c7df2eaac..0e69cca2f32 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -79,7 +79,7 @@ (if-let* ((xdg (xdg-cache-home)) ((file-directory-p xdg)) ((file-writable-p xdg))) - (prog1 (setq xdg (file-name-concat xdg "emacs")) + (prog1 (setq xdg (expand-file-name "emacs" xdg)) (make-directory xdg t)) (eval (car (get 'temporary-file-directory 'standard-value)) t))) "The default value of `temporary-file-directory' for Tramp.") @@ -243,6 +243,8 @@ value is the default binding of the variable." ;; are developers using `outline-minor-mode' in Lisp files, we still ;; keep this quoting. ;; +;; * Use `with-environment-variables'. +;; ;; * Starting with Emacs 29.1, use `buffer-match-p'. ;; ;; * Starting with Emacs 29.1, use `string-split'. diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 40449b2c455..64bde348775 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -737,7 +737,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (tramp-error v 'file-error "Cannot expand tilde in file `%s'" name)) (unless (tramp-run-real-handler #'file-name-absolute-p (list localname)) (setq localname (concat "/" localname))) - ;; Do not keep "/..". + ;; Do not keep "/..". (when (string-match-p (rx bos "/" (** 1 2 ".") eos) localname) (setq localname "/")) ;; Do normal `expand-file-name' (this does "/./" and "/../"), diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d87cecb9ec6..be761a71fa7 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -7208,5 +7208,11 @@ If VEC is `tramp-null-hop', return local null device." ;; ;; * Implement user and host name completion for multi-hops. Some ;; methods in tramp-container.el have it already. +;; +;; * Make it configurable, which environment variables are set in +;; direct async processes. +;; +;; * Pass working dir for direct async processes, for example for +;; container methods. ;;; tramp.el ends here commit 3be04f3dab85348006a8567e172c3dcb0a6831a4 Author: Yuan Fu Date: Wed Jan 29 23:20:38 2025 -0800 Fix tree-sitter language remapping * src/treesit.c (resolve_language_symbol): Move forward. (treesit_ensure_query_compiled): Resolve language remapping here. (Ftreesit_parser_list): Don't resolve language remaping here, because there's no need: parsers now carries the remapped language. (Ftreesit_query_compile): Don't resolve language remapping here, because we resolve language remapping when actually compiling the query. Also we want the query to carry the unmapped language. diff --git a/src/treesit.c b/src/treesit.c index 3cbce612653..2c14f965c2d 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -563,6 +563,17 @@ treesit_symbol_to_c_name (char *symbol_name) } } +/* Resolve language symbol LANG according to + treesit-language-remap-alist. */ +static +Lisp_Object resolve_language_symbol (Lisp_Object lang) +{ + Lisp_Object res = Fassoc (lang, Vtreesit_language_remap_alist, Qeq); + if (NILP (res)) + return lang; + return Fcdr (res); +} + /* Find the override name for LANGUAGE_SYMBOL in treesit-load-name-override-list. Set NAME and C_SYMBOL to the override name, and return true if there exists one, otherwise @@ -1489,10 +1500,20 @@ treesit_ensure_query_compiled (Lisp_Object query, Lisp_Object *signal_symbol, /* Get query source and TSLanguage ready. */ Lisp_Object source = XTS_COMPILED_QUERY (query)->source; Lisp_Object language = XTS_COMPILED_QUERY (query)->language; + + Lisp_Object remapped_lang = resolve_language_symbol (language); + if (!SYMBOLP (remapped_lang)) + { + *signal_symbol = Qtreesit_query_error; + *signal_data = list2 (build_string ("Invalid language symbol"), + remapped_lang); + return NULL; + } + /* This is the main reason why we compile query lazily: to avoid loading languages early. */ struct treesit_loaded_lang lang - = treesit_load_language (language, signal_symbol, signal_data); + = treesit_load_language (remapped_lang, signal_symbol, signal_data); TSLanguage *treesit_lang = lang.lang; if (treesit_lang == NULL) return NULL; @@ -1530,17 +1551,6 @@ void treesit_ensure_query_compiled_signal (Lisp_Object lisp_query) xsignal (signal_symbol, signal_data); } -/* Resolve language symbol LANG according to - treesit-language-remap-alist. */ -static -Lisp_Object resolve_language_symbol (Lisp_Object lang) -{ - Lisp_Object res = Fassoc (lang, Vtreesit_language_remap_alist, Qeq); - if (NILP (res)) - return lang; - return Fcdr (res); -} - /* Lisp definitions. */ @@ -1754,8 +1764,6 @@ tag. */) if (buf->base_buffer) buf = buf->base_buffer; - language = resolve_language_symbol (language); - /* Return a fresh list so messing with that list doesn't affect our internal data. */ Lisp_Object return_list = Qnil; @@ -3087,9 +3095,6 @@ You can use `treesit-query-validate' to validate and debug a query. */) wrong_type_argument (Qtreesit_query_p, query); CHECK_SYMBOL (language); - Lisp_Object remapped_lang = resolve_language_symbol (language); - CHECK_SYMBOL (remapped_lang); - treesit_initialize (); if (TS_COMPILED_QUERY_P (query)) @@ -3100,7 +3105,10 @@ You can use `treesit-query-validate' to validate and debug a query. */) return query; } - Lisp_Object lisp_query = make_treesit_query (query, remapped_lang); + /* We don't map language here, instead, we remap language when + actually compiling the query. This way the query appears to have + the unmapped language to the Lisp world. */ + Lisp_Object lisp_query = make_treesit_query (query, language); /* Maybe actually compile. */ if (NILP (eager)) commit c81b50aaf520daa2c9c8b45715f75149bc254014 Author: Yuan Fu Date: Mon Jan 27 18:00:16 2025 -0800 Add back tree-sitter declare-function for python.el (bug#75526) treesit-declare-unavailable-functions is not available for old emacs versions, but python.el is a core package available on ELPA. Remove the treesit-declare-unavailable-functions until compat.el releases a new version that contains it. * lisp/progmodes/python.el: Remove treesit-declare-unavailable-functions and add back declare-function forms. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c00de2d6a8d..bd8ec236207 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -259,7 +259,14 @@ (require 'compat) (require 'project nil 'noerror) (require 'seq) -(treesit-declare-unavailable-functions) + +(declare-function treesit-parser-create "treesit.c") +(declare-function treesit-induce-sparse-tree "treesit.c") +(declare-function treesit-node-child-by-field-name "treesit.c") +(declare-function treesit-node-type "treesit.c") +(declare-function treesit-node-start "treesit.c") +(declare-function treesit-node-end "treesit.c") +(declare-function treesit-node-parent "treesit.c") ;; Avoid compiler warnings (defvar compilation-error-regexp-alist) commit 782be196e52f8912c3e26c646f04fe48cf703aca Author: Gerd Möllmann Date: Wed Jan 29 13:42:40 2025 +0100 Further fixes for cursor positioning (bug#75056) * src/dispnew.c (write_matrix): Don't set the cursor here. Parameter to set the cursor or not removed. (combine_updates_for_frame): Call tty_set_cursor here, depending on whether or not the selected frame is related to the updated frame. (update_frame_with_menu): Adapt to change of write_matrix. diff --git a/src/dispnew.c b/src/dispnew.c index 913b860df1e..35c8d347616 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -95,12 +95,14 @@ static void check_matrix_pointers (struct glyph_matrix *, static void mirror_line_dance (struct window *, int, int, int *, char *); static void update_window_tree (struct window *); static void update_window (struct window *); -static void write_matrix (struct frame *, bool, bool, bool); +static void write_matrix (struct frame *, bool, bool); static void scrolling (struct frame *); static void set_window_cursor_after_update (struct window *); static void adjust_frame_glyphs_for_window_redisplay (struct frame *); static void adjust_frame_glyphs_for_frame_redisplay (struct frame *); static void set_window_update_flags (struct window *w, bool on_p); +static void tty_set_cursor (struct frame *f); + #if 0 /* Please leave this in as a debugging aid. */ static void @@ -3994,10 +3996,19 @@ combine_updates_for_frame (struct frame *f, bool inhibit_scrolling) } update_begin (root); - write_matrix (root, inhibit_scrolling, 1, false); + write_matrix (root, inhibit_scrolling, false); make_matrix_current (root); update_end (root); + /* The selected frame determines where the cursor on ttys goes, except + when it is a frame that is completely unrelated to the frame being + displayed. This can happen with multi-tty, when the selected frame + can be a window-system frame. */ + if (frame_ancestor_p (root, SELECTED_FRAME ())) + tty_set_cursor (SELECTED_FRAME ()); + else + tty_set_cursor (root); + /* If a child is displayed, and the cursor is displayed in another frame, the child might lay above the cursor, so that it appears to "shine through" the child. Avoid that because it's confusing. */ @@ -4066,22 +4077,20 @@ void update_frame_with_menu (struct frame *f, int row, int col) { struct window *root_window = XWINDOW (f->root_window); - bool cursor_at_point_p; eassert (FRAME_TERMCAP_P (f)); /* Update the display. */ update_begin (f); - cursor_at_point_p = !(row >= 0 && col >= 0); - /* Do not stop due to pending input, and do not try scrolling. This - means that write_glyphs will always return false. */ - write_matrix (f, 1, cursor_at_point_p, true); + write_matrix (f, true, true); make_matrix_current (f); clear_desired_matrices (f); /* ROW and COL tell us where in the menu to position the cursor, so that screen readers know the active region on the screen. */ - if (!cursor_at_point_p) + if (row >= 0 && col >= 0) cursor_to (f, row, col); + else + tty_set_cursor (f); update_end (f); flush_terminal (f); @@ -5658,13 +5667,12 @@ tty_set_cursor (struct frame *f) } } -/* Write desired matix of tty frame F and make it current. +/* Write desired matrix of tty frame F and make it current. INHIBIT_ID_P means that scrolling by insert/delete should not be tried. - SET_CURSOR_P false means do not set cursor at point in selected window. */ + UPDATING_MENU_P true means we are called for updating a tty menu. */ static void -write_matrix (struct frame *f, bool inhibit_id_p, - bool set_cursor_p, bool updating_menu_p) +write_matrix (struct frame *f, bool inhibit_id_p, bool updating_menu_p) { /* If we cannot insert/delete lines, it's no use trying it. */ if (!FRAME_LINE_INS_DEL_OK (f)) @@ -5689,10 +5697,6 @@ write_matrix (struct frame *f, bool inhibit_id_p, for (int i = first_row; i < last_row; ++i) if (MATRIX_ROW_ENABLED_P (f->desired_matrix, i)) write_row (f, i, updating_menu_p); - - /* Now just clean up termcap drivers and set cursor, etc. */ - if (set_cursor_p) - tty_set_cursor (f); } /* Do line insertions/deletions on frame F for frame-based redisplay. */ commit 7aacefba6bfe4c0e658f09d2ac7f025f9a9a827f Author: Gerd Möllmann Date: Wed Jan 29 08:34:43 2025 +0100 Replace two macros with functions in dispnew.c (bug#75056) * src/dispnew.c (WINDOW_TO_FRAME_VPOS, WINDOW_TO_FRAME_VPOS): Macros removed. (window_to_frame_vpos, window_to_frame_vpos): Always define, and use them instead of the removed macros. diff --git a/src/dispnew.c b/src/dispnew.c index 6571761b7a9..913b860df1e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -139,11 +139,6 @@ static int glyph_pool_count; #ifdef GLYPH_DEBUG -static int window_to_frame_vpos (struct window *, int); -static int window_to_frame_hpos (struct window *, int); -#define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos (W, VPOS) -#define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos (W, HPOS) - /* One element of the ring buffer containing redisplay history information. */ @@ -235,11 +230,6 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history, } -#else /* not GLYPH_DEBUG */ - -#define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + WINDOW_TOP_EDGE_LINE (W)) -#define WINDOW_TO_FRAME_HPOS(W, HPOS) ((HPOS) + WINDOW_LEFT_EDGE_COL (W)) - #endif /* GLYPH_DEBUG */ @@ -3167,8 +3157,6 @@ check_matrix_pointers (struct glyph_matrix *window_matrix, VPOS and HPOS translations **********************************************************************/ -#ifdef GLYPH_DEBUG - /* Translate vertical position VPOS which is relative to window W to a vertical position relative to W's frame. */ @@ -3195,9 +3183,6 @@ window_to_frame_hpos (struct window *w, int hpos) return hpos; } -#endif /* GLYPH_DEBUG */ - - /********************************************************************** Redrawing Frames @@ -3879,8 +3864,8 @@ abs_cursor_pos (struct frame *f, int *x, int *y) a new cursor position has been computed. */ && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) { - int wx = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); - int wy = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); + int wx = window_to_frame_hpos (w, w->cursor.hpos); + int wy = window_to_frame_vpos (w, w->cursor.vpos); wx += max (0, w->left_margin_cols); @@ -5664,8 +5649,8 @@ tty_set_cursor (struct frame *f) a new cursor position has been computed. */ && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) { - int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); - int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); + int x = window_to_frame_hpos (w, w->cursor.hpos); + int y = window_to_frame_vpos (w, w->cursor.vpos); x += max (0, w->left_margin_cols); cursor_to (f, y, x); commit 6cf479931d1adc03661116ef827f77fdc615db22 Author: Gerd Möllmann Date: Wed Jan 29 08:28:58 2025 +0100 Don't use selected frame in tty_set_cursor (bug#75056) * src/dispnew.c (tty_set_cursor): Add frmae parameter. (write_matrix): Pass to the updated frame to tty_set_cursor. diff --git a/src/dispnew.c b/src/dispnew.c index d1e731e69f8..6571761b7a9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5591,10 +5591,8 @@ scrolling_window (struct window *w, int tab_line_p) ************************************************************************/ static void -tty_set_cursor (void) +tty_set_cursor (struct frame *f) { - struct frame *f = SELECTED_FRAME (); - if ((cursor_in_echo_area /* If we are showing a message instead of the mini-buffer, show the cursor for the message instead of for the @@ -5656,7 +5654,7 @@ tty_set_cursor (void) else { /* We have only one cursor on terminal frames. Use it to - display the cursor of the selected window. */ + display the cursor of the selected window of the frame. */ struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); if (w->cursor.vpos >= 0 /* The cursor vpos may be temporarily out of bounds @@ -5709,7 +5707,7 @@ write_matrix (struct frame *f, bool inhibit_id_p, /* Now just clean up termcap drivers and set cursor, etc. */ if (set_cursor_p) - tty_set_cursor (); + tty_set_cursor (f); } /* Do line insertions/deletions on frame F for frame-based redisplay. */ commit b34c069d8250e9557d5ef5e7997a5a7e370c7ad2 Author: Alan Mackenzie Date: Wed Jan 29 18:35:31 2025 +0000 CC Mode: Don't propertize parens in macros incorrectly Parentheses in macros were getting incorrectly propertized with the '(1) (punctuation) syntax-table text property. This was due to a typo in the patch "CC Mode: Rationalize and optimize cache invalidation (1)" from 2024-10-06. Correct this. * lisp/progmodes/cc-mode.el (c-depropertize-CPP): Move the first c-clear-syntax-table-with-value-trim-caches invocation from inside the enclosing `when' form to after it. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 73964c2f4a4..77e853271a4 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1033,8 +1033,8 @@ Note that the style variables are always made local to the buffer." (setq m-beg (point)) (c-end-of-macro) (when c-ml-string-opener-re - (save-excursion (c-depropertize-ml-strings-in-region m-beg (point))) - (c-clear-syntax-table-with-value-trim-caches m-beg (point) '(1)))) + (save-excursion (c-depropertize-ml-strings-in-region m-beg (point)))) + (c-clear-syntax-table-with-value-trim-caches m-beg (point) '(1))) (while (and (< (point) end) (setq ss-found commit 6a92f674fe5123742b2c1bc890bab7b3743582c8 Author: Juri Linkov Date: Wed Jan 29 19:58:10 2025 +0200 Fix args in treesit-beginning-of-defun and treesit-end-of-defun * lisp/treesit.el (treesit-beginning-of-defun): Set arg to 1 when nil. (treesit-end-of-defun): Fix arg names in docstring. diff --git a/lisp/treesit.el b/lisp/treesit.el index 33fcd9e7207..76b6bdc9cb2 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2855,6 +2855,7 @@ not set, Emacs also looks for definition of defun in (let ((orig-point (point)) (success nil) (pred (or treesit-defun-type-regexp 'defun))) + (unless arg (setq arg 1)) (catch 'done (dotimes (_ 2) @@ -2874,8 +2875,8 @@ not set, Emacs also looks for definition of defun in (defun treesit-end-of-defun (&optional arg _) "Move forward to next end of defun. -With argument ARG, do it that many times. -Negative argument -N means move back to Nth preceding end of defun. +With argument ARG, do it that many times. Negative ARG means +move back to the ARGth preceding end of defun. This is a tree-sitter equivalent of `end-of-defun'. Behavior of this function depends on `treesit-defun-type-regexp' and commit 25c254aa417baa9a5f8fd987e3467bd7a5f0de5b Author: Basil L. Contovounesios Date: Wed Jan 29 14:15:44 2025 +0100 ; Remove duplicate defvar in comp-run.el. * lisp/emacs-lisp/comp-run.el (comp-async-compilations): Remove duplicate definition (bug#75925). diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el index 984b93100f3..061f1767b74 100644 --- a/lisp/emacs-lisp/comp-run.el +++ b/lisp/emacs-lisp/comp-run.el @@ -161,9 +161,6 @@ LOAD and SELECTOR work as described in `native--compile-async'." (defvar comp-files-queue () "List of Emacs Lisp files to be compiled.") -(defvar comp-async-compilations (make-hash-table :test #'equal) - "Hash table file-name -> async compilation process.") - (defun comp--async-runnings () "Return the number of async compilations currently running. This function has the side effect of cleaning-up finished commit cb62a47896bb21420a709c655034e8acfcb08082 Author: Eli Zaretskii Date: Wed Jan 29 17:55:58 2025 +0200 ; Fix Cygw32 build diff --git a/src/treesit.c b/src/treesit.c index d4090b949ea..3cbce612653 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -4569,7 +4569,7 @@ applies to LANGUAGE-A will be redirected to LANGUAGE-B instead. */); defsubr (&Streesit_subtree_stat); #endif /* HAVE_TREE_SITTER */ defsubr (&Streesit_available_p); -#ifdef WINDOWSNT +#ifdef HAVE_NTGUI DEFSYM (Qtree_sitter__library_abi, "tree-sitter--library-abi"); Fset (Qtree_sitter__library_abi, #if HAVE_TREE_SITTER commit 142fe5ace4e5d4ed667505f73fc95757a764d530 Author: João Távora Date: Wed Jan 29 08:37:37 2025 +0000 Eglot: don't auto-shutdown when reverting of single managed buffer When eglot-autoshutdown is t and the only reason we're considering it is because of a revert (which tears down Eglot's minor mode as if by killing), detect that situation and purposedly cancel the shutdown. * lisp/progmodes/eglot.el (eglot--managed-mode): Tweak. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index e7b50d25bb5..c2a8562eb97 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2144,7 +2144,9 @@ Use `eglot-managed-p' to determine if current buffer is managed.") (setf (eglot--managed-buffers server) (delq (current-buffer) (eglot--managed-buffers server))) (when (and eglot-autoshutdown - (null (eglot--managed-buffers server))) + (null (eglot--managed-buffers server)) + ;; Don't shutdown if up again soon. + (not revert-buffer-in-progress-p)) (eglot-shutdown server))))))) (defun eglot--managed-mode-off () commit e2ff77052da91e662bbd3cb19a742604db742d32 Author: João Távora Date: Wed Jan 29 08:33:54 2025 +0000 Eglot: in eglot-code-action-indications, make 'margin' interactive Didn't know it was possible, thanks to Ergus for the tip about binding [left-margin mouse-2] in the keymap. The technique adopted in 'eglot-mouse-call' possibly still doesn't work very well if the margin thing we're clicking on is not on the line point is currently on. But we don't have that problem (yet?) because LSP action suggestions function mostly on a "at point" basis. * lisp/progmodes/eglot.el (eglot-code-action-indications): Adjust docstring. (eglot--mouse-call): Don't go anywhere except in text area. (eglot-diagnostics-map): Bind eglot-mouse-actions to left-margin. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 48b1d785d8e..e7b50d25bb5 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -595,7 +595,6 @@ Note additionally: - `margin' and `nearby' are incompatible. If both are specified, the latter takes priority; -- `margin's indicator is not interactive; - `mode-line' only works if `eglot-mode-line-action-suggestion' exists in `eglot-mode-line-format' (which see)." :type '(set @@ -2214,8 +2213,8 @@ If it is activated, also signal textDocument/didOpen." (interactive "e") (let ((start (event-start event))) (with-selected-window (posn-window start) (save-excursion - (goto-char (or (posn-point start) - (point))) + (unless (posn-area start) + (goto-char (posn-point start))) (call-interactively what) (when update-mode-line (force-mode-line-update t))))))) @@ -2459,6 +2458,7 @@ still unanswered LSP requests to the server\n")))) (defvar eglot-diagnostics-map (let ((map (make-sparse-keymap))) (define-key map [mouse-2] #'eglot-code-actions-at-mouse) + (define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse) map) "Keymap active in Eglot-backed Flymake diagnostic overlays.")