unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Cc: 6679@debbugs.gnu.org
Subject: bug#6679: locate-library does not provide a default when called interactively
Date: Sat, 28 Mar 2020 22:59:44 +0100	[thread overview]
Message-ID: <87sghsm97z.fsf@gmail.com> (raw)
In-Reply-To: <4C466601.5060707@gmail.com> (Kevin Rodgers's message of "Tue, 20 Jul 2010 21:14:09 -0600")

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

tags 6679 + patch
thanks

On Tue, 20 Jul 2010 21:14:09 -0600
Kevin Rodgers wrote:

> Assuming that complexity is justified, it ought to be factored into a
> read-library-name utility that both find-library and locate-library use.

The first part has since happened (`read-library-name'), all that is
needed is the latter. Patch attached.

> `C-h a -library\'' returns apropos-library and load-library in addition to
> find-library and locate-library, but it's not clear to me that they would
> benefit from a default.

The patch also handles `load-library'. The set of arguments/completions
expected/provided by `apropos-library' is slightly different and
requires other validation, so `read-library-name' wouldn't really help
there.

-- 
Štěpán


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-load-library-locate-library-Use-read-library-name.patch --]
[-- Type: text/x-patch, Size: 2573 bytes --]

>From 14acebb7a31da36423c8601033fe209efc95d1da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= <stepnem@gmail.com>
Date: Sat, 28 Mar 2020 22:16:28 +0100
Subject: [PATCH] load-library, locate-library: Use read-library-name

* lisp/emacs-lisp/find-func.el (read-library-name): Add autoload
cookie.
* lisp/files.el (load-library)
* lisp/subr.el (locate-library): Use 'read-library-name' when called
interactively. (bug#6652 bug#6679)
---
 lisp/emacs-lisp/find-func.el | 1 +
 lisp/files.el                | 7 +------
 lisp/subr.el                 | 7 +------
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 167ead3ce0..e35db56550 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -279,6 +279,7 @@ find-library
       (switch-to-buffer (find-file-noselect (find-library-name library)))
     (run-hooks 'find-function-after-hook)))
 
+;;;###autoload
 (defun read-library-name ()
   "Read and return a library name, defaulting to the one near point.
 
diff --git a/lisp/files.el b/lisp/files.el
index 8ce0187f5b..5249b150c5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1101,12 +1101,7 @@ load-library
 
 See Info node `(emacs)Lisp Libraries' for more details.
 See `load-file' for a different interface to `load'."
-  (interactive
-   (let (completion-ignored-extensions)
-     (list (completing-read "Load library: "
-                            (apply-partially 'locate-file-completion-table
-                                             load-path
-                                             (get-load-suffixes))))))
+  (interactive (list (read-library-name)))
   (load library))
 
 (defun file-remote-p (file &optional identification connected)
diff --git a/lisp/subr.el b/lisp/subr.el
index 70f33ee5bd..70a74fba66 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2301,12 +2301,7 @@ locate-library
 When called from a program, the file name is normally returned as a
 string.  When run interactively, the argument INTERACTIVE-CALL is t,
 and the file name is displayed in the echo area."
-  (interactive (list (completing-read "Locate library: "
-				      (apply-partially
-                                       'locate-file-completion-table
-                                       load-path (get-load-suffixes)))
-		     nil nil
-		     t))
+  (interactive (list (read-library-name) nil nil t))
   (let ((file (locate-file library
 			   (or path load-path)
 			   (append (unless nosuffix (get-load-suffixes))
-- 
2.26.0


  reply	other threads:[~2020-03-28 21:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20 13:53 bug#6679: locate-library does not provide a default when called interactively Kevin Rodgers
2010-07-21  3:14 ` Kevin Rodgers
2020-03-28 21:59   ` Štěpán Němec [this message]
2020-04-03 12:01     ` bug#6652: " Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sghsm97z.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=6679@debbugs.gnu.org \
    --cc=kevin.d.rodgers@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).