From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: A suggestion... Date: Thu, 17 May 2007 09:14:14 +0200 Message-ID: <85zm43zzuh.fsf@lola.goethe.zz> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1179386071 7244 80.91.229.12 (17 May 2007 07:14:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 May 2007 07:14:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Herbert Euler" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 17 09:14:28 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 1HoaBt-0006f1-Kp for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 09:14:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoaJw-00067Q-Iz for ged-emacs-devel@m.gmane.org; Thu, 17 May 2007 03:22:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HoaJt-00065x-3T for emacs-devel@gnu.org; Thu, 17 May 2007 03:22:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HoaJq-00065l-MB for emacs-devel@gnu.org; Thu, 17 May 2007 03:22:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HoaJq-00065i-FP for emacs-devel@gnu.org; Thu, 17 May 2007 03:22:38 -0400 Original-Received: from mail-in-11.arcor-online.net ([151.189.21.51]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HoaBk-0000Ao-6z for emacs-devel@gnu.org; Thu, 17 May 2007 03:14:17 -0400 Original-Received: from mail-in-03-z2.arcor-online.net (mail-in-03-z2.arcor-online.net [151.189.8.15]) by mail-in-11.arcor-online.net (Postfix) with ESMTP id 91B8C12005; Thu, 17 May 2007 09:14:10 +0200 (CEST) Original-Received: from mail-in-10.arcor-online.net (mail-in-10.arcor-online.net [151.189.21.50]) by mail-in-03-z2.arcor-online.net (Postfix) with ESMTP id 760652D3B28; Thu, 17 May 2007 09:14:10 +0200 (CEST) Original-Received: from lola.goethe.zz (dslb-084-061-048-000.pools.arcor-ip.net [84.61.48.0]) by mail-in-10.arcor-online.net (Postfix) with ESMTP id 3755532DCE6; Thu, 17 May 2007 09:14:10 +0200 (CEST) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 194181C002E3; Thu, 17 May 2007 09:14:14 +0200 (CEST) In-Reply-To: (Herbert Euler's message of "Thu\, 17 May 2007 12\:31\:45 +0800") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux) 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:71212 Archived-At: "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. (defcustom find-function-transform-list `((,(expand-file-name ".." data-directory) "/home/tmp/emacs") ("/usr/local/emacs-21/share/emacs/site-lisp/preview" "/home/tmp/auctex/preview") ("/usr/local/emacs-21/share/emacs/site-lisp/auctex" "/home/tmp/auctex/preview" "/home/tmp/auctex")) "File prefixes to transform `find-function-source-path'." :group 'find-file :type '(repeat (list string (repeat string)))) (defadvice find-library-name (around find-function-transform activate) (let ((find-function-source-path (or find-function-source-path load-path))) (let (lst case-fold-search lst2 len elt2) (setq find-function-source-path (dolist (elt find-function-source-path (nreverse lst)) (setq lst2 find-function-transform-list) (catch 'found (while lst2 (setq elt2 (pop lst2) len (length (car elt2))) (when (or (string= elt (car elt2)) (and (< len (length elt)) (string= (substring elt 0 (1+ len)) (concat (car elt2) "/")))) (while (setq elt2 (cdr elt2)) (push (concat (car elt2) (substring elt len)) lst)) (throw 'found t))) (push elt lst))))) ad-do-it)) -- David Kastrup, Kriemhildstr. 15, 44793 Bochum