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

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

bug#8266: :complete-function in define-widget does not work as it used t


From: Glenn Morris
Subject: bug#8266: :complete-function in define-widget does not work as it used to
Date: Wed, 22 Feb 2012 16:46:56 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)



Lennart Borgman wrote:

> I have used constructs like this many times, but now the
> :complete-function does not work any more. It gives me "idx" (which I
> expect) but insert it in the wrong place.

I don't see anything like this in the current trunk on GNU/Linux.

I added

(defalias 'idxgds-query-url-p 'ignore)

because the example is incomplete.

I used entered "idx" in the customize and field and used M-x
widget-complete.



> To show it evaluate the code below and do "M-x customize-option RET
> idxsearch-engine RET" and try to complete the choice.
>
>
> (defvar idxsearch-engines
>   '((idxdocidxer-search "DocIndexer")
>     (idxgds-search "Google Desktop Search")
>     (idxwds-search "Windows Desktop Search"))
>   "Search engines.")
>
> (defun idxsearch-funp (fun)
>   (assoc fun idxsearch-engines))
>
> (define-widget 'idxsearch-function 'function
>   "A index search function known by `idxsearch."
>   :complete-function (lambda ()
>                        (interactive)
>                        (lisp-complete-symbol 'idxsearch-funp))
>   :prompt-match 'idxsearch-funp
>   :prompt-history 'widget-function-prompt-value-history
>   :match-alternatives '(idxsearch-funp)
>   :validate (lambda (widget)
>               (unless (idxsearch-funp (widget-value widget))
>                 (widget-put widget :error (format "Unknown index
> search function: %S"
>                                                   (widget-value widget)))
>                 widget))
>   :value 'fundamental-mode
>   :tag "Index search specific function")
>
> (defcustom idxsearch-engine (cond
>                              ((idxgds-query-url-p) 'idxgds-search)
>                              (t (if (eq system-type 'windows-nt)
>                                     'idxwds-search
>                                   'idxdocidxer-search)))
>   "Desktop search engine for `idxsearch' to use."
>   :type 'idxsearch-function
>   :group 'idxsearch)





reply via email to

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