1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-31 01:20:37 -08:00
Commit graph

159464 commits

Author SHA1 Message Date
Yuan Fu
795e01ac24
Update and enable treesit-imenu function in python.el
* lisp/progmodes/python.el (python--treesit-settings): Add docstring.
(python--imenu-treesit-create-index-1): Rewrite with
treesit-induce-sparse-tree.
(python-imenu-treesit-create-index): Move main body to
python--imenu-treesit-create-index-1.
(python-imenu-treesit-create-flat-index): Fix typo.
(python-mode): Enable treesit-imenu.  Also fix indentation for
which-func code.
2022-09-24 21:11:30 -07:00
Yuan Fu
f071e61d10
; Fix docstrings in treesit.el
* lisp/treesit.el (treesit-font-lock-rules)
(treesit-inspect-mode): Fix docstrings.
2022-09-24 21:11:30 -07:00
Yuan Fu
eba6582436
Add the treesit-search functions that supplant the removed ones
The signatures also changed.

treesit-traverse-depth-first   -> treesit-search-subtree
treesit-traverse-breadth-first ->
treesit-traverse-forward       -> treesit-search-forward
treesit-search-forward         -> treesit-search-forward-goto
treesit-search-beginning/end   -> treesit-search-forward-goto
                               -> treesit-induce-sparse-tree

* doc/lispref/parsing.texi (Retrieving Node): Add relevant manual
sections.
* lisp/treesit.el (treesit-search-forward-goto): New function.
* src/treesit.c (ts_traverse_sibling_helper)
(ts_traverse_match_predicate)
(ts_search_dfs)
(ts_search_forward)
(treesit-search-subtree)
(treesit-search-forward)
(ts_build_sparse_tree)
(Ftreesit_induce_sparse_tree): Add functions.
* test/src/treesit-tests.el (treesit-node-supplemental): Add comments.
2022-09-24 21:11:30 -07:00
Yuan Fu
c957832cbf
Remove treesit-traverse functions
Remove before adding the replacements.

