[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6679: locate-library does not provide a default when called interact
From: |
Štěpán Němec |
Subject: |
bug#6679: locate-library does not provide a default when called interactively |
Date: |
Sat, 28 Mar 2020 22:59:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
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
>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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#6679: locate-library does not provide a default when called interactively,
Štěpán Němec <=