Yuan Fu [Tue, 14 Jun 2022 18:36:22 +0000 (11:36 -0700)]
Support compiled queries in treesit-query-capture
Last commit added this new type, this commit adds functionalities.
treesit.el only has documentation changes.
* lisp/treesit.el (treesit-query-in, treesit-font-lock-settings,
treesit-defun-query): Update docstring.
* src/treesit.c (make_ts_query): New function.
(Ftreesit_query_compile): New function.
(Ftreesit_query_capture): Remove code that creates a query object and
instead either use make_ts_query or use the give compiled query. Free
the query object conditonally.
(syms_of_treesit): New symbol.
Yuan Fu [Tue, 14 Jun 2022 06:01:04 +0000 (23:01 -0700)]
Add new type treesit-compiled-query
No intergration/interaction with the new type, just adding it.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add new type.
* src/alloc.c (cleanup_vector): Add gc for the new type.
* src/data.c (Ftype_of): Add switch case for the new type.
(syms_of_data): Add symbols for the new type.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add new type.
* src/treesit.c (Ftreesit_compiled_query_p): New function.
(syms_of_treesit): Add symbol for the new type.
* src/treesit.h (struct Lisp_TS_Query): New struct.
(TS_COMPILED_QUERY_P, XTS_COMPILED_QUERY, CHECK_TS_COMPILED_QUERY):
New macros.
* src/print.c (print_vectorlike): Add printing for the new type.
Yuan Fu [Mon, 13 Jun 2022 20:22:17 +0000 (13:22 -0700)]
Fix treesit-search-forward
Move the check for movement
(if (> arg 0)
;; Make sure we moved forward.
(> (funcall pos-fn node) starting-point)
;; Make sure we moved backward.
(< (funcall pos-fn node) starting-point))
into cl-loop:
if (treesit-node-eq cap-node node)
becomes
if (and (treesit-node-eq cap-node node)
(if (> arg 0)
;; Make sure we moved forward.
(> (funcall pos-fn node)
starting-point)
;; Make sure we moved backward.
(< (funcall pos-fn node)
starting-point)))
* lisp/treesit.el (treesit-search-forward): Move the check.
Yuan Fu [Sun, 12 Jun 2022 03:24:38 +0000 (20:24 -0700)]
Rename treesit-traverse-forward-depth-first
* lisp/treesit.el (treesit-traverse-forward): Rename to
'treesit-traverse-forward'.
(treesit-traverse-forward, treesit-search-forward): Use
the new name.
Yuan Fu [Fri, 13 May 2022 20:38:21 +0000 (13:38 -0700)]
Redefine treesit-node-at
The old 'treesit-node-at' becomes 'treesit-node-on'. The new
'treesit-node-at' has slightly different semantics. Now
'treesit-node-on' gets the smallest node covering a range and
'treesit-node-at' gets the smallest node after a position.
The reason of change can be found in the docstring of
'treesit-node-on' (the BEWARE part): its result can be sometimes
surprising/unexpected.
* doc/lispref/parsing.texi (Retrieving Node): Update manual.
* lisp/treesit.el (treesit-node-at): Change to new definition.
(treesit-node-on): Inherits the old definition of
'treesit-node-at'. Parameter END is now mandatory.
(treesit-language-at, treesit-node-field-name): Use the new '-on'
function.
(treesit-font-lock-fontify-region, treesit-simple-indent-presets,
treesit-indent): Use the new '-at' function.
* test/src/treesit-tests.el (treesit-node-supplemental): Update tests.
Yuan Fu [Mon, 9 May 2022 19:34:01 +0000 (12:34 -0700)]
Remove call to nconc to improve performance
* src/treesit.c (struct capture_range): New struct.
(ts_predicate_capture_name_to_text, ts_predicate_equal,
ts_predicate_match, ts_eval_predicates): Replace capture list with
capture_range.
(Ftreesit_query_capture): Remove call to nconc.
Yuan Fu [Sun, 13 Mar 2022 06:10:06 +0000 (22:10 -0800)]
Add tree-sitter intergration
* configure.ac (HAVE_TREE_SITTER, TREE_SITTER_OBJ): New variables.
(DYNAMIC_LIB_SUFFIX): new variable, I copied code from MODULES_SUFFIX
so the diff looks this way.
* doc/lispref/elisp.texi (Top): Add tree-sitter manual.
* doc/lispref/modes.texi (Font Lock Mode): mention tree-sitter.
(Parser-based Font Lock): New section.
(Auto-Indentation): Mention tree-sitter.
(Parser-based Indentation): New section.
* doc/lispref/parsing.texi (Parsing Program Source): New chapter.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add
treesit-parser and treesit-node type.
* lisp/treesit.el: New file.
* src/Makefile.in (TREE_SITTER_LIBS, TREE_SITTER_FLAGS,
TREE_SITTER_OBJ): New variables.
* src/alloc.c:
(cleanup_vector): Add cleanup code for treesit-parser and
treesit-node.
* src/casefiddle.c (casify_region): Notify tree-sitter parser of
buffer change.
* src/data.c (Ftype_of): Add treesit-parser and treesit-node type
(Qtreesit_parser, Qtreesit_node): New symbol.
* src/emacs.c (main): Add symbols in treesit.c.
* src/eval.c (define_error): Move the function to here.
* src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap,
insert_from_buffer_1, replace_range, del_range_2): Notify tree-sitter
parser of buffer change.
* src/json.c (define_error): Move this function out.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add treesit-parser and
treesit-node.
* src/lread.c (Vdynamic_library_suffixes): New variable.
* src/print.c (print_vectorlike): Add code for printing
treesit-parser and treesit-node.
* src/treesit.c: New file.
* src/treesit.h: New file.
* test/src/treesit-tests.el: New file.
Po Lu [Sat, 7 May 2022 01:34:35 +0000 (09:34 +0800)]
Fix freezes with some oddball menus
* src/xmenu.c (x_activate_menubar): Clear flag if dispatching
the event failed.
* src/xterm.c (handle_one_xevent): Check for sensitive
CascadeButton instead of row column type.
Eric Abrahamsen [Fri, 6 May 2022 17:14:08 +0000 (10:14 -0700)]
Fix handling of IMAP search strings
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-string): This was
a misunderstanding of what `multibyte-string-p' means. The check was
actually supposed to be whether the string was non-ascii or not.
* doc/emacs/maintaining.texi (VC Change Log): Remove the entries
for commands now removed from most VCs.
* lisp/vc/log-view.el (log-view-mode-menu): Disable menu entries
(bug#14531).
Eric Abrahamsen [Fri, 6 May 2022 16:37:07 +0000 (09:37 -0700)]
Don't force Gnus cache usage in nnvirtual
* lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers): We're not sure
why this was happening, but it shouldn't be necessary. Simply calling
`gnus-retrieve-headers' directly will use the cache if the user has
configured it.
Move buffer-local-set-state to subr because it's used at runtime
* lisp/subr.el (buffer-local-set-state)
(buffer-local-set-state--get, buffer-local-restore-state): Moved
from easy-mmode.el because they have to be available run-time.
Remove the P/N/M-p/M-n bindings from the general log-view map
* lisp/vc/log-view.el (log-view-mode-map): Remove the P/N/M-p/M-n
bindings (that are only usable in some VCs).
* lisp/vc/vc-sccs.el (vc-sccs-log-view-mode):
* lisp/vc/vc-rcs.el (vc-rcs-log-view-mode):
* lisp/vc/vc-cvs.el (vc-cvs-log-view-mode): New modes that bind
the P/N/M-p/M-n commands (bug#14531).
* lisp/emacs-lisp/easy-mmode.el (buffer-local-set-state--get)
(buffer-local-restore-state): Autoload. Perhaps it would be
better to move these functions to subr.el or something...
Po Lu [Fri, 6 May 2022 03:01:39 +0000 (11:01 +0800)]
Fix menu dismissal problems on Xt builds with XI2
* src/xmenu.c (prepare_for_entry_into_toolkit_menu)
(leave_toolkit_menu): New functions.
(create_and_show_popup_menu): Replace some of the grab logic
with resetting the XI event mask instead.
* lisp/emacs-lisp/crm.el: Set completion-list-insert-choice-function.
* lisp/emacs-lisp/crm.el (completing-read-multiple): Set buffer-local
completion-list-insert-choice-function that handles string values of args.
https://lists.gnu.org/archive/html/emacs-devel/2022-05/msg00017.html
Paul Eggert [Thu, 5 May 2022 15:56:19 +0000 (08:56 -0700)]
timestamp doc minor improvements
* doc/lispref/os.texi (Time of Day, Time Conversion)
(Time Calculations): Fix some confusion about decoded times,
timestamps, and time values. Exclude floating-point infinities
and NaNs from timestamps, as the code doesn’t always follow
IEEE-754 rules for them and whatever the code does, doesn’t matter
for timestamps anyway.
* doc/emacs/misc.texi (Interactive Shell): Document OSC directory
tracking more.
* lisp/shell.el (shell-dirtrack-mode): Link to the OSC directory
tracking function.
Po Lu [Thu, 5 May 2022 09:46:05 +0000 (09:46 +0000)]
Speed up opening fonts on Haiku
* src/font.h (font_property_index): Note that some font drivers
use the extra data in a font entity to store driver-specific
information.
* src/haiku_font_support.cc (BFont_find): Set font indices.
(be_open_font_at_index): New function.
(BFont_open_pattern): Clean up coding style.
* src/haiku_support.h (enum haiku_font_specification)
(struct haiku_font_pattern): New fields and specifications for
indices.
* src/haikufont.c (haikufont_pattern_to_entity, haikufont_open):
Use indices to open fonts if available in the extra data.
Po Lu [Thu, 5 May 2022 07:55:33 +0000 (15:55 +0800)]
Improve appearance of macOS font panel buttons
* src/nsterm.m (ns_create_font_panel_buttons):
([EmacsView noteUserCancelledSelection]): New functions.
([EmacsView showFontPanel]): Use those buttons instead.
Michael Albinus [Thu, 5 May 2022 07:54:31 +0000 (09:54 +0200)]
Add Tramp test
* test/lisp/net/tramp-tests.el (tar-mode): Require.
(tramp-test10-write-region-other-file-name-handler): New test.
(tramp-test31-interrupt-process, tramp-test31-signal-process):
Tag them :unstable unconditionally.
* test/lisp/net/tramp-resources/foo.tar.gz: New resource file.
Po Lu [Thu, 5 May 2022 04:58:47 +0000 (04:58 +0000)]
Take size into account when previewing fonts on Haiku
* src/haiku_support.cc (MessageReceived): Decode size sent and
handle `UPDATE_PREVIEW_DIALOG' message.
(UpdatePreview): Add current size.
(EmacsFontSelectionDialog): Assign correct modification messages
to the size entry.
Po Lu [Thu, 5 May 2022 03:10:30 +0000 (03:10 +0000)]
Allow displaying font preview on Haiku
* src/haiku_support.cc (class EmacsFontPreviewDialog)
(class DualLayoutView): New classes.
(class EmacsFontSelectionDialog): Add field for preview,
checkbox and layout view.
(MessageReceived): Handle new font preview messages.
(EmacsFontSelectionDialog): New constructor.
(FrameResized): Resize the layout view instead.
Eric Abrahamsen [Wed, 4 May 2022 19:54:37 +0000 (12:54 -0700)]
Remove bogus mode check from gnus topic update functions
* lisp/gnus/gnus-topic.el (gnus-topic-update-topics-containing-group):
(gnus-topic-update-topic): These functions originally checked to see
if we were in group mode, but later that check was changed to
'gnus-topic-mode, which never passes because 'gnus-topic-mode isn't a
major mode. Revert to checking for 'gnus-group-mode, and use
`derived-mode-p' while we're at it.
Juri Linkov [Wed, 4 May 2022 19:32:30 +0000 (22:32 +0300)]
* lisp/tab-bar.el: Use pixel-based alignment (bug#55207)
* lisp/tab-bar.el (tab-bar-format-align-right): Use string-pixel-width
on the string with tab-bar face to get the width in pixels to align.
(tab-bar-format-global): Remove string-trim-right to keep padding-right.
Robert Pluim [Wed, 4 May 2022 12:35:59 +0000 (14:35 +0200)]
* doc/emacs/killing.texi: Fix typos
* doc/emacs/killing.texi (Clipboard): Fix wording in description of
'save-interprogram-paste-before-kill'. Ensure the reference to
"Yanking Media" is not split over two lines.
Eli Zaretskii [Wed, 4 May 2022 09:04:53 +0000 (12:04 +0300)]
Fix restoring desktop from TTY-saved sessions
* lisp/frameset.el (frameset-restore): Don't override/fix position
of the restored frames for which we have geometry information
saved by a past GUI session. (Bug#55070)
Po Lu [Wed, 4 May 2022 08:48:24 +0000 (16:48 +0800)]
Turn on XInput 2 support by default
The support doesn't interfere with compatibility, since Emacs
built with XInput 2 support transparently falls back to Core
Input when a suitable version of the input extension is not
available. It also matured much sooner than expected, so
enabling this by default will lead to new features being
available to more users.
* INSTALL:
* configure.ac:
* etc/NEWS: Enable XInput 2 support by default.