# HG changeset patch # User Stefan Monnier # Date 962891929 0 # Node ID 6d383cf4bb99ef0f4d227c5c2eccc394687eaf35 # Parent 62205b47cdfdc688d1027c15b50932c1e7d96f63 Docstrings fixes. (facemenu-get-face): Don't use internal-find-face. (facemenu-iterate): Rename arg to match the docstring. diff -r 62205b47cdfd -r 6d383cf4bb99 lisp/facemenu.el --- a/lisp/facemenu.el Thu Jul 06 13:25:31 2000 +0000 +++ b/lisp/facemenu.el Thu Jul 06 13:58:49 2000 +0000 @@ -181,7 +181,7 @@ (let ((map (make-sparse-keymap "Background Color"))) (define-key map "o" (cons "Other..." 'facemenu-set-background)) map) - "Menu keymap for background colors") + "Menu keymap for background colors.") ;;;###autoload (defalias 'facemenu-background-menu facemenu-background-menu) @@ -276,7 +276,7 @@ (defcustom facemenu-add-face-function nil - "Function called at beginning of text to change or `nil'. + "Function called at beginning of text to change or nil. This function is passed the FACE to set and END of text to change, and must return a string which is inserted. It may set `facemenu-end-add-face'." :type '(choice (const :tag "None" nil) @@ -284,7 +284,7 @@ :group 'facemenu) (defcustom facemenu-end-add-face nil - "String to insert or function called at end of text to change or `nil'. + "String to insert or function called at end of text to change or nil. This function is passed the FACE to set, and must return a string which is inserted." :type '(choice (const :tag "None" nil) @@ -295,7 +295,7 @@ (defcustom facemenu-remove-face-function nil "When non-nil, this is a function called to remove faces. This function is passed the START and END of text to change. -May also be `t' meaning to use `facemenu-add-face-function'." +May also be t meaning to use `facemenu-add-face-function'." :type '(choice (const :tag "None" nil) (const :tag "Use add-face" t) function) @@ -343,7 +343,7 @@ ;;;###autoload (defun facemenu-set-foreground (color &optional start end) - "Set the foreground color of the region or next character typed. + "Set the foreground COLOR of the region or next character typed. The color is prompted for. A face named `fg:color' is used \(or created). If the region is active, it will be set to the requested face. If it is inactive \(even if mark-even-if-inactive is set) the next @@ -358,7 +358,7 @@ ;;;###autoload (defun facemenu-set-background (color &optional start end) - "Set the background color of the region or next character typed. + "Set the background COLOR of the region or next character typed. The color is prompted for. A face named `bg:color' is used \(or created). If the region is active, it will be set to the requested face. If it is inactive \(even if mark-even-if-inactive is set) the next @@ -373,7 +373,7 @@ ;;;###autoload (defun facemenu-set-face-from-menu (face start end) - "Set the face of the region or next character typed. + "Set the FACE of the region or next character typed. This function is designed to be called from a menu; the face to use is the menu item's name. @@ -530,7 +530,7 @@ (defun facemenu-add-face (face &optional start end) "Add FACE to text between START and END. -If START is `nil' or START to END is empty, add FACE to next typed character +If START is nil or START to END is empty, add FACE to next typed character instead. For each section of that region that has a different face property, FACE will be consed onto it, and other faces that are completely hidden by that will be removed from the list. @@ -605,7 +605,7 @@ (defun facemenu-get-face (symbol) "Make sure FACE exists. -If not, create it and add it to the appropriate menu. Return the symbol. +If not, create it and add it to the appropriate menu. Return the SYMBOL. If a window system is in use, and this function creates a face named `fg:color', then it sets the foreground to that color. Likewise, `bg:color' @@ -613,7 +613,7 @@ no color is set and a warning is issued." (let ((name (symbol-name symbol)) foreground) - (cond ((internal-find-face symbol)) + (cond ((facep symbol)) ((and (display-color-p) (or (setq foreground (string-match "^fg:" name)) (string-match "^bg:" name))) @@ -702,12 +702,12 @@ (nreverse (face-list))) list)) -(defun facemenu-iterate (func iterate-list) +(defun facemenu-iterate (func list) "Apply FUNC to each element of LIST until one returns non-nil. Returns the non-nil value it found, or nil if all were nil." - (while (and iterate-list (not (funcall func (car iterate-list)))) - (setq iterate-list (cdr iterate-list))) - (car iterate-list)) + (while (and list (not (funcall func (car list)))) + (setq list (cdr list))) + (car list)) (facemenu-update)