From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?utf-8?q?R=C3=B6hler?= Newsgroups: gmane.emacs.help Subject: Re: Feature Request: Auto-jumping to source file (.el) upon elisp error Date: Mon, 10 Dec 2007 19:47:21 +0100 Message-ID: <200712101947.21738.andreas.roehler@online.de> References: <2195cd7f-f88e-420b-b173-a3996379d5f4@i29g2000prf.googlegroups.com> <858x42n3vm.fsf@usenet.my.skamphausen.de> <2575de4c-8fb5-4794-b724-d19253ae498b@d21g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1197312538 13848 80.91.229.12 (10 Dec 2007 18:48:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Dec 2007 18:48:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 10 19:49:08 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J1ngf-0005Ra-Be for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Dec 2007 19:49:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1ngN-0000gu-T3 for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Dec 2007 13:48:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J1nfI-000063-1C for help-gnu-emacs@gnu.org; Mon, 10 Dec 2007 13:47:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J1nfF-0008U2-JD for help-gnu-emacs@gnu.org; Mon, 10 Dec 2007 13:47:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J1nfF-0008Ta-BC for help-gnu-emacs@gnu.org; Mon, 10 Dec 2007 13:47:37 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J1nfF-0000ul-66 for help-gnu-emacs@gnu.org; Mon, 10 Dec 2007 13:47:37 -0500 Original-Received: from noname (p54BE963E.dip0.t-ipconnect.de [84.190.150.62]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1J1nfD3XKj-0007kd; Mon, 10 Dec 2007 19:47:36 +0100 User-Agent: KMail/1.9.5 In-Reply-To: <2575de4c-8fb5-4794-b724-d19253ae498b@d21g2000prf.googlegroups.com> Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX18rBWsVQMuosOq8enirL/fFyV3i06Wxrk3MFN1 AhEny3jahW8jPK8rbZ4IyFUXJGZZvjvOfn53rkeRwrLZU1oE5V ihlH5jJSQJ/SdG3RMco6w== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:49985 Archived-At: Am Montag, 10. Dezember 2007 15:27 schrieb Nordl=C3=B6w: > On Dec 10, 1:14 pm, Stefan Kamphausen wrote: > > Hi, > > > > "Nordl=C3=B6w" 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=C3=B6w 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=C3=B6hler (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=09 (widen) (goto-char (point-min)) (cond=20 ((search-forward (concat "(defun " (symbol-name function)" ") nil t) ;;=20 Leerzeichen, um "-" in Funktionsnamen auszuschlie=EF=BF=BD=EF=BF=BD=C3=9Fen (progn (narrow-to-region (progn (beginning-of-defun) (point))(progn=20 (end-of-defun) (point))) (delete-other-windows)))=20 ((progn (goto-char (point-min)) (re-search-forward (concat "(defalias '" (symbol-name=20 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) " *$") n= il=20 t 1)) (message " %s" (match-string-no-properties 0))) (t (goto-char (point-min))))) (message "%s" "No file assigned, self-made function?"))) ;;;;;;