aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/cus-face.el6
-rw-r--r--lisp/faces.el47
-rw-r--r--lisp/help-fns.el1
-rw-r--r--src/dispextern.h16
-rw-r--r--src/xfaces.c40
5 files changed, 91 insertions, 19 deletions
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index d73bce42c3e..5a49a810434 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -233,7 +233,11 @@
233 (file :tag "File" 233 (file :tag "File"
234 :help-echo "Name of bitmap file." 234 :help-echo "Name of bitmap file."
235 :must-match t))) 235 :must-match t)))
236 236 (:extend
237 (choice :tag "Extend"
238 :help-echo "Control whether attributes should be extended after EOL."
239 (const :tag "Off" nil)
240 (const :tag "On" t)))
237 (:inherit 241 (:inherit
238 (repeat :tag "Inherit" 242 (repeat :tag "Inherit"
239 :help-echo "List of faces to inherit attributes from." 243 :help-echo "List of faces to inherit attributes from."
diff --git a/lisp/faces.el b/lisp/faces.el
index c789d3729e0..36fc69895dd 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -342,6 +342,7 @@ is either `foreground-color', `background-color', or a keyword."
342 (:box (".attributeBox" . "Face.AttributeBox")) 342 (:box (".attributeBox" . "Face.AttributeBox"))
343 (:underline (".attributeUnderline" . "Face.AttributeUnderline")) 343 (:underline (".attributeUnderline" . "Face.AttributeUnderline"))
344 (:inverse-video (".attributeInverse" . "Face.AttributeInverse")) 344 (:inverse-video (".attributeInverse" . "Face.AttributeInverse"))
345 (:extend (".attributeExtend" . "Face.AttributeExtend"))
345 (:stipple 346 (:stipple
346 (".attributeStipple" . "Face.AttributeStipple") 347 (".attributeStipple" . "Face.AttributeStipple")
347 (".attributeBackgroundPixmap" . "Face.AttributeBackgroundPixmap")) 348 (".attributeBackgroundPixmap" . "Face.AttributeBackgroundPixmap"))
@@ -594,6 +595,13 @@ Use `face-attribute' for finer control."
594 (let ((italic (face-attribute face :slant frame inherit))) 595 (let ((italic (face-attribute face :slant frame inherit)))
595 (memq italic '(italic oblique)))) 596 (memq italic '(italic oblique))))
596 597
598(defun face-extend-p (face &optional frame inherit)
599 "Return non-nil if FACE specifies a non-nil extend.
600If the optional argument FRAME is given, report on face FACE in that frame.
601If FRAME is t, report on the defaults for face FACE (for new frames).
602If FRAME is omitted or nil, use the selected frame.
603Optional argument INHERIT is passed to `face-attribute'."
604 (eq (face-attribute face :extend frame inherit) t))
597 605
598 606
599;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 607;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -760,6 +768,11 @@ For convenience, attributes `:family', `:foundry', `:width',
760`:height', `:weight', and `:slant' may also be set in one step 768`:height', `:weight', and `:slant' may also be set in one step
761from an X font name: 769from an X font name:
762 770
771`:extend'
772
773VALUE specifies whether the FACE should be extended after EOL.
774VALUE must be one of t or nil.
775
763`:font' 776`:font'
764 777
765Set font-related face attributes from VALUE. 778Set font-related face attributes from VALUE.
@@ -979,6 +992,18 @@ Use `set-face-attribute' or `modify-face' for finer control."
979 992
980(define-obsolete-function-alias 'set-face-italic-p 'set-face-italic "24.4") 993(define-obsolete-function-alias 'set-face-italic-p 'set-face-italic "24.4")
981 994
995(defun set-face-extend (face extend-p &optional frame)
996 "Specify whether face FACE should be extended.
997EXTEND-P nil means FACE explicitly doesn't extend after EOL.
998EXTEND-P t means FACE extends after EOL.
999
1000FRAME nil or not specified means change face on all frames.
1001Use `set-face-attribute' to \"unspecify\" underlining."
1002 (interactive
1003 (let ((list (read-face-and-attribute :extend)))
1004 (list (car list) (if (cadr list) t))))
1005 (set-face-attribute face frame :extend extend-p))
1006
982 1007
983(defalias 'set-face-background-pixmap 'set-face-stipple) 1008(defalias 'set-face-background-pixmap 'set-face-stipple)
984 1009
@@ -1102,7 +1127,7 @@ an integer value."
1102 (:slant 1127 (:slant
1103 (mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1))) 1128 (mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
1104 font-slant-table)) 1129 font-slant-table))
1105 (:inverse-video 1130 ((or :inverse-video :extend)
1106 (mapcar #'(lambda (x) (cons (symbol-name x) x)) 1131 (mapcar #'(lambda (x) (cons (symbol-name x) x))
1107 (internal-lisp-face-attribute-values attribute))) 1132 (internal-lisp-face-attribute-values attribute)))
1108 ((or :underline :overline :strike-through :box) 1133 ((or :underline :overline :strike-through :box)
@@ -1147,6 +1172,7 @@ an integer value."
1147 (:slant . "slant") 1172 (:slant . "slant")
1148 (:underline . "underline") 1173 (:underline . "underline")
1149 (:overline . "overline") 1174 (:overline . "overline")
1175 (:extend . "extend")
1150 (:strike-through . "strike-through") 1176 (:strike-through . "strike-through")
1151 (:box . "box") 1177 (:box . "box")
1152 (:inverse-video . "inverse-video display") 1178 (:inverse-video . "inverse-video display")
@@ -1549,7 +1575,8 @@ is given, in which case return its value instead."
1549 ;; (see also realize_default_face in xfaces.c). 1575 ;; (see also realize_default_face in xfaces.c).
1550 (append 1576 (append
1551 '(:underline nil :overline nil :strike-through nil 1577 '(:underline nil :overline nil :strike-through nil
1552 :box nil :inverse-video nil :stipple nil :inherit nil) 1578 :box nil :inverse-video nil :stipple nil :inherit nil
1579 :extend nil)
1553 ;; `display-graphic-p' is unavailable when running 1580 ;; `display-graphic-p' is unavailable when running
1554 ;; temacs, prior to loading frame.el. 1581 ;; temacs, prior to loading frame.el.
1555 (when (fboundp 'display-graphic-p) 1582 (when (fboundp 'display-graphic-p)
@@ -2314,24 +2341,24 @@ If you set `term-file-prefix' to nil, this function does nothing."
2314;; if background is light. 2341;; if background is light.
2315(defface region 2342(defface region
2316 '((((class color) (min-colors 88) (background dark)) 2343 '((((class color) (min-colors 88) (background dark))
2317 :background "blue3") 2344 :background "blue3" :extend t)
2318 (((class color) (min-colors 88) (background light) (type gtk)) 2345 (((class color) (min-colors 88) (background light) (type gtk))
2319 :distant-foreground "gtk_selection_fg_color" 2346 :distant-foreground "gtk_selection_fg_color"
2320 :background "gtk_selection_bg_color") 2347 :background "gtk_selection_bg_color" :extend t)
2321 (((class color) (min-colors 88) (background light) (type ns)) 2348 (((class color) (min-colors 88) (background light) (type ns))
2322 :distant-foreground "ns_selection_fg_color" 2349 :distant-foreground "ns_selection_fg_color"
2323 :background "ns_selection_bg_color") 2350 :background "ns_selection_bg_color" :extend t)
2324 (((class color) (min-colors 88) (background light)) 2351 (((class color) (min-colors 88) (background light))
2325 :background "lightgoldenrod2") 2352 :background "lightgoldenrod2" :extend t)
2326 (((class color) (min-colors 16) (background dark)) 2353 (((class color) (min-colors 16) (background dark))
2327 :background "blue3") 2354 :background "blue3" :extend t)
2328 (((class color) (min-colors 16) (background light)) 2355 (((class color) (min-colors 16) (background light))
2329 :background "lightgoldenrod2") 2356 :background "lightgoldenrod2" :extend t)
2330 (((class color) (min-colors 8)) 2357 (((class color) (min-colors 8))
2331 :background "blue" :foreground "white") 2358 :background "blue" :foreground "white" :extend t)
2332 (((type tty) (class mono)) 2359 (((type tty) (class mono))
2333 :inverse-video t) 2360 :inverse-video t)
2334 (t :background "gray")) 2361 (t :background "gray" :extend t))
2335 "Basic face for highlighting the region." 2362 "Basic face for highlighting the region."
2336 :version "21.1" 2363 :version "21.1"
2337 :group 'basic-faces) 2364 :group 'basic-faces)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 5e55240daba..235aa9a6e19 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1385,6 +1385,7 @@ If FRAME is omitted or nil, use the selected frame."
1385 (:stipple . "Stipple") 1385 (:stipple . "Stipple")
1386 (:font . "Font") 1386 (:font . "Font")
1387 (:fontset . "Fontset") 1387 (:fontset . "Fontset")
1388 (:extend . "Extend")
1388 (:inherit . "Inherit"))) 1389 (:inherit . "Inherit")))
1389 (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x))) 1390 (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
1390 attrs)))) 1391 attrs))))
diff --git a/src/dispextern.h b/src/dispextern.h
index 57400ae047a..519cc36345c 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1677,11 +1677,9 @@ struct face
1677 /* Pixel value or color index of background color. */ 1677 /* Pixel value or color index of background color. */
1678 unsigned long background; 1678 unsigned long background;
1679 1679
1680 /* Pixel value or color index of underline color. */ 1680 /* Pixel value or color index of underline, overlined,
1681 strike-through, or box color. */
1681 unsigned long underline_color; 1682 unsigned long underline_color;
1682
1683 /* Pixel value or color index of overlined, strike-through, or box
1684 color. */
1685 unsigned long overline_color; 1683 unsigned long overline_color;
1686 unsigned long strike_through_color; 1684 unsigned long strike_through_color;
1687 unsigned long box_color; 1685 unsigned long box_color;
@@ -1864,6 +1862,9 @@ struct face_cache
1864 ? FRAME_FACE_CACHE (F)->faces_by_id[ID] \ 1862 ? FRAME_FACE_CACHE (F)->faces_by_id[ID] \
1865 : NULL) 1863 : NULL)
1866 1864
1865#define FACE_EXTENSIBLE_P(F) \
1866 (!NILP (F->lface[LFACE_EXTEND_INDEX]))
1867
1867/* True if FACE is suitable for displaying ASCII characters. */ 1868/* True if FACE is suitable for displaying ASCII characters. */
1868INLINE bool 1869INLINE bool
1869FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face) 1870FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face)
@@ -2373,7 +2374,7 @@ struct it
2373 /* Face id of the iterator saved in case a glyph from dpvec contains 2374 /* Face id of the iterator saved in case a glyph from dpvec contains
2374 a face. The face is restored when all glyphs from dpvec have 2375 a face. The face is restored when all glyphs from dpvec have
2375 been delivered. */ 2376 been delivered. */
2376 int saved_face_id; 2377 int saved_face_id, saved_extend_face_id;
2377 2378
2378 /* Vector of glyphs for control character translation. The pointer 2379 /* Vector of glyphs for control character translation. The pointer
2379 dpvec is set to ctl_chars when a control character is translated. 2380 dpvec is set to ctl_chars when a control character is translated.
@@ -2435,7 +2436,7 @@ struct it
2435 ptrdiff_t prev_stop; 2436 ptrdiff_t prev_stop;
2436 ptrdiff_t base_level_stop; 2437 ptrdiff_t base_level_stop;
2437 struct composition_it cmp_it; 2438 struct composition_it cmp_it;
2438 int face_id; 2439 int face_id, extend_face_id;
2439 2440
2440 /* Save values specific to a given method. */ 2441 /* Save values specific to a given method. */
2441 union { 2442 union {
@@ -2493,6 +2494,9 @@ struct it
2493 /* Face to use. */ 2494 /* Face to use. */
2494 int face_id; 2495 int face_id;
2495 2496
2497 /* Face to extend at EOL/ */
2498 int extend_face_id;
2499
2496 /* Setting of buffer-local variable selective-display-ellipses. */ 2500 /* Setting of buffer-local variable selective-display-ellipses. */
2497 bool_bf selective_display_ellipsis_p : 1; 2501 bool_bf selective_display_ellipsis_p : 1;
2498 2502
diff --git a/src/xfaces.c b/src/xfaces.c
index c7d6990f505..889bf83561c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1590,6 +1590,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1590#define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) 1590#define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX)
1591#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) 1591#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX)
1592#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) 1592#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX)
1593#define LFACE_EXTEND(LFACE) AREF ((LFACE), LFACE_EXTEND_INDEX)
1593#define LFACE_DISTANT_FOREGROUND(LFACE) \ 1594#define LFACE_DISTANT_FOREGROUND(LFACE) \
1594 AREF ((LFACE), LFACE_DISTANT_FOREGROUND_INDEX) 1595 AREF ((LFACE), LFACE_DISTANT_FOREGROUND_INDEX)
1595 1596
@@ -1633,6 +1634,10 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
1633 || SYMBOLP (attrs[LFACE_UNDERLINE_INDEX]) 1634 || SYMBOLP (attrs[LFACE_UNDERLINE_INDEX])
1634 || STRINGP (attrs[LFACE_UNDERLINE_INDEX]) 1635 || STRINGP (attrs[LFACE_UNDERLINE_INDEX])
1635 || CONSP (attrs[LFACE_UNDERLINE_INDEX])); 1636 || CONSP (attrs[LFACE_UNDERLINE_INDEX]));
1637 eassert (UNSPECIFIEDP (attrs[LFACE_EXTEND_INDEX])
1638 || IGNORE_DEFFACE_P (attrs[LFACE_EXTEND_INDEX])
1639 || SYMBOLP (attrs[LFACE_EXTEND_INDEX])
1640 || STRINGP (attrs[LFACE_EXTEND_INDEX]));
1636 eassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) 1641 eassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
1637 || IGNORE_DEFFACE_P (attrs[LFACE_OVERLINE_INDEX]) 1642 || IGNORE_DEFFACE_P (attrs[LFACE_OVERLINE_INDEX])
1638 || SYMBOLP (attrs[LFACE_OVERLINE_INDEX]) 1643 || SYMBOLP (attrs[LFACE_OVERLINE_INDEX])
@@ -2512,6 +2517,13 @@ merge_face_ref (struct window *w,
2512 err_msgs, named_merge_points)) 2517 err_msgs, named_merge_points))
2513 err = true; 2518 err = true;
2514 } 2519 }
2520 else if (EQ (keyword, QCextend))
2521 {
2522 if (EQ (value, Qt) || NILP (value))
2523 to[LFACE_EXTEND_INDEX] = value;
2524 else
2525 err = true;
2526 }
2515 else 2527 else
2516 err = true; 2528 err = true;
2517 2529
@@ -3030,6 +3042,17 @@ FRAME 0 means change the face on all frames, and change the default
3030 old_value = LFACE_INVERSE (lface); 3042 old_value = LFACE_INVERSE (lface);
3031 ASET (lface, LFACE_INVERSE_INDEX, value); 3043 ASET (lface, LFACE_INVERSE_INDEX, value);
3032 } 3044 }
3045 else if (EQ (attr, QCextend))
3046 {
3047 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
3048 {
3049 CHECK_SYMBOL (value);
3050 if (!EQ (value, Qt) && !NILP (value))
3051 signal_error ("Invalid extend face attribute value", value);
3052 }
3053 old_value = LFACE_EXTEND (lface);
3054 ASET (lface, LFACE_EXTEND_INDEX, value);
3055 }
3033 else if (EQ (attr, QCforeground)) 3056 else if (EQ (attr, QCforeground))
3034 { 3057 {
3035 /* Compatibility with 20.x. */ 3058 /* Compatibility with 20.x. */
@@ -3503,7 +3526,9 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
3503 value = face_boolean_x_resource_value (value, true); 3526 value = face_boolean_x_resource_value (value, true);
3504 else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth)) 3527 else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth))
3505 value = intern (SSDATA (value)); 3528 value = intern (SSDATA (value));
3506 else if (EQ (attr, QCreverse_video) || EQ (attr, QCinverse_video)) 3529 else if (EQ (attr, QCreverse_video)
3530 || EQ (attr, QCinverse_video)
3531 || EQ (attr, QCextend))
3507 value = face_boolean_x_resource_value (value, true); 3532 value = face_boolean_x_resource_value (value, true);
3508 else if (EQ (attr, QCunderline) 3533 else if (EQ (attr, QCunderline)
3509 || EQ (attr, QCoverline) 3534 || EQ (attr, QCoverline)
@@ -3727,6 +3752,8 @@ frames). If FRAME is omitted or nil, use the selected frame. */)
3727 value = LFACE_SWIDTH (lface); 3752 value = LFACE_SWIDTH (lface);
3728 else if (EQ (keyword, QCinherit)) 3753 else if (EQ (keyword, QCinherit))
3729 value = LFACE_INHERIT (lface); 3754 value = LFACE_INHERIT (lface);
3755 else if (EQ (keyword, QCextend))
3756 value = LFACE_EXTEND (lface);
3730 else if (EQ (keyword, QCfont)) 3757 else if (EQ (keyword, QCfont))
3731 value = LFACE_FONT (lface); 3758 value = LFACE_FONT (lface);
3732 else if (EQ (keyword, QCfontset)) 3759 else if (EQ (keyword, QCfontset))
@@ -3754,7 +3781,9 @@ Value is nil if ATTR doesn't have a discrete set of valid values. */)
3754 3781
3755 if (EQ (attr, QCunderline) || EQ (attr, QCoverline) 3782 if (EQ (attr, QCunderline) || EQ (attr, QCoverline)
3756 || EQ (attr, QCstrike_through) 3783 || EQ (attr, QCstrike_through)
3757 || EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video)) 3784 || EQ (attr, QCinverse_video)
3785 || EQ (attr, QCreverse_video)
3786 || EQ (attr, QCextend))
3758 result = list2 (Qt, Qnil); 3787 result = list2 (Qt, Qnil);
3759 3788
3760 return result; 3789 return result;
@@ -4784,6 +4813,9 @@ gui_supports_face_attributes_p (struct frame *f,
4784 || (!UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX]) 4813 || (!UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
4785 && face_attr_equal_p (attrs[LFACE_INVERSE_INDEX], 4814 && face_attr_equal_p (attrs[LFACE_INVERSE_INDEX],
4786 def_attrs[LFACE_INVERSE_INDEX])) 4815 def_attrs[LFACE_INVERSE_INDEX]))
4816 || (!UNSPECIFIEDP (attrs[LFACE_EXTEND_INDEX])
4817 && face_attr_equal_p (attrs[LFACE_EXTEND_INDEX],
4818 def_attrs[LFACE_EXTEND_INDEX]))
4787 || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) 4819 || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
4788 && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX], 4820 && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX],
4789 def_attrs[LFACE_FOREGROUND_INDEX])) 4821 def_attrs[LFACE_FOREGROUND_INDEX]))
@@ -5362,6 +5394,9 @@ realize_default_face (struct frame *f)
5362 ASET (lface, LFACE_FONTSET_INDEX, Qnil); 5394 ASET (lface, LFACE_FONTSET_INDEX, Qnil);
5363 } 5395 }
5364 5396
5397 if (UNSPECIFIEDP (LFACE_EXTEND (lface)))
5398 ASET (lface, LFACE_EXTEND_INDEX, Qnil);
5399
5365 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface))) 5400 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface)))
5366 ASET (lface, LFACE_UNDERLINE_INDEX, Qnil); 5401 ASET (lface, LFACE_UNDERLINE_INDEX, Qnil);
5367 5402
@@ -6539,6 +6574,7 @@ syms_of_xfaces (void)
6539 DEFSYM (QCstrike_through, ":strike-through"); 6574 DEFSYM (QCstrike_through, ":strike-through");
6540 DEFSYM (QCbox, ":box"); 6575 DEFSYM (QCbox, ":box");
6541 DEFSYM (QCinherit, ":inherit"); 6576 DEFSYM (QCinherit, ":inherit");
6577 DEFSYM (QCextend, ":extend");
6542 6578
6543 /* Symbols used for Lisp face attribute values. */ 6579 /* Symbols used for Lisp face attribute values. */
6544 DEFSYM (QCcolor, ":color"); 6580 DEFSYM (QCcolor, ":color");