unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Matt Price <matt.price@utoronto.ca>
To: Drew Adams <drew.adams@oracle.com>
Cc: 'help-gnu-emacs' <help-gnu-emacs@gnu.org>
Subject: RE: pymacs & interactivel isp functions
Date: Sat, 22 Nov 2008 16:07:51 -0500	[thread overview]
Message-ID: <1227388071.16060.698.camel@localhost> (raw)
In-Reply-To: <000f01c94cb6$d5ac5690$0200a8c0@us.oracle.com>

On Sat, 2008-11-22 at 07:27 -0800, Drew Adams wrote:

> Dunno. Your function that does all of the completion,
> `edsquery-return-addresslist' isn't shown. 
> 
that code is python.  here it is, but i don't think it's the problem
(see next bit below):

def return_addresslist (queryterm, predicate, buff):
    results = abook.search(queryterm)
    names =[]
    for record in results:
        name = record.get_name()
        address = record.get_property('email_1')
        names.append(name + " " + "<" + address +">")
        for i in ["2","3"]:
            if record.get_property('email_' + i):
                 address = record.get_property('email_' + i)
                 record.get_property('email_' + i)
                 names.append(name + ' '+ "<" + address +">")
    return names

it just returns a list of strings, which is what i thought
completing-read wanted to receive.  

> The error message is saying that function `ad-Orig-minibuffer-complete' expected
> a number or a marker but received the list of strings. 
> 
i think ad-Orig-minibuffer-complete comes from the
minibuffer-complete-cycle package; i've taken out references to it in
my .emacs for now.  but my issue persists. 

> You also apparently advised the standard function `minibuffer-complete', and
> that code isn't shown either. So it's difficult to guess what is the problem.

i think this came from minibuffer-complete-cycle.

> > i'm not sure, but it looks like it isn't breaking the cdr 
> > cell down into its components before evaluating it?
> > suggesting to me that, again, there's something wrong with my syntax.
> 
> No comprendo. What isn't breaking what cdr cell down into what components?
> 
um, i'm sure i just don't know what i'm talking about...

> FWIW, I see nothing wrong with the call to completing-read. The problem is
> likely in your completion function `edsquery-return-addresslist'.

or in my understanding of completing-read, see below.
> 
> > i appreciate the remedial lisp lessons.  sorry to just continue not
> > getting it... thanks again,
> 
> The error message should help. Look at your advised version of
> `minibuffer-complete', `ad-Orig-minibuffer-complete', and see why and where it
> expects a number or marker. Look at why your function `eds...' gives it a list
> of strings in that place instead. Perhaps try unadvising `minibuffer-complete',
> at least for testing.

hmm, i thought i wanted edsquery to give a list of strings.  i have the
following trivial code which is still giving the same kind of error, and
i think probably illustrates my conceptual error, whatever it is:

( matt/external-addressbook-completion (stub)
"get a list of addresses for tab-completion in a new email"
  (interactive (list (completing-read "Name: "
      #'static-list
;;       collection
      nil t))))

(defun static-list (s p n)
  '("matt1" "matt2" "matt3"))

(setq collection '("matt1" "matt2" "matt3"))

if i let 'collection' serve as the collection, the function works as
expected; but if 'static list' is called instead, i once again have a
type error:  
minibuffer-complete: Wrong type argument: number-or-marker-p, ("matt2"
"matt3")
my confusion, i guess, is that I'd thought the two should evaluate to
the same list '("matt1" "matt2" "matt3").  clearly i'm misunderstanding
something but it's the kind of conceptual error i have trouble finding
an answer for in the documentation.

thanks again.  you should feel free to drop me, though, drew -- i
appreciate all your efforts.  
matt

-- 
Matt Price
matt.price@utoronto.ca




  reply	other threads:[~2008-11-22 21:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 16:16 pymacs & interactivel isp functions Matt Price
2008-11-19 17:37 ` Drew Adams
2008-11-22  8:39   ` Matt Price
2008-11-22 15:27     ` Kevin Rodgers
2008-11-22 15:27     ` Drew Adams
2008-11-22 21:07       ` Matt Price [this message]
2008-11-22 21:45         ` Drew Adams
     [not found] <mailman.747.1227111401.26697.help-gnu-emacs@gnu.org>
2008-11-20 19:48 ` Greg Detre

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=1227388071.16060.698.camel@localhost \
    --to=matt.price@utoronto.ca \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).