From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Newsgroups: gmane.emacs.bugs Subject: bug#6679: locate-library does not provide a default when called interactively Date: Sat, 28 Mar 2020 22:59:44 +0100 Message-ID: <87sghsm97z.fsf@gmail.com> References: <4C466601.5060707@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="95611"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 6679@debbugs.gnu.org To: Kevin Rodgers Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 30 04:39:33 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIkKq-000OnK-Qx for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Mar 2020 04:39:32 +0200 Original-Received: from localhost ([::1]:43850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIkKp-0001Cd-Rv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Mar 2020 22:39:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55502) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIkIA-0004Oj-CP for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2020 22:36:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIkI9-0004Ej-5D for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2020 22:36:46 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jIkI8-0004E3-W6 for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2020 22:36:45 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jIkI8-0004nW-US for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2020 22:36:44 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?= Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Mar 2020 02:36:44 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6679 X-GNU-PR-Package: emacs Original-Received: via spool by 6679-submit@debbugs.gnu.org id=B6679.158553573317358 (code B ref 6679); Mon, 30 Mar 2020 02:36:44 +0000 Original-Received: (at 6679) by debbugs.gnu.org; 30 Mar 2020 02:35:33 +0000 Original-Received: from mail-lf1-f52.google.com ([209.85.167.52]:37856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jIJUB-0000kp-Ov for 6679@debbugs.gnu.org; Sat, 28 Mar 2020 17:59:24 -0400 Original-Received: by mail-lf1-f52.google.com with SMTP id j11so10800078lfg.4 for <6679@debbugs.gnu.org>; Sat, 28 Mar 2020 14:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=uABbj55DEgMLwWITo9C15/eeLKjzVGZyoCTDqdp1DLM=; b=R4Rir3Nd99XvzUAN4eRaIsiP7IK6Zbhc/VKD36BxaBPHO0Nyv/kw1CQXPa8ZMAna5I ey3U4/db7tVi+pgjLV4310YqlPvPa4kVTzffutJR2bVXxf0dDQE4jNF2JFmgIYYuWvZz Msqh7Cu9WYkBnf7yVfdYdSIQOs+yQ193bKjcGnlNgEFYiXyY+jBbFz2zHl4wmu/WBpgQ VFoV/RUVrPkEF8B/8NnPZH+4BX7TJCNoNBcbe9D8AZyqGCnBbt7w0NsFzJipDZrKcely WZDIhM5GMVee7m6k4CmD0ywQrLDyyERYl0EU1S813KkpilFysJW8foYUjqeICj8ddSKB 707w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=uABbj55DEgMLwWITo9C15/eeLKjzVGZyoCTDqdp1DLM=; b=IeXbZg6Ma13Oz1GVqgXAbbODQaEFP25FVFr0hZ/ef0AbygBl2aW2xvCCsCJ0ByljX1 BBjCvhs7uqQ2LDHVSJ0WT7mmmr7MlAgqFuIt89QPaMs0O4rMg6IuvceZRHLMv1h0cxN8 io4uRJsvh79lI6UHUaaTorLZ7OuMw2Po6ZrAWOo5hHQ4WAIGwpkdCU7twKz/IdA1wt7d AhZesY5gStrOX/LrXhGv/a5sliwjyBv5d0tpzr+jpCt5aSSd0Lh6wEiLLZDINQ8Aqwzs R9aoW3h2HFYi0osPRh+Ws2pfe4XV1IeC8xODrSkCuusTuHgSrl+8L/zfzsuW73x4kicu 8KRg== X-Gm-Message-State: AGi0PuYu3GKFGc6xZr7FEvMLlz0pZCsJpACN/HZUjPjkgte953gHcMgJ PJzY6KMg3QpY/689RPYAs4g= X-Google-Smtp-Source: APiQypJwqntuE19l5CgjV0XWF7QK+E2bdrlimE+pc0NnBEE+glBOkaCVjsaniln0u06r99ge+BL6CA== X-Received: by 2002:ac2:5b49:: with SMTP id i9mr3630589lfp.21.1585432757693; Sat, 28 Mar 2020 14:59:17 -0700 (PDT) Original-Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id d6sm5705621lfn.72.2020.03.28.14.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2020 14:59:17 -0700 (PDT) In-Reply-To: <4C466601.5060707@gmail.com> (Kevin Rodgers's message of "Tue, 20 Jul 2010 21:14:09 -0600") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-List-Received-Date: Sat, 28 Mar 2020 21:59:24 -0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177853 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-load-library-locate-library-Use-read-library-name.patch >>From 14acebb7a31da36423c8601033fe209efc95d1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= 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 --=-=-=--