[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion for C-h f, describe-function

From: David Kastrup
Subject: Re: Suggestion for C-h f, describe-function
Date: Tue, 04 Jul 2006 09:11:24 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> 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

(defcustom find-function-transform-list
  "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)))))

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

[Prev in Thread] Current Thread [Next in Thread]