Merge from origin/emacs-29

5f882f4ee9 ; Fix doc string punctuation in ruby-ts-mode.el.
546a68925c Fix 'Info-goto-node-web' when NODE is given in various forms
7ff943044e Fix setting cursor when the window's op line has 'line-pr...
7f0bef47dd Drop extra parenthesis in example code in Emacs Lisp Intr...
fbaf113bf3 rust-ts-mode: appropriately fontify doc strings
bd62bdbc68 Fix example code in Emacs Lisp Introduction manual
c7e459132a Fix example in Emacs Lisp Intro manual
a6e9c26c8f ; * doc/emacs/files.texi (Save Commands): Fix last change.
f6a06ed6c5 Elisp manual: Mention 'write-region' for saving the buffer
4774a3abb4 Document, that PROCESS of signal-process can be a string
ab12628408 Fix typescript-ts-mode indentation for switch statements
This commit is contained in:
Eli Zaretskii 2023-12-02 10:05:51 -05:00
commit 59af2c6b15
10 changed files with 82 additions and 24 deletions

View file

@ -547,6 +547,10 @@ buffer name with the buffer's default directory (@pxref{File Names}).
to that major mode, in most cases. The command
@code{set-visited-file-name} also does this. @xref{Choosing Modes}.
If you wish to save the current buffer to a different file without
visiting that file, use @code{mark-whole-buffer} (@kbd{C-x h}), then
@w{@kbd{M-x write-region}} (@pxref{Misc File Ops}).
If Emacs is about to save a file and sees that the date of the latest
version on disk does not match what Emacs last read or wrote, Emacs
notifies you of this fact, because it probably indicates a problem caused

View file

@ -5986,12 +5986,12 @@ In outline, the whole function looks like this:
(and @var{are-both-transient-mark-mode-and-mark-active-true})
(push-mark))
(let (@var{determine-size-and-set-it})
(goto-char
(@var{if-there-is-an-argument}
@var{figure-out-where-to-go}
@var{else-go-to}
(point-min))))
@var{do-nicety}
(goto-char
(@var{if-there-is-an-argument}
@var{figure-out-where-to-go}
@var{else-go-to}
(point-min))))
@var{do-nicety}
@end group
@end smallexample
@ -6044,12 +6044,13 @@ like this:
@group
(if (> (buffer-size) 10000)
;; @r{Avoid overflow for large buffer sizes!}
(* (prefix-numeric-value arg)
(/ size 10))
(* (prefix-numeric-value arg)
(/ size 10))
(/
(+ 10
(*
size (prefix-numeric-value arg))) 10)))
(* size
(prefix-numeric-value arg)))
10))
@end group
@end smallexample
@ -6186,7 +6187,7 @@ The code looks like this:
@c Keep this on one line.
@smallexample
(/ (+ 10 (* size (prefix-numeric-value arg))) 10))
(/ (+ 10 (* size (prefix-numeric-value arg))) 10)
@end smallexample
@need 1200
@ -6203,7 +6204,7 @@ enclosing expression:
(*
size
(prefix-numeric-value arg)))
10))
10)
@end group
@end smallexample

View file

@ -1516,6 +1516,9 @@ If @var{process} is a process object which contains the property
@code{remote-pid}, or @var{process} is a number and @var{remote} is a
remote file name, @var{process} is interpreted as process on the
respective remote host, which will be the process to signal.
If @var{process} is a string, it is interpreted as process object with
the respective process name, or as a number.
@end deffn
Sometimes, it is necessary to send a signal to a non-local

View file

