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.
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.
Stefan Monnier [Tue, 7 Nov 2023 23:57:03 +0000 (18:57 -0500)]
Move EIEIO's C3 linearization code to `subr.el`
The code was used to linearize the EIEIO class hierarchy, since
it results in saner results than things like BFS or DFS.
By moving it to `subr.el` we get to benefit from that same
advantage both in `cl--class-allparents` and
in `derived-mode-all-parents`.
* lisp/subr.el (merge-ordered-lists): New function.
(derived-mode-all-parents): Use it to improve parent ordering.
* lisp/emacs-lisp/eieio-core.el (eieio--c3-candidate)
(eieio--c3-merge-lists): Delete functions, replaced by
`merge-ordered-lists`.
(eieio--class-precedence-c3): Use `merge-ordered-lists`.
* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents):
Use `merge-ordered-lists` to improve parent ordering.
* lisp/emacs-lisp/cl-macs.el (cl--struct-all-parents): Delete function.
(cl--pcase-mutually-exclusive-p): Use `cl--class-allparents` instead.
João Távora [Sat, 11 Nov 2023 15:29:46 +0000 (15:29 +0000)]
Fix test failures in test/lisp/minibuffer-tests.el
bug#48841, bug#47711
In some instances the test code needed to be updated to make different
assumptions about implementation details.
In others, like the ones about the completions-first-difference face,
minor parts of the actual user-visible behaviour were broken.
* test/lisp/minibuffer-tests.el (completion-test1): Robustify test.
(completion--pcm-score): Don't assume completion-score is stored
in string as a property.
* lisp/minibuffer.el (completion--hilit-from-re): Take new parameter.
(completion-pcm--hilit-commonality): Use it.
Po Lu [Sat, 11 Nov 2023 10:03:33 +0000 (18:03 +0800)]
Enable canceling tap gestures
* doc/lispref/commands.texi (Touchscreen Events): Relate new
THRESHOLD argument to touch-screen-track-tap.
* lisp/button.el (push-button):
* lisp/wid-edit.el (widget-button--check-and-call-button):
Provide a threshold to enable canceling button presses.
* lisp/touch-screen.el (touch-screen-track-tap): Enable
canceling tap gestures and resuming touch sequence translation
if the touch point exceeds a set threshold.
Eli Zaretskii [Sat, 11 Nov 2023 10:02:24 +0000 (12:02 +0200)]
Improve documentation of read syntax and printed representation
* doc/lispref/objects.texi (Syntax for Strings): Describe in more
detail how to specify special characters in string literals.
(Printed Representation, Character Type, Nonprinting Characters):
Improve information and add cross-references about printed
representation and read syntax. (Bug#67033)
Jim Porter [Sat, 11 Nov 2023 01:53:02 +0000 (17:53 -0800)]
Add some more Eshell history tests
* test/lisp/eshell/em-hist-tests.el (em-hist-test/check-history-file):
New function. Use it throughout this file.
(em-hist-test/history-append): Rename to...
(em-hist-test/write-history/append): ... this.
(em-hist-test/history-read): Rename to...
(em-hist-test/write-history/overwrite): ... this.
(em-hist-test/write-history/append-multiple-eshells)
(em-hist-test/write-history/overwrite-multiple-shells): New tests.
(em-hist-test/write-history/read-only): Check the resulting history.
Liu Hui [Tue, 7 Nov 2023 01:10:59 +0000 (09:10 +0800)]
Improve read/append behavior of eshell history command
* lisp/eshell/em-hist.el (eshell-hist--new-items): New variable.
(eshell-hist-initialize): Initialize 'eshell-hist--new-items' to 0.
(eshell/history): Change the behavior of 'history -a' to "append new
history in current buffer to history file". Clarify the help text of
'history -r'.
(eshell-add-input-to-history): Increase counter of new history items.
(eshell-read-history): Respect 'eshell-hist-ignoredups' option.
(eshell-write-history): If the optional argument APPEND is non-nil,
appending new history items rather than the whole history.
* test/lisp/eshell/em-hist-tests.el (em-hist-test/history-append)
(em-hist-test/history-read): New tests (bug#66768).
Eli Zaretskii [Fri, 10 Nov 2023 19:54:35 +0000 (21:54 +0200)]
Fix mode-line after switching from WDired back to Dired
* lisp/wdired.el (wdired-change-to-dired-mode): Call
'dired-sort-set-mode-line' to set the mode name in the mode line,
so as to restore the display before switching to WDired.
(Bug#67028)
Eric Abrahamsen [Fri, 10 Nov 2023 16:35:04 +0000 (17:35 +0100)]
Add some headers to message-ignored-bounced-headers
* lisp/gnus/message.el (message-ignored-bounced-headers): These are
headers that a) are derived from the exact text of the message and
thus are now invalid and b) either will be automatically regenerated
when the message is sent or shouldn't be present on the message copy
at all.
Use BASE_EQ instead of EQ for some uninterned symbols
* src/editfns.c (labeled_restrictions_pop, Fwiden):
* src/eval.c (lexbound_p, Fbacktrace__locals):
* src/fileio.c (Finsert_file_contents):
* src/fns.c (Fyes_or_no_p):
* src/keyboard.c (command_loop_1):
Use BASE_EQ for comparing with Qoutermost_restriction,
Qinternal_interpreter_environment and Qunbound as uninterned
symbols won't be EQ to a symbol-with-pos.
* java/org/gnu/emacs/EmacsService.java (onLowMemory): New
function.
* src/android.c (android_on_low_memory, onLowMemory): New
functions called when a VM caution is registered. Clear
the image cache and run garbage collection.
Yuan Fu [Fri, 10 Nov 2023 05:09:48 +0000 (21:09 -0800)]
Replace treesit--things-around with new functions (bug#66989)
* lisp/treesit.el (treesit-forward-sexp):
Replace things-around with thing-at.
(treesit--navigate-thing): Replace things-around with
thing-prev/next/at. Also this should fix the problem described in
bug#66989.
(treesit-thing-at-point): Replace things-around with thing-at.
Juri Linkov [Thu, 9 Nov 2023 16:20:14 +0000 (18:20 +0200)]
Improve 'next-line-completion' and add more tests
* lisp/simple.el (next-line-completion): Improve (bug#59486).
Better handle the case when completion-auto-wrap is nil.
* test/lisp/minibuffer-tests.el (completion-auto-wrap-test)
(completions-header-format-test)
(completions-affixation-navigation-test): Add calls to
'next-line-completion' and 'previous-line-completion'.
(completions-group-navigation-test): New test.
Andrea Corallo [Wed, 25 Oct 2023 15:58:43 +0000 (17:58 +0200)]
comp: make comp-run don't require cl-lib at runtime
* lisp/emacs-lisp/comp-run.el (cl-lib): Require it only at compile
time.
(native-compile-async-skip-p): Use 'seq-some'.
(native--compile-async): Don't use 'cl-substitute'.
Avoid keeping 'completion-in-region-mode' on when exiting
'completion--in-region-1' if the *Completions* buffer isn't shown.
Otherwise, the bindings from 'completion-in-region-mode-map' linger,
notable shadowing other bindings for TAB.
* lisp/minibuffer.el (completion--in-region-1): Disable
'completion-in-region-mode' if the *Completions* buffer isn't visible.
Remove symbol `debug' from the condition-case handler of `error'
that was added in commit f931cebce76d911dfc61274e0a8c1de3627b9179
since it interferes on completing in an incomplete elisp form (bug#66979).
Stefan Monnier [Tue, 7 Nov 2023 00:05:40 +0000 (19:05 -0500)]
Use `derived-mode-add-parents` in remaining uses of `derived-mode-parent`
Until now multiple inheritance wasn't really used, but some ad-hoc
code went a bit beyond the normal uses of the mode hierarchy.
Use the new multiple inheritance code to replace that ad-hoc code,
thereby eliminating basically all remaining direct uses of the
`derived-mode-parent` property.
CEDET had its own notion of mode hierrchy using `derived-mode-parent`
as well as its own `mode-local-parent` property set via
`define-child-mode`.
`derived-mode-add-parents` lets us reimplement `define-child-mode`
such that CEDET can now use the normal API functions.
* lisp/locate.el (locate-mode): Use `derived-mode-add-parents`.
* lisp/cedet/mode-local.el (get-mode-local-parent): Declare obsolete.
(mode-local-equivalent-mode-p, mode-local-use-bindings-p): Make them
obsolete aliases.
(mode-local--set-parent): Rewrite to use `derived-mode-add-parents`.
Declare as obsolete.
(mode-local-map-mode-buffers): Use `derived-mode-p`.
(mode-local-symbol, mode-local--activate-bindings)
(mode-local--deactivate-bindings, mode-local-describe-bindings-2):
Use `derived-mode-all-parents`.
* lisp/cedet/srecode/table.el (srecode-get-mode-table):
* lisp/cedet/srecode/find.el (srecode-table, srecode-load-tables-for-mode)
(srecode-all-template-hash): Use `derived-mode-all-parents`.
* lisp/cedet/srecode/map.el (srecode-map-entries-for-mode):
* lisp/cedet/semantic/db.el (semanticdb-equivalent-mode):
Use `provided-mode-derived-p` now that it obeys `define-child-mode`.
Stefan Monnier [Wed, 8 Nov 2023 19:20:09 +0000 (14:20 -0500)]
(derived-mode-all-parents): Speed up with a cache
Most uses of the mode hierarchy don't really need to construct the
list, they just need to iterate over it. With single inheritance
we could do it just by jumping up from a mode to its parent,
but to support the upcoming multiple inheritance we'd need a more
complex and costly iterator.
Luckily, the inheritance graph is mostly static so we can cache
the list of all parents, making `derived-mode-all-parents` cheap
enough to be the basis of iteration and keeping the API very simple.
* lisp/subr.el (derived-mode-all-parents): Cache the result.
(derived-mode--flush): New function.
(derived-mode-set-parent): Use it.
Stefan Monnier [Wed, 8 Nov 2023 16:32:27 +0000 (11:32 -0500)]
subr.el: Provide a functional API around `derived-mode-parent`
The `derived-mode-parent` property should be an implementation detail,
so we can change it more easily. To that end, add functions to set and
query it.
* lisp/subr.el (derived-mode-all-parents): New function.
(provided-mode-derived-p): Use it.
(derived-mode-set-parent): New function.