help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Flaw in) tab completion of email addresses in mail buffer


From: Kaustuv
Subject: Re: (Flaw in) tab completion of email addresses in mail buffer
Date: 10 Jul 2003 15:59:59 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Thanks a lot for pointing out wrong programming style in my coding as well
as pointing out the silly error which rendered my program unusuable.
So now after all these suggetions the implementation is 

(defun bbdb-tab-complete-name () 
  "Tab complete name using BBDB database "
  (interactive)
  (if (save-excursion 
        (beginning-of-line) 
        (or (looking-at "^To:") (looking-at "^CC:")))
        (bbdb-complete-name)
        (princ "\t" (current-buffer))))
         
(add-hook 'mail-mode-hook  
          (lambda ()
            (local-set-key [(tab)] 'bbdb-tab-complete-name)))

which works just the way I wanted it to work. 
BTW is there no genralization of looking-at function which looks at more
than one regexp so effectively it is doing:
 (or (or (looking-at "^To:") (looking-at "^CC:")) (looking-at "^BCC:"))

Thanks a lot once more to all.
Regards
Kaustuv

> Kaustuv wrote:
> 
> > (defun bbdb-tab-complete-name   "Tab complete name using BBDB database "
> >   (interactive)
> >   (setq p (point))
> >   (beginning-of-line)
> >   (setq tag (read (current-buffer)))
> >   (goto-char p)
> >   (if (string= tag "To:") (bbdb-complete-name)))
> > (add-hook 'mail-mode-hook     (lambda ()
> >         (local-set-key [(tab)] 'bbdb-tab-complete-name)))
> > Even though I can exectue each line of the function correctly when I call
> > the function as a whole I get Invalid-Function. Can some one suggest why?
> 
> 
> You left out the function's lambda list:
> 
> 
> (defun bbdb-tab-complete-name ()
>    ...)
> 
> -- 
> Kevin Rodgers
> 

-- 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]