* doc/lispref/parsing.texi (Retrieving Node): Remove relevant sections.
* lisp/treesit.el (treesit-traverse-depth-first)
(treesit--traverse-breadth-first-1)
(treesit-traverse-breadth-first)
(treesit-next-sibling-or-up)
(treesit-traverse-forward)
(treesit-search-forward)
(treesit-search-beginning):
(treesit-search-end): Remove functions.
(treesit-defun-query): Remove variable.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Remove functions.
* test/src/treesit-tests.el: Remove comments.
2022-09-24 21:11:30 -07:00
Yuan Fu
1575ee2eeb
Accept nil as NODE in treesit-node-text
* lisp/treesit.el (treesit-node-text): Just wrap function body
in (when ...).
2022-09-24 21:11:30 -07:00
Yuan Fu
17422c2cfc
; * src/treesit.c (Ftreesit_node_field_name_for_child): Doc fix. 2022-09-24 21:11:30 -07:00
Yuan Fu
b584569014
Change make_string to build_string in treesit.c
* src/treesit.c (Ftreesit_node_string)
(Ftreesit_node_field_name_for_child): Change make_string to
build_string.
2022-09-24 21:11:29 -07:00
Yuan Fu
914f68da05
; Minor tree-sitter manual fix
* doc/lispref/parsing.texi (Retrieving Node): Remove the quote.
2022-09-24 21:11:29 -07:00
Yuan Fu
c5147882a9
; Minor manual fix for tree-sitter indent
* doc/lispref/modes.texi (Parser-based Indentation): Change var to
code.
2022-09-24 21:11:29 -07:00
Yuan Fu
08a1c32d0b
Improve printing treesit nodes
* src/print.c (print_vectorlike): Instead of position, print the type
of the node.
2022-09-24 21:11:29 -07:00
Yuan Fu
013c7d6aae
Rename treesit-expand-query/pattern
* src/treesit.c (treesit-expand-pattern): Rename to
treesit-patter-expand.
(treesit-expand-query): Rename to treesit-query-expand.
(make_ts_query): Use new name.
* test/src/treesit-tests.el (treesit-query-api): Fix name.
2022-09-24 21:11:29 -07:00
Yuan Fu
1cdb24fe35
Utilize tree-sitter in python.el
* lisp/progmodes/python.el (python-use-tree-sitter): New option.
(python--treesit-keywords, python--treesit-builtins)
(python--treesit-constants, python--treesit-operators)
(python--treesit-special-attributes, python--treesit-exceptions): New
variables.
(python--treesit-fontify-string, python--treesit-settings)
(python--imenu-treesit-create-index)
(python--imenu-treesit-create-flat-index)
(python-info-treesit-current-defun): New functions.
(python-mode): Enable tree-sitter font-lock and which-func.
2022-09-22 11:24:32 -07:00
Yuan Fu
361eaae71e
Improve treesit-query-capture
* src/treesit.c (Ftreesit_query_capture): Add a suggestion in the
signal message.
2022-09-20 18:36:52 -07:00
Yuan Fu
cb0464bf42
Fix treesit-query-validate
* lisp/treesit.el (treesit-query-validate): Add a call to
treesit-query-expand so this function works on both sexp and string
query, as expected.
2022-09-20 18:36:52 -07:00
Yuan Fu
55e01229da
Rename treesit-expand-query/pattern
* src/treesit.c (treesit-expand-pattern): Rename to
treesit-patter-expand.
(treesit-expand-query): Rename to treesit-query-expand.
(make_ts_query): Use new name.
2022-09-20 18:36:49 -07:00
Yuan Fu
1d3234988a
Add node-only parameter to treesit-query-capture
* doc/lispref/parsing.texi (Pattern Matching): Mention the new
parameter.
* lisp/treesit.el (treesit-query-in): Add node-only.
* src/treesit.c (Ftreesit_query_capture): Add node-only.
2022-09-08 12:52:25 -07:00
Yuan Fu
56dbb5db3b
* lisp/treesit.el (treesit-can-enable-p): Minor fix. 2022-09-08 12:50:47 -07:00
Yuan Fu
c2a9fe0c1d
Fix tree-sitter manual entry for treesit-should-enable-p
* doc/lispref/parsing.texi: Move two entries in the front to "Using
Parser" section, replacing the old entry.
2022-09-07 16:15:01 -07:00
Yuan Fu
a23aec59b3
Remove treesit-disabled-modes and change treesit-should-enable-p
Per emacs-devel discussion, remove treesit-disabled-modes and let
major modes to provide tree-sitter switches.  I also decided to add
treesit-max-buffer-size to elisp manual despite it being a user
option.  Though we should still add it to the user manual.

* doc/lispref/parsing.texi (Parsing Program Source): Update manual to
remove entries for treesit-diabled-modes and add
treesit-max-buffer-size.  Also update treesit-should-enable-p.
* lisp/treesit.el (treesit-disabled-modes): Remove user option.
(treesit-maximum-size): Change to treesit-max-buffer-size.
(treesit-should-enable-p): Change to treesit-can-enable-p and remove
checks of treesit-disabled-modes.
2022-09-07 13:20:37 -07:00
Yuan Fu
31ad906bd0
Add manual entry for tree-sitter search functions
* doc/lispref/parsing.texi (Retrieving Node): New subsection
"Searching for node".
* doc/lispref/positions.texi (List Motion): Add entries for
treesit-defun-query, treesit-beginning-of-defun, treesit-end-of-defun.
* lisp/treesit.el (treesit-search-forward, treesit-search-beginning)
(treesit-search-end): Minor docstring fix-up.
2022-09-07 11:52:13 -07:00
Yuan Fu
47a6c23751
Add tree-sitter font-lock settings helper function/macro
1. Add treesit-font-lock-rules that helps with settings
treesit-font-lock-settings.
2. Remove treesit-font-lock-defaults and with it, decoration levels.

Now major modes should set treesit-font-lock-settings with the output
of treesit-font-lock-rules rather than setting
treesit-font-lock-defaults.

