changeset 10730:c42fdf00dfa0

(facemenu-next): Variable deleted. (facemenu-self-insert-face): New function. (facemenu-set-face): Use facemenu-self-insert-face. (facemenu-set-face-from-menu): Likewise. (facemenu-after-change): Function deleted. Don't use it as hook.
author Richard M. Stallman <rms@gnu.org>
date Mon, 13 Feb 1995 16:56:19 +0000
parents fb4f688fc2cf
children 65e10f44e765
files lisp/facemenu.el
diffstat 1 files changed, 6 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/facemenu.el	Mon Feb 13 16:54:58 1995 +0000
+++ b/lisp/facemenu.el	Mon Feb 13 16:56:19 1995 +0000
@@ -216,7 +216,6 @@
   "Alist of colors, used for completion.
 If null, `facemenu-read-color' will set it.")
 
-(defvar facemenu-next nil) ; set when we are going to set a face on next char.
 (defvar facemenu-loc nil)
 
 (defun facemenu-update ()
@@ -252,8 +251,7 @@
       (let ((start (or start (region-beginning)))
 	    (end (or end (region-end))))
 	(facemenu-add-face face start end))
-    (setq facemenu-next face
-	  facemenu-loc (point))))
+    (facemenu-self-insert-face face)))
 
 ;;;###autoload
 (defun facemenu-set-foreground (color &optional start end)
@@ -301,7 +299,11 @@
   (facemenu-get-face face)
   (if start 
       (facemenu-add-face face start end)
-    (setq facemenu-next face facemenu-loc (point))))
+    (facemenu-self-insert-face face)))
+
+(defun facemenu-self-insert-face (face)
+  (setq self-insert-face face
+	self-insert-face-command this-command))
 
 (defun facemenu-set-invisible (start end)
   "Make the region invisible.
@@ -489,18 +491,6 @@
 	     (define-key menu key (cons name function))))))
   nil) ; Return nil for facemenu-iterate
 
-(defun facemenu-after-change (begin end old-length)
-  "May set the face of just-inserted text to user's request.
-This only happens if the change is an insertion, and
-`facemenu-set-face[-from-menu]' was called with point at the
-beginning of the insertion."
-  (if (null facemenu-next)		; exit immediately if no work
-      nil
-    (if (and (= 0 old-length)		; insertion
-	     (= facemenu-loc begin))	; point wasn't moved in between
-	(facemenu-add-face facemenu-next begin end))
-    (setq facemenu-next nil)))
-
 (defun facemenu-complete-face-list (&optional oldlist)
   "Return list of all faces that are look different.
 Starts with given ALIST of faces, and adds elements only if they display 
@@ -524,6 +514,5 @@
   (car iterate-list))
 
 (facemenu-update)
-(add-hook 'after-change-functions 'facemenu-after-change)
 
 ;;; facemenu.el ends here