]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoAdd :override flag for tree-sitter font-lock
Yuan Fu [Tue, 4 Oct 2022 20:28:46 +0000 (13:28 -0700)]
Add :override flag for tree-sitter font-lock

* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/treesit.el (treesit-font-lock-settings): Update docstring.
(treesit-font-lock-rules): Handle :override.
(treesit-font-lock-fontify-region): Handle :override.  Also set
inhibit-point-motion-hooks to t.

2 years ago; * doc/lispref/parsing.texi (Language Definitions): Fix typo.
Yuan Fu [Tue, 4 Oct 2022 20:02:07 +0000 (13:02 -0700)]
; * doc/lispref/parsing.texi (Language Definitions): Fix typo.

2 years agoFix python tree-sitter font-lock
Yuan Fu [Tue, 4 Oct 2022 19:18:53 +0000 (12:18 -0700)]
Fix python tree-sitter font-lock

Add fontification for lhs attribute and some operators.

* lisp/progmodes/python.el (python--treesit-keywords): Add operators.
(python--treesit-settings): Add lhs attribute.

2 years agoAdd treesit-language-version
Yuan Fu [Tue, 4 Oct 2022 19:16:47 +0000 (12:16 -0700)]
Add treesit-language-version

* doc/lispref/parsing.texi (Language Definitions): Update manual.
* src/treesit.c (Ftreesit_language_version): New function

2 years agoImprove documentation of tree-sitter search functions
Yuan Fu [Sun, 2 Oct 2022 03:29:35 +0000 (20:29 -0700)]
Improve documentation of tree-sitter search functions

* doc/lispref/parsing.texi (Retrieving Node): Update manual.
* src/treesit.c (treesit-search-subtree)
(treesit-search-forwardn)
(treesit-induce-sparse-tree): Mention case-insensitivity.
* lisp/treesit.el (treesit-simple-indent): Mention case-insensitivity.

2 years agoIgnore some capture name in treesit-font-lock-fontify-region
Yuan Fu [Sun, 2 Oct 2022 03:25:25 +0000 (20:25 -0700)]
Ignore some capture name in treesit-font-lock-fontify-region

* doc/lispref/modes.texi (Parser-based Font Lock): Update manual.
* lisp/treesit.el: (treesit-font-lock-fontify-region): Ignore names
that are not face nor function.
(treesit-font-lock-rules): Update docstring.

2 years agoRemove treesit-query-in
Yuan Fu [Sat, 1 Oct 2022 00:20:34 +0000 (17:20 -0700)]
Remove treesit-query-in

Because treesit-query-capture can now do everything it does.

* doc/lispref/parsing.texi (Pattern Matching): Update manual.
* lisp/treesit.el (treesit-query-in): Remove function.
* src/treesit.c (Ftreesit_query_capture): Accept parser and language
symbol as NODE.

2 years agoChange tree-sitter indent anchor preset 'prev-line'
Yuan Fu [Fri, 30 Sep 2022 23:54:42 +0000 (16:54 -0700)]
Change tree-sitter indent anchor preset 'prev-line'

* doc/lispref/modes.texi: Update manual.
* lisp/treesit.el (treesit-simple-indent-presets): Change prev-line to
mean bol of prev-line.

2 years agoFix tree-sitter manuals
Yuan Fu [Fri, 30 Sep 2022 23:51:21 +0000 (16:51 -0700)]
Fix tree-sitter manuals

* doc/lispref/modes.texi: Fix typos, reword, etc.
* doc/lispref/parsing.texi: Fix typos, reword, etc.

2 years ago; * lisp/progmodes/python.el (python-mode): Fix typo.
Yuan Fu [Sun, 25 Sep 2022 03:54:03 +0000 (20:54 -0700)]
; * lisp/progmodes/python.el (python-mode): Fix typo.

2 years agoFix treesit-induce-sparse-tree
Yuan Fu [Sun, 25 Sep 2022 03:52:32 +0000 (20:52 -0700)]
Fix treesit-induce-sparse-tree

Because not-at-all-werid way we implemented ts_build_sparse_tree, it’s
return value needs a bit post-processing (i.e., reverse its cdr).

