aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.h
diff options
context:
space:
mode:
authorGregory Heytings2022-07-06 00:43:56 +0200
committerGregory Heytings2022-07-06 00:43:56 +0200
commit38b3780f6e1bdcbb2a9a7dde76fa55da36e2774f (patch)
treed0642db75c1bfbbe11e50d8f48511a9f1ea94f5a /src/buffer.h
parent0463368a7b70dfc7914e5c5577c9690f8d0c4f7c (diff)
downloademacs-38b3780f6e1bdcbb2a9a7dde76fa55da36e2774f.tar.gz
emacs-38b3780f6e1bdcbb2a9a7dde76fa55da36e2774f.zip
Actually fix the long lines display bug (bug#56393).
* lisp/files.el (auto-narrow-mode): New minor mode. (auto-narrow-pre-command-function, auto-narrow-post-command-function): New auxiliary functions for the minor mode. (auto-narrow-display-length, auto-narrow-widen-automatically): New defcustoms for the minor mode. (auto-narrow--widen-automatically, auto-narrow--isearch-widen-automatically, auto-narrow--initialized): New internal variables for the minor mode. * src/buffer.h (struct buffer): New internal variable for the minor mode. (bset_auto_narrow__narrowing_state, BUFFER_AUTO_NARROWED_P): New auxiliary functions. * src/buffer.c (init_buffer_once, syms_of_buffer): New internal variable for the minor mode. Update the docstring of mode-line-format. * src/fileio.c (Finsert_file_contents): Detect whether the minor mode should be entered when the buffer is displayed. (syms_of_fileio): New defcustom for the minor mode. * src/keyboard.c (syms_of_keyboard): New hook functions for the minor mode. (command_loop_1): Execute the hook functions. * src/xdisp.c (redisplay_window): Enter the minor mode when the buffer is displayed. (decode_mode_spec): Indicate when the minor mode is active in the modeline. Indicate the buffer position relative to the whole buffer. (set_vertical_scroll_bar): Indicate the buffer position relative to the whole buffer. (syms_of_xdisp): Two new symbols. * lisp/isearch.el (isearch-widen-automatically): New defcustom. (isearch-search): Use the new defcustom. * lisp/bindings.el (mode-line-modes): Do not propertize the indication in the modeline when the new minor mode is active. * etc/NEWS: Announce the new minor mode, and remove the unobsoletion indication for 'longlines-mode'. * lisp/longlines.el: Reobsolete longlines-mode. * doc/emacs/display.texi (Auto-Narrowing): New section, describing the new minor mode. (Display): Entry for the new section. * doc/emacs/trouble.texi (Long Lines): Remove the section. (Lossage): Remove the entry for the Long Lines section. * doc/emacs/emacs.texi (Top): Remove the entry for the Long Lines section.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 135eaf72d30..19faa844e02 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -561,6 +561,9 @@ struct buffer
561 in the display of this buffer. */ 561 in the display of this buffer. */
562 Lisp_Object extra_line_spacing_; 562 Lisp_Object extra_line_spacing_;
563 563
564 /* Narrowing state when auto-narrow mode is in effect. */
565 Lisp_Object auto_narrow__narrowing_state_;
566
564 /* Cursor type to display in non-selected windows. 567 /* Cursor type to display in non-selected windows.
565 t means to use hollow box cursor. 568 t means to use hollow box cursor.
566 See `cursor-type' for other values. */ 569 See `cursor-type' for other values. */
@@ -832,6 +835,11 @@ bset_width_table (struct buffer *b, Lisp_Object val)
832{ 835{
833 b->width_table_ = val; 836 b->width_table_ = val;
834} 837}
838INLINE void
839bset_auto_narrow__narrowing_state (struct buffer *b, Lisp_Object val)
840{
841 b->auto_narrow__narrowing_state_ = val;
842}
835 843
836/* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return 844/* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return
837 the max (resp. min) p such that 845 the max (resp. min) p such that
@@ -1112,6 +1120,12 @@ BUFFER_CHECK_INDIRECTION (struct buffer *b)
1112 } 1120 }
1113} 1121}
1114 1122
1123INLINE bool
1124BUFFER_AUTO_NARROWED_P (struct buffer *b)
1125{
1126 return EQ (BVAR (b, auto_narrow__narrowing_state), Qauto);
1127}
1128
1115/* This structure holds the default values of the buffer-local variables 1129/* This structure holds the default values of the buffer-local variables
1116 that have special slots in each buffer. 1130 that have special slots in each buffer.
1117 The default value occupies the same slot in this structure 1131 The default value occupies the same slot in this structure