From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: A suggestion... Date: Thu, 17 May 2007 16:28:20 +0200 Message-ID: <464C6684.8010805@swipnet.se> References: <85zm43zzuh.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020606060803050402010702" X-Trace: sea.gmane.org 1179414097 9676 80.91.229.12 (17 May 2007 15:01:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 May 2007 15:01:37 +0000 (UTC) Cc: Herbert Euler , emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 17:01:35 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HohTx-0003Hk-04 for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 17:01:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hohc2-0006JY-2y for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 11:09:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hohby-0006JT-TO for emacs-devel@gnu.org; Thu, 17 May 2007 11:09:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hohbw-0006JH-72 for emacs-devel@gnu.org; Thu, 17 May 2007 11:09:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hohbw-0006JE-1C for emacs-devel@gnu.org; Thu, 17 May 2007 11:09:48 -0400 Original-Received: from av6-2-sn3.vrr.skanova.net ([81.228.9.180]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HohTi-0001nz-Oq; Thu, 17 May 2007 11:01:19 -0400 Original-Received: by av6-2-sn3.vrr.skanova.net (Postfix, from userid 502) id EA7F0383AA; Thu, 17 May 2007 17:01:14 +0200 (CEST) Original-Received: from smtp3-1-sn3.vrr.skanova.net (smtp3-1-sn3.vrr.skanova.net [81.228.9.101]) by av6-2-sn3.vrr.skanova.net (Postfix) with ESMTP id D6A3737F13; Thu, 17 May 2007 17:01:14 +0200 (CEST) Original-Received: from husetbladh.homeip.net (81-235-205-78-no59.tbcn.telia.com [81.235.205.78]) by smtp3-1-sn3.vrr.skanova.net (Postfix) with ESMTP id BCC8F37E42; Thu, 17 May 2007 17:01:14 +0200 (CEST) User-Agent: Thunderbird 1.5.0.10 (X11/20070403) In-Reply-To: <85zm43zzuh.fsf@lola.goethe.zz> X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:71255 Archived-At: This is a multi-part message in MIME format. --------------020606060803050402010702 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit David Kastrup skrev: > "Herbert Euler" writes: > >>> When doing something like C-h f for a function, one gets displayed a >>> hyperlink to the corresponding source file. >>> >>> Now there is not rarely the situation that one actually wants not to >>> go to the Elisp file in load-path, but rather the actual source file. >>> >>> It happens that .elc files have a header similar to the following: >>> >>> ;ELC. >>> ;;; Compiled by dak@lola.quinscape.zz on Mon May 14 12:09:35 2007 >>> ;;; from file /rep/emacs/lisp/gnus/mml2015.el >>> ;;; in Emacs version 23.0.51 >>> ;;; with all optimizations. >>> >>> The information is sufficient for determining whether the compilation >>> happened on the current machine by the current user, and if so, what >>> the actual source file has been. >>> >>> So in this particular case, I'd prefer if, without further >>> configuration and ado, I'd be landed in the corresponding source file >>> if it is still present on the given machine. >>> >>> Since I have several packages I build and install from the respective >>> CVS source archives, having this work automatically would be quite >>> nice. >> I agree. M-. now always creates buffers like "subr.el<2>", which >> is not good. > > I have in my own personal .emacs file the following which mitigates > the problem but requires manual configuration for every package you > work with. And at my Emacs at the workplace, I have not yet adapted > .emacs, so I was annoyed again. All the info for an automatic > solution is actually in-place in the compiled Lisp files. Even when > some installation procedure copies _only_ the compiled files. > I want this feature as well. I came up with the following patch. It probably don't work correctly with non-ascii file names, I think one should check file coding there somewhere. Also I don't check user and machine since I share installation and source directories with different user names (long story) on different machines. Jan D. --------------020606060803050402010702 Content-Type: text/x-patch; name="help-fns.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="help-fns.diff" Index: lisp/help-fns.el *** lisp/help-fns.el.~1.96.~ 2007-01-24 20:52:15.000000000 +0100 --- lisp/help-fns.el 2007-05-17 16:23:46.000000000 +0200 *************** *** 232,237 **** --- 232,250 ---- libname) file)))) + (defun find-source-lisp-file (file-name) + (let* ((elc-file (locate-file (concat file-name "c") load-path)) + (str (if (and elc-file (file-readable-p elc-file)) + (with-temp-buffer + (insert-file-contents elc-file nil 0 256) + (buffer-string)))) + (src-file (and str + (string-match ";;; from file \\(.*\\.el\\)" str) + (match-string 1 str)))) + (if (and src-file (file-readable-p src-file)) + src-file + file-name))) + ;;;###autoload (defun describe-function-1 (function) (let* ((def (if (symbolp function) *************** *** 309,314 **** --- 322,331 ---- ;; but that's completely wrong when the user used load-file. (princ (if (eq file-name 'C-source) "C source code" file-name)) (princ "'") + ;; See if lisp files are present where they where installed from. + (if (not (eq file-name 'C-source)) + (setq file-name (find-source-lisp-file file-name))) + ;; Make a hyperlink to the library. (with-current-buffer standard-output (save-excursion --------------020606060803050402010702 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------020606060803050402010702--