@ -1787,11 +1787,24 @@ By default, go to the current Info node."
(interactive (list (Info-read-node-name
"Go to node (default current page): " Info-current-node))
Info-mode)
(browse-url-button-open-url
(Info-url-for-node (format "(%s)%s" (file-name-sans-extension
(file-name-nondirectory
Info-current-file))
node))))
(let (filename)
(string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
node)
(setq filename (if (= (match-beginning 1) (match-end 1))
""
(match-string 2 node))
node (match-string 3 node))
(let ((trim (string-match "\\s +\\'" filename)))
(if trim (setq filename (substring filename 0 trim))))
(let ((trim (string-match "\\s +\\'" node)))
(if trim (setq node (substring node 0 trim))))
(if (equal filename "")
(setq filename (file-name-sans-extension (file-name-nondirectory
Info-current-file))))
(if (equal node "")
(setq node "Top"))
(browse-url-button-open-url
(Info-url-for-node (format "(%s)%s" filename node)))))
(defun Info-url-for-node (node)
"Return a URL for NODE, a node in the GNU Emacs or Elisp manual.
@ -1817,8 +1830,10 @@ and elisp manuals are supported."
""))
(concat "https://www.gnu.org/software/emacs/manual/html_node/"
manual "/"
(url-hexify-string (string-replace " " "-" node))
".html")))
(and (not (equal node "Top"))
(concat
(url-hexify-string (string-replace " " "-" node))
".html")))))
(defvar Info-read-node-completion-table)

View file

@ -197,8 +197,8 @@
(defun ruby-ts--comment-font-lock (node override start end &rest _)
"Apply font lock to comment NODE within START and END.
Applies `font-lock-comment-delimiter-face' and
`font-lock-comment-face' See `treesit-fontify-with-override' for
values of OVERRIDE"
`font-lock-comment-face'. See `treesit-fontify-with-override' for
values of OVERRIDE."
;; Empirically it appears as if (treesit-node-start node) will be
;; where the # character is at and (treesit-node-end node) will be
;; the end of the line

View file

@ -153,7 +153,7 @@
:language 'rust
:feature 'comment
'(([(block_comment) (line_comment)]) @font-lock-comment-face)
'(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
:language 'rust
:feature 'delimiter
@ -293,6 +293,17 @@
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings for `rust-ts-mode'.")
(defun rust-ts-mode--comment-docstring (node override start end &rest _args)
"Use the comment or documentation face appropriately for comments."
(let* ((beg (treesit-node-start node))
(end (treesit-node-end node))
(face (save-excursion
(goto-char beg)
(if (looking-at "///")
'font-lock-doc-face
'font-lock-comment-face))))
(treesit-fontify-with-override beg end face override start end)))
(defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
(let* ((case-fold-search nil)
(face

View file

@ -107,6 +107,9 @@ Argument LANGUAGE is either `typescript' or `tsx'."
((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset)
((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset)
((or (node-is "case")
(node-is "default"))
parent-bol typescript-ts-mode-indent-offset)
((parent-is "switch_case") parent-bol typescript-ts-mode-indent-offset)
((parent-is "switch_default") parent-bol typescript-ts-mode-indent-offset)
((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)

View file

@ -7212,6 +7212,8 @@ If PROCESS is a process object which contains the property
`remote-pid', or PROCESS is a number and REMOTE is a remote file name,
PROCESS is interpreted as process on the respective remote host, which
will be the process to signal.
If PROCESS is a string, it is interpreted as process object with the
respective process name, or as a number.
SIGCODE may be an integer, or a symbol whose name is a signal name. */)
(Lisp_Object process, Lisp_Object sigcode, Lisp_Object remote)
{

View file

@ -18083,7 +18083,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
else if (dpos == 0)
match_with_avoid_cursor = true;
}
else if (STRINGP (glyph->object))
else if (STRINGP (glyph->object)
&& !glyph->avoid_cursor_p)
{
Lisp_Object chprop;
ptrdiff_t glyph_pos = glyph->charpos;
@ -18309,7 +18310,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
/* Any glyphs that come from the buffer are here because
of bidi reordering. Skip them, and only pay
attention to glyphs that came from some string. */
if (STRINGP (glyph->object))
if (STRINGP (glyph->object)
&& !glyph->avoid_cursor_p)
{
Lisp_Object str;
ptrdiff_t tem;

View file

@ -45,6 +45,23 @@ const foo = () => {
};
=-=-=
Name: Switch statement
=-=
const foo = (x: string) => {
switch (x) {
case "a":
console.log(x);
return 1;
case "b":
return 2;
case "c":
default:
return 0;
}
};
=-=-=
Code:
(lambda ()
(setq indent-tabs-mode nil)