* lisp/tab-line.el (tab-line-format): Move to C.
(tab-line-update-window-parameter): Remove function.
(global-tab-line-mode): Set the default value of tab-line-format.
* src/buffer.c (syms_of_buffer): Define buffer-local variable
tab-line-format.
* src/buffer.h (struct buffer): Add tab_line_format_.
* src/window.c (window_wants_tab_line):
* src/xdisp.c (pos_visible_p, display_mode_lines):
Check for buffer-local tab_line_format.
(force-mode-line-update))))
\f
-(defvar tab-line-format '(:eval (tab-line-format)))
-
;;;###autoload
(define-minor-mode global-tab-line-mode
"Display window-local tab line."
:type 'boolean
:global t
:init-value nil
- :initialize (lambda (sym val)
- (custom-initialize-default sym val)
- (when global-tab-line-mode
- (add-hook 'pre-redisplay-functions #'tab-line-update-window-parameter)))
- (if global-tab-line-mode
- (progn
- (add-hook 'pre-redisplay-functions #'tab-line-update-window-parameter)
- (force-mode-line-update))
- (remove-hook 'pre-redisplay-functions #'tab-line-update-window-parameter)
- (walk-windows (lambda (w) (tab-line-update-window-parameter w)) t)))
-
-(defun tab-line-update-window-parameter (window)
- (let* ((name 'tab-line-format)
- (value (window-parameter window name))
- (active global-tab-line-mode))
- (when (xor value active)
- (set-window-parameter
- window name (unless value tab-line-format)))))
+ (setq-default tab-line-format (when global-tab-line-mode
+ '(:eval (tab-line-format)))))
\f
(provide 'tab-line)
b->header_line_format_ = val;
}
static void
+bset_tab_line_format (struct buffer *b, Lisp_Object val)
+{
+ b->tab_line_format_ = val;
+}
+static void
bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
{
b->indicate_buffer_boundaries_ = val;
XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx;
XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
+ XSETFASTINT (BVAR (&buffer_local_flags, tab_line_format), idx); ++idx;
XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
/* real setup is done in bindings.el */
bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-"));
bset_header_line_format (&buffer_defaults, Qnil);
+ bset_tab_line_format (&buffer_defaults, Qnil);
bset_abbrev_mode (&buffer_defaults, Qnil);
bset_overwrite_mode (&buffer_defaults, Qnil);
bset_case_fold_search (&buffer_defaults, Qt);
Fput (Qprotected_field, Qerror_message,
build_pure_c_string ("Attempt to modify a protected field"));
+ DEFVAR_PER_BUFFER ("tab-line-format",
+ &BVAR (current_buffer, tab_line_format),
+ Qnil,
+ doc: /* Analogous to `mode-line-format', but controls the tab line.
+The tab line appears, optionally, at the top of a window;
+the mode line appears at the bottom. */);
+
DEFVAR_PER_BUFFER ("header-line-format",
&BVAR (current_buffer, header_line_format),
Qnil,
of windows. Nil means don't display that line. */
Lisp_Object header_line_format_;
+ /* Analogous to mode_line_format for the line displayed at the top
+ of windows. Nil means don't display that line. */
+ Lisp_Object tab_line_format_;
+
/* Keys that are bound local to this buffer. */
Lisp_Object keymap_;
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_tab_line_format, Qnone)
- && !NILP (window_tab_line_format)
+ && (!NILP (window_tab_line_format)
+ || !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), tab_line_format)))
&& (WINDOW_PIXEL_HEIGHT (w)
> (((window_wants_mode_line (w) ? 1 : 0)
+ (window_wants_header_line (w) ? 1 : 0)
= window_parameter (w, Qtab_line_format);
w->tab_line_height
- = display_mode_line (w, TAB_LINE_FACE_ID, window_tab_line_format);
+ = display_mode_line (w, TAB_LINE_FACE_ID,
+ NILP (window_tab_line_format)
+ ? BVAR (current_buffer, tab_line_format)
+ : window_tab_line_format);
}
if (window_wants_header_line (w))
Lisp_Object window_tab_line_format
= window_parameter (w, Qtab_line_format);
- display_mode_line (w, TAB_LINE_FACE_ID, window_tab_line_format);
+ display_mode_line (w, TAB_LINE_FACE_ID,
+ NILP (window_tab_line_format)
+ ? BVAR (current_buffer, tab_line_format)
+ : window_tab_line_format);
++n;
}