Po Lu [Wed, 8 Feb 2023 14:40:10 +0000 (22:40 +0800)]
Update Android port
* doc/lispref/frames.texi (On-Screen Keyboards): Describe return
value of `frame-toggle-on-screen-keyboard'.
* java/org/gnu/emacs/EmacsSurfaceView.java (surfaceChanged)
(surfaceCreated, EmacsSurfaceView): Remove unuseful
synchronization code. The framework doesn't seem to look at
this at all.
* java/org/gnu/emacs/EmacsView.java (EmacsView):
(onLayout): Lay out the window after children.
(swapBuffers): Properly implement `force'.
(windowUpdated): Delete function.
* lisp/frame.el (frame-toggle-on-screen-keyboard): Return
whether or not the on screen keyboard might've been displayed.
* lisp/minibuffer.el (minibuffer-on-screen-keyboard-timer):
(minibuffer-on-screen-keyboard-displayed):
(minibuffer-setup-on-screen-keyboard):
(minibuffer-exit-on-screen-keyboard): Improve OSK dismissal when
there are consecutive minibuffers.
* lisp/touch-screen.el (touch-screen-window-selection-changed):
New function.
(touch-screen-handle-point-up): Register it as a window
selection changed function.
* src/android.c (struct android_emacs_window)
(android_init_emacs_window): Remove references to
`windowUpdated'.
(android_window_updated): Delete function.
* src/android.h (struct android_output): Remove
`last_configure_serial'.
* src/androidterm.c (handle_one_android_event)
(android_frame_up_to_date):
* src/androidterm.h (struct android_output): Remove frame
synchronization, as that does not work on Android.
Po Lu [Wed, 8 Feb 2023 12:03:19 +0000 (20:03 +0800)]
Fix graphics state when instructing glyphs
* src/sfntfont.c (sfntfont_get_glyph_outline): Take new argument
STATE and restore it prior to instructing the glyph.
(sfntfont_measure_instructed_pcm, sfntfont_measure_pcm)
(sfntfont_draw): Adjust accordingly.
Po Lu [Wed, 8 Feb 2023 08:34:29 +0000 (16:34 +0800)]
Improve text display on Android port
* src/sfnt.c (sfnt_build_glyph_outline): Clear
build_outline_context.
(sfnt_poly_coverage): Extend coverage map.
(sfnt_prepare_raster): Always floor coordinates, since the
increase in coverage makes this hack unnecessary.
(sfnt_build_outline_edges): Likewise.
(sfnt_compare_edges): Remove function.
(sfnt_edge_sort): New function. Since edges are already
partially sorted, and there are not many, insertion sort
suffices.
(sfnt_poly_edges): Use sfnt_edge_sort.
(sfnt_fill_span): Stop rounding x0 and x1 to the grid, and make
coverage computation static.
(sfnt_lookup_glyph_metrics): Fix return code for unscaled
metrics.
(sfnt_scale_metrics): New function.
(SFNT_ENABLE_HINTING): Remove define.
(struct sfnt_cvt_table, struct sfnt_fpgm_table)
(struct sfnt_prep_table): Move to sfnt.h.
(sfnt_read_cvt_table):
(sfnt_read_fpgm_table, sfnt_read_prep_table): Make TEST_STATIC.
(struct sfnt_unit_vector, struct sfnt_interpreter_definition)
(struct sfnt_interpreter_zone, struct sfnt_graphics_state):
(struct sfnt_interpreter): Move to sfnt.h.
(sfnt_make_interpreter): Make TEST_STATIC.
(POP, PUSH, DELTAP1, DELTAP2, DELTAP3): When TEST, define to
regular push and pop.
(sfnt_deltac):
(sfnt_deltap): Fix order of arguments.
(IUP_SINGLE_PAIR): Fix interpolation loop wraparound.
(sfnt_interpret_font_program):
(sfnt_interpret_control_value_program): Make TEST_STATIC.
(struct sfnt_instructed_outline): Move to sfnt.h.
(sfnt_build_instructed_outline): Make TEST_STATIC.
(sfnt_interpret_simple_glyph):
(sfnt_x_raster):
(sfnt_test_raster):
(all_tests):
(sfnt_verbose):
(main): Improve test code.
* src/sfnt.h (SFNT_ENABLE_HINTING, struct sfnt_cvt_table)
(struct sfnt_fpgm_table, struct sfnt_prep_table)
(struct sfnt_unit_vector, struct sfnt_interpreter_definition)
(struct sfnt_interpreter_zone, struct sfnt_graphics_state)
(struct sfnt_interpreter, struct sfnt_instructed_outline)
(PROTOTYPE): New definitions.
* src/sfntfont-android.c (sfntfont_android_put_glyphs): Make
coordinate generation more straightforward.
* src/sfntfont.c (sfntfont_get_glyph_outline): New arguments
INTERPRETER and METRICS.
(struct sfnt_font_info): New tables.
(sfntfont_setup_interpreter): New function.
(sfntfont_open): Avoid memory leak. Set up interpreter.
(sfntfont_measure_instructed_pcm): New function.
(sfntfont_measure_pcm): Delegate to measure_instructed_pcm where
appropriate.
(sfntfont_close): Free new tables.
(sfntfont_draw): Scale metrics properly.
* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
* test/lisp/net/tramp-tests.el
(tramp-test26-interactive-file-name-completion): New test.
Eli Zaretskii [Mon, 6 Feb 2023 16:28:21 +0000 (18:28 +0200)]
Fix 'hack-local-variables' when EOL conversion is inhibited
* lisp/files.el (hack-local-variables--find-variables): Replace
CRs with newlines only if the original buffer is under explicit
selective-display. (Bug#61321)
Po Lu [Mon, 6 Feb 2023 14:55:42 +0000 (22:55 +0800)]
Port emacsclient wrapper to Android 7.1 and earlier
* java/org/gnu/emacs/EmacsNative.java (EmacsNative): Load every
native library on which Emacs depends prior to loading libemacs
itself.
* java/org/gnu/emacs/EmacsOpenActivity.java (readEmacsClientLog)
(EmacsOpenActivity, startEmacsClient): Don't use redirectError
on Android 7.1 and earlier.
Po Lu [Mon, 6 Feb 2023 14:00:08 +0000 (22:00 +0800)]
Update Android port
* java/AndroidManifest.xml.in: Prevent the Emacs activity from
being overlayed by the emacsclient wrapper.
* java/org/gnu/emacs/EmacsOpenActivity.java (run): Likewise.
(onCreate): Set an appropriate theme on ICS and up.
Allow unbind to commute with discardN and discardN-preserve-tos
* lisp/emacs-lisp/byte-opt.el (byte-after-unbind-ops):
Add discardN and discardN-preserve-tos, both of which
commute with unbind. This enables subsequent optimisations.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Remove code forcing forward motion after applying certain
transformations; these were only there to keep output identical across
refactorings.
LAP optimiser: bind local variables instead of mutating them
This is a refactoring step: there is no change in how the optimiser
works.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Instead of re-using local variables through mutation, bind them at
point of use. This ensures that there is no value leakage by mistake
and actually reduces the static size of the bytecode of this function
somewhat.
The lousy variable names (tmp, tmp2 etc) are retained but
can at least now be changed into something more descriptive.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Instead of using the O(n) `delq' to remove single instructions, use
the O(1) `setcdr'. To do this, anchor the instruction list in a cons
cell and use the predecessor cell in iteration.
* java/org/gnu/emacs/EmacsView.java (EmacsView): New flag
`isCurrentlyTextEditor'.
(showOnScreenKeyboard, hideOnScreenKeyboard): Set as
appropriate.
(onCheckIsTextEditor): Return its value.
Stefan Monnier [Sat, 4 Feb 2023 16:23:31 +0000 (11:23 -0500)]
nadvice: Fix bug#61179
Advising interactive forms relies on the ability to distinguish
interactive forms that do nothing else than return a function.
So, be careful to preserve this info.
Furthermore, interactive forms are expected to be evaluated in
the lexical context captured by the closure to which they belong,
so be careful to preserve that context when manipulating those forms.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form) <lambda>:
Preserve the info that an interactive form does nothing else than
return a function.
* lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): New function.
(advice--interactive-form): Use it.
(advice--make-interactive-form): Refine to also accept function values
quoted with `quote`. Remove obsolete TODO.
* test/lisp/emacs-lisp/nadvice-tests.el: Don't disallow byte-compilation.
(advice-test-bug61179): New test.
* lisp/emacs-lisp/oclosure.el (cconv--interactive-helper): Allow
the `if` arg to be a form.
* lisp/simple.el (oclosure-interactive-form): Adjust accordingly.
Po Lu [Sat, 4 Feb 2023 15:32:07 +0000 (23:32 +0800)]
Add emacsclient desktop file equivalent on Android
* doc/emacs/android.texi (Android File System):
* java/AndroidManifest.xml.in: Update with new activity. Remove
Android 10 restrictions through a special flag.
* java/org/gnu/emacs/EmacsNative.java (getProcName): New
function.
* java/org/gnu/emacs/EmacsOpenActivity.java (EmacsOpenActivity):
New file.
* java/org/gnu/emacs/EmacsService.java (getLibraryDirection):
Remove unused annotation.
* lib-src/emacsclient.c (decode_options): Set alt_display on
Android.
* src/android.c (android_proc_name): New function.
(NATIVE_NAME): Export via JNI.
Alan Mackenzie [Fri, 3 Feb 2023 20:55:59 +0000 (20:55 +0000)]
CC Mode: Fontify a certain foo * bar class by the asymmetric space heuristic
This fixes bug #61144. If the space around the * is "symmetric" we leave foo
* bar unfontified, a multiplication operation. If it is "asymmetric" we
fontify it as a pointer declaration.
* lisp/progmodes/cc-engine.el (c-fdoc-assymetric-space-about-asterisk): New
macro, extracted from c-forward-decl-or-cast-1.
(c-forward-decl-or-cast-1): Invoke the new macro twice, in CASE 16 (new) and
CASE 17.5 (the source of the macro). In CASE 16, additionally set
unsafe-maybe when appropriate.
Stefan Kangas [Fri, 3 Feb 2023 05:30:24 +0000 (06:30 +0100)]
Merge from origin/emacs-29
96ea27278b4 ; Fix c-ts-mode indent test d963a8f1355 Make c-ts-mode indent tests side-effect-free 8a6bdf88b4b Call treesit_record_change in insert_from_gap_1 a2b77c79dcc Use c-ts-common-statement-offset for closing brackets too 74e715cb729 ; Go back to original point when filling comments in c-ts... b8009bbf2d8 ; Fix error where we pass t to treesit-node-type in c-ts-... 88ccf78b206 ; * src/treesit.c (treesit_predicate_match): Simplify las... 20454128b8b Minor improvements in sqlite.c 3b3c47d977b (treesit_predicate_match): Match node text against regexp... e8334781c9f Improve documentation of gdb-mi's dedicated windows c4988840598 Avoid spurious pause in kill-ring-save (Bug#60841) 382ab516cef Change the default of 'treesit-defun-tactic' for 'c-ts-mode' 4d3428e95a9 Fix docstring fontification of CL's 'defstruct' 1c125baa3f0 Teach 'hs-minor-mode' about tree-sitter based modes 2de0ab5cbd3 ; Doc fixes in keymap.el c6660a6d6de Improve documentation of 'repeat-mode' and related variables be304bb3286 ; * etc/NEWS: Mention the 'utf-8-auto' bugfix (bug#60750).
Yuan Fu [Fri, 3 Feb 2023 02:23:21 +0000 (18:23 -0800)]
Make c-ts-mode indent tests side-effect-free
Running indent tests changes the global value of
c-ts-mode-indent-style. That's not good. This change fixes that.
I also refactored the indent style functions a bit.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--prompt-for-style): New function.
(c-ts-mode-set-local-style): New function.
(c-ts-mode-set-style): Use c-ts-mode--prompt-for-style. Use
derived-mode-p when testing for major mode. Remove check of current
buffer's major mode since it doesn't matter.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts:
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use
c-ts-mode-set-local-style to set the indent style locally.
Yuan Fu [Fri, 3 Feb 2023 01:22:22 +0000 (17:22 -0800)]
Call treesit_record_change in insert_from_gap_1
Before this change, insert_from_gap calls treesit_record_change but
insert_from_gap_1 doesn't. However, insert_from_gap_1 is a public
function and is called in many other places outside of insdel.c. This
could lead to tree-sitter's parse tree becoming out-of-sync with the
buffer content.
This change might fix bug#60650.
* src/insdel.c (insert_from_gap_1): Call treesit_record_change.
(insert_from_gap): Remove call to treesit_record_change.
* admin/notes/tree-sitter/treesit_record_change: New file.
Eli Zaretskii [Thu, 2 Feb 2023 19:45:44 +0000 (21:45 +0200)]
Minor improvements in sqlite.c
* src/sqlite.c (Fsqlite_next): Doc fix. Return nil if SQLITE_DONE
was once seen for this statement. (Bug#61151)
(row_to_value): Cons the value in reverse, to avoid the Fnreverse
call. Patch by Helmut Eller <eller.helmut@gmail.com>.
(Bug#61165)
Kévin Le Gouguec [Sun, 29 Jan 2023 10:23:01 +0000 (11:23 +0100)]
Avoid spurious pause in kill-ring-save (Bug#60841)
'indicate-copied-region' checks whether the region is "highlighted"
and if not, briefly moves point to mark to give a visual cue of the
extent of text that was saved to the kill ring.
The region is considered "highlighted" if (a) it is active and (b) its
face specifies a :background. That latter condition does not account
for the multiple ways in which the face can make the region "visually
distinct" from the default face, so switch to the more extensive
predicate face-differs-from-default-p.
The patch also fixes a couple of issues with the predicate's
implementation, and introduces a new user option in case anyone
happened to enjoy unconditional blinking.
* lisp/faces.el (face-differs-from-default-p): Filter out :extend; add
rationale for the attributes we ignore.
* lisp/simple.el (copy-region-blink-predicate): Add option to let
users explicitly opt into or out of blinking point and mark.
(region-indistinguishable-p): New function to detect
"if there is currently no active region highlighting", leveraging
face-differs-from-default-p.
(indicate-copied-region): Use it.
* src/xfaces.c (merge_face_ref): Allow :stipple to be nil, since it is
a documented valid value for that attribute.
* etc/NEWS: Announce user option.
Make `byte-compile-log-lap` more robust and produce nicer output.
This is of interest for Elisp compiler maintainers only.
* lisp/emacs-lisp/byte-opt.el (bytecomp--log-lap-arg): New.
(byte-compile-log-lap-1): Extract argument conversion and rewrite
in a more modern way, fixing bugs. In particular, tags are now
displayed as "X:" where X is the tag number, and that tag number
is shown as argument to goto-like ops.
(byte-optimize-lapcode): Clean up and simplify logging, producing
useful information when `byte-optimize-log` is `byte` as intended.
Po Lu [Thu, 2 Feb 2023 02:18:18 +0000 (10:18 +0800)]
Update Android port
* src/android.c (android_get_current_api_level): New function.
* src/android.h: Export it.
* src/sfntfont-android.c (init_sfntfont_android): Make device
API level detection always work.
Po Lu [Thu, 2 Feb 2023 02:11:02 +0000 (10:11 +0800)]
Update Android port
* src/sfnt.c (xmalloc, xrealloc): Improve behavior upon
allocation failures during test.
(sfnt_table_names): Add prep.
(sfnt_transform_coordinates): Allow applying offsets during
coordinate transform.
(sfnt_decompose_compound_glyph): Defer offset computation until
any component compound glyph is loaded, then apply it during the
transform process.
(sfnt_multiply_divide): Make available everywhere. Implement on
64 bit systems.
(sfnt_multiply_divide_signed): New function.
(sfnt_mul_fixed): Fix division overflow.
Stefan Kangas [Tue, 31 Jan 2023 05:30:26 +0000 (06:30 +0100)]
Merge from origin/emacs-29
1684e254a3b Update to Transient v0.3.7-196-gb91f509 327941b2112 CC Mode: Fix a coding bug in c-make-keywords-re. This sh... 2f3683cd4dc * lisp/isearch.el (isearch-emoji-by-name): Disable derive... 86b03046c00 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... e866490a077 Fix keymap inheritance in descendants of 'c-ts-base-mode' f67a9a12b7b Fix interactive use of `keymap-local-set' and `keymap-glo...
Jim Porter [Sun, 22 Jan 2023 21:20:46 +0000 (13:20 -0800)]
During completion, convert all Eshell arguments to strings
Eshell was already converting some types (numbers, nil) to strings, as
well as fixing up multiple-dot forms like ".../", so this way is more
consistent and should produce fewer problems for Pcomplete functions.
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments): Always
convert parsed arguments to strings.
* test/lisp/eshell/em-cmpl-tests.el (eshell-arguments-equal,
eshell-arguments-equal--equal-explainer): New functions.
(em-cmpl-test/parse-arguments/pipeline)
(em-cmpl-test/parse-arguments/multiple-dots)
(em-cmpl-test/parse-arguments/variable/numeric)
(em-cmpl-test/parse-arguments/variable/nil)
(em-cmpl-test/parse-arguments/variable/list)
(em-cmpl-test/parse-arguments/variable/splice): Use
'eshell-arguments-equal'.
Alan Mackenzie [Mon, 30 Jan 2023 20:02:36 +0000 (20:02 +0000)]
CC Mode: Fix a coding bug in c-make-keywords-re. This should fix bug #61135
* lisp/progmodes/cc-defs.el (c-make-keywords-re): Generate "\>" components in
result regexp when argument ADORN is `appendable'. This fully fixes a bug
which was half-fixed on 2019-01-22.
Eli Zaretskii [Mon, 30 Jan 2023 18:25:59 +0000 (20:25 +0200)]
Revert "Fix incremental build failures with tree-sitter"
This reverts commit 176830fe2bb1c80ee128e515f6223cddc8b0a2ca.
That commit isn't needed, since the problem was fixed
in another way, in the defcustom's :set function.
Robert Pluim [Mon, 30 Jan 2023 09:51:30 +0000 (10:51 +0100)]
Fix interactive use of `keymap-local-set' and `keymap-global-set'
* lisp/keymap.el (keymap-global-set, keymap-local-set): Convert the
read key sequence to a string when called interactively. Based on a
patch from Stephen Berman <stephen.berman@gmx.net>. (Bug#61149)
Eli Zaretskii [Mon, 30 Jan 2023 12:22:19 +0000 (14:22 +0200)]
; Fix build and startup without tree-sitter
* lisp/treesit.el (treesit--font-lock-level-setter): Don't loop
over all the buffers if tree-sitter is not built-in, or else
initialization of defcustom will fail. (Bug#61155)
* lisp/progmodes/rust-ts-mode.el (treesit-node-parent):
* lisp/progmodes/c-ts-common.el (treesit-node-parent): Declare, to
* avoid byte-compilation warnings.
Stefan Kangas [Mon, 30 Jan 2023 06:19:43 +0000 (07:19 +0100)]
Merge from origin/emacs-29
8360e12f0ea Update to Org 9.6.1-23-gc45a05 9058601308d ; * doc/emacs/misc.texi (Document View): Remove @footnote... 197f994384c Document tree-sitter features in the user manual b73539832d9 ; Remove treesit--font-lock-fast-mode-grace-count 64fee21d5f8 Fix dockerfile-ts-mode line continuation indentation (bug... 1970726e26a Use treesit-subtree-stat to determine treesit--font-lock-... 382e018856a Add treesit-subtree-stat a3003492ace Move c-ts-mode--statement-offset to c-ts-common.el 4b1714571c8 ; Fix byte-compile warnings in c-ts-mode.el f50cb7d7c4b ; Improve docstring of c-ts-mode--indent-style-setter 1c3ca3bb649 Fix <> syntax in rust-ts-mode 56e8607dc99 Fix spurious errors on Windows when deleting temporary *.... 2bd0b947538 Fix java class member without access modifier (bug#61115) 1de6ebf2878 Make treesit-font-lock-level a defcustom 6e50ee8bbb5 Add c-ts-mode-set-style and :set for c-ts-mode-indent-style 450db0587a9 Minor documentation improvements for outline-minor-mode (... 578e8926713 ; * doc/lispref/variables.texi (File Local Variables): Im... bc5ee2b7bf0 ; * src/comp.c: Remove Local Variables section to avoid w... 362678d90e1 python.el: Use correct regexp when enabling python-ts-mode 76bb46db9df ; * doc/emacs/frames.texi (Mouse References): Improve ind...