From: Dave Love Date: Sat, 10 Feb 2001 00:41:39 +0000 (+0000) Subject: (customize-face): Default to face of text at point. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=90a98c4fa006460c26175d28944fe5de2229382a;p=emacs.git (customize-face): Default to face of text at point. (hook): Use functionp, not fboundp. (custom-hook-convert-widget): Allow symbols (functions not necessarily defined). --- diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 052b4ca2dee..d69e051e8ce 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1,6 +1,6 @@ ;;; cus-edit.el --- Tools for customizing Emacs and Lisp packages. ;; -;; Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +;; Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. ;; ;; Author: Per Abrahamsen ;; Keywords: help, faces @@ -1029,8 +1029,19 @@ Show the buffer in another window, but don't select it." (defun customize-face (&optional symbol) "Customize SYMBOL, which should be a face name or nil. If SYMBOL is nil, customize all faces." - (interactive (list (completing-read "Customize face: (default all) " - obarray 'custom-facep t))) + (interactive (list (let* ((face (get-char-property (point) 'face)) + (def (cond ((facep face) + face) + ((facep (car-safe face)) + (car-safe face))))) + (completing-read (format "Customize face: (default %s) " + (or def "all")) + obarray + (lambda (f) + (and (custom-facep f) + ;; made with defface? + (get f 'face-defface-spec))) + t nil nil def)))) (if (or (null symbol) (and (stringp symbol) (zerop (length symbol)))) (custom-buffer-create (custom-sort-items (mapcar (lambda (symbol) @@ -3004,7 +3015,7 @@ restoring it to the state of a face that has never been customized." ;; chaos. :set (lambda (symbol value) (dolist (elt value) - (if (fboundp elt) + (if (functionp elt) (add-hook symbol elt)))) :convert-widget 'custom-hook-convert-widget :tag "Hook") @@ -3014,7 +3025,11 @@ restoring it to the state of a face that has never been customized." (let* ((options (widget-get widget :options)) (other `(editable-list :inline t :entry-format "%i %d%v" - (function :format " %v"))) + (choice :format " %v" + function + ;; Allow functions not defined + ;; at this point. + (symbol :tag "Function")))) (args (if options (list `(checklist :inline t ,@(mapcar (lambda (entry)