help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Request: Auto-jumping to source file (.el) upon elisp error


From: Nordlöw
Subject: Re: Feature Request: Auto-jumping to source file (.el) upon elisp error
Date: Tue, 11 Dec 2007 01:40:12 -0800 (PST)
User-agent: G2/1.0

On Dec 10, 7:47 pm, Andreas Röhler <andreas.roeh...@online.de> wrote:
> 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.roeh...@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?")))
>
> ;;;;;;

Can I make this happen automatically upon error?

Automation, automation, automation...

Thanks again,
Nordlöw


reply via email to

[Prev in Thread] Current Thread [Next in Thread]