* lisp/treesit.el (treesit-font-lock-settings): Update docstring.
(treesit-font-lock-rules): New function.
(treesit-font-lock-defaults): Remove variable.
(treesit-font-lock-enable): Remove code that interacts
treesit-font-lock-defaults.
* doc/lispref/modes.texi: Update manual for
treesit-font-lock-settings, treesit-font-lock-rules,
treesit-font-lock-defaults.
2022-09-07 11:46:07 -07:00
Yuan Fu
77d5a0cf9f Merge remote-tracking branch 'origin/master' into feature/tree-sitter 2022-08-29 11:41:10 -07:00
Eli Zaretskii
df2f6fb7fc ; Autoload 'latin1-display-ucs-per-lynx'
* lisp/international/latin1-disp.el (latin1-display-ucs-per-lynx):
Autoload it, since we autoload 'latin1-display'.
2022-08-28 08:57:13 +03:00
Po Lu
d704c61e25 Fix two issues in xterm.c
* src/xterm.c (x_atom_refs): Make EMACS_SERVER_TIME_PROP atom
have a vendor-specific prefix.
(x_query_pointer_1): Fix leak of button mask.
2022-08-28 12:02:43 +08:00
Juri Linkov
3f076a8e44 Use truncated-partial-width-window-p in more places (bug#56815)
* lisp/simple.el (line-move, line-move-finish):
Use truncated-partial-width-window-p.

* lisp/window.el (count-screen-lines, scroll-command--goto-goal-column):
Use truncated-partial-width-window-p.
(truncated-partial-width-window-p): Replace window-width with
window-total-width.

* src/indent.c (scan_for_column): Bring the logic of using
truncated-partial-width-window-p closer to what the display engine does.
2022-08-27 22:52:03 +03:00
Juri Linkov
0ab49d46dd Use a list of text properties to search in symlink filenames in Wdired
* lisp/dired-aux.el (dired-isearch-search-filenames):
Use text properties 'dired-filename' and 'dired-symlink-filename'.

* lisp/dired.el (dired-font-lock-keywords): Add text property
'dired-symlink-filename' on symlinks.

* lisp/isearch.el (isearch-search-fun-in-text-property):
Support a list of text properties (bug#57293).
2022-08-27 22:43:40 +03:00
Lars Ingebrigtsen
f427b985a1 Make dynamic info-lookup more backwards-compatible
* lisp/info-look.el (info-lookup--expand-info): Don't try to
expand elements that aren't functions (bug#57446).
2022-08-27 15:44:12 +02:00
Daniel Martín
716441a069 Fix webp detection on some Macos systems
* configure.ac (HAVE_RSVG): Make webp detection work with Macos
10.3/Homebrew (bug#57420).
2022-08-27 15:29:11 +02:00
Eli Zaretskii
a2d62456a7 Fix regression with cursor motion in Magit buffers
* lisp/simple.el (line-move): Condition movement optimizations on
presence of very long lines.  (Bug#57433)
2022-08-27 14:06:15 +03:00
Eli Zaretskii
6b1ed2f2c9 Fix antialias face attribute when text is scaled
This restores the code we had in realize_gui_face before commit bf0d3f7.
The problem described in bug#17973, which led to that commit, only
happens if one uses a specific (misc-fixed) font family, not for
the usual default fonts used by Emacs, and I'm not sure what's
described there is a bug at all.  At least for the purposes of
text-scale-adjust, it makes no sense to ignore the
foundry/family/adstyle of the original font, because we _want_ the
same (or very similar) font, just of a different size.

And likely in other use cases: if the :font attribute of a face
specifies some font properties, we want to keep them all, not
arbitrarily to ignore some of them.  And definitely catering to an
obscure use case such as the one cited in bug#17973 is NOT a good
reason to make such radical changes in face-realization behavior.

So I think backing out that part of commit bf0d3f7 is TRT, and if
we decide that this causes bug#17973 in too many situations we care
about, I'd rather find a kludge for that specific case than do that
for every face realization.
* src/xfaces.c (realize_gui_face): Preserve face attributes when
text is scaled.  This reverts part of the changes installed in
commit bf0d3f7.  (Bug#37473)
2022-08-27 13:13:48 +03:00
Mattias Engdegård
d19c7042b2 ; * etc/NEWS: typo 2022-08-27 12:01:19 +02:00
Alan Mackenzie
0f37808195 CC Mode: Remove double evaluation of self-quoting function in cc-langs.el
This is a followup to Stefan Monnier's fix for bug #57065 from 2022-08-25.

* lisp/progmodes/cc-langs.el (c-init-language-vars): Add a #' after the
funcall.
2022-08-27 09:33:52 +00:00
Eli Zaretskii
56aa52c346 Support "replacement characters" on TTY frames
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground):
* src/pgtkterm.c (pgtk_draw_glyphless_glyph_string_foreground):
* src/haikuterm.c (haiku_draw_glyphless_glyph_string_foreground):
* src/xterm.c (x_draw_glyphless_glyph_string_foreground):
* src/w32term.c (w32_draw_glyphless_glyph_string_foreground):
* src/xdisp.c (lookup_glyphless_char_display): Handle extra-slot
of 'glyphless-char-display' that is a cons cell.
(syms_of_xdisp) <glyphless-char-display>: Update doc string.

* etc/NEWS:
* doc/lispref/display.texi (Glyphless Chars): Document the new
feature.

* lisp/faces.el (glyphless-char): Make the face stand out on TTY
frames that don't support the underline attribute.
2022-08-27 11:56:00 +03:00
Po Lu
4015d561c3 Fix crash when handling "swallowed" generic events
* src/xmenu.c (x_menu_translate_generic_event, x_menu_show):
Pass through more events, correctly.
* src/xterm.c (handle_one_xevent): Don't abort if must_free_data
and xi_event is NULL; this is an Xlib bug.
2022-08-27 09:54:19 +08:00
Dmitry Gutov
6edff5ac33 xref-matches-in-files: Use with-connection-local-variables
* lisp/progmodes/xref.el (xref-matches-in-files):
Use with-connection-local-variables (bug#57385).
2022-08-27 01:09:47 +03:00
Stefan Kangas
c1442f96db Use shr as default for mm-text-html-renderer
* lisp/gnus/mm-decode.el (mm-text-html-renderer): Use 'shr' as
default to avoid a nil value.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
2022-08-26 22:14:17 +02:00
Lars Ingebrigtsen
997103bb87 Clarify the :box attributes in Face Attributes lispref node
* doc/lispref/display.texi (Face Attributes): Mention that the
elements are optional (bug#50699).
2022-08-26 20:00:10 +02:00
Alan Mackenzie
233c91d32a CC Mode: Fontify correctly a brace list element followed only by syntactic WS
This fixes a regression introduced in the fix for bug #56841 on 2022-08-24.

* lisp/progmodes/cc-engine (c-forward-declarator): Allow point to be at EOB
after the call to c-forward-name, rather than rejecting it as an invalid
declarator.  Also reindent a section of this function.
2022-08-26 15:51:21 +00:00
Michael Albinus
be2e6228f8 Use `rx' in Tramp where possible
* lisp/net/tramp.el:
* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-cache.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-compat.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-ftp.el:
* lisp/net/tramp-fuse.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-rclone.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sudoedit.el: Use `rx' where possible.

* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
Use `eval-when-compile'.
(tramp-adb-maybe-open-connection): Use file-property for "/".  Use
`eval-when-compile'.

* lisp/net/tramp-cmds.el (mm-7bit-chars): Declare.
(tramp-reporter-dump-variable): Simplify point movement.

* lisp/net/tramp-gvfs.el (tramp-dbus-function): Fix typo.
(tramp-zeroconf-parse-device-names): Use `tramp-prefix-port-format'.

* lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell):
Use `eval-when-compile'.  Improve sanity check.

* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp): Declare.
(tramp-set-syntax): Set also `tramp-completion-method-regexp'.
(tramp-volume-letter-regexp, tramp-completion-method-regexp-alist):
New defconsts.
(tramp-build-completion-method-regexp): New defun.
(tramp-completion-method-regexp): New defvar.
(tramp-completion-file-name-regexp-default)
(tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate)
(tramp-completion-file-name-regexp-alist): Remove.
(tramp-build-completion-file-name-regexp): Rwrite.
(tramp-make-tramp-file-name): Use `tramp-archive-method'.
(tramp-handle-file-directory-p): Ignore errors.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-handle-make-auto-save-file-name): Use `eval-when-compile'.

* test/lisp/net/tramp-archive-tests.el:
* test/lisp/net/tramp-tests.el: Use `rx' where possible.
(tramp-test01-file-name-syntax): Adapt test.
2022-08-26 16:19:47 +02:00
Lars Ingebrigtsen
4cb31b1935 Make the *Ido COmpletions* buffer fit the window to the buffer
* lisp/ido.el (ido-completion-help): Display the ido completions
buffer pretty much the same way that the default *Completions*
buffer is displayed (bug#50671).  This means that we're defaulting
to fit-window-to-buffer.
2022-08-26 14:02:57 +02:00
Augusto Stoffel
54a0c9569e New option 'thrifty' for Man-notify-method
* lisp/man.el (Man-notify-when-ready): Accept new 'thrifty' notify
method.
(Man-notify-method): Explain what 'thrifty' does (bug#57408).
2022-08-26 13:12:28 +02:00
Lars Ingebrigtsen
762a37b5e5 Delete blank lines at the start of the cited text in message-indent-citation
* lisp/gnus/message.el (message-indent-citation): Fix thinko in
the fix for the previous thinko.
2022-08-26 12:30:37 +02:00
Basil L. Contovounesios
2888a2e076 Fix recent gamegrid.el change for nox build
* lisp/play/gamegrid.el (gamegrid-make-glyph): Declare
image-scaling-factor as special before dynamically binding it, for
the sake of --without-x builds which do not preload lisp/image.el.
2022-08-26 13:12:15 +03:00
Basil L. Contovounesios
0f561d0e5c Pacify obsolete gv warnings in xt-mouse-tests.el
* test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Replace
deprecated generalized variables frame-width and frame-height with
direct calls to set-frame-width and set-frame-height, respectively.
2022-08-26 12:53:49 +03:00
Jim Porter
a457aa6257 Kill the buffer for the temp file after using '$<command>' in Eshell
* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Kill the temp
file's buffer when we're done.

Ref: https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-08/msg01444.html
2022-08-25 22:08:38 -07:00
Stefan Kangas
23c01a23a3 Merge from origin/emacs-28
e3b8577525 ; * etc/DEBUG: Fix wording of "X protocol errors" section.
2022-08-26 06:30:30 +02:00
Stefan Kangas
4ac59b3313 ; Merge from origin/emacs-28
The following commit was skipped:

ba64d09156 Treat smtp-auth method from auth-info as a symbol
2022-08-26 06:30:30 +02:00
Stefan Kangas
6d3d9dba60 Merge from origin/emacs-28
9e03e29c4e * lisp/wdired.el: Improve "Commentary" section.
92e90297f9 * lisp/wdired.el: Doc fix; don't mention obsolete variable.
2ccefef4c7 * lisp/progmodes/etags.el (next-file): Minor doc fix.
2022-08-26 06:30:29 +02:00
Stefan Kangas
743e966cb8 ; Merge from origin/emacs-28
The following commit was skipped:

82bcd44378 * configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHEC...
2022-08-26 06:30:29 +02:00
Po Lu
8cad97e3db Restore old code in x_sync_trigger_fence
* src/xterm.c (x_sync_trigger_fence): Restore old code, since that
makes it easier to adapt to more than 2 sync fences (which might be
necessary in the future, if we ever decide to do frame handling
asynchronously), and is much more recognizable for people coming from
other programs.
2022-08-26 09:42:35 +08:00