From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sean O'Rourke" Newsgroups: gmane.emacs.devel Subject: patch: default argument for find-library Date: Mon, 22 Oct 2007 23:19:41 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1193120404 8412 80.91.229.12 (23 Oct 2007 06:20:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Oct 2007 06:20:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 23 08:20:05 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 1IkD7Q-0006Ib-KK for ged-emacs-devel@m.gmane.org; Tue, 23 Oct 2007 08:20:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkD7I-0005U3-LE for ged-emacs-devel@m.gmane.org; Tue, 23 Oct 2007 02:19:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IkD7F-0005Td-GQ for emacs-devel@gnu.org; Tue, 23 Oct 2007 02:19:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IkD7D-0005T3-P8 for emacs-devel@gnu.org; Tue, 23 Oct 2007 02:19:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IkD7D-0005Sk-B5 for emacs-devel@gnu.org; Tue, 23 Oct 2007 02:19:47 -0400 Original-Received: from ms-smtp-03.socal.rr.com ([66.75.162.135]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IkD7C-0004Sp-SP for emacs-devel@gnu.org; Tue, 23 Oct 2007 02:19:47 -0400 Original-Received: from mister-foo.local (cpe-76-173-198-96.socal.res.rr.com [76.173.198.96]) by ms-smtp-03.socal.rr.com (8.13.6/8.13.6) with ESMTP id l9N6Jfdu023414 for ; Mon, 22 Oct 2007 23:19:43 -0700 (PDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (darwin) X-Virus-Scanned: Symantec AntiVirus Scan Engine X-detected-kernel: by monty-python.gnu.org: NetCache Data OnTap 5.x 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:81507 Archived-At: --=-=-= 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 * 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 Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--