Stefan Monnier [Fri, 10 Mar 2023 20:05:55 +0000 (15:05 -0500)]
src/profiler.c: Try and fix occasional assertion failures
Apparently the (>= match imatch) test fails sometimes in `profiler.el`.
Not sure where this comes from, but this patch should remove one
possible source.
* src/profiler.c (Fprofiler_cpu_log, Fprofiler_memory_log):
Change the special Automatic_GC backtrace to make it clear that it's
a *sibling* of the call tree (i.e. it's at the (its own) root).
(malloc_probe): Obey `size` when incrementing the gc_counter.
Eli Zaretskii [Fri, 10 Mar 2023 19:54:52 +0000 (14:54 -0500)]
src/profiler.c: Keep track of allocations during GC
Cargo-cult the `cpu_gc_count` code to `memory_gc_count`.
* src/profiler.c (mem_gc_count): New var.
(Fprofiler_memory_start): Initialize it.
(Fprofiler_memory_log): Increment it.
(Fprofiler_memory_log): Use it.
Robert Pluim [Wed, 15 Feb 2023 11:16:11 +0000 (12:16 +0100)]
Improve thing-at-point email detection
* lisp/thingatpt.el (thing-at-point-email-regexp): Allow numbers at
the start of the user portion, and disallow '.' at the start. Also
disallow '.' at the start of the domain portion.
* test/lisp/thingatpt-tests.el (thing-at-point-test-data): Add various
email tests.
Stefan Monnier [Thu, 9 Mar 2023 21:19:16 +0000 (16:19 -0500)]
gud.el: Bring back the pseudo-tool-bar in text frames (bug#62041)
commit 8bb5c1bfec0929f2ba419e1c503f5acc01c336c2 accidentally
threw away the pseudo-tool-bar implemented in the text frames'
menu-bar of gud-minor-mode buffers.
Bring it back, and while we're at it, improve it so it also works
right when you have both text and GUI frames.
Also fix a misunderstanding in last change (`gud-mode-map` does need
to have a Gud menu, because `gud-mode` buffers already have it by
virtue of being in `gud-minor-mode` as well).
* lisp/progmodes/gud.el (gud-text-menu-bar-map): New keymap.
(gud-menu-mode-map): Rename from `gud-shared-mode-map`.
(gud-menu-map): Adjust accordingly.
(gud-minor-mode-map): Use them.
(gud-mode-map): Don't inherit from the shared/menu keymap.
Stefan Kangas [Thu, 9 Mar 2023 05:30:23 +0000 (06:30 +0100)]
Merge from origin/emacs-29
7e1012765c4 Fix libwebp check for some webp installations c2ca009da4c Avoid potential infloop 34c14430e9d Don't misindent 'else:' after 'if re.match:' in Python 8a2a554192a * Make sure `default-directory' exists before spawning pr... 1862e7eb7ef Fix sed expression in install-etc make target c8ec0017cb9 Avoid using bash in the emacsclient desktop file a588937094f Fix documentation of the 'line-height' text property 971ded31c4f Add 'declare' specs to with- and without-restriction
Jim Porter [Fri, 10 Feb 2023 07:27:50 +0000 (23:27 -0800)]
Fix Pcompletion of "tar" when using unrecognized arguments
Previously, arguments to tar like "--warning=no-timestamp" would cause
Pcompletion to hang (bug#58921).
This simplifies the logic flow by moving all the cases for "--"
arguments inside the THEN form of '(if (pcomplete-match "^--" 0)', and
for all "-" arguments inside the ELSE form.
* lisp/pcmpl-gnu.el (pcmpl-gnu--tar-long-options): New variable.
(pcomplete/tar): Properly handle completion of arguments that look
like "--ARG=", even if they're not recognized by this function.
Stefan Monnier [Wed, 8 Mar 2023 20:08:00 +0000 (15:08 -0500)]
gud.el: Fix bug#62041
Add a new `gud-shared-mode-map` where we put the bindings
shared between `gud-minor-mode-map` and `gud-mode-map`.
* lisp/progmodes/gud.el (gud-shared-mode-map): New keymap.
(gud-mode-map, gud-minor-mode-map): Use it as parent.
(gud-menu-map): Put the menu in that new keymap.
(gud-speedbar-buttons, gdb-script-font-lock-syntactic-face)
(gdb-script-indent-line): Skip obsolete face variables.
Yuan Fu [Wed, 8 Mar 2023 00:35:23 +0000 (16:35 -0800)]
Fix empty line indentation in c-ts-mode (bug#61997)
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Handle the empty line case.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-simple-indent-presets): Support null as
a value for NODE-TYPE in the 'match' matcher.
Ulrich Müller [Tue, 7 Mar 2023 17:25:37 +0000 (18:25 +0100)]
Fix Elisp code injection vulnerability in emacsclient-mail.desktop
A crafted mailto URI could contain unescaped double-quote
characters, allowing injection of Elisp code. Therefore, any
'\' and '"' characters are replaced by '\\' and '\"', using Bash
pattern substitution (which is not available in the POSIX shell).
We want to pass literal 'u=${1//\\/\\\\}; u=${u//\"/\\\"};' in the
bash -c command, but in the desktop entry '"', '$', and '\' must
be escaped as '\\"', '\\$', and '\\\\', respectively (backslashes
are expanded twice, see the Desktop Entry Specification).
Reported by Gabriel Corona <gabriel.corona@free.fr>.
* etc/emacsclient-mail.desktop (Exec): Escape backslash and
double-quote characters.
Eli Zaretskii [Tue, 7 Mar 2023 12:39:27 +0000 (14:39 +0200)]
Fix problem with debuginfod queries in "M-x gdb"
* lisp/progmodes/gdb-mi.el (gdb-debuginfod-enable-setting): New
defcustom.
(gdb-debuginfod-message): New function.
(gdb-init-1): Initialize gdb-debuginfod-enable. Ask the user
about debuginfod queries and display any error messages.
(Bug#61973)
Alan Mackenzie [Tue, 7 Mar 2023 08:00:25 +0000 (08:00 +0000)]
eval-and-compile: Strip symbol positions for eval but not for compile.
This fixes bug #61962.
* lisp/subr.el (safe-copy-tree): New function.
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): Amend
the entry for eval-and-compile to use safe-copy-tree and
byte-run-strip-symbol-positions for the eval part.
João Távora [Mon, 6 Mar 2023 22:28:47 +0000 (22:28 +0000)]
Fix regression in Fido mode (bug#62015)
To understand the regression consider this recipe where the 'fo'
pattern is typed by the user in the last step.
emacs -Q
C-x b foo RET
C-x b afoo RET
C-x b *scratch* RET
M-x fido-mode RET
C-x b fo
This used to offer both 'foo' and 'afoo' as candidates but now only
offered 'foo'. This is because the pattern 'fo' matches 'foo', but
not 'afoo' with 'basic' completion style.
Fido mode, however, prioritizes 'flex' completion style, and that is
not happening here as it used to.
Don't override completion-category-defaults in fido-mode
I took away the nil setting of 'completion-category-defaults; in Fido
mode's minibuffer. It seemed generally the correct thing to do, and
was done mainly because Eglot added its style preferences to that
variable instead of completion-category-overrides directly, which is a
nono. So, to be able use the Fido UI with Eglot successfully,
'completion-category-defaults' should stay untouched. Or so I
thought.
However, I failed to notice that, for most categories, the default
value of 'completion-category-defaults' prioritizes the 'basic'
completion style.
For example, in the 'buffer' category, the default value has the
styles list '(basic substring)'. This means that if a pattern matches
accoring to the 'basic' style, 'substring' will not be tried. And
neither will 'completion-styles' which in Fido mode's case happens to
be 'flex'.
The solution in this commit is to craft a value for completion
category defaults that is just like the default one, but prioritizes
'flex' completion for every category.
* lisp/icomplete.el (icomplete--fido-ccd): New helper.
(icomplete--fido-mode-setup): Use it.
Eli Zaretskii [Mon, 6 Mar 2023 15:31:57 +0000 (17:31 +0200)]
Revert "Fix configuration of webp libraries"
This reverts commit de4277af009115ceba7fe920163c05c608ea9524.
It breaks WebP support at least on my system.
There's no reason to require libwebpdecoder library to be
installed, since we don't use the functions from it, at least
not in libwebp 1.2.1.
* lisp/emacs-lisp/cconv.el (cconv-convert): When form is an
interactive lambda form, don't destructively modify it, as it might be
a constant literal. Instead, create a new list with the relevant
place(s) changed.
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-form-modify-bug60974): New test.
* lisp/net/tramp-sh.el (tramp-use-ssh-controlmaster-options):
Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Yuan Fu [Sun, 5 Mar 2023 23:22:36 +0000 (15:22 -0800)]
Fix c-ts-mode indentation
Mentioned in bug#61893.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Handle
"#elif" and "#else".
* test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: Add an
"#elif" to the test.
Yuan Fu [Sun, 5 Mar 2023 23:07:58 +0000 (15:07 -0800)]
Fix c-ts-mode indentation
Mentioned in bug#61893, although not the subject of it.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--anchor-prev-sibling): Fix the child index for preproc_else
and preproc_elif case.
* test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts:
New test.
Yuan Fu [Sun, 5 Mar 2023 23:01:54 +0000 (15:01 -0800)]
Fix c-ts-mode indentation
Not the subject of it, but mentioned in bug#61893.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Skip
the sibling if it doesn't start on it's own line.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
Stefan Kangas [Sun, 5 Mar 2023 05:30:15 +0000 (06:30 +0100)]
Merge from origin/emacs-29
836044f329a Fix c-ts-mode preproc directive indentation 64980a59b65 ; * lisp/files.el (hack-local-variables): Fix typo in the... a7cd125d490 More robustly unspoof HOME in Eglot tests (bug#61637) 6c66dbd02c7 Turn on Eglot inlay hints by default 246f5b541c5 Update ts modes missed in 4c16fd3a512 to use column-0 0bfba49ca7c Robustify Eglot for "transient" projects ea5fd375bb2 Fix documentation of 'normal-mode' in buffers that don't ... 4c16fd3a512 Change tree-sitter indent anchor 'point-min' to 'column-0' f47b3930158 Fix go-ts-mode multi-line string indentation (bug#61923) e0bf2da3db6 ; More accurate doc strings for 'window-at' and 'window-a...
Yuan Fu [Sat, 4 Mar 2023 22:39:44 +0000 (14:39 -0800)]
Fix c-ts-mode preproc directive indentation
Mentioned in bug#61893, although not the subject of that report. This
change fixes indentation for nested directives. For example, when the
directive involves elif and the like, the elif is nested in the if
directive, so simply using grand-parent and great-grand-parent for
anchor is insufficient, because the nesting can grow arbitrarily.
The test added also covers the last preproc fix.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--standalone-parent-skip-preproc): New function.
(c-ts-mode--indent-styles): New rules.
* test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts: New test.
João Távora [Sat, 4 Mar 2023 19:14:48 +0000 (19:14 +0000)]
More robustly unspoof HOME in Eglot tests (bug#61637)
A fair number of LSP servers allow user-local installations instead of
system wide installations. Emacs's technique of spoofing the HOME env
var to some non-existent or non-home directory during 'make check'
breaks these tests. That's because the executables are still found by
executable-find, but their invocation will rarely be successful as
HOME isn't what they expect it to be.
Eglot tests already had a technique for dealing with this,
"unspoffing" HOME just for the invocations of LSP server but it
stopped working a while back. So make it more robust.
Eventually, we'll want to decide wether these local servers should be
considered in 'make check' runs at all, or whether there is a way to
use them with a spoofed HOME.
* test/lisp/progmodes/eglot-tests.el (eglot--call-with-fixture):
More robustly unspoof HOME.
* lisp/progmodes/eglot.el (eglot--maybe-activate-editing-mode):
Activate eglot-inlay-hints-mode.
(eglot-inlay-hints-mode): Instead of warning about missing
:inlayHintProvider, turn off eglot-inlay-hints-mode.
João Távora [Sat, 4 Mar 2023 12:49:00 +0000 (12:49 +0000)]
Robustify Eglot for "transient" projects
When Eglot needs to synthesize a "transient" project for
default-directory sometimes the value of that variable is set to an
unexpanded value, sometimes not. This can cause simple invocations
like.
Emacs -Q ~/path/to-some-python-file.py -f eglot
to fail, because eglot--current-server will be looking for a project
in the registry called
(transient . "~/path")
where in reality it is stored there as
(transient . "/home/someuser/path")
The fix is to always expand default-directory in eglot--current-project.
* lisp/progmodes/eglot.el (eglot--current-project): Use
expand-file-name.
bug#61489: Increase BLOCK_ALIGN from 1024 to 32768
Originally discovered by Tyler Dodge in his article "Significant Garbage
Collection Improvement For Emacs".
While testing this change on Archlinux system with Intel i5-7200U CPU,
average time of garbage collection gets reduced by ≈25%. Other users
report improvements up to 50%. While monitoring PSS of emacs with and
without customizations loaded before and after the patch, no
statistically significant differences were discovered. So overall, this
change is a win.
* src/alloc.c (BLOCK_ALIGN): increase from 1024 to 32768.
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.
João Távora [Sat, 4 Mar 2023 00:09:32 +0000 (00:09 +0000)]
Remove Eglot activation check from find-file-hook
Adding eglot--maybe-activate-editing-mode to find-file-hook isn't
really necessary, since it is already in
'after-change-major-mode-hook', and that also runs every time we find
a file.
This reduces the number of project.el logic that runs every time the
user visits a file.
* lisp/progmodes/eglot.el (find-file-hook): No need to add
eglot--maybe-activate-editing-mode here.
When `total_length` is 0 there should be no subtree at all, but
`delete_interval` only deletes one interval, so make sure we don't end
up with some stale child of `i`.
F. Jason Park [Tue, 14 Feb 2023 07:27:50 +0000 (23:27 -0800)]
Release ERC 5.5
* doc/misc/erc.texi: Update ERCVER to 5.5.
* lisp/erc/erc.el: Increment main version header to 5.5. Update
Compat version in package-requires header to 29.1.3.4. Update
`customize-package-emacs-version-alist' entry by mapping ERC 5.5 to
Emacs 29.1.
(erc-version): Update value to 5.5.
Jim Porter [Tue, 28 Feb 2023 19:35:21 +0000 (11:35 -0800)]
Don't create GUI frames in batch sessions
This resolves an issue with running test/lisp/server-tests.el when
'DISPLAY' is set: the tests would start the Emacs server in a batch
session, and then request a new GUI frame. However, that caused the
tests to terminate with SIGIO, since a batch Emacs doesn't set a SIGIO
handler.
* 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.