1

In GNU Emacs 25.2.2 on Ubuntu 17.10, emacs -Q:

(info "(gnus) The Gnus Registry") finds the right page.

M-x info-apropos RET gnus registry RET finds nothing.

Is there a command I can use to search all of my info files?

2
  • 1
    I'm guessing that this is because info-apropos searches the indexes of each manual, and in the Gnus manual there is no index entry that matches gnus registry. (However, if you ask it to look for gnus-registry, with a hyphen, it finds search hits.) Perhaps info-apropos should automatically include general terms associated with each particular manual, e.g., include gnus for the Gnus manual. You can submit an enhancement request using M-x report-emacs-bug.
    – Drew
    Commented Jun 12, 2018 at 22:50
  • 1
    C-h f index-apropos tells you that it looks for a string in the indexes. It does not do "apropos" (e.g., keyword or regexp) matching. Maybe it should. Or maybe it's name should be changed to not suggest that it does. Again: M-x report-emacs-bug.
    – Drew
    Commented Jun 12, 2018 at 22:57

1 Answer 1

1

Here's a command that does the job. It uses the core of info-apropos, substituting the regular apropos handling of input.

I've now added this to Info+ (info+.el), as a redefinition of standard command info-apropos. This also uses another window, if you're not already in Info.

(defun my-info-apropos (pattern &optional literalp)
  "Search indexes of all known Info files on your system for apropos PATTERN.
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 nodes)))))
        (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)))))

You'll also need to modify Info-apropos-matches (or define another function that is the modified version, and call that in the code above), so that it accepts an optional arg REGEXP-P, which if non-nil does not regexp-quote the STRING arg. In other words, replace the use of just STRING with (if REGEXP-P STRING (regexp-quote STRING)).

I submitted Emacs bug #31807 for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.