* src/treesit.c (Ftreesit_induce_sparse_tree): Reverse the top-level
children list.
(ts_build_sparse_tree): Add comment.

2 years agoImprove treesit-search-forward-goto
Yuan Fu [Sun, 25 Sep 2022 03:42:03 +0000 (20:42 -0700)]
Improve treesit-search-forward-goto

* doc/lispref/parsing.texi (Retrieving Node): Update manual.
* lisp/treesit.el (treesit-search-forward-goto): Instead of taking a
node, use the node at point, and make sure we make progress.

2 years agoFix treesit-search-forward
Yuan Fu [Sun, 25 Sep 2022 03:41:30 +0000 (20:41 -0700)]
Fix treesit-search-forward

* src/treesit.c (ts_search_forward): Fix return value.

2 years agoUpdate and enable treesit-imenu function in python.el
Yuan Fu [Sun, 25 Sep 2022 02:41:17 +0000 (19:41 -0700)]
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.

2 years ago; Fix docstrings in treesit.el
Yuan Fu [Sun, 25 Sep 2022 02:39:10 +0000 (19:39 -0700)]
; Fix docstrings in treesit.el

* lisp/treesit.el (treesit-font-lock-rules)
(treesit-inspect-mode): Fix docstrings.

2 years agoAdd the treesit-search functions that supplant the removed ones
Yuan Fu [Sun, 25 Sep 2022 02:35:11 +0000 (19:35 -0700)]
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.

2 years agoRemove treesit-traverse functions
Yuan Fu [Sun, 25 Sep 2022 02:29:15 +0000 (19:29 -0700)]
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.

2 years agoAccept nil as NODE in treesit-node-text
Yuan Fu [Sun, 25 Sep 2022 02:24:06 +0000 (19:24 -0700)]
Accept nil as NODE in treesit-node-text

* lisp/treesit.el (treesit-node-text): Just wrap function body
in (when ...).

2 years ago; * src/treesit.c (Ftreesit_node_field_name_for_child): Doc fix.
Yuan Fu [Sun, 25 Sep 2022 02:23:21 +0000 (19:23 -0700)]
; * src/treesit.c (Ftreesit_node_field_name_for_child): Doc fix.

2 years agoChange make_string to build_string in treesit.c
Yuan Fu [Sun, 25 Sep 2022 02:22:49 +0000 (19:22 -0700)]
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.

2 years ago; Minor tree-sitter manual fix
Yuan Fu [Sun, 25 Sep 2022 02:20:59 +0000 (19:20 -0700)]
; Minor tree-sitter manual fix

* doc/lispref/parsing.texi (Retrieving Node): Remove the quote.

2 years ago; Minor manual fix for tree-sitter indent
Yuan Fu [Sun, 25 Sep 2022 02:20:06 +0000 (19:20 -0700)]
; Minor manual fix for tree-sitter indent

* doc/lispref/modes.texi (Parser-based Indentation): Change var to
code.

2 years agoImprove printing treesit nodes
Yuan Fu [Sun, 25 Sep 2022 02:19:03 +0000 (19:19 -0700)]
Improve printing treesit nodes

* src/print.c (print_vectorlike): Instead of position, print the type
of the node.

2 years agoRename treesit-expand-query/pattern
Yuan Fu [Wed, 21 Sep 2022 01:01:15 +0000 (18:01 -0700)]
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.

2 years agoUtilize tree-sitter in python.el
Yuan Fu [Thu, 22 Sep 2022 18:24:32 +0000 (11:24 -0700)]
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.

2 years agoImprove treesit-query-capture
Yuan Fu [Wed, 21 Sep 2022 01:10:01 +0000 (18:10 -0700)]
Improve treesit-query-capture

* src/treesit.c (Ftreesit_query_capture): Add a suggestion in the
signal message.

2 years agoFix treesit-query-validate
Yuan Fu [Wed, 21 Sep 2022 01:02:16 +0000 (18:02 -0700)]
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.

2 years agoRename treesit-expand-query/pattern
Yuan Fu [Wed, 21 Sep 2022 01:01:15 +0000 (18:01 -0700)]
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.

