Juri Linkov [Tue, 16 Apr 2024 06:40:15 +0000 (09:40 +0300)]
Support prefix argument for switching tabs in tab-line-mode
* lisp/tab-line.el (tab-line-select-tab-buffer): Optimize.
(tab-line-switch-cycling): Enable by default like in tab-bar-mode.
(tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab):
Add a prefix argument ARG and support it for switching tabs.
Improve docstring.
Eric Abrahamsen [Tue, 16 Apr 2024 03:14:50 +0000 (20:14 -0700)]
; Improvements to PEG documentation
* doc/lispref/peg.texi: Make more use of defmac/defmacro, and try to
clarify the relationships between the various macros and functions.
* lisp/progmodes/peg.el (peg-parse): Remove claim that PEXS can also be
a single list of rules.
Stefan Monnier [Mon, 15 Apr 2024 19:53:48 +0000 (15:53 -0400)]
(track-changes--before): Fix bug#70396
* lisp/emacs-lisp/track-changes.el (track-changes--before):
Widen the buffer before accessing it with positions
potentially outside the beg..end region.
Eli Zaretskii [Mon, 15 Apr 2024 13:50:59 +0000 (16:50 +0300)]
Fix resetting the frame's 'frozen_window_starts' flag
* src/window.c (grow_mini_window, shrink_mini_window): Reimplement
how the frame's 'frozen_window_starts' flag is set and reset, to
make sure it is always reset when the mini-window gets to its
normal one-line height. Patch by Martin Rudalics
<rudalics@gmx.at> (Bug#70038)
Eli Zaretskii [Mon, 15 Apr 2024 12:47:39 +0000 (15:47 +0300)]
Fix display of @xref documentation in Info
* lisp/info.el (Info--dont-hide-references): New variable.
(Info-fontify-node): Use 'Info--dont-hide-references' to disable
hiding "*Note" or showing "See" instead of it in select nodes.
(Bug#70382)
Po Lu [Mon, 15 Apr 2024 11:54:20 +0000 (19:54 +0800)]
Rewrite Android description of Android window management
* doc/emacs/android.texi (Android Environment): Rewrite several
paragraphs to better reflect recent changes and emphasize
behavior on modern OS releases.
Po Lu [Mon, 15 Apr 2024 01:21:17 +0000 (09:21 +0800)]
Fix bug#70385
* src/xdisp.c (note_fringe_highlight): Don't proceed if
popup_activated, window is outdated, or when row beneath pointer
does not display text. (bug#70385)
GC-mark temporary key values created when sorting (bug#69709)
Bug reported and fix proposed by Aris Spathis.
* src/sort.c (merge_markmem): Mark heap-allocated temporary key values.
(tim_sort): Delay key function calls to after marking function has been
registered.
* test/src/fns-tests.el (fns-tests-sort-gc): New test.
Juri Linkov [Sun, 14 Apr 2024 16:18:31 +0000 (19:18 +0300)]
Add 'forward-sexp-default-function' to be used by 'treesit-forward-sexp'
* lisp/emacs-lisp/lisp.el (forward-sexp-default-function):
New function with body from 'forward-sexp' (bug#68993).
(forward-sexp-function): Change the default value from nil to
'forward-sexp-default-function'.
(forward-sexp): Use either 'forward-sexp-function' or
'forward-sexp-default-function'.
* lisp/treesit.el (treesit-forward-sexp): In nodes of type 'text'
fall back to 'forward-sexp-default-function'. Improve docstring.
Earl Hyatt [Sun, 24 Mar 2024 15:49:21 +0000 (11:49 -0400)]
Add command 'list-keyboard-macros' that works like 'list-buffers'.
The command 'list-keyboard-macros' allows editing and re-arranging
macros using 'tabulated-list-mode'. Existing keyboard macros can be
duplicated or deleted. Macro counters and counter formats can take new
values read from the minibuffer. Macro keys can be edited using
'edit-kbd-macro'.
* doc/emacs/kmacro.texi (Kmacro Menu): Document the new command
and the menu's commands.
* etc/NEWS (Kmacro Menu Mode): Mention the new mode and command.
* lisp/kmacro.el (kmacro-menu-mark, kmacro-menu-marked)
(kmacro-menu-flagged): Add faces for marks and flags.
* lisp/kmacro.el (kmacro-menu-mode-map, kmacro-menu-mode): Add mode
and map.
* lisp/kmacro.el (list-keyboard-macros, kmacro-menu): Add command.
* lisp/kmacro.el (kmacro-menu--deletion-flags, kmacro-menu--marks)
(kmacro-menu--id-kmacro, kmacro-menu--id-position, kmacro-menu--kmacros)
(kmacro-menu--refresh, kmacro-menu--map-ids, kmacro-menu--replace-all)
(kmacro-menu--replace-at, kmacro-menu--query-revert, kmacro-menu--assert-row)
(kmacro-menu--propertize-keys, kmacro-menu--do-region)
(kmacro-menu--marks-exist-p): Add utility functions of mode
and commands.
* lisp/kmacro.el (kmacro-menu-mark, kmacro-menu-flag-for-deletion)
(kmacro-menu-unmark, kmacro-menu-unmark-backward)
(kmacro-menu-unmark-all): Add commands for marks and flags.
* lisp/kmacro.el (kmacro-menu-do-flagged-delete, kmacro-menu-do-copy)
(kmacro-menu-do-delete): Add commands that modify the ring.
* lisp/kmacro.el (kmacro-menu-edit-position, kmacro-menu-transpose)
(kmacro-menu-edit-format, kmacro-menu-edit-counter)
(kmacro-menu-edit-keys, kmacro-menu-edit-column): Add commands that
modify a keyboard macro.
Stefan Monnier [Sat, 13 Apr 2024 19:35:46 +0000 (15:35 -0400)]
peg-tests.el: Fix test failures
* lisp/progmodes/peg.el (peg-parse): Refine heuristic since unknown
terminals are resolved at run-time rather than compile-time now.
(peg--macroexpand) <stack-action>: Avoid generating a `let` with an
empty body.
(peg--translate-rule-body): Adjust to name change of
`macroexp-warn-and-return` and the fact that it's always available.
* test/lisp/progmodes/peg-tests.el (peg-parse-string):
Add `indent` declaration.
(peg-test): Check that the compiler emits the warnings we expect.
Stefan Monnier [Sat, 13 Apr 2024 14:31:28 +0000 (10:31 -0400)]
(define-globalized-minor-mode): Require the use of `run-mode-hooks`
When `define-globalized-minor-mode` was introduced (Emacs-22),
`run-mode-hooks` was brand new, so we could not expect all major
modes to use it and we had to rely on brittle workarounds to try
and approximate `after-change-major-mode-hook`.
These workarounds have undesirable side effects, and (we hope)
they're not needed any more now that virtually all major modes
have been changed to use `run-mode-hooks` (or
`define-derived-mode`).
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Rely only on `after-change-major-mode-hook`, remove the "cmhh"
[typo for the intended "cmmh", BTW] workaround.
* doc/lispref/modes.texi (Mode Hooks): Clarify the importance of
`after-change-major-mode-hook` w.r.t `define-globalized-minor-mode`.
(Defining Minor Modes): Rewrite the explanation of which buffers
are affected, including adjusting it to the fact that
`fundamental-mode` has used run `run-mode-hooks` for last 10 years.
Stefan Monnier [Sat, 13 Apr 2024 14:10:19 +0000 (10:10 -0400)]
(define-globalized-minor-mode): Fix bug#58888
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode) <MODE-cmhh>:
Try and detect well-behaved modes so they're not affected by
those which require the cmhh hack.
Stefan Monnier [Fri, 5 Apr 2024 21:37:32 +0000 (17:37 -0400)]
lisp/emacs-lisp/track-changes.el: New file (bug#70077)
This new package provides an API that is easier to use right than
our `*-change-functions` hooks.
The patch includes changes to `diff-mode.el` and `eglot.el` to
make use of this new package.
* lisp/emacs-lisp/track-changes.el: New file.
* test/lisp/emacs-lisp/track-changes-tests.el: New file.
* doc/lispref/text.texi (Tracking changes): New subsection.
* lisp/progmodes/eglot.el: Require `track-changes`.
(eglot--virtual-pos-to-lsp-position): New function.
(eglot--track-changes): New var.
(eglot--managed-mode): Use `track-changes-register` i.s.o
`after/before-change-functions` when available.
(eglot--track-changes-signal): New function, partly extracted from
`eglot--after-change`.
(eglot--after-change): Use it.
(eglot--track-changes-fetch): New function.
(eglot--signal-textDocument/didChange): Use it.
* lisp/vc/diff-mode.el: Require `track-changes`.
Also require `easy-mmode` before the `eval-when-compile`s.
(diff-unhandled-changes): Delete variable.
(diff-after-change-function): Delete function.
(diff--track-changes-function): Rename from `diff-post-command-hook`
and adjust to new calling convention.
(diff--track-changes): New variable.
(diff--track-changes-signal): New function.
(diff-mode, diff-minor-mode): Use it with `track-changes-register`.
Phil Sainty [Sat, 13 Apr 2024 12:49:56 +0000 (00:49 +1200)]
; Additional fixup for truncation of long lines in compilation buffers
* lisp/progmodes/compile.el
(compilation--insert-abbreviated-line): Handle long lines that end
in a newline. (Bug#70236)
The fix in commit 8f93cba324e4d4022a9422b8c56186213ba2de8d resulted in
the previous "Don't hide the final newline" code causing an off-by-one
error. With the new code the value of point is what is wanted in both
cases.
Po Lu [Sat, 13 Apr 2024 11:43:40 +0000 (19:43 +0800)]
Fix crash upon call to Fset_fontset_font after X server disconnect
* src/image.c (free_image):
* src/xfaces.c (free_realized_face): Handle scenarios where
free_frame_faces is called with the display connection cut.
* src/xterm.c (x_free_frame_resources): Call free_frame_faces
unconditionally, lest fontsets for this dead frame contaminate
Vfontset_list and produce crashes afterwards. (bug#66151)
Vladimir Kazanov [Sun, 24 Dec 2023 11:13:10 +0000 (11:13 +0000)]
Support tooltips for fringe indicators
* src/xdisp.c (note_fringe_highlight): New function.
(note_mouse_highlight): Call it when the mouse is on the fringes.
* src/frame.c (syms_of_frame) <left-fringe-help>
<right-fringe-help>: DEFSYM them.
* etc/NEWS:
* doc/lispref/text.texi (Special Properties):
* doc/lispref/display.texi (Other Display Specs): Document the new
properties.
* etc/TODO: Remove the todo item about this.
* lisp/help.el (help-quick-sections): Mention
'help-quick-use-map' in docstring.
(help-quick-use-map): Add new variable, defaulting to the
global-map.
(help-quick): Use new variable.
john muhl [Wed, 13 Mar 2024 13:35:08 +0000 (08:35 -0500)]
Mark Flymake regions more accurately in 'lua-ts-mode'
* lisp/progmodes/lua-ts-mode.el (lua-ts-flymake-luacheck): Use
the end position provided by Luacheck rather than relying on
'thing-at-point' to guess where the end should be. (Bug#70167)
(Buffer-menu-group-by): Replace function-item with const
better suitable for Customization UI.
(Buffer-menu-group-by-mode): Use 'mouse-buffer-menu-mode-groups'
to group buffers by mode.
Juri Linkov [Fri, 12 Apr 2024 16:35:55 +0000 (19:35 +0300)]
New user option 'tab-line-tabs-buffer-group-function'
* lisp/tab-line.el (tab-line-tabs-buffer-group-function):
Turn defvar into defcustom with the default value
'tab-line-tabs-buffer-group-by-mode'.
(tab-line-tabs-buffer-group-by-mode): New function with body from
'tab-line-tabs-buffer-group-name'.
(tab-line-tabs-buffer-group-by-project): New function.
(tab-line-tabs-buffer-groups): Use fallback name "No group" instead of "All".
* etc/NEWS: D-Bus byte array conversion works over raw UTF-8 bytes.
Fix typos.
* lisp/net/dbus.el (dbus-string-to-byte-array)
(dbus-byte-array-to-string): BYTE-ARRAY must be an UTF-8 raw bytes
sequence. Make optional argument MULTIBYTE obsolete. (Bug#70301)
(dbus-call-method-handler, dbus-register-signal)
(dbus-escape-as-identifier): Use `length=' and `length>'.
* test/lisp/net/dbus-tests.el (dbus--test-method-handler)
(dbus-test09-get-managed-objects): Use `length='.
(dbus-test01-type-conversion): Extend test.
Joseph Turner [Sat, 6 Apr 2024 01:32:36 +0000 (18:32 -0700)]
Display Info buffer after ensuring it contains text
* lisp/info.el (info-pop-to-buffer): Move display of Info buffer
to a later stage after its text contents is ready to display.
This helps to use fit-window-to-buffer in display-buffer-alist (bug#70213).
Generalize the file-name specific workaround in minibuffer-completion-help
* lisp/minibuffer.el (completion-base-suffix):
New function (bug#48356).
(minibuffer-completion-help): Use it here.
(minibuffer-completion-help): Cut off the double completion
boundary when it occurs inside
completion-list-insert-choice-function..
* lisp/textmodes/reftex-dcr.el (reftex-view-crossref-when-idle):
Check if point inside a mandatory argument where the cite/ref key
usually resides. For example, with \cite[45]{emacs:30} and point
on 4, the following bogus message in the echo area is suppressed:
"cite: no such database entry: \cite[45]". (bug#38258)
Fix docstring.
* lisp/progmodes/go-ts-mode.el:
(go-ts-mode--method-elem-supported-p): New function.
(go-ts-mode--font-lock-settings): Conditionally use method_elem or
method_spec in the query.
* lisp/completion-preview.el (completion-preview--ignore): New
internal command.
(completion-preview--internal-commands): Add it.
(completion-preview--mouse-map): Use it to fix bindings.
This command completes the symbol at point up to the longest
common prefix of all completions candidates. We also add an
indication of the longest common prefix in the completion
preview by highlighting that part of the preview with the
'completion-preview-exact' face. To facilitate these features
we change the way we store the completion candidates while the
preview is visible, to explicitly keep the common prefix along
with a list of its suffixes.
* lisp/completion-preview.el (completion-preview--try-table):
Return longest common prefix and list of suffixes instead of
list of full candidates. Add illustrative comment.
(completion-preview--capf-wrapper, completion-preview--update)
(completion-preview--show, completion-preview-insert)
(completion-preview-next-candidate): Adjust.
(completion-preview-common): New face.
(completion-preview-exact): Tweak to distinguish it from
'completion-preview-common'.
(completion-preview-complete): New command.
(completion-preview-active-mode-map): Bind it.
(completion-preview-mode): Mention it in docstring.
(completion-preview-commands): Add 'completion-preview-complete'.
(completion-preview--make-overlay): Simplify.
(completion-preview--internal-command-p): Remove.
(completion-preview-require-certain-commands): Update.
(completion-preview--inhibit-update): New inline function.
(completion-preview--inhibit-update-p): New local variable.
(completion-preview--post-command, completion-preview-hide):
Reset it to nil.
* test/lisp/completion-preview-tests.el
(completion-preview-tests--check-preview): Check the 'face'
property of both the first and last character. Update callers.
(completion-preview-insert-calls-exit-function)
(completion-preview-complete): New tests.
* lisp/completion-preview.el (completion-preview-completion-styles):
New variable. Default to only include the 'basic' completion style.
(completion-preview--try-table): Let-bind 'completion-styles' when
calling 'completion-all-completions'. With the default value of
'completion-preview-completion-styles', this yields a significant
performance improvement (up to 4 times faster compared to the
'substring' style when tested with 'elisp-completion-at-point').
Following commit e720ba62193 'mouse-wheel-up-event' and
'mouse-wheel-down-event' are translated to 'wheel-up/down'
events, so we only need to bind 'wheel-down/up' in
'completion-preview--mouse-map'.
* lisp/completion-preview.el: Don't require 'mwheel'.
(completion-preview--mouse-map): Remove bindings for
'mouse-wheel-up/down-event'.
For `en/decode-coding-string/region`, `after-change-functions`
were either not run at all, or run only after deleting the text
but not after inserting it.
* src/coding.c (decode_coding_object, encode_coding_object): Run the
after-change-functions after inserting the result.
* test/src/editfns-tests.el (sanity-check-change-functions-with-op):
New macro.
(sanity-check-change-functions-errors): New function.
(editfns-tests--before/after-change-functions): Use them to add
cases for `en/decode-coding-string/region`.
Po Lu [Wed, 10 Apr 2024 14:33:08 +0000 (22:33 +0800)]
Optimize generated Android DEX bytecode
* configure.ac (D8): Attempt to locate the bundle where d8 is
installed, detect whether an installation of `r8' is similarly
present, and use this installation in place of d8 if so.
* java/Makefile.in (ANDROID_MIN_SDK, IS_D8_R8): New
substitutions.
(classes.dex): Provide --min-api, --debug or --release and
--pg-conf to d8 or r8.
* lisp/progmodes/rust-ts-mode.el (rust-ts-flymake-command):
New option (bug#70260).
(rust-ts--flymake-proc): New variable.
(rust-ts-flymake--helper): New function.
(rust-ts-flymake): New function.
(rust-ts-mode): Add it to flymake-diagnostic-functions.
Stefan Monnier [Mon, 29 Jan 2024 14:35:09 +0000 (09:35 -0500)]
(mouse-wheel-buttons): Map old-style wheel buttons to actual wheel events
Change the handling of the old X11 convention that uses mouse-4/5/6/7
events to represent wheel events: instead of asking downstream
packages to use the `mouse-wheel-*-event` variables to know which events
represent wheel events, use new var `mouse-wheel-buttons` to directly
convert those events into the standard `wheel-up/down/left/right` events
used everywhere else.
This will simplify the work of packages which can thus just bind their
commands to `wheel-up/down/left/right`.
* lisp/mouse.el (mouse-wheel-buttons): New custom variable.
* src/keyboard.c (make_lispy_event): Adjust for "wheel-clicks" on the tab-bar.
* src/xterm.c (x_construct_mouse_click): Add `xi2` argument and
obey `mouse-wheel-buttons` variable.
(handle_one_xevent): Adjust calls accordingly.
(syms_of_xterm): Define the `mouse-wheel-buttons` and the
`wheel-up/down/left/right`symbols.
* lisp/xt-mouse.el: Don't require `mwheel` any more.
(xterm-mouse--same-button-p): Delete function.
(xterm-mouse--read-event-sequence): Use `mouse-wheel-buttons`.