From: "Andreas Röhler" <andreas.roehler@online.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Feature Request: Auto-jumping to source file (.el) upon elisp error
Date: Mon, 10 Dec 2007 19:47:21 +0100 [thread overview]
Message-ID: <200712101947.21738.andreas.roehler@online.de> (raw)
In-Reply-To: <2575de4c-8fb5-4794-b724-d19253ae498b@d21g2000prf.googlegroups.com>
Am Montag, 10. Dezember 2007 15:27 schrieb Nordlöw:
> On Dec 10, 1:14 pm, Stefan Kamphausen <ska...@gmx.net> wrote:
> > Hi,
> >
> > "Nordlöw" <per.nord...@gmail.com> writes:
> > > But the top-most function, in your case produce-an-error(), is neither
> > > clickable nor mentioned about its file/buffer-origin in the Debugger
> > > output. This is sad because this is what the user/developer wants to
> > > see first in order to most easily understand the top-most (call-stack)
> > > context of the problem.
> >
> > you are right that the function is not clickable in the backtrace if
> > being added interactively. It does work however, if it was written
> > into a separate file and then loaded via (e.g.) M-x load-file.
> >
> > Does that fit your needs?
> >
> > Regards,
> > Stefan
> > --
> > Stefan Kamphausen ---http://www.skamphausen.de
> > a blessed +42 regexp of confusion (weapon in hand)
> > You hit. The format string crumbles and turns to dust.
>
> Okey, thanks for your answer!
>
> Is it still possible to make Emacs automatically open top-most source
> code context in another window?
>
> Thanks again,
> Nordlöw
I use an adapted function `aktualisieren', which takes
arguments as C-h f does, but then opens the source if
available, narrowed to function mentioned. Code below.
Might that be a step forward?
Andreas Röhler
(defun aktualisieren (function)
"Go to FUNCTION (a symbol), narrow to region."
(interactive
(let ((fn (save-excursion
(beginning-of-defun)
(forward-word 2)
(if (featurep 'xemacs)
(function-at-point)
(function-called-at-point))))
val)
(list (intern-soft (completing-read (if fn
(format "Describe function (default %s): " fn)
"Describe function: ")
obarray 'fboundp t nil nil (symbol-name fn))))))
(if (file-readable-p
;; No effect, why?
(condition-case nil
(symbol-file function)
(error "Keine Quelldatei gefunden")))
(let* ((datei (symbol-file function)))
(cond
((file-exists-p (concat (file-name-sans-extension datei) ".el"))
(find-file (concat (file-name-sans-extension datei) ".el")))
((file-exists-p (concat (file-name-sans-extension datei) ".el.gz"))
(find-file (concat (file-name-sans-extension datei) ".el.gz")))
((file-exists-p (concat datei ".gz"))
(find-file (concat datei ".gz")))
(t (error (concat "Keine Quelle vorhanden"))))
;; 2007-06-03 a.roehler@web.de changed section end
(widen)
(goto-char (point-min))
(cond
((search-forward (concat "(defun " (symbol-name function)" ") nil t) ;;
Leerzeichen, um "-" in Funktionsnamen auszuschlie��ßen
(progn
(narrow-to-region (progn (beginning-of-defun) (point))(progn
(end-of-defun) (point)))
(delete-other-windows)))
((progn (goto-char (point-min))
(re-search-forward (concat "(defalias '" (symbol-name
function) " '\\([^)]+\\)") nil t 1))
(progn
(message " %s" (match-string-no-properties 1))
(goto-char (point-min))
(search-forward (match-string-no-properties 1))))
((progn (goto-char (point-min))
(re-search-forward (concat "\(define-.+" (symbol-name function) " *$") nil
t 1))
(message " %s" (match-string-no-properties 0)))
(t (goto-char (point-min)))))
(message "%s" "No file assigned, self-made function?")))
;;;;;;
next prev parent reply other threads:[~2007-12-10 18:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-10 8:54 Feature Request: Auto-jumping to source file (.el) upon elisp error Nordlöw
2007-12-10 9:59 ` Stefan Kamphausen
2007-12-10 10:40 ` Nordlöw
2007-12-10 12:14 ` Stefan Kamphausen
2007-12-10 14:27 ` Nordlöw
2007-12-10 18:47 ` Andreas Röhler [this message]
2007-12-10 19:11 ` Feature Request: Auto-jumping to source file (.el) upon elisperror Drew Adams
2007-12-11 7:05 ` Andreas Röhler
[not found] ` <mailman.4842.1197312462.18990.help-gnu-emacs@gnu.org>
2007-12-11 9:40 ` Feature Request: Auto-jumping to source file (.el) upon elisp error Nordlöw
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200712101947.21738.andreas.roehler@online.de \
--to=andreas.roehler@online.de \
--cc=help-gnu-emacs@gnu.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).