* java/org/gnu/emacs/EmacsService.java (queryTree): Return
handles as longs rather than shorts.
(viewGetSelection): Take long WINDOW, not short.
* src/android.c (struct android_emacs_handle): New structure.
(handle_class): New variable.
(android_init_emacs_service, android_init_emacs_pixmap)
(android_init_emacs_gc_class, android_init_emacs_cursor): Adjust
to match signature changes in constructors.
(android_init_emacs_handle): New function.
(initEmacs): Initialize the handle class, its fields and metods.
(sendConfigureNotify, sendKeyPress, sendKeyRelease, sendFocusIn)
(sendFocusOut, sendWindowAction, sendEnterNotify)
(sendLeaveNotify, sendMotionNotify, sendButtonPress)
(sendButtonRelease, sendTouchDown, sendTouchUp, sendTouchMove)
(sendWheel, sendIconified, sendDeiconified, sendContextMenu)
(sendExpose, sendDndDrag, sendDndUri, sendDndText): Update for
changes to handle type.
(android_alloc_id, android_resolve_handle)
(android_resolve_handle2): Remove functions; replace the second
with a macro that accepts one fewer argument. All callers
changed.
(android_destroy_handle): Cease indexing the handle list for the
handle object.
(android_globalize_reference): New function.
(android_create_window, android_create_gc, android_create_pixmap)
(android_create_font_cursor): Call android_globalize_reference
to convert global references into handles.
(android_free_cursor, android_destroy_window): Cease verifying
the handle type.
(android_copy_area): Check destination object type rather than
handle entry.
(android_query_tree): Adjust for changes to return types.
(likely): Define __builtin_expect variant unconditionally.
* src/android.h (android_resolve_handle): New macro.
* src/androidgui.h (android_handle): Define to intptr_t.
* src/androidterm.c (deleteSurroundingText, finishComposingText)
(performEditorAction, performContextMenuAction, getExtractedText)
(getSelectedText, requestSelectionUpdate, requestCursorUpdates)
(clearInputFlags, getSurroundingText)
(android_get_surrounding_text_internal): Accept handles as
longs, not jshorts.
Warn when loading .el files without lexical-binding declaration
This corresponds to the byte-compiler warning for the same issue,
here emitted for files that aren't compiled but loaded from source.
It should make the planned change to enable lexical binding by default
in Emacs 31 go smoother.
* src/lread.c (lexical_cookie_t): New type.
(lisp_file_lexically_bound_p): Renamed to...
(lisp_file_lexical_cookie): ...this, with the return value retyped.
* src/lread.c (warn_missing_cookie): New.
(Fload): Warn when loading source file and cookie missing.
(Feval_buffer): Add LOADING arg; warn when set and cookie missing.
* lisp/international/mule.el (load-with-code-conversion):
* lisp/startup.el (command-line--load-script):
Call eval-buffer with LOADING arg set.
* etc/NEWS: Announce.
Stefan Monnier [Fri, 3 May 2024 17:23:00 +0000 (13:23 -0400)]
track-changes.el: Add a workaround for bug#70541
* lisp/emacs-lisp/track-changes.el (track-changes-inconsistent-state-p):
New function.
* lisp/progmodes/eglot.el (eglot--track-changes-signal): Use it.
Ihor Radchenko [Fri, 3 May 2024 07:46:22 +0000 (10:46 +0300)]
mhtml-mode: Use `run-mode-hook' to run `prog-mode-hook' (bug#70671)
* lisp/textmodes/mhtml-mode.el (mhtml-mode): When running hooks
simulating inheritance from `prog-mode', use `run-mode-hooks' that
honors `delay-mode-hooks' macro. Note that `delay-mode-hooks' is bound
to non-nil when major mode body is evaluated, so there is no chance that
any major mode-related hooks are executed twice.
Elias G. Perez [Thu, 2 May 2024 16:33:43 +0000 (10:33 -0600)]
Fix bug#70711
* lisp/progmodes/flymake.el (flymake--indicator-overlay-spec):
Check if `flymake-fringe-indicator-position' or
`flymake-margin-indicator-position' are non-nil for allow no
indicators.
F. Jason Park [Thu, 25 Apr 2024 12:09:50 +0000 (05:09 -0700)]
; Set explicit hook depth for erc-once-with-server-event
* lisp/erc/erc.el (erc-once-with-server-event): Set hook depth to -95.
* test/lisp/erc/erc-scenarios-base-association-nick.el: Improve
comment.
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d--render-entries): Remove do-nothing assertion since its purpose
was unclear and likely dubious, as was incidentally highlighted by the
addition of a function not present on older Emacsen, which this test
still needs to run on.
Juri Linkov [Thu, 2 May 2024 17:55:03 +0000 (20:55 +0300)]
* lisp/tab-bar.el: Support mouse clicks bound in keymap properties.
(tab-bar--event-to-item): Handle mouse bindings for commands
bound in keymap properties of global-mode-string (bug#70086).
(tab-bar-mouse-down-1, tab-bar-mouse-1, tab-bar-touchscreen-begin):
Add the symbol 'global' to the list of handled items.
Lin Sun [Sat, 27 Apr 2024 06:54:27 +0000 (06:54 +0000)]
New function 'python-shell-send-block' for python-mode
* lisp/progmodes/python.el (python-shell-send-block): New
function.
* test/lisp/progmodes/python-tests.el
(python-test--shell-send-block): Test case for the new
function.
* etc/NEWS: Document 'python-shell-send-block'.
(Bug#70609)
Improve performance of `file-truename' (bug#70036)
* lisp/files.el (file-truename): Avoid repetitive calls to
`file-name-nondirectory'. These calls contribute
significantly to CPU time. See the benchmarks in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70036#47
* src/nsterm.m (ns_maybe_dumpglyphs_background): Conform logic
to X version by always displaying the background if s->stipple_p
should be set.
(ns_draw_stretch_glyph_string): Set stipple background as
appropriate.
(ns_set_glyph_string_gc): New function.
(ns_draw_glyph_string): Call it, as on X. Reported by Arash
Esbati <arash@gnu.org>.
Augusto Stoffel [Sun, 21 Apr 2024 09:21:58 +0000 (11:21 +0200)]
Eglot: Add 'command-modes' property to all suitable commands
Those are the commands that call 'eglot--current-server-or-lose'.
* lisp/progmodes/eglot.el (eglot--managed-mode),
(eglot-list-connections-mode): Make non-interactive. (Bug#70554)
Yuan Fu [Thu, 2 May 2024 04:21:00 +0000 (21:21 -0700)]
Fix fontification for else in macro body in rust-ts-mode
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Add a rule for else in macro body. Also added the same rule for "in"
and "move" keyword, as they seems to have the same problem.
Add font-locking for typed parameters in python-ts-mode (bug#70665)
* lisp/progmodes/python.el (python--treesit-settings): Add
tree-sitter font-locking rule for typed parameters.
* test/lisp/progmodes/python-tests.el
(python-ts-mode-types-face-1): Test for
font-lock-variable-name-face in typed parameter.
* java/org/gnu/emacs/EmacsFillRectangle.java
(EmacsFillRectangle) <invertFilter>: New variable.
(perform): If the transfer mode is invert, copy the source
to itself with invertFilter as the color filter.
Andrea Corallo [Wed, 1 May 2024 18:14:01 +0000 (14:14 -0400)]
(disassemble): Fix case of `(byte-code ...)` argument
* lisp/emacs-lisp/disass.el (disassemble): Handle (byte-code ...) here..
(disassemble-internal): ...instead of here.
(disassemble-1): Adjust text to reflect the existence of other
compiled functions.
help-xref-button fails if not preceded by a valid match, so a
preceding unconditional search should not be allowed to fail
silently.
* lisp/emacs-lisp/ert.el (ert-describe-test):
* lisp/help-fns.el (help-fns--compiler-macro)
(help-fns-function-description-header, describe-variable)
(help-fns--customize-variable, describe-face)
(help-fns--face-attributes, describe-keymap): Let unconditional
re-search-backward before help-xref-button fail early, as that would
indicate a logic bug, and the backtrace would more accurately point
to the actual source of the mistake.
Po Lu [Wed, 1 May 2024 07:57:29 +0000 (15:57 +0800)]
Disable on-screen keyboard outside fields in Custom buffers
* lisp/cus-edit.el (Custom-display-on-screen-keyboard-p): New
function.
(Custom-mode): Install it as the touch-screen-keyboard-function.
* lisp/touch-screen.el (touch-screen-keyboard-function): New
variable.
(touch-screen-handle-point-up): Don't special-case the splash
screen with respect to touch-screen-display-keyboard in keeping
with user feedback.
Po Lu [Wed, 1 May 2024 03:45:53 +0000 (11:45 +0800)]
Fix compatibility issues with Android clipboards
* java/org/gnu/emacs/EmacsClipboard.java (getClipboardData):
Return an AssetFileDescriptor.
* java/org/gnu/emacs/EmacsContextMenu.java (onMenuItemClick):
Typo corrections in commentary.
* java/org/gnu/emacs/EmacsOpenActivity.java (onCreate): Raise
minimum version on which to read file descriptors from
ParcelFileDescriptor objects to Honeycomb.
* java/org/gnu/emacs/EmacsSdk11Clipboard.java
(getClipboardData): Return the asset file descriptor.
* java/org/gnu/emacs/EmacsSdk8Clipboard.java (getClipboardData):
Adjust return type to match.
* src/android.h (struct android_parcel_file_descriptor_class):
Move from androidselect.c.
* src/androidselect.c (fd_class): Export function.
(android_init_emacs_clipboard): Adjust signature of
getClipboardData.
(android_init_asset_file_descriptor, close_asset_fd)
(extract_fd_offsets): New functions.
(Fandroid_get_clipboard_data): Extract file descriptor and
offset from the AssetFileDescriptor here, rather than in
getClipboardData.
(init_androidselect): Call android_init_asset_file_descriptor.
* src/androidvfs.c (android_init_fd_class): Export and enable
calling this function more than once.
Po Lu [Wed, 1 May 2024 00:56:23 +0000 (08:56 +0800)]
; Fix widget button press cancellation
* lisp/wid-edit.el (widget-button--check-and-call-button): Throw
nil if a mouse-button-derived press is canceled. Reported by
David Ponce <da_vid@orange.fr>.
Fix first appearance records for some misdated functions
* etc/NEWS.unknown: Add approximate version records for
defsubst, mark, nreverse, let*, rassq, >=,
transpose-sexps, buffer-modified-p, current-column, downcase,
previous-line, catch, throw, and count-lines,
which all were given much more recent introduction versions
by describe-function.
Po Lu [Tue, 30 Apr 2024 10:26:39 +0000 (18:26 +0800)]
Fix deletion of text holding `inhibit-read-only' properties
* src/intervals.h (INTERVAL_VISIBLE_P): Split into ...
(INTERVAL_GENERALLY_WRITABLE_P, INTERVAL_EXPRESSLY_WRITABLE_P):
... two new macros.
* src/textprop.c (verify_interval_modification): If the buffer
is read only, verify not that there is only a single exempting
interval spanning the area of a multiple-character operation,
but that every intervening interval in such an operation exempts
it from write restrictions, either by providing a read-only
property that appears in Vinhibit_read_only, or by providing an
inhibit-read-only property.
* test/src/textprop-tests.el (textprop-interval-immutability):
New test.
Paul Eggert [Tue, 30 Apr 2024 08:20:12 +0000 (01:20 -0700)]
Pacify GCC 14 -Wnull-dereference in tim_sort
* src/lisp.h (tim_sort): Require array arg to be nonnull.
* src/sort.c (reverse_slice): Omit no-longer-needed eassert.
(tim_sort): Avoid undefined behavior when length == 0,
since reverse_slice would then compute &seq[-1].
Paul Eggert [Tue, 30 Apr 2024 08:20:12 +0000 (01:20 -0700)]
Pacify GCC 14 -Wnull-dereference
* src/xterm.c (x_dpyinfo): New function, which acts like
x_display_info_for_display except it always returns nonnull.
This simplifies callers and pacifies GCC 14. All callers changed.
Paul Eggert [Tue, 30 Apr 2024 08:20:12 +0000 (01:20 -0700)]
etags: work around GCC bug 114882
* lib-src/etags.c: Ignore -Wanalyzer-use-of-uninitialized-value.
This applies to the whole source file, not just to areas where GCC
has bugs, as it was too tricky to ignore more selectively.
Paul Eggert [Tue, 30 Apr 2024 08:20:12 +0000 (01:20 -0700)]
etags: fix #line parsing (\\", long lines)
* lib-src/etags.c (readline): Don’t mishandle lines like
‘#line 1 "a//"’, which has an escaped backslash before ‘"’.
Don’t mishandle lines so long that sscanf overflows %n.
Paul Eggert [Tue, 30 Apr 2024 08:20:12 +0000 (01:20 -0700)]
Simplify etags.c by omitting a macro
* lib-src/etags.c (xnew): Remove. All uses removed.
xnew was confusing, as sometimes it was used with n=1,
sometimes with Type=char, and it’s easier just to use xmalloc
or xnmalloc.
Po Lu [Tue, 30 Apr 2024 05:21:59 +0000 (13:21 +0800)]
Minor adjustments to eww text field change handlers
* lisp/net/eww.el (eww-check-text-conversion): Fix doc string.
(eww-mode): Specify face, eww-form and field as nonsticky
properties by default.
(eww-tag-textarea, eww-form-text): Render properties
front-sticky.
(eww-process-text-input): Use field functions to compute field
bounds.
Eric Abrahamsen [Mon, 29 Apr 2024 20:13:38 +0000 (13:13 -0700)]
Add (semi-redundant) fix to nnatom backend declaration
* lisp/gnus/gnus.el (gnus-valid-select-methods): We need a value for
post/mail/none in order to conform to the option type.
* lisp/gnus/nnatom.el: This call to gnus-declare-backend does the exact
same thing as above, and needs to be adjusted accordingly.
Add NEWS.unknown file to correct versions of introduction
It is not intended for the human reader, but to give less wrong versions
of first appearance displayed by `describe-function` or
`describe-variable` that would otherwise be derived from a notice in a
more recent NEWS* file.
It is better to add items to this file than changing historical NEWS*
files when the actual version of introduction is not known.
* etc/NEWS.unknown: New file. Add entry for `nthcdr`.
* src/fns.c (string_cmp): Fix bad comparisons for certain strings.
This only affected `value<` for aggregates, not `string<`.
* test/src/fns-tests.el (fns-value<-ordered): Add test cases.
Po Lu [Mon, 29 Apr 2024 12:01:59 +0000 (20:01 +0800)]
Adapt eww to touch screens, mice and text conversion
* doc/emacs/input.texi (On-Screen Keyboards): Update conditions
for displaying the virtual keyboard when t-s-d-k is enabled.
* etc/NEWS (Announce): Document changes.
* lisp/net/eww.el (eww-check-text-conversion): New function.
(eww-mode): Install it as a local post-command-hook.
(eww-submit-map, eww-submit-file, eww-checkbox-map): Bind
suitable commands to mouse-2.
(eww-form-submit, eww-form-checkbox, eww-form-file)
(eww-tag-select): Disguise inserted forms as buttons, that touch
event translation may prefer their bindings to mouse-2 over
mouse-1.
(eww-form-text, eww-tag-textarea): Insert field properties as
well.
(eww-select-file, eww-toggle-checkbox, eww-submit): New argument
EVENT, to whose position point is set.
* lisp/touch-screen.el (touch-screen-handle-point-up): Trivial
adjustments to the criteria for selecting mouse commands and
displaying the on screen keyboard.
* src/minibuf.c (Fread_from_minibuffer): Reset frame conversion
if Voverriding_text_conversion_style is set.
* src/textconv.c (textconv_query): Narrow to field.
(reset_frame_conversion): New function.
(reset_frame_state): Clear conversion field.
(really_delete_surrounding_text): Narrow to field.
(locate_and_save_position_in_field): New function.
(really_request_point_update, really_set_point_and_mark)
(complete_edit_check, handle_pending_conversion_events_1)
(handle_pending_conversion_events, get_conversion_field)
(set_composing_region, textconv_set_point_and_mark, replace_text)
(get_extracted_text, get_surrounding_text, report_point_change):
Compute, narrow to and offset by the currently active field
whenever point is updated or a command is received.
(syms_of_textconv): Revise doc strings.