GNU bug report logs -
#25393
FEATURE REQUEST: *Backtrace* -- C source code def highlight + jump to def.
Previous Next
Reported by: Keith David Bershatsky <esq <at> lawlist.com>
Date: Sun, 8 Jan 2017 08:31:02 UTC
Severity: wishlist
Tags: fixed
Fixed in version 27.1
Done: Gemini Lasswell <gazally <at> runbox.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25393 in the body.
You can then email your comments to 25393 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25393
; Package
emacs
.
(Sun, 08 Jan 2017 08:31:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Keith David Bershatsky <esq <at> lawlist.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 08 Jan 2017 08:31:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
As a feature request, the Emacs team may wish to consider implementing the ability for users to highlight C source code definitions in the *Backtrace* buffer and jump to the function definitions. The highlighting of said functions makes the *Backtrace* buffer prettier, and it's handy to jump to the definitions with buttons. A check should probably be included to see whether the `find-function-C-source-directory' contains C source code files before creating highlighting/buttons for jumping:
Here is the link to the related thread: http://emacs.stackexchange.com/questions/29875/debugging-debugger-mode-how-to-highlight-the-culprit
In my use-case, it wasn't very obvious to me that `/` was the cause of my backtrace error message because it was not highlighted -- this is true even though I am aware that the problem is always near the top of the debugger buffer. It is just not a function I use a lot and it didn't really look like a function because it was just regular text coloration.
(require 'debug)
(defun debugger-make-xrefs (&optional buffer)
"Attach cross-references to function names in the `*Backtrace*' buffer."
(interactive "b")
(with-current-buffer (or buffer (current-buffer))
(save-excursion
(setq buffer (current-buffer))
(let ((inhibit-read-only t)
(old-end (point-min)) (new-end (point-min)))
(if debugger-previous-backtrace
(let (old-start new-start (all-match t))
(goto-char (point-max))
(with-temp-buffer
(insert debugger-previous-backtrace)
(while (and all-match (not (bobp)))
(setq old-end (point))
(forward-line -1)
(setq old-start (point))
(with-current-buffer buffer
(setq new-end (point))
(forward-line -1)
(setq new-start (point)))
(if (not (zerop
(let ((case-fold-search nil))
(compare-buffer-substrings
(current-buffer) old-start old-end
buffer new-start new-end))))
(setq all-match nil))))
(delete-region new-end (point-max))
(goto-char (point-max))
(insert (substring debugger-previous-backtrace
(- old-end (point-min))))
(narrow-to-region (point-min) new-end)))
(goto-char (point-min))
(while (progn
(goto-char (+ (point) 2))
(skip-syntax-forward "^w_")
(not (eobp)))
(let* ((beg (point))
(end (progn (skip-syntax-forward "w_") (point)))
(fn (function-called-at-point)) ;; MODIFICATION
(sym (intern-soft (buffer-substring-no-properties beg end)))
;; MODIFICATION
(file
(if fn
(let* (
(function fn)
(advised (and (symbolp function)
(featurep 'nadvice)
(advice--p (advice--symbol-function function))))
;; If the function is advised, use the symbol that has the
;; real definition, if that symbol is already set up.
(real-function
(or (and advised
(advice--cd*r (advice--symbol-function function)))
function))
;; Get the real definition.
(def (if (symbolp real-function)
(or (symbol-function real-function)
(signal 'void-function (list real-function)))
real-function))
(aliased (or (symbolp def)
;; Advised & aliased function.
(and advised (symbolp real-function)
(not (eq 'autoload (car-safe def))))))
(file-name (find-lisp-object-file-name function (if aliased 'defun
def))))
file-name)
(and sym (symbol-file sym 'defun)))))
(when (or fn file) ;; MODIFICATION
(goto-char beg)
(re-search-forward "\\(\\sw\\|\\s_\\)+")
(help-xref-button 0 'help-function-def sym file)))
(forward-line 1))
(widen))
(setq debugger-previous-backtrace (buffer-string)))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25393
; Package
emacs
.
(Thu, 09 Aug 2018 00:12:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 25393 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Keith,
The new backtrace mode, in the master branch as of da0054c307, makes
links for built-in functions.
The attached patch improves on current master by making links to C
functions work even when those functions are advised. See
http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00025.html for
Clément's report of that problem.
[0001-Fix-links-in-backtraces-to-work-on-advised-built-ins.patch (text/plain, attachment)]
[Message part 3 (text/plain, inline)]
Keith David Bershatsky <esq <at> lawlist.com> writes:
> A check should probably be included to see whether the
> `find-function-C-source-directory' contains C source code files before
> creating highlighting/buttons for jumping:
I chose not to do this. I think it's better to make the buttons
and give an error message when they are pressed if
'find-function-C-source-directory' is misconfigured, because then the
error message lets the user know that there is a configuration problem
so that she or he can try to fix it.
Let me know if you are able to give this a try and how it works for you.
Thanks,
Gemini
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25393
; Package
emacs
.
(Mon, 27 Aug 2018 18:08:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 25393 <at> debbugs.gnu.org (full text, mbox):
Gemini Lasswell <gazally <at> runbox.com> writes:
> The attached patch improves on current master by making links to C
> functions work even when those functions are advised. See
> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00025.html for
> Clément's report of that problem.
I've pushed the patch to master (674f276c0a), and I'm closing this bug.
Added tag(s) fixed.
Request was from
Gemini Lasswell <gazally <at> runbox.com>
to
control <at> debbugs.gnu.org
.
(Mon, 27 Aug 2018 18:08:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
25393 <at> debbugs.gnu.org and Keith David Bershatsky <esq <at> lawlist.com>
Request was from
Gemini Lasswell <gazally <at> runbox.com>
to
control <at> debbugs.gnu.org
.
(Mon, 27 Aug 2018 18:08:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 25 Sep 2018 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 271 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.