* [seano@cs.ucla.edu: patch: default argument for find-library]
@ 2007-10-31 7:47 Richard Stallman
2007-10-31 13:52 ` Vinicius Jose Latorre
0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2007-10-31 7:47 UTC (permalink / raw)
To: emacs-devel
Would someone please install this, then ack?
------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY
autolearn=failed version=3.1.0
To: emacs-devel@gnu.org
From: "Sean O'Rourke" <seano@cs.ucla.edu>
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 <sorourke@cs.ucsd.edu>
* 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
- --=-=-=--
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [seano@cs.ucla.edu: patch: default argument for find-library]
2007-10-31 7:47 [seano@cs.ucla.edu: patch: default argument for find-library] Richard Stallman
@ 2007-10-31 13:52 ` Vinicius Jose Latorre
0 siblings, 0 replies; 2+ messages in thread
From: Vinicius Jose Latorre @ 2007-10-31 13:52 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
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: emacs-devel@gnu.org
> From: "Sean O'Rourke" <seano@cs.ucla.edu>
> 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 <sorourke@cs.ucsd.edu>
>
> * 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
> - --=-=-=--
> ------- End of forwarded message -------
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-31 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 7:47 [seano@cs.ucla.edu: patch: default argument for find-library] Richard Stallman
2007-10-31 13:52 ` Vinicius Jose Latorre
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).