summaryrefslogtreecommitdiff
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-10-08 23:23:38 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-10-08 23:23:38 -0400
commit587faadd0c89d5baa58612bc011785a4b5fed8df (patch)
treea1f88a894dda76933739da218279853b89f23b2f /lisp/wid-edit.el
parent85d50db7e43f64e9b88ef6c9580e425443bf7251 (diff)
downloademacs-587faadd0c89d5baa58612bc011785a4b5fed8df.tar.gz
More face customization cleanups.
* cus-edit.el (custom-commands, custom-buffer-create-internal) (custom-magic-value-create): Pad button tags with spaces. (custom-face-edit): New variable. (custom-face-value-create): Determine whether to use the usual face editor here, instead of using custom-face-selected. Pass face defaults to custom-face-edit widget. (custom-face-selected, custom-display-unselected): Delete widgets. (custom-display-unselected-match): Function removed. (custom-face-set, custom-face-mark-to-save): Accept custom-face-edit widgets as the direct widget child. * wid-edit.el (widget--completing-widget): New var. (widget-default-complete): Bind it when doing completion. (widget-string-complete, widget-file-complete): Use it.
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el26
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 22c8a21a203..a6dca41bc28 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -57,8 +57,6 @@
;;; Code:
-(defvar widget)
-
;;; Compatibility.
(defun widget-event-point (event)
@@ -1462,11 +1460,15 @@ The value of the :type attribute should be an unconverted widget type."
:notify 'widget-default-notify
:prompt-value 'widget-default-prompt-value)
+(defvar widget--completing-widget)
+
(defun widget-default-complete (widget)
"Call the value of the :complete-function property of WIDGET.
-If that does not exist, call the value of `widget-complete-field'."
- (call-interactively (or (widget-get widget :complete-function)
- widget-complete-field)))
+If that does not exist, call the value of `widget-complete-field'.
+During this call, `widget--completing-widget' is bound to WIDGET."
+ (let ((widget--completing-widget widget))
+ (call-interactively (or (widget-get widget :complete-function)
+ widget-complete-field))))
(defun widget-default-create (widget)
"Create WIDGET at point in the current buffer."
@@ -3048,14 +3050,13 @@ as the value."
:complete-function 'ispell-complete-word
:prompt-history 'widget-string-prompt-value-history)
-(defvar widget)
-
(defun widget-string-complete ()
"Complete contents of string field.
Completions are taken from the :completion-alist property of the
widget. If that isn't a list, it's evalled and expected to yield a list."
(interactive)
- (let* ((completion-ignore-case (widget-get widget :completion-ignore-case))
+ (let* ((widget widget--completing-widget)
+ (completion-ignore-case (widget-get widget :completion-ignore-case))
(alist (widget-get widget :completion-alist))
(_ (unless (listp alist)
(setq alist (eval alist)))))
@@ -3100,9 +3101,10 @@ It reads a file name from an editable text field."
(defun widget-file-complete ()
"Perform completion on file name preceding point."
(interactive)
- (completion-in-region (widget-field-start widget)
- (max (point) (widget-field-text-end widget))
- 'completion-file-name-table))
+ (let ((widget widget--completing-widget))
+ (completion-in-region (widget-field-start widget)
+ (max (point) (widget-field-text-end widget))
+ 'completion-file-name-table)))
(defun widget-file-prompt-value (widget prompt value unbound)
;; Read file from minibuffer.
@@ -3725,7 +3727,7 @@ example:
(widget-insert " ")
(widget-create-child-and-convert
widget 'push-button
- :tag "Choose" :action 'widget-color--choose-action)
+ :tag " Choose " :action 'widget-color--choose-action)
(widget-insert " "))
(defun widget-color--choose-action (widget &optional event)