comparison lisp/facemenu.el @ 72335:d6694b6039c1

(facemenu-add-face): Pass frame to facemenu-active-faces. (facemenu-set-face): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Thu, 10 Aug 2006 04:00:34 +0000
parents 8d6af1c1c365
children 1bac8eb0facf
comparison
equal deleted inserted replaced
72334:872d10db66d6 72335:d6694b6039c1
318 (facemenu-iterate 'facemenu-add-new-face 318 (facemenu-iterate 'facemenu-add-new-face
319 (facemenu-complete-face-list facemenu-keybindings))) 319 (facemenu-complete-face-list facemenu-keybindings)))
320 320
321 ;;;###autoload 321 ;;;###autoload
322 (defun facemenu-set-face (face &optional start end) 322 (defun facemenu-set-face (face &optional start end)
323 "Add FACE to the region or next character typed. 323 "Apply FACE to the region or next character typed.
324 This adds FACE to the top of the face list; any faces lower on the list that 324
325 will not show through at all will be removed. 325 If the region is active (normally true except in Transient
326 326 Mark mode) and nonempty, and there is no prefix argument,
327 Interactively, reads the face name with the minibuffer. 327 this command applies FACE to the region. Otherwise, it applies FACE
328 328 to the faces to use for the next character
329 If the region is active (normally true except in Transient Mark mode) 329 inserted. (Moving point or switching buffers before typing
330 and there is no prefix argument, this command sets the region to the 330 a character to insert cancels the specification.)
331 requested face. 331
332 332 If FACE is `default', to \"apply\" it means clearing
333 Otherwise, this command specifies the face for the next character 333 the list of faces to be used. For any other value of FACE,
334 inserted. Moving point or switching buffers before 334 to \"apply\" it means putting FACE at the front of the list
335 typing a character to insert cancels the specification." 335 of faces to be used, and removing any faces further
336 along in the list that would be completely overridden by
337 preceding faces (including FACE).
338
339 This command can also add FACE to the menu of faces,
340 if `facemenu-listed-faces' says to do that."
336 (interactive (list (progn 341 (interactive (list (progn
337 (barf-if-buffer-read-only) 342 (barf-if-buffer-read-only)
338 (read-face-name "Use face")) 343 (read-face-name "Use face"))
339 (if (and mark-active (not current-prefix-arg)) 344 (if (and mark-active (not current-prefix-arg))
340 (region-beginning)) 345 (region-beginning))
610 face 615 face
611 (facemenu-active-faces 616 (facemenu-active-faces
612 (cons face 617 (cons face
613 (if (listp prev) 618 (if (listp prev)
614 prev 619 prev
615 (list prev))))))) 620 (list prev)))
621 ;; Specify the selected frame
622 ;; because nil would mean to use
623 ;; the new-frame default settings,
624 ;; and those are usually nil.
625 (selected-frame)))))
616 (setq part-start part-end))) 626 (setq part-start part-end)))
617 (setq self-insert-face (if (eq last-command self-insert-face-command) 627 (setq self-insert-face (if (eq last-command self-insert-face-command)
618 (cons face (if (listp self-insert-face) 628 (cons face (if (listp self-insert-face)
619 self-insert-face 629 self-insert-face
620 (list self-insert-face))) 630 (list self-insert-face)))
653 (setq active-list (cons (car face-list) active-list))) 663 (setq active-list (cons (car face-list) active-list)))
654 (setq face-list (cdr face-list))) 664 (setq face-list (cdr face-list)))
655 (nreverse active-list))) 665 (nreverse active-list)))
656 666
657 (defun facemenu-add-new-face (face) 667 (defun facemenu-add-new-face (face)
658 "Add FACE (a face) to the Face menu. 668 "Add FACE (a face) to the Face menu if `facemenu-listed-faces' says so.
659 669 This is called whenever you create a new face, and at other times."
660 This is called whenever you create a new face."
661 (let* (name 670 (let* (name
662 symbol 671 symbol
663 menu docstring 672 menu docstring
664 (key (cdr (assoc face facemenu-keybindings))) 673 (key (cdr (assoc face facemenu-keybindings)))
665 function menu-val) 674 function menu-val)