comparison lisp/faces.el @ 17386:b251c8820860

(make-face): New arg no-resources. (make-empty-face): New function.
author Richard M. Stallman <rms@gnu.org>
date Fri, 11 Apr 1997 05:59:37 +0000
parents 84aa6682810b
children 209c61e51bd0
comparison
equal deleted inserted replaced
17385:259d4c9aae0e 17386:b251c8820860
388 (if (string-match "^(" new-stipple-string) 388 (if (string-match "^(" new-stipple-string)
389 (read new-stipple-string) 389 (read new-stipple-string)
390 new-stipple-string))) 390 new-stipple-string)))
391 (list face (if (equal stipple "") nil stipple)))) 391 (list face (if (equal stipple "") nil stipple))))
392 392
393 (defun make-face (name) 393 (defun make-face (name &optional no-resources)
394 "Define a new FACE on all frames. 394 "Define a new FACE on all frames.
395 You can modify the font, color, etc of this face with the set-face- functions. 395 You can modify the font, color, etc of this face with the set-face- functions.
396 If NO-RESOURCES is non-nil, then we ignore X resources
397 and always make a face whose attributes are all nil.
398
396 If the face already exists, it is unmodified." 399 If the face already exists, it is unmodified."
397 (interactive "SMake face: ") 400 (interactive "SMake face: ")
398 (or (internal-find-face name) 401 (or (internal-find-face name)
399 (let ((face (make-vector 8 nil))) 402 (let ((face (make-vector 8 nil)))
400 (aset face 0 'face) 403 (aset face 0 'face)
408 (set-frame-face-alist (car frames) 411 (set-frame-face-alist (car frames)
409 (cons (cons name (copy-sequence face)) 412 (cons (cons name (copy-sequence face))
410 (frame-face-alist (car frames)))) 413 (frame-face-alist (car frames))))
411 (setq frames (cdr frames))) 414 (setq frames (cdr frames)))
412 (setq global-face-data (cons (cons name face) global-face-data))) 415 (setq global-face-data (cons (cons name face) global-face-data)))
413 ;; when making a face after frames already exist 416 ;; When making a face after frames already exist
414 (if (memq window-system '(x w32)) 417 (or no-resources
415 (make-face-x-resource-internal face)) 418 (if (memq window-system '(x w32))
416 ;; add to menu 419 (make-face-x-resource-internal face)))
420 ;; Add to menu of faces.
417 (if (fboundp 'facemenu-add-new-face) 421 (if (fboundp 'facemenu-add-new-face)
418 (facemenu-add-new-face name)) 422 (facemenu-add-new-face name))
419 face)) 423 face))
420 name) 424 name)
425
426 (defun make-empty-face (face)
427 "Define a new FACE on all frames, which initially reflects the defaults.
428 You can modify the font, color, etc of this face with the set-face- functions.
429 If the face already exists, it is unmodified."
430 (interactive "SMake empty face: ")
431 (make-face face t))
421 432
422 ;; Fill in a face by default based on X resources, for all existing frames. 433 ;; Fill in a face by default based on X resources, for all existing frames.
423 ;; This has to be done when a new face is made. 434 ;; This has to be done when a new face is made.
424 (defun make-face-x-resource-internal (face &optional frame set-anyway) 435 (defun make-face-x-resource-internal (face &optional frame set-anyway)
425 (cond ((null frame) 436 (cond ((null frame)