[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Visual cleanup for customize buffers
From: |
Kim F. Storm |
Subject: |
Visual cleanup for customize buffers |
Date: |
Thu, 12 Jan 2006 22:58:25 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Here are some trivial patches to cleanup some of the visual clutter in
customize buffers:
- Don't show the "Hide value" button for trivial values which
fit on one line initially. I don't see ANY reason why a
user would click on that button to, say, hide a boolean
or numeric value.
- For choice values, replace the old [Value Menu] Value
by the more common [Value v] (where v is a "pull down" icon)
To see some good examples of this, try M-x customize-group cua
and look at the variables "cua prefix override inhibit delay"
and "Cua normal cursor color".
- Remove the empty line between the [STATE] line and the documentation.
*** wid-edit.el 04 Jan 2006 17:15:51 +0100 1.160
--- wid-edit.el 12 Jan 2006 22:42:11 +0100
***************
*** 1416,1421 ****
--- 1416,1423 ----
(call-interactively (or (widget-get widget :complete-function)
widget-complete-field)))
+ (defvar widget-choice-menu-image nil)
+
(defun widget-default-create (widget)
"Create WIDGET at point in the current buffer."
(widget-specify-insert
***************
*** 1423,1429 ****
button-begin button-end
sample-begin sample-end
doc-begin doc-end
! value-pos)
(insert (widget-get widget :format))
(goto-char from)
;; Parse escapes in format.
--- 1425,1431 ----
button-begin button-end
sample-begin sample-end
doc-begin doc-end
! value-pos value-choice-button)
(insert (widget-get widget :format))
(goto-char from)
;; Parse escapes in format.
***************
*** 1436,1443 ****
(setq button-begin (point))
(insert (widget-get-indirect widget :button-prefix)))
((eq escape ?\])
! (insert (widget-get-indirect widget :button-suffix))
! (setq button-end (point)))
((eq escape ?\{)
(setq sample-begin (point)))
((eq escape ?\})
--- 1438,1471 ----
(setq button-begin (point))
(insert (widget-get-indirect widget :button-prefix)))
((eq escape ?\])
! (save-excursion
! (setq button-end (point))
! (when value-choice-button
! (goto-char button-begin)
! (when (search-forward ":" button-end t)
! (setq button-end (1- (point))))
! (goto-char button-end)
! (when (eq (preceding-char) ?\n)
! (backward-char 1))
! (insert " ")
! (if (display-graphic-p)
! (insert-image
! (or widget-choice-menu-image
! (setq widget-choice-menu-image
! (create-image
"\377\176\176\074\074\030\030\377"
! 'xbm t :width 8 :height 8
! :foreground
! (if (facep 'custom-button)
! (face-foreground
'custom-button)
! "black")
! :background
! (if (facep 'custom-button)
! (face-background
'custom-button)
! "lightgrey")
! :ascent 'center))) ">")
! (insert (propertize "?>" ))
! (setq button-end (point)))
! (insert (widget-get-indirect widget :button-suffix))))
((eq escape ?\{)
(setq sample-begin (point)))
((eq escape ?\})
***************
*** 1469,1474 ****
--- 1497,1505 ----
(if (and button-begin (not button-end))
(widget-apply widget :value-create)
(setq value-pos (point))))
+ ((eq escape ?V)
+ (widget-apply widget :value-create)
+ (setq value-choice-button t))
(t
(widget-apply widget :format-handler escape)))))
;; Specify button, sample, and doc, and insert value.
***************
*** 3560,3566 ****
(define-widget 'choice 'menu-choice
"A union of several sexp types."
:tag "Choice"
! :format "%{%t%}: %[Value Menu%] %v"
:button-prefix 'widget-push-button-prefix
:button-suffix 'widget-push-button-suffix
:prompt-value 'widget-choice-prompt-value)
--- 3591,3597 ----
(define-widget 'choice 'menu-choice
"A union of several sexp types."
:tag "Choice"
! :format "%{%t%}: %[%V%]"
:button-prefix 'widget-push-button-prefix
:button-suffix 'widget-push-button-suffix
:prompt-value 'widget-choice-prompt-value)
***************
*** 3629,3635 ****
:prompt-value 'widget-boolean-prompt-value
:button-prefix 'widget-push-button-prefix
:button-suffix 'widget-push-button-suffix
! :format "%{%t%}: %[Toggle%] %v\n"
:on "on (non-nil)"
:off "off (nil)")
--- 3660,3666 ----
:prompt-value 'widget-boolean-prompt-value
:button-prefix 'widget-push-button-prefix
:button-suffix 'widget-push-button-suffix
! :format "%{%t%}: %v %[Toggle%]\n"
:on "on (non-nil)"
:off "off (nil)")
*** cus-edit.el 12 Jan 2006 09:13:27 +0100 1.275
--- cus-edit.el 12 Jan 2006 22:11:35 +0100
***************
*** 2513,2526 ****
tag)
buttons)
(insert " ")
! (push (widget-create-child-and-convert
! widget 'visibility
! :help-echo "Hide the value of this option."
! :on "Hide Value"
! :off "Show Value"
! :action 'custom-toggle-parent
! t)
! buttons)
(push (widget-create-child-and-convert
widget type
:format value-format
--- 2513,2527 ----
tag)
buttons)
(insert " ")
! (unless (atom value)
! (push (widget-create-child-and-convert
! widget 'visibility
! :help-echo "Hide the value of this option."
! :on "Hide Value"
! :off "Show Value"
! :action 'custom-toggle-parent
! t)
! buttons))
(push (widget-create-child-and-convert
widget type
:format value-format
***************
*** 2540,2546 ****
;; this anyway. The doc string widget should be added like the others.
;; --dv
(widget-put widget :buttons buttons)
! (insert "\n")
;; Insert documentation.
(widget-default-format-handler widget ?h)
--- 2541,2548 ----
;; this anyway. The doc string widget should be added like the others.
;; --dv
(widget-put widget :buttons buttons)
! (unless (eq (preceding-char) ?\n)
! (insert "\n"))
;; Insert documentation.
(widget-default-format-handler widget ?h)
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Visual cleanup for customize buffers,
Kim F. Storm <=
- Re: Visual cleanup for customize buffers, Luc Teirlinck, 2006/01/12
- Re: Visual cleanup for customize buffers, Kim F. Storm, 2006/01/13
- Re: Visual cleanup for customize buffers, Luc Teirlinck, 2006/01/13
- Re: Visual cleanup for customize buffers, Kim F. Storm, 2006/01/13
- RE: Visual cleanup for customize buffers, Drew Adams, 2006/01/13
- Re: Visual cleanup for customize buffers, David Kastrup, 2006/01/13
- Re: Visual cleanup for customize buffers, Luc Teirlinck, 2006/01/13
- Re: Visual cleanup for customize buffers, Luc Teirlinck, 2006/01/13
- Re: Visual cleanup for customize buffers, Richard M. Stallman, 2006/01/14
- Re: Visual cleanup for customize buffers, Luc Teirlinck, 2006/01/13