Merge from origin/emacs-29

f9b7913656 Fix empty line indentation in c-ts-mode (bug#61997)
90504f9d89 Fix tree-sitter indent preset prev-line (bug#61998)
ed3bab3cc7 Revert 'forward-sentence-default-function' to return poin...
bfe62b1041 ; * etc/NEWS: Fix typos.
3c1693d08b Fix Elisp code injection vulnerability in emacsclient-mai...
ab417c8a6e Fix problem with debuginfod queries in "M-x gdb"

# Conflicts:
#	etc/NEWS
This commit is contained in:
Stefan Kangas 2023-03-08 06:30:18 +01:00
commit 5ff018524c
8 changed files with 110 additions and 17 deletions

View file

@ -5064,6 +5064,9 @@ first child where parent is @code{argument_list}, use
(match nil "argument_list" nil nil 0 0)
@end example
In addition, @var{node-type} can be a special value @code{null},
which matches when the value of @var{node} is @code{nil}.
@item n-p-gp
Short for ``node-parent-grandparent'', this matcher is a function of 3
arguments: @var{node-type}, @var{parent-type}, and

View file

@ -2085,6 +2085,18 @@ command accepts the Unicode name of an Emoji (for example, "smiling
face" or "heart with arrow"), like 'C-x 8 e e', with minibuffer
completion, and adds the Emoji into the search string.
** GDB/MI
---
*** New user option 'gdb-debuginfod-enable-setting'.
On capable platforms, GDB 10.1 and later can download missing source
and debug info files from special-purpose servers, called "debuginfod
servers". Use this new option to control whether 'M-x gdb' instructs
GDB to download missing files from debuginfod servers when you debug
the corresponding programs. The default is to ask you at the
beginning of each debugging session whether to download the files for
that session.
** Glyphless Characters
+++

View file

@ -1,7 +1,10 @@
[Desktop Entry]
Categories=Network;Email;
Comment=GNU Emacs is an extensible, customizable text editor - and more
Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u
# We want to pass the following commands to the shell wrapper:
# u=${1//\\/\\\\}; u=${u//\"/\\\"}; exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")"
# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'.
Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u
Icon=emacs
Name=Emacs (Mail, Client)
MimeType=x-scheme-handler/mailto;
@ -13,7 +16,7 @@ Actions=new-window;new-instance;
[Desktop Action new-window]
Name=New Window
Exec=sh -c "exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u
Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u
[Desktop Action new-instance]
Name=New Instance

View file

@ -419,7 +419,9 @@ MODE is either `c' or `cpp'."
((parent-is "field_declaration_list") c-ts-mode--anchor-prev-sibling 0)
;; Statement in {} blocks.
((match nil "compound_statement" nil 1 1) standalone-parent c-ts-mode-indent-offset)
((or (match nil "compound_statement" nil 1 1)
(match null "compound_statement"))
standalone-parent c-ts-mode-indent-offset)
((parent-is "compound_statement") c-ts-mode--anchor-prev-sibling 0)
;; Opening bracket.
((node-is "compound_statement") standalone-parent c-ts-mode-indent-offset)

View file

@ -255,6 +255,9 @@ This variable is updated in `gdb-done-or-error' and returned by
It is initialized to `gdb-non-stop-setting' at the beginning of
every GDB session.")
(defvar gdb-debuginfod-enable nil
"Whether the current GDB session can query debuginfod servers.")
(defvar-local gdb-buffer-type nil
"One of the symbols bound in `gdb-buffer-rules'.")
@ -467,6 +470,30 @@ GDB session needs to be restarted for this setting to take effect."
:group 'gdb-non-stop
:version "26.1")
(defcustom gdb-debuginfod-enable-setting
;; debuginfod servers are only for ELF executables, and elfutils, of
;; which libdebuginfod is a part, is not usually available on
;; MS-Windows.
(if (not (eq system-type 'windows-nt)) 'ask)
"Whether to enable downloading missing debug info from debuginfod servers.
The debuginfod servers are HTTP servers for distributing source
files and debug info files of programs. If GDB was built with
debuginfod support, it can query these servers when you debug a
program for which some of these files are not available locally,
and download the files if the servers have them.
The value nil means never to download from debuginfod servers.
The value t means always download from debuginfod servers when
some source or debug info files are missing.
The value `ask', the default, means ask at the beginning of each
debugging session whether to download from debuginfod servers
during that session."
:type '(choice (const :tag "Never download from debuginfod servers" nil)
(const :tag "Download from debuginfod servers when necessary" t)
(const :tag "Ask whether to download for each session" ask))
:group 'gdb
:version "29.1")
;; TODO Some commands can't be called with --all (give a notice about
;; it in setting doc)
(defcustom gdb-gud-control-all-threads t
@ -1021,6 +1048,11 @@ detailed description of this mode.
(run-hooks 'gdb-mode-hook))
(defconst gdb--string-regexp (rx "\""
(* (or (seq "\\" nonl)
(not (any "\"\\"))))
"\""))
(defun gdb-init-1 ()
;; (Re-)initialize.
(setq gdb-selected-frame nil
@ -1044,7 +1076,8 @@ detailed description of this mode.
gdb-threads-list '()
gdb-breakpoints-list '()
gdb-register-names '()
gdb-non-stop gdb-non-stop-setting)
gdb-non-stop gdb-non-stop-setting
gdb-debuginfod-enable gdb-debuginfod-enable-setting)
;;
(gdbmi-bnf-init)
;;
@ -1053,6 +1086,15 @@ detailed description of this mode.
(gdb-force-mode-line-update
(propertize "initializing..." 'face font-lock-variable-name-face))
;; This needs to be done before we ask GDB for anything that might
;; trigger questions about debuginfod queries.
(if (eq gdb-debuginfod-enable 'ask)
(setq gdb-debuginfod-enable
(y-or-n-p "Enable querying debuginfod servers for this session?")))
(gdb-input (format "-gdb-set debuginfod enabled %s"
(if gdb-debuginfod-enable "on" "off"))
'gdb-debuginfod-message)
(gdb-get-buffer-create 'gdb-inferior-io)
(gdb-clear-inferior-io)
(gdb-inferior-io--init-proc (get-process "gdb-inferior"))
@ -1080,6 +1122,18 @@ detailed description of this mode.
(gdb-input "-file-list-exec-source-file" 'gdb-get-source-file)
(gdb-input "-gdb-show prompt" 'gdb-get-prompt))
(defun gdb-debuginfod-message ()
"Show in the echo area GDB error response for a debuginfod command, if any."
(goto-char (point-min))
(cond
((re-search-forward "msg=\\(\".+\"\\)$" nil t)
;; Supports debuginfod, but cannot perform command.
(message "%s" (buffer-substring (1+ (match-beginning 1))
(1- (line-end-position)))))
((re-search-forward "No symbol" nil t)
(message "This version of GDB doesn't support debuginfod commands."))
(t (message nil))))
(defun gdb-non-stop-handler ()
(goto-char (point-min))
(if (re-search-forward "No symbol" nil t)
@ -1148,11 +1202,6 @@ no input, and GDB is waiting for input."
(declare-function tooltip-show "tooltip" (text &optional use-echo-area
text-face default-face))
(defconst gdb--string-regexp (rx "\""
(* (or (seq "\\" nonl)
(not (any "\"\\"))))
"\""))
(defun gdb-tooltip-print (expr)
(with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
(goto-char (point-min))

View file

@ -476,8 +476,7 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(skip-chars-backward " \t\n")
(goto-char par-end)))
(setq arg (1- arg)))
(let ((npoint (constrain-to-field nil opoint t)))
(not (= npoint opoint)))))
(constrain-to-field nil opoint t)))
(defvar forward-sentence-function #'forward-sentence-default-function
"Function to be used to calculate sentence movements.
@ -499,8 +498,13 @@ sentence. Delegates its work to `forward-sentence-function'."
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(while (ignore-errors (forward-sentence))
(setq sentences (1+ sentences)))
(let* ((prev (point))
(next (forward-sentence)))
(while (and (not (null next))
(not (= prev next)))
(setq prev next
next (ignore-errors (forward-sentence))
sentences (1+ sentences))))
;; Remove last possibly empty sentence
(when (/= (skip-chars-backward " \t\n") 0)
(setq sentences (1- sentences)))

View file

@ -1107,9 +1107,11 @@ See `treesit-simple-indent-presets'.")
(&optional node-type parent-type node-field
node-index-min node-index-max)
(lambda (node parent &rest _)
(and (or (null node-type)
(string-match-p
node-type (or (treesit-node-type node) "")))
(and (pcase node-type
('nil t)
('null (null node))
(_ (string-match-p
node-type (or (treesit-node-type node) ""))))
(or (null parent-type)
(string-match-p
parent-type (treesit-node-type parent)))
@ -1253,7 +1255,8 @@ See `treesit-simple-indent-presets'.")
(save-excursion
(goto-char bol)
(forward-line -1)
(skip-chars-forward " \t"))))
(skip-chars-forward " \t")
(point))))
(cons 'column-0 (lambda (_n _p bol &rest _)
(save-excursion
(goto-char bol)
@ -1301,6 +1304,7 @@ MATCHER:
(match nil \"argument_list\" nil nil 0 0).
NODE-TYPE, PARENT-TYPE, and NODE-FIELD are regexps.
NODE-TYPE can also be `null', which matches when NODE is nil.
no-node

View file

@ -418,3 +418,19 @@ required_matrix_height (struct window *w)
|
}
=-=-=
Name: Empty Line
=-=
int
main (void)
{
|
}
=-=
int
main (void)
{
|
}
=-=-=