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`.
Move over optional arguments in parentheses correctly
* lisp/textmodes/reftex-parse.el (reftex-move-to-previous-arg):
Recognize ')' as closing delimiter for optional argument.
Fix docstring.
(reftex-what-macro): Identify LaTeX macros with optional arguments
in parentheses correctly. This is necessary to make
`reftex-view-crossref' work with biblatex on entries like:
\parencites(Glob.Pre)(Glob.Post)[Pre][Post]{key1}[Pre][Post]{key2}
(bug#31132)
Inhibit flymake lexical cookie warning in *scratch* (bug#70068)
Add a hack to prevent flymake from complaining about a missing lexical
cookie when enabled in *scratch*.
* lisp/emacs-lisp/bytecomp.el
(bytecomp--inhibit-lexical-cookie-warning): New variable.
(byte-compile-file): Use it to gate the warning.
* lisp/progmodes/elisp-mode.el (elisp-flymake-byte-compile):
Set the inhibitor when spawning a check in lisp-interaction-mode.
Po Lu [Tue, 9 Apr 2024 02:37:47 +0000 (10:37 +0800)]
Improve treatment of aborted touch events in Speedbar and elsewhere
* lisp/dframe.el (dframe-popup-kludge): Mark as a
mouse-1-menu-command.
* lisp/touch-screen.el (touch-screen-handle-point-up): New
argument CANCELED. Implement specific responses to cancellation
for each tool state.
(touch-screen-handle-touch): Adjust to match.
Stefan Monnier [Mon, 8 Apr 2024 12:18:31 +0000 (08:18 -0400)]
(define-globalized-minor-mode): Fix bug#69431
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
When `after-change-major-mode-hook` runs, enable the mode only
in the current buffer and not in other pending buffers.
Stephen Berman [Mon, 8 Apr 2024 11:56:56 +0000 (13:56 +0200)]
Update INSTALL for native compilation of Lisp files
* INSTALL: Add section "Native compilation of Lisp files" under
ADDITIONAL DISTRIBUTION FILES and correspondingly augment item 6
of DETAILED BUILDING AND INSTALLATION. In the latter also note
differences between in-source-tree and out-of-tree builds for
running 'src/emacs' uninstalled.
Yuan Fu [Sun, 7 Apr 2024 22:59:48 +0000 (15:59 -0700)]
Document tree-sitter things feature (bug#70016) (bug#68824)
* doc/lispref/parsing.texi (Retrieving Nodes): Mention new kinds of
predicate argument that the tree-traversing functions accept (which are
thing symbols and thing definitions).
(User-defined Things): New node dedicated to thing definition and
navigation functions.
Yuan Fu [Sun, 7 Apr 2024 20:33:31 +0000 (13:33 -0700)]
Make tree-sitter thing feature public and remove obsolete functions
* lisp/treesit.el (treesit--things-around): Remove function.
(treesit-forward-sexp):
(treesit-beginning-of-thing):
(treesit-end-of-thing):
(treesit-navigate-thing):
(treesit-thing-at-point):
(treesit-outline-search): Use public version of thing-functions.
(treesit--thing-prev):
(treesit--thing-next):
(treesit--thing-at):
(treesit--navigate-thing): Make public.
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation): Use
public version of thing-functions.
F. Jason Park [Sun, 31 Mar 2024 23:32:44 +0000 (16:32 -0700)]
Fix invisible erc-speedbar cursor in text terminals
* lisp/erc/erc-speedbar.el
(erc-speedbar--reset-last-ran-on-timer): Use `with-current-buffer'
instead of `setf' and `buffer-local-value'.
(erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable)
(erc-speedbar-toggle-nicknames-window-lock): Revise doc string.
(erc-speedbar-toggle-nicknames-window-lock): Set `cursor-type' in
speedbar buffer.
(erc-nickbar-toggle-nicknames-window-lock): New function alias. Note
that this name flouts traditional library namespacing conventions.
* lisp/erc/erc-status-sidebar.el (erc-status-sidebar-get-window): Use
`cursor-type' instead of `internal-show-cursor'. (Bug#63595)
F. Jason Park [Mon, 1 Apr 2024 22:27:47 +0000 (15:27 -0700)]
Allow updating of /IGNORE timeouts in ERC
* lisp/erc/erc.el (erc--read-time-period, erc--decode-time-period):
Move body of former, now a superficial wrapper, to latter, a new
function.
(erc--format-time-period): New function.
(erc--get-ignore-timer-args): New function.
(erc--find-ignore-timer): New function to search through `timer-list'
to find matching ignore timer.
(erc-cmd-IGNORE): Refactor and redo doc string. Add new optional
`timespec' parameter, primarily to aid in testing. Update an existing
timer instead of always creating one, and display time remaining in
"ignore list" output. Pass server buffer instead of current buffer to
timer callbacks because `erc--unignore-user' displays its messages in
the `active' buffer, not necessarily the issuing one. Note that doing
this does discard potentially useful information, so if ever reverting,
we can change the `cl-find' :test in `erc--find-ignore-timer' to
something that compares the `erc-server-process' of both buffers.
;;
;; Something like:
;;
;; (defun erc--ignore-timers-equal-p (a b)
;; (and (equal (car a) (car b))
;; (eq (buffer-local-value 'erc-server-process (cadr a))
;; (buffer-local-value 'erc-server-process (cadr b)))))
;;
(erc-cmd-UNIGNORE): Pass `erc-ignore-list' member matching `user'
parameter to `erc--unignore-user' instead of original, raw parameter,
along with the server buffer.
(erc--unignore-user): Cancel existing timer and don't bother switching
to server buffer since we're already there.
(erc-message-english-ignore-list): New variable.
* test/lisp/erc/erc-scenarios-ignore.el: New file.
* test/lisp/erc/erc-tests.el (erc--read-time-period): New test.
(erc-cmd-UNIGNORE): New test. (Bug#70127)
* lisp/align.el (align-rules-list): Remove the check of
`latex-mode' with `eq' which doesn't work with newer AUCTeX mode
names and modes defined by user with `define-derived-mode'.
(bug#69187)
Po Lu [Sun, 7 Apr 2024 06:39:42 +0000 (14:39 +0800)]
Resolve disagreements in accounting of tooltip positions on Android
* java/org/gnu/emacs/EmacsService.java (getLocationInWindow):
New function.
* java/org/gnu/emacs/EmacsWindow.java (translateCoordinates):
Derive "root window" position from the origin point of the
containing activity's window rather than that of the screen,
the two of which differ when "freeform mode" is enabled.
Po Lu [Sun, 7 Apr 2024 04:15:39 +0000 (12:15 +0800)]
Port new Android window management strategy to Android 5.0
* doc/emacs/android.texi (Android Windowing): Revise to match.
* java/org/gnu/emacs/EmacsWindowManager.java (registerWindow)
(removeWindowConsumer, pruneWindows): Decrease minimum API for
monitoring of tasks to Android 5.0.
(getTaskToken): Ignore misleading documentation and access
baseIntent by way of RecentTaskInfo.
Jared Finder [Sat, 30 Mar 2024 20:14:43 +0000 (13:14 -0700)]
Add documentation for 'switch-window' event
* doc/lispref/commands.texi (Focus Events): Add
documentation for the structure of 'switch-window' events.
Make sure to be clear when referring to window system windows
vs Emacs windows.
* doc/lispref/windows.texi (Mouse Window Auto-selection):
Adding cross-reference to "Focus Events". (Bug#69915)
Olaf Rogalsky [Sat, 30 Mar 2024 16:00:51 +0000 (17:00 +0100)]
Support 'mouse-autoselect-window' in xterm-mouse
Generate select-window events, so that 'mouse-autoselect-window'
takes effect on TTY frames, when 'xterm-mouse-mode' is enabled.
* lisp/xt-mouse.el (xterm-mouse-translate-1):
If 'mouse-autoselect-window' is non-nil, add select-window
events to 'unread-command-events'. (Bug#69915)
Xuan Wang [Fri, 29 Mar 2024 00:34:23 +0000 (20:34 -0400)]
Fix warning-suppress for list type "warning type"
Per the documentation of 'warning-suppress-types' and the
implementation of 'warning-suppress-p', a warning type can
be either a symbol or a list of symbols. The previous
implementation could generate wrong 'warning-suppress-types':
old behavior:
type warning-suppress-types
pkg -> '((pkg)) Correct
(pkg subtype) -> '(((pkg subtype))) Incorrect
Now we check whether type is a cons cell first. (Should not
use listp here, as listp returns t for nil.)
new behavior:
type warning-suppress-types
pkg -> '((pkg)) Correct
(pkg subtype) -> '((pkg subtype)) Correct
* lisp/emacs-lisp/warnings.el (warnings-suppress): Fix saving
warning types in 'warning-suppress-types'. (Bug#70063)
* lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make the
regex same as before, but conditionally check other heuristics rather
than crazy regex shenanigans.
Juri Linkov [Fri, 5 Apr 2024 16:44:52 +0000 (19:44 +0300)]
Mark display-comint-buffer-action as obsolete after adding a category.
* lisp/window.el (display-comint-buffer-action):
Append '(category . comint)' to the default value. Mark as obsolete.
(display-tex-shell-buffer-action):
Append '(category . tex-shell)' to the default value. Mark as obsolete.
(bug#69983)
Juri Linkov [Fri, 5 Apr 2024 16:23:08 +0000 (19:23 +0300)]
* lisp/tab-bar.el (tab-bar-mode-map): New keymap (bug#69578).
(tab-bar-select-tab-modifiers): Call tab-bar--undefine-keys
before set-default in :set of defcustom.
(tab-bar--define-keys, tab-bar--undefine-keys):
Change keybindings in tab-bar-mode-map instead of the global map.
Move checking of global-key-binding to tab-bar-mode--tab-key-bind.
(tab-bar-mode--tab-key-bind): New internal function.