Function: facemenu-set-face-from-menu

facemenu-set-face-from-menu is an interactive and byte-compiled function defined in facemenu.el.gz.

Signature

(facemenu-set-face-from-menu FACE START END)

Documentation

Set the FACE of the region or next character typed.

This function is designed to be called from a menu; FACE is determined using the event type of the menu entry. If FACE is a symbol whose name starts with "fg:" or "bg:", then this functions sets the foreground or background to the color specified by the rest of the symbol's name. Any other symbol is considered the name of a face.

If the region is active (normally true except in Transient Mark mode) and there is no prefix argument, this command sets the region to the requested face.

Otherwise, this command specifies the face for the next character inserted. Moving point or switching buffers before typing a character to insert cancels the specification.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/facemenu.el.gz
(defun facemenu-set-face-from-menu (face start end)
  "Set the FACE of the region or next character typed.
This function is designed to be called from a menu; FACE is determined
using the event type of the menu entry.  If FACE is a symbol whose
name starts with \"fg:\" or \"bg:\", then this functions sets the
foreground or background to the color specified by the rest of the
symbol's name.  Any other symbol is considered the name of a face.

If the region is active (normally true except in Transient Mark mode)
and there is no prefix argument, this command sets the region to the
requested face.

Otherwise, this command specifies the face for the next character
inserted.  Moving point or switching buffers before typing a character
to insert cancels the specification."
  (interactive (list last-command-event
		     (if (and mark-active (not current-prefix-arg))
			 (region-beginning))
		     (if (and mark-active (not current-prefix-arg))
			 (region-end))))
  (barf-if-buffer-read-only)
  (facemenu-add-face
   (let ((fn (symbol-name face)))
     (if (string-match "\\`\\([fb]\\)g:\\(.+\\)" fn)
	 (list (list (if (string= (match-string 1 fn) "f")
			 :foreground
		       :background)
		     (match-string 2 fn)))
       face))
   start end))