aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-09-09 22:19:53 +0000
committerDave Love2002-09-09 22:19:53 +0000
commitb0628208cbc52cc19ae9610f08b596ddc28d99a6 (patch)
tree8fc06bb8b7c72a4df31f12d64b8130f0fcc3290c
parent0b520940e63bd347502ece7ec2092163a2ca987e (diff)
downloademacs-b0628208cbc52cc19ae9610f08b596ddc28d99a6.tar.gz
emacs-b0628208cbc52cc19ae9610f08b596ddc28d99a6.zip
(widget-string-complete): New.
(widget-coding-system-prompt-value-history): Deleted. (coding-system): Use coding-system-value-history.
-rw-r--r--lisp/wid-edit.el42
1 files changed, 38 insertions, 4 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 783c0efbf37..1ac4e3c2542 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2870,6 +2870,43 @@ as the value."
2870 :complete-function 'ispell-complete-word 2870 :complete-function 'ispell-complete-word
2871 :prompt-history 'widget-string-prompt-value-history) 2871 :prompt-history 'widget-string-prompt-value-history)
2872 2872
2873(eval-when-compile (defvar widget))
2874
2875(defun widget-string-complete ()
2876 "Complete contents of string field.
2877Completions are taken from the :completion-alist property of the
2878widget. 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
2873(define-widget 'regexp 'string 2910(define-widget 'regexp 'string
2874 "A regular expression." 2911 "A regular expression."
2875 :match 'widget-regexp-match 2912 :match 'widget-regexp-match
@@ -3025,16 +3062,13 @@ It will read a directory name from the minibuffer when invoked."
3025 (interactive) 3062 (interactive)
3026 (lisp-complete-symbol 'boundp)) 3063 (lisp-complete-symbol 'boundp))
3027 :tag "Variable") 3064 :tag "Variable")
3028
3029(defvar widget-coding-system-prompt-value-history nil
3030 "History of input to `widget-coding-system-prompt-value'.")
3031 3065
3032(define-widget 'coding-system 'symbol 3066(define-widget 'coding-system 'symbol
3033 "A MULE coding-system." 3067 "A MULE coding-system."
3034 :format "%{%t%}: %v" 3068 :format "%{%t%}: %v"
3035 :tag "Coding system" 3069 :tag "Coding system"
3036 :base-only nil 3070 :base-only nil
3037 :prompt-history 'widget-coding-system-prompt-value-history 3071 :prompt-history 'coding-system-value-history
3038 :prompt-value 'widget-coding-system-prompt-value 3072 :prompt-value 'widget-coding-system-prompt-value
3039 :action 'widget-coding-system-action 3073 :action 'widget-coding-system-action
3040 :complete-function (lambda () 3074 :complete-function (lambda ()