all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gemini Lasswell <gazally@runbox.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Philipp Stephani <p.stephani2@gmail.com>, 40728@debbugs.gnu.org
Subject: bug#40728: 27.0.91; Removed public functions from debugger.el
Date: Mon, 27 Apr 2020 13:54:27 -0700	[thread overview]
Message-ID: <87h7x4zm2k.fsf@runbox.com> (raw)
In-Reply-To: <83imhugoyq.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Apr 2020 18:24:13 +0300")

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Gemini, could you please write replacements for the functions you
> removed, or defalias them to some equivalent replacements?  I agree
> that public functions should not be removed, not without deprecating
> them first (if indeed they don't make sense).

Here is a patch to bring those functions back.


[-- Attachment #2: 0001-Restore-some-public-functions-to-debug.el-Bug-40728.patch --]
[-- Type: text/plain, Size: 3693 bytes --]

From 6e1141592bc259bab9c61f3212351c92d0eb16e7 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@runbox.com>
Date: Sun, 26 Apr 2020 10:14:38 -0700
Subject: [PATCH] Restore some public functions to debug.el (Bug#40728)

In "Add backtrace-mode and use it in the debugger, ERT and Edebug", on
19 June 2018, three public functions in debug.el were removed.
Restore them so as not to break users' workflows.  Since
backtrace-mode now provides the functionality that used to come from
the buttons created by debugger-insert-backtrace, it is now obsolete.

* lisp/emacs-lisp/debug.el (debugger-insert-backtrace): New function.
Mark it as obsolete.
(debugger-toggle-locals, debug-help-follow): New aliases.

* lisp/emacs-lisp/backtrace.el (backtrace--to-string): New function.
(backtrace-to-string): Use it.  Fix whitespace.
---
 lisp/emacs-lisp/backtrace.el | 11 +++++++----
 lisp/emacs-lisp/debug.el     | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index 37dad8db16..5874ba72fc 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -922,11 +922,15 @@ backtrace
   (princ (backtrace-to-string (backtrace-get-frames 'backtrace)))
   nil)
 
-(defun backtrace-to-string(&optional frames)
+(defun backtrace-to-string (&optional frames)
   "Format FRAMES, a list of `backtrace-frame' objects, for output.
 Return the result as a string.  If FRAMES is nil, use all
 function calls currently active."
-  (unless frames (setq frames (backtrace-get-frames 'backtrace-to-string)))
+  (substring-no-properties
+   (backtrace--to-string
+    (or frames (backtrace-get-frames 'backtrace-to-string)))))
+
+(defun backtrace--to-string (frames)
   (let ((backtrace-fontify nil))
     (with-temp-buffer
       (backtrace-mode)
@@ -934,8 +938,7 @@ backtrace-to-string
             backtrace-frames frames
             backtrace-print-function #'cl-prin1)
       (backtrace-print)
-      (substring-no-properties (filter-buffer-substring (point-min)
-                                                        (point-max))))))
+      (filter-buffer-substring (point-min) (point-max)))))
 
 (provide 'backtrace)
 
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index ed28997292..14957eae0f 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -320,6 +320,17 @@ debugger--print
      (message "Error in debug printer: %S" err)
      (prin1 obj stream))))
 
+(make-obsolete 'debugger-insert-backtrace
+               "use a `backtrace-mode' buffer or `backtrace-to-string'."
+               "Emacs 27.1")
+
+(defun debugger-insert-backtrace (frames do-xrefs)
+  "Format and insert the backtrace FRAMES at point.
+Make functions into cross-reference buttons if DO-XREFS is non-nil."
+  (insert (if do-xrefs
+              (backtrace--to-string frames)
+            (backtrace-to-string frames))))
+
 (defun debugger-setup-buffer (args)
   "Initialize the `*Backtrace*' buffer for entry to the debugger.
 That buffer should be current already and in debugger-mode."
@@ -527,6 +538,8 @@ debugger-eval-expression
           (let ((str (eval-expression-print-format val)))
             (if str (princ str t))))))))
 
+(defalias 'debugger-toggle-locals 'backtrace-toggle-locals)
+
 \f
 (defvar debugger-mode-map
   (let ((map (make-keymap)))
@@ -621,6 +634,8 @@ debugger-record-expression
 	     (buffer-substring (line-beginning-position 0)
 			       (line-end-position 0)))))
 
+(defalias 'debug-help-follow 'backtrace-help-follow-symbol)
+
 \f
 ;; When you change this, you may also need to change the number of
 ;; frames that the debugger skips.
-- 
2.23.1


  reply	other threads:[~2020-04-27 20:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20  8:21 bug#40728: 27.0.91; Removed public functions from debugger.el Philipp Stephani
2020-04-20 15:24 ` Eli Zaretskii
2020-04-27 20:54   ` Gemini Lasswell [this message]
2020-04-28  6:32     ` Eli Zaretskii
2020-04-28  8:26       ` Philipp Stephani
2020-08-24  8:26         ` Stefan Kangas
2020-10-01 18:04           ` Lars Ingebrigtsen
2020-10-04 18:51             ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7x4zm2k.fsf@runbox.com \
    --to=gazally@runbox.com \
    --cc=40728@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.