Jim Porter [Sat, 11 Nov 2023 21:26:44 +0000 (13:26 -0800)]
Forward completion text properties in 'completion-table-with-quoting'
This fixes an issue with 'pcomplete-here-using-help', which passes
annotation strings along as text properties. Previously, those got
clobbered when the completions got requoted (bug#67112).
* lisp/minibuffer.el (completion--twq-all): Apply text properties from
the first character of the unquoted completion to the quoted
completion.
Kévin Le Gouguec [Sun, 12 Nov 2023 09:55:24 +0000 (10:55 +0100)]
Recognize shebang lines that pass '-S/--split-string' to 'env'
* etc/NEWS: announce the change.
* lisp/files.el (auto-mode-interpreter-regexp): Add optional '-S'
switch to the ignored group capturing the env invocation.
Allow multiple spaces between #!, interpreter and first argument:
empirically, Linux's 'execve' accepts that. (Bug#66902)
* test/lisp/files-tests.el (files-tests--check-shebang): New helper to
generate a temporary file with a given interpreter line, and assert
that the mode picked by 'set-auto-mode' is derived from an expected
mode. Write the 'should' form so that failure reports include useful
context; for example:
Po Lu [Sun, 19 Nov 2023 03:00:25 +0000 (11:00 +0800)]
Reorganize documentation relating to touch screens
Chiefly, elevate it from an appendix to a node in the User Input
chapter. I have been approached time and again with questions
from people who have not searched the appendices for such
documentation.
* doc/emacs/emacs.texi: Move Other Input below Commands in the
menu.
* doc/emacs/input.texi (Other Input Devices): Rename to Other
Input. All callers changed.
(Touchscreens, On-Screen Keyboards): Revise and reword
documentation. Homogenize nomenclature for on screen keyboards,
preferring "virtual keyboards" after it has been mentioned once
by the other name.
Stefan Monnier [Sat, 18 Nov 2023 21:34:38 +0000 (16:34 -0500)]
(update_search_regs): Install better fix for bug#67124
The recent fix for the bug in `replace-match-maybe-edit`
was basically a refinement of a previously installed workaround,
whereas the bug was really in `update_search_regs`.
* src/search.c (update_search_regs): Improve handling of `start` positions.
* lisp/replace.el (replace-match-maybe-edit): Remove workaround.
* test/src/search-tests.el (search-test--replace-match-update-data): New test.
F. Jason Park [Wed, 15 Nov 2023 05:10:39 +0000 (21:10 -0800)]
Favor ISUPPORT params for MODE processing in ERC
* etc/ERC-NEWS: Mention shift toward CHANMODES ISUPPORT parameter for
dictating MODE parsing behavior.
* lisp/erc/erc-backend.el (erc--init-channel-modes, erc--update-modes,
erc-set-modes, erc-update-modes): Forward declarations, the last two
being removals.
(erc-server-MODE, erc-server-221): Use `erc--update-modes' instead of
`erc-update-modes'.
(erc-server-324): Use `erc--init-channel-modes' instead of
`erc-set-modes'.
* lisp/erc/erc-common.el (erc--channel-mode-types): New struct for
stashing processed \"CHANMODES\" data for the current server.
* lisp/erc/erc.el (erc-channel-modes): Fix doc string.
(erc-set-initial-user-mode): Display a local notice when requesting
redundant user MODE operations.
(erc-set-modes, erc-parse-modes, erc-update-modes): Deprecate for
reasons explained in associated ERC-NEWS entry.
(erc--update-membership-prefix): New function, a helper for specifying
arguments to the rather unruly `erc-update-current-channel-member'.
(erc--channel-modes): New variable to record channel-mode state in a
hash table.
(erc--channel-mode-types): New variable and getter to stash
and retrieve server-local instance of the struct of the same name.
(erc--process-channel-modes): New function to parse channel-mode
changes, dispatch handlers for unary modes, and update the local
variables `erc-channel-modes' and `erc--channel-modes'.
(erc--user-modes): New local variable for remembering user modes per
server. New function of the same name, a "getter" for the variable.
(erc--parse-user-modes): New function to parse user modes only.
(erc--update-user-modes): New function to update and sort
`erc--user-modes'.
(erc--update-channel-modes): New function to replace much of
`erc-update-modes', currently a thin wrapper around
`erc--process-channel-modes' to ensure it updates status prefixes.
(erc--update-modes): New function to call appropriate mode-updating
function for the current buffer.
(erc--init-channel-modes): New function to update channel mode letters
without status prefixes.
(erc--handle-channel-mode): New generic function, a placeholder for an
eventual API to handle specific "unary" mode letters, meaning those
that specify a single parameter for setting or unsetting.
(erc-update-channel-limit): Update doc string and answer question
posed by ancient comment.
(erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop): New English catalog
messages.
* test/lisp/erc/erc-scenarios-base-chan-modes.el: New file.
* test/lisp/erc/erc-tests.el (erc-parse-modes,
erc--update-channel-modes, erc--update-user-modes, erc--user-modes,
erc--parse-user-modes): New tests.
* test/lisp/erc/resources/base/modes/chan-changed.eld: New test data
file. (Bug#67220)
F. Jason Park [Tue, 14 Nov 2023 02:24:59 +0000 (18:24 -0800)]
Use caching variant of erc-parse-prefix internally
* lisp/erc/erc-common.el (erc--parsed-prefix): New struct to help with
tasks that depends on the advertised "PREFIX" parameter.
* lisp/erc/erc.el (erc-parse-prefix): Rework slightly for readability.
(erc--parsed-prefix): New variable and function of the same name for
caching the reversed result of `erc-parse-prefix' locally per server.
(erc-channel-receive-names): Use value stored in `erc--parsed-prefix'.
* test/lisp/erc/erc-tests.el (erc-with-server-buffer): Only activate
spy around actual test case forms.
(erc--parse-prefix): New test. (Bug#67220)
F. Jason Park [Tue, 14 Nov 2023 02:24:59 +0000 (18:24 -0800)]
Simplify ISUPPORT-derived data wrangling in ERC
* lisp/erc/erc-backend.el (erc--get-isupport-entry): Check server
buffer for `erc-server-parameters' when (re)initializing value. This
function was previously unreliable from a target buffer on cache
misses.
(erc--with-isupport-data): New macro for accessing and caching data
derived from an ISUPPORT parameter. Late-arriving params break the
cache.
(erc-server-005): Rewrite pattern as `rx' form, factoring out bol/eol.
* lisp/erc/erc-common.el (erc--isupport-data): New struct to be
subclassed for storing cached ISUPPORT-derived data.
* test/lisp/erc/erc-scenarios-display-message.el: Remove stray
`require'. (Bug#67220)
F. Jason Park [Fri, 17 Nov 2023 21:26:00 +0000 (13:26 -0800)]
Add test for erc-cmd-SQUERY
* lisp/erc/erc-backend.el (erc-message): Revise doc string.
* test/lisp/erc/erc-scenarios-base-misc-regressions.el (erc-cmd-MOTD):
Move test to another file specifically for slash commands.
* test/lisp/erc/erc-scenarios-misc-commands.el: New file.
* test/lisp/erc/resources/base/commands/motd.eld: Move file elsewhere.
* test/lisp/erc/resources/commands/motd.eld: "New" file, moved here
reusing the same Git blob from now deleted subdir base/commands.
* test/lisp/erc/resources/commands/squery.eld: New file. (Bug#67209)
Osmo Karppinen [Fri, 17 Nov 2023 10:31:50 +0000 (12:31 +0200)]
Fix command-line parsing for erc-cmd-SQUERY
* lisp/erc/erc.el (erc-cmd-SQUERY): Set symbol property
`do-not-parse-args' to t so additional command-line arguments aren't
parsed but rather included as part of the function's lone (raw) LINE
parameter. (Bug#67209)
Eli Zaretskii [Sat, 18 Nov 2023 10:02:25 +0000 (12:02 +0200)]
; Add commentary for exposing a mode hook to Custom
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode-hook): Add
commentary about the reasons for exposing the hook to Custom, per
the discussion in bug#67207.
Eli Zaretskii [Sat, 18 Nov 2023 09:52:48 +0000 (11:52 +0200)]
Document changes in 'edmacro-parse-keys'
* lisp/edmacro.el (edmacro-parse-keys): Add a comment for forcing
output to be a vector.
(read-kbd-macro): Adjust the doc string to changes in
'edmacro-parse-keys'. (Bug#67182)
Po Lu [Sat, 18 Nov 2023 09:41:51 +0000 (17:41 +0800)]
Document Battery Optimization challenges on Android
* etc/PROBLEMS (Runtime problems specific to Android): Mention
battery optimization, the way it impacts background execution,
and how it might be disabled.
Eli Zaretskii [Sat, 18 Nov 2023 09:11:04 +0000 (11:11 +0200)]
Add 2 SQLite extensions to allow-list.
* src/sqlite.c (Fsqlite_load_extension): Add 2 Free Software
extensions to the allow-list. For the details, see
https://lists.gnu.org/archive/html/emacs-devel/2023-11/msg00234.html.
Eli Zaretskii [Sat, 18 Nov 2023 08:13:37 +0000 (10:13 +0200)]
Avoid loading cl-lib as result of invoking 'load-library'
* lisp/emacs-lisp/find-func.el (find-function--any-subform-p):
Don't use 'cl-destructuring-bind'.
(find-library--from-load-history): Don't use 'cl-loop'.
* lisp/thingatpt.el (thing-at-point): Don't use 'cl-loop'. This
avoids loading cl-lib whenever thingatpt.el is loaded, for
example, as result of "M-x load-library".
Po Lu [Sat, 18 Nov 2023 06:15:55 +0000 (14:15 +0800)]
Offer to grant storage permissions if absent
* java/org/gnu/emacs/EmacsService.java (externalStorageAvailable)
(requestStorageAccess23, requestStorageAccess30)
(requestStorageAccess): New functions.
* lisp/startup.el (fancy-startup-tail, normal-splash-screen):
Call android-win functions for inserting the new storage
permission notice.
* lisp/term/android-win.el
(android-display-storage-permission-popup)
(android-after-splash-screen): New functions.
* src/android.c (android_init_emacs_service): Link to new Java
functions.
(android_external_storage_available_p)
(android_request_storage_access): New functions.
* src/android.h: Update prototypes.
* src/androidfns.c (Fandroid_external_storage_available_p)
(Fandroid_request_storage_access): New functions.
(syms_of_androidfns): Register new subrs.
Spencer Baugh [Thu, 16 Nov 2023 16:34:08 +0000 (11:34 -0500)]
Return t from completion-emacs22-try-completion only for completions
The emacs22 completion style ignores the text after point when
computing completions. However, it still needs to take into account
the entire string it's given, to avoid returning incorrect values.
Previously, completion-emacs22-try-completion would return t if the
text before point was an exact completion. But this is effectively
saying that the entire input string was an exact completion, which may
not be correct. This would cause completing-read with REQUIRE-MATCH=t
to return a non-completion.
Now, completion-emacs22-try-completion only returns t if the entire
input string is an exact completion.
* lisp/minibuffer.el (completion-emacs22-try-completion): Return t
only if the entire input string is an exact completion. (Bug#67210)
Po Lu [Fri, 17 Nov 2023 03:36:58 +0000 (11:36 +0800)]
Correct initial scale calculation when pinching nonselected window
* lisp/touch-screen.el (touch-screen-pinch): Retrieve present
scale within the window pinched.
(touch-screen-handle-point-update): Expunge inefficacious code
meant to disregard events sent during gesture navigation.
Po Lu [Fri, 17 Nov 2023 03:16:23 +0000 (11:16 +0800)]
Correct generation of touchscreen-pinch events
* lisp/touch-screen.el (touch-screen-pinch): Check that posn-x-y
is available before scrolling to it.
(touch-screen-handle-aux-point-update): Don't provide posns for
windows besides the window where the touch sequence started in
touchscreen-pinch events.
Po Lu [Thu, 16 Nov 2023 13:07:01 +0000 (21:07 +0800)]
Disable generation of mouse-1 events after ancillary tool presses
* lisp/touch-screen.el (touch-screen-handle-scroll): Correct
typo in comment.
(touch-screen-handle-point-update): Attempt to detect scroll
gestures and the like also when what is ancillary-tool.
(touch-screen-handle-point-up): Don't needlessly compute
relative xy when transforming aux tool into current tool.
(touch-screen-handle-touch): Set what field to ancillary-tool
rather than clear it when initializing the ancillary tool,
indicating to t-s-h-p-u that it must not generate mouse up
events.
Po Lu [Thu, 16 Nov 2023 09:31:04 +0000 (17:31 +0800)]
; Commit omitted change
* lisp/completion-preview.el (completion-preview-commands):
Substitute analyze-text-conversion for text-conversion, as this
list enumerates commands, not events.
Stefan Monnier [Thu, 16 Nov 2023 05:16:31 +0000 (00:16 -0500)]
todo-mode.el: Don't let-bind `buffer-read-only`
Prefer let-binding `inhibit-read-only` so the code can freely change
`buffer-read-only`. While at it, prefer #' to quote function names.
* lisp/calendar/todo-mode.el (todo-rename-category)
(todo-delete-category, todo-delete-item)
(todo-edit-item--diary-inclusion, todo-edit-category-diary-inclusion)
(todo-edit-category-diary-nonmarking, todo-archive-done-item)
(todo-unarchive-items, todo-display-categories)
(todo-update-categories-display, todo-filter-items-1)
(todo-reset-nondiary-marker, todo-reset-done-separator-string)
(todo-reset-done-string, todo-reset-comment-string):
Bind `inhibit-read-only` instead of `buffer-read-only`.
(todo-mode, todo-archive-mode, todo-edit-mode, todo-categories-mode)
(todo-filtered-items-mode): Let `define-derived-mode` take care of
adding the keymap to the docstring.
(todo-mode, todo-archive-mode, todo-categories-mode)
(todo-filtered-items-mode): Let `define-derived-mode` set
`mode-class`.
Po Lu [Thu, 16 Nov 2023 03:29:58 +0000 (11:29 +0800)]
Pan during touch screen pinch gestures
* doc/lispref/commands.texi (Touchscreen Events): Document new
ratio-diff parameter to touchscreen-pinch events.
* lisp/completion-preview.el (completion-preview-commands):
Account text-conversion events preview commands as well.
* lisp/touch-screen.el (touch-screen-aux-tool): Introduce two
new elements.
(touch-screen-pinch): Scroll window in accord with event deltas.
(touch-screen-handle-aux-point-update): Supply the ratio
difference in generated events.
(touch-screen-handle-touch): Create a vector with those two new
elements.
Juri Linkov [Wed, 15 Nov 2023 17:44:04 +0000 (19:44 +0200)]
Enable completion-in-region-mode in minibuffer-complete-history/defaults
* lisp/minibuffer.el (minibuffer-complete-history)
(minibuffer-complete-defaults): Let-bind completion-in-region-mode-predicate
to lambda that checks if the "*Completions*" buffer window is visible.
This enables completion-in-region-mode that supports arrows
with minibuffer-visible-completions.
Spencer Baugh [Fri, 10 Nov 2023 12:20:09 +0000 (07:20 -0500)]
Signal file-locked on lock conflict with noninteractive=t
Previously we would signal a generic error on lock conflict when
noninteractive=t. That meant that non-interactively handling a lock
conflict would require catching all errors and checking the string in
DATA.
Now we just signal file-locked instead, which matches the interactive
behavior when the user says "q" at the prompt.
Also, when noninteractive, we signal before we write the prompt about
the lock conflict. That prompt usually gets in the way of
noninteractively handling and suppress lock conflict errors. The
signal data contains all the necessary information, we don't need to
write a separate message for noninteractive.
* lisp/userlock.el (ask-user-about-lock): Signal file-locked on
noninteractive lock conflict. (bug#66993)
* doc/lispref/commands.texi (Touchscreen Events): Address touch
screen pinch events and the process by which they are produced.
* java/org/gnu/emacs/EmacsWindow.java (figureChange)
<ACTION_POINTER_DOWN>: Supply pointer index to getX and getY,
correcting a mistake where the first touch point's coordinate
was saved here in lieu of the pointer that was pressed's.
* lisp/touch-screen.el (touch-screen-current-tool): Revise doc
string.
(touch-screen-aux-tool): New variable.
(touch-screen-scroll-point-to-y, touch-screen-pinch): New
functions.
(global-map): Bind [touchscreen-pinch] to touch-screen-pinch.
(touch-screen-handle-point-update): Revise doc string; set new
tenth field of t-s-c-t to POINT relative to its window, without
regard to whether an event has been sent.
(touch-screen-distance, touch-screen-centrum): New functions.
(touch-screen-handle-aux-point-update): New function; generate
and send touchscreen-pinch if need be.
(touch-screen-handle-point-up): If an ancillary tool exists,
transfer the information there into touch-screen-current-tool
and clear t-s-a-t.
(touch-screen-handle-touch): Call t-s-a-p-u as is proper; set
t-s-a-t if a touchscreen-down event arrives and t-s-c-t is set.
* src/androidterm.c (handle_one_android_event): Properly save
the event's X and Y when a new touch point is registered.
Eli Zaretskii [Tue, 14 Nov 2023 13:14:01 +0000 (15:14 +0200)]
Fix spell-checking email message with citations
This became broken 7 years ago, when the 'boundp condition was
removed, and with it an important unrelated part of the code.
* lisp/textmodes/ispell.el (ispell-message): Fix cite-regexp.
Po Lu [Tue, 14 Nov 2023 02:57:18 +0000 (10:57 +0800)]
Properly merge EXTRA_EMAIL content with mailto URIs
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate):
EXTRA_EMAIL is an array rather than a string, so insert
its first element into an empty mailto URI.
Harald Jörg [Mon, 13 Nov 2023 15:39:20 +0000 (16:39 +0100)]
; cperl-mode.el: Eliminate warnings about using obsolete functions
* lisp/progmodes/cperl-mode.el (cperl-info-on-current-command):
Use cperl-perldoc instead of cperl-info-on-command.
(cperl-imenu-on-info): Shortcut this function since the Perl info
file can no longer be installed.
The compiler didn't cancel aliasing if the aliased variable was
modified in a variable binding in the same `let` that created
the alias. For example,
(let ((x A))
(let ((y x)
(z (setq x B)))
y))
would incorrectly substitute y->x in the body form despite x being
already modified at that point, which normally should have cancelled
the aliasing.
Bug reported by Alan Mackenzie.
* lisp/emacs-lisp/byte-opt.el (byte-optimize--aliased-vars):
Now an alist that also contains the aliases; update the doc string.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form):
Detect aliasing early for `let`-bound variables as well.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test cases.
Juri Linkov [Mon, 13 Nov 2023 07:09:15 +0000 (09:09 +0200)]
* lisp/vc/vc-hooks.el (vc-display-status): New value 'no-backend' (bug#66464).
* lisp/vc/vc-hooks.el (vc-default-mode-line-string): Use it.
* lisp/vc/vc-git.el (vc-git-mode-line-string): Use it.
* lisp/vc/vc-hg.el (vc-hg-mode-line-string): Use it.