home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / emacs / help / 3525 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.9 KB  |  52 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!mit.edu!acevedo
  3. From: acevedo@mit.edu (Raul Acevedo)
  4. Subject: Re: How to locate a function?
  5. In-Reply-To: bcho@ISI.EDU's message of 27 Jul 92 23:50:48 GMT
  6. Message-ID: <ACEVEDO.92Jul28094522@hippocrene.mit.edu>
  7. Sender: news@athena.mit.edu (News system)
  8. Nntp-Posting-Host: hippocrene.mit.edu
  9. Organization: Massachusetts Institute of Technology
  10. References: <22053@venera.isi.edu>
  11. Distribution: gnu
  12. Date: Tue, 28 Jul 1992 13:44:06 GMT
  13. Lines: 37
  14.  
  15. In article <22053@venera.isi.edu> bcho@ISI.EDU (Bonghan Cho) writes:
  16.  
  17.    How can I know the directory where a given function resides?
  18.    Since the load path has many paths, otherwise, it is very diffcult to
  19.    locate functions in order to modify the function definitions.
  20.  
  21. I have the following code that searches `load-path' for where an elisp
  22. *package* (i.e. a file like `rmail.el' or `gnus.el', not a function)
  23. resides:
  24.  
  25. (defun where-is-library (file arg)
  26.  
  27.   "Find where the Emacs Lisp library FILE is in the current `load-path'.
  28.  
  29. By default, appends \".el\" to the filename given, unless FILE already
  30. ends in \".el\" or \".elc\".  If a prefix argument is given, then no
  31. \".el\" prefix is given."
  32.  
  33.   (interactive "sWhere is library: \nP")
  34.   (let ((path load-path)
  35.         (file (if (or arg (string-match ".elc?\\'" file))
  36.                   file
  37.                   (concat file ".el"))))
  38.     (while (and path (not (file-exists-p (concat (car path) "/" file))))
  39.       (setq path (cdr path)))
  40.     (if path
  41.         (message "File %s is in %s." file (car path))
  42.         (message "File %s not found." file))))
  43.  
  44. If you want to know about a particular *function*, you have to use tags. 
  45. --
  46. Raul J. Acevedo
  47. acevedo@MIT.EDU
  48.  
  49. Life is a mystery and it's an unsolvable one.  You simply live it through, and,
  50. as you draw your last breath you say "What was that all about?"
  51.         --- Marlon Brando
  52.