diff options
| author | Juri Linkov | 2019-09-05 22:27:42 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-09-05 22:27:42 +0300 |
| commit | 2a0164753456d0f788aa026bdd903ac76519d6ab (patch) | |
| tree | cd1d607d81b73ebba8edcaa9c829cbc1fda2b1a8 /src | |
| parent | 7970c89c770f475ab67a8de84223e45c5bb23d8c (diff) | |
| download | emacs-2a0164753456d0f788aa026bdd903ac76519d6ab.tar.gz emacs-2a0164753456d0f788aa026bdd903ac76519d6ab.zip | |
Don't use hook pre-redisplay-functions. Set buffer-local tab-line-format.
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 14 | ||||
| -rw-r--r-- | src/buffer.h | 4 | ||||
| -rw-r--r-- | src/window.c | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 10 |
4 files changed, 28 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index ad9feee92a4..233a95c2597 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -249,6 +249,11 @@ bset_header_line_format (struct buffer *b, Lisp_Object val) | |||
| 249 | b->header_line_format_ = val; | 249 | b->header_line_format_ = val; |
| 250 | } | 250 | } |
| 251 | static void | 251 | static void |
| 252 | bset_tab_line_format (struct buffer *b, Lisp_Object val) | ||
| 253 | { | ||
| 254 | b->tab_line_format_ = val; | ||
| 255 | } | ||
| 256 | static void | ||
| 252 | bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) | 257 | bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val) |
| 253 | { | 258 | { |
| 254 | b->indicate_buffer_boundaries_ = val; | 259 | b->indicate_buffer_boundaries_ = val; |
| @@ -5188,6 +5193,7 @@ init_buffer_once (void) | |||
| 5188 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; | 5193 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx; |
| 5189 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; | 5194 | XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); ++idx; |
| 5190 | XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; | 5195 | XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx; |
| 5196 | XSETFASTINT (BVAR (&buffer_local_flags, tab_line_format), idx); ++idx; | ||
| 5191 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; | 5197 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx; |
| 5192 | XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; | 5198 | XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx; |
| 5193 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; | 5199 | XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx; |
| @@ -5233,6 +5239,7 @@ init_buffer_once (void) | |||
| 5233 | /* real setup is done in bindings.el */ | 5239 | /* real setup is done in bindings.el */ |
| 5234 | bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); | 5240 | bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-")); |
| 5235 | bset_header_line_format (&buffer_defaults, Qnil); | 5241 | bset_header_line_format (&buffer_defaults, Qnil); |
| 5242 | bset_tab_line_format (&buffer_defaults, Qnil); | ||
| 5236 | bset_abbrev_mode (&buffer_defaults, Qnil); | 5243 | bset_abbrev_mode (&buffer_defaults, Qnil); |
| 5237 | bset_overwrite_mode (&buffer_defaults, Qnil); | 5244 | bset_overwrite_mode (&buffer_defaults, Qnil); |
| 5238 | bset_case_fold_search (&buffer_defaults, Qt); | 5245 | bset_case_fold_search (&buffer_defaults, Qt); |
| @@ -5504,6 +5511,13 @@ syms_of_buffer (void) | |||
| 5504 | Fput (Qprotected_field, Qerror_message, | 5511 | Fput (Qprotected_field, Qerror_message, |
| 5505 | build_pure_c_string ("Attempt to modify a protected field")); | 5512 | build_pure_c_string ("Attempt to modify a protected field")); |
| 5506 | 5513 | ||
| 5514 | DEFVAR_PER_BUFFER ("tab-line-format", | ||
| 5515 | &BVAR (current_buffer, tab_line_format), | ||
| 5516 | Qnil, | ||
| 5517 | doc: /* Analogous to `mode-line-format', but controls the tab line. | ||
| 5518 | The tab line appears, optionally, at the top of a window; | ||
| 5519 | the mode line appears at the bottom. */); | ||
| 5520 | |||
| 5507 | DEFVAR_PER_BUFFER ("header-line-format", | 5521 | DEFVAR_PER_BUFFER ("header-line-format", |
| 5508 | &BVAR (current_buffer, header_line_format), | 5522 | &BVAR (current_buffer, header_line_format), |
| 5509 | Qnil, | 5523 | Qnil, |
diff --git a/src/buffer.h b/src/buffer.h index 2080a6f40b7..e411ab5461d 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -539,6 +539,10 @@ struct buffer | |||
| 539 | of windows. Nil means don't display that line. */ | 539 | of windows. Nil means don't display that line. */ |
| 540 | Lisp_Object header_line_format_; | 540 | Lisp_Object header_line_format_; |
| 541 | 541 | ||
| 542 | /* Analogous to mode_line_format for the line displayed at the top | ||
| 543 | of windows. Nil means don't display that line. */ | ||
| 544 | Lisp_Object tab_line_format_; | ||
| 545 | |||
| 542 | /* Keys that are bound local to this buffer. */ | 546 | /* Keys that are bound local to this buffer. */ |
| 543 | Lisp_Object keymap_; | 547 | Lisp_Object keymap_; |
| 544 | 548 | ||
diff --git a/src/window.c b/src/window.c index 30b53d1a06d..6749ffde4c1 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5419,7 +5419,8 @@ window_wants_tab_line (struct window *w) | |||
| 5419 | && !MINI_WINDOW_P (w) | 5419 | && !MINI_WINDOW_P (w) |
| 5420 | && !WINDOW_PSEUDO_P (w) | 5420 | && !WINDOW_PSEUDO_P (w) |
| 5421 | && !EQ (window_tab_line_format, Qnone) | 5421 | && !EQ (window_tab_line_format, Qnone) |
| 5422 | && !NILP (window_tab_line_format) | 5422 | && (!NILP (window_tab_line_format) |
| 5423 | || !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), tab_line_format))) | ||
| 5423 | && (WINDOW_PIXEL_HEIGHT (w) | 5424 | && (WINDOW_PIXEL_HEIGHT (w) |
| 5424 | > (((window_wants_mode_line (w) ? 1 : 0) | 5425 | > (((window_wants_mode_line (w) ? 1 : 0) |
| 5425 | + (window_wants_header_line (w) ? 1 : 0) | 5426 | + (window_wants_header_line (w) ? 1 : 0) |
diff --git a/src/xdisp.c b/src/xdisp.c index eca47d26c38..9f999c79031 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1478,7 +1478,10 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1478 | = window_parameter (w, Qtab_line_format); | 1478 | = window_parameter (w, Qtab_line_format); |
| 1479 | 1479 | ||
| 1480 | w->tab_line_height | 1480 | w->tab_line_height |
| 1481 | = display_mode_line (w, TAB_LINE_FACE_ID, window_tab_line_format); | 1481 | = display_mode_line (w, TAB_LINE_FACE_ID, |
| 1482 | NILP (window_tab_line_format) | ||
| 1483 | ? BVAR (current_buffer, tab_line_format) | ||
| 1484 | : window_tab_line_format); | ||
| 1482 | } | 1485 | } |
| 1483 | 1486 | ||
| 1484 | if (window_wants_header_line (w)) | 1487 | if (window_wants_header_line (w)) |
| @@ -24743,7 +24746,10 @@ display_mode_lines (struct window *w) | |||
| 24743 | Lisp_Object window_tab_line_format | 24746 | Lisp_Object window_tab_line_format |
| 24744 | = window_parameter (w, Qtab_line_format); | 24747 | = window_parameter (w, Qtab_line_format); |
| 24745 | 24748 | ||
| 24746 | display_mode_line (w, TAB_LINE_FACE_ID, window_tab_line_format); | 24749 | display_mode_line (w, TAB_LINE_FACE_ID, |
| 24750 | NILP (window_tab_line_format) | ||
| 24751 | ? BVAR (current_buffer, tab_line_format) | ||
| 24752 | : window_tab_line_format); | ||
| 24747 | ++n; | 24753 | ++n; |
| 24748 | } | 24754 | } |
| 24749 | 24755 | ||