Package: debian-el
Version: 27.5-1
Severity: wishlist
File: /usr/share/emacs/site-lisp/debian-el/apt-utils.el

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))))



-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)

Kernel: Linux 2.6.22-1-486
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages debian-el depends on:
ii  binutils               2.17cvs20070426-4 The GNU assembler, linker and bina
ii  emacs21 [emacsen]      21.4a+1-5         The GNU Emacs editor
ii  emacs22-gtk [emacsen]  22.1+1-1          The GNU Emacs editor (with GTK use
ii  reportbug              3.39              reports bugs in the Debian distrib
ii  xemacs21-mule [emacsen 21.4.20-2         highly customizable text editor --

Versions of packages debian-el recommends:
ii  dlocate                      0.5-0.3     fast alternative to dpkg -L and dp
ii  groff-base                   1.18.1.1-13 GNU troff text-formatting system (
ii  wget                         1.10.2-3    retrieves files from the web

-- no debconf information



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

Reply via email to