Mercurial > emacs
comparison lisp/facemenu.el @ 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 | 3d30caa4b459 |
children | 2834ab2db11a |
comparison
equal
deleted
inserted
replaced
10729:fb4f688fc2cf | 10730:c42fdf00dfa0 |
---|---|
214 (defvar facemenu-color-alist nil | 214 (defvar facemenu-color-alist nil |
215 ;; Don't initialize here; that doesn't work if preloaded. | 215 ;; Don't initialize here; that doesn't work if preloaded. |
216 "Alist of colors, used for completion. | 216 "Alist of colors, used for completion. |
217 If null, `facemenu-read-color' will set it.") | 217 If null, `facemenu-read-color' will set it.") |
218 | 218 |
219 (defvar facemenu-next nil) ; set when we are going to set a face on next char. | |
220 (defvar facemenu-loc nil) | 219 (defvar facemenu-loc nil) |
221 | 220 |
222 (defun facemenu-update () | 221 (defun facemenu-update () |
223 "Add or update the \"Face\" menu in the menu bar. | 222 "Add or update the \"Face\" menu in the menu bar. |
224 You can call this to update things if you change any of the menu configuration | 223 You can call this to update things if you change any of the menu configuration |
250 (facemenu-add-new-face face) | 249 (facemenu-add-new-face face) |
251 (if mark-active | 250 (if mark-active |
252 (let ((start (or start (region-beginning))) | 251 (let ((start (or start (region-beginning))) |
253 (end (or end (region-end)))) | 252 (end (or end (region-end)))) |
254 (facemenu-add-face face start end)) | 253 (facemenu-add-face face start end)) |
255 (setq facemenu-next face | 254 (facemenu-self-insert-face face))) |
256 facemenu-loc (point)))) | |
257 | 255 |
258 ;;;###autoload | 256 ;;;###autoload |
259 (defun facemenu-set-foreground (color &optional start end) | 257 (defun facemenu-set-foreground (color &optional start end) |
260 "Set the foreground color of the region or next character typed. | 258 "Set the foreground color of the region or next character typed. |
261 The color is prompted for. A face named `fg:color' is used \(or created). | 259 The color is prompted for. A face named `fg:color' is used \(or created). |
299 (if mark-active (region-end)))) | 297 (if mark-active (region-end)))) |
300 (barf-if-buffer-read-only) | 298 (barf-if-buffer-read-only) |
301 (facemenu-get-face face) | 299 (facemenu-get-face face) |
302 (if start | 300 (if start |
303 (facemenu-add-face face start end) | 301 (facemenu-add-face face start end) |
304 (setq facemenu-next face facemenu-loc (point)))) | 302 (facemenu-self-insert-face face))) |
303 | |
304 (defun facemenu-self-insert-face (face) | |
305 (setq self-insert-face face | |
306 self-insert-face-command this-command)) | |
305 | 307 |
306 (defun facemenu-set-invisible (start end) | 308 (defun facemenu-set-invisible (start end) |
307 "Make the region invisible. | 309 "Make the region invisible. |
308 This sets the `invisible' text property; it can be undone with | 310 This sets the `invisible' text property; it can be undone with |
309 `facemenu-remove-all'." | 311 `facemenu-remove-all'." |
487 (define-key-after menu-val key (cons name function) | 489 (define-key-after menu-val key (cons name function) |
488 (car (nth (- (length menu-val) 3) menu-val))) | 490 (car (nth (- (length menu-val) 3) menu-val))) |
489 (define-key menu key (cons name function)))))) | 491 (define-key menu key (cons name function)))))) |
490 nil) ; Return nil for facemenu-iterate | 492 nil) ; Return nil for facemenu-iterate |
491 | 493 |
492 (defun facemenu-after-change (begin end old-length) | |
493 "May set the face of just-inserted text to user's request. | |
494 This only happens if the change is an insertion, and | |
495 `facemenu-set-face[-from-menu]' was called with point at the | |
496 beginning of the insertion." | |
497 (if (null facemenu-next) ; exit immediately if no work | |
498 nil | |
499 (if (and (= 0 old-length) ; insertion | |
500 (= facemenu-loc begin)) ; point wasn't moved in between | |
501 (facemenu-add-face facemenu-next begin end)) | |
502 (setq facemenu-next nil))) | |
503 | |
504 (defun facemenu-complete-face-list (&optional oldlist) | 494 (defun facemenu-complete-face-list (&optional oldlist) |
505 "Return list of all faces that are look different. | 495 "Return list of all faces that are look different. |
506 Starts with given ALIST of faces, and adds elements only if they display | 496 Starts with given ALIST of faces, and adds elements only if they display |
507 differently from any face already on the list. | 497 differently from any face already on the list. |
508 The faces on ALIST will end up at the end of the returned list, in reverse | 498 The faces on ALIST will end up at the end of the returned list, in reverse |
522 (while (and iterate-list (not (funcall func (car iterate-list)))) | 512 (while (and iterate-list (not (funcall func (car iterate-list)))) |
523 (setq iterate-list (cdr iterate-list))) | 513 (setq iterate-list (cdr iterate-list))) |
524 (car iterate-list)) | 514 (car iterate-list)) |
525 | 515 |
526 (facemenu-update) | 516 (facemenu-update) |
527 (add-hook 'after-change-functions 'facemenu-after-change) | |
528 | 517 |
529 ;;; facemenu.el ends here | 518 ;;; facemenu.el ends here |