unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8266: :complete-function in define-widget does not work as it used to
@ 2011-03-16 23:39 Lennart Borgman
  2012-02-22 21:46 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Lennart Borgman @ 2011-03-16 23:39 UTC (permalink / raw)
  To: 8266

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.

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)





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#8266: :complete-function in define-widget does not work as it used to
  2011-03-16 23:39 bug#8266: :complete-function in define-widget does not work as it used to Lennart Borgman
@ 2012-02-22 21:46 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2012-02-22 21:46 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 8266




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)





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-22 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 23:39 bug#8266: :complete-function in define-widget does not work as it used to Lennart Borgman
2012-02-22 21:46 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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