[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/extend_face_id 1958094 2/8: Added face parameter :
From: |
Jimmy Aguilar Mena |
Subject: |
[Emacs-diffs] scratch/extend_face_id 1958094 2/8: Added face parameter :extend. |
Date: |
Sat, 14 Sep 2019 18:01:40 -0400 (EDT) |
branch: scratch/extend_face_id
commit 195809490ab3742db7bec9be63a9a18dc22d05c3
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>
Added face parameter :extend.
This is an initial change to add a parameter :extend that will be used
in the display engine later.
---
lisp/cus-face.el | 6 +++++-
lisp/faces.el | 48 ++++++++++++++++++++++++++++++++++++++----------
src/dispextern.h | 16 ++++++++++------
src/xfaces.c | 40 ++++++++++++++++++++++++++++++++++++++--
4 files changed, 91 insertions(+), 19 deletions(-)
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index d73bce4..5a49a81 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -233,7 +233,11 @@
(file :tag "File"
:help-echo "Name of bitmap file."
:must-match t)))
-
+ (:extend
+ (choice :tag "Extend"
+ :help-echo "Control whether attributes should be extended after
EOL."
+ (const :tag "Off" nil)
+ (const :tag "On" t)))
(:inherit
(repeat :tag "Inherit"
:help-echo "List of faces to inherit attributes from."
diff --git a/lisp/faces.el b/lisp/faces.el
index 5193c21..814a4b2 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -342,6 +342,7 @@ is either `foreground-color', `background-color', or a
keyword."
(:box (".attributeBox" . "Face.AttributeBox"))
(:underline (".attributeUnderline" . "Face.AttributeUnderline"))
(:inverse-video (".attributeInverse" . "Face.AttributeInverse"))
+ (:extend (".attributeExtend" . "Face.AttributeExtend"))
(:stipple
(".attributeStipple" . "Face.AttributeStipple")
(".attributeBackgroundPixmap" . "Face.AttributeBackgroundPixmap"))
@@ -594,6 +595,13 @@ Use `face-attribute' for finer control."
(let ((italic (face-attribute face :slant frame inherit)))
(memq italic '(italic oblique))))
+(defun face-extend-p (face &optional frame inherit)
+ "Return non-nil if FACE specifies a non-nil extend.
+If the optional argument FRAME is given, report on face FACE in that frame.
+If FRAME is t, report on the defaults for face FACE (for new frames).
+If FRAME is omitted or nil, use the selected frame.
+Optional argument INHERIT is passed to `face-attribute'."
+ (eq (face-attribute face :extend frame inherit) t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -760,6 +768,11 @@ For convenience, attributes `:family', `:foundry',
`:width',
`:height', `:weight', and `:slant' may also be set in one step
from an X font name:
+`:extend'
+
+VALUE specifies whether the FACE should be extended after EOL.
+VALUE must be one of t or nil.
+
`:font'
Set font-related face attributes from VALUE.
@@ -979,6 +992,18 @@ Use `set-face-attribute' or `modify-face' for finer
control."
(define-obsolete-function-alias 'set-face-italic-p 'set-face-italic "24.4")
+(defun set-face-extend (face extend-p &optional frame)
+ "Specify whether face FACE should be extended.
+EXTEND-P nil means FACE explicitly doesn't extend after EOL.
+EXTEND-P t means FACE extends after EOL.
+
+FRAME nil or not specified means change face on all frames.
+Use `set-face-attribute' to \"unspecify\" underlining."
+ (interactive
+ (let ((list (read-face-and-attribute :extend)))
+ (list (car list) (if (cadr list) t))))
+ (set-face-attribute face frame :extend extend-p))
+
(defalias 'set-face-background-pixmap 'set-face-stipple)
@@ -1102,7 +1127,7 @@ an integer value."
(:slant
(mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
font-slant-table))
- (:inverse-video
+ ((or :inverse-video :extend)
(mapcar #'(lambda (x) (cons (symbol-name x) x))
(internal-lisp-face-attribute-values attribute)))
((or :underline :overline :strike-through :box)
@@ -1147,6 +1172,7 @@ an integer value."
(:slant . "slant")
(:underline . "underline")
(:overline . "overline")
+ (:extend . "extend")
(:strike-through . "strike-through")
(:box . "box")
(:inverse-video . "inverse-video display")
@@ -1448,6 +1474,7 @@ If FRAME is omitted or nil, use the selected frame."
(:stipple . "Stipple")
(:font . "Font")
(:fontset . "Fontset")
+ (:extend . "Extend")
(:inherit . "Inherit")))
(max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
attrs))))
@@ -1667,7 +1694,8 @@ is given, in which case return its value instead."
;; (see also realize_default_face in xfaces.c).
(append
'(:underline nil :overline nil :strike-through nil
- :box nil :inverse-video nil :stipple nil :inherit nil)
+ :box nil :inverse-video nil :stipple nil :inherit nil
+ :extend nil)
;; `display-graphic-p' is unavailable when running
;; temacs, prior to loading frame.el.
(when (fboundp 'display-graphic-p)
@@ -2432,24 +2460,24 @@ If you set `term-file-prefix' to nil, this function
does nothing."
;; if background is light.
(defface region
'((((class color) (min-colors 88) (background dark))
- :background "blue3")
+ :background "blue3" :extend t)
(((class color) (min-colors 88) (background light) (type gtk))
:distant-foreground "gtk_selection_fg_color"
- :background "gtk_selection_bg_color")
+ :background "gtk_selection_bg_color" :extend t)
(((class color) (min-colors 88) (background light) (type ns))
:distant-foreground "ns_selection_fg_color"
- :background "ns_selection_bg_color")
+ :background "ns_selection_bg_color" :extend t)
(((class color) (min-colors 88) (background light))
- :background "lightgoldenrod2")
+ :background "lightgoldenrod2" :extend t)
(((class color) (min-colors 16) (background dark))
- :background "blue3")
+ :background "blue3" :extend t)
(((class color) (min-colors 16) (background light))
- :background "lightgoldenrod2")
+ :background "lightgoldenrod2" :extend t)
(((class color) (min-colors 8))
- :background "blue" :foreground "white")
+ :background "blue" :foreground "white" :extend t)
(((type tty) (class mono))
:inverse-video t)
- (t :background "gray"))
+ (t :background "gray" :extend t))
"Basic face for highlighting the region."
:version "21.1"
:group 'basic-faces)
diff --git a/src/dispextern.h b/src/dispextern.h
index a182dbf..c11a3a7 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1634,11 +1634,9 @@ struct face
/* Pixel value or color index of background color. */
unsigned long background;
- /* Pixel value or color index of underline color. */
+ /* Pixel value or color index of underline, overlined,
+ strike-through, or box color. */
unsigned long underline_color;
-
- /* Pixel value or color index of overlined, strike-through, or box
- color. */
unsigned long overline_color;
unsigned long strike_through_color;
unsigned long box_color;
@@ -1819,6 +1817,9 @@ struct face_cache
? FRAME_FACE_CACHE (F)->faces_by_id[ID] \
: NULL)
+#define FACE_EXTENSIBLE_P(F) \
+ (!NILP (F->lface[LFACE_EXTEND_INDEX]))
+
/* True if FACE is suitable for displaying ASCII characters. */
INLINE bool
FACE_SUITABLE_FOR_ASCII_CHAR_P (struct face *face)
@@ -2325,7 +2326,7 @@ struct it
/* Face id of the iterator saved in case a glyph from dpvec contains
a face. The face is restored when all glyphs from dpvec have
been delivered. */
- int saved_face_id;
+ int saved_face_id, saved_extend_face_id;
/* Vector of glyphs for control character translation. The pointer
dpvec is set to ctl_chars when a control character is translated.
@@ -2387,7 +2388,7 @@ struct it
ptrdiff_t prev_stop;
ptrdiff_t base_level_stop;
struct composition_it cmp_it;
- int face_id;
+ int face_id, extend_face_id;
/* Save values specific to a given method. */
union {
@@ -2445,6 +2446,9 @@ struct it
/* Face to use. */
int face_id;
+ /* Face to extend at EOL/ */
+ int extend_face_id;
+
/* Setting of buffer-local variable selective-display-ellipses. */
bool_bf selective_display_ellipsis_p : 1;
diff --git a/src/xfaces.c b/src/xfaces.c
index 2cc626f..9c58e3e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1590,6 +1590,7 @@ the WIDTH times as wide as FACE on FRAME. */)
#define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX)
#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX)
#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX)
+#define LFACE_EXTEND(LFACE) AREF ((LFACE), LFACE_EXTEND_INDEX)
#define LFACE_DISTANT_FOREGROUND(LFACE) \
AREF ((LFACE), LFACE_DISTANT_FOREGROUND_INDEX)
@@ -1633,6 +1634,10 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
|| SYMBOLP (attrs[LFACE_UNDERLINE_INDEX])
|| STRINGP (attrs[LFACE_UNDERLINE_INDEX])
|| CONSP (attrs[LFACE_UNDERLINE_INDEX]));
+ eassert (UNSPECIFIEDP (attrs[LFACE_EXTEND_INDEX])
+ || IGNORE_DEFFACE_P (attrs[LFACE_EXTEND_INDEX])
+ || SYMBOLP (attrs[LFACE_EXTEND_INDEX])
+ || STRINGP (attrs[LFACE_EXTEND_INDEX]));
eassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_OVERLINE_INDEX])
|| SYMBOLP (attrs[LFACE_OVERLINE_INDEX])
@@ -2512,6 +2517,13 @@ merge_face_ref (struct window *w,
err_msgs, named_merge_points))
err = true;
}
+ else if (EQ (keyword, QCextend))
+ {
+ if (EQ (value, Qt) || NILP (value))
+ to[LFACE_EXTEND_INDEX] = value;
+ else
+ err = true;
+ }
else
err = true;
@@ -3030,6 +3042,17 @@ FRAME 0 means change the face on all frames, and change
the default
old_value = LFACE_INVERSE (lface);
ASET (lface, LFACE_INVERSE_INDEX, value);
}
+ else if (EQ (attr, QCextend))
+ {
+ if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
+ {
+ CHECK_SYMBOL (value);
+ if (!EQ (value, Qt) && !NILP (value))
+ signal_error ("Invalid extend face attribute value", value);
+ }
+ old_value = LFACE_EXTEND (lface);
+ ASET (lface, LFACE_EXTEND_INDEX, value);
+ }
else if (EQ (attr, QCforeground))
{
/* Compatibility with 20.x. */
@@ -3503,7 +3526,9 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
value = face_boolean_x_resource_value (value, true);
else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth))
value = intern (SSDATA (value));
- else if (EQ (attr, QCreverse_video) || EQ (attr, QCinverse_video))
+ else if (EQ (attr, QCreverse_video)
+ || EQ (attr, QCinverse_video)
+ || EQ (attr, QCextend))
value = face_boolean_x_resource_value (value, true);
else if (EQ (attr, QCunderline)
|| EQ (attr, QCoverline)
@@ -3727,6 +3752,8 @@ frames). If FRAME is omitted or nil, use the selected
frame. */)
value = LFACE_SWIDTH (lface);
else if (EQ (keyword, QCinherit))
value = LFACE_INHERIT (lface);
+ else if (EQ (keyword, QCextend))
+ value = LFACE_EXTEND (lface);
else if (EQ (keyword, QCfont))
value = LFACE_FONT (lface);
else if (EQ (keyword, QCfontset))
@@ -3754,7 +3781,9 @@ Value is nil if ATTR doesn't have a discrete set of valid
values. */)
if (EQ (attr, QCunderline) || EQ (attr, QCoverline)
|| EQ (attr, QCstrike_through)
- || EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video))
+ || EQ (attr, QCinverse_video)
+ || EQ (attr, QCreverse_video)
+ || EQ (attr, QCextend))
result = list2 (Qt, Qnil);
return result;
@@ -4782,6 +4811,9 @@ gui_supports_face_attributes_p (struct frame *f,
|| (!UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
&& face_attr_equal_p (attrs[LFACE_INVERSE_INDEX],
def_attrs[LFACE_INVERSE_INDEX]))
+ || (!UNSPECIFIEDP (attrs[LFACE_EXTEND_INDEX])
+ && face_attr_equal_p (attrs[LFACE_EXTEND_INDEX],
+ def_attrs[LFACE_EXTEND_INDEX]))
|| (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
&& face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX],
def_attrs[LFACE_FOREGROUND_INDEX]))
@@ -5358,6 +5390,9 @@ realize_default_face (struct frame *f)
ASET (lface, LFACE_FONTSET_INDEX, Qnil);
}
+ if (UNSPECIFIEDP (LFACE_EXTEND (lface)))
+ ASET (lface, LFACE_EXTEND_INDEX, Qnil);
+
if (UNSPECIFIEDP (LFACE_UNDERLINE (lface)))
ASET (lface, LFACE_UNDERLINE_INDEX, Qnil);
@@ -6535,6 +6570,7 @@ syms_of_xfaces (void)
DEFSYM (QCstrike_through, ":strike-through");
DEFSYM (QCbox, ":box");
DEFSYM (QCinherit, ":inherit");
+ DEFSYM (QCextend, ":extend");
/* Symbols used for Lisp face attribute values. */
DEFSYM (QCcolor, ":color");
- [Emacs-diffs] branch scratch/extend_face_id created (now 87bf154), Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id 87bf154 8/8: Make hl-line face to extend all the line.., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id e0e3aa7 7/8: Fix last change in append_space_for_newline., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id da9c131 5/8: Changed handle_face_prop_general prototype., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id 7ef4f12 1/8: Simplify struct face to use only underline., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id 1958094 2/8: Added face parameter :extend.,
Jimmy Aguilar Mena <=
- [Emacs-diffs] scratch/extend_face_id 61a8bcc 3/8: Conditional merged face to extend after eol., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id cae56f9 6/8: Add space for cursor to work also in terminal., Jimmy Aguilar Mena, 2019/09/14
- [Emacs-diffs] scratch/extend_face_id b307a5c 4/8: Fixed extend face filtered for prop., Jimmy Aguilar Mena, 2019/09/14