emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 59af2c6b150 3/4: Merge from origin/emacs-29


From: Eli Zaretskii
Subject: master 59af2c6b150 3/4: Merge from origin/emacs-29
Date: Sat, 2 Dec 2023 10:09:45 -0500 (EST)

branch: master
commit 59af2c6b150b1639756a724ce06103bdc51b0309
Merge: 907aab88c7a 5f882f4ee97
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge from origin/emacs-29
    
    5f882f4ee97 ; Fix doc string punctuation in ruby-ts-mode.el.
    546a68925c9 Fix 'Info-goto-node-web' when NODE is given in various forms
    7ff943044e9 Fix setting cursor when the window's op line has 'line-pr...
    7f0bef47ddd Drop extra parenthesis in example code in Emacs Lisp Intr...
    fbaf113bf38 rust-ts-mode: appropriately fontify doc strings
    bd62bdbc680 Fix example code in Emacs Lisp Introduction manual
    c7e459132a9 Fix example in Emacs Lisp Intro manual
    a6e9c26c8f4 ; * doc/emacs/files.texi (Save Commands): Fix last change.
    f6a06ed6c5d Elisp manual: Mention 'write-region' for saving the buffer
    4774a3abb4b Document, that PROCESS of signal-process can be a string
    ab126284081 Fix typescript-ts-mode indentation for switch statements
---
 doc/emacs/files.texi                               |  4 +++
 doc/lispintro/emacs-lisp-intro.texi                | 25 ++++++++++---------
 doc/lispref/processes.texi                         |  3 +++
 lisp/info.el                                       | 29 ++++++++++++++++------
 lisp/progmodes/ruby-ts-mode.el                     |  4 +--
 lisp/progmodes/rust-ts-mode.el                     | 13 +++++++++-
 lisp/progmodes/typescript-ts-mode.el               |  3 +++
 src/process.c                                      |  2 ++
 src/xdisp.c                                        |  6 +++--
 .../typescript-ts-mode-resources/indent.erts       | 17 +++++++++++++
 10 files changed, 82 insertions(+), 24 deletions(-)

diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 7efb4516d15..917e937d32d 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -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
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 7563d66bad1..d6627a2a1ca 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -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
 
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 3e7872208a2..887b41d0005 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -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
diff --git a/lisp/info.el b/lisp/info.el
index 463aea93376..51e9eb72edf 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -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)
 
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index e772b6dd04a..b339e2028ab 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -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
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 88344934e49..03ff2776d3a 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -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
diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index 0503c724d36..7998b3740b6 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -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)
diff --git a/src/process.c b/src/process.c
index 8419b1e88ca..bde87b78701 100644
--- a/src/process.c
+++ b/src/process.c
@@ -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)
 {
diff --git a/src/xdisp.c b/src/xdisp.c
index 2dbe85f0f04..0b2508cdf17 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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;
diff --git a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts 
b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
index 20f423259b4..7b6185e0386 100644
--- a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]