Earl Hyatt [Sat, 19 Aug 2023 22:26:45 +0000 (18:26 -0400)]
Make using Edmacro easier for long sequences of keys
* lisp/edmacro.el (edmacro-set-macro-to-region-lines)
(edmacro-reverse-key-order): New command and user option to
make working with longer lists of keys, such as from
'kmacro-edit-lossage', easier.
(edit-kbd-macro): Move regexps used to identify parts of
buffer to internal variables.
(edmacro--macro-lines-regexp, edmacro-mode-font-lock-keywords):
Allow noting whether the most recent line of keys is displayed
first.
(edmacro-mode-map): Bind the new command to 'C-c C-r'.
(edmacro-mode): Describe the new command in the mode
documentation string.
* doc/emacs/kmacro.texi (Edit Keyboard Macro): Mention
'edmacro-insert-key' and the newly added
'edmacro-set-macro-to-region-lines' and
'edmacro-reverse-key-line-order'.
* etc/NEWS (Edmacro): Add section describing the new features.
Po Lu [Sat, 16 Sep 2023 02:38:46 +0000 (10:38 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (display): Return
false if the list of menu buttons is empty, lest Android cease
displaying menus on the assumption that Emacs is defective.
* src/fns.c (sort_list): Render sentence motion commands
functional within commentary
* src/sfntfont.c (sfntfont_list_family): Sort and deduplicate
the returned family list and make it a list of symbols.
(syms_of_sfntfont) <Qstring_lessp>: New defsym.
Stefan Monnier [Fri, 15 Sep 2023 18:44:59 +0000 (14:44 -0400)]
(mutually_exclusive_p): Fix the regression from commit 6fad73d7cc53
Commit 6fad73d7cc53 throws away some useful optimization because
it misfired in some cases (as seen in bug#657260). Here we try to
recover those useful optimizations with a slightly more careful
algorithm.
* src/regex-emacs.c (mutually_exclusive_aux): Rename from
`mutually_exclusive_p`. Add two new args. Improve the
case where we need to recurse.
(mutually_exclusive_p): New function defined on top of it.
* test/src/regex-emacs-tests.el (regexp-tests-backtrack-optimization):
Re-enable the test.
* src/regex-emacs.c (mutually_exclusive_exactn)
(mutually_exclusive_charset): New functions, extracted from
`mutually_exclusive_p`.
(mutually_exclusive_p): Use them.
Stefan Kangas [Fri, 15 Sep 2023 08:52:03 +0000 (10:52 +0200)]
Mark two tests as expensive
* test/lisp/calendar/todo-mode-tests.el
(todo-test-add-and-delete-file):
* test/lisp/simple-tests.el (simple-tests-shell-command-39067):
Mark tests taking more than 10 seconds to run on a MacBook Pro from
2015 as expensive.
Po Lu [Fri, 15 Sep 2023 02:30:12 +0000 (10:30 +0800)]
Correct bug#65919
* src/process.c (child_signal_notify): Expunge call to
non-reentrant function from signal handler.
* src/xfns.c (setup_xi_event_mask): Cease selecting for
XI_FocusIn and XI_FocusOut under X toolkit builds.
* src/xterm.c (xi_handle_interaction, xi_handle_focus_change)
(xi_handle_focus_change): Make conditional on GTK 3 or no
toolkit builds.
(xi_handle_delete_frame, x_free_frame_resources): Adjust
correspondingly.
(handle_one_xevent) <EnterNotify, LeaveNotify>: Examine
EnterNotify and LeaveNotify events for focus changes
irrespective of whether XI2 is enabled under the X toolkit and
GTK 2.x.
Po Lu [Thu, 14 Sep 2023 08:53:04 +0000 (16:53 +0800)]
Avert a crash in the Android last resort font driver
* java/org/gnu/emacs/EmacsFontDriver.java (FONT_INVALID_CODE):
New constant.
(hasChar, encodeChar): Accept a jint character code rather than
a jchar.
* java/org/gnu/emacs/EmacsSdk23FontDriver.java (hasChar)
(encodeChar): Return 0 or FONT_INVALID_CODE if the character is
not representable in a Java char.
Yuan Fu [Thu, 14 Sep 2023 02:16:04 +0000 (19:16 -0700)]
Fix treesit-font-lock-fontify-region wrt local parsers
* lisp/treesit.el (treesit--update-ranges-local): Minor change.
(treesit-font-lock-fontify-region): Don't try to fontify if node is
nil. Don't use alist-get to get the root node for a language: there
might be multiple root nodes (from multiple local parsers) for the
same language.
(treesit-major-mode-setup): Remove existing local parsers when major
mode is activated.
Po Lu [Thu, 14 Sep 2023 01:57:09 +0000 (09:57 +0800)]
Improve the Android last resort font driver
* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7Typeface):
Rename fileName to familyName and cease attempting to infer a
style from it.
(EmacsSdk7FontDriver): Employ preset typefaces rather than
enumerating each typeface within the system fonts directory.
(draw): Circumvent kerning difficulties by advancing past each
character individually.
Yuan Fu [Thu, 14 Sep 2023 01:14:03 +0000 (18:14 -0700)]
Improve docstring for treesit-language-at
* lisp/treesit.el (treesit-language-at-point-function)
(treesit-language-at): Several people has confused over this, make it
extra clear than treesit-language-at requires
treesit-language-at-point-function to work.
Stephen Berman [Wed, 13 Sep 2023 21:43:54 +0000 (23:43 +0200)]
Fix last Ibuffer change and improve feedback messages
* lisp/ibuf-macs.el (define-ibuffer-op): Emit grammatically
correct message on finishing operation, and don't operate when
there are no marked buffer lines and point is not on a buffer
line. (bug#64230, Message #21)
* lisp/ibuffer.el (ibuffer-map-lines): Take acting on only one
buffer line and using non-nil 'ibuffer-expert' into account.
Jim Porter [Wed, 13 Sep 2023 18:50:39 +0000 (11:50 -0700)]
When waiting for processes in Eshell, wait until all the I/O is complete
This should fix bug#59103, bug#65590, and bug#65601.
* lisp/eshell/esh-proc.el (eshell-sentinel): Set ':eshell-handles' to
nil when finished with I/O.
(eshell-wait-for-process): Wait until ':eshell-handles' is nil.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Split the first line of
generated docstrings if either the struct name or a field name is very
long. This reduces the likelihood of "docstring wider than 80
characters" errors. (Bug#65790)
* lisp/emacs-lisp/cl-macs.el (cl-defsubst): Split the first line of
the docstring into 2 lines if the function name is very long.
Additionally, remove the word "inlining" in the generated docstring as
it is not very useful and increases the likelihood of "docstring wider
than 80 characters" errors. (Bug#65790)
Po Lu [Wed, 13 Sep 2023 13:39:22 +0000 (21:39 +0800)]
Reorganize Android permissions documentation
* doc/emacs/android.texi (Android Environment): Illustrate the
behavior of modern Android versions first. Reported by Stefan
Kangas <stefankangas@gmail.com>.
Po Lu [Wed, 13 Sep 2023 01:24:16 +0000 (09:24 +0800)]
Facilitate opening content:// files without a linked file name
* java/org/gnu/emacs/EmacsOpenActivity.java
(checkReadableOrCopy): If FILE is NULL, return a matching
content URI if possible, else generate a file name with the URI
as a reference.
(onCreate): Catch SecurityException around calls to
openFileDescriptor.
Yuan Fu [Tue, 12 Sep 2023 07:36:07 +0000 (00:36 -0700)]
Avoid unnecessary tree-sitter reparse when setting the same range
* src/treesit.h (Lisp_TS_Parser)
* src/treesit.c (make_treesit_parser): Remove has_range field, add
last_set_ranges field.
(Ftreesit_parser_set_included_ranges): Return early if the new range
is the same as the old one.
(Ftreesit_parser_included_ranges): Change has_range to
last_set_ranges.
Yuan Fu [Tue, 12 Sep 2023 03:59:50 +0000 (20:59 -0700)]
Make sure undefined tree-sitter thing doesn't raise an error
A previous change should've achived this, but that wasn't enough.
This one actually achieves the intended effect, namely,
treesit-node-match-p doesn't raise an error if IGNORE-MISSING is
non-nil, and traverse functions don't raise error by default.
* src/treesit.c (treesit_traverse_validate_predicate): Remove
ignore_missing parameter, return error symbol.
(Ftreesit_node_match_p)
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Check returned error symbol.
(syms_of_treesit): New symbol.
Jim Porter [Tue, 12 Sep 2023 05:05:38 +0000 (22:05 -0700)]
Ensure that Eshell doesn't consider a process complete until stderr is done
This will hopefully help resolve some timing issues with subprocesses
in Eshell. There's now much less chance of output going missing when
using redirects.
* lisp/eshell/esh-proc.el (eshell-gather-process-output): Set
':eshell-stderr-live'...
(eshell-sentinel): ... use it.
Stefan Monnier [Tue, 12 Sep 2023 16:55:54 +0000 (12:55 -0400)]
(read-char-from-minibuffer): Allow use of `quoted-insert` (bug#65805)
* lisp/subr.el (read-char-from-minibuffer-map): No need to remap
`self-insert-command` any more.
(read-char-from-minibuffer): Use `post-command-hook` to exit as soon as
a char is provided.
Po Lu [Tue, 12 Sep 2023 02:37:55 +0000 (10:37 +0800)]
Extract font foundry metadata from the OS/2 table
* src/sfnt.c (sfnt_table_names): Append an entry for OS/2
tables.
(sfnt_read_OS_2_table): New function.
(main): Introduce a new test for the OS/2 table reader.
* src/sfnt.h (sfnt_read_OS_2_table): New declaration.
* src/sfntfont.c (sfnt_decode_foundry_name): Delete function.
(sfnt_enum_font_1): Read the font's OS/2 table and extract the
foundry name from there. Use `misc' if absent.
(sfntfont_desc_to_entity, sfntfont_open): Cease interning
desc->designer, as that is now a symbol.
(syms_of_sfntfont) <Qmisc>: New defsym Qmisc. (bug#65865)
Alan Third [Mon, 11 Sep 2023 16:18:31 +0000 (17:18 +0100)]
Remove check for appdefined events on the queue (bug#65843)
It seems this was likely a bug in macOS 10.10.1. I have no way to find
out when it was fixed, but hopefully before 10.10.5, the most recent
release of that version.
* src/nsterm.m (ns_send_appdefined): Remove check for whether previous
appdefined events have been lost.
Alan Third [Fri, 8 Sep 2023 18:33:06 +0000 (19:33 +0100)]
Fix crash on child frame creation (bug#65817)
* src/nsterm.m ([EmacsView initFrameFromEmacs:]): Reorder the way the
frame and layers are created.
([EmacsView makeBackingLayer]): Change to the newly renamed method
below.
([EmacsLayer initWithColorSpace:doubleBuffered:]):
([EmacsLayer initWithDoubleBuffered:]): Rename the method and remove
the colorspace argument as it's no longer able to be set on initial
creation.
* src/nsterm.h: Use new method prototype.
Stephen Berman [Mon, 11 Sep 2023 14:15:29 +0000 (16:15 +0200)]
Avoid confusing message in Ibuffer (bug#64230)
* lisp/ibuffer.el (ibuffer-map-lines): With `ibuffer-auto-mode'
enabled, Ibuffer counts the automatically popped up (and hence not
user-marked) buffer "*Ibuffer confirmation*". Since Ibuffer
reports how many user-marked buffers were acted upon, and in this
case the reported count would be too high by one, decrement the
count to avoid the confusing message.
Po Lu [Mon, 11 Sep 2023 04:56:37 +0000 (12:56 +0800)]
Respect vertical centering preferences under Android
* src/sfntfont.c (sfntfont_open): Match XLFD name against
Vvertical_centering_font_regexp; if they agree, set
font->vertical_centering. Also set a suitable full name.
Po Lu [Mon, 11 Sep 2023 01:32:44 +0000 (09:32 +0800)]
Properly set text conversion style within ERC buffers
* lisp/erc/erc.el (erc-mode): Register
`erc-check-text-conversion' as a local post command hook.
(set-text-conversion-style): New function. Detect if point is
within the input prompt, then enable or disable text conversion
correspondingly.
F. Jason Park [Sat, 22 Jul 2023 07:46:44 +0000 (00:46 -0700)]
Consider all windows in erc-scrolltobottom-mode
* etc/ERC-NEWS: Add entry for option `erc-scrolltobottom-all', and
mention explicit hook-depth intervals reserved by ERC.
* lisp/erc/erc-backend.el (erc--hide-prompt): Change hook depth on
`pre-command-hook' from 91 to 80.
* lisp/erc/erc-goodies.el (erc-input-line-position): Mention secondary
role when new option `erc-scroll-to-bottom-relaxed' is non-nil.
(erc-scrolltobottom-all): New option that decides whether module
`scrolltobottom' affects all windows or just the selected one, as it
always has.
(erc-scrolltobottom-relaxed): New option to leave the prompt
stationary instead of forcing it to the bottom of the window.
(erc-scrolltobottom-mode, erc-scrolltobottom-enable,
erc-scrolltobottom-disable): Use `erc--scrolltobottom-setup' instead
of `erc-add-scroll-to-bottom' for adding and removing local hooks and
instead of ranging over buffers when removing them. Also add and
remove new hook members when `erc-scrolltobottom-all' is non-nil.
(erc--scrolltobottom-relaxed-commands,
erc--scrolltobottom-window-info,
erc--scrolltobottom-post-force-commands,
erc--scrolltobottom-relaxed-skip-commands): New internal variables.
(erc--scrolltobottom-on-pre-command
erc--scrolltobottom-on-post-command): New functions resembling
`erc-possibly-scroll-to-bottom' that try to avoid scrolling repeatedly
for no reason.
(erc--scrolltobottom-on-pre-command-relaxed,
erc--scrolltobottom-on-post-command-relaxed): New commands to help
implement `erc-scroll-to-bottom-relaxed'.
(erc--scrolltobottom-at-prompt-minibuffer-active): New function to
scroll to bottom on window configuration changes when using the
minibuffer.
(erc--scrolltobottom-all): New function to scroll all windows
displaying the current buffer.
(erc-add-scroll-to-bottom): Deprecate this function because it is now
unused in the default client and trivial to implement otherwise.
(erc--scrolltobottom-setup): New generic function to perform teardown
as well as setup depending on the state of the module's mode variable.
Also add an implementation specifically for `erc-scrolltobottom-all'
that locally modifies different sets of hooks depending on
`erc-scrolltobottom-relaxed'.
(erc--scrolltobottom-on-pre-insert): New generic function that
remembers the last `window-start' and maybe the current screen line
before inserting a message, in order to restore it afterward.
(erc--scrolltobottom-confirm): New function, a replacement for
`erc-scroll-to-bottom' that returns non-nil when it's actually
recentered the window. For now, used only when
`erc-scrolltobottom-all' is enabled.
(erc-move-to-prompt-setup): Add `erc-move-to-prompt' to
`pre-command-hook' at a depth of 70 in the current buffer.
(erc-keep-place-mode, erc-keep-place-enable): Change hook depth from 0
to 85.
(erc--keep-place-indicator-setup): Add overlay arrow `after-string' in
non-graphical settings in case users have time stamps or other content
occupying the left margin.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable):
Change hook depth from 90 to 85 locally so as not to conflict with a
value of t, for append.
(erc--keep-place-indicator-on-global-module): Change hook depth from
90 to 85 locally.
* test/lisp/erc/erc-scenarios-scrolltobottom-relaxed.el: New file.
* test/lisp/erc/erc-scenarios-scrolltobottom.el: New file.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--term-size, erc-scenarios-common--run-in-term,
erc-scenarios-common-interactive-debug-term-p,
erc-scenarios-common-with-noninteractive-in-term): New test macro and
supporting helper function and variables to facilitate running
scenario-based tests in an inferior Emacs, in term-mode.
(erc-scenarios-common--at-win-end-p,
erc-scenarios-common--above-win-end-p,
erc-scenarios-common--prompt-past-win-end-p,
erc-scenarios-common--recenter-top-bottom-around,
erc-scenarios-common--recenter-top-bottom,
erc-scenarios-scrolltobottom--normal): New test fixture and assertion
helper functions.
* test/lisp/erc/resources/scrolltobottom/help.eld: New file.
(Bug#64855)
F. Jason Park [Thu, 31 Aug 2023 06:15:22 +0000 (23:15 -0700)]
Add optional timezone param to erc-echo-timestamp
* etc/ERC-NEWS: Move `erc-echo-timestamp' from misc section
to own entry, and mention option `erc-echo-timestamp-zone'.
* lisp/erc/erc-stamp.el (erc-echo-timestamps): Mention that some
finagling is required if enabling this option after activating the
module.
(erc-echo-timestamp-format): Add additional Custom choice constants
and make the existing default one of them.
(erc-echo-timestamp-zone): New option to specify timezone for option
`erc-echo-timestamps' and function `erc-echo-timestamp'.
(erc-stamp-mode, erc-stamp-enable, erc-stamp-disable): Call
`erc-stamp--setup' instead of `erc-munge-invisibility-spec'.
(erc-stamp--current-time): Use `current-time' instead of
`erc-current-time'.
(erc-add-timestamp): Improve readability slightly, and change
`fboundp' to `functionp' to avoid signaling an error when the
variable's value is not a symbol.
(erc-munge-invisibility-spec): Perform teardown when boolean flag
options, like `erc-timestamp-intangible' and `erc-echo-timestamps' are
nil.
(erc-stamp--setup): Call `erc-munge-invisibility-spec', possibly
binding timestamp options to nil to force a tear down).
(erc-stamp--last-stamp, erc-stamp--on-clear-message): New function and
helper state variable to tell Emacs not to clear the current timestamp
message when navigating within the same IRC message.
(erc-echo-timestamp): Add optional `zone' parameter, to be passed
directly to `format-time-string', when non-interactive, and massaged
sensibly otherwise. Set the local variable `erc-stamp--last-stamp'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): New test.
(Bug#60936)
F. Jason Park [Sat, 26 Aug 2023 02:03:26 +0000 (19:03 -0700)]
; Allow alternate ert-info text in ERC test utility
* test/lisp/erc/erc-tests.el
(erc-tests--assert-printed-in-subprocess): Don't insist that arguments
to the Emacs "-load" invocation option be actual disk files.
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t--wait-message-prefix, erc-d-t-wait-for, erc-d-t-ensure-for):
Add and use new variable to make `ert-info' message prefix adjustable.
The immediate use for this is to make it easier to distinguish between
consecutive assertions in which the first waits for a condition and
the second ensures it holds for some duration.
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-default): Skip killed buffers.
* test/lisp/erc/resources/erc-d/erc-d.el: Typo.
* test/lisp/erc/resources/base/assoc/bouncer-history/barnet.eld: Timeouts.
* test/lisp/erc/resources/base/assoc/bouncer-history/foonet.eld: Timeouts.
* test/lisp/erc/resources/base/assoc/bumped/again.eld: Timeouts.
* test/lisp/erc/resources/base/assoc/bumped/foisted.eld: Timeouts.
* test/lisp/erc/resources/base/assoc/bumped/refoisted.eld: Timeouts.
* test/lisp/erc/resources/base/flood/soju.eld: Timeouts.
* test/lisp/erc/resources/base/netid/bouncer/barnet.eld: Timeouts.
* test/lisp/erc/resources/base/netid/bouncer/foonet.eld: Timeouts.
* test/lisp/erc/resources/base/reconnect/aborted-dupe.eld: Timeouts.
* test/lisp/erc/resources/base/reconnect/aborted.eld: Timeouts.
* test/lisp/erc/resources/base/renick/self/qual-chester.eld: Timeouts.
* test/lisp/erc/resources/base/renick/self/qual-tester.eld: Timeouts.
* test/lisp/erc/resources/erc-d/resources/dynamic-barnet.eld: Timeouts.
* test/lisp/erc/resources/erc-d/resources/dynamic-foonet.eld: Timeouts.
* test/lisp/erc/resources/erc-d/resources/linger.eld: Timeouts.
* test/lisp/erc/resources/join/legacy/foonet.eld: Timeouts.
F. Jason Park [Sat, 2 Sep 2023 03:05:35 +0000 (20:05 -0700)]
Allow login to contain NUH delimiters in erc-parse-user
* lisp/erc/erc.el (erc--parse-user-regexp-legacy,
erc--parse-user-regexp-pedantic): New constants. The first is the
original pattern that matches across line endings. The second
disallows multiline strings and interprets excess delimiting
characters as part of the middle, "user" component as per RFC1459.
The latter distinction is largely academic because most servers reject
such logins anyway, but bridges to other protocols and future
extensions may need to exploit this for novel uses.
(erc--parse-user-regexp): New variable, currently set to
`erc--parse-user-regexp-legacy'.
(erc-parse-user): Keep original pattern as default, but do so
indirectly via `erc--parse-user-regexp'.
* test/lisp/erc/erc-tests.el (erc-parse-user): New test.
Jim Porter [Thu, 7 Sep 2023 00:01:06 +0000 (17:01 -0700)]
Wait for all processes in a pipeline before resuming an Eshell command
Previously, we only waited until the tail process was finished, but
now, we wait for all of them. This is more consistent with other
shells, and prevents some cases of a process's output coming *after*
we continued past its pipeline.
* lisp/eshell/esh-cmd.el (eshell-resume-command): Simplify
conditionals, and check that all the foreground processes are dead
before resuming Eshell command.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/pipeline-wait/multi-proc): New test.
Jim Porter [Mon, 3 Apr 2023 05:41:29 +0000 (22:41 -0700)]
Collect all processes in an Eshell pipeline, not just the head and tail
This has the extra benefit that Eshell now only considers a pipeline
to be done when *all* of its processes are done (previously, it
checked only the last one in the pipeline).
* lisp/eshell/esh-util.el (eshell-process-pair-p)
(eshell-make-process-pair): Rename to...
(eshell-process-list-p, eshell-make-process-list): ... these, and
handle lists of processes. Update callers.
* lisp/eshell/esh-cmd.el (eshell-head-process): Use 'car'.
(eshell-tail-process): Get the last element of the list.
(eshell-do-pipelines): Return a list of all processes in the pipeline.
(eshell-do-pipelines-synchronously): Return the result of the first
command (usually t or nil).
(eshell-execute-pipeline): Simplify.
(eshell-do-eval): Pass all processes to 'eshell/wait'.
* lisp/font-lock.el (font-lock-verbose)
* lisp/image-mode.el (image-auto-resize)
* lisp/gnus/message.el (message-openpgp-header): Arrange for 'other'
to be the last choice. (Bug#65852)
* src/lisp.h (union vectorlike_header): Rewrite the description of the
header word layout, with some useful added precision and the customary
ASCII art for bit fields.
Point will skips empty lines and optionally goto the other
end when encountering a boundary.
* lisp/dired.el (dired-movement-style): Control whether to
skip empty lines and whether to cycle through non-empty
lines.
* lisp/dired.el (dired-next-line): Add a new movement style
controlled by `dired-movement-style'.
* etc/NEWS (dired-movement-style):
Felix Dietrich [Sun, 6 Aug 2023 04:01:24 +0000 (06:01 +0200)]
Make ‘mailcap-viewer-passes-test’ return t for viewers without tests
* lisp/net/mailcap.el (mailcap-viewer-passes-test):
Make ‘mailcap-viewer-passes-test’ follow its docstring and return t
for viewers without a test. (Bug#65224)
* test/lisp/net/mailcap-tests.el
(mailcap-viewer-passes-test-w/o-test-returns-t): New test.
* src/xterm.c (handle_one_xevent): The construct ``allows to
<infinitive>'' is not English inasmuch as no direct object to
``allows'' is provided. Correct and rephrase each instance of such a
construct within our documentation and commentary.
Yuan Fu [Sat, 9 Sep 2023 19:35:13 +0000 (12:35 -0700)]
Fix treesit-node-at wrt local parsers
* lisp/treesit.el (treesit-node-at): Don't compute language at point
first. Because treesit-language-at uses treesit-node-at with a
language argument. Only call treesit-language-at when PARSER-OR-LANG
is nil.