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.
F. Jason Park [Fri, 10 Nov 2023 21:34:31 +0000 (13:34 -0800)]
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules
chapter.
* etc/ERC-NEWS: Mention new module `command-indicator'.
* lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the
nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'.
(erc-noncommands-mode, erc-noncommands-enable,
erc-noncommands-disable): Deprecate this module because it's a no-op.
(erc-command-indicator-face, erc-command-indicator): Migrate from main
library.
(erc-command-indicator-mode, erc-command-indicator-enable,
erc-command-indicator-disable): New module to take the spiritual place
of `noncommands'.
(erc-command-indicator): Move function here from main library, along
with option namesake mentioned above.
(erc-command-indicator-toggle-hidden): New command to toggle echoed
command-line visibility.
(erc--command-indicator-permit-insertion): New function.
(erc--command-indicator-display): New function, a slightly revised
version of the old `erc-display-command' from the main library. Its
only call site was removed back in d1036d288de "backport: erc
bugfixes". However, references were left behind to associated assets,
like `erc-command-indicator', etc. The function was later commented
out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for
`erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove
duplicate ERC prompt on reconnect".
* lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new
non-module-specific name for `erc-match--toggle-hidden'.
(erc-match--toggle-hidden): Move to main library for shared use by
other modules.
* lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated
role.
(erc-command-indicator): Move option and function of same name to
erc-goodies.
(erc-command-indicator-face): Move to erc-goodies.
(erc-modules): Remove module `noncommands' from standard value and
Custom set. Add `command-indicator' to set.
(erc--toggle-hidden): "New" function, a rebranded version of the
utility `erc-match--toggle-hidden' from erc-match.
(erc--send-input-lines): Accommodate modules wanting alternate
insertion functions.
(erc-load-irc-script-lines): Account for `erc-command-indicator' no
longer being defined in this library.
* test/lisp/erc/erc-scenarios-base-send-message.el
(erc-scenarios-base-send-message--command-indicator): New test.
* test/lisp/erc/erc-tests.el (erc-tests--modules): Remove
deprecated module `noncommands' from manifest. (Bug#67031)
F. Jason Park [Thu, 9 Nov 2023 05:20:54 +0000 (21:20 -0800)]
Simplify default text props for ERC input
* lisp/erc/erc.el (erc--msg-props): Reformat doc string to improve
readability.
(erc-send-current-line): Don't bind `erc--msg-prop-overrides' because
doing so affects all scoped calls to `erc-display-message' made by
slash commands, etc. and makes handling overly complex and error
prone.
(erc-display-msg): Set `erc-msg' property to `msg' instead of `self'
because the only legitimate use of this function is for inserting
"echoed" prompt input. (Bug#60936 and Bug#67031)
F. Jason Park [Mon, 18 Sep 2023 10:39:57 +0000 (03:39 -0700)]
Allow opting out of empty message padding in ERC
* lisp/erc/erc.el (erc--allow-empty-outgoing-lines-p): New internal
variable.
(erc-send-input-line, erc--run-send-hooks): Don't pad output when
`erc--allow-empty-outgoing-lines-p' is non-nil. (Bug#67031)
F. Jason Park [Sat, 10 Jun 2023 04:00:03 +0000 (21:00 -0700)]
Make nested input handling more robust in ERC
* lisp/erc/erc.el (erc--send-action-function): New function-valued
variable for locally advising `erc-send-action' so that built-in
modules can elect to handle insertion and sending themselves.
(erc-send-action): Defer to `erc--send-action-function'.
(erc--send-action-perform-ctcp): Isolate the message-sending business
for CTCP ACTIONs that used to reside in `erc-send-action'.
(erc--send-action-display): Isolate the message-insertion business
formerly residing in `erc-send-action' for more granular use. Fix a
minor bug involving inserted representations of CTCP ACTIONs not
having `erc-my-nick-face' applied to the speaker.
(erc--send-action): Perform the same displaying and sending of CTCP
ACTION messages formerly handled by `erc-send-action', but display
messages before sending them.
(erc--current-line-input-split): New variable bound to the post-review
`erc--input-split' object for the extent of display processing. This
mainly benefits slash-command handlers and the utility functions they
employ, such as `erc-send-message'.
(erc-cmd-SAY): Defer to `erc--send-message'.
(erc--send-message-nested-function): New function-valued variable
supporting an internal interface for influencing how
`erc-send-message' inserts and sends prompt input. Some handlers for
slash commands, like /SV, use `erc-send-message' to perform their own
insertion and sending, which is normally the domain of
`erc-send-current-line'. When this happens, modules can't easily
leverage the normal hook-based API to do things like suppress
insertion but allow sending or vice-versa. This variable provides an
internal seam for modules to exert such influence.
(erc-send-message): Behave specially when called by the default
interactive client via `erc-send-current-line' and friends.
(erc--send-message-external): New function to house the former body of
`erc-send-message', for third-party code needing to apply the
traditional behavior.
(erc--send-message-nested): New function for turning arbitrary text,
such as replacement prompt input, into outgoing message text by doing
things like ensuring "send" hooks run and invariants for prompt
markers are preserved.
(erc--make-input-split): New helper function for creating a standard
`erc--input-split' object from a string. This is arguably less
confusing than adding another constructor to the struct definition.
(erc-send-current-line): Bind `erc--current-line-input-split' when
dispatching prompt-input handlers. Use helper `erc--make-input-split'
to initialize working `erc--input-split' state object.
(erc--run-send-hooks): Honor existing `refoldp' slot from
`erc--input-split' object.
(erc--send-input-lines): Convert to generic function to allow modules
control over fundamental insertion and sending operations, which is
necessary for next-generation features, like multiline messages.
(erc-modes): Don't output non-modules. That is, only list actual
modules created via `define-erc-module', and `quote' members of the
resulting list.
* test/lisp/erc/erc-scenarios-base-send-message.el: New test file.
* test/lisp/erc/resources/base/send-message/noncommands.eld: New data
file. (Bug#67031)
F. Jason Park [Fri, 15 Jul 2022 12:02:35 +0000 (05:02 -0700)]
Always run erc-server-send-queue via timer
* lisp/erc/erc-backend.el (erc--server-send, erc-server-send): Convert
the latter into a wrapper that calls the former, a "new" internal
generic function, so that built-in modules can do things like prepend
tags to outgoing messages and send messages over other transports or
proxy protocols. Extend the `no-penalty' parameter to mean ERC will
schedule an imminent send via a timer. And always run the function
`erc-server-send-queue' on a timer. (Bug#67031)
F. Jason Park [Thu, 9 Nov 2023 03:14:55 +0000 (19:14 -0800)]
Make ERC's error-notice formatting more consistent
* lisp/erc/erc-backend.el (erc--server-propagate-failed-connection):
Include leading three-asterisk notice prefix when reporting process
exit status, and set the `erc-msg' text property to `notice-error'.
(erc-schedule-reconnect): Include leading notice prefix when inserting
`reconnecting' message.
* lisp/erc/erc.el (erc-process-input-line, erc-cmd-PART,
erc-cmd-TOPIC): Display `no-target' messages as "error notices".
(erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect): Hard-code standard
value of `erc-notice-prefix' into message text for consistency during
formatting and insertion.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Expect notice
prefix before `no-target' message. (Bug#67031)
F. Jason Park [Sun, 3 Sep 2023 23:05:59 +0000 (16:05 -0700)]
Offer alternate pool-creation strategies in erc-nicks
* lisp/erc/erc-nicks.el (erc-nicks-bg-color): Expand doc string.
(erc-nicks-colors): Add new choices `font-lock' and `ansi-color'.
(erc-nicks--adjust-contrast): Add assertion to prevent dependency bug
from resurfacing when hacking on module activation code.
(erc-nicks--create-pool-function): New function-valued variable to
specify a pool creation strategy. Note in doc string that this could
form the basis for a possible user option should the need arise.
(erc-nicks--create-coerced-pool): New function for filtering
user-provided `erc-nicks-color' values.
(erc-nicks--create-pool, erc-nicks--create-culled-pool): Rename former
to latter.
(erc-nicks--init-pool): Call `erc-nicks--create-pool-function' to
actually create pool. Account for new `erc-nicks-colors' values.
(erc-nicks-enable, erc-nicks-mode): Set `erc-nicks--fg-rgb' before
`erc-nicks--init-pool' to prevent type error in filters that depend on
that variable being initialized. This is a bug fix.
(erc-nicks-refresh): Provide helpful user error instead of letting
`arith-error' propagate due to an empty pool.
(erc-nicks--colors-from-faces): New helper function.
* test/lisp/erc/erc-nicks-tests.el (erc-nicks--create-pool,
erc-nicks--create-culled-pool): Rename test from former to latter and
update function invocations to reflect that.
(erc-nicks--create-coerced-pool): New test. (Bug#63569)
F. Jason Park [Mon, 6 Nov 2023 00:03:15 +0000 (16:03 -0800)]
Don't use func-arity to trigger API warning in url-irc
* lisp/url/url-irc.el (url-irc): Use more robust `condition-case'
pattern instead, which will still fail when met with various edge
cases. The old way was only useful for non-variadic lambda lists
consisting entirely of named positional parameters. (Bug#56514)
Stefan Monnier [Sun, 12 Nov 2023 16:37:38 +0000 (11:37 -0500)]
(derived-mode-all-parents): Fix handling of cycles
* lisp/subr.el (derived-mode-all-parents): Fix the handling of cycles
so that it doesn't fill the cache with incorrect results.
(merge-ordered-lists): Improve docstring.
(provided-mode-derived-p): Swap the loops since `modes` is usually
shorter than `ps`.
* test/lisp/subr-tests.el (subr-tests--parent-mode): Simplify.
(subr-tests--mode-A, subr-tests--mode-B, subr-tests--mode-C): New funs.
(subt-tests--derived-mode-add-parents): New test.
Stephen Berman [Sun, 12 Nov 2023 13:58:58 +0000 (14:58 +0100)]
Add support in todo-mode.el for ISO date format
* lisp/calendar/todo-mode.el (todo--date-pattern-groups): New defconst.
(todo-date-pattern): Use it to extend pattern matching of
`calendar-date-display-form' to support the ISO date format in
todo item date headers (bug#66395, bug#55284).
(todo-edit-item--header): Make it work with ISO date strings.
Po Lu [Sun, 12 Nov 2023 03:44:58 +0000 (11:44 +0800)]
Adjust dump file location under Android
* java/org/gnu/emacs/EmacsApplication.java (EmacsApplication)
<apkFileName>: New field.
(getApkFile): Move from EmacsService.java.
(findDumpFile): If the dump file is older than the APK, delete
it irrespective of whether the checksums agree.
(onCreate): Initialize apkFileName.
* java/org/gnu/emacs/EmacsService.java (onCreate): Use
EmacsApplication.apkFileName.
* src/android.c (android_on_low_memory): Correct arguments to
Fclear_image_cache.
* src/image.c (Fclear_image_cache): Check that animation_cache
is always a cons.