2870 |
:complete-function 'ispell-complete-word |
:complete-function 'ispell-complete-word |
2871 |
:prompt-history 'widget-string-prompt-value-history) |
:prompt-history 'widget-string-prompt-value-history) |
2872 |
|
|
2873 |
|
(eval-when-compile (defvar widget)) |
2874 |
|
|
2875 |
|
(defun widget-string-complete () |
2876 |
|
"Complete contents of string field. |
2877 |
|
Completions are taken from the :completion-alist property of the |
2878 |
|
widget. If that isn't a list, it's evalled and expected to yield a list." |
2879 |
|
(interactive) |
2880 |
|
(let* ((prefix (buffer-substring-no-properties (widget-field-start widget) |
2881 |
|
(point))) |
2882 |
|
(completion-ignore-case (widget-get widget :completion-ignore-case)) |
2883 |
|
(alist (widget-get widget :completion-alist)) |
2884 |
|
(_ (unless (listp alist) |
2885 |
|
(setq alist (eval alist)))) |
2886 |
|
(completion (try-completion prefix alist))) |
2887 |
|
(cond ((eq completion t) |
2888 |
|
(when completion-ignore-case |
2889 |
|
;; Replace field with completion in case its case is different. |
2890 |
|
(delete-region (widget-field-start widget) |
2891 |
|
(widget-field-end widget)) |
2892 |
|
(insert-and-inherit (car (assoc-ignore-case prefix alist)))) |
2893 |
|
(message "Only match")) |
2894 |
|
((null completion) |
2895 |
|
(error "No match")) |
2896 |
|
((not (eq t (compare-strings prefix nil nil completion nil nil |
2897 |
|
completion-ignore-case))) |
2898 |
|
(when completion-ignore-case |
2899 |
|
;; Replace field with completion in case its case is different. |
2900 |
|
(delete-region (widget-field-start widget) |
2901 |
|
(widget-field-end widget)) |
2902 |
|
(insert-and-inherit completion))) |
2903 |
|
(t |
2904 |
|
(message "Making completion list...") |
2905 |
|
(with-output-to-temp-buffer "*Completions*" |
2906 |
|
(display-completion-list |
2907 |
|
(all-completions prefix alist nil))) |
2908 |
|
(message "Making completion list...done"))))) |
2909 |
|
|
2910 |
(define-widget 'regexp 'string |
(define-widget 'regexp 'string |
2911 |
"A regular expression." |
"A regular expression." |
2912 |
:match 'widget-regexp-match |
:match 'widget-regexp-match |
3062 |
(interactive) |
(interactive) |
3063 |
(lisp-complete-symbol 'boundp)) |
(lisp-complete-symbol 'boundp)) |
3064 |
:tag "Variable") |
:tag "Variable") |
|
|
|
|
(defvar widget-coding-system-prompt-value-history nil |
|
|
"History of input to `widget-coding-system-prompt-value'.") |
|
3065 |
|
|
3066 |
(define-widget 'coding-system 'symbol |
(define-widget 'coding-system 'symbol |
3067 |
"A MULE coding-system." |
"A MULE coding-system." |
3068 |
:format "%{%t%}: %v" |
:format "%{%t%}: %v" |
3069 |
:tag "Coding system" |
:tag "Coding system" |
3070 |
:base-only nil |
:base-only nil |
3071 |
:prompt-history 'widget-coding-system-prompt-value-history |
:prompt-history 'coding-system-value-history |
3072 |
:prompt-value 'widget-coding-system-prompt-value |
:prompt-value 'widget-coding-system-prompt-value |
3073 |
:action 'widget-coding-system-action |
:action 'widget-coding-system-action |
3074 |
:complete-function (lambda () |
:complete-function (lambda () |