From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: master ec9523a: Add a keybinding to the help menu to display manuals Date: Thu, 15 Oct 2020 00:33:52 +0200 Message-ID: <87k0vs4eun.fsf@rub.de> References: <20201013010930.20500.91773@vcs0.savannah.gnu.org> <20201013010931.ABE62209AA@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20081"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 15 00:36:06 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kSpNN-00058O-VV for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Oct 2020 00:36:06 +0200 Original-Received: from localhost ([::1]:32970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSpNN-0005ew-0O for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Oct 2020 18:36:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSpLO-00046Z-35 for emacs-devel@gnu.org; Wed, 14 Oct 2020 18:34:02 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:43935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSpLL-0000xj-QZ for emacs-devel@gnu.org; Wed, 14 Oct 2020 18:34:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602714835; bh=1jSj3ndaOGru1Si3noptRFkBm+Sh+KJggXcESVMyey0=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=lgu/i1AzYGEBIGlQnuTMWkqs3fzPPeHl8FnczBaKsYbvET6B4Sv0QcUl03RZTQNIo HcZMtOG6LVYsr2B8z2oQLHvR+KdQIdc3my5PSOJDA88Cv6Cr8VAdO1ntiXJ7DBBWUp UzP4UVSJhLOYU3w0+ZgSjMXYbNEWwVBJ9L38vY9o= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([178.6.218.110]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MjS9I-1k4AuX1c8g-00ky7u; Thu, 15 Oct 2020 00:33:55 +0200 In-Reply-To: (Stefan Kangas's message of "Wed, 14 Oct 2020 12:06:48 -0700") X-Provags-ID: V03:K1:bnaMIlopLZ1XUUzRMFnzcm9kDHrGWPk20FSfVzftoXb9IMjQusq PeJ99Dmyts35NKRuNybkJK6i+RXyjqw7iOPIlEWjcxSGIJZ6otrufFykCRtFtBMSmofFXoX tjjM4H5pI1PU74eI8D7sZKwpK5uaGWobb9+tSxQkOCKOMA7HoC9X0ahlDt8mqr+UZd/VT1R P44AX3mpU5Qbz28LPodbg== X-UI-Out-Filterresults: notjunk:1;V03:K0:GGqo7P77+Is=:rZqTY0BI1fpINUu9usDehL 4JRwiIct5+vpx1Xr55MoTzSY7xlweHchB+N60JRMG7DcX4GdRq+/+tfkeSDn3woVsGJCcLn2t pEInWlCPZ7DCxABKodm1Id8nC53dppD1Igjr8oDgVO+wAdClZutphj5Ijj0l+bgAeJ92CeTrW GNAy5IhoVmPW9YlsVT6hGrMCRLfoHk8vzuoxey+yfAhn5Ub7WjJEALrCBQIxUEeMr4iGbI6tX ZrzNHbamd4ZTTW8cGGK5TKQKA5QQuV3hD7jwddp5LsWls9iTIfpPL2HUVSOLSgAMeozbmjrt3 zCyCyT0/CmNPYCkFy7YQymzkwWSih8IoEDk3CRy1Hj7IjVEXVKgfScgYrYKNIbUOLx/MjTa88 VFnYLCDWY6XmHw/v0MbJIXxF5CIAwLTip+niLrJDUFCA2qEiHvUaHFBHbGMh6cmGSMNjbvdYg xf0OkUKqcN8njtmPgdog4VJZb0/LY5Ifa38oQc186VjxGMSPEsNLTWsWDmoFGuUzWAyVWTe7A bmMY0uVYfblAj9qU9cLsJgkqDZdP+AvGafvmikafayvUL8JbaB3DFg2JwbuneD8NLIPSWl6GH 5CBM50Q5n485H52ZHYlg/QkDzRNa7F9x+81fhNDhH8mYOP6CL1NmyMCiZjPUgdzJfW2wJc7QC GOz8Z036r4Seo+4zVQkWkInr7x6K2hc8ktONQ9HCXW/OVE8njmLQ/quzh0wx+e2RynKd1AS/r OTW6Hg+wiaQrr+fdpSw9LmDOaqMgP1EvUzTgJxrDF+JDnBYEFb4lBoOaN4QcJM/bVKExupH5 Received-SPF: pass client-ip=212.227.15.15; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/14 18:33:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257689 Archived-At: --=-=-= Content-Type: text/plain On Wed, 14 Oct 2020 12:06:48 -0700 Stefan Kangas wrote: > larsi@gnus.org (Lars Ingebrigtsen) writes: > >> +*** New keybinding in 'help-for-help' to display a manual. >> +The 'R' keybinding after 'C-h C-h' will prompt for a manual name and >> +then display it. > > Shouldn't this NEWS entry rather say something like: > > * New keybinding 'C-h R' prompts for a manual display and displays it. > > Testing the command, the completion is a bit unsatisfactory. It doesn't > seem to prompt for a manual name, but a file name? Or maybe it allows > both? I see all of "gnus", "gnus.info" and "gnus.info.gz" in the > completion list, yet they all seem to lead to the same manual. I also > see ".", ".." and a directory "emacs/". ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ These last three are due to this bit in Info-read-node-name-2: ;; If the file name has no suffix or a standard suffix, ;; include it. (and (or (null (file-name-extension file)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (string-match suffix file)) And it's even worse if Info-directory-list includes directories that contain lots of extensionless files that aren't info files, such as, for example, the AUCTeX package from GNU ELPA, which contains such files as ChangeLog, COPYING, GNUmakefile, etc., all of which are listed in the *Completions* buffer, and if you choose one of them, it gets visited in Info mode, which throws the user-error: "No such node or anchor: Top". An odd thing about Info-read-node-name-2 is that it explicitly removes the empty string from Info-suffix-list but then in effect adds it back by checking for extensionless files in the above code. I checked the info files installed on my system and all of them end in ".info" or "info.gz" (in some cases followed by a dash and a number, indicating split info subfiles, see below). And also in the Emacs source all info files under info/ end in ".info". Are there known cases of extensionless info files that do not correspond to a file ending in ".info" or ".info.gz" (or another compression suffix)? If not, then removing that bit of the code will prevent the current false positives. In addition, Info-read-node-name-2 excludes subfiles of split info files only where these are extensionless files ending in the regexp "-[0-9]+", but this misses files which have the number before a compression extension, of which my system has several, e.g. R-exts.info-3.gz. However, in all cases on my system, split info files contain "info" before "-[0-9]+", and if that's always the case, then the patch below will make tab completion on info-display-manual (i.e. `C-h R') show all info files without shwoing the .info extension and also excluding numbered subfiles and false positives. Granted this is still not the manual name as shown in the top level Info directory but only the extensionless file name, e.g. "eintr" instead of "Emacs Lisp Intro", but at least it seems better than the status quo (if the assumption that all info files include the ".info" extension is correct). Steve Berman --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: Info-read-node-name-2 patch diff --git a/lisp/info.el b/lisp/info.el index 6dffb3993c..fb0de4d598 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1830,21 +1830,16 @@ Info-read-node-name-2 (when (file-directory-p dir) (dolist (file (file-name-all-completions (file-name-nondirectory string) dir)) - ;; If the file name has no suffix or a standard suffix, - ;; include it. - (and (or (null (file-name-extension file)) - (string-match suffix file)) - ;; But exclude subfiles of split Info files. - (not (string-match "-[0-9]+\\'" file)) + ;; Check if the file name has a standard suffix. + (and (string-match suffix file) + ;; Exclude subfiles of split Info files. + (not (string-match "info-[0-9]+\\(\\..*\\)?\\'" file)) ;; And exclude backup files. (not (string-match "~\\'" file)) - (push (if string-dir (concat string-dir file) file) names)) - ;; If the file name ends in a standard suffix, - ;; add the unsuffixed name as a completion option. - (when (string-match suffix file) - (setq file (substring file 0 (match-beginning 0))) - (push (if string-dir (concat string-dir file) file) - names-sans-suffix))))) + ;; Use the unsuffixed name as a completion option. + (let ((file (substring file 0 (match-beginning 0)))) + (push (if string-dir (concat string-dir file) file) + names-sans-suffix)))))) ;; If there is just one file, don't duplicate it with suffixes, ;; so `Info-read-node-name-1' will be able to complete a single ;; candidate and to add the terminating ")". --=-=-=--