Stefan Kangas [Sun, 15 Jan 2023 12:08:02 +0000 (13:08 +0100)]
Merge from origin/emacs-29
920a7d38e96 ; Fix typos 48a62c55465 Add constructor_declaration as java-ts-mode defun 72c45fa9109 Further improvement for non-string values in pcomplete 1ef359095ec ; * etc/NEWS (--with-native-compilation=aot): Tweak wording. a8eb9dd4006 Fix the case in first-completion revealed by minibuffer-t...
Initial support for forward/backward-sentence movement with
tree-sitter. Include all statements, and some declarations. Don't
include the bigger declarations we don't want to jump over too big
blocks of code.
* lisp/progmodes/java-ts-mode.el (java-ts-mode): Add relevant node
types to treesit-sentence-type-regexp.
Further improvement for non-string values in pcomplete
* lisp/pcomplete.el (pcomplete-arg): Use the string representation
of the argument value instead of the text representation of the
argument. Return the value, even when it is not a string, when
index is 'last'. Fixes bug#60464.
Jim Porter [Sun, 8 Jan 2023 21:50:50 +0000 (13:50 -0800)]
Use the 'field' property to navigate through Eshell prompts
* lisp/eshell/esh-mode.el (eshell-skip-prompt-function): Make
obsolete.
* lisp/eshell/em-prompt.el (eshell-prompt-regexp): Update docstring.
(eshell-prompt-initialize): Don't set 'eshell-skip-prompt-function'.
(eshell-next-prompt): Search for the 'field' property set to 'prompt'
to find the next prompt.
(eshell-previous-prompt): Move 'forward-line' call into
'eshell-next-prompt'.
(eshell-forward-matching-input, eshell-backward-matching-input):
Reimplement on top of 'eshell-next-prompt'.
(eshell-skip-prompt): Make obsolete.
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test/next-previous-prompt): New test.
Jim Porter [Sun, 8 Jan 2023 21:05:59 +0000 (13:05 -0800)]
Make 'eshell-bol' obsolete
Now that Eshell uses fields for its output, 'eshell-bol' is no longer
needed, and we can just use 'beginning-of-line'.
* lisp/eshell/esh-mode.el (eshell-bol): Mark obsolete.
(eshell-mode-map): Remove 'C-a' mapping.
(eshell-command-map): Use 'move-beginning-of-line'.
(eshell-move-argument, eshell-kill-input): Use 'beginning-of-line'.
(eshell-get-old-input): Remove unnecessary call to
'eshell-skip-prompt-function'.
* lisp/eshell/em-rebind.el (eshell-rebind-keys-alist): Remove 'C-a'
and '<home>' mappings; the global mapping for these
('move-beginning-of-line') does the same thing now.
Jim Porter [Sun, 8 Jan 2023 21:00:47 +0000 (13:00 -0800)]
Set the 'field' property for Eshell output
This makes Eshell work more like 'M-x shell', and lets the <home> key
move to the beginning of the user's input at the prompt (bug#60666).
* lisp/eshell/em-prompt.el (eshell-emit-prompt): Add 'field' property
to prompt.
(eshell-bol-ignoring-prompt): New function.
* lisp/eshell/esh-io.el: Declare 'eshell-interactive-print'...
(eshell-output-object-to-target): ... use it.
* lisp/eshell/esh-mode.el (eshell-output-filter-functions): Update
docstring.
(eshell-interactive-print): Set the output to have a field value of
'command-output'.
(eshell-output-filter): Rename to...
(eshell-interactive-filter): ... this, and take a buffer instead of a
process.
* lisp/eshell/esh-proc.el (eshell-interactive-process-filter): New
function, adapted from 'eshell-output-filter'...
(eshell-gather-process-output): ... use it.
Stefan Monnier [Sat, 14 Jan 2023 14:26:17 +0000 (09:26 -0500)]
(apropos-documentation): Don't try to parse .elc files
The old code scanned for #@ in .elc files, assuming they're
docstrings and then looking around them to try and guess to which
definition that docstring belongs, making many assumptions about how
the code happens to be layed out by bytecomp.
Replace that with code which relies on the (FILE . POS) info to
extract the docstring knowing already where they are and what def they
belong to.
* lisp/apropos.el (apropos-documentation-check-elc-file): Delete function.
(apropos--documentation-add-from-elc): New function to replace it.
(apropos--documentation-add): New function, extracted from
`apropos-documentation`.
(apropos-documentation): Use them. Let-bind `apropos-accumulator` and
`apropos-files-scanned`.
(apropos-documentation-internal): Don't handle the `cons` case any more.
(apropos-item): Don't declare as global var.
(apropos-documentation-check-doc-file): Use `apropos-item` as a local
var rather than a global var.
(apropos-print-doc): Receive `apropos-item` as arg rather than refer to
it as a global variable.
(apropos-print): Adjust calls accordingly.
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Indent
inside body.
(java-ts-mode--font-lock-settings): Add rule for name in
annotation_type_element_declaration.
Stefan Monnier [Sat, 14 Jan 2023 14:10:45 +0000 (09:10 -0500)]
Merge from origin/emacs-29
f1032bf24e7 Eglot: don't use "nil" as minibuffer initial input 1b9ffd28116 Fix dependency bug when building lwlib dc33a122230 Fix use of build_pure_c_string in treesit.c
Stefan Monnier [Sat, 14 Jan 2023 14:06:10 +0000 (09:06 -0500)]
apropos.el: Fix bug#60628
* lisp/apropos.el (apropos--map-preloaded-atoms): New function.
(apropos-documentation): Use it.
(apropos-documentation-check-elc-file): Don't presume #@ is preceded by
a newline (since that's not the case any more since commit 900b09c0235d54d5), but be more careful not to burp on false positives.
Fix indentation of object_expressions in csharp-ts-mode
* lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): Make
sure the opening brace is indented at parent-bol, and everything else
is indented.
Xi Lu [Sat, 7 Jan 2023 14:46:40 +0000 (22:46 +0800)]
Replace 'hfy-find-cmd' with 'directory-files-recursively'.
This removes a potential vulnerability to maliciously
named files. (Bug#60562)
* lisp/htmlfontify.el (hfy-exclude-file-rules): New defcustom.
(hfy-list-files): Reimplement using 'directory-files-recursively'.
Laurence Warne [Thu, 22 Dec 2022 17:16:08 +0000 (17:16 +0000)]
Preserve the window position with proced (bug#60381)
Preserve the window position for windows which display a proced
buffer, but are not the selected window when a proced buffer is
updated. Previously, the window position would be set to the
start of the buffer when a proced buffer was updated and it was
not displayed in the selected window.
Similarly, preserve the position in proced buffers which are not
displayed in any window by setting
'switch-to-buffer-preserve-window-point' to nil in proced buffers.
* lisp/proced.el (proced-auto-update-timer): Only update a given
proced buffer if it is displayed in a window.
(proced-update): Set the window position if the proced buffer is
displayed in a window.
(proced--position-info, proced--determine-pos): New Functions.
(proced-mode): Set 'switch-to-buffer-preserve-window-point' to
nil in proced buffers.
* test/lisp/proced-tests.el
(proced-update-preserves-pid-at-point-test): New test.
Eli Zaretskii [Sat, 14 Jan 2023 08:26:40 +0000 (10:26 +0200)]
Disable and document 'doc-view-mupdf-use-svg' (bug#58041)
* lisp/doc-view.el (doc-view-mupdf-use-svg): Disable by default.
* etc/NEWS: Document. Patch by Visuwesh <visuweshm@gmail.com>.
Do not merge to master.
Eshel Yaron [Sat, 14 Jan 2023 08:12:11 +0000 (10:12 +0200)]
Eglot: don't use "nil" as minibuffer initial input
Doing M-x eglot in a buffer for which buffer-file-name is nil, prompts
the user for a major mode to manage by invoking completing-read. The
way completing-read was called would end up with the string "nil" as
the initial minibuffer input, which is not very useful nor is it a
valid input.
* lisp/progmodes/eglot.el (eglot--guess-contact): Tweak prompt for
major mode. (Bug#60379)
Paul Eggert [Sat, 14 Jan 2023 02:22:47 +0000 (18:22 -0800)]
Fix dependency bug when building lwlib
* lwlib/Makefile.in (DEPFLAGS): Use OBJS to calculate dependency
file names, not ALLOBJS. This fixes a typo introduced
in 2015-05-15 "Replace AC_SUBST_FILE in configure with include in
Makefiles" that caused lwlib/*.o to not be rebuilt sometimes
when that was needed.
Paul Eggert [Sat, 14 Jan 2023 03:32:47 +0000 (19:32 -0800)]
Update from Gnulib by running admin/merge-gnulib
This adds a new file m4/xattr.m4 from Gnulib,
for NFS v4 attribute copying.
Also, do these changes by hand:
* configure.ac: Mention $LIB_XATTR" in ACL summary.
* src/Makefile.in (QCOPY_ACL_LIB): New macro.
(LIBES): Use it.
Yuan Fu [Sat, 14 Jan 2023 01:26:08 +0000 (17:26 -0800)]
Fix use of build_pure_c_string in treesit.c
This is brought up in bug#60691. build_pure_c_string should only be
used in places such as syms_of_treesit, which are called just once,
during dumping.
(treesit_load_language):
(Ftreesit_pattern_expand):
(Ftreesit_query_expand):
(treesit_eval_predicates): Use new varaibles.
(treesit_check_buffer_size):
(treesit_compose_query_signal_data):
(treesit_check_range_argument):
(Ftreesit_parser_set_included_ranges):
(treesit_predicate_capture_name_to_node):
(treesit_predicate_equal):
(treesit_predicate_match):
(treesit_predicate_pred): Use build_string for signal message.
Stefan Monnier [Fri, 13 Jan 2023 22:56:04 +0000 (17:56 -0500)]
(function-documentation): Make it work for the remaining cases
* lisp/simple.el (function-documentation):
Use `internal-subr-documentation` and make it work also with symbols
and macros.
* src/doc.c (Fsubr_documentation): New function, extracted
from Fdocumentation.
(syms_of_doc): defsubr it.
(Fdocumentation): Don't handle subrs and module functions here.
Daniel Martín [Sun, 8 Jan 2023 13:04:24 +0000 (14:04 +0100)]
Add c-ts-mode tests
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New .erts file
to test indentation of typical C constructs and prevent regression of
bug fixes.
* test/lisp/progmodes/c-ts-mode-tests.el: New file with c-ts-mode
tests.
Yuan Fu [Fri, 13 Jan 2023 01:29:14 +0000 (17:29 -0800)]
Fix c-ts-mode--fill-paragraph
Example:
doc: /* Return non-nil if NODE1 and NODE2 are the same node.
If any one of NODE1 and NODE2 is nil, return nil.
This function uses the same equivalence metric as `equal'. */
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fill-paragraph): Fix the
case where there are words before the /*, like the example above.
Eli Zaretskii [Fri, 13 Jan 2023 08:39:58 +0000 (10:39 +0200)]
Fix minor issues with 'pp' and related commands
* etc/NEWS:
* lisp/emacs-lisp/pp.el (pp-use-max-width, pp-emacs-lisp-code):
Mention in doc string that formatting via 'pp-emacs-lisp-code'
could be slow.
(pp-eval-expression, pp-macroexpand-expression): Honor
'pp-use-max-width'. (Bug#58687)
Remove deprecated RLS server from eglot server list
* lisp/progmodes/eglot.el (eglot-server-programs) Remove deprecated
RLS server from list since it is no longer maintained. (Bug#60761)
Ref: https://github.com/rust-lang/rls
Gregory Heytings [Thu, 12 Jan 2023 17:47:28 +0000 (19:47 +0200)]
* lisp/simple.el (next-completion): Handle first completion specially.
When completions-header-format is nil and completion-show-help is nil,
the first completion is at the beginning the buffer, so 'M-<down>'
missed it and moved to the second completion. Handle this case by
setting/checking the special text-property 'first-completion' that
is nil at the first call (bug#60411).
* test/src/coding-tests.el (coding-tests): Use
'with-coding-priority' instead of 'prefer-coding-system', as the
latter has global persistent effect and affects further tests.
Stefan Kangas [Thu, 12 Jan 2023 05:30:12 +0000 (06:30 +0100)]
Merge from origin/emacs-29
f4f30ff4c44 Update to Org 9.6.1 09f7a920644 Add support for annotation_type_declaration 4a8891a462e * etc/NEWS: Mention incompatible changes in 'outline-mino... 384504edf35 Ensure VC package names are not empty 70947da708c Handle missing package description when unpacking vc pack...
Add forward-sentence with tree sitter support (bug#60623)
* etc/NEWS: Mention the new changes.
* lisp/textmodes/paragraphs.el (forward-sentence-default-function):
Move old implementation to its own function.
(forward-sentence-function): New defvar defaulting to old behavior.
(forward-sentence): Use the variable in this function unconditionally.
* lisp/treesit.el (treesit-sentence-type-regexp): New defvar.
(treesit-forward-sentence): New defun.
(treesit-major-mode-setup): Conditionally set
forward-sentence-function.
* doc/emacs/programs.texi (Defuns): Add new subsection.
(Moving by Sentences): Add some documentation with xrefs to the elisp
manual and related nodes.
* doc/lispref/positions.texi (List Motion): Mention
treesit-sentence-type-regexp and describe how to enable this
functionality.
* lisp/emacs-lisp/package-vc.el (package-vc--unpack): Raise an error
if the package name is empty.
(package-vc-install): Avoid generating an empty file name, if a URL
ends with a slash, and raise an error if the package name is empty.
Alan Mackenzie [Tue, 10 Jan 2023 20:29:37 +0000 (20:29 +0000)]
CC Mode: partially revert commit from 2022-10-04
This reversion is of an ill-advised optimization, which resulted in non-type
identifiers getting fontified as types.
* lisp/progmodes/cc-fonts.el (c-fontify-new-found-type): Rather than writing
the expected face directly to the text, instead remove the `fontified'
property. This allows the full font-lock mechanism to fontify the buffer
correctly.
F. Jason Park [Wed, 4 Jan 2023 07:10:53 +0000 (23:10 -0800)]
Remove obsolete server buffers on MOTD in erc-track
* lisp/erc/erc-networks.el
(erc-networks--copy-server-buffer-functions): New internal hook
through which modules can perform housekeeping when server buffers
belonging to the same network context are merged.
(erc-networks--copy-over-server-buffer-contents): Run new internal
hook `erc-networks--copy-server-buffer-functions'.
* lisp/erc/erc-track.el (erc-track-enable, erc-track-disable): Manage
membership in `erc-networks--copy-server-buffer-functions' hook.
(erc-track--replace-killed-buffer): New function to replace server
buffer being killed in `erc-modified-channels-alist'.
* test/lisp/erc/erc-scenarios-base-association.el
(erc-scenarios-networks-merge-server-track): New test.
* test/lisp/erc/resources/networks/merge-server/track.eld: New test
data. (Bug#60560.)
F. Jason Park [Wed, 4 Jan 2023 07:10:53 +0000 (23:10 -0800)]
; Kill some stray buffers left behind by ERC tests
* test/lisp/erc/erc-services-tests.el
(erc--auth-source-search--plstore-standard,
erc--auth-source-search--plstore-announced,
erc--auth-source-search--plstore-overrides): Kill buffer renamed by
plstore. In the future, try using the `:buffer' keyword introduced in
Emacs 29.
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers): Don't forget about `erc-dcc-chat-mode'
buffers.
Stefan Kangas [Tue, 10 Jan 2023 08:51:57 +0000 (09:51 +0100)]
Merge from origin/emacs-29
55aabfea4ac Fix c-ts-mode comment indent 8377ed5298f Highlight identifier in import statements in js-ts-mode aa9df1260c3 Don't print named tree-sitter nodes with parenthesizes (b... e385c099b8c Improve fontification for import-statements in typescript... 28dd6021384 Fix c-ts-mode indentation for 2nd line in block comment (... 8a36a0f44aa ; xref.el: Bump version f16cc7c49c7 ; project.el: Bump version ebc5263667b ; * src/callint.c (Finteractive): Doc string clarification. c1401d1c6c8 * lisp/vc/diff-mode.el (diff-font-lock-keywords): Check f... 1f8ad353d9f Minor improvement for tree-sitter explorer ef87c755660 Make sure NODE is not the root node in tree-sitter indent... 1238fa8e49b Fix label indent of GNU and Linux style in c-ts-mode (bug... dc911e4ba5c Improve go-ts-mode Imenu, navigation and electric pair (b... 20f36c8f6f9 ; ruby.rb: Fix pattern matching syntax and extend the exa... d46f7f4edcc Revert "Add c-or-c++-ts-mode (bug#59613)" 1469aac20d8 ; * src/pgtkfns.c (parse_resource_key): Use recursive sch... da96a1fd741 Add back renamed function 'font-lock-fontify-syntacticall... b1aa720671e ; * lisp/progmodes/ruby-ts-mode.el: Fix compilation warni... 5cb01ac5d78 ; * src/callint.c (Finteractive): Fix the doc string (bug... 53e64cfb852 Improve options and docs of M-x command completion fef4f18cc33 ; Fix NEWS e04b3d41bb4 Update to Org 9.6-90-ga6523f e3d806b4172 Fix string fontification on python-ts-mode (bug#60599) 800e15e3be0 Fix string-interpolation feature of python-ts-mode (bug#6... 38b63f4c3ce Add indentation rule for concatenated_string (bug#60572) 2cdd75a18ff Fix highlighting of variable-declarations in typescript-t... 73168793c01 Fix label indentation for Linux style in c-ts-mode (bug#6... 8575043f56b Remove duplicate entries in c-ts-mode's Imenu ef7f3c6388b Fix use of treesit-ready-p in c/c++-ts-mode cc1de953d4f ; * lisp/progmodes/gud.el (gud-tooltip-modes): Add ts- mo... 16f1e47ca8b ; * lisp/align.el (align-c++-modes): Add c/c++-ts-mode. 508389ad2bb Add documentation for c/c++-ts-mode (bug#60443) ee3e8d3f927 (ruby-ts--font-lock-settings): Improve highlighting in pa... 614f8c431d3 Optionally include the namespace in c-ts-mode--declarator... 7c356934fbb Support namespaces in c++-ts-mode (bug#60397) 757c2c25922 Fix c-ts-mode--looking-at-star 1df2826639c Add c-or-c++-ts-mode (bug#59613) 0cb686ffb6b Document the 'definition-name' property. 7f855b5297b ; Fix description of etc/DOC e9341119fe4 ; Fix documentation of etc/DOC 86a3462e3d2 (treesit-simple-indent-presets): Do that for 'or' as well. e0fef510b00 ; Minor rewording of tree-sitter terminology f58452e3ae7 Fix 'python-shell-buffer-substring' when START is in midd... 7f9588685a0 ; Fix last change e8b85f225d9 Rearrange the "Saving Emacs Sessions" section of the user...
Yuan Fu [Mon, 9 Jan 2023 09:44:44 +0000 (01:44 -0800)]
Fix c-ts-mode indentation for 2nd line in block comment (bug#60270)
If the first line is "/*" or "/* ", indent like this:
/*
aaa
If the first line is "/* some text", indent like this:
/* some text
aaa
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles):
(c-ts-mode--looking-at-star): Minor refactor.
(c-ts-mode--comment-2nd-line-matcher)
(c-ts-mode--comment-2nd-line-anchor): New functions.
* lisp/treesit.el (treesit-simple-indent-presets):
prev-adaptive-prefix doesn't handle the comment-start-skip case (i.e,
2nd line) anymore. (Handled by the new matcher.)
Add named defun for transpose-sexps-default-function (bug#60654)
* lisp/simple.el (transpose-sexps-default-function): Move the lambda
into its own function.
(transpose-sexps-function): Refer to it by name.
* etc/NEWS: Mention the change.
Yuan Fu [Mon, 9 Jan 2023 04:30:07 +0000 (20:30 -0800)]
Minor improvement for tree-sitter explorer
If you open an empty python buffer and type
1 + 2
a
b
Currently the explorer only displays the top-level node at point, ie,
only 1 + 2, only a, or only b. That's kind of awkward, so if the
buffer is small, show the entire parse tree.
* lisp/treesit.el (treesit--explorer-refresh): See above.
Yuan Fu [Mon, 9 Jan 2023 03:05:19 +0000 (19:05 -0800)]
Make sure NODE is not the root node in tree-sitter indent (bug#60602)
There are two possible ways to solve the problem raised in the bug
report: either make sure NODE is never the root (so that parent is
never nil), or allow parent to be nil.
If we go with the latter, a lot of matcher and anchor functions need
change (they need to guard against a null parent). I tried it, and
needing to check for null parent is pretty annoying. In comparison,
if NODE is never the root, it is very convenient for the user, and it
doesn't complicate the rule that much (and it's rather intuitive,
people usually don't think of the case where NODE is the root node).
So that's what I choose.
* doc/lispref/modes.texi (Parser-based Indentation): Update manual.
* lisp/treesit.el (treesit-indent-function): Update docstring.
(treesit--indent-1): Make sure NODE is not the root.
Yuan Fu [Mon, 9 Jan 2023 00:57:29 +0000 (16:57 -0800)]
Fix label indent of GNU and Linux style in c-ts-mode (bug#60543)
The previous fix isn't correct.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): New indent rule. Fix the rule for Linux
style.
(c-ts-mode--top-level-label-matcher): New function.
Tad Fisher [Wed, 4 Jan 2023 21:40:17 +0000 (13:40 -0800)]
; * src/pgtkfns.c (parse_resource_key): Use recursive schema lookup
XDG_DATA_DIRS may consist of multiple directories, and
g_settings_schema_source_get_default composes these into a recursive
schema source. One must pass TRUE to g_settings_schema_source_lookup,
otherwise only the first directory in XDG_DATA_DIRS is searched.
It follows that in the case that the directory containing the compiled
GSettings schema for Emacs is not the first in XDG_DATA_DIRS,
parse_resource_key will not accept any resource key, which causes
pgtk_get_defaults_value and pgtk_set_defaults_value to fail.
This impacts systems that compose multiple GSettings schema sources
via XDG_DATA_DIRS, such Flatpak and NixOS.
Supporting GIO documentation for g_settings_schema_source_get_default:
> The returned source may actually consist of multiple schema sources
> from different directories, depending on which directories were given
> in `XDG_DATA_DIRS` and `GSETTINGS_SCHEMA_DIR`. For this reason, all
> lookups performed against the default source should probably be done
> recursively.