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.
Stefan Monnier [Mon, 11 Mar 2024 20:12:26 +0000 (16:12 -0400)]
Use a dedicated type to represent interpreted-function values
Change `function` so that when evaluating #'(lambda ...)
we return an object of type `interpreted-function` rather than
a list starting with one of `lambda` or `closure`.
The new type reuses the existing PVEC_CLOSURE (nee PVEC_COMPILED)
tag and tries to align the corresponding elements:
- the arglist, the docstring, and the interactive-form go in the
same slots as for byte-code functions.
- the body of the function goes in the slot used for the bytecode string.
- the lexical context goes in the slot used for the constants of
bytecoded functions.
The first point above means that `help-function-arglist`,
`documentation`, and `interactive-form`s don't need to
distinguish interpreted and bytecode functions any more.
Main benefits of the change:
- We can now reliably distinguish a list from a function value.
- `cl-defmethod` can dispatch on `interactive-function` and `closure`.
Dispatch on `function` also works now for interpreted functions but still
won't work for functions represented as lists or as symbols, of course.
- Function values are now self-evaluating. That was alrready the case
when byte-compiled, but not when interpreted since
(eval '(closure ...)) signals a void-function error.
That also avoids false-positive warnings about "don't quote your lambdas"
when doing things like `(mapcar ',func ...)`.
* src/eval.c (Fmake_interpreted_closure): New function.
(Ffunction): Use it and change calling convention of
`Vinternal_make_interpreted_closure_function`.
(FUNCTIONP, Fcommandp, eval_sub, funcall_general, funcall_lambda)
(Ffunc_arity, lambda_arity): Simplify.
(funcall_lambda): Adjust to new representation.
(syms_of_eval): `defsubr` the new function. Remove definition of `Qclosure`.
* lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure):
Change calling convention and use `make-interpreted-closure`.
* src/data.c (Fcl_type_of): Distinguish `byte-code-function`s from
`interpreted-function`s.
(Fclosurep, finterpreted_function_p): New functions.
(Fbyte_code_function_p): Don't be confused by `interpreted-function`s.
(Finteractive_form, Fcommand_modes): Simplify.
(syms_of_data): Define new type symbols and `defsubr` the two
new functions.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <interpreted-function>:
New method.
* lisp/emacs-lisp/oclosure.el (oclosure): Refine the parent
to be `closure`.
(oclosure--fix-type, oclosure-type): Simplify.
(oclosure--copy, oclosure--get, oclosure--set): Adjust to
new representation.
* src/callint.c (Fcall_interactively): Adjust to new representation.
* src/lread.c (bytecode_from_rev_list):
* lisp/simple.el (function-documentation):
* lisp/help.el (help-function-arglist): Remove the old `closure` case
and adjust the byte-code case so it handles `interpreted-function`s.
* lisp/emacs-lisp/cl-preloaded.el (closure): New type.
(byte-code-function): Add it as a parent.
(interpreted-function): Adjust parent (the type itself was already
added earlier by accident).
* lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Adjust to
new representation.
(byte-compile): Use `interpreted-function-p`.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust to
new representation.
(side-effect-free-fns): Add `interpreted-function-p` and `closurep`.
* lisp/emacs-lisp/nadvice.el (advice--interactive-form-1):
Use `interpreted-function-p`; adjust to new representation; and take
advantage of the fact that function values are now self-evaluating.
* lisp/emacs-lisp/disass.el (disassemble-internal): Adjust to
new representation.
* lisp/emacs-lisp/edebug.el (edebug--strip-instrumentation):
Use `interpreted-function-p`.
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers):
Add `closurep` and `interpreted-function-p`.
* test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Adjust to
more precise type info in `describe-function`.
* test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d--render-entries):
Use `interpreted-function-p`.
* test/lisp/emacs-lisp/macroexp-resources/vk.el (vk-f4, vk-f5):
Don't hardcode function values.
* doc/lispref/functions.texi (Anonymous Functions): Don't suggest that
function values are lists. Reword "self-quoting" to reflect the
fact that #' doesn't return the exact same object. Update examples
with the new shape of the return value.
* doc/lispref/variables.texi (Lexical Binding):
* doc/lispref/lists.texi (Rearrangement):
* doc/lispref/control.texi (Handling Errors): Update examples to reflect
new representation of function values.
Stefan Monnier [Sun, 24 Mar 2024 22:32:25 +0000 (18:32 -0400)]
(COMPILED): Rename to CLOSURE
In preparation for the use of `PVEC_COMPILED` objects for
interpreted functions, rename them to use a more neutral name.
* src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`.
(enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`.
Also use `CODE` rather than `BYTECODE`.
(CLOSUREP): Rename from `COMPILEDP`.
(enum Lisp_Closure): Rename from `Lisp_Compiled`.
* src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c,
* src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c,
* src/profiler.c: Rename all uses accordingly.
* src/.gdbinit (xclosure): Rename from `xcompiled`.
(xcompiled): New obsolete alias.
(xpr): Adjust accordingly. Also adjust to new PVEC_CLOSURE tag name.
Po Lu [Sun, 28 Apr 2024 12:57:33 +0000 (12:57 +0000)]
Implement dots and dashes on Haiku
* src/doc.c (store_function_docstring): Re-enable loading doc
strings of compiled functions from etc/DOC, which haiku-win,
ns-win, and the like require.
* src/haikuterm.c (haiku_draw_dash, haiku_fill_underline)
(haiku_draw_text_decoration): Port underline code from X.
Po Lu [Sun, 28 Apr 2024 08:58:58 +0000 (16:58 +0800)]
Implement dots and dashes on Android
* java/org/gnu/emacs/EmacsDrawLine.java (EmacsDrawLine)
(measureLine, polyDashPattern): New function.
(perform): Delegate to polyDashPattern if the line style is not
LineSolid. Also simplify now that anti-aliasing need no longer
be taken into account.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Mention
omission in commentary.
* java/org/gnu/emacs/EmacsGC.java (EmacsGC): Disable
anti-aliasing in default paint object.
<line_style, line>: New fields.
(markDirty): Apply stroke width.
Po Lu [Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)]
Implement dots and dashes on X
* src/dispextern.h (enum face_underline_type): Indent and expand
commentary as to the new dependency on the order of its
enumerals.
* src/xfaces.c (realize_gui_face): Enable dots and dashes on
window systems.
* src/xterm.c (x_draw_underwave): Don't define unused variable
on Cairo builds.
(x_draw_dash): New function; implement for X and Cairo.
(x_fill_underline): New function. Delegate to x_fill_rectangle
or x_draw_dash as appropriate.
(x_draw_glyph_string): Call x_fill_underline rather than
x_fill_rectangle.
Po Lu [Thu, 1 Jan 1970 00:00:00 +0000 (00:00 +0000)]
Port double-line underlines to GUI systems
* src/xterm.c (x_get_scale_factor): Replace display in first
argument with a pointer to dpyinfo.
(x_draw_underwave): Adjust to match.
(x_draw_glyph_string): Implement double-line underlines.