From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "=?ISO-8859-1?Q?Nordl=F6w?=" Newsgroups: gmane.emacs.help Subject: Re: Feature Request: Auto-jumping to source file (.el) upon elisp error Date: Tue, 11 Dec 2007 01:40:12 -0800 (PST) Organization: http://groups.google.com Message-ID: <812fcf3b-e3fc-44a1-a16e-af8121ca520f@b1g2000pra.googlegroups.com> 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 1197366071 32501 80.91.229.12 (11 Dec 2007 09:41:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Dec 2007 09:41:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 11 10:41:21 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 1J21c7-0005jX-0c for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Dec 2007 10:41:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J21bo-0001FY-Ps for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Dec 2007 04:41:00 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!b1g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 114 Original-NNTP-Posting-Host: 150.227.15.253 Original-X-Trace: posting.google.com 1197366013 28682 127.0.0.1 (11 Dec 2007 09:40:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 11 Dec 2007 09:40:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b1g2000pra.googlegroups.com; posting-host=150.227.15.253; posting-account=ytJKAgoAAAA1tg4ScoRszebXiIldA5vg User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.7) Gecko/20070923 Firefox/2.0.0.7 (Swiftfox),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 netcache (NetCache NetApp/6.1.1RC1) Original-Xref: shelby.stanford.edu gnu.emacs.help:154570 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:49997 Archived-At: On Dec 10, 7:47 pm, Andreas R=C3=B6hler wrote: > 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 neith= er > > > > 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-stac= k) > > > > 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 (d= efault %s): " fn) > "Describe function: ") > obarray 'fboundp t nil nil (symbo= l-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=EF=BF=BD=EF=BF=BD=C3=9Fe= n > (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 fun= ction) " *$") 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=C3=B6w