]> code.delx.au - gnu-emacs/blobdiff - lisp/wid-edit.el
* lisp/electric.el (electric-pair-pairs): New var.
[gnu-emacs] / lisp / wid-edit.el
index 22c8a21a2038e412be37d0c3c915c6c09bd440a3..e905e8f2a87fa68b0ffdbd4b349d0add9be2101c 100644 (file)
@@ -57,8 +57,6 @@
 
 ;;; Code:
 
-(defvar widget)
-
 ;;; Compatibility.
 
 (defun widget-event-point (event)
@@ -640,7 +638,8 @@ extension (xpm, xbm, gif, jpg, or png) located in
                specs)
           (dolist (elt widget-image-conversion)
             (dolist (ext (cdr elt))
-              (push (list :type (car elt) :file (concat image ext)) specs)))
+              (push (list :type (car elt) :file (concat image ext)
+                          :ascent 'center) specs)))
           (find-image (nreverse specs))))
        (t
         ;; Oh well.
@@ -1462,11 +1461,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."
@@ -2193,19 +2196,9 @@ when he invoked the menu."
   ;; We could probably do the same job as the images using single
   ;; space characters in a boxed face with a stretch specification to
   ;; make them square.
-  :on-glyph '(create-image "\300\300\141\143\067\076\034\030"
-                          'xbm t :width 8 :height 8
-                          :background "grey75" ; like default mode line
-                          :foreground "black"
-                          :relief -2
-                          :ascent 'center)
+  :on-glyph "checked"
   :off "[ ]"
-  :off-glyph '(create-image (make-string 8 0)
-                           'xbm t :width 8 :height 8
-                           :background "grey75"
-                           :foreground "black"
-                           :relief -2
-                           :ascent 'center)
+  :off-glyph "unchecked"
   :help-echo "Toggle this item."
   :action 'widget-checkbox-action)
 
@@ -3048,14 +3041,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 +3092,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 +3718,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)