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: Suggestion for C-h f, describe-function Date: Tue, 04 Jul 2006 09:11:24 +0200 Message-ID: <857j2tkfoj.fsf@lola.goethe.zz> References: <85slllbpkb.fsf@lola.goethe.zz> <85fyhlbccv.fsf@lola.goethe.zz> <85fyhjr66c.fsf@lola.goethe.zz> <85mzbroxqg.fsf@lola.goethe.zz> <85ejx3ourf.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1151997467 29152 80.91.229.2 (4 Jul 2006 07:17:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 4 Jul 2006 07:17:47 +0000 (UTC) Cc: emacs-devel@gnu.org, storm@cua.dk Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 04 09:17:45 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FxfAF-0000EL-Hw for ged-emacs-devel@m.gmane.org; Tue, 04 Jul 2006 09:17:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FxfAE-0004Wm-P2 for ged-emacs-devel@m.gmane.org; Tue, 04 Jul 2006 03:17:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fxf9c-0004OA-Vu for emacs-devel@gnu.org; Tue, 04 Jul 2006 03:17:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fxf9b-0004Nl-Ux for emacs-devel@gnu.org; Tue, 04 Jul 2006 03:17:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fxf9b-0004Nf-OA for emacs-devel@gnu.org; Tue, 04 Jul 2006 03:17:03 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FxfNC-0000ET-Ft for emacs-devel@gnu.org; Tue, 04 Jul 2006 03:31:06 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1Fxf9J-0001oa-Dm; Tue, 04 Jul 2006 03:16:45 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 455C61C4D3B9; Tue, 4 Jul 2006 09:11:24 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 03 Jul 2006 19:21:09 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:56466 Archived-At: Richard Stallman writes: > Would be usable except that setting it up stops the tracking of > further load-path changes, and it requires converting _all_ > corresponding directories in the current load-path to their respective > source directory. > > Do you actually change load-path during your editing session? If so, > why? Packages triggered by autoload might add the rest of their hierarchy into load-path. > If not, wouldn't it be fine to set find-function-source-path once in > .emacs? I am not comfortable with that idea. I now put the following into my .emacs (of course, others would not need the AUCTeX parts, and if something similar were to be put into Emacs proper, one would use variables like source-directory and others to make this more generic). It seems to do the trick for me, but I am pretty sure that others might find something similar useful. It is also undocumented as for now. (defcustom find-function-transform-list '(("/usr/local/emacs-21/share/emacs/22.0.50" "/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'." :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