2 years agoAdd node-only parameter to treesit-query-capture
Yuan Fu [Thu, 8 Sep 2022 19:52:25 +0000 (12:52 -0700)]
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.

2 years ago* lisp/treesit.el (treesit-can-enable-p): Minor fix.
Yuan Fu [Thu, 8 Sep 2022 19:50:47 +0000 (12:50 -0700)]
* lisp/treesit.el (treesit-can-enable-p): Minor fix.

2 years agoFix tree-sitter manual entry for treesit-should-enable-p
Yuan Fu [Wed, 7 Sep 2022 23:15:01 +0000 (16:15 -0700)]
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.

2 years agoRemove treesit-disabled-modes and change treesit-should-enable-p
Yuan Fu [Wed, 7 Sep 2022 20:20:37 +0000 (13:20 -0700)]
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.

2 years agoAdd manual entry for tree-sitter search functions
Yuan Fu [Wed, 7 Sep 2022 18:52:13 +0000 (11:52 -0700)]
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.

2 years agoAdd tree-sitter font-lock settings helper function/macro
Yuan Fu [Wed, 7 Sep 2022 18:46:07 +0000 (11:46 -0700)]
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.

2 years agoMerge remote-tracking branch 'origin/master' into feature/tree-sitter
Yuan Fu [Mon, 29 Aug 2022 18:41:10 +0000 (11:41 -0700)]
Merge remote-tracking branch 'origin/master' into feature/tree-sitter

2 years ago; Autoload 'latin1-display-ucs-per-lynx'
Eli Zaretskii [Sun, 28 Aug 2022 05:57:13 +0000 (08:57 +0300)]
; Autoload 'latin1-display-ucs-per-lynx'

* lisp/international/latin1-disp.el (latin1-display-ucs-per-lynx):
Autoload it, since we autoload 'latin1-display'.

2 years agoFix two issues in xterm.c
Po Lu [Sun, 28 Aug 2022 04:02:43 +0000 (12:02 +0800)]
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.

2 years agoUse truncated-partial-width-window-p in more places (bug#56815)
Juri Linkov [Sat, 27 Aug 2022 19:52:03 +0000 (22:52 +0300)]
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.

2 years agoUse a list of text properties to search in symlink filenames in Wdired
Juri Linkov [Sat, 27 Aug 2022 19:43:40 +0000 (22:43 +0300)]
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).

2 years agoMake dynamic info-lookup more backwards-compatible
Lars Ingebrigtsen [Sat, 27 Aug 2022 13:44:12 +0000 (15:44 +0200)]
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).

2 years agoFix webp detection on some Macos systems
Daniel Martín [Sat, 27 Aug 2022 13:28:34 +0000 (15:28 +0200)]
Fix webp detection on some Macos systems

