Dmitry Gutov [Fri, 6 Jan 2023 01:12:20 +0000 (03:12 +0200)]
(ruby-ts-mode): Split font-lock feature 'builtin' into two
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Split the 'builtin' feature in two: 'builtin-constant' and
'builtin-variable'.
(ruby-ts-highlight-predefined-constants):
Drop the user option, the highlighting granularity can be chosen
using treesit-font-lock-recompute-features.
(ruby-ts--font-lock-settings): Update accordingly.
(ruby-ts--predefined-constants, ruby-ts--predefined-variables):
Fix docstrings.
Eli Zaretskii [Thu, 5 Jan 2023 20:33:51 +0000 (22:33 +0200)]
Avoid assertion violation due to fill-column indicator face
* src/xdisp.c (extend_face_to_end_of_line): Use the original
iterator metrics for the stretch glyph, the one unaffected by the
'fill-column-indicator' face. (Bug#60580)
Juri Linkov [Wed, 4 Jan 2023 07:57:06 +0000 (09:57 +0200)]
Tree-sitter doc fixes (bug#60524)
* doc/lispref/modes.texi (Parser-based Font Lock):
Replace :lang with :language.
* doc/lispref/parsing.texi (Language Grammar): Replace
treesit-load-suffixes with dynamic-library-suffixes.
(Retrieving Nodes): Fix function names.
(Tree-sitter Major Modes): Fix treesit-ready-p args.
Fix pxref to Parser-based Indentation.
(Tree-sitter C API): Fix function names.
* lisp/treesit.el (treesit--simple-indent-eval): Remove cond BODY
duplicated from CONDITION.
(treesit)<define-short-documentation-group>: Fix function names.
Daniel Martín [Tue, 3 Jan 2023 21:08:13 +0000 (22:08 +0100)]
Fontify C++ function definitions in c-ts-mode (bug#60529)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--declarator-identifier):
Teach the code how to extract the declarator of a node of type
"qualified_identifier".
(c-ts-mode--fontify-declarator): Consider the case where the
identifier in a function declarator is buried inside
"qualifier_identifier" nodes.
Dmitry Gutov [Tue, 3 Jan 2023 22:37:43 +0000 (00:37 +0200)]
(ruby-ts-add-log-current-function): Fix when between two methods
* lisp/progmodes/ruby-ts-mode.el
(ruby-ts-add-log-current-function): Fix the case when point is
between two methods. 'treesit-node-at' returs the 'def' node of
the method after point in such case, so it behaved like point was
inside the method below.
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-add-log-current-method-outside-of-method):
Update the test case.
* test/lisp/progmodes/ruby-mode-tests.el
(ruby-add-log-current-method-outside-of-method):
Mirror that change.
Dmitry Gutov [Tue, 3 Jan 2023 01:10:49 +0000 (03:10 +0200)]
Extract common code into ruby-base-mode to derive from
* lisp/progmodes/ruby-mode.el (ruby-base-mode):
New major base mode, to set up common vars and hooks.
(ruby-mode-variables): Delete. Move most code to ruby-base-mode.
And some -- to ruby-mode body.
(ruby-mode): Derive from ruby-base-mode. Also move some setup
to there.
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Derive from ruby-base-mode. Remove duplicating settings.
Dmitry Gutov [Tue, 3 Jan 2023 00:26:00 +0000 (02:26 +0200)]
ruby-ts-mode: Indentation fixes
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-keywords):
Fix for 'def' (which was misread as 'method' in the check).
(ruby-ts--indent-rules): Indent the curly block closer the same
way as the 'do ... end' closer.
Dmitry Gutov [Mon, 2 Jan 2023 22:41:25 +0000 (00:41 +0200)]
ruby-ts--font-lock-settings: Use more standard faces
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Use more standard faces for regexp literals and string
interpolation delimiters (following js-ts-mode).
Dmitry Gutov [Mon, 2 Jan 2023 21:26:39 +0000 (23:26 +0200)]
ruby-ts-mode: Standardize the string literal highlights
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
Use font-lock-string-face for %w() and `...`.
Use font-lock-constant-face (just like we do for symbol literals)
for symbol array literals, %i().
Combine the matchers for string content and heredocs.
Fontification improvements in typescript-ts-mode (bug#60500)
- highlight method-definitins in interfaces.
- only highlight variable-declarations, not variables
everywhere (consistency with other modes).
- move highlighting of method invocations to level 4
Eli Zaretskii [Mon, 2 Jan 2023 15:02:05 +0000 (17:02 +0200)]
Fix shrinking of the tab-bar
* src/haikufns.c (haiku_change_tab_bar_height):
* src/pgtkfns.c (pgtk_change_tab_bar_height):
* src/nsfns.m (ns_change_tab_bar_height):
* src/w32fns.c (w32_change_tab_bar_height):
* src/xfns.c (x_change_tab_bar_height): Don't let the number of
tab-bar lines degenerate to zero due to integer division.
(Bug#60210)
F. Jason Park [Thu, 29 Dec 2022 14:43:19 +0000 (06:43 -0800)]
Fix default-port regression in erc-select-read-args
* lisp/erc/erc.el (erc--warn-unencrypted): New function, likely
temporary, to warn new users connecting interactively to the default
server, "irc.libara.chat", via the default non-TLS port, 6667.
(erc-select-read-args): Remove stray code from incomplete feature
introduced by bug#56514. Ensure connecting always works with default
port, which is non-TLS. Respect `erc-prompt-for-password' when user
pastes URL containing password component into "server" prompt. Maybe
add `erc--warn-unencrypted' as one-off hook for impending connection.
* test/lisp/erc/erc-tests.el (erc-select-read-args): Always expect
password prompt and sometimes a non-TLS port when `erc' called
interactively. (Bug#60428.)
Daniel Martín [Sat, 31 Dec 2022 00:45:27 +0000 (01:45 +0100)]
Fix fontification of C++ reference return types (bug#60441)
* lisp/progmodes/c-ts-mode.el (c-ts-fontify-error): Treat
reference_declarator nodes the same as pointer_declarator nodes when
calculating the identifier to fontify.
Adjust function-call fontification in csharp-ts-mode (bug#60376)
- Ensure method-invocations are highlighted only on level 4.
- Ensure consistent fontification of variable declarations
(don't highlight usage of all variables).
- Fix issues with highlighting types in new() expressions.
- Fix issues with generic types in variable-declarations not using "var".
- Use fewer, more general queries for function-invocations. simplify code.
Fix shortdoc-tests failure with respect to regexp-opt-charset
* test/lisp/emacs-lisp/shortdoc-tests.el (regexp-opt): Require.
`regexp-opt-charset` is not autoloaded, and whether `regexp-opt` is
preloaded is configuration-dependent.
Eli Zaretskii [Sun, 1 Jan 2023 09:04:22 +0000 (11:04 +0200)]
Improve documentation of 'isearch-open-overlay-temporary'
* lisp/isearch.el (isearch-open-overlay-temporary): Document that
the overlay passed to the 'isearch-open-invisible-temporary'
function cannot be deleted too early. (Bug#60399)
Yuan Fu [Sat, 31 Dec 2022 22:27:51 +0000 (14:27 -0800)]
; Remove GRAMMAR-DIR from treesit-language-source-alist
Removing it doesn't affect building all the language grammars in
batch.sh, so it must be an artifact I added for something else and
later forgot to remove.
* lisp/subr.el (buffer-match-p): Look up the cadr instead of the cdr
for the negation in 'not'.
* doc/lispref/buffers.texi (Buffer List): Update documentation.
(Bug#58951)
Kévin Le Gouguec [Tue, 27 Dec 2022 14:40:43 +0000 (15:40 +0100)]
Simplify introduction of use-package manual
* doc/misc/use-package.texi (Getting Started): Do not advise requiring
the package, since the macro is autoloaded; also correct the macro's
name. (Bug#60366)
kobarity [Thu, 22 Dec 2022 14:08:40 +0000 (23:08 +0900)]
Fix python-shell-buffer-substring when retrieving a single statement
* lisp/progmodes/python.el (python-shell-buffer-substring): Do not add
"if True:" line when retrieving a single statement.
(python-shell-send-region): Add a reference to
`python-shell-buffer-substring' in docstring.
* test/lisp/progmodes/python-tests.el (python-shell-buffer-substring-13)
(python-shell-buffer-substring-14, python-shell-buffer-substring-15)
(python-shell-buffer-substring-16, python-shell-buffer-substring-17):
New tests. (Bug#60142)
* src/treesit.c (Ftreesit_language_abi_version): Fix a typo in
function's Lisp name. Doc fix.
(Ftreesit_language_available_p): Fix a typo in the function's C
name.
Eli Zaretskii [Fri, 30 Dec 2022 14:43:38 +0000 (16:43 +0200)]
; Fix recently modified docs of 'set-face-attribute' (bug#52493)
* doc/lispref/display.texi (Attribute Functions): Clarify wording
and restore removed information about resetting attributes to
'unspecified' for future frames.
* lisp/faces.el (set-face-attribute): Minor copyedit of doc
string.
Yuan Fu [Fri, 30 Dec 2022 10:56:26 +0000 (02:56 -0800)]
Add treesit-install-language-grammar
Per discussion on emacs-devel, I added function to install and compile
language grammars.
* lisp/treesit.el (treesit-language-source-alist): New variable.
(treesit-install-language-grammar)
(treesit--call-process-signal)
(treesit--install-language-grammar-1): New functions.
Yuan Fu [Fri, 30 Dec 2022 08:47:22 +0000 (00:47 -0800)]
Change "language definition" to "language grammar" in manual.
"Language grammar" is apparently the more widely used term among
people talking about tree-sitter. To avoid confusion, I think it's
good to use that rather than "language definition", which is a term
that I made up :-)
Feel free to revert this if it is too much change.
Gregory Heytings [Thu, 29 Dec 2022 22:41:58 +0000 (22:41 +0000)]
Clarify the documentation of 'set-face-attribute'
* lisp/faces.el (set-face-attribute): Mention the evaluation order
of attribute-value pairs in the docstring.
* doc/lispref/display.texi (Attribute Functions): Likewise, and
explain with an example that a different argument order might give
different results. Also align the documentation in the manual
with that of the docstring, whose changes were discussed in
bug#57499 but not included in the manual.
Gregory Heytings [Mon, 19 Dec 2022 22:18:22 +0000 (22:18 +0000)]
Handle non-string values in pcomplete
* lisp/pcomplete.el (pcomplete-arg): When
pcomplete-parse-arguments-function returns a non-string value,
return the string the user typed in, and attach the value as a
text property to that string. Fixes bug#59956 and bug#60021.
Gregory Heytings [Thu, 29 Dec 2022 21:50:26 +0000 (21:50 +0000)]
Fix completion when completion-auto-select is set
* lisp/minibuffer.el (completion--do-completion): Do not display
"Complete, but not unique" messages when completion-auto-select is
set. Fixes bug#60359.
Eli Zaretskii [Thu, 29 Dec 2022 11:52:09 +0000 (13:52 +0200)]
Avoid assertion violations in treesit.c with --enable-checking
* src/treesit.c (Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range): Check validity of buffer
positions before converting them to byte-positions, to avoid
assertion violations in buf_charpos_to_bytepos.