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.
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).
Stephen Berman [Wed, 8 Nov 2023 23:13:06 +0000 (00:13 +0100)]
Prevent an infinite loop in todo-mode (bug#66994)
* lisp/calendar/todo-mode.el (todo-item-start): Moving an item to
a todo file (with `C-u m') that had not yet been read into a
buffer puts point at the beginning of the file, from where it is
impossible to reach todo-item-start by this function, so don't try
in that case.
Alan Mackenzie [Wed, 8 Nov 2023 20:49:48 +0000 (20:49 +0000)]
With `native-compile', compile lambdas in a defun or lambda too
This fixes bug#64646. Also refactor two functions to reduce
code duplication.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol)
(comp-spill-lap-function/list): Add all functions found by the
byte compiler (including lambdas) to the native compiler's
context, thus making them be native compiled. Refactor to use
comp-intern-func-in-ctxt. Make comp-spill-lap-function/list
also compile closures.
* test/src/comp-resources/comp-test-funcs.el
(comp-tests-lambda-return-f2): New function
* test/src/comp-tests.el (comp-test-lambda-return2)
(comp-tests-free-fun-f2): New functions to test that internal
lambdas get native compiled.
Randy Taylor [Wed, 1 Nov 2023 02:08:25 +0000 (22:08 -0400)]
Fix cmake-ts-mode indentation (Bug#66845)
* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--indent-rules):
Support versions v0.3.0 and v0.4.0 of the grammar.
(cmake-ts-mode--font-lock-compatibility-fe9b5e0): Fix docstring.
* lisp/progmodes/project.el (project-remember-projects-under): Instead
of traversing the directories manually, re-use
`directory-files-recursively' to reduce complexity. (Bug#66649)
Po Lu [Wed, 8 Nov 2023 03:03:57 +0000 (11:03 +0800)]
Don't leave point amid text conversion edits if auto-fill transpires
* lisp/simple.el (analyze-text-conversion): Save point in
old-point after auto-fill completes, so that point-moved is not
set if point remains intact subsequent to the execution of both
hooks.
João Távora [Wed, 25 Oct 2023 12:45:01 +0000 (13:45 +0100)]
Allow completion frontends to fontify candidates just-in-time
bug#48841, bug#47711
The variable may be bound by the frontend to a non-nil around
completion-producing calls like completion-all-completions. See
completion-lazy-hilit docstring for more info.
* lisp/minibuffer.el (completion-lazy-hilit): New variable.
(completion-lazy-hilit): New function.
(completion-lazy-hilit-fn): New variable.
(completion-pcm--regexp)
(completion--flex-score-last-md): New helper variables.
(completion--flex-score-1): New helper.
(completion-pcm--hilit-commonality): Use completion-lazy-hilit.
(completion--flex-adjust-metadata): Rework sorting code.
Po Lu [Mon, 6 Nov 2023 02:14:09 +0000 (10:14 +0800)]
Emulate secondary selections on Android
* doc/lispref/frames.texi (Other Selections): Revise
documentation to match.
* lisp/term/android-win.el (android-secondary-selection): New
variable.
(android-primary-selection, android-get-clipboard-1)
(android-get-primary, gui-backend-get-selection)
(gui-backend-selection-exists-p, gui-backend-selection-owner-p)
(gui-backend-set-selection): Update doc strings and code as is
proper.
Juri Linkov [Sun, 5 Nov 2023 17:52:33 +0000 (19:52 +0200)]
New option to use arrows in the minibuffer to select completions (bug#59486)
* lisp/minibuffer.el (minibuffer-visible-completions): New defcustom.
(minibuffer-visible-completions-bind): New function.
(minibuffer-visible-completions-map): New defvar-keymap.
(minibuffer-mode): Set buffer-local minibuffer-completion-auto-choose
to nil for minibuffer-visible-completions.
(completing-read-default, completion-in-region-mode):
Use minibuffer-visible-completions to compose keymap
with minibuffer-visible-completions-map.
(minibuffer-next-completion): Add new arg VERTICAL,
and use next-line-completion.
(minibuffer-next-line-completion)
(minibuffer-previous-line-completion): New commands.
Po Lu [Sun, 5 Nov 2023 02:40:52 +0000 (10:40 +0800)]
Implement more Android text editing controls
* lisp/term/android-win.el (android-deactivate-mark-command):
New command.
(select-all, start-selecting-text, stop-selecting-text): Arrange
for commands manipulating the region to be executed when these
keys are registered.
* src/android.c (android_get_keysym_name): Return the keysym
name of each of the new keysyms introduced.
* src/androidterm.c (performContextMenuAction): Save special
keysyms into key events for the selectAll, startSelectingText
and stopSelectingText actions.
Dmitry Gutov [Sun, 5 Nov 2023 00:35:25 +0000 (02:35 +0200)]
Add project-any-command and project-prefix-or-any-command
* lisp/progmodes/project.el (project-any-command): New command.
(project-prefix-map): Bind it to 'o'.
(project-switch-commands): Add entry for it here too.
(project-prefix-or-any-command): New command (bug#63648).
(project-switch-commands): Update the custom type to mention
'project-prefix-or-any-command' as well.
* etc/NEWS: Document the change.
F. Jason Park [Fri, 3 Nov 2023 00:05:48 +0000 (17:05 -0700)]
Align date stamps to whole days in ERC
* lisp/erc/erc-stamp.el (erc-stamp--current-time): Ditch overriding
precedence of the `erc--ts' property in `:around' method because the
variable `erc-stamp--current-time' fills that role well enough.
(erc-stamp--current-datestamp-left): Remove unused variable.
(erc-stamp--insert-date-stamp-as-phony-message): Assume
`erc-timestamp-last-inserted-left' has already been assigned the
updated rendered stamp for the current time.
(erc-stamp--lr-date-on-pre-modify): Use the variable
`erc-stamp--current-time' instead of the `erc-ts' property to convey
an overriding time value for `erc-add-timestamp'. Set
`erc-timestamp-last-inserted-left' instead of fiddling with another
temporary variable to hack around these ill-fitting interfaces. Use
day-aligned time value for the `erc-ts' property assigned to date
stamps.
(erc-stamp--date-mode): New internal minor mode.
(erc-insert-timestamp-left-and-right): Defer to `erc-stamp--date-mode'
for setting up date-stamp specific hooks.
(erc-stamp--time-as-day): New function to "round" a date stamp to
start of local day.
(erc-stamp--setup): Defer to `erc-stamp--date-mode' for date-stamp
specific teardown. (Bug#60936)
* test/lisp/erc/erc-fill-tests.el
(erc-fill-tests--current-time-value): Change default value to nil.
(erc-stamp--current-time): New method for test cases.
(erc-fill-tests--insert-privmsg): Use realistic value for `unparsed'
slot.
(erc-fill-tests--wrap-populate): Bind
`erc-fill-tests--current-time-value' to 0. Don't mock the function
`erc-stamp--current-time' because doing so inhibits normal polymorphic
dispatch, which test cases rely on for delivering correct timestamp
values in varied contexts.
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
F. Jason Park [Sat, 4 Nov 2023 20:48:11 +0000 (13:48 -0700)]
Decouple disparate escape-hatch concerns in erc-stamp
* lisp/erc/erc-stamp.el (erc-stamp--allow-unmanaged): Improve doc
string.
(erc-stamp--permanent-cursor-sensor-functions): New variable to take
over the formerly provided `cursor-sensor-functions' aspect of the
flag `erc-stamp--allow-unmanaged'.
(erc-add-timestamp): Use
`erc-stamp--permanent-cursor-sensor-functions' instead of
`erc-stamp--allow-unmanaged' in guard condition.
(erc-munge-invisibility-spec): Use dedicated compatibility flag
`erc-stamp--permanent-cursor-sensor-functions' and forgo unnecessary
setup when it's non-nil. (Bug#60936)
F. Jason Park [Sat, 4 Nov 2023 18:08:22 +0000 (11:08 -0700)]
Preserve user markers when inserting ERC date stamps
* lisp/erc/erc-stamp.el
(erc-stamp--insert-date-stamp-as-phony-message): Ensure existing
user markers aren't displaced by date-stamp insertion.
* lisp/erc/erc.el (erc--insert-line-function): New function-valued
variable for overriding `insert'.
(erc-insert-line): Call `erc--insert-line-function', when non-nil, to
insert line specially.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-insert-modify): New assertion helper
function.
(erc-scenarios-stamp--date-mode/left-and-right): New test.
(Bug#60936)
F. Jason Park [Thu, 2 Nov 2023 02:22:49 +0000 (19:22 -0700)]
Don't over-truncate erc-timestamp-format-left
* lisp/erc/erc-stamp.el (erc-timestamp-format-left): Fix typo in doc
string and mention that changing the value mid-session requires
cycling the minor mode.
(erc-echo-timestamp-format): Add Custom :tag for choices.
(erc-stamp--date-format-end): Revise doc string.
(erc-stamp--format-date-stamp): Fix bug involving erroneous truncation
parameter for `substring' when `erc-timestamp-format-left' doesn't end
in a newline. Thanks to Emanuel Berg for catching this.
(erc-stamp-prepend-date-stamps-p) Revise doc string.
(erc-insert-timestamp-left-and-right): Add comment regarding
compatibility concession. (Bug#60936)
F. Jason Park [Fri, 3 Nov 2023 23:07:20 +0000 (16:07 -0700)]
Really fix off-by-one in erc--get-inserted-msg-bounds
* lisp/erc/erc.el (erc--get-inserted-msg-bounds): Account for
`previous-single-property-change' returning a position adjacent to
that with an actual changed value. The prior attempt at addressing
this was insufficient.
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds): New test.
; * test/lisp/erc/resources/base/local-modules/second.eld: Timeout.
; * test/lisp/erc/resources/base/local-modules/third.eld: Timeout.
Stefan Kangas [Sat, 4 Nov 2023 13:51:33 +0000 (14:51 +0100)]
Make FAQ on starting Emacs maximized portable
* doc/misc/efaq.texi (Start Emacs Maximized): Rename node from
"Fullscreen mode on MS-Windows". Make advice portable to other
platforms, and remove MS-Windows specific hacks.
Ref: https://lists.gnu.org/r/emacs-devel/2023-10/msg00733.html
Co-authored-by: David Hedlund <public@beloved.name>
Jens Schmidt [Wed, 1 Nov 2023 18:56:06 +0000 (19:56 +0100)]
Add tests for saving to write-protected files
* test/lisp/files-tests.el (files-tests--with-yes-or-no-p): Add macro.
(files-tests-save-buffer-read-only-file): Add test for writing to
write-protected files with `save-buffer'. (Bug#66546)
Eli Zaretskii [Sat, 4 Nov 2023 07:33:33 +0000 (09:33 +0200)]
Remove unnecessary assertion added 2 days ago
* src/xdisp.c (get_glyph_face_and_encoding): Remove unnecessary
assertion. It triggers, for no good reason, when running the
recipe of bug#66922 and typing C-p in the *Warnings* buffer after
the recipe finishes, because the glyph passed to this function is
a STRETCH_GLYPH, not a CHAR_GLYPH.
Po Lu [Fri, 3 Nov 2023 03:32:17 +0000 (11:32 +0800)]
Avoid moving point while analyzing text conversion
* lisp/simple.el (analyze-text-conversion): If neither calling
p-s-i-h nor calling p-t-c-h yields a change to point, return it
to its location before analyze-text-conversion was called.
* src/keyboard.c (kbd_buffer_get_event): See that text
conversion events are uniformly delivered prior to keyboard
events arriving in unison.
Dmitry Gutov [Thu, 2 Nov 2023 23:40:36 +0000 (01:40 +0200)]
Remove 'M-.' binding from js-mode and js-ts-mode
* lisp/progmodes/js.el (js-mode-map, js-ts-mode-map): Remove.
The global binding must be a lot more useful for most users
(https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg01295.html).
Po Lu [Thu, 2 Nov 2023 05:18:37 +0000 (13:18 +0800)]
Properly compute overhangs for overstruck text
* src/xdisp.c (get_glyph_face_and_encoding): Account for
non-character glyphs by not attempting to translate them to
characters.
(gui_get_glyph_overhangs, gui_produce_glyphs): If the face is
overstruck, increase the right side bearing by 1 pixel.
F. Jason Park [Tue, 31 Oct 2023 23:50:16 +0000 (16:50 -0700)]
Preserve point when inserting date stamps in ERC
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-disable): Move
remaining local teardown business to `erc-stamp--setup' and use
`erc-buffer-do' instead of `erc-with-all-buffers-of-server' to
emphasize that all ERC buffers are affected.
(erc-stamp--insert-date-stamp-as-phony-message): Move `erc--msg-props'
binding to `erc-stamp--lr-date-on-pre-modify'.
(erc-stamp--lr-date-on-pre-modify): Bind `erc--msg-props' here so that
the related guard condition in `erc-add-timestamp' is satisfied and
`erc-insert-timestamp-function' runs. This fixes a regression new in
ERC 5.6 and introduced by c68dc778 "Manage some text props for ERC
insertion-hook members". Also, `save-excursion' when narrowing to
prevent point from being dislodged after submitting input at the
prompt.
(erc-insert-timestamp-left-and-right): Don't initialize date stamps
when `erc-timestamp-format-left' is nil or consists only of newlines,
and enable fallback behavior in such cases on behalf of users without
informing them. Allow global hook members to run first so that those
owned by `scrolltobottom' and similar can see the unadulterated input.
Fix wrong hook name.
(erc-stamp--setup): Fix wrong hook name. Kill all local vars here
instead of sharing this duty with the minor-mode toggle. (Bug#60936)
F. Jason Park [Tue, 31 Oct 2023 06:36:54 +0000 (23:36 -0700)]
; Attempt to fix race in erc-buffer-display test
* test/lisp/erc/erc-fill-tests.el (erc-fill-tests--time-vals,
erc-fill-tests--current-time-value): Rename former to latter and
change type from function to natnum.
(erc-fill-tests--wrap-populate, erc-fill-wrap--merge,
erc-fill-wrap--merge-action): Use `erc-fill-tests--current-time-value'
instead of function `erc-fill-tests--time-vals'.
* test/lisp/erc/erc-scenarios-base-association.el
(erc-scenarios-common--base-association-multi-net): Extend timeout.
* test/lisp/erc/erc-scenarios-base-buffer-display.el
(erc-scenarios-base-buffer-display--reconnect-common): Move some
common assertions here from callers.
(erc-scenarios-base-buffer-display--defwin-recbury-intbuf,
erc-scenarios-base-buffer-display--count-reset-timeout):
Factor out a couple common assertions. Clarify some comments.
(erc-scenarios-base-buffer-display--defwino-recbury-intbuf):
Factor out a couple common assertions and clarify some comments.
Account for possible concurrency bug leading to intermittent
test failures.
* test/lisp/erc/erc-scenarios-base-misc-regressions.el
(erc-scenarios-base-gapless-connect,
erc-scenarios-base-channel-buffer-revival): Extend timeouts.
* test/lisp/erc/resources/dcc/chat/accept.eld: Extend timeout.
* test/lisp/erc/resources/base/reconnect/options-again.eld: Extend
timeouts.
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--m): Prevent possible
wrong-type error.
* test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Extend
timeouts.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--base-network-id-bouncer): Extend timeout.
Juri Linkov [Wed, 1 Nov 2023 17:45:05 +0000 (19:45 +0200)]
New commands previous-line-completion and next-line-completion (bug#59486)
* lisp/simple.el (completion-list-mode-map): Bind [up] to
'previous-line-completion', and [down] to 'next-line-completion'.
(completion-auto-wrap): Mention `next-line-completion' and
`previous-line-completion' in the docstring.
(previous-line-completion, next-line-completion): New commands.
* etc/NEWS: Mention user option 'Man-support-remote-systems'.
Fix typos.
* lisp/dired.el (Man-support-remote-systems): Declare.
(dired-do-man): Use it. Use also `file-local-name'.
* lisp/man.el (Man-support-remote-systems): New defcustom.
(Man-xref-normal-file): Handle remote files.
(Man-default-directory, Man-shell-file-name)
(Man-header-file-path): New defuns.
(Man-init-defvars): Use octal numbers.
(Man-support-local-filenames): Handle remote files.
(Man-completion-table): Use `Man-default-directory' and `process-file'.
(man): Adapt docstring.
(Man-start-calling): Use `Man-default-directory'.
(Man-getpage-in-background): Use `Man-default-directory',
`Man-shell-file-name', `start-file-process' and `process-file'. Adapt
buffer name.
(Man-update-manpage): Use `Man-shell-file-name' and `process-file'.
(Man-view-header-file): Use `Man-header-file-path'.