comparison lisp/cus-edit.el @ 66336:d9a2701e02cd

* cus-edit.el (custom-button, custom-button-pressed): New vars. (custom-raised-buttons): Add :set spec. (custom-button-unraised, custom-button-pressed-unraised): New faces, so that custom-raised-buttons actually does something. (custom-mode): Use custom-button and custom-button-pressed. * wid-edit.el (widget-specify-button): Don't ignore widget-mouse-face on graphic terminals. (widget-move-and-invoke): Cleanup.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 23 Oct 2005 17:40:38 +0000
parents 1b475d6de39b
children b148d2fdff12
comparison
equal deleted inserted replaced
66335:781c3e37424c 66336:d9a2701e02cd
1375 (defun Custom-buffer-done (&rest ignore) 1375 (defun Custom-buffer-done (&rest ignore)
1376 "Exit current Custom buffer according to `custom-buffer-done-kill'." 1376 "Exit current Custom buffer according to `custom-buffer-done-kill'."
1377 (interactive) 1377 (interactive)
1378 (quit-window custom-buffer-done-kill)) 1378 (quit-window custom-buffer-done-kill))
1379 1379
1380 (defvar custom-button nil
1381 "Face used for buttons in customization buffers.")
1382
1383 (defvar custom-button-pressed nil
1384 "Face used for pressed buttons in customization buffers.")
1385
1380 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) 1386 (defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
1381 '(("unspecified" . unspecified)))) 1387 '(("unspecified" . unspecified))))
1382 "If non-nil, indicate active buttons in a `raised-button' style. 1388 "If non-nil, indicate active buttons in a `raised-button' style.
1383 Otherwise use brackets." 1389 Otherwise use brackets."
1384 :type 'boolean 1390 :type 'boolean
1385 :version "21.1" 1391 :version "21.1"
1386 :group 'custom-buffer) 1392 :group 'custom-buffer
1393 :set (lambda (variable value)
1394 (custom-set-default variable value)
1395 (setq custom-button
1396 (if value 'custom-button 'custom-button-unraised))
1397 (setq custom-button-pressed
1398 (if value
1399 'custom-button-pressed
1400 'custom-button-pressed-unraised))))
1387 1401
1388 (defun custom-buffer-create-internal (options &optional description) 1402 (defun custom-buffer-create-internal (options &optional description)
1389 (custom-mode) 1403 (custom-mode)
1390 (if custom-buffer-verbose-help 1404 (if custom-buffer-verbose-help
1391 (progn 1405 (progn
1894 '((((type x w32 mac) (class color)) ; Like default modeline 1908 '((((type x w32 mac) (class color)) ; Like default modeline
1895 (:box (:line-width 2 :style released-button) 1909 (:box (:line-width 2 :style released-button)
1896 :background "lightgrey" :foreground "black")) 1910 :background "lightgrey" :foreground "black"))
1897 (t 1911 (t
1898 nil)) 1912 nil))
1899 "Face used for buttons in customization buffers." 1913 "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
1900 :version "21.1" 1914 :version "21.1"
1901 :group 'custom-faces) 1915 :group 'custom-faces)
1902 ;; backward-compatibility alias 1916 ;; backward-compatibility alias
1903 (put 'custom-button-face 'face-alias 'custom-button) 1917 (put 'custom-button-face 'face-alias 'custom-button)
1918
1919 (defface custom-button-unraised
1920 '((((min-colors 88)
1921 (class color) (background light)) :foreground "blue1" :underline t)
1922 (((class color) (background light)) :foreground "blue" :underline t)
1923 (((min-colors 88)
1924 (class color) (background dark)) :foreground "cyan1" :underline t)
1925 (((class color) (background dark)) :foreground "cyan" :underline t)
1926 (t :underline t))
1927 "Face for custom buffer buttons if `custom-raised-buttons' is nil."
1928 :version "22.1"
1929 :group 'custom-faces)
1930
1931 (setq custom-button
1932 (if custom-raised-buttons 'custom-button 'custom-button-unraised))
1904 1933
1905 (defface custom-button-pressed 1934 (defface custom-button-pressed
1906 '((((type x w32 mac) (class color)) 1935 '((((type x w32 mac) (class color))
1907 (:box (:line-width 2 :style pressed-button) 1936 (:box (:line-width 2 :style pressed-button)
1908 :background "lightgrey" :foreground "black")) 1937 :background "lightgrey" :foreground "black"))
1909 (t 1938 (t
1910 (:inverse-video t))) 1939 (:inverse-video t)))
1911 "Face used for buttons in customization buffers." 1940 "Face for pressed custom buttons if `custom-raised-buttons' is non-nil."
1912 :version "21.1" 1941 :version "21.1"
1913 :group 'custom-faces) 1942 :group 'custom-faces)
1914 ;; backward-compatibility alias 1943 ;; backward-compatibility alias
1915 (put 'custom-button-pressed-face 'face-alias 'custom-button-pressed) 1944 (put 'custom-button-pressed-face 'face-alias 'custom-button-pressed)
1945
1946 (defface custom-button-pressed-unraised
1947 '((default :inherit custom-button-unraised)
1948 (((class color) (background light)) :foreground "magenta4")
1949 (((class color) (background dark)) :foreground "violet"))
1950 "Face for pressed custom buttons if `custom-raised-buttons' is nil."
1951 :version "22.1"
1952 :group 'custom-faces)
1953
1954 (setq custom-button-pressed
1955 (if custom-raised-buttons
1956 'custom-button-pressed
1957 'custom-button-pressed-unraised))
1916 1958
1917 (defface custom-documentation nil 1959 (defface custom-documentation nil
1918 "Face used for documentation strings in customization buffers." 1960 "Face used for documentation strings in customization buffers."
1919 :group 'custom-faces) 1961 :group 'custom-faces)
1920 ;; backward-compatibility alias 1962 ;; backward-compatibility alias
4309 (make-local-variable 'custom-options) 4351 (make-local-variable 'custom-options)
4310 (make-local-variable 'custom-local-buffer) 4352 (make-local-variable 'custom-local-buffer)
4311 (make-local-variable 'widget-documentation-face) 4353 (make-local-variable 'widget-documentation-face)
4312 (setq widget-documentation-face 'custom-documentation) 4354 (setq widget-documentation-face 'custom-documentation)
4313 (make-local-variable 'widget-button-face) 4355 (make-local-variable 'widget-button-face)
4314 (setq widget-button-face 'custom-button) 4356 (setq widget-button-face custom-button)
4315 (set (make-local-variable 'widget-button-pressed-face) 'custom-button-pressed) 4357 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
4316 (set (make-local-variable 'widget-mouse-face) 4358 (if custom-raised-buttons
4317 'custom-button-pressed) ; buttons `depress' when moused 4359 (set (make-local-variable 'widget-mouse-face) custom-button))
4360
4318 ;; When possible, use relief for buttons, not bracketing. This test 4361 ;; When possible, use relief for buttons, not bracketing. This test
4319 ;; may not be optimal. 4362 ;; may not be optimal.
4320 (when custom-raised-buttons 4363 (when custom-raised-buttons
4321 (set (make-local-variable 'widget-push-button-prefix) "") 4364 (set (make-local-variable 'widget-push-button-prefix) "")
4322 (set (make-local-variable 'widget-push-button-suffix) "") 4365 (set (make-local-variable 'widget-push-button-suffix) "")