unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Samuel Bronson <naesten@gmail.com>, 18044@debbugs.gnu.org
Subject: bug#18044: 24.3; `info-display-manual' should use completing input for manual name
Date: Thu, 17 Jul 2014 20:47:45 -0700 (PDT)	[thread overview]
Message-ID: <c5fb6dc8-a4f1-48ab-bcde-d003d8421103@default> (raw)
In-Reply-To: <87tx6f766x.fsf@naesten.mooo.com>

> I think it would be possible to extract the necessary machinery from the
> function `Info-read-node-name' and its -1/-2 friends, but I don't grok
> completion well enough to do it myself, and one of the core
> (not-info-specific) completion functions involved isn't even documented.

Righto.  info+.el has done that for a long time, with this defun:

;; REPLACE ORIGINAL in `info.el':
;;
;; Use completion for inputting the manual name.
;;
(defun info-display-manual (manual)
  "Go to Info buffer that displays MANUAL, creating if it does not exist."
  ;;  (interactive "sManual name: ")
  (interactive
   (let ((manuals  ()))
     (condition-case nil
         (with-temp-buffer
           (Info-mode)
           (Info-directory)
           (goto-char (point-min))
           (re-search-forward "\\* Menu: *\n" nil t)
           (let (manual)
             (while (re-search-forward "\\*.*: *(\\([^)]+\\))" nil t)
               (setq manual  (match-string 1))
               (set-text-properties 0 (length manual) nil manual)
               (add-to-list 'manuals (list manual)))))
       (error nil))
     (list (completing-read "Display manual: " manuals))))
  (let ((blist (buffer-list))
        (manual-re (concat "\\(/\\|\\`\\)" manual "\\(\\.\\|\\'\\)"))
        (case-fold-search t)
        found)
    (dolist (buffer blist)
      (with-current-buffer buffer
        (when (and (eq major-mode 'Info-mode)
                   (stringp Info-current-file)
                   (string-match manual-re Info-current-file))
          (setq found  buffer
                blist  ()))))
    (if found
        (switch-to-buffer found)
      (info-initialize)
      (info (Info-find-file manual)))))

http://www.emacswiki.org/InfoPlus
http://www.emacswiki.org/emacs-en/download/info%2b.el





  reply	other threads:[~2014-07-18  3:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18  2:26 bug#18044: 24.3; `info-display-manual' should use completing input for manual name Samuel Bronson
2014-07-18  3:47 ` Drew Adams [this message]
2014-07-18  6:26 ` Eli Zaretskii
2021-07-14  9:06 ` Lars Ingebrigtsen
2021-07-14 12:06   ` Eli Zaretskii
2021-07-14 13:01     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5fb6dc8-a4f1-48ab-bcde-d003d8421103@default \
    --to=drew.adams@oracle.com \
    --cc=18044@debbugs.gnu.org \
    --cc=naesten@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).