forwarded 442425 Matt Hodges <[EMAIL PROTECTED]>
thanks

Hi Matt,

I don't know whether you are subscribed to the package to receive bug
emails, but this is interesting.

-- 
Peter

Kevin Ryde <[EMAIL PROTECTED]> wrote:

> It'd be nice if M-x apt-utils-show-package, when it prompts for a
> package name, didn't build the list of possible names until you hit tab
> or whatever to try to complete from among them.  The apt-cache program,
> or whatever builds the list, is very slow on my system and it's good to
> get the prompt without doing that, since of course you can type a
> package name without using the completions.  The few lines below work
> for me, using a completions handler function.

(defun apt-utils-show-package (&optional new-session)
  "Show information for a Debian package.
A selection of known packages is presented.  See `apt-utils-mode'
for more detailed help.  If NEW-SESSION is non-nil, generate a
new `apt-utils-mode' buffer."
  (interactive "P")
  (let ((package (apt-utils-choose-package)))
    (when (> (length package) 0)
      (apt-utils-show-package-1 package t new-session))))

(defun apt-utils-choose-package ()
  "Choose a Debian package name."
  (let ((package
         (and (eq major-mode 'apt-utils-mode)
              (cadr (member 'apt-package
                            (text-properties-at (point)))))))
    (when (not (stringp package))
      (setq package nil))
    (completing-read (if package
                         (format "Choose Debian package (%s): " package)
                       "Choose Debian package: ")
                     'apt-utils-choose-package-completion
                     nil t package)))

(defun apt-utils-choose-package-completion (str pred all)
  "Apt package name completion handler, for `completing-read'."
  (apt-utils-check-package-lists)
  (let ((collection (cond
                     (apt-utils-completing-read-hashtable-p
                      apt-utils-package-list)
                     (t
                      (apt-utils-build-completion-table
                       apt-utils-package-list)))))
    (if all
        (all-completions str collection pred)
      (try-completion str collection pred))))



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to