Arash Esbati [Wed, 5 Jun 2024 19:37:43 +0000 (21:37 +0200)]
Fix names of TeX-related major-modes
* lisp/ffap.el (ffap-alist, ffap-string-at-point-mode-alist): Add
entries for mode names introduced in AUCTeX v14. Use
`plain-tex-mode' for built-in mode. (bug#71376)
Juri Linkov [Fri, 7 Jun 2024 06:45:05 +0000 (09:45 +0300)]
* lisp/buff-menu.el: Mark all entries in outline.
(Buffer-menu-mark, Buffer-menu-unmark, Buffer-menu-delete)
(Buffer-menu-save): Mark all entries in the outline
when `outline-minor-mode' is enabled and point is
on the outline heading line (bug#70150).
(Buffer-menu-backup-unmark): Support outline heading lines.
João Távora [Thu, 6 Jun 2024 22:08:28 +0000 (17:08 -0500)]
Eglot: better fix for bug#70724
If the project's root is or destroyed , this may happen for a
variety of reasons, including reasons affecting non-reconnection
scenarios, so better to check in eglot--connect.
An Eglot "reconnection" has always created as accurate a copy of
the previous server object as possible, down to the 'eq'ness or
the saved initargs, language ids, etc. So re-querying for
projects is not the thing to do here.
A new different server can be created with `M-x eglot` which will
ask about shutting down the existing one.
* lisp/progmodes/eglot.el (eglot-reconnect): Revert previous change.
(eglot--connect): Do sanity check here
Kyle Meyer [Wed, 29 May 2024 04:05:46 +0000 (00:05 -0400)]
Enable code block evaluation when generating .org manuals
* doc/misc/Makefile.in ($(1:.org=.texi)): Enable code
block evaluation in Org mode manual and other .org manuals
to produce automatically generated parts. (Bug#71394)
When testing a scratch sync to the Emacs repo, the build
failed with
make[3]: Leaving directory '/home/kyle/src/savannah/emacs--master/lisp'
Evaluate this emacs-lisp code block on your system? (yes or no)
Error: end-of-file ("Error reading from stdin")
yes-or-no-p("Evaluate this emacs-lisp code block on your system? ")
That's expected given 715148131 (org-manual: Automatically
generate export option list, 2023-07-31) and the default
org-confirm-babel-evaluate value.
Javier Olaechea [Mon, 1 Apr 2024 04:07:10 +0000 (23:07 -0500)]
Add 'sqlite-execute-batch' command
This command is similar to 'sqlite-execute' except that it
executes multiple statements in exchange for not accepting
any arguments. (Bug#70145)
* src/sqlite.c (Fsqlite_execute_batch): New function.
* test/src/sqlite-tests.el (sqlite-multiple-statements): Add
smoke test for 'sqlite-execute-batch'.
* etc/NEWS: Mention new command 'sqlite-execute-batch'.
* doc/lispref/text.texi (Database): Document the new command.
F. Jason Park [Tue, 4 Jun 2024 17:42:35 +0000 (10:42 -0700)]
Select correct frame after enabling erc-nickbar-mode
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure): Re-select frame
originally selected when earlier calling `speedbar-frame-mode'. Do
this because `speedbar-frame' may become the new selected frame when
multiple visible frames exist.
(erc-nickbar-disable): Don't expect the mode to have been enabled
previously.
F. Jason Park [Tue, 28 May 2024 07:32:13 +0000 (00:32 -0700)]
Don't recurse in erc-server-delayed-check-reconnect
* lisp/erc/erc-backend.el (erc-server-delayed-check-reconnect): Run
`reschedule' function on a timer to avoid growing the stack when
calling `delete-process'.
* lisp/erc/erc-common.el (erc--favor-changed-reverted-modules-state):
Fix `pcase' condition so that changing an option to its standard value
does not earn a "STANDARD" label in Customize if that value differs
from the saved one.
* lisp/erc/erc.el (erc-open-socks-tls-stream): Reword doc string.
* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match)
(erc--with-dependent-type-match): Remove useless tests (bug#71178).
* test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld:
Await phantom EOFs and PINGs to somewhat account for a race that can
result in a failure when running the suite in parallel with -jN.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--print-trace): Set `debug-on-error' to t
so that errors in timers always trigger test failures.
;; * test/lisp/erc/resources/base/assoc/reconplay/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/upstream-reconnect/soju-barnet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/mask-target-routing/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/join/network-id/barnet.eld: Timeout.
Juri Linkov [Wed, 5 Jun 2024 17:07:28 +0000 (20:07 +0300)]
Allow multi-level outlines in tabulated-list-groups used by list-buffers
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-groups)
(tabulated-list-groups-categorize, tabulated-list-groups-sort)
(tabulated-list-groups-flatten): New functions (bug#70150).
* lisp/buff-menu.el (Buffer-menu-group-by): Change type from a function
to a list of functions.
(list-buffers--refresh): Use the function 'tabulated-list-groups' where
:path-function uses a list of functions from 'Buffer-menu-group-by', and
:sort-function is hard-coded to sort groups by name.
(Buffer-menu-group-by-mode, Buffer-menu-group-by-root): Remove prefix "*".
Eli Zaretskii [Wed, 5 Jun 2024 16:18:49 +0000 (19:18 +0300)]
Another attempt to prevent crashes when resizing TTY frames
* src/dispnew.c (frame_size_change_delayed): Accept frame as
argument, and check the 'new_size_p' flag of the frame in
addition to 'delayed_size_change'. Callers changed.
(window_to_frame_vpos, build_frame_matrix_from_leaf_window): Call
'frame_size_change_delayed' instead of looking at
delayed_size_change alone. (Bug#71289)
Eshel Yaron [Wed, 5 Jun 2024 08:23:56 +0000 (10:23 +0200)]
New user option 'completion-preview-idle-delay'
Support displaying the completion preview shortly after you
pause typing (on idle) rather than immediately.
* lisp/completion-preview.el (Commentary): Update.
(completion-preview--try-update):
(completion-preview--update-from-timer): New functions.
(completion-preview--timer): New buffer-local variable.
(completion-preview-idle-delay): New user option.
(completion-preview--show): Use it.
(completion-preview--post-command):
(completion-preview-mode): Disable idle timer if active.
Eshel Yaron [Wed, 5 Jun 2024 08:03:06 +0000 (10:03 +0200)]
Allow 'completion-preview-require-minimum-symbol-length' to be nil
With some completion backends, completion preview is useful not only
after a partial symbol, but also after punctuation and other non-symbol
characters. For example, in C code it's helpful to display the
completion preview for struct members when point is after 'foo->'.
Provide an option to skip the check for minimum symbol length at point
in order to support this use case.
* lisp/completion-preview.el
(completion-preview-minimum-symbol-length): Mention possible nil
value in type and docstring.
(completion-preview-require-minimum-symbol-length): Skip check
if 'completion-preview-minimum-symbol-length' is nil.
Juri Linkov [Wed, 5 Jun 2024 06:38:39 +0000 (09:38 +0300)]
Rehighlight hi-lock patterns after reverting the buffer.
* lisp/hi-lock.el (hi-lock-revert-buffer-rehighlight): New function.
(hi-lock-mode): Add hi-lock-revert-buffer-rehighlight to
revert-buffer-restore-functions, and remove after mode is disabled.
https://lists.gnu.org/archive/html/emacs-devel/2024-06/msg00044.html
Juri Linkov [Tue, 4 Jun 2024 16:53:47 +0000 (19:53 +0300)]
* lisp/outline.el (outline-revert-buffer-rehighlight): New function.
(outline-minor-mode): Add 'outline-revert-buffer-rehighlight' to
'revert-buffer-restore-functions'. When mode is disabled,
remove hooks from 'revert-buffer-restore-functions' and
also from 'after-change-functions'.
Eli Zaretskii [Tue, 4 Jun 2024 16:12:38 +0000 (19:12 +0300)]
Fix the build with mingw.org's MinGW
The change in boot-time.c imported from Gnulib broke the
MinGW build using mingw.org's MinGW. It is wrong to include
sysinfoapi.h, MS documentation says to include <windows.h>.
* lib/boot-time.c: Don't include sysinfoapi.h.
Paul Eggert [Mon, 3 Jun 2024 21:43:10 +0000 (14:43 -0700)]
lwlib: pacify gcc -Wmissing-variable-declarations
* lwlib/lwlib.c (lwlib_toolkit_type): Remove unused var.
* lwlib/xlwmenu.c (submenu_destroyed): Now static.
* src/xmenu.c (widget_id_tick): Declare extern, as a FIXME.
Po Lu [Tue, 4 Jun 2024 02:23:13 +0000 (10:23 +0800)]
Provide additional Android metadata
* java/AndroidManifest.xml.in: Enable preserving user data
beyond uninstallation, restarting activities without persiting
state, increase maximum number of simultaneously open
activities, and provide a sensible category.
Juri Linkov [Mon, 3 Jun 2024 18:13:38 +0000 (21:13 +0300)]
Move revert-buffer-restore-functions use from buff-menu.el to outline.el
* lisp/buff-menu.el (Buffer-menu-mode): Remove
revert-buffer-restore-functions with handling of
outline-minor-mode and move it to outline-minor-mode.
* lisp/outline.el (outline-minor-mode):
Add revert-buffer-restore-functions to call
outline-minor-mode-highlight-buffer after reverting the buffer
with outline-minor-mode and outline-minor-mode-highlight
where font-lock can't be used to update highlighting.
Eli Zaretskii [Mon, 3 Jun 2024 18:13:05 +0000 (21:13 +0300)]
Avoid assertion violations in 'try_window_id'
* src/xdisp.c (try_window_id): Avoid assertions in
'find_first_unchanged_at_end_row' due to 'init_iterator' freeing
all the realized faces. (Bug#71274)
Stefan Monnier [Mon, 3 Jun 2024 17:26:10 +0000 (13:26 -0400)]
pcase.el (\`): Try and handle large patterns better
Large backquote patterns tend to lead to very large and deeply
nested expansions, but they also tend to contain a lot of
"constant" subpatterns that can be compiled to quote patterns.
This patch does just that. See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01140.html
* lisp/emacs-lisp/pcase.el (pcase--split-pred):
Improve the handling of pred-vs-quote so it also works with
quoted objects like cons cells, vectors, and strings.
Simplify the `pcase--mutually-exclusive-p` branch accordingly.
(pcase--expand-\`): New function, extracted from the \` pcase macro.
Make it recurse internally, and optimize backquote patterns to `quote`
patterns where possible.
(\`): Use it.
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-vectors): Add tests
that were broken by a more naïve version of the optimization.
(pcase-tests-quote-optimization): New test.
Eli Zaretskii [Mon, 3 Jun 2024 17:37:31 +0000 (20:37 +0300)]
Avoid crashes and assertions while handling SIGWINCH
* src/dispnew.c (build_frame_matrix_from_leaf_window)
(window_to_frame_vpos): Avoid assertion violations when we have an
unhandled SIGWINCH.
(frame_size_change_delayed): New function.
* src/dispextern.h (frame_size_change_delayed): Add prototype.
* src/cm.c (cmcheckmagic): Don't check magicwrap if we have an
unhandled SIGWINCH. (Bug#71289)
Juri Linkov [Mon, 3 Jun 2024 17:18:46 +0000 (20:18 +0300)]
New commands to show/hide outlines by regexp (bug#49731)
* lisp/outline.el (outline-mode-prefix-map): Bind "/ s" to
'outline-show-by-heading-regexp', and "/ h" to
'outline-hide-by-heading-regexp'.
(outline-show-by-heading-regexp)
(outline-hide-by-heading-regexp): New commands.
(outline-hidden-headings-regexp): New helper function.
Juri Linkov [Mon, 3 Jun 2024 16:55:47 +0000 (19:55 +0300)]
New variable 'revert-buffer-restore-functions' (bug#69511)
* doc/lispref/backups.texi (Reverting):
Add documentation for 'revert-buffer-restore-functions'.
* lisp/files.el (revert-buffer-restore-functions): New variable.
(revert-buffer-restore-read-only): New function.
(revert-buffer): Use 'revert-buffer-restore-functions' with
the default value 'revert-buffer-restore-read-only' (bug#69511).
* lisp/buff-menu.el (Buffer-menu-mode): Add hook
'revert-buffer-restore-functions' to restore
outline-minor-mode highlighting.
Robert Pluim [Mon, 3 Jun 2024 12:52:05 +0000 (14:52 +0200)]
Improve key binding documentation.
* doc/emacs/custom.texi (Init Rebinding): Explain how to bind a key to a
string and how to use non-ASCII characters.
* lisp/keymap.el (keymap-global-set, keymap-local-set): Mention
'key-description'.
Robert Pluim [Mon, 3 Jun 2024 12:00:56 +0000 (14:00 +0200)]
Add common pairs to defcustom for electric-quote-chars
* lisp/electric.el (electric--print-list-of-chars): New function to
display chars as chars instead of integers in a custom widget.
(electric-char-pair): New widget for displaying a pair of characters.
(electric-quote-chars-pairs): New widget. Contains presets for common
combinations of left/right quotation characters
(electric-quote-chars): Update to use 'electric-quote-chars-pairs'.
Po Lu [Mon, 3 Jun 2024 12:37:41 +0000 (20:37 +0800)]
Small followup change
* lisp/image.el (create-image): Remove supererogatory instances
of pcase. Recognize new `lambda' values and refrain from
specifying a default transform-smoothing when it is returned.
(image--default-smoothing): Return lambda if scaling is default.
* lisp/tool-bar.el (tool-bar--image-expression): Revert this
portion of last change.
Robert Pluim [Thu, 16 May 2024 14:25:24 +0000 (16:25 +0200)]
Improve support for entering quotation marks
* lisp/international/iso-transl.el (iso-transl-char-map): Add entries
for "low" single and double quotation marks.
(iso-transl-language-alist): Add convenient support for the official
German quoting style to the German language entry. It uses "low" double
quotes on the left, and *left* double quotes on the right. Add support
for single guillemets to the French language entry.
* lisp/leim/quail/latin-post.el ("latin-postfix"): Add entries for
single, double and "low" Unicode quotation marks. Add entries for
single guillemets.
* lisp/leim/quail/latin-pre.el ("latin-prefix"): And here.
Po Lu [Mon, 3 Jun 2024 08:34:51 +0000 (16:34 +0800)]
Maintain relationship between tool bar image and default font width
* doc/lispref/display.texi (Image Descriptors): Document new
value of QCscale.
* lisp/cus-start.el (standard) <image-scaling-factor>: New
definition.
* lisp/image.el (image-scaling-factor): Move to C.
(create-image): Provide `default' as the default scaling factor.
(image--default-smoothing): Accept non-integer scaling factors.
(image-compute-scaling-factor): Document that this function
is no longer invoked by Emacs.
* lisp/tool-bar.el (tool-bar--image-expression): Disable
transform smoothing for tool-bar icons.
* src/dispextern.h (clear_image_cache): New definition.
* src/frame.c (gui_set_font): Clear such image cache entries as
derive their scales from the default font width.
* src/image.c (clear_image_cache): Export function.
(compute_image_size): Implement `default' by reading
Vimage_scaling_factor and/or computing a scale factor from the
frame's column width, as the case may be.
New argument F. All callers changed.
(syms_of_image) <Vimage_scaling_factor>: Move from image.el.
Yuan Fu [Mon, 3 Jun 2024 04:52:48 +0000 (21:52 -0700)]
Use parser notifier to set parser ranges
This is a continuation from an earlier commit where I added
treesit-parser-changed-ranges and friends. Dmitry raised an concern
about the edge case where the parser re-parses multiple times before
treesit--pre-redisplay has a chance to run and process changed ranges.
Instead of making treesit-parser-changed-ranges DTRT and become more
complicated, it's agreed that using parser notifier is a better
solution (and treesit-parser-changed-ranges can probably be removed).
So, I took out the code that does the work from treesit--pre-redisplay
and put them into treesit--font-lock-mark-ranges-to-fontify. This
function will be called on each parser re-parse. And in
treesit--pre-redisplay, to ensure that treesit--f-l-m-r-to-f gets
called, we force the primary parser to re-parse.
I also added a new variable that major modes need to set,
treesit-primary-parser. I also added code that makes Emacs guess the
primary parser if that variable isn't set.
Documentation fot treesit-primary-parser will come later.
For futher reference, the message id for the message that prompted
this change is <dc94733b-df75-446c-980e-1c8ea65826cf@gutov.dev>
* lisp/treesit.el (treesit-primary-parser): New variable.
(treesit--font-lock-mark-ranges-to-fontify): New function.
(treesit--guess-primary-parser): New function.
(treesit--pre-redisplay): Extract out.
(treesit--pre-syntax-ppss): Add comments.
(treesit-major-mode-setup): Guess and set treesit-primary-parser; add
treesit--font-lock-mark-ranges-to-fontify as a notifier to the primary
parser.
* doc/misc/tramp.texi (Inline methods): Be more specific with containers.
(Remote processes): New subsection "Managing remote shell history".
Explain shell-history-file-name.
(Frequently Asked Questions): Add items to Tramp speedup. Remove
entry about history file.
* etc/NEWS: New user option 'shell-history-file-name'.
* lisp/shell.el (shell-history-file-name): New defcustom.
(shell-mode): Use it. (Bug#71049)
Spencer Baugh [Sun, 26 May 2024 13:26:09 +0000 (09:26 -0400)]
In rgrep, check matching files before excluding files
There are a lot of excluding globs, and checking them all is expensive.
The files glob (i.e. the glob for files we actually want) is usually
just one or two entries, so it's quite fast to check.
If find checks the files glob first and then the excluding glob, it has
to do much less checking (since the files glob will substantially narrow
down the set of files on its own), and find performance is much better.
In my benchmarking, this takes (rgrep "foo" "*.el" "~/src/emacs/trunk/")
from ~410ms to ~130ms.
Further optimizations are possible now that the ignores and matched
files are in the same <F> argument which can be rearranged more easily
without compatibility issues; I'll do those optimizations in later
commits.
* lisp/progmodes/grep.el (rgrep-find-ignores-in-<f>): Add.
* lisp/progmodes/grep.el (rgrep-default-command): Check
rgrep-find-ignores-in-<f> and move the excluded files glob to part of
the "files" argument. (Bug#71179)