Add an intermediary face for mode lines: `mode-line-active'
* doc/emacs/display.texi (Standard Faces): Document the new face. * lisp/faces.el (mode-line-active): New face. (mode-line): Don't inherit from vaiable-pitch. * src/xfaces.c (lookup_basic_face, realize_basic_faces) (syms_of_xfaces): * src/xdisp.c (window_box_height, window_text_pixel_size) (display_mode_lines, Fformat_mode_line): * src/dispextern.h (CURRENT_MODE_LINE_ACTIVE_FACE_ID_3) (CURRENT_MODE_LINE_ACTIVE_FACE_ID, enum face_id): Rename from *MODE_LINE_FACE_ID to *MODE_LINE_ACTIVE_FACE_ID.
This commit is contained in:
parent
5d6e1c749a
commit
3f843b25dc
6 changed files with 74 additions and 34 deletions
|
@ -716,46 +716,62 @@ frame:
|
|||
@table @code
|
||||
@item mode-line
|
||||
@cindex @code{mode-line} face
|
||||
@cindex faces for mode lines
|
||||
This face is used for the mode line of the currently selected window,
|
||||
This is the base face used for the mode lines, as well as header lines
|
||||
and for menu bars when toolkit menus are not used. By default, it's
|
||||
drawn with shadows for a raised effect on graphical displays, and
|
||||
drawn as the inverse of the default face on non-windowed terminals.
|
||||
|
||||
The @code{mode-line-active} and @code{mode-line-inactive} faces (which
|
||||
are the ones used on the mode lines) inherit from this face.
|
||||
|
||||
@item mode-line-active
|
||||
@cindex faces for mode lines
|
||||
Like @code{mode-line}, but used for the mode line of the currently
|
||||
selected window. This face inherits from @code{mode-line}, so changes
|
||||
in that face affect mode lines in all windows.
|
||||
|
||||
@item mode-line-inactive
|
||||
@cindex @code{mode-line-inactive} face
|
||||
Like @code{mode-line}, but used for mode lines of the windows other
|
||||
than the selected one (if @code{mode-line-in-non-selected-windows} is
|
||||
non-@code{nil}). This face inherits from @code{mode-line}, so changes
|
||||
in that face affect mode lines in all windows.
|
||||
|
||||
@item mode-line-highlight
|
||||
@cindex @code{mode-line-highlight} face
|
||||
Like @code{highlight}, but used for mouse-sensitive portions of text
|
||||
on mode lines. Such portions of text typically pop up tooltips
|
||||
(@pxref{Tooltips}) when the mouse pointer hovers above them.
|
||||
|
||||
@item mode-line-buffer-id
|
||||
@cindex @code{mode-line-buffer-id} face
|
||||
This face is used for buffer identification parts in the mode line.
|
||||
|
||||
@item header-line
|
||||
@cindex @code{header-line} face
|
||||
Similar to @code{mode-line} for a window's header line, which appears
|
||||
at the top of a window just as the mode line appears at the bottom.
|
||||
Most windows do not have a header line---only some special modes, such
|
||||
Info mode, create one.
|
||||
|
||||
@item header-line-highlight
|
||||
@cindex @code{header-line-highlight} face
|
||||
Similar to @code{highlight} and @code{mode-line-highlight}, but used
|
||||
for mouse-sensitive portions of text on header lines. This is a
|
||||
separate face because the @code{header-line} face might be customized
|
||||
in a way that does not interact well with @code{highlight}.
|
||||
|
||||
@item tab-line
|
||||
@cindex @code{tab-line} face
|
||||
Similar to @code{mode-line} for a window's tab line, which appears
|
||||
at the top of a window with tabs representing window buffers.
|
||||
@xref{Tab Line}.
|
||||
|
||||
@item vertical-border
|
||||
@cindex @code{vertical-border} face
|
||||
This face is used for the vertical divider between windows on text
|
||||
terminals.
|
||||
|
||||
@item minibuffer-prompt
|
||||
@cindex @code{minibuffer-prompt} face
|
||||
@vindex minibuffer-prompt-properties
|
||||
|
@ -765,19 +781,23 @@ By default, Emacs automatically adds this face to the value of
|
|||
properties (@pxref{Text Properties,,, elisp, the Emacs Lisp Reference
|
||||
Manual}) used to display the prompt text. (This variable takes effect
|
||||
when you enter the minibuffer.)
|
||||
|
||||
@item fringe
|
||||
@cindex @code{fringe} face
|
||||
The face for the fringes to the left and right of windows on graphic
|
||||
displays. (The fringes are the narrow portions of the Emacs frame
|
||||
between the text area and the window's right and left borders.)
|
||||
@xref{Fringes}.
|
||||
|
||||
@item cursor
|
||||
The @code{:background} attribute of this face specifies the color of
|
||||
the text cursor. @xref{Cursor Display}.
|
||||
|
||||
@item tooltip
|
||||
This face is used for tooltip text. By default, if Emacs is built
|
||||
with GTK+ support, tooltips are drawn via GTK+ and this face has no
|
||||
effect. @xref{Tooltips}.
|
||||
|
||||
@item mouse
|
||||
This face determines the color of the mouse pointer.
|
||||
@end table
|
||||
|
|
14
etc/NEWS
14
etc/NEWS
|
@ -75,13 +75,19 @@ time.
|
|||
|
||||
* Changes in Emacs 29.1
|
||||
|
||||
+++
|
||||
** New face 'mode-line-active'.
|
||||
This inherits from the 'mode-line' face, but is the face actually used
|
||||
on the mode lines (along with 'mode-line-inactive').
|
||||
|
||||
---
|
||||
** The mode line now uses a proportional font by default.
|
||||
To get the old monospaced mode line back, customize the 'mode-line'
|
||||
face not to inherit from the 'variable-pitch' face, or add this to
|
||||
your ~/.emacs:
|
||||
To get the old monospaced mode line back, customize the
|
||||
'mode-line-active' and 'mode-line-inactive' faces not to inherit from
|
||||
the 'variable-pitch' face, or add this to your ~/.emacs:
|
||||
|
||||
(set-face-attribute 'mode-line nil :inherit 'default)
|
||||
(set-face-attribute 'mode-line-active nil :inherit 'mode-line)
|
||||
(set-face-attribute 'mode-line-inactive nil :inherit 'mode-line)
|
||||
|
||||
+++
|
||||
** New function 'buffer-text-pixel-size'.
|
||||
|
|
|
@ -2611,19 +2611,26 @@ non-nil."
|
|||
(defface mode-line
|
||||
'((((class color) (min-colors 88))
|
||||
:box (:line-width -1 :style released-button)
|
||||
:inherit variable-pitch
|
||||
:background "grey75" :foreground "black")
|
||||
(t
|
||||
:inverse-video t
|
||||
:inherit variable-pitch))
|
||||
"Basic mode line face for selected window."
|
||||
:inverse-video t))
|
||||
"Face for the mode lines (for the selected window) as well as header lines.
|
||||
See `mode-line-display' for the face used on mode lines."
|
||||
:version "21.1"
|
||||
:group 'mode-line-faces
|
||||
:group 'basic-faces)
|
||||
|
||||
(defface mode-line-active
|
||||
'((t :inherit (mode-line variable-pitch)))
|
||||
"Face for the selected mode line.
|
||||
This inherits from the `mode-line' face."
|
||||
:version "29.1"
|
||||
:group 'mode-line-faces
|
||||
:group 'basic-faces)
|
||||
|
||||
(defface mode-line-inactive
|
||||
'((default
|
||||
:inherit mode-line)
|
||||
:inherit (mode-line variable-pitch))
|
||||
(((class color) (min-colors 88) (background light))
|
||||
:weight light
|
||||
:box (:line-width -1 :color "grey75" :style nil)
|
||||
|
|
|
@ -1477,21 +1477,23 @@ struct glyph_string
|
|||
compared against minibuf_window (if SELW doesn't match), and SCRW
|
||||
which is compared against minibuf_selected_window (if MBW matches). */
|
||||
|
||||
#define CURRENT_MODE_LINE_FACE_ID_3(SELW, MBW, SCRW) \
|
||||
#define CURRENT_MODE_LINE_ACTIVE_FACE_ID_3(SELW, MBW, SCRW) \
|
||||
((!mode_line_in_non_selected_windows \
|
||||
|| (SELW) == XWINDOW (selected_window) \
|
||||
|| (minibuf_level > 0 \
|
||||
&& !NILP (minibuf_selected_window) \
|
||||
&& (MBW) == XWINDOW (minibuf_window) \
|
||||
&& (SCRW) == XWINDOW (minibuf_selected_window))) \
|
||||
? MODE_LINE_FACE_ID \
|
||||
? MODE_LINE_ACTIVE_FACE_ID \
|
||||
: MODE_LINE_INACTIVE_FACE_ID)
|
||||
|
||||
|
||||
/* Return the desired face id for the mode line of window W. */
|
||||
|
||||
#define CURRENT_MODE_LINE_FACE_ID(W) \
|
||||
(CURRENT_MODE_LINE_FACE_ID_3((W), XWINDOW (selected_window), (W)))
|
||||
#define CURRENT_MODE_LINE_ACTIVE_FACE_ID(W) \
|
||||
(CURRENT_MODE_LINE_ACTIVE_FACE_ID_3((W), \
|
||||
XWINDOW (selected_window), \
|
||||
(W)))
|
||||
|
||||
/* Return the current height of the mode line of window W. If not known
|
||||
from W->mode_line_height, look at W's current glyph matrix, or return
|
||||
|
@ -1504,7 +1506,7 @@ struct glyph_string
|
|||
= (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
|
||||
? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
|
||||
: estimate_mode_line_height \
|
||||
(XFRAME ((W)->frame), CURRENT_MODE_LINE_FACE_ID (W)))))
|
||||
(XFRAME ((W)->frame), CURRENT_MODE_LINE_ACTIVE_FACE_ID (W)))))
|
||||
|
||||
/* Return the current height of the header line of window W. If not known
|
||||
from W->header_line_height, look at W's current glyph matrix, or return
|
||||
|
@ -1818,7 +1820,7 @@ face_tty_specified_color (unsigned long color)
|
|||
enum face_id
|
||||
{
|
||||
DEFAULT_FACE_ID,
|
||||
MODE_LINE_FACE_ID,
|
||||
MODE_LINE_ACTIVE_FACE_ID,
|
||||
MODE_LINE_INACTIVE_FACE_ID,
|
||||
TOOL_BAR_FACE_ID,
|
||||
FRINGE_FACE_ID,
|
||||
|
@ -1836,6 +1838,7 @@ enum face_id
|
|||
CHILD_FRAME_BORDER_FACE_ID,
|
||||
TAB_BAR_FACE_ID,
|
||||
TAB_LINE_FACE_ID,
|
||||
MODE_LINE_FACE_ID,
|
||||
BASIC_FACE_ID_SENTINEL
|
||||
};
|
||||
|
||||
|
@ -2545,7 +2548,8 @@ struct it
|
|||
enum line_wrap_method line_wrap;
|
||||
|
||||
/* The ID of the default face to use. One of DEFAULT_FACE_ID,
|
||||
MODE_LINE_FACE_ID, etc, depending on what we are displaying. */
|
||||
MODE_LINE_ACTIVE_FACE_ID, etc, depending on what we are
|
||||
displaying. */
|
||||
int base_face_id;
|
||||
|
||||
/* If `what' == IT_CHARACTER, the character and the length in bytes
|
||||
|
|
31
src/xdisp.c
31
src/xdisp.c
|
@ -1285,8 +1285,8 @@ window_box_height (struct window *w)
|
|||
if (ml_row && ml_row->mode_line_p)
|
||||
height -= ml_row->height;
|
||||
else
|
||||
height -= estimate_mode_line_height (f,
|
||||
CURRENT_MODE_LINE_FACE_ID (w));
|
||||
height -= estimate_mode_line_height
|
||||
(f, CURRENT_MODE_LINE_ACTIVE_FACE_ID (w));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
|
|||
= window_parameter (w, Qmode_line_format);
|
||||
|
||||
w->mode_line_height
|
||||
= display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
|
||||
= display_mode_line (w, CURRENT_MODE_LINE_ACTIVE_FACE_ID (w),
|
||||
NILP (window_mode_line_format)
|
||||
? BVAR (current_buffer, mode_line_format)
|
||||
: window_mode_line_format);
|
||||
|
@ -3146,11 +3146,11 @@ CHECK_WINDOW_END (struct window *w)
|
|||
will produce glyphs in that row.
|
||||
|
||||
BASE_FACE_ID is the id of a base face to use. It must be one of
|
||||
DEFAULT_FACE_ID for normal text, MODE_LINE_FACE_ID,
|
||||
DEFAULT_FACE_ID for normal text, MODE_LINE_ACTIVE_FACE_ID,
|
||||
MODE_LINE_INACTIVE_FACE_ID, or HEADER_LINE_FACE_ID for displaying
|
||||
mode lines, or TOOL_BAR_FACE_ID for displaying the tool-bar.
|
||||
|
||||
If ROW is null and BASE_FACE_ID is equal to MODE_LINE_FACE_ID,
|
||||
If ROW is null and BASE_FACE_ID is equal to MODE_LINE_ACTIVE_FACE_ID,
|
||||
MODE_LINE_INACTIVE_FACE_ID, or HEADER_LINE_FACE_ID, the iterator
|
||||
will be initialized to use the corresponding mode line glyph row of
|
||||
the desired matrix of W. */
|
||||
|
@ -3196,7 +3196,7 @@ init_iterator (struct it *it, struct window *w,
|
|||
appropriate. */
|
||||
if (row == NULL)
|
||||
{
|
||||
if (base_face_id == MODE_LINE_FACE_ID
|
||||
if (base_face_id == MODE_LINE_ACTIVE_FACE_ID
|
||||
|| base_face_id == MODE_LINE_INACTIVE_FACE_ID)
|
||||
row = MATRIX_MODE_LINE_ROW (w->desired_matrix);
|
||||
else if (base_face_id == TAB_LINE_FACE_ID)
|
||||
|
@ -11020,7 +11020,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, Li
|
|||
Lisp_Object window_mode_line_format
|
||||
= window_parameter (w, Qmode_line_format);
|
||||
|
||||
y = y + display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
|
||||
y = y + display_mode_line (w, CURRENT_MODE_LINE_ACTIVE_FACE_ID (w),
|
||||
NILP (window_mode_line_format)
|
||||
? BVAR (current_buffer, mode_line_format)
|
||||
: window_mode_line_format);
|
||||
|
@ -25813,7 +25813,8 @@ display_mode_lines (struct window *w)
|
|||
struct window *sel_w = XWINDOW (old_selected_window);
|
||||
|
||||
/* Select mode line face based on the real selected window. */
|
||||
display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
|
||||
display_mode_line (w,
|
||||
CURRENT_MODE_LINE_ACTIVE_FACE_ID_3 (sel_w, sel_w, w),
|
||||
NILP (window_mode_line_format)
|
||||
? BVAR (current_buffer, mode_line_format)
|
||||
: window_mode_line_format);
|
||||
|
@ -25852,11 +25853,11 @@ display_mode_lines (struct window *w)
|
|||
}
|
||||
|
||||
|
||||
/* Display mode or header/tab line of window W. FACE_ID specifies which
|
||||
line to display; it is either MODE_LINE_FACE_ID, HEADER_LINE_FACE_ID or
|
||||
TAB_LINE_FACE_ID. FORMAT is the mode/header/tab line format to
|
||||
display. Value is the pixel height of the mode/header/tab line
|
||||
displayed. */
|
||||
/* Display mode or header/tab line of window W. FACE_ID specifies
|
||||
which line to display; it is either MODE_LINE_ACTIVE_FACE_ID,
|
||||
HEADER_LINE_FACE_ID or TAB_LINE_FACE_ID. FORMAT is the
|
||||
mode/header/tab line format to display. Value is the pixel height
|
||||
of the mode/header/tab line displayed. */
|
||||
|
||||
static int
|
||||
display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
|
||||
|
@ -26649,8 +26650,8 @@ are the selected window and the WINDOW's buffer). */)
|
|||
|
||||
face_id = (NILP (face) || EQ (face, Qdefault)) ? DEFAULT_FACE_ID
|
||||
: EQ (face, Qt) ? (EQ (window, selected_window)
|
||||
? MODE_LINE_FACE_ID : MODE_LINE_INACTIVE_FACE_ID)
|
||||
: EQ (face, Qmode_line) ? MODE_LINE_FACE_ID
|
||||
? MODE_LINE_ACTIVE_FACE_ID : MODE_LINE_INACTIVE_FACE_ID)
|
||||
: EQ (face, Qmode_line_active) ? MODE_LINE_ACTIVE_FACE_ID
|
||||
: EQ (face, Qmode_line_inactive) ? MODE_LINE_INACTIVE_FACE_ID
|
||||
: EQ (face, Qheader_line) ? HEADER_LINE_FACE_ID
|
||||
: EQ (face, Qtab_line) ? TAB_LINE_FACE_ID
|
||||
|
|
|
@ -4857,7 +4857,7 @@ lookup_basic_face (struct window *w, struct frame *f, int face_id)
|
|||
switch (face_id)
|
||||
{
|
||||
case DEFAULT_FACE_ID: name = Qdefault; break;
|
||||
case MODE_LINE_FACE_ID: name = Qmode_line; break;
|
||||
case MODE_LINE_ACTIVE_FACE_ID: name = Qmode_line_active; break;
|
||||
case MODE_LINE_INACTIVE_FACE_ID: name = Qmode_line_inactive; break;
|
||||
case HEADER_LINE_FACE_ID: name = Qheader_line; break;
|
||||
case TAB_LINE_FACE_ID: name = Qtab_line; break;
|
||||
|
@ -5569,6 +5569,7 @@ realize_basic_faces (struct frame *f)
|
|||
if (realize_default_face (f))
|
||||
{
|
||||
realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID);
|
||||
realize_named_face (f, Qmode_line_active, MODE_LINE_ACTIVE_FACE_ID);
|
||||
realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID);
|
||||
realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID);
|
||||
realize_named_face (f, Qfringe, FRINGE_FACE_ID);
|
||||
|
@ -6945,6 +6946,7 @@ syms_of_xfaces (void)
|
|||
DEFSYM (Qborder, "border");
|
||||
DEFSYM (Qmouse, "mouse");
|
||||
DEFSYM (Qmode_line_inactive, "mode-line-inactive");
|
||||
DEFSYM (Qmode_line_active, "mode-line-active");
|
||||
DEFSYM (Qvertical_border, "vertical-border");
|
||||
DEFSYM (Qwindow_divider, "window-divider");
|
||||
DEFSYM (Qwindow_divider_first_pixel, "window-divider-first-pixel");
|
||||
|
|
Loading…
Add table
Reference in a new issue