mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Merge from origin/emacs-29
644c71d678lisp/textmodes/bibtex.el: fix bibtex-beginning-of-entry (...ab38abfdf7lisp/textmodes/bibtex.el: Treat $ as punctuation in BibTe...d086cd6cf8Clarify the documentation of 'set-face-attribute'dafa6d6badHandle non-string values in pcompletebeed746f94Fix completion when completion-auto-select is set7ccb88486e; * etc/DEBUG: Update MS-Windows specifics for GDB 13 and...558b59d81bAdd color fontification in css-ts-mode (bug#60405)a96a7c8115; * lisp/textmodes/css-mode.el (css-ts-mode): Fix imenu s...793641a3db; * lisp/progmodes/js.el: Fix byte-compile warning.0aea1cf819* lisp/hi-lock.el (hi-lock--regexps-at-point): Fix bug (b...60418e6f09* src/keyboard.c (echo_add_key): Use recently rebound C-h...706ed85285Avoid assertion violations in treesit.c with --enable-che...38c35bf0f6Clean up treesit-default-defun-skipper and add comments9371d488beMerge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/...9d814bea46; whitespace.el: Use the new 'ert-with-buffer-selected' i...784e509bdeFix c-ts-mode bracket indentation (bug#60398)
This commit is contained in:
commit
89e7bb230d
14 changed files with 140 additions and 74 deletions
|
|
@ -3057,17 +3057,23 @@ If @var{frame} is @code{t}, this function sets the default attributes
|
|||
for newly created frames; they will effectively override the attribute
|
||||
values specified by @code{defface}. If @var{frame} is @code{nil},
|
||||
this function sets the attributes for all existing frames, as well as
|
||||
for newly created frames. However, if you want to @emph{reset} the
|
||||
value of an attribute to @code{unspecified} in a way that also affects
|
||||
newly created frames, you @emph{must} explicitly call this function
|
||||
with @var{frame} set to @code{t} and the value of the attribute set to
|
||||
@code{unspecified} (@emph{not} @code{nil}!@:), in addition to the call
|
||||
with @var{frame} set to @code{nil}. This is because the default
|
||||
attributes for newly created frames are merged with the face's spec in
|
||||
@code{defface} when a new frame is created, and so having
|
||||
@code{unspecified} in the default attributes for new frames will be
|
||||
unable to override @code{defface}; the special call to this function
|
||||
as described above will arrange for @code{defface} to be overridden.
|
||||
for newly created frames.
|
||||
|
||||
To @emph{unset} the value of an attribute, that is, to indicate that
|
||||
the face doesn't by itself specify a value for the attribute, the
|
||||
special value @code{unspecified} (@emph{not} @code{nil}!@:) must be
|
||||
used.
|
||||
|
||||
Note that the attribute-value pairs are evaluated in the order they
|
||||
are specified, except the @code{:family} and @code{:foundry}
|
||||
attributes, which are evaluated first. This means both that only the
|
||||
last value of a given attribute will be used, and that in some cases a
|
||||
different order will give different results. For example, when
|
||||
@code{:weight} is placed before @code{:font}, the weight value is
|
||||
applied to the current font of the face, and might be rounded to the
|
||||
closest available weight of that font, whereas when @code{:font} is
|
||||
placed before @code{:weight} the weight value is applied to the
|
||||
specified font.
|
||||
@end defun
|
||||
|
||||
The following commands and functions mostly provide compatibility
|
||||
|
|
|
|||
|
|
@ -277,8 +277,13 @@ GDB:
|
|||
If you do this, then typing C-c or C-BREAK into the console window
|
||||
through which you interact with GDB will stop Emacs and return control
|
||||
to the debugger, no matter if Emacs displays GUI or text-mode frames.
|
||||
This is the only reliable alternative on MS-Windows to get control to
|
||||
the debugger, besides setting breakpoints in advance.
|
||||
With GDB versions before 13.1, this is the only reliable alternative
|
||||
on MS-Windows to get control to the debugger, besides setting
|
||||
breakpoints in advance. GDB 13.1 changed the way C-c and C-BREAK are
|
||||
handled on Windows, so with those newer versions, you don't need the
|
||||
"set new-console 1" setting to be able to interrupt Emacs by typing
|
||||
C-c or C-BREAK into the console window from which you started Emacs
|
||||
and where you interact with GDB.
|
||||
|
||||
** Examining Lisp object values.
|
||||
|
||||
|
|
|
|||
|
|
@ -690,6 +690,10 @@ be reset to `unspecified' when creating new frames, disregarding
|
|||
what the FACE's face spec says, call this function with FRAME set to
|
||||
t and the ATTRIBUTE's value set to `unspecified'.
|
||||
|
||||
Note that the ATTRIBUTE VALUE pairs are evaluated in the order
|
||||
they are specified, except the `:family' and `:foundry'
|
||||
attributes which are evaluated first.
|
||||
|
||||
The following attributes are recognized:
|
||||
|
||||
`:family'
|
||||
|
|
|
|||
|
|
@ -569,24 +569,29 @@ the major mode specifies support for Font Lock."
|
|||
(when (and face-before face-after (not (eq face-before face-after)))
|
||||
(setq face-before nil))
|
||||
(when (or face-after face-before)
|
||||
(let* ((hi-text
|
||||
(buffer-substring-no-properties
|
||||
(if face-before
|
||||
(or (previous-single-property-change (point) 'face)
|
||||
(point-min))
|
||||
(point))
|
||||
(if face-after
|
||||
(or (next-single-property-change (point) 'face)
|
||||
(point-max))
|
||||
(point)))))
|
||||
(let* ((beg (if face-before
|
||||
(or (previous-single-property-change (point) 'face)
|
||||
(point-min))
|
||||
(point)))
|
||||
(end (if face-after
|
||||
(or (next-single-property-change (point) 'face)
|
||||
(point-max))
|
||||
(point))))
|
||||
;; Compute hi-lock patterns that match the
|
||||
;; highlighted text at point. Use this later in
|
||||
;; during completing-read.
|
||||
(dolist (hi-lock-pattern hi-lock-interactive-patterns)
|
||||
(let ((regexp (or (car (rassq hi-lock-pattern hi-lock-interactive-lighters))
|
||||
(car hi-lock-pattern))))
|
||||
(if (string-match regexp hi-text)
|
||||
(push regexp regexps)))))))
|
||||
(let ((pattern (or (rassq hi-lock-pattern hi-lock-interactive-lighters)
|
||||
(car hi-lock-pattern))))
|
||||
(cond
|
||||
((stringp pattern)
|
||||
(when (string-match pattern (buffer-substring-no-properties beg end))
|
||||
(push pattern regexps)))
|
||||
((functionp (cadr pattern))
|
||||
(save-excursion
|
||||
(goto-char beg)
|
||||
(when (funcall (cadr pattern) end)
|
||||
(push (car pattern) regexps))))))))))
|
||||
regexps))
|
||||
|
||||
(defvar-local hi-lock--unused-faces nil
|
||||
|
|
|
|||
|
|
@ -1474,7 +1474,10 @@ when the buffer's text is already an exact match."
|
|||
(if (and (eq this-command last-command) completion-auto-help)
|
||||
(minibuffer-completion-help beg end))
|
||||
(completion--done completion 'exact
|
||||
(unless expect-exact
|
||||
(unless (or expect-exact
|
||||
(and completion-auto-select
|
||||
(eq this-command last-command)
|
||||
completion-auto-help))
|
||||
"Complete, but not unique"))))
|
||||
|
||||
(minibuffer--bitset completed t exact))))))))
|
||||
|
|
|
|||
|
|
@ -645,13 +645,26 @@ parts of the list.
|
|||
|
||||
The OFFSET argument is added to/taken away from the index that will be
|
||||
used. This is really only useful with `first' and `last', for
|
||||
accessing absolute argument positions."
|
||||
(nth (+ (pcase index
|
||||
('first 0)
|
||||
('last pcomplete-last)
|
||||
(_ (- pcomplete-index (or index 0))))
|
||||
(or offset 0))
|
||||
pcomplete-args))
|
||||
accessing absolute argument positions.
|
||||
|
||||
When the argument has been transformed into something that is not
|
||||
a string by `pcomplete-parse-arguments-function', the text
|
||||
representation of the argument, namely what the user actually
|
||||
typed in, is returned, and the value of the argument is stored in
|
||||
the pcomplete-arg-value text property of that string."
|
||||
(let ((arg
|
||||
(nth (+ (pcase index
|
||||
('first 0)
|
||||
('last pcomplete-last)
|
||||
(_ (- pcomplete-index (or index 0))))
|
||||
(or offset 0))
|
||||
pcomplete-args)))
|
||||
(if (stringp arg)
|
||||
arg
|
||||
(propertize
|
||||
(buffer-substring (pcomplete-begin index offset)
|
||||
(pcomplete-begin (1- (or index 0)) offset))
|
||||
'pcomplete-arg-value arg))))
|
||||
|
||||
(defun pcomplete-begin (&optional index offset)
|
||||
"Return the beginning position of the INDEXth argument.
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ MODE is either `c' or `cpp'."
|
|||
`(((parent-is "translation_unit") parent-bol 0)
|
||||
((node-is ")") parent 1)
|
||||
((node-is "]") parent-bol 0)
|
||||
((node-is "}") (and parent parent-bol) 0)
|
||||
((node-is "}") c-ts-mode--bracket-children-anchor 0)
|
||||
((node-is "else") parent-bol 0)
|
||||
((node-is "case") parent-bol 0)
|
||||
((node-is "preproc_arg") no-indent)
|
||||
|
|
@ -133,7 +133,8 @@ MODE is either `c' or `cpp'."
|
|||
((match "#endif" "preproc_if") point-min 0)
|
||||
((match "preproc_function_def" "compound_statement") point-min 0)
|
||||
((match "preproc_call" "compound_statement") point-min 0)
|
||||
((parent-is "compound_statement") (and parent parent-bol) c-ts-mode-indent-offset)
|
||||
((parent-is "compound_statement")
|
||||
c-ts-mode--bracket-children-anchor c-ts-mode-indent-offset)
|
||||
((parent-is "function_definition") parent-bol 0)
|
||||
((parent-is "conditional_expression") first-sibling 0)
|
||||
((parent-is "assignment_expression") parent-bol c-ts-mode-indent-offset)
|
||||
|
|
@ -189,6 +190,21 @@ MODE is either `c' or `cpp'."
|
|||
('linux (alist-get 'linux (c-ts-mode--indent-styles mode)))))))
|
||||
`((,mode ,@style))))
|
||||
|
||||
(defun c-ts-mode--bracket-children-anchor (_n parent &rest _)
|
||||
"This anchor is used for children of a compound_statement.
|
||||
So anything inside a {} block. PARENT should be the
|
||||
compound_statement. This anchor looks at the {, if itson its own
|
||||
line, anchor at it, if it has stuff before it, anchor at the
|
||||
beginning of grandparent."
|
||||
(save-excursion
|
||||
(goto-char (treesit-node-start parent))
|
||||
(let ((bol (line-beginning-position)))
|
||||
(skip-chars-backward " \t")
|
||||
(treesit-node-start
|
||||
(if (< bol (point))
|
||||
(treesit-node-parent parent)
|
||||
parent)))))
|
||||
|
||||
(defun c-ts-mode--looking-at-star (&rest _)
|
||||
"A tree-sitter simple indent matcher.
|
||||
Matches if there is a \"*\" after point (ignoring whitespace in
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@
|
|||
(declare-function treesit-node-start "treesit.c")
|
||||
(declare-function treesit-node-end "treesit.c")
|
||||
(declare-function treesit-node-type "treesit.c")
|
||||
(declare-function treesit-query-compile "treesit.c")
|
||||
(declare-function treesit-query-capture "treesit.c")
|
||||
|
||||
;;; Constants
|
||||
|
||||
|
|
@ -3642,8 +3644,9 @@ OVERRIDE is the override flag described in
|
|||
"call_expression")))
|
||||
|
||||
(defvar js--treesit-lhs-identifier-query
|
||||
(treesit-query-compile 'javascript '((identifier) @id
|
||||
(property_identifier) @id))
|
||||
(when (treesit-available-p)
|
||||
(treesit-query-compile 'javascript '((identifier) @id
|
||||
(property_identifier) @id)))
|
||||
"Query that captures identifier and query_identifier.")
|
||||
|
||||
(defun js--treesit-fontify-assignment-lhs (node override start end &rest _)
|
||||
|
|
|
|||
|
|
@ -1822,8 +1822,9 @@ Initialized by `bibtex-set-dialect'.")
|
|||
1 '(11))))
|
||||
|
||||
(defvar bibtex-font-lock-keywords
|
||||
;; entry type and reference key
|
||||
`((,bibtex-any-entry-maybe-empty-head
|
||||
`(("\\$[^$\n]+\\$" . font-lock-string-face) ; bug#50202
|
||||
;; entry type and reference key
|
||||
(,bibtex-any-entry-maybe-empty-head
|
||||
(,bibtex-type-in-head font-lock-function-name-face)
|
||||
(,bibtex-key-in-head font-lock-constant-face nil t))
|
||||
;; optional field names (treated as comments)
|
||||
|
|
@ -3631,8 +3632,11 @@ if that value is non-nil.
|
|||
(setq-local fill-paragraph-function #'bibtex-fill-field)
|
||||
(setq-local font-lock-defaults
|
||||
'(bibtex-font-lock-keywords
|
||||
nil t ((?$ . "\"")
|
||||
;; Mathematical expressions should be fontified as strings
|
||||
nil t ((?$ . ".")
|
||||
;; Mathematical expressions should be fontified
|
||||
;; as strings. Yet `$' may also appear in certain
|
||||
;; fields like `URL' when it does not delimit
|
||||
;; a math expression (bug#50202).
|
||||
(?\" . ".")
|
||||
;; Quotes are field delimiters and quote-delimited
|
||||
;; entries should be fontified in the same way as
|
||||
|
|
@ -4079,11 +4083,19 @@ INIT is surrounded by field delimiters, unless NODELIM is non-nil."
|
|||
If inside an entry, move to the beginning of it, otherwise move to the
|
||||
beginning of the previous entry. If point is ahead of all BibTeX entries
|
||||
move point to the beginning of buffer. Return the new location of point."
|
||||
;; This command is similar to `beginning-of-defun', but with historical
|
||||
;; differences.
|
||||
;; - It does not move point to the previous entry if point is already
|
||||
;; at the beginning of an entry
|
||||
;; - It does not take an optional ARG that moves backward to the beginning
|
||||
;; of a defun ARG times.
|
||||
;; - It returns point and the code relies on this.
|
||||
(interactive)
|
||||
(skip-chars-forward " \t")
|
||||
(if (looking-at "@")
|
||||
(forward-char))
|
||||
(re-search-backward "^[ \t]*@" nil 'move)
|
||||
(beginning-of-line)
|
||||
;; `bibtex-any-valid-entry-type' would fail if users "disable"
|
||||
;; an entry by chosing an invalid entry type.
|
||||
(or (looking-at bibtex-any-entry-maybe-empty-head)
|
||||
(re-search-backward bibtex-any-entry-maybe-empty-head nil 'move))
|
||||
(point))
|
||||
|
||||
(defun bibtex-end-of-entry ()
|
||||
|
|
|
|||
|
|
@ -1804,11 +1804,15 @@ can also be used to fill comments.
|
|||
:syntax-table css-mode-syntax-table
|
||||
(when (treesit-ready-p 'css)
|
||||
;; Borrowed from `css-mode'.
|
||||
(setq-local syntax-propertize-function
|
||||
css-syntax-propertize-function)
|
||||
(add-hook 'completion-at-point-functions
|
||||
#'css-completion-at-point nil 'local)
|
||||
(setq-local fill-paragraph-function #'css-fill-paragraph)
|
||||
(setq-local adaptive-fill-function #'css-adaptive-fill)
|
||||
(setq-local add-log-current-defun-function #'css-current-defun-name)
|
||||
;; `css--fontify-region' first calls the default function, which
|
||||
;; will call tree-sitter's function, then it fontifies colors.
|
||||
(setq-local font-lock-fontify-region-function #'css--fontify-region)
|
||||
|
||||
;; Tree-sitter specific setup.
|
||||
(treesit-parser-create 'css)
|
||||
|
|
@ -1821,8 +1825,8 @@ can also be used to fill comments.
|
|||
(property constant string)
|
||||
(error variable function operator bracket)))
|
||||
(setq-local treesit-simple-imenu-settings
|
||||
`( nil ,(rx bos (or "rule_set" "media_statement") eos)
|
||||
nil nil))
|
||||
`(( nil ,(rx bos (or "rule_set" "media_statement") eos)
|
||||
nil nil)))
|
||||
(treesit-major-mode-setup)))
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
|||
|
|
@ -1779,13 +1779,17 @@ comments and multiline string literals. For example,
|
|||
This function tries to move to the beginning of a line, either by
|
||||
moving to the empty newline after a defun, or to the beginning of
|
||||
the current line if the beginning of the defun is indented."
|
||||
(cond ((and (looking-at (rx (* (or " " "\\t")) "\n"))
|
||||
(not (looking-at (rx bol))))
|
||||
(goto-char (match-end 0)))
|
||||
((save-excursion
|
||||
(skip-chars-backward " \t")
|
||||
(eq (point) (line-beginning-position)))
|
||||
(goto-char (line-beginning-position)))))
|
||||
;; Moving forward, point at the end of a line and not already on an
|
||||
;; empty line: go to BOL of the next line (which hopefully is an
|
||||
;; empty line).
|
||||
(cond ((and (looking-at (rx (* (or " " "\t")) "\n"))
|
||||
(not (bolp)))
|
||||
(forward-line 1))
|
||||
;; Moving backward, but there are some whitespace (and only
|
||||
;; whitespace) between point and BOL: go back to BOL.
|
||||
((looking-back (rx (+ (or " " "\t")))
|
||||
(line-beginning-position))
|
||||
(beginning-of-line))))
|
||||
|
||||
;; prev-sibling:
|
||||
;; 1. end-of-node before pos
|
||||
|
|
|
|||
|
|
@ -503,11 +503,10 @@ echo_add_key (Lisp_Object c)
|
|||
if ((NILP (echo_string) || SCHARS (echo_string) == 0)
|
||||
&& help_char_p (c))
|
||||
{
|
||||
AUTO_STRING (str, " (Type ? for further options, q for quick help)");
|
||||
AUTO_STRING (str, " (Type ? for further options, C-q for quick help)");
|
||||
AUTO_LIST2 (props, Qface, Qhelp_key_binding);
|
||||
Fadd_text_properties (make_fixnum (7), make_fixnum (8), props, str);
|
||||
Fadd_text_properties (make_fixnum (30), make_fixnum (31), props,
|
||||
str);
|
||||
Fadd_text_properties (make_fixnum (30), make_fixnum (33), props, str);
|
||||
new_string = concat2 (new_string, str);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2070,12 +2070,11 @@ Note that this function returns an immediate child, not the smallest
|
|||
|
||||
struct buffer *buf = XBUFFER (XTS_PARSER (XTS_NODE (node)->parser)->buffer);
|
||||
ptrdiff_t visible_beg = XTS_PARSER (XTS_NODE (node)->parser)->visible_beg;
|
||||
ptrdiff_t byte_pos = buf_charpos_to_bytepos (buf, XFIXNUM (pos));
|
||||
|
||||
treesit_check_position (pos, buf);
|
||||
|
||||
treesit_initialize ();
|
||||
|
||||
ptrdiff_t byte_pos = buf_charpos_to_bytepos (buf, XFIXNUM (pos));
|
||||
TSNode treesit_node = XTS_NODE (node)->node;
|
||||
TSNode child;
|
||||
if (NILP (named))
|
||||
|
|
@ -2106,14 +2105,14 @@ If NODE is nil, return nil. */)
|
|||
|
||||
struct buffer *buf = XBUFFER (XTS_PARSER (XTS_NODE (node)->parser)->buffer);
|
||||
ptrdiff_t visible_beg = XTS_PARSER (XTS_NODE (node)->parser)->visible_beg;
|
||||
ptrdiff_t byte_beg = buf_charpos_to_bytepos (buf, XFIXNUM (beg));
|
||||
ptrdiff_t byte_end = buf_charpos_to_bytepos (buf, XFIXNUM (end));
|
||||
|
||||
treesit_check_position (beg, buf);
|
||||
treesit_check_position (end, buf);
|
||||
|
||||
treesit_initialize ();
|
||||
|
||||
ptrdiff_t byte_beg = buf_charpos_to_bytepos (buf, XFIXNUM (beg));
|
||||
ptrdiff_t byte_end = buf_charpos_to_bytepos (buf, XFIXNUM (end));
|
||||
TSNode treesit_node = XTS_NODE (node)->node;
|
||||
TSNode child;
|
||||
if (NILP (named))
|
||||
|
|
|
|||
|
|
@ -42,13 +42,6 @@ nil, `whitespace-mode' is left disabled."
|
|||
'(whitespace-mode 1))
|
||||
,@body)))
|
||||
|
||||
(defmacro whitespace--with-buffer-selected (buffer-or-name &rest body)
|
||||
(declare (debug (form body)) (indent 1))
|
||||
`(save-window-excursion
|
||||
(with-current-buffer (or ,buffer-or-name (current-buffer))
|
||||
(with-selected-window (display-buffer (current-buffer))
|
||||
,@body))))
|
||||
|
||||
(defun whitespace-tests--faceup (&rest lines)
|
||||
"Convenience wrapper around `faceup-test-font-lock-buffer'.
|
||||
Returns non-nil if the concatenated LINES match the current
|
||||
|
|
@ -354,7 +347,7 @@ buffer's content."
|
|||
(indirect (clone-indirect-buffer (buffer-name) nil)))
|
||||
(should (eq (marker-buffer whitespace-bob-marker) base))
|
||||
(should (eq (marker-buffer whitespace-eob-marker) base))
|
||||
(whitespace--with-buffer-selected indirect
|
||||
(ert-with-buffer-selected indirect
|
||||
;; Mutate the indirect buffer to update its bob/eob markers.
|
||||
(execute-kbd-macro (kbd "z RET M-< a")))
|
||||
;; With Bug#59618, the above mutation would cause the base
|
||||
|
|
@ -382,7 +375,7 @@ buffer's content."
|
|||
;; because the buffer should only be killed on success.
|
||||
(indirect (clone-indirect-buffer nil nil)))
|
||||
(whitespace-tests--check-markers base 2 4)
|
||||
(whitespace--with-buffer-selected indirect
|
||||
(ert-with-buffer-selected indirect
|
||||
(whitespace-tests--check-markers indirect 2 4)
|
||||
;; Mutate the buffer to trigger `after-change-functions' and
|
||||
;; thus `whitespace--update-bob-eob'.
|
||||
|
|
@ -405,7 +398,7 @@ buffer's content."
|
|||
;; the buffer should only be killed on success.
|
||||
(clone (clone-buffer)))
|
||||
(whitespace-tests--check-markers orig 2 4)
|
||||
(whitespace--with-buffer-selected clone
|
||||
(ert-with-buffer-selected clone
|
||||
(whitespace-tests--check-markers clone 2 4)
|
||||
(execute-kbd-macro (kbd "z RET M-< a"))
|
||||
(whitespace-tests--check-markers clone 1 8))
|
||||
|
|
|
|||
Loading…
Reference in a new issue