Po Lu [Tue, 26 Sep 2023 01:30:04 +0000 (09:30 +0800)]
Properly clip overlaid fringe bitmaps
* src/xterm.c (x_draw_fringe_bitmap): Save clip rectangle from
x_clip_to_row, and draw only the intersection between it and the
fringe bitmap, for if the bitmap is overlaid, the clip mask will
override the clip rectangle.
(x_clip_to_row): New argument *RECT_RETURN. All callers
changed.
Use heuristic to speed up allocation of small vectors (bug#65491)
Instead of scanning vector_free_lists from the appropriate size until
we find a nonempty bucket, start at the last bucket where we last put
something in. This may favour splitting larger vectors than necessary
but in general saves a lot of time in the allocation of small vectors.
Original patch by Ihor Radchenko.
* src/alloc.c (last_inserted_vector_free_idx): New variable.
(setup_on_free_list): Set it.
(allocate_vector_from_block): Use it.
(sweep_vectors): Reset it.
Remove useless half of vector_free_lists array (bug#65491)
The latter half of vector_free_lists was never used in any meaningful
way but it did require traversal during allocation and GC. Reduce it
to sizes we actually allocate, with a bucket for bigger ones.
* src/alloc.c (VECTOR_MAX_FREE_LIST_INDEX): Rename to...
(VECTOR_FREE_LIST_ARRAY_SIZE): ... this and adjust its value.
(vector_free_lists): Use new, smaller size.
(setup_on_free_list, allocate_vector_from_block):
Adapt to new vector_free_lists size.
(pseudovector_nbytes): New function extracted from...
(vectorlike_nbytes): ...here.
macroexp-parse-body: correct parsing of empty body (bug#66136)
* lisp/emacs-lisp/macroexp.el (macroexp-parse-body):
Return an empty body even when there are declarations present.
Previously, the last declaration was considered part of the body,
which is only correct if the input consists of a single string.
Po Lu [Mon, 25 Sep 2023 05:01:44 +0000 (13:01 +0800)]
Update Android port
* doc/lispref/os.texi (Desktop Notifications): Revise
documentation for android-notifications-notify to reflect
changes.
* java/org/gnu/emacs/EmacsDesktopNotification.java (display1):
Convert notification importance to a legacy priority between
Android 7.1 and 4.1.
* java/org/gnu/emacs/EmacsPixmap.java (EmacsPixmap): Remove
immutable bitmap constructor, as the underlying Android API
functions are erroneously implemented.
* src/android.c (android_init_emacs_pixmap): Cease searching for
deleted constructor.
(android_create_pixmap_from_bitmap_data): Create a pixmap, then
fill it with the contents of the bitmap, in lieu of employing
the aforementioned constructor.
João Távora [Sat, 23 Sep 2023 20:54:50 +0000 (21:54 +0100)]
Flymake: unbreak tests
Flymake's normal behaviour implies catching the errors of misbehaving
backends. This behavior is tested by Flymake's automated tests, built
on top of ERT, which means that debug-on-error is always t in the
bodies of said tests (I don't know the rationale for this, but it's
been like this for some time)
Flymake used to shun usage of 'condition-case-unless-debug' because of
this. But since that macro is pretty useful, I started using it
again, and as a consequence, tests started breaking.
The solution is to:
1. stop requiring the deprecated legacy backend 'flymake-proc' (which
by design, always errors, except in rare circumstances).
2. deliberately set debug-on-error to nil around the "dummy backends""
test.
* lisp/progmodes/flymake.el (flymake-proc): Don't require it by
default.
* test/lisp/progmodes/flymake-tests.el:
(dummy-backends): Make robust to ert's debug-on-error setting.
Eric Abrahamsen [Sat, 23 Sep 2023 22:33:53 +0000 (15:33 -0700)]
Use delete-region in Gnus message yanking
See Bug#66106
* lisp/gnus/gnus-msg.el (gnus-summary-reply): Not erase-buffer. The
intention was to narrow the buffer to the headers, and then delete
just those headers. But erase-buffer doesn't respect narrowing, so
use (delete-region (point-min) (point-max)) instead.
Eli Zaretskii [Sat, 23 Sep 2023 13:32:57 +0000 (09:32 -0400)]
Merge from origin/emacs-29
6bc3800000c Ensure ucs-names is consistent with Unicode names 93134bb9c2f Make key-translate actually work 85f49a9bc8b Update to Org 9.6.9 2826c26537c Add leim subdirectories to emacs package
Po Lu [Sat, 23 Sep 2023 00:31:45 +0000 (08:31 +0800)]
Display background dialogs using the correct style
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Wrap
CONTEXT within EmacsStyle such that dialogs are displayed in the
same style used by activities.
Po Lu [Fri, 22 Sep 2023 01:36:40 +0000 (09:36 +0800)]
Enable opening mailto URLs under Android
* doc/emacs/android.texi (Android Startup): Mention how mailto
URLs are treated by the emacsclient wrapper.
* java/AndroidManifest.xml.in: Register `mailto' scheme filters
for EmacsOpenActivity.
* java/org/gnu/emacs/EmacsOpenActivity.java (startEmacsClient):
Extract code that starts Emacs when it isn't already running,
and take a list of arguments rather than a single file name.
(onCreate): If the scheme is `mailto', escape the URI and call
`message-mailto'.
João Távora [Thu, 21 Sep 2023 21:35:05 +0000 (22:35 +0100)]
Flymake: new 'short' option for flymake-show-diagnostics-at-end-of-line
bug#66041
* lisp/progmodes/flymake.el (Version): Bump to 1.3.6
(flymake-eol-information-face): New face.
(flymake-show-diagnostics-at-end-of-line): Support new value short.
(flymake--eol-overlay-summary): Rework.
(flymake--highlight-line):
Stefan Monnier [Thu, 21 Sep 2023 15:47:31 +0000 (11:47 -0400)]
regex-emacs.c (mutually_exclusive_aux): Rework again
Rework the way we handle loops. This new code does not really work
better than the previous one, but it has the advantage of being "fail
safe" and also that we can dynamically check if our assumptions about
the shape of the bytecode are satisfied or not.
* src/regex-emacs.c (mutually_exclusive_aux): Replace `done_beg` and
`done_end` with `loop_beg` and `loop_end`.
(mutually_exclusive_p): Adjust accordingly.
(analyze_first): Fix incorrect assertion.
Alan Mackenzie [Wed, 20 Sep 2023 15:51:17 +0000 (15:51 +0000)]
Insert symbol `debug' into two condition-case handlers
This fixes bug#65622. Also correct a mismatch between a
function to which advice is added, and that from which it is
removed.
* lisp/emacs-lisp/macroexp.el (internal-macroexpand-for-load):
Add a `debug' to the condition-case handler for `error', so
that a useful backtrace will be produced on a macro expansion
error.
* lisp/progmodes/elisp-mode.el (elisp--local-variables): Add
`debug' to a condition-case handler, as above. In the
advice-remove call, give the same function, macroexpand-1, as
in the corresponding advice-add call.
João Távora [Wed, 20 Sep 2023 10:00:19 +0000 (11:00 +0100)]
Eglot: better consider diagnostics at point on code action requests
* lisp/progmodes/eglot.el (eglot--code-action-bounds): Rename from
eglot--code-action-bounds. Rework to consider diagnostics.
(eglot-code-actions): Use new eglot--code-action-bounds.
(eglot--code-action): Use new eglot--code-action-bounds.
Paul Eggert [Wed, 20 Sep 2023 08:04:32 +0000 (01:04 -0700)]
Fix off-by-1 typo in vadd_to_log
* src/xdisp.c (vadd_to_log): Fix off-by-1 typo that I introduced
in commit fbee6265a72a4129d2efbf15a622b13e8b4aae9f
dated Thu Aug 13 13:48:28 2015 -0700.
Problem and fix reported by Robert Pluim (Bug#66098#11).
Juri Linkov [Tue, 19 Sep 2023 17:51:07 +0000 (20:51 +0300)]
* lisp/tab-bar.el (tab-bar-auto-width): Don't check if width changes.
Remove the condition '(< curr-width prev-width)' that was intended to check
if the width stopped to change. But actually it's not only unneeded,
but causes a bug: when the name contains a combining character, then
the width doesn't change, and the name truncation stops too early.
Don't use pointer arithmetic for pointer tagging (bug#65491)
This makes for safer code when tagging null pointers in particular,
since pointer arithmetic on NULL is undefined and therefore can be
assumed, by the compiler, not to occur.
* src/lisp.h (untagged_ptr): Remove.
(TAG_PTR): Cast to uintptr_t instead of untagged_ptr.
* doc/misc/modus-themes.org
(Option for reloading the theme on custom change)
(Option for disabling other themes while loading Modus)
(Option for completion framework aesthetics)
(Option for org-mode block styles, Get a single color from the palette)
(Add padding to mode line, Note on SHR fonts)
(Note on goto-address-mode faces): Use correct markup for 'nil'.
(Custom Org todo keyword and priority faces): Reword statements and
update the value of sample configuration blocks.
(Use more spacious margins or padding in Emacs frames): Mention the
'spacious-padding' package on GNU ELPA.
(Full support for packages or face groups): Document newly supported
packages and remove those that are no longer covered explicitly.
(Indirectly covered packages): Note that css-mode is covered
indirectly.
(Acknowledgements): Expand list of people who have helped with the
project.
* etc/themes/modus-operandi-deuteranopia-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-operandi-deuteranopia): Expand or tweak the palette, where
necessary.
* etc/themes/modus-operandi-theme.el (unless): Add theme-autoload
cookie and relevant metadata.
(modus-operandi): Expand or tweak the palette, where necessary.
* etc/themes/modus-operandi-tinted-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-operandi-tinted): Expand or tweak the palette, where necessary.
* etc/themes/modus-operandi-tritanopia-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-operandi-tritanopia): Expand or tweak the palette, where
necessary.
* etc/themes/modus-vivendi-deuteranopia-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-vivendi-deuteranopia): Expand or tweak the palette, where
necessary.
* etc/themes/modus-vivendi-theme.el (unless): Add theme-autoload
cookie and relevant metadata.
(modus-vivendi): Expand or tweak the palette, where necessary.
* etc/themes/modus-vivendi-tinted-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-vivendi-tinted): Expand or tweak the palette, where necessary.
* etc/themes/modus-vivendi-tritanopia-theme.el (unless): Add
theme-autoload cookie and relevant metadata.
(modus-vivendi-tritanopia): Expand or tweak the palette, where
necessary.
* etc/themes/modus-themes.el (modus-themes-preset-overrides-faint)
(modus-themes-preset-overrides-intense)
(modus-themes-preset-overrides-warmer): Make minor tweaks.
(modus-themes--annotate-theme, modus-themes--select-prompt)
(modus-themes--toggle-theme-p, modus-themes-toggle)
(modus-themes--list-colors-prompt, modus-themes--heading)
(modus-themes-faces): Refine internal functions.
The detailed release notes are available here:
<https://protesilaos.com/codelog/2023-09-19-modus-themes-4-3-0/>.
Po Lu [Tue, 19 Sep 2023 11:57:14 +0000 (19:57 +0800)]
Update Android port
* src/android.c (android_exception_check_1)
(android_exception_check_2, android_exception_check_3)
(android_exception_check_4): Permit each object to be NULL.
(android_browse_url): Release VALUE if an exception transpires.
Alan Mackenzie [Tue, 19 Sep 2023 10:25:34 +0000 (10:25 +0000)]
Don't use ellipses while cl-printing strings.
This fixes bug#65680. The former use of print-length as a
bound on the length of the printed string was erroneous,
causing error messages preceding backtracees to get
unnecessarily truncated to 50 characters.
* lisp/emacs-lisp/cl-print.el (cl-print-object <string>):
Remove the substitution of ellipses for long strings.
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-ellipsis-string): Remove this test.
Yuan Fu [Sat, 16 Sep 2023 16:03:16 +0000 (09:03 -0700)]
Fix tree-sitter range update function
* lisp/treesit.el (treesit-update-ranges): If an embedded language
doesn't have any range, don't set its range to nil (which means whole
buffer), instead, set its range to a dummy (1 . 1) zero range.
Don't use pointer arithmetic for untagging Lisp values (bug#65491)
* src/lisp.h (XUNTAG):
Instead of casting a Lisp value to char * and subtracting the tag,
cast it to a suitable integral type and work on that.
This should result in identical or at least equivalent code, except
that it avoids potential problems arising from the restrictions on
pointer arithmetic in C. In particular, a null pointer can be neither
an operand in nor the result of pointer arithmetic.
C compilers know this and would, prior to this change, optimise
XUNTAG(obj, Lisp_Int0, mytype) != NULL
to 1. This means, for example, that make_pointer_integer and
XFIXNUMPTR could not be entrusted with null pointers, and
next_vector in alloc.c was unsafe to use.
Jim Porter [Mon, 18 Sep 2023 17:17:12 +0000 (10:17 -0700)]
Fix another race condition when waiting for Eshell processes
When checking if the other processes in our pipeline are "alive", we
also need to check whether their sentinels are finished. Otherwise,
we might proceed with command evaluation while one of the other
processes is still cleaning up.
* lisp/eshell/esh-proc.el (eshell-process-active-p): New function...
(eshell-wait-for-process)
* lisp/eshell/esh-cmd.el (eshell-resume-command): ... use it.
Robert Pluim [Mon, 18 Sep 2023 08:41:01 +0000 (10:41 +0200)]
Ensure ucs-names is consistent with Unicode names
* lisp/international/mule-cmds.el (ucs-names): Skip adding an old-name
if it conflicts with the offical name of a codepoint. Adjust the
ranges iterated over to account for new Unicode codepoints.
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-old-name-override,
mule-cmds-tests--ucs-names-missing-names): New tests for checking
'ucs-names' consistency.
Po Lu [Mon, 18 Sep 2023 06:13:30 +0000 (14:13 +0800)]
Correct crash in child processes under armeabi Android
* exec/trace.c (process_system_call) <READLINKAT_SYSCALL>:
Examine tracee->waiting_for_syscall and avoid rewriting user
arguments if a system call is presently being executed by the
kernel. Reported by Romário Rios <romariorios@protonmail.com>.
Danny Freeman [Fri, 15 Sep 2023 15:29:05 +0000 (11:29 -0400)]
Offset ranges before applying embedded tree-sitter parser
This feature would allow treesitter major modes to easily specify
offsets when using embeded parsers. A potential use case for this is
javascript template strings, when we want to apply a different parser
to the string's contents, but do not want to include the template
string's delimiters.
* lisp/treesit.el
(treesit-query-range): Accept an optional offest arg, apply the offset
to all returned ranges.
(treesit-range-rules): Accept an optional :offset keyword arg to adjust
ranges an embded parser is applied to.
(treesit-update-ranges): Forward optional :offset setting from
`treesit-range-rules' to `treesit-query-rang'.
* test/lisp/treesit-tests.el
(treesit-range-offset): Tests the new offset functionality.
Jim Porter [Mon, 18 Sep 2023 04:06:46 +0000 (21:06 -0700)]
Use 'eshell-with-temp-command' (indirectly) to parse Eshell script files
* lisp/eshell/esh-cmd.el (eshell--region-p): New function.
(eshell-with-temp-command, eshell-parse-command): Support
'(:file . FILENAME)' to use the contents of FILENAME.
* lisp/eshell/em-script.el (eshell-source-file): Call
'eshell-parse-command' and use backticks.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Call
damageRect with integer coordinates in lieu of consing a new
Rect.
* java/org/gnu/emacs/EmacsDrawable.java (damageRect) <IIII>:
Declare a new variant of damageRect, accepting four integers
designating the extents of the damage rectangle.
* java/org/gnu/emacs/EmacsPixmap.java (damageRect) <IIII>: New
stub.
* java/org/gnu/emacs/EmacsView.java (damageRect) <IIII>:
Implement this overloaded variant of damageRect.
* src/android.c (android_init_emacs_drawable)
(android_init_emacs_window): Move search for `damageRect' to
android_init_emacs_window.
(android_damage_window): Call IIII variant of `damageRect' to
avoid consing a new rectangle. Ameliorate dynamic method
dispatch overhead.
Stefan Kangas [Sat, 16 Sep 2023 12:34:20 +0000 (14:34 +0200)]
Add missing builtin package declarations
* lisp/finder.el (finder--builtins-alist): Add new package
directories 'leim' and 'obsolete' as part of the 'emacs' package.
Add new package directory 'use-package' as part of the
'use-package' package.
* lisp/net/eudc-capf.el:
* lisp/net/eudcb-ecomplete.el:
* lisp/net/eudcb-macos-contacts.el:
* lisp/net/eudcb-mailabbrev.el: Declare library as part of the
'eudc' package.
* lisp/mail/ietf-drums-date.el: Declare library as part of the
'ietf-drums' package.
* lisp/image/image-dired-dired.el:
* lisp/image/image-dired-external.el:
* lisp/image/image-dired-tags.el:
* lisp/image/image-dired-util.el: Declare library as part of the
'image-dired' package.
* lisp/emacs-lisp/oclosure.el:
* lisp/keymap.el:
* lisp/progmodes/c-ts-common.el: Declare library as part of the
'emacs' package. (Bug#62751)
F. Jason Park [Thu, 7 Sep 2023 02:40:11 +0000 (19:40 -0700)]
Spoof channel users in erc-button--phantom-users-mode
* lisp/erc/erc-backend.el (erc--cmem-from-nick-function): Update
forward declaration.
(erc-server-PRIVMSG): Use new name for `erc--user-from-nick-function',
now `erc--cmem-from-nick-function'.
* lisp/erc/erc-button.el (erc-button--phantom-users,
erc-button--phantom-cmems): Rename former to latter.
(erc-button--fallback-user-function,
erc-button--fallback-cmem-function): Rename former to latter.
(erc--phantom-channel-user, erc--phantom-server-user): New superficial
`cl-struct' definitions "subclassing" `erc-channel-user' and
`erc-server-user'. Note that these symbols lack an `erc-button'
prefix.
(erc-button--add-phantom-speaker): Look for channel member instead of
server user, creating one if necessary. Return a made-up
`erc-channel-user' along with a fake `erc-server-user'.
(erc-button--get-phantom-user, erc-button--get-phantom-cmem): Rename
former to latter.
(erc-button--phantom-users-mode, erc-button--phantom-users-enable,
erc-button--phantom-users-disable): Use updated "cmem" names for
function-valued interface variables and their implementing functions.
Remove obsolete comment.
(erc-button-add-nickname-buttons): Attempt to query fallback function
for channel member instead of server user.
* lisp/erc/erc.el (erc--user-from-nick-function,
erc--cmem-from-nick-function): Rename former to latter.
(erc--examine-nick, erc--cmem-get-existing): Rename former to
latter. (Bug#60933)