commit 15b9d99cef63f6743e49d350136157bd42d362e9 (HEAD, refs/remotes/origin/master) Author: Sean Whitton Date: Tue Oct 29 12:57:58 2024 +0800 ; * lisp/vc/log-edit.el (log-edit-diff-function): Tweak formatting. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 6176cf3589d..9dcc8c89526 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -247,9 +247,9 @@ when this variable is set to nil.") (defvar log-edit-callback nil) (defvar log-edit-diff-function (lambda () (error "Diff functionality has not been set up")) - "Function to display an appropriate Diff Mode buffer for the change. + "Function to display an appropriate `diff-mode' buffer for the change. Called by the `log-edit-show-diff' command. -Should not leave the Diff Mode buffer's window selected; that is, the +Should not leave the `diff-mode' buffer's window selected; that is, the Log Edit buffer's window should be selected when the function returns.") (defvar log-edit-listfun nil) commit c7a1fafa992b217014430fb30fd09c8e037227e0 Author: Sean Whitton Date: Tue Oct 29 12:52:20 2024 +0800 * lisp/vc/log-edit.el (log-edit-diff-function): Document. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 58f4cc2c2b6..6176cf3589d 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -246,7 +246,11 @@ when this variable is set to nil.") (defvar log-edit-initial-files nil) (defvar log-edit-callback nil) (defvar log-edit-diff-function - (lambda () (error "Diff functionality has not been set up"))) + (lambda () (error "Diff functionality has not been set up")) + "Function to display an appropriate Diff Mode buffer for the change. +Called by the `log-edit-show-diff' command. +Should not leave the Diff Mode buffer's window selected; that is, the +Log Edit buffer's window should be selected when the function returns.") (defvar log-edit-listfun nil) (defvar log-edit-parent-buffer nil) commit 1551c306f30cc139b321056c03206df4b71eae5c Author: Yuan Fu Date: Mon Oct 28 19:30:52 2024 -0700 Fix the call to treesit-thing-defined-p * lisp/treesit.el (treesit-defun-at-point): Add the necessary 2nd argument. diff --git a/lisp/treesit.el b/lisp/treesit.el index e59a831bd40..6f5d065cc24 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2834,7 +2834,9 @@ is `nested'. Return nil if `treesit-defun-type-regexp' isn't set and `defun' isn't defined in `treesit-thing-settings'." - (when (or treesit-defun-type-regexp (treesit-thing-defined-p 'defun)) + (when (or treesit-defun-type-regexp + (treesit-thing-defined-p + 'defun (treesit-language-at (point)))) (treesit-thing-at-point (or treesit-defun-type-regexp 'defun) treesit-defun-tactic))) commit c0cb369ab188ea7ae0d3271d19c0cecce7be0329 Author: Dmitry Gutov Date: Tue Oct 29 04:27:00 2024 +0200 project--completing-read-strict: Move some common processing here * lisp/progmodes/project.el (project--completing-read-strict): Add new optional argument, COMMON-PARENT-DIRECTORY. Move the absolute->relative processing of MB-DEFAULT and the contents of HIST here. (project--read-file-cpd-relative): From here. So that 'project--read-file-absolute' can also benefit from those conversions. (project--read-file-absolute): Pass the new argument. (project-read-file-name-function): Update value tags. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index aae4b708b7b..cf1c94a6d20 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1146,9 +1146,9 @@ for VCS directories listed in `vc-directory-exclusion-list'." (defcustom project-read-file-name-function #'project--read-file-cpd-relative "Function to call to read a file name from a list. For the arguments list, see `project--read-file-cpd-relative'." - :type '(choice (const :tag "Read with completion from relative names" + :type '(choice (const :tag "Read with completion from relative file names" project--read-file-cpd-relative) - (const :tag "Read with completion from absolute names" + (const :tag "Read with completion from file names" project--read-file-absolute) (function :tag "Custom function" nil)) :group 'project @@ -1198,47 +1198,34 @@ by the user at will." (file-name-absolute-p (car all-files))) prompt (concat prompt (format " in %s" common-parent-directory)))) - (mb-default (mapcar (lambda (mb-default) - (if (and common-parent-directory - mb-default - (file-name-absolute-p mb-default)) - (file-relative-name - mb-default common-parent-directory) - mb-default)) - (if (listp mb-default) mb-default (list mb-default)))) (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) (new-collection (project--file-completion-table substrings)) - (abs-cpd (expand-file-name common-parent-directory)) - (abs-cpd-length (length abs-cpd)) - (relname (cl-letf* ((non-essential t) ;Avoid new Tramp connections. - ((symbol-value hist) - (mapcan - (lambda (s) - (setq s (expand-file-name s)) - (and (string-prefix-p abs-cpd s) - (not (eq abs-cpd-length (length s))) - (list (substring s abs-cpd-length)))) - (symbol-value hist)))) - (project--completing-read-strict prompt - new-collection - predicate - hist mb-default))) + (relname (project--completing-read-strict prompt + new-collection + predicate + hist mb-default + (unless (equal common-parent-directory "") + common-parent-directory))) (absname (expand-file-name relname common-parent-directory))) absname)) (defun project--read-file-absolute (prompt all-files &optional predicate hist mb-default) - (let* ((new-prompt (if (file-name-absolute-p (car all-files)) + (let* ((names-absolute (file-name-absolute-p (car all-files))) + (new-prompt (if names-absolute prompt (concat prompt " in " default-directory))) - ;; FIXME: Map relative names to absolute? + ;; TODO: The names are intentionally not absolute in many cases. + ;; Probably better to rename this function. (ct (project--file-completion-table all-files)) (file (project--completing-read-strict new-prompt ct predicate - hist mb-default))) + hist mb-default + (unless names-absolute + default-directory)))) (unless (file-name-absolute-p file) (setq file (expand-file-name file))) file)) @@ -1297,17 +1284,39 @@ directories listed in `vc-directory-exclusion-list'." (defun project--completing-read-strict (prompt collection &optional predicate - hist mb-default) - (minibuffer-with-setup-hook - (lambda () - (setq-local minibuffer-default-add-function - (lambda () - (let ((minibuffer-default mb-default)) - (minibuffer-default-add-completions))))) - (completing-read (format "%s: " prompt) - collection predicate 'confirm - nil - hist))) + hist mb-default + common-parent-directory) + (cl-letf* ((mb-default (mapcar (lambda (mb-default) + (if (and common-parent-directory + mb-default + (file-name-absolute-p mb-default)) + (file-relative-name + mb-default common-parent-directory) + mb-default)) + (if (listp mb-default) mb-default (list mb-default)))) + (abs-cpd (expand-file-name (or common-parent-directory ""))) + (abs-cpd-length (length abs-cpd)) + (non-essential t) ;Avoid new Tramp connections. + ((symbol-value hist) + (if common-parent-directory + (mapcan + (lambda (s) + (setq s (expand-file-name s)) + (and (string-prefix-p abs-cpd s) + (not (eq abs-cpd-length (length s))) + (list (substring s abs-cpd-length)))) + (symbol-value hist)) + (symbol-value hist)))) + (minibuffer-with-setup-hook + (lambda () + (setq-local minibuffer-default-add-function + (lambda () + (let ((minibuffer-default mb-default)) + (minibuffer-default-add-completions))))) + (completing-read (format "%s: " prompt) + collection predicate 'confirm + nil + hist)))) ;;;###autoload (defun project-find-dir () commit a6626a00dc4b459e57d700e5bb7524cd3e0a55f8 Author: Dmitry Gutov Date: Tue Oct 29 03:48:03 2024 +0200 project--read-file-cpd-relative: Move out the 'included-cpd' logic * lisp/progmodes/project.el (project-find-dir): Use 'project-files-relative-names'. Include "./" here rather than (project--read-file-cpd-relative): ...doing it here. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 000506f58cb..aae4b708b7b 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1198,10 +1198,6 @@ by the user at will." (file-name-absolute-p (car all-files))) prompt (concat prompt (format " in %s" common-parent-directory)))) - (included-cpd (when (member common-parent-directory all-files) - (setq all-files - (delete common-parent-directory all-files)) - t)) (mb-default (mapcar (lambda (mb-default) (if (and common-parent-directory mb-default @@ -1211,8 +1207,6 @@ by the user at will." mb-default)) (if (listp mb-default) mb-default (list mb-default)))) (substrings (mapcar (lambda (s) (substring s cpd-length)) all-files)) - (_ (when included-cpd - (setq substrings (cons "./" substrings)))) (new-collection (project--file-completion-table substrings)) (abs-cpd (expand-file-name common-parent-directory)) (abs-cpd-length (length abs-cpd)) @@ -1323,6 +1317,7 @@ The current buffer's `default-directory' is available as part of \"future history\"." (interactive) (let* ((project (project-current t)) + (project-files-relative-names t) (all-files (project-files project)) (completion-ignore-case read-file-name-completion-ignore-case) ;; FIXME: This misses directories without any files directly @@ -1330,11 +1325,15 @@ The current buffer's `default-directory' is available as part of ;; `project-files-filtered', and see ;; https://stackoverflow.com/a/50685235/615245 for possible ;; implementation. - (all-dirs (mapcar #'file-name-directory all-files)) + (all-dirs (cons "./" + (delq nil + ;; Some completion UIs show duplicates. + (delete-dups + (mapcar #'file-name-directory all-files))))) + (default-directory (project-root project)) (dir (project--read-file-name project "Dired" - ;; Some completion UIs show duplicates. - (delete-dups all-dirs) + all-dirs nil 'file-name-history (and default-directory (project--find-default-from default-directory project))))) commit 40cf6f9009209b8c3363d057882611cd5d56f853 Author: Sean Whitton Date: Tue Oct 29 09:40:02 2024 +0800 Fix window selection after log-edit-show-diff * lisp/vc/vc.el (vc-diff-patch-string): Use display-buffer, not pop-to-buffer, for consistency with log-edit-diff-fileset. (vc-modify-change-comment): Use save-selected-window around vc-diff-internal to avoid leaving the *vc-diff* window selected, for consistency with log-edit-diff-fileset. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 972bd47d26b..194b181f3e9 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1996,7 +1996,7 @@ in the output buffer." (setq-local revert-buffer-function (lambda (_ _) (vc-diff-patch-string patch-string))) (setq-local vc-patch-string patch-string) - (pop-to-buffer (current-buffer)) + (display-buffer (current-buffer)) (vc-run-delayed (vc-diff-finish (current-buffer) nil)))) (defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose buffer) @@ -2538,8 +2538,9 @@ the variable `vc-BACKEND-header'." (prevrev (vc-call-backend backend 'previous-revision rootdir rev))) - (vc-diff-internal nil (list backend (list rootdir)) - prevrev rev)))))) + (save-selected-window + (vc-diff-internal nil (list backend (list rootdir)) + prevrev rev))))))) ;;;###autoload (defun vc-merge () commit 41f347c1d1a03c38861d4b422211b6042d87ed06 Author: Alan Mackenzie Date: Tue Oct 29 01:51:05 2024 +0200 elisp-mode-tests.el: Add test for the added fix * test/lisp/progmodes/elisp-mode-tests.el (elisp-completes-functions-after-empty-let-bindings): New test (bug#73880). diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 591c32a8271..45714b3e7d9 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -109,6 +109,14 @@ (should (member "backup-inhibited" comps)) (should-not (member "backup-buffer" comps)))))) +(ert-deftest elisp-completes-functions-after-empty-let-bindings () + (with-temp-buffer + (emacs-lisp-mode) + (insert "(let () (ba") + (let ((comps (elisp--test-completions))) + (should (member "backup-buffer" comps)) + (should-not (member "backup-inhibited" comps))))) + (ert-deftest elisp-completes-functions-after-let-bindings-2 () (with-temp-buffer (emacs-lisp-mode) commit 7681eacc399612625b38d9504407722bde23dc22 Author: Dmitry Gutov Date: Tue Oct 29 01:38:00 2024 +0200 elisp: Fix completion at funpos after empty let bindings form * lisp/progmodes/elisp-mode.el (elisp-completion-at-point): Use 'skip-syntax-backward' instead of 'backward-list' since the latter also skips over other syntax, such as empty parens (bug#73880). diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 62f1045a512..2b6d9d2b8bb 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -789,7 +789,7 @@ functions are annotated with \"\" via the (goto-char (1- beg)) (when (eq parent ?\() (up-list -1)) - (forward-symbol -1) + (skip-syntax-backward " w_") (or (looking-at "\\_<\\(let\\*?\\|bind\\*\\)\\_>") commit fb5915665522f747daa8dfa11e91dc406d18edb7 Author: Alan Mackenzie Date: Mon Oct 28 16:35:27 2024 +0000 Call PF correctly from pcase--edebug-match-pat-args Also correct a doc string and insert commentary. This fixes bug#74052. * lisp/emacs-lisp/edebug.el (edebug--match-&-spec-op <&interpose>): Correct and complete the doc string, which now says MUST call exactly once, and documents the return values of FUN, PF and edebug--match-&-spec-op. Also remove an unneeded `(...) construct. * lisp/emacs-lisp/pcase.el (pcase--edebug-match-pat-args): Call PF also for the main cases handled. diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index b96d2437b8a..d09229ee890 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1803,12 +1803,21 @@ infinite loops when the code/environment contains a circular object.") (cl-defmethod edebug--match-&-spec-op ((_ (eql '&interpose)) cursor specs) "Compute the specs for `&interpose SPEC FUN ARGS...'. -Extracts the head of the data by matching it against SPEC, -and then matches the rest by calling (FUN HEAD PF ARGS...) -where PF is the parsing function which FUN can call exactly once, -passing it the specs that it needs to match. -Note that HEAD will always be a list, since specs are defined to match -a sequence of elements." +SPECS is a list (SPEC FUN ARGS...), where SPEC is an edebug +specification, FUN is the function from the &interpose form which +transforms the edebug spec, and the optional ARGS is a list of final +arguments to be supplied to FUN. + +Extracts the head of the data by matching it against SPEC, and then +matches the rest by calling (FUN HEAD PF ARGS...). PF is the parsing +function which FUN must call exactly once, passing it one argument, the +specs that it needs to match. FUN's value must be the value of this PF +call, which in turn will be the value of this function. + +Note that HEAD will always be a list, since specs is defined to match a +sequence of elements." + ;; Note: PF is called in FUN rather than in this function, so that it + ;; can use any dynamic bindings created there. (pcase-let* ((`(,spec ,fun . ,args) specs) (exps (edebug-cursor-expressions cursor)) @@ -1817,14 +1826,14 @@ a sequence of elements." (length (edebug-cursor-expressions cursor)))) (head (seq-subseq exps 0 consumed))) (cl-assert (eq (edebug-cursor-expressions cursor) (nthcdr consumed exps))) - (apply fun `(,head - ,(lambda (newspecs) - ;; FIXME: What'd be the difference if we used - ;; `edebug-match-sublist', which is what - ;; `edebug-list-form-args' uses for the similar purpose - ;; when matching "normal" forms? - (append instrumented-head (edebug-match cursor newspecs))) - ,@args)))) + (apply fun head + (lambda (newspecs) + ;; FIXME: What'd be the difference if we used + ;; `edebug-match-sublist', which is what + ;; `edebug-list-form-args' uses for the similar purpose + ;; when matching "normal" forms? + (append instrumented-head (edebug-match cursor newspecs))) + args))) (cl-defmethod edebug--match-&-spec-op ((_ (eql '¬)) cursor specs) ;; If any specs match, then fail diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 898d460c144..9812621d50e 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -84,14 +84,17 @@ (defun pcase--edebug-match-pat-args (head pf) ;; (cl-assert (null (cdr head))) (setq head (car head)) - (or (alist-get head '((quote sexp) - (or &rest pcase-PAT) - (and &rest pcase-PAT) - (guard form) - (pred &or ("not" pcase-FUN) pcase-FUN) - (app pcase-FUN pcase-PAT))) - (let ((me (pcase--get-macroexpander head))) - (funcall pf (and me (symbolp me) (edebug-get-spec me)))))) + (let ((specs + (or + (alist-get head '((quote sexp) + (or &rest pcase-PAT) + (and &rest pcase-PAT) + (guard form) + (pred &or ("not" pcase-FUN) pcase-FUN) + (app pcase-FUN pcase-PAT))) + (let ((me (pcase--get-macroexpander head))) + (and me (symbolp me) (edebug-get-spec me)))))) + (funcall pf specs))) (defun pcase--get-macroexpander (s) "Return the macroexpander for pcase pattern head S, or nil." commit c05a13ef0dc69497e275b627dbc8e2b25ece7711 Author: Alan Mackenzie Date: Mon Oct 28 15:58:04 2024 +0000 CC Mode: Add/remove defun buffer locally to post-command-hook Also remove no longer existing hook. * lisp/progmodes/cc-mode (c-leave-cc-mode-mode): remove-hook c-post-command buffer locally. Delete removal of non-existent c-post-gc-hook. (c-basic-common-init): add-hook c-post-command buffer locally. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2fcb46a1c0d..c5bb075c7f6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -186,8 +186,7 @@ (with-current-buffer b c-buffer-is-cc-mode)) (throw 'found nil))) - (remove-hook 'post-command-hook 'c-post-command) - (remove-hook 'post-gc-hook 'c-post-gc-hook))) + (remove-hook 'post-command-hook 'c-post-command t))) (c-save-buffer-state () (c-clear-char-properties (point-min) (point-max) 'category) (c-clear-char-properties (point-min) (point-max) 'syntax-table) @@ -761,7 +760,7 @@ that requires a literal mode spec at compile time." ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need ;; c-after-font-lock-init. (add-hook 'after-change-functions 'c-after-change nil t) - (add-hook 'post-command-hook 'c-post-command) + (add-hook 'post-command-hook 'c-post-command nil t) (when (boundp 'font-lock-extend-after-change-region-function) (set (make-local-variable 'font-lock-extend-after-change-region-function) commit fc3de939b9059dd4436134f08e7fa7149087c317 Author: Sean Whitton Date: Mon Oct 28 21:46:06 2024 +0800 Fix C-c C-d and C-c C-w during log-view-modify-change-comment * lisp/vc/vc-dispatcher.el (log-edit-diff-fileset) (log-edit-diff-patch): Declare. (vc-log-edit, vc-start-logentry): New optional argument DIFF-FUNCTION to specify log-edit-diff-function in the generated Log Edit buffer. * lisp/vc/vc.el (vc-modify-change-comment): Pass the new DIFF-FUNCTION argument to vc-start-logentry. diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 634b6fe1555..c4a2b252cb0 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -685,10 +685,12 @@ NOT-URGENT means it is ok to continue if the user says not to save." ;; Set up key bindings for use while editing log messages (declare-function log-edit-empty-buffer-p "log-edit" ()) +(declare-function log-edit-diff-fileset "log-edit" ()) +(declare-function log-edit-diff-patch "log-edit" ()) (defvar vc-patch-string) -(defun vc-log-edit (fileset mode backend) +(defun vc-log-edit (fileset mode backend &optional diff-function) "Set up `log-edit' for use on FILE." (setq default-directory (buffer-local-value 'default-directory vc-parent-buffer)) @@ -718,7 +720,9 @@ NOT-URGENT means it is ok to continue if the user says not to save." (lambda (file) (file-relative-name file root)) fileset)))) (log-edit-diff-function - . ,(if vc-patch-string 'log-edit-diff-patch 'log-edit-diff-fileset)) + . ,(cond (diff-function) + (vc-patch-string #'log-edit-diff-patch) + (t #'log-edit-diff-fileset))) (log-edit-vc-backend . ,backend) (vc-log-fileset . ,fileset) (vc-patch-string . ,vc-patch-string)) @@ -727,7 +731,7 @@ NOT-URGENT means it is ok to continue if the user says not to save." (set-buffer-modified-p nil) (setq buffer-file-name nil)) -(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string) +(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string diff-function) "Accept a comment for an operation on FILES. If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the action on close to ACTION. If COMMENT is a string and @@ -740,7 +744,8 @@ empty comment. Remember the file's buffer in `vc-parent-buffer' MODE, defaulting to `log-edit-mode' if MODE is nil. AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'. BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer. -PATCH-STRING is a patch to check in." +PATCH-STRING is a patch to check in. +DIFF-FUNCTION is `log-edit-diff-function' for the Log Edit buffer." (let ((parent (if (and (length= files 1) (not (vc-dispatcher-browsing))) (get-file-buffer (car files)) @@ -755,7 +760,7 @@ PATCH-STRING is a patch to check in." (concat " from " (buffer-name vc-parent-buffer))) (when patch-string (setq-local vc-patch-string patch-string)) - (vc-log-edit files mode backend) + (vc-log-edit files mode backend diff-function) (make-local-variable 'vc-log-after-operation-hook) (when after-hook (setq vc-log-after-operation-hook after-hook)) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index e0fe4931e63..972bd47d26b 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2528,7 +2528,18 @@ the variable `vc-BACKEND-header'." ;; So refresh the view. (when (derived-mode-p 'log-view-mode) (revert-buffer))) - nil backend))) + nil backend nil + (lambda () + ;; Here we want the root diff for REV, even if we were called + ;; from a buffer generated by C-x v l, because the change comment + ;; we will edit applies to the whole revision. + (let* ((rootdir + (vc-call-backend backend 'root default-directory)) + (prevrev + (vc-call-backend backend + 'previous-revision rootdir rev))) + (vc-diff-internal nil (list backend (list rootdir)) + prevrev rev)))))) ;;;###autoload (defun vc-merge () commit b7b55dfc03c4d36ae77812c16d15142a6f6f27df Author: Eli Zaretskii Date: Mon Oct 28 09:04:41 2024 -0400 More workarounds for GDB bug 32313 * src/eval.c (backtrace_args): Same treatment as backtrace_function. diff --git a/src/eval.c b/src/eval.c index 3c4999d818c..d0a2abf0089 100644 --- a/src/eval.c +++ b/src/eval.c @@ -50,7 +50,6 @@ Lisp_Object Vsignaling_function; /* These would ordinarily be static, but they need to be visible to GDB. */ bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE; -Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE; union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; @@ -107,20 +106,21 @@ specpdl_arg (union specbinding *pdl) return pdl->unwind.arg; } +/* To work around GDB bug 32313 + make + backtrace_* functions visible-to-GDB pointers instead of merely + being an externally visible functions themselves. Declare the + pointer first to pacify gcc -Wmissing-variable-declarations. */ +#define GDB_FUNCPTR(func, resulttype, params) \ + extern resulttype (*const func) params EXTERNALLY_VISIBLE; \ + resulttype (*const func) params = func##_body + static Lisp_Object backtrace_function_body (union specbinding *pdl) { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->bt.function; } -/* To work around GDB bug 32313 - - make backtrace_function a visible-to-GDB pointer instead of merely - being an externally visible function itself. Declare the pointer - first to pacify gcc -Wmissing-variable-declarations. */ -#define GDB_FUNCPTR(func, resulttype, params) \ - extern resulttype (*const func) params EXTERNALLY_VISIBLE; \ - resulttype (*const func) params = func##_body GDB_FUNCPTR (backtrace_function, Lisp_Object, (union specbinding *)); static ptrdiff_t @@ -130,12 +130,13 @@ backtrace_nargs (union specbinding *pdl) return pdl->bt.nargs; } -Lisp_Object * -backtrace_args (union specbinding *pdl) +static Lisp_Object * +backtrace_args_body (union specbinding *pdl) { eassert (pdl->kind == SPECPDL_BACKTRACE); return pdl->bt.args; } +GDB_FUNCPTR (backtrace_args, Lisp_Object *, (union specbinding *)); /* Functions to modify slots of backtrace records. */