* configure.ac (HAVE_RSVG): Make webp detection work with Macos
10.3/Homebrew (bug#57420).

2 years agoFix regression with cursor motion in Magit buffers
Eli Zaretskii [Sat, 27 Aug 2022 11:06:15 +0000 (14:06 +0300)]
Fix regression with cursor motion in Magit buffers

* lisp/simple.el (line-move): Condition movement optimizations on
presence of very long lines.  (Bug#57433)

2 years agoFix antialias face attribute when text is scaled
Eli Zaretskii [Sat, 27 Aug 2022 10:13:48 +0000 (13:13 +0300)]
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)

2 years ago; * etc/NEWS: typo
Mattias Engdegård [Sat, 27 Aug 2022 10:00:31 +0000 (12:00 +0200)]
; * etc/NEWS: typo

2 years agoCC Mode: Remove double evaluation of self-quoting function in cc-langs.el
Alan Mackenzie [Sat, 27 Aug 2022 09:33:52 +0000 (09:33 +0000)]
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.

2 years agoSupport "replacement characters" on TTY frames
Eli Zaretskii [Sat, 27 Aug 2022 08:56:00 +0000 (11:56 +0300)]
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.

2 years agoFix crash when handling "swallowed" generic events
Po Lu [Sat, 27 Aug 2022 01:54:16 +0000 (09:54 +0800)]
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.

2 years agoxref-matches-in-files: Use with-connection-local-variables
Dmitry Gutov [Fri, 26 Aug 2022 22:09:47 +0000 (01:09 +0300)]
xref-matches-in-files: Use with-connection-local-variables

* lisp/progmodes/xref.el (xref-matches-in-files):
Use with-connection-local-variables (bug#57385).

2 years agoUse shr as default for mm-text-html-renderer
Stefan Kangas [Fri, 26 Aug 2022 20:12:19 +0000 (22:12 +0200)]
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>.

2 years agoClarify the :box attributes in Face Attributes lispref node
Lars Ingebrigtsen [Fri, 26 Aug 2022 12:27:25 +0000 (14:27 +0200)]
Clarify the :box attributes in Face Attributes lispref node

* doc/lispref/display.texi (Face Attributes): Mention that the
elements are optional (bug#50699).

2 years agoCC Mode: Fontify correctly a brace list element followed only by syntactic WS
Alan Mackenzie [Fri, 26 Aug 2022 15:51:21 +0000 (15:51 +0000)]
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.

2 years agoUse `rx' in Tramp where possible
Michael Albinus [Fri, 26 Aug 2022 14:19:47 +0000 (16:19 +0200)]
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.

2 years agoMake the *Ido COmpletions* buffer fit the window to the buffer
Lars Ingebrigtsen [Fri, 26 Aug 2022 12:02:57 +0000 (14:02 +0200)]
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.

2 years agoNew option 'thrifty' for Man-notify-method
Augusto Stoffel [Fri, 26 Aug 2022 11:12:28 +0000 (13:12 +0200)]
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).

2 years agoDelete blank lines at the start of the cited text in message-indent-citation
Lars Ingebrigtsen [Fri, 26 Aug 2022 10:30:30 +0000 (12:30 +0200)]
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.

2 years agoFix recent gamegrid.el change for nox build
Basil L. Contovounesios [Fri, 26 Aug 2022 10:12:15 +0000 (13:12 +0300)]
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.

2 years agoPacify obsolete gv warnings in xt-mouse-tests.el
Basil L. Contovounesios [Fri, 26 Aug 2022 09:53:49 +0000 (12:53 +0300)]
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.

2 years agoKill the buffer for the temp file after using '$<command>' in Eshell
Jim Porter [Sat, 20 Aug 2022 17:48:32 +0000 (10:48 -0700)]
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

2 years agoMerge from origin/emacs-28
Stefan Kangas [Fri, 26 Aug 2022 04:30:30 +0000 (06:30 +0200)]
Merge from origin/emacs-28

e3b8577525 ; * etc/DEBUG: Fix wording of "X protocol errors" section.

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Fri, 26 Aug 2022 04:30:30 +0000 (06:30 +0200)]
; Merge from origin/emacs-28

The following commit was skipped:

ba64d09156 Treat smtp-auth method from auth-info as a symbol

2 years agoMerge from origin/emacs-28
Stefan Kangas [Fri, 26 Aug 2022 04:30:29 +0000 (06:30 +0200)]
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.

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Fri, 26 Aug 2022 04:30:29 +0000 (06:30 +0200)]
; Merge from origin/emacs-28

The following commit was skipped:

82bcd44378 * configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHEC...

2 years agoRestore old code in x_sync_trigger_fence
Po Lu [Fri, 26 Aug 2022 01:42:35 +0000 (09:42 +0800)]
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.

2 years ago; * src/xterm.h (struct x_display_info): Update comment.
Po Lu [Fri, 26 Aug 2022 01:37:47 +0000 (09:37 +0800)]
; * src/xterm.h (struct x_display_info): Update comment.

2 years agoUpdate from Gnulib by running admin/merge-gnulib
Paul Eggert [Thu, 25 Aug 2022 23:16:56 +0000 (18:16 -0500)]
Update from Gnulib by running admin/merge-gnulib

2 years agoFix overflows in HAVE_XSYNC timestamp handling
Paul Eggert [Wed, 24 Aug 2022 01:18:13 +0000 (18:18 -0700)]
Fix overflows in HAVE_XSYNC timestamp handling

Also, port to platforms lacking CLOCK_MONOTONIC and int64_t, and
use 0 more consistently to represent missing timestamps.
* src/xterm.h (struct x_display_info):
Omit server_time_monotonic_p and server_time_offset if
!HAVE_CLOCK_GETTIME since they are unused in that case.
* src/xterm.h (struct x_display_info, struct x_output):
* src/xterm.c (x_sync_get_monotonic_time)
(x_sync_current_monotonic_time, x_sync_note_frame_times):
Use int_fast64_t instead of int64_t as POSIX doesn't
guarantee the latter.  Similarly for uint_fast64_t.
(x_sync_get_monotonic_time, x_sync_current_monotonic_time)
(x_sync_note_frame_times, x_display_set_last_user_time):
Check for integer overflow in time arithmetic.
(CLOCK_MONOTONIC): Define to CLOCK_REALTIME if absent.
(x_sync_current_monotonic_time): Check for clock_gettime failure
and fall back on CLOCK_REALTIME if CLOCK_MONOTONIC does not work,
which POSIX allows.
(x_sync_current_monotonic_time, x_sync_note_frame_times)
(x_display_set_last_user_time):
Use 0 more consistently to represent missing timestamps.

2 years agoFix unlikely core dump with Xaw
Paul Eggert [Tue, 23 Aug 2022 23:25:40 +0000 (16:25 -0700)]
Fix unlikely core dump with Xaw

* lwlib/lwlib-Xaw.c (make_dialog): Don’t dump core if calloc fails.
Caught with --enable-gcc-warnings.

2 years ago* lisp/progmodes/cc-langs.el (c-make-no-parens-syntax-table): Fix bug#57065
Stefan Monnier [Thu, 25 Aug 2022 20:59:30 +0000 (16:59 -0400)]
* lisp/progmodes/cc-langs.el (c-make-no-parens-syntax-table): Fix bug#57065

(c-lang-const c-make-mode-syntax-table) already returns a function,
so quote it to avoid double evaluation since it could fail if the
function is not self-evaluating, such as when it's a symbol or
a value of the form (closure ...).

2 years ago; * etc/DEBUG: Fix wording of "X protocol errors" section.
Eli Zaretskii [Thu, 25 Aug 2022 19:07:04 +0000 (22:07 +0300)]
; * etc/DEBUG: Fix wording of "X protocol errors" section.

2 years ago; * etc/NEWS: Fix wording of a recently-added entry.
Eli Zaretskii [Thu, 25 Aug 2022 18:56:50 +0000 (21:56 +0300)]
; * etc/NEWS: Fix wording of a recently-added entry.

2 years ago; * lisp/progmodes/grep.el (grep-command-position): Doc fix.
Eli Zaretskii [Thu, 25 Aug 2022 18:51:23 +0000 (21:51 +0300)]
; * lisp/progmodes/grep.el (grep-command-position): Doc fix.

2 years ago; Delete some commented out code from linum.el
Stefan Kangas [Thu, 25 Aug 2022 18:01:00 +0000 (20:01 +0200)]
; Delete some commented out code from linum.el

* lisp/linum.el (linum-mode): Delete code commented out since
2009.

2 years agoImprove explanation of init file in FAQ
Stefan Kangas [Thu, 25 Aug 2022 16:46:48 +0000 (18:46 +0200)]
Improve explanation of init file in FAQ

* doc/misc/efaq.texi (Setting up a customization file): Improve
and update section to reflect current behavior.  Add
cross-references back to this section.
* doc/emacs/custom.texi (Init File): Add comment to remind about
also updating the FAQ.
Ref: https://lists.gnu.org/r/emacs-devel/2022-08/msg01056.html

2 years agoDon't refer to Emacs 24.3 or older in FAQ
Stefan Kangas [Thu, 25 Aug 2022 16:06:30 +0000 (18:06 +0200)]
Don't refer to Emacs 24.3 or older in FAQ

* doc/misc/efaq.texi: Don't say that the FAQ has been edited.
(Displaying the current line or column, Automatic indentation)
(Problems with very large files, Emacs for other operating systems)
(Right-to-left alphabets, Expanding aliases when sending mail): Remove
references to Emacs 24.3 or older.

(Learning how to do something): Don't include the reference card
price; it is currently incorrect and is likely to be incorrect again
in the future.

2 years agoTreat smtp-auth method from auth-info as a symbol
Robert Pluim [Thu, 25 Aug 2022 16:13:16 +0000 (18:13 +0200)]
Treat smtp-auth method from auth-info as a symbol

The lookup of the SMTP auth method is done based on symbols, but
sometimes the requested value comes from `auth-info', in which case it
is a string, so call `intern-soft' to convert it to a symbol (which
does nothing if it's already a symbol).

* lisp/mail/smtpmail.el (smtpmail-try-auth-methods): Call
`intern-soft' on the smtp-auth key's value.  (Bug#57373)

Do not merge to master

2 years ago* lisp/wdired.el: Improve "Commentary" section.
Stefan Kangas [Thu, 25 Aug 2022 15:15:39 +0000 (17:15 +0200)]
* lisp/wdired.el: Improve "Commentary" section.

2 years ago* lisp/wdired.el: Doc fix; don't mention obsolete variable.
Stefan Kangas [Thu, 25 Aug 2022 15:11:05 +0000 (17:11 +0200)]
* lisp/wdired.el: Doc fix; don't mention obsolete variable.

2 years ago* lisp/progmodes/etags.el (next-file): Minor doc fix.
Stefan Kangas [Tue, 23 Aug 2022 14:18:57 +0000 (16:18 +0200)]
* lisp/progmodes/etags.el (next-file): Minor doc fix.

2 years agoAdd a new user option grep-command-position
Lars Ingebrigtsen [Thu, 25 Aug 2022 15:02:34 +0000 (17:02 +0200)]
Add a new user option grep-command-position

* lisp/progmodes/grep.el (grep-command): Mention it.
(grep-command-position): New user option.
(grep): Use it (bug#50502).

2 years agoDocument how :map and :scale interacts in image maps
Lars Ingebrigtsen [Thu, 25 Aug 2022 14:38:14 +0000 (16:38 +0200)]
Document how :map and :scale interacts in image maps

* doc/lispref/display.texi (Image Descriptors): Mention problems
with scaling (bug#50487).

2 years agoFix generalized variable documentation for recent change
Stefan Kangas [Thu, 25 Aug 2022 14:23:50 +0000 (16:23 +0200)]
Fix generalized variable documentation for recent change

* doc/lispref/variables.texi (Setting Generalized Variables): Delete
obsolete generalized variable 'frame-width'.

2 years agoMake a prefix go to the previous error
Lars Ingebrigtsen [Thu, 25 Aug 2022 14:20:07 +0000 (16:20 +0200)]
Make a prefix go to the previous error

* lisp/textmodes/flyspell.el (flyspell-goto-next-error): Make a
prefix find the previous error (bug#50443).

2 years agoMention C-x C-q + revert change in NEWS
Lars Ingebrigtsen [Thu, 25 Aug 2022 14:00:27 +0000 (16:00 +0200)]
Mention C-x C-q + revert change in NEWS

2 years agoTreat smtp-auth method from auth-info as a symbol
Robert Pluim [Thu, 25 Aug 2022 09:47:57 +0000 (11:47 +0200)]
Treat smtp-auth method from auth-info as a symbol

The lookup of the SMTP auth method is done based on symbols, but
sometimes the requested value comes from `auth-info', in which case it
is a string, so call `intern-soft' to convert it to a symbol (which
does nothing if it's already a symbol).

* lisp/mail/smtpmail.el (smtpmail-try-auth-methods): Call
`intern-soft' on the smtp-auth key's value.  (Bug#57373)

2 years agoAllow symlink creation on MS-Windows without Administrator privileges
Kien Nguyen [Wed, 24 Aug 2022 14:19:35 +0000 (23:19 +0900)]
Allow symlink creation on MS-Windows without Administrator privileges

* src/w32.c (symlink): Use the
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE flag when available.
(Bug#57386)

2 years agoFix warning about obsoleted generalized variables
Lars Ingebrigtsen [Thu, 25 Aug 2022 12:54:49 +0000 (14:54 +0200)]
Fix warning about obsoleted generalized variables

* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete):
Autoload so that the call here from gv.el (about obsolete
generalized variables) doesn't bug out (bug#57394).

2 years agoMake frame-width obsolete as a generalized variable
Lars Ingebrigtsen [Thu, 25 Aug 2022 12:42:59 +0000 (14:42 +0200)]
Make frame-width obsolete as a generalized variable

* lisp/emacs-lisp/gv.el (frame-width): Make obsolete as
generalized variable.

2 years agoFix instrumented eval-defun not printing "Edebug:" to the echo area
Daniel Martín [Thu, 25 Aug 2022 12:37:36 +0000 (14:37 +0200)]
Fix instrumented eval-defun not printing "Edebug:" to the echo area

* lisp/progmodes/elisp-mode.el (elisp--eval-defun): Determine if we're
instrumenting a function and call eval-region with PRINTFLAG set to
nil if so (Bug#50245).

* test/lisp/progmodes/elisp-mode-tests.el
(eval-defun-prints-edebug-when-instrumented): Add a new test.

2 years agoAdd hideshow-test.el file (bug#56635)
Lars Ingebrigtsen [Thu, 25 Aug 2022 12:29:43 +0000 (14:29 +0200)]
Add hideshow-test.el file (bug#56635)

2 years agoAdd Python blocks support for hideshow
kobarity [Thu, 25 Aug 2022 12:29:10 +0000 (14:29 +0200)]
Add Python blocks support for hideshow

* lisp/progmodes/python.el (python-nav-beginning-of-block-regexp):
New variable.
(python-hideshow-forward-sexp-function): Change to call
`python-nav-end-of-block'.
(python-hideshow-find-next-block): New function to be used as
FIND-NEXT-BLOCK-FUNC in `hs-special-modes-alist'.
(python-info-looking-at-beginning-of-block): New function to be
used as LOOKING-AT-BLOCK-START-P-FUNC in `hs-special-modes-alist'.
(python-mode): Change settings of `hs-special-modes-alist'.

* test/lisp/progmodes/python-tests.el
(python-hideshow-hide-levels-1): Fix to keep empty lines.
(python-info-looking-at-beginning-of-block-1)
(python-hideshow-hide-levels-3, python-hideshow-hide-levels-4)
(python-hideshow-hide-all-1, python-hideshow-hide-all-2)
(python-hideshow-hide-all-3, python-hideshow-hide-block-1): New
tests (bug#56635).

2 years agoExtend `hs-special-modes-alist' for languages such as Python
kobarity [Thu, 25 Aug 2022 12:28:22 +0000 (14:28 +0200)]
Extend `hs-special-modes-alist' for languages such as Python

* lisp/progmodes/hideshow.el (hs-special-modes-alist): Add
elements FIND-BLOCK-BEGINNING-FUNC, FIND-NEXT-BLOCK-FUNC, and
LOOKING-AT-BLOCK-START-P-FUNC.
(hs-find-block-beginning-func): New variable to hold
FIND-BLOCK-BEGINNING-FUNC.
(hs-find-next-block-func): New variable to hold
FIND-NEXT-BLOCK-FUNC.
(hs-looking-at-block-start-p-func): New variable to hold
LOOKING-AT-BLOCK-START-P-FUNC.
(hs-grok-mode-type): Set new variables from
`hs-special-modes-alist'.
(hs-find-next-block): New function.
(Misc.): Update callers of the above functions.

* test/lisp/progmodes/hideshow-tests.el: New test file (bug#56635).

2 years agoAllow not deleting the config.cache file with "make FAST=true bootstrap"
Lars Ingebrigtsen [Thu, 25 Aug 2022 12:18:45 +0000 (14:18 +0200)]
Allow not deleting the config.cache file with "make FAST=true bootstrap"

* Makefile.in: Add some commentary about make bootstrap,
./configure -C and FASTo
(top_bootclean): Don't delete config.cache here.
(top_distclean): Delete it here instead.
(bootstrap-clean): Allow not deleting the cache file.

* admin/emake (cores): Adjust.

2 years ago* configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHECK. (Bug#57380)
Andreas Schwab [Thu, 25 Aug 2022 07:51:40 +0000 (09:51 +0200)]
* configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHECK.  (Bug#57380)

(cherry picked from commit ce82300221f270241fdda1f5dfb567bdb1208543)

2 years agoMinor fixes in tramp-tests.el
Michael Albinus [Thu, 25 Aug 2022 09:08:48 +0000 (11:08 +0200)]
Minor fixes in tramp-tests.el

* test/lisp/net/tramp-tests.el (tramp--test-deftest-with-stat)
(tramp--test-deftest-with-perl)
(tramp--test-deftest-with-ls): Skip if underlying test didn't run
or lasted too long.
(tramp--test-shell-file-name): Do not depend on `tramp--test-adb-p'.

2 years ago* configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHECK. (Bug#57380)
Andreas Schwab [Thu, 25 Aug 2022 07:51:40 +0000 (09:51 +0200)]
* configure.ac: Move AC_LANG_PUSH/POP out of AC_CACHE_CHECK.  (Bug#57380)

2 years agoFix various problems with mouse highlight on XI2 builds
Po Lu [Thu, 25 Aug 2022 04:24:34 +0000 (12:24 +0800)]
Fix various problems with mouse highlight on XI2 builds

* src/dispextern.h (reset_mouse_highlight): Fix coding style.
* src/xterm.c (xi_position_changed): New functions.
(xi_report_motion_window_clear, handle_one_xevent): Don't report
motion events if the pixel position did not actually change.

* src/xterm.h (struct xi_device_t): New fields
`last_motion_window', `last_motion_x' and `last_motion_y'.

2 years agovc-merge: Look for 'merge-file' instead of 'merge'
Dmitry Gutov [Wed, 24 Aug 2022 22:15:24 +0000 (01:15 +0300)]
vc-merge: Look for 'merge-file' instead of 'merge'

* lisp/vc/vc.el (vc-merge):
Look for 'merge-file' in second clause (bug#50258).

2 years agoC++ Mode - Fontify "class Foo {\n ~Foo() noexcept;" correctly
Alan Mackenzie [Wed, 24 Aug 2022 19:27:32 +0000 (19:27 +0000)]
C++ Mode - Fontify "class Foo {\n  ~Foo() noexcept;" correctly

This fixes bug #49787.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): (In `if' form just
before CASE 8) Remove the (not ...) around the (looking-at
c-after-suffixed-type-maybe-decl-key).

* lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Add
`c-not-decl' to the values of c-type which are erased at the start of a
fontification.

2 years agoFix handling of UNCs in 'parse-colon-path
Eli Zaretskii [Wed, 24 Aug 2022 16:19:33 +0000 (19:19 +0300)]
Fix handling of UNCs in 'parse-colon-path

* lisp/files.el (parse-colon-path): Don't remove the second
leading slash on systems that support UNCs.  (Bug#57353)

* test/lisp/files-tests.el (files-tests-bug-21454): Update
expected results.
(files-colon-path): Add a new test pattern.

2 years agoCC Mode: Fontify args correctly when arglist closing ) is not on the same line
Alan Mackenzie [Wed, 24 Aug 2022 14:42:11 +0000 (14:42 +0000)]
CC Mode: Fontify args correctly when arglist closing ) is not on the same line

This fixes bug #56841.

* lisp/progmodes/cc-engine.el (c-forward-declarator): Fix an off-by-one
comparing the position after a c-forward-name with a limit.

* lisp/progmodes/cc-mode.el (c-fl-decl-end): Handle correctly point starting
inside a literal.  Insert a missing c-backward-syntactic-ws in the handling of
C++ attributes.  Correctly handle an unmatched (.  Better handle point
starting inside a [ or (.  Tidy up the handling of syntactic whitespace at the
end of the buffer.