Dmitry Gutov [Sat, 4 Mar 2023 00:37:14 +0000 (02:37 +0200)]
Redirect eldoc messages to the mode-line when in edebug-mode
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message): Redirect
eldoc messages to the mode-line when in edebug-mode (bug#56459).
(eldoc-minibuffer--cleanup): New function, used in above.
* lisp/gnus/message.el (message-setup-1):
* lisp/progmodes/cc-engine.el (c-forward-single-comment):
* lisp/progmodes/ruby-mode.el (ruby-add-log-current-method):
Eliminate uses of condition-case without handlers. These seem to have
been there for quite a long time. This change does not affect the
behaviour of the code and makes some warnings go away.
Stefan Kangas [Fri, 3 Mar 2023 05:30:12 +0000 (06:30 +0100)]
Merge from origin/emacs-29
9e105d483fa Fix c-ts-mode indentation for statement after preproc (bu... a72a55e3e49 Fix c/c++-ts-mode's mode lighter 67befc1f5a5 Eglot: use shell-file-name in eglot--cmd (bug#61748) 1c7b2673bdd Avoid signaling errors in url-basic-auth when password is... 756225e3778 Fix wdired-tests on MS-Windows a137f71c67e Improvements to xwidget on macOS (bug#60703) 3f43a16bc63 ; Avoid byte-compilation warning in c-ts-mode.el
Yuan Fu [Fri, 3 Mar 2023 03:59:11 +0000 (19:59 -0800)]
Fix c-ts-mode indentation for statement after preproc (bug#61893)
Originally our c-ts-mode--anchor-prev-sibling only specially handled
labeled_statements, now we add special case for preproc in the similar
fasion: instead of using the preproc directive as anchor, use the last
statement in that preproc as the anchor. Thus effectively ignore the
preproc.
There should be an accompanying test, but there are some problem in
the elif preproc directive indent so it would pass, we'll add the test
when that is fixed.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--anchor-prev-sibling): Add special case for preproc
directives.
where S1...Sn are switch clauses (that can be compiled into a switch
op) and C a non-switch clause, by tucking on an extra copy of C at the
end. This was a serious wrong-code bug when the condition of C had
side-effects; otherwise it was only a waste of time and space.
* lisp/emacs-lisp/bytecomp.el (byte-compile-cond): Fix.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Use the current for-effect mode when optimising the body form,
instead of always optimising it for value.
Eli Zaretskii [Thu, 2 Mar 2023 12:21:33 +0000 (14:21 +0200)]
Fix wdired-tests on MS-Windows
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-bug32173-02, wdired-test-unfinished-edit-01)
(wdired-test-bug39280): Run test-dir through file-truename, to
avoid failures due to MS-Windows "numeric tails" (mis)feature and
similar issues, which make file names fail to compare 'equal'.
(wdired-test-bug34915, wdired-test-bug61510): Skip if symlinks
fail.
* lisp/man.el (Man-getpage-in-background): Add new defcustom
Man-prefer-synchronous-call and modify #'Man-getpage-in-background.
Only call #'start-process when 'make-process satisfies #'fboundp AND
Man-prefer-synchronous-call is bound to nil. (Bug#61552)
* src/nsxwidget.m ()
([XwWebView initWithFrame:configuration:xwidget:])
(nsxwidget_init): Fixed memory leaks: when sending an alloc
message to an object, send an autorelease message to any objects
we won't explictly release.
([XwWebView webView:didFinishNavigation:]): Second string to
store in 'store_xwidget_event_string' is "load finished" rather
than empty string.
([XwWebView webView:didStartProvisionalNavigation:])
([XwWebView webView:didReceiveServerRedirectForProvisionalNavigation:])
([XwWebView webView:didCommitNavigation:]): New functions.
(nsxwidget_webkit_estimated_load_progress): New function.
(nsxwidget_webkit_stop_loading): New function.
* src/xwidget.c (Fxwidget_webkit_estimated_load_progress): Call
'nsxwidget_webkit_estimated_load_progress' if we're on MacOS.
(Fxwidget_webkit_stop_loading): Call 'nsxwidget_webkit_stop_loading'
if we're on MacOS.
(syms_of_xwidget): Define symbol for function.
'xwidget_webkit_estimated_load_progress' if we're on MacOS.
* src/nsxwidget.h: Signature for functions
'nsxwidget_webkit_estimated_load_progress' and
'nsxwidget_webkit_stop_loading'.
* lisp/xwidget.el (xwidget-webkit-current-url): Message URL rather
than return value of 'kill-new' (which is always nil).
Philippe Altherr [Sun, 15 Jan 2023 12:37:00 +0000 (13:37 +0100)]
Add support for Zsh's case branches ;|.
* lisp/progmodes/sh-script.el (sh-font-lock-paren)
(sh-smie-sh-grammar, sh-smie-sh-rules, sh-smie-rc-grammar):
Support case branches ending with ";|", per Zsh. (Bug#60833)
Stefan Kangas [Thu, 2 Mar 2023 05:30:15 +0000 (06:30 +0100)]
Merge from origin/emacs-29
07f3236133b * src/profiler.c (malloc_probe): Make it safe for GC (bug... 1f1d36fa808 * lisp/emacs-lisp/debug-early.el (debug-early-backtrace):... 99df815c153 Revert "Don't disable eldoc when doing edebug" 0a4b1c0102d ; Eglot: improve bug-reference-url-format/bug-reference-u... 40c9fc8e3b3 Eglot: work around Tramp instability bug#61350 4a6db125b9e Fix treesit-indent-region 7ef9a8210c9 Replace C++ comments with C style equivalents
Yuan Fu [Wed, 1 Mar 2023 22:34:56 +0000 (14:34 -0800)]
Don’t signal warning when loading go-ts-mode.el without grammar
* lisp/progmodes/go-ts-mode.el: Add a QUIET flag to the call of
treesit-ready-p, so that it doesn't signal a warning if
go-mod (tree-sitter grammar) is not available.
Yuan Fu [Wed, 1 Mar 2023 22:01:47 +0000 (14:01 -0800)]
Fix c-ts-mode empty line indentation (bug#61893)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Make the
"rest sibling" matchers catch the case where NODE is nil, when
indenting an empty line.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
Yuan Fu [Wed, 1 Mar 2023 21:55:53 +0000 (13:55 -0800)]
Improve tree-sitter's prev-sibling indent anchor
Now it handles the case where NODE is nil when indenting an empty
line: it tries to get the previous sibling nonetheless.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling):
* lisp/treesit.el (treesit-simple-indent-presets): Add an or form to
handle more cases.
Juri Linkov [Mon, 27 Feb 2023 18:32:53 +0000 (20:32 +0200)]
* lisp/icomplete.el: Fix in-buffer completion.
(icomplete-force-complete-and-exit, icomplete-force-complete): Use
'icomplete--field-beg/end' when not in the minibuffer to not erase
the current buffer. Also disable 'completion-in-region-mode' instead
of calling 'exit-minibuffer' (bug#45764, bug#51575, bug#61479).
The `noerror` arg of `require` doesn't do what Stefan naively thought
when he wrote this code, so use `condition-case` instead.
Also check for `cl-defmethod` since `cl-prin1` can't be loaded before
that anyway.
Eli Zaretskii [Wed, 1 Mar 2023 15:35:51 +0000 (17:35 +0200)]
Revert "Don't disable eldoc when doing edebug"
This reverts commit 6fd1fb8a6837acde8e1c9ab26618ec0f36121c72.
It turns out ElDoc does show messages inside Edebug, if you
are (un)lucky enough to have point where ElDoc has something
to show. Bug#56459 needs to be fixed in some more complex
way.
Yuan Fu [Wed, 1 Mar 2023 07:51:06 +0000 (23:51 -0800)]
Fix treesit-indent-region
Fix it for the case where there is no suitable rule for the line.
Right now treesit-indent-region would indent the line to column 0.
After the change the indentation is not altered.
* lisp/treesit.el (treesit-indent-region): Handle the case where
ANCHOR or OFFSET is nil specially.
Stefan Kangas [Wed, 1 Mar 2023 05:30:20 +0000 (06:30 +0100)]
Merge from origin/emacs-29
97a83ff31fa Eglot: fix M-x eglot-show-workspace-configuration (bug#61... 48a0804d10d ruby-mode: Fix method call indentation in rhs of multiple... 16d012cf3bd * lisp/net/tramp.el (tramp-remote-path): Improve docstring. b371697cdca Minor change in 'dired--find-possibly-alternative-file' c2b5c6acc58 Implement prefix arg for 'c-ts-mode-toggle-comment-style' eb2ab52fb01 Defaults to zero for image-dired--number-of-thumbnails 5dc163f592a ; Add a doc string for 'ediff-window-display-p' obsolescence
Now consult .dir-locals.el every time the workspace configuration is
needed:
- workspace/configuration server request
- workspace/didChangeConfiguration signal
- M-x eglot-show-workspace-configuration
The major-mode/hack-dir-local-variables-non-file-buffer trick is used.
When there is more than one, the server connection's "main" major mode
is used to find the relevant .dir-locals.el section.
Eli Zaretskii [Tue, 28 Feb 2023 13:15:27 +0000 (15:15 +0200)]
; Add a doc string for 'ediff-window-display-p' obsolescence
* lisp/vc/ediff-init.el (ediff-window-display-p): Document how to
prevent Ediff from creating additional frames, now that this
function can no longer be used or advised for that. (Bug#61850)
Stefan Kangas [Tue, 28 Feb 2023 05:30:13 +0000 (06:30 +0100)]
Merge from origin/emacs-29
613de662811 Rename the newly added -ref- faces to -use- f601e9666d8 Eglot: support multiple labels in same inlay hint 4a5eda7ed2a Eglot: don't paint hints outside requested region (bug#61... 11c1aa1eb12 ; * doc/misc/gnus.texi: Fix last change. 44949c292f9 ; Add `nnimap-user' to Gnus manual 6c7078c66f4 ; * lisp/progmodes/c-ts-mode.el (treesit-node-prev-siblin... 3d0a6c9baa6 Eglot: protect against unintended field text motion (bug#... 647e40f4a0c ; And yet another fix to eglot-current-linepos-function's... 9d0f856a167 Fix description of 'desktop-save-mode' aee10ca1cbe Adjust tree-sitter defun navigation (bug#61617) edf5b976869 Simplify c-ts-mode--top-level-label-matcher 0f15286c539 New tree-sitter indent anchor standalone-parent used by c...
Dmitry Gutov [Tue, 28 Feb 2023 02:07:55 +0000 (04:07 +0200)]
Rename the newly added -ref- faces to -use-
* lisp/font-lock.el (font-lock-variable-use-face)
(font-lock-property-use-face): Rename from font-lock-variable-ref-face
and font-lock-property-ref-face. Update all references (bug#61655).
Augusto Stoffel [Wed, 7 Dec 2022 17:44:07 +0000 (18:44 +0100)]
New user option 'grep-use-headings'
* lisp/progmodes/grep.el (grep-heading-regexp): New user option.
(grep-heading): New face (bug#59888).
(grep--heading-format, grep--heading-state, grep--heading-filter):
Filter function for grep processes and supporting variables.
(grep-use-headings): New user option.
(grep-mode): Use the above, if applicable.
Augusto Stoffel [Thu, 8 Dec 2022 20:05:10 +0000 (21:05 +0100)]
Introduce 'compilation-annotation' text property
It is meant to mark parts of compilation buffers which do not
correspond to process output (bug#59888).
* lisp/progmodes/compile.el (compilation-insert-annotation): New
function.
(compilation-start, compilation-handle-exit): Use it.
(compilation--ensure-parse) Rely on 'compilation-annotation' property
instead of 'compilation-header-end'.
Juri Linkov [Mon, 27 Feb 2023 18:32:53 +0000 (20:32 +0200)]
* lisp/icomplete.el: Fix in-buffer completion.
(icomplete-force-complete-and-exit, icomplete-force-complete): Use
'icomplete--field-beg/end' when not in the minibuffer to not erase
the current buffer. Also disable 'completion-in-region-mode' instead
of calling 'exit-minibuffer' (bug#45764, bug#51575, bug#61479).
Adjust some `pure` and `side-effect-free` function declarations
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns):
Add `format-message` and `substring-no-properties`.
* lisp/subr.el (number-sequence, copy-tree, looking-at-p)
(string-match-p, string-trim-right, string-lines):
Declare side-effect-free.
(syntax-class, version-list-<, version-list-=, version-list-<=)
(version-list-not-zero): Declare pure and side-effect-free.
(ensure-list): Declare side-effect-free and error-free.
(string-equal-ignore-case): Remove `pure` declaration.
We may want it to be pure but right now it's not.
Arash Esbati [Mon, 27 Feb 2023 09:10:13 +0000 (10:10 +0100)]
; Add `nnimap-user' to Gnus manual
* doc/misc/gnus.texi (Customizing the IMAP Connection): Document
backend variable `nnimap-user' which was introduced with commit 5e68f8614f in 2011.
Add index entries for all backend variables. (bug#61837)
João Távora [Mon, 27 Feb 2023 11:29:32 +0000 (11:29 +0000)]
Eglot: protect against unintended field text motion (bug#61726)
Suggested-by: Augusto Stoffel <arstoffel@gmail.com>
* lisp/progmodes/eglot.el (eglot--bol): New helper.
(eglot-utf-8-linepos, eglot-utf-16-linepos)
(eglot-utf-32-linepos, eglot-move-to-utf-8-linepos)
(eglot-move-to-utf-16-linepos, eglot-move-to-utf-32-linepos)
(eglot-handle-notification, eglot--xref-make-match)
(eglot-completion-at-point): Use it.
Improve delete-consecutive-dups doc precision and add test
* lisp/subr.el (delete-consecutive-dups): Document which element of
each run is retained (the earliest in the list). This matters because
it makes it safe to ignore the return value.
* test/lisp/subr-tests.el (subr--delete-dups)
(subr--delete-consecutive-dups): Add tests.
Yuan Fu [Mon, 27 Feb 2023 08:14:32 +0000 (00:14 -0800)]
Adjust tree-sitter defun navigation (bug#61617)
Before this change, when you use a tree-sitter navigation function to
move to the next beginning of a thing, it jumps over the immediate
next thing and lands you at the beginning of the next-next thing.
Eg, when point is at the "|", and we evaluate
(treesit--navigate-thing pos 1 'beg), we go from
| (thing) (thing)
to
(thing) |(thing)
But some might expect point to go to
|(thing) (thing)
instead, which makes sense. Also, that's how Emacs expect defun
navigation functions to work. The discrepancy in expectation causes
bug#61617.
In this change I made tree-sitter navigation functions to work as what
Emacs expects. And what I described for moving to the next beginning
of thing is similarly applicable to moving to the end of previous end
of thing.
* lisp/treesit.el (treesit-beginning-of-defun)
(treesit-end-of-defun): Handle the case where defun-skipper moves
point back to where we started, by adding a retry.
(treesit--navigate-thing): Add a single condition checking for
progress to the condition form responsible for checking whether to
skip the next defun. Namely (eq pos (funcall advance next)))).
* test/src/treesit-tests.el:
(treesit--ert-defun-navigation-nested-master)
(treesit--ert-defun-navigation-top-level-master): Change tests to
reflect the new expectation.
Yuan Fu [Mon, 27 Feb 2023 02:05:13 +0000 (18:05 -0800)]
New tree-sitter indent anchor standalone-parent used by c-ts-mode
When writing c-ts-mode Theo used parent-bol which works well except
one case:
1 for (int i=0;
2 i < 5;
3 i++) {
4 func(i);
5 }
In this case, when indenting "func(i)", parent-bol returns the start
of "i++" on line 3, instead of the "correct" anchor, the start of
"for" on line 1. parent-bol would have worked if the "for (...) {"
part is in one line.
To support this case I tried numerous things and added a bunch of
stuff, culminating in c-ts-common-statement-offset. It's complicated,
requires extra setup, and slow.
Not anymore! I think the new anchor standalone-parent really captures
the logic behind how people expect indentation to work. It's simple
and fast, and requires no setup.
Eli Zaretskii [Sun, 26 Feb 2023 17:51:59 +0000 (19:51 +0200)]
; Improve documentation of loading *.eln files
* doc/lispref/loading.texi (How Programs Do Loading):
* doc/emacs/building.texi (Lisp Libraries): Some additional
details about what happens with natively-compiled files.
Augusto Stoffel [Sun, 26 Feb 2023 11:47:32 +0000 (11:47 +0000)]
Eglot: support positionEncoding LSP capability (bug#61726)
* lisp/progmodes/eglot.el(eglot-client-capabilities): Announce the
new capability.
(eglot-bytewise-column, eglot-move-to-bytewise-column): New functions.
(eglot--managed-mode): Set 'eglot-current-column-function' and
'eglot-move-to-bytewise-column' appropriately.
Jim Porter [Sat, 25 Feb 2023 05:49:54 +0000 (21:49 -0800)]
Be more cautious in completing Eshell variable assignments
Previously, Eshell treated cases like the second argument in "tar
--directory=dir" as a variable assignment, but that prevented
'pcomplete/tar' from implementing its own completion for that
argument (bug#61778).
* lisp/eshell/esh-var.el (eshell-complete-variable-assignment): Only
handle completion when all initial arguments are variable assignments.
* test/lisp/eshell/em-cmpl-tests.el
(em-cmpl-test/variable-assign-completion/non-assignment): New test.