From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Visual cleanup for customize buffers Date: Thu, 12 Jan 2006 22:58:25 +0100 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137104766 31679 80.91.229.2 (12 Jan 2006 22:26:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 Jan 2006 22:26:06 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 12 23:25:56 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ExAtE-000881-GO for ged-emacs-devel@m.gmane.org; Thu, 12 Jan 2006 23:25:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ExAvK-0005yr-O7 for ged-emacs-devel@m.gmane.org; Thu, 12 Jan 2006 17:28:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ExAW1-0001Ep-4q for emacs-devel@gnu.org; Thu, 12 Jan 2006 17:01:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ExAVy-0001Bu-8p for emacs-devel@gnu.org; Thu, 12 Jan 2006 17:01:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ExAVx-0001Bd-8u for emacs-devel@gnu.org; Thu, 12 Jan 2006 17:01:50 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ExAYp-0005pr-2W for emacs-devel@gnu.org; Thu, 12 Jan 2006 17:04:47 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 8823447FE0B for ; Thu, 12 Jan 2006 22:59:36 +0100 (CET) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:48966 Archived-At: 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 http://www.cua.dk