Gnus development mailing list
 help / color / mirror / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: ding@gnus.org
Subject: Re: gnus-completing-read vs XEmacs 21.4
Date: Mon, 04 Oct 2010 17:25:09 +0100	[thread overview]
Message-ID: <pvhptyl22ae2.fsf@gmx.li> (raw)
In-Reply-To: <84iq1ikkpp.fsf@davestoy.home>

Dave Goldberg wrote:
>> OK, I'll try a fresh git clone and see if that solves it.

> Still getting an error, but I have eliminated the use of the old
> function (I had a current git pull, but had not copied it to my local
> packages directory - Doh! - that is now fixed).  I've also commented
> out requires of any external completion related packages in my
> init.el to no avail.  I think.

> Debugger entered--Lisp error: (wrong-type-argument listp "nnml:emunah")
>   try-completion("nnml:" ("nnml:emunah" "nnml:mm" "nnml:vv" "nnml:temple" "nnml:spam" "nnml:business" "nnml:bbdb-digest" "nnml:friends" "nnml:personal" "nnml:misc" "nnml:software" "nnml:personal.molly" "nndraft:drafts" "nnml:personal.the_browns" "nnml:inbox.mm" "nndraft:queue" "nnml:family" "nnml:ding-list" "nnml:inbox" "nnml:itac") nil)

[...]

This is almost certainly because old (for some value of old)
versions of Emacs and XEmacs expect the second value of
try-completion to be an alist and the car of each element is
checked for matching.

For example:

$ xemacs --version
XEmacs 21.1 (patch 14)

`try-completion' is a built-in function
(try-completion STRING ALIST &optional PRED)

Documentation:
Return common substring of all completions of STRING in ALIST.
Each car of each element of ALIST is tested to see if it begins with STRING.

(try-completion "foo" '("foo" "bar")) => wrong-type-argument:
listp, "foo"

(try-completion "foo" '(("foo") ("bar"))) => t

No idea /why/ this design decision was made.

I bet the new code doesn't cater for this case and just passes a
list of possible options.  Here's a simple fix (warning,
untested) which you'd probably want to condition on
try-completion being old.


diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el
index 26d6e2c..350cd13 100644
--- a/lisp/gnus-util.el
+++ b/lisp/gnus-util.el
@@ -1596,7 +1596,10 @@ SPEC is a predicate specifier that contains stuff like `or', `and',
            (concat prompt (when def
                             (concat " (default " def ")"))
                    ": ")
-           collection require-match initial-input history def))
+           (if (listp collection)
+               (mapcar (lambda (x) (if (not (consp x)) (cons x nil) x) collection))
+             collection)
+           require-match initial-input history def))
 
 (defun gnus-emacs-completing-read (prompt collection &optional require-match
                                           initial-input history def)



Lawrence
-- 
Lawrence Mitchell <wence@gmx.li>




  parent reply	other threads:[~2010-10-04 16:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 14:20 Dave Goldberg
2010-10-04 14:32 ` Julien Danjou
2010-10-04 15:20   ` Dave Goldberg
2010-10-04 15:29     ` Julien Danjou
2010-10-04 15:38       ` Dave Goldberg
2010-10-04 16:04         ` Dave Goldberg
2010-10-04 16:08           ` Julien Danjou
2010-10-04 16:25           ` Lawrence Mitchell [this message]
2010-10-04 16:31             ` Dave Goldberg
2010-10-04 16:35               ` Lawrence Mitchell
2010-10-04 16:37             ` Julien Danjou
2010-10-04 16:54               ` Lawrence Mitchell
2010-10-04 17:47                 ` Julien Danjou
2010-10-04 18:28                   ` Dave Goldberg
2010-10-04 20:18                     ` Julien Danjou
2010-10-04 21:55                       ` Dave Goldberg
2010-10-08 12:14                   ` Andrew Cohen
2010-10-08 14:35                     ` Julien Danjou

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

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

  git send-email \
    --in-reply-to=pvhptyl22ae2.fsf@gmx.li \
    --to=wence@gmx.li \
    --cc=ding@gnus.org \
    /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.
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 NNTP newsgroup(s).