From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#31807: 27.0; `info-apropos' bad name or bad matching Date: Thu, 14 Jun 2018 13:45:38 -0700 (PDT) Message-ID: References: <<78156de2-86c8-4593-92b5-59edf7a8996e@default>> <<83o9gd33dj.fsf@gnu.org>> <> <<83in6l30ir.fsf@gnu.org>> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1529009047 26735 195.159.176.226 (14 Jun 2018 20:44:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 14 Jun 2018 20:44:07 +0000 (UTC) Cc: 31807@debbugs.gnu.org To: Eli Zaretskii , Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 14 22:44:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTZ6A-0006qa-JA for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jun 2018 22:44:02 +0200 Original-Received: from localhost ([::1]:42962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTZ8H-0007b1-Q3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jun 2018 16:46:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTZ8B-0007Yn-1t for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2018 16:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTZ85-0003Nn-W4 for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2018 16:46:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTZ85-0003NZ-Sc for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2018 16:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fTZ85-0003aS-H3 for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2018 16:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jun 2018 20:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31807 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31807-submit@debbugs.gnu.org id=B31807.152900914913770 (code B ref 31807); Thu, 14 Jun 2018 20:46:01 +0000 Original-Received: (at 31807) by debbugs.gnu.org; 14 Jun 2018 20:45:49 +0000 Original-Received: from localhost ([127.0.0.1]:48568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTZ7t-0003a2-6o for submit@debbugs.gnu.org; Thu, 14 Jun 2018 16:45:49 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:42236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTZ7q-0003Zc-Te for 31807@debbugs.gnu.org; Thu, 14 Jun 2018 16:45:47 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5EKiVQM042654; Thu, 14 Jun 2018 20:45:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=D72YPN8xvuBQGfQ690DZFaJmsaHb4v+6FFbmyYL76R0=; b=YDWsEcqJLwDpRwvI+5v5SCkh2xpOq2otl4aNKOSdgqckmH/bAg/7rqJcrCJ61noXR0C9 j/sriCVQwCAsjLgco/5PQ/NisVW8uqb7uuiCgoYremNdjPnfuHDu8hvA9lgtSK9el1WE 0LPUACMAqumUr0GrUjFB3NIi+lnFcPd4ck1txcoxkSyTVwrUBUAGACrCXY8IXSa9+TgL mgWnE1K+P5z/oesiQvOMKrxzitSvGmuXnoszPPYPTwx4Kahso9WOkvYhvuXq6YoGjs30 TVoxqA6dvyiPjwkdq7afmePvA5rIJGWJMVg/yUo0CCSkuGzRSJl44uBAU7tLK0CUk+p5 fw== Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2jk0xrpmth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Jun 2018 20:45:40 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5EKjdAi008789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Jun 2018 20:45:40 GMT Original-Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5EKjd7B029670; Thu, 14 Jun 2018 20:45:39 GMT In-Reply-To: <<83in6l30ir.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4690.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8924 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806140228 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147431 Archived-At: > > If you want to keep the current behavior then I'd suggest > > having two different commands AND, for the one that does > > literal string matching, change the name to something that > > does not include "apropos" in the name. >=20 > I'm okay with a new command, but it should have a new name. How about > info-apropos-regexp? The old command must keep its name, for the same > reason we cannot change its behavior. >=20 > > When I get some time I'll take a closer look. >=20 > Thanks. Here's the code I've included in my library `info+.el'. You may want to use it in `info.el'. Or not. If you want to rename `info-apropos' here to `info-apropos-regexp', do so. And you might want other changes, too. It should be pretty clear what the essential changes are, versus others that you might not want to make. (I untabify, I use `add-to-list' for backward compatibility, and I use a separate window if invoked outside Info.) HTH. ;; REPLACE ORIGINAL in `info.el': ;; ;; Added optional arg LITERALP. Use apropos matching, not literal-string m= atching, ;; by default. Prefix arg matches literally. ;; Use other window, unless already in Info. ;; (defun info-apropos (pattern &optional literalp) "Search indexes of all known Info files on your system for apropos PATTER= N. Build a menu of the possible matches. With a prefix arg, match PATTERN as a literal string, not as a regexp or keywords. Just as for commands such as `apropos', PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words." (interactive (list (apropos-read-pattern "index entries") current-prefix-= arg)) (apropos-parse-pattern pattern) (if (equal apropos-regexp "") (Info-find-node Info-apropos-file "Top") (let ((nodes Info-apropos-nodes) nodename) (while (and nodes (not (string-match apropos-regexp (nth 1 (car node= s))))) (setq nodes (cdr nodes))) ;; Use another window, if not already in Info. (unless (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) (if nodes (Info-find-node Info-apropos-file (caar nodes)) (setq nodename (format "Index for '%s'" apropos-regexp)) (push (list nodename apropos-regexp (Info-apropos-matches apropos-regexp (and (not literalp= ) 'REGEXP))) Info-apropos-nodes) (Info-find-node Info-apropos-file nodename))))) ;; REPLACE ORIGINAL in `info.el': ;; ;; Added optional arg REGEXP-P. ;; (defun Info-apropos-matches (string &optional regexp-p) "Collect STRING matches from all known Info files on your system. Return a list of matches where each element is in the format \((FILENAME INDEXTEXT NODENAME LINENUMBER)). Non-nil optional REGEXP-P means interpret STRING as a regexp, instead of trying to match it literally." ;; Emacs 23 has an `interactive' spec here, for no reason. (unless (string=3D string "") (let ((pattern (format "\n\\* +\\([^\n]*\\(%s\\)[^\n]*\\):[ \t]+\ \\([^\n]+\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?" (if regexp-p string (regexp-quote string))= )) (ohist Info-history) (ohist-list Info-history-list) (current-node Info-current-node) (current-file Info-current-file) manuals matches node nodes) (let ((Info-fontify-maximum-menu-size nil)) (Info-directory) ;; `current-node' and `current-file' are nil if you invoke `info-ap= ropos' as ;; the first Info command. (`info-apropos' loads `info.el'.) In t= hat case, ;; use `(DIR)Top', to avoid an error after search is complete. (unless current-node (setq current-file Info-current-file current-node Info-current-node)) (message "Searching indices...") (goto-char (point-min)) (re-search-forward "\\* Menu: *\n" nil t) ;; Ensure no duplicates in MANUALS, so the `dolist' runs faster. (while (re-search-forward "\\*.*: *(\\([^)]+\\))" nil t) (add-to-list 'manuals (match-string 1))) (dolist (manual (nreverse manuals)) (message "Searching %s" manual) (condition-case err (if (setq nodes (Info-index-nodes (Info-find-file manual))) (save-excursion (Info-find-node manual (car nodes)) (while (progn (goto-char (point-min)) (while (re-search-forward pattern nil t) (let ((entry (match-string-no-properties 1)= ) (nodename (match-string-no-properties 3)= ) (line (match-string-no-properties 4)= )) (add-text-properties (- (match-beginning 2) (match-beginning 1)) (- (match-end 2) (match-beginning 1)) '(face info-index-match) entry) (setq matches (cons (list manual entry noden= ame line) matches)))) (setq nodes (cdr nodes) node (car nodes))) (Info-goto-node node)))) (error (message "%s" (if (eq (car-safe err) 'error) (nth 1 err)= err)) (sit-for 1 t))))) (Info-find-node current-file current-node) (setq Info-history ohist Info-history-list ohist-list) (message "Searching indices...done") (or (nreverse matches) t))))