aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-03-08 20:07:12 +0800
committerPo Lu2023-03-08 20:07:12 +0800
commitc15f9aee2e6882e6b24bdb87e82f70274c6592ea (patch)
tree99c656a69bcba2a0eebd24e3558a43fab3d81da4
parentf9e68ed00e469d841c58681cd9d06e3d985614ad (diff)
parent5ff018524c740c77215ddb5d5983dbfcadb05599 (diff)
downloademacs-c15f9aee2e6882e6b24bdb87e82f70274c6592ea.tar.gz
emacs-c15f9aee2e6882e6b24bdb87e82f70274c6592ea.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--doc/lispref/modes.texi3
-rw-r--r--etc/NEWS.2912
-rw-r--r--etc/emacsclient-mail.desktop7
-rw-r--r--lisp/progmodes/c-ts-mode.el4
-rw-r--r--lisp/progmodes/gdb-mi.el61
-rw-r--r--lisp/textmodes/paragraphs.el12
-rw-r--r--lisp/treesit.el12
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent.erts16
8 files changed, 110 insertions, 17 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index c12224230fc..fff1ea65b07 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -5064,6 +5064,9 @@ first child where parent is @code{argument_list}, use
5064(match nil "argument_list" nil nil 0 0) 5064(match nil "argument_list" nil nil 0 0)
5065@end example 5065@end example
5066 5066
5067In addition, @var{node-type} can be a special value @code{null},
5068which matches when the value of @var{node} is @code{nil}.
5069
5067@item n-p-gp 5070@item n-p-gp
5068Short for ``node-parent-grandparent'', this matcher is a function of 3 5071Short for ``node-parent-grandparent'', this matcher is a function of 3
5069arguments: @var{node-type}, @var{parent-type}, and 5072arguments: @var{node-type}, @var{parent-type}, and
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index 189ca590e3f..01ab4b8a1db 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -2085,6 +2085,18 @@ command accepts the Unicode name of an Emoji (for example, "smiling
2085face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer 2085face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer
2086completion, and adds the Emoji into the search string. 2086completion, and adds the Emoji into the search string.
2087 2087
2088** GDB/MI
2089
2090---
2091*** New user option 'gdb-debuginfod-enable-setting'.
2092On capable platforms, GDB 10.1 and later can download missing source
2093and debug info files from special-purpose servers, called "debuginfod
2094servers". Use this new option to control whether 'M-x gdb' instructs
2095GDB to download missing files from debuginfod servers when you debug
2096the corresponding programs. The default is to ask you at the
2097beginning of each debugging session whether to download the files for
2098that session.
2099
2088** Glyphless Characters 2100** Glyphless Characters
2089 2101
2090+++ 2102+++
diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop
index 91df122c594..49c6f99f317 100644
--- a/etc/emacsclient-mail.desktop
+++ b/etc/emacsclient-mail.desktop
@@ -1,7 +1,10 @@
1[Desktop Entry] 1[Desktop Entry]
2Categories=Network;Email; 2Categories=Network;Email;
3Comment=GNU Emacs is an extensible, customizable text editor - and more 3Comment=GNU Emacs is an extensible, customizable text editor - and more
4Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u 4# We want to pass the following commands to the shell wrapper:
5# u=${1//\\/\\\\}; u=${u//\"/\\\"}; exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")"
6# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'.
7Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u
5Icon=emacs 8Icon=emacs
6Name=Emacs (Mail, Client) 9Name=Emacs (Mail, Client)
7MimeType=x-scheme-handler/mailto; 10MimeType=x-scheme-handler/mailto;
@@ -13,7 +16,7 @@ Actions=new-window;new-instance;
13 16
14[Desktop Action new-window] 17[Desktop Action new-window]
15Name=New Window 18Name=New Window
16Exec=sh -c "exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u 19Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u
17 20
18[Desktop Action new-instance] 21[Desktop Action new-instance]
19Name=New Instance 22Name=New Instance
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index c37041d20ac..8c44647ec3e 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -419,7 +419,9 @@ MODE is either `c' or `cpp'."
419 ((parent-is "field_declaration_list") c-ts-mode--anchor-prev-sibling 0) 419 ((parent-is "field_declaration_list") c-ts-mode--anchor-prev-sibling 0)
420 420
421 ;; Statement in {} blocks. 421 ;; Statement in {} blocks.
422 ((match nil "compound_statement" nil 1 1) standalone-parent c-ts-mode-indent-offset) 422 ((or (match nil "compound_statement" nil 1 1)
423 (match null "compound_statement"))
424 standalone-parent c-ts-mode-indent-offset)
423 ((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0) 425 ((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0)
424 ;; Opening bracket. 426 ;; Opening bracket.
425 ((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset) 427 ((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 2edaf9e2593..060957eac29 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -255,6 +255,9 @@ This variable is updated in `gdb-done-or-error' and returned by
255It is initialized to `gdb-non-stop-setting' at the beginning of 255It is initialized to `gdb-non-stop-setting' at the beginning of
256every GDB session.") 256every GDB session.")
257 257
258(defvar gdb-debuginfod-enable nil
259 "Whether the current GDB session can query debuginfod servers.")
260
258(defvar-local gdb-buffer-type nil 261(defvar-local gdb-buffer-type nil
259 "One of the symbols bound in `gdb-buffer-rules'.") 262 "One of the symbols bound in `gdb-buffer-rules'.")
260 263
@@ -467,6 +470,30 @@ GDB session needs to be restarted for this setting to take effect."
467 :group 'gdb-non-stop 470 :group 'gdb-non-stop
468 :version "26.1") 471 :version "26.1")
469 472
473(defcustom gdb-debuginfod-enable-setting
474 ;; debuginfod servers are only for ELF executables, and elfutils, of
475 ;; which libdebuginfod is a part, is not usually available on
476 ;; MS-Windows.
477 (if (not (eq system-type 'windows-nt)) 'ask)
478 "Whether to enable downloading missing debug info from debuginfod servers.
479The debuginfod servers are HTTP servers for distributing source
480files and debug info files of programs. If GDB was built with
481debuginfod support, it can query these servers when you debug a
482program for which some of these files are not available locally,
483and download the files if the servers have them.
484
485The value nil means never to download from debuginfod servers.
486The value t means always download from debuginfod servers when
487some source or debug info files are missing.
488The value `ask', the default, means ask at the beginning of each
489debugging session whether to download from debuginfod servers
490during that session."
491 :type '(choice (const :tag "Never download from debuginfod servers" nil)
492 (const :tag "Download from debuginfod servers when necessary" t)
493 (const :tag "Ask whether to download for each session" ask))
494 :group 'gdb
495 :version "29.1")
496
470;; TODO Some commands can't be called with --all (give a notice about 497;; TODO Some commands can't be called with --all (give a notice about
471;; it in setting doc) 498;; it in setting doc)
472(defcustom gdb-gud-control-all-threads t 499(defcustom gdb-gud-control-all-threads t
@@ -1021,6 +1048,11 @@ detailed description of this mode.
1021 1048
1022 (run-hooks 'gdb-mode-hook)) 1049 (run-hooks 'gdb-mode-hook))
1023 1050
1051(defconst gdb--string-regexp (rx "\""
1052 (* (or (seq "\\" nonl)
1053 (not (any "\"\\"))))
1054 "\""))
1055
1024(defun gdb-init-1 () 1056(defun gdb-init-1 ()
1025 ;; (Re-)initialize. 1057 ;; (Re-)initialize.
1026 (setq gdb-selected-frame nil 1058 (setq gdb-selected-frame nil
@@ -1044,7 +1076,8 @@ detailed description of this mode.
1044 gdb-threads-list '() 1076 gdb-threads-list '()
1045 gdb-breakpoints-list '() 1077 gdb-breakpoints-list '()
1046 gdb-register-names '() 1078 gdb-register-names '()
1047 gdb-non-stop gdb-non-stop-setting) 1079 gdb-non-stop gdb-non-stop-setting
1080 gdb-debuginfod-enable gdb-debuginfod-enable-setting)
1048 ;; 1081 ;;
1049 (gdbmi-bnf-init) 1082 (gdbmi-bnf-init)
1050 ;; 1083 ;;
@@ -1053,6 +1086,15 @@ detailed description of this mode.
1053 (gdb-force-mode-line-update 1086 (gdb-force-mode-line-update
1054 (propertize "initializing..." 'face font-lock-variable-name-face)) 1087 (propertize "initializing..." 'face font-lock-variable-name-face))
1055 1088
1089 ;; This needs to be done before we ask GDB for anything that might
1090 ;; trigger questions about debuginfod queries.
1091 (if (eq gdb-debuginfod-enable 'ask)
1092 (setq gdb-debuginfod-enable
1093 (y-or-n-p "Enable querying debuginfod servers for this session?")))
1094 (gdb-input (format "-gdb-set debuginfod enabled %s"
1095 (if gdb-debuginfod-enable "on" "off"))
1096 'gdb-debuginfod-message)
1097
1056 (gdb-get-buffer-create 'gdb-inferior-io) 1098 (gdb-get-buffer-create 'gdb-inferior-io)
1057 (gdb-clear-inferior-io) 1099 (gdb-clear-inferior-io)
1058 (gdb-inferior-io--init-proc (get-process "gdb-inferior")) 1100 (gdb-inferior-io--init-proc (get-process "gdb-inferior"))
@@ -1080,6 +1122,18 @@ detailed description of this mode.
1080 (gdb-input "-file-list-exec-source-file" 'gdb-get-source-file) 1122 (gdb-input "-file-list-exec-source-file" 'gdb-get-source-file)
1081 (gdb-input "-gdb-show prompt" 'gdb-get-prompt)) 1123 (gdb-input "-gdb-show prompt" 'gdb-get-prompt))
1082 1124
1125(defun gdb-debuginfod-message ()
1126 "Show in the echo area GDB error response for a debuginfod command, if any."
1127 (goto-char (point-min))
1128 (cond
1129 ((re-search-forward "msg=\\(\".+\"\\)$" nil t)
1130 ;; Supports debuginfod, but cannot perform command.
1131 (message "%s" (buffer-substring (1+ (match-beginning 1))
1132 (1- (line-end-position)))))
1133 ((re-search-forward "No symbol" nil t)
1134 (message "This version of GDB doesn't support debuginfod commands."))
1135 (t (message nil))))
1136
1083(defun gdb-non-stop-handler () 1137(defun gdb-non-stop-handler ()
1084 (goto-char (point-min)) 1138 (goto-char (point-min))
1085 (if (re-search-forward "No symbol" nil t) 1139 (if (re-search-forward "No symbol" nil t)
@@ -1148,11 +1202,6 @@ no input, and GDB is waiting for input."
1148(declare-function tooltip-show "tooltip" (text &optional use-echo-area 1202(declare-function tooltip-show "tooltip" (text &optional use-echo-area
1149 text-face default-face)) 1203 text-face default-face))
1150 1204
1151(defconst gdb--string-regexp (rx "\""
1152 (* (or (seq "\\" nonl)
1153 (not (any "\"\\"))))
1154 "\""))
1155
1156(defun gdb-tooltip-print (expr) 1205(defun gdb-tooltip-print (expr)
1157 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) 1206 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
1158 (goto-char (point-min)) 1207 (goto-char (point-min))
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index bf249fdcdfb..6c33380b6bd 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -476,8 +476,7 @@ sentences. Also, every paragraph boundary terminates sentences as well."
476 (skip-chars-backward " \t\n") 476 (skip-chars-backward " \t\n")
477 (goto-char par-end))) 477 (goto-char par-end)))
478 (setq arg (1- arg))) 478 (setq arg (1- arg)))
479 (let ((npoint (constrain-to-field nil opoint t))) 479 (constrain-to-field nil opoint t)))
480 (not (= npoint opoint)))))
481 480
482(defvar forward-sentence-function #'forward-sentence-default-function 481(defvar forward-sentence-function #'forward-sentence-default-function
483 "Function to be used to calculate sentence movements. 482 "Function to be used to calculate sentence movements.
@@ -499,8 +498,13 @@ sentence. Delegates its work to `forward-sentence-function'."
499 (save-restriction 498 (save-restriction
500 (narrow-to-region start end) 499 (narrow-to-region start end)
501 (goto-char (point-min)) 500 (goto-char (point-min))
502 (while (ignore-errors (forward-sentence)) 501 (let* ((prev (point))
503 (setq sentences (1+ sentences))) 502 (next (forward-sentence)))
503 (while (and (not (null next))
504 (not (= prev next)))
505 (setq prev next
506 next (ignore-errors (forward-sentence))
507 sentences (1+ sentences))))
504 ;; Remove last possibly empty sentence 508 ;; Remove last possibly empty sentence
505 (when (/= (skip-chars-backward " \t\n") 0) 509 (when (/= (skip-chars-backward " \t\n") 0)
506 (setq sentences (1- sentences))) 510 (setq sentences (1- sentences)))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index e680668a353..9bb58ec4ab1 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1107,9 +1107,11 @@ See `treesit-simple-indent-presets'.")
1107 (&optional node-type parent-type node-field 1107 (&optional node-type parent-type node-field
1108 node-index-min node-index-max) 1108 node-index-min node-index-max)
1109 (lambda (node parent &rest _) 1109 (lambda (node parent &rest _)
1110 (and (or (null node-type) 1110 (and (pcase node-type
1111 (string-match-p 1111 ('nil t)
1112 node-type (or (treesit-node-type node) ""))) 1112 ('null (null node))
1113 (_ (string-match-p
1114 node-type (or (treesit-node-type node) ""))))
1113 (or (null parent-type) 1115 (or (null parent-type)
1114 (string-match-p 1116 (string-match-p
1115 parent-type (treesit-node-type parent))) 1117 parent-type (treesit-node-type parent)))
@@ -1253,7 +1255,8 @@ See `treesit-simple-indent-presets'.")
1253 (save-excursion 1255 (save-excursion
1254 (goto-char bol) 1256 (goto-char bol)
1255 (forward-line -1) 1257 (forward-line -1)
1256 (skip-chars-forward " \t")))) 1258 (skip-chars-forward " \t")
1259 (point))))
1257 (cons 'column-0 (lambda (_n _p bol &rest _) 1260 (cons 'column-0 (lambda (_n _p bol &rest _)
1258 (save-excursion 1261 (save-excursion
1259 (goto-char bol) 1262 (goto-char bol)
@@ -1301,6 +1304,7 @@ MATCHER:
1301 (match nil \"argument_list\" nil nil 0 0). 1304 (match nil \"argument_list\" nil nil 0 0).
1302 1305
1303 NODE-TYPE, PARENT-TYPE, and NODE-FIELD are regexps. 1306 NODE-TYPE, PARENT-TYPE, and NODE-FIELD are regexps.
1307 NODE-TYPE can also be `null', which matches when NODE is nil.
1304 1308
1305no-node 1309no-node
1306 1310
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 77bfeb5ad6e..9e28ef203fd 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -418,3 +418,19 @@ required_matrix_height (struct window *w)
418 | 418 |
419} 419}
420=-=-= 420=-=-=
421
422Name: Empty Line
423
424=-=
425int
426main (void)
427{
428|
429}
430=-=
431int
432main (void)
433{
434 |
435}
436=-=-=