emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: patch: default argument for find-library]


From: Vinicius Jose Latorre
Subject: Re: address@hidden: patch: default argument for find-library]
Date: Wed, 31 Oct 2007 10:52:39 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071009 SeaMonkey/1.1.5

Richard Stallman wrote:
Would someone please install this, then ack?

Done in trunk and emacs_22_branch.


------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=failed version=3.1.0
To: address@hidden
From: "Sean O'Rourke" <address@hidden>
Date: Mon, 22 Oct 2007 23:19:41 -0700
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Subject: patch: default argument for find-library

- --=-=-=

This patch uses the library name at point as the interactive
default to `find-library' -- `find-variable' and `find-function'
already have analogous defaults.

/s

2007-10-22  Sean O'Rourke  <address@hidden>

        * emacs-lisp/find-func.el (find-library): use library at
        point as default interactive argument.


- --=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment

Index: find-func.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/emacs-lisp/find-func.el,v
retrieving revision 1.82
diff -p -u -w -r1.82 find-func.el
- --- find-func.el      17 Oct 2007 23:49:00 -0000      1.82
+++ find-func.el        23 Oct 2007 06:17:37 -0000
@@ -192,11 +192,21 @@ TYPE should be nil to find a function, o
 (defun find-library (library)
   "Find the elisp source of LIBRARY."
   (interactive
+   (let* ((path (cons (or find-function-source-path load-path)
+                      (find-library-suffixes)))
+          (def (if (eq (function-called-at-point) 'require)
+                   (save-excursion
+                     (backward-up-list)
+                     (forward-char)
+                     (backward-sexp -2)
+                     (thing-at-point 'symbol))
+                 (thing-at-point 'symbol))))
+     (when def
+       (setq def (and (locate-file-completion def path 'test) def)))
    (list
- -    (completing-read "Library name: "
- -                  'locate-file-completion
- -                  (cons (or find-function-source-path load-path)
- -                        (find-library-suffixes)))))
+      (completing-read (if def (format "Library name (default %s): " def)
+                         "Library name: ")
+                    'locate-file-completion path nil nil nil def))))
   (let ((buf (find-file-noselect (find-library-name library))))
     (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf)))))
- --=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel
- --=-=-=--
------- End of forwarded message -------





reply via email to

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