summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-07-08 23:36:18 +0200
committerGregory Heytings <gregory@heytings.org>2022-07-08 23:36:18 +0200
commit60e51595c8a89ffc34dbe0d36c75d1c119a7d5c5 (patch)
treee9736bab9374cbe83431fc70f499b51ae1c92313 /src
parente31cffb5abfe68b62047532765a2076ac4885475 (diff)
downloademacs-60e51595c8a89ffc34dbe0d36c75d1c119a7d5c5.tar.gz
emacs-60e51595c8a89ffc34dbe0d36c75d1c119a7d5c5.tar.bz2
emacs-60e51595c8a89ffc34dbe0d36c75d1c119a7d5c5.zip
Revert commit 38b3780f6e.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c9
-rw-r--r--src/buffer.h14
-rw-r--r--src/fileio.c21
-rw-r--r--src/keyboard.c28
-rw-r--r--src/xdisp.c122
5 files changed, 30 insertions, 164 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d5b4292a21d..509ce51b55e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5276,9 +5276,6 @@ init_buffer_once (void)
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, auto_narrow__narrowing_state), idx);
- /* Make this one a permanent local. */
- buffer_permanent_local_flags[idx++] = 1;
XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), idx); ++idx;
/* buffer_local_flags contains no pointers, so it's safe to treat it
@@ -5665,7 +5662,7 @@ A string is printed verbatim in the mode line except for %-constructs:
%p -- print percent of buffer above top of window, or Top, Bot or All.
%P -- print percent of buffer above bottom of window, perhaps plus Top,
or print Bottom or All.
- %n -- print Narrow or Auto-Narrow if appropriate.
+ %n -- print Narrow if appropriate.
%t -- visited file is text or binary (if OS supports this distinction).
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.
@@ -6366,10 +6363,6 @@ see `display-graphic-p'.
If value is a floating point number, it specifies the spacing relative
to the default frame line height. A value of nil means add no extra space. */);
- DEFVAR_PER_BUFFER ("auto-narrow--narrowing-state",
- &BVAR (current_buffer, auto_narrow__narrowing_state), Qnil,
- doc: /* Internal variable used by `auto-narrow-mode'. */);
-
DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
&BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
doc: /* Non-nil means show a cursor in non-selected windows.
diff --git a/src/buffer.h b/src/buffer.h
index 19faa844e02..135eaf72d30 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -561,9 +561,6 @@ struct buffer
in the display of this buffer. */
Lisp_Object extra_line_spacing_;
- /* Narrowing state when auto-narrow mode is in effect. */
- Lisp_Object auto_narrow__narrowing_state_;
-
/* Cursor type to display in non-selected windows.
t means to use hollow box cursor.
See `cursor-type' for other values. */
@@ -835,11 +832,6 @@ bset_width_table (struct buffer *b, Lisp_Object val)
{
b->width_table_ = val;
}
-INLINE void
-bset_auto_narrow__narrowing_state (struct buffer *b, Lisp_Object val)
-{
- b->auto_narrow__narrowing_state_ = val;
-}
/* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return
the max (resp. min) p such that
@@ -1120,12 +1112,6 @@ BUFFER_CHECK_INDIRECTION (struct buffer *b)
}
}
-INLINE bool
-BUFFER_AUTO_NARROWED_P (struct buffer *b)
-{
- return EQ (BVAR (b, auto_narrow__narrowing_state), Qauto);
-}
-
/* This structure holds the default values of the buffer-local variables
that have special slots in each buffer.
The default value occupies the same slot in this structure
diff --git a/src/fileio.c b/src/fileio.c
index bb6f73fe39a..10d4b8bc15e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4997,16 +4997,6 @@ by calling `format-decode', which see. */)
Otherwise start with an empty undo_list. */
bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil);
- if (!noninteractive
- && !NILP (Vauto_narrow_long_line_threshold)
- && !NILP (CALLN
- (Fgtr,
- Fcar (Fcdr (Fbuffer_line_statistics (Fcurrent_buffer ()))),
- Vauto_narrow_long_line_threshold)))
- {
- bset_auto_narrow__narrowing_state (current_buffer, Qneeded);
- }
-
unbind_to (count1, Qnil);
}
@@ -6648,17 +6638,6 @@ This includes interactive calls to `delete-file' and
/* Lisp function for recursively deleting directories. */
DEFSYM (Qdelete_directory, "delete-directory");
- DEFVAR_LISP ("auto-narrow-long-line-threshold",
- Vauto_narrow_long_line_threshold,
- doc: /* Line length above which `auto-narrow-mode' is entered.
-When non-nil, and when a file with one or more lines longer than
-`auto-narrow-long-line-threshold' is opened or inserted in a buffer,
-`auto-narrow-mode' is automatically enabled.
-When nil, `auto-narrow-mode' is disabled. */);
- Vauto_narrow_long_line_threshold = Qnil;
-
- DEFSYM (Qauto_narrow_mode, "auto-narrow-mode");
-
DEFSYM (Qsubstitute_env_in_file_name, "substitute-env-in-file-name");
DEFSYM (Qget_buffer_window_list, "get-buffer-window-list");
diff --git a/src/keyboard.c b/src/keyboard.c
index 38aa64774dc..bed8307b6f2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1290,9 +1290,6 @@ command_loop_1 (void)
if (NILP (Vmemory_full))
{
- if (!NILP (Vauto_narrow_post_command_function) && !NILP (Vrun_hooks))
- safe_run_hooks (Qauto_narrow_post_command_function);
-
/* Make sure this hook runs after commands that get errors and
throw to top level. */
/* Note that the value cell will never directly contain nil
@@ -1475,8 +1472,6 @@ command_loop_1 (void)
Vreal_this_command = cmd;
safe_run_hooks (Qpre_command_hook);
- safe_run_hooks (Qauto_narrow_pre_command_function);
-
already_adjusted = 0;
if (NILP (Vthis_command))
@@ -1527,8 +1522,6 @@ command_loop_1 (void)
}
kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
- safe_run_hooks (Qauto_narrow_post_command_function);
-
safe_run_hooks (Qpost_command_hook);
/* If displaying a message, resize the echo area window to fit
@@ -12047,11 +12040,6 @@ syms_of_keyboard (void)
DEFSYM (Qpre_command_hook, "pre-command-hook");
DEFSYM (Qpost_command_hook, "post-command-hook");
- DEFSYM (Qauto_narrow_pre_command_function,
- "auto-narrow-pre-command-function");
- DEFSYM (Qauto_narrow_post_command_function,
- "auto-narrow-post-command-function");
-
DEFSYM (Qundo_auto__add_boundary, "undo-auto--add-boundary");
DEFSYM (Qundo_auto__undoably_changed_buffers,
"undo-auto--undoably-changed-buffers");
@@ -12616,22 +12604,6 @@ avoid making Emacs unresponsive while the user types.
See also `pre-command-hook'. */);
Vpost_command_hook = Qnil;
- DEFVAR_LISP ("auto-narrow-pre-command-function",
- Vauto_narrow_pre_command_function,
- doc: /* Function executed before each command is executed in `auto-narrow-mode'.
-If non-nil, and `auto-narrow-mode' is enabled, the function is
-called before each command is executed, after `pre-command-hook'.
-It is called without arguments. */);
- Vauto_narrow_pre_command_function = Qnil;
-
- DEFVAR_LISP ("auto-narrow-post-command-function",
- Vauto_narrow_post_command_function,
- doc: /* Function executed after each command is executed in `auto-narrow-mode'.
-If non-nil, and `auto-narrow-mode' is enabled, the function is
-called after each command is executed, before `post-command-hook'.
-It is called without arguments. */);
- Vauto_narrow_post_command_function = Qnil;
-
#if 0
DEFVAR_LISP ("echo-area-clear-hook", ...,
doc: /* Normal hook run when clearing the echo area. */);
diff --git a/src/xdisp.c b/src/xdisp.c
index be51a0eb136..4089525e10f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18872,20 +18872,11 @@ set_vertical_scroll_bar (struct window *w)
&& NILP (echo_area_buffer[0])))
{
struct buffer *buf = XBUFFER (w->contents);
- if (! BUFFER_AUTO_NARROWED_P (current_buffer))
- {
- whole = BUF_ZV (buf) - BUF_BEGV (buf);
- start = marker_position (w->start) - BUF_BEGV (buf);
- /* I don't think this is guaranteed to be right. For the
- moment, we'll pretend it is. */
- end = BUF_Z (buf) - w->window_end_pos - BUF_BEGV (buf);
- }
- else
- {
- whole = BUF_Z (buf) - BUF_BEG (buf);
- start = marker_position (w->start) - BUF_BEG (buf);
- end = BUF_Z (buf) - w->window_end_pos - BUF_BEG (buf);
- }
+ whole = BUF_ZV (buf) - BUF_BEGV (buf);
+ start = marker_position (w->start) - BUF_BEGV (buf);
+ /* I don't think this is guaranteed to be right. For the
+ moment, we'll pretend it is. */
+ end = BUF_Z (buf) - w->window_end_pos - BUF_BEGV (buf);
if (end < start)
end = start;
@@ -19142,14 +19133,6 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
variables. */
set_buffer_internal_1 (XBUFFER (w->contents));
- if (EQ (BVAR (current_buffer, auto_narrow__narrowing_state), Qneeded))
- {
- safe_call (1, Qauto_narrow_mode);
- /* Normally set by auto-narrow-mode, set it here anyway as a safety measure. */
- bset_auto_narrow__narrowing_state (current_buffer, Qauto);
- message1 ("Auto-Narrow mode enabled in current buffer");
- }
-
current_matrix_up_to_date_p
= (w->window_end_valid
&& !current_buffer->clip_changed
@@ -27684,12 +27667,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
case 'n':
if (BUF_BEGV (b) > BUF_BEG (b) || BUF_ZV (b) < BUF_Z (b))
- {
- if (! BUFFER_AUTO_NARROWED_P (b))
- return " Narrow";
- else
- return " Auto-Narrow";
- }
+ return " Narrow";
break;
/* Display the "degree of travel" of the window through the buffer. */
@@ -27697,27 +27675,17 @@ decode_mode_spec (struct window *w, register int c, int field_width,
{
ptrdiff_t toppos = marker_position (w->start);
ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos;
- ptrdiff_t beg, z;
+ ptrdiff_t begv = BUF_BEGV (b);
+ ptrdiff_t zv = BUF_ZV (b);
- if (! BUFFER_AUTO_NARROWED_P (b))
- {
- beg = BUF_BEGV (b);
- z = BUF_ZV (b);
- }
- else
- {
- beg = BUF_BEG (b);
- z = BUF_Z (b);
- }
-
- if (z <= botpos)
- return toppos <= beg ? "All" : "Bottom";
- else if (toppos <= beg)
+ if (zv <= botpos)
+ return toppos <= begv ? "All" : "Bottom";
+ else if (toppos <= begv)
return "Top";
else
{
sprintf (decode_mode_spec_buf, "%2d%%",
- percent99 (toppos - beg, (toppos - beg) + (z - botpos)));
+ percent99 (toppos - begv, (toppos - begv) + (zv - botpos)));
return decode_mode_spec_buf;
}
}
@@ -27726,27 +27694,17 @@ decode_mode_spec (struct window *w, register int c, int field_width,
case 'p':
{
ptrdiff_t pos = marker_position (w->start);
- ptrdiff_t beg, z;
+ ptrdiff_t begv = BUF_BEGV (b);
+ ptrdiff_t zv = BUF_ZV (b);
- if (! BUFFER_AUTO_NARROWED_P (b))
- {
- beg = BUF_BEGV (b);
- z = BUF_ZV (b);
- }
- else
- {
- beg = BUF_BEG (b);
- z = BUF_Z (b);
- }
-
- if (w->window_end_pos <= BUF_Z (b) - z)
- return pos <= beg ? "All" : "Bottom";
- else if (pos <= beg)
+ if (w->window_end_pos <= BUF_Z (b) - zv)
+ return pos <= begv ? "All" : "Bottom";
+ else if (pos <= begv)
return "Top";
else
{
sprintf (decode_mode_spec_buf, "%2d%%",
- percent99 (pos - beg, z - beg));
+ percent99 (pos - begv, zv - begv));
return decode_mode_spec_buf;
}
}
@@ -27756,26 +27714,16 @@ decode_mode_spec (struct window *w, register int c, int field_width,
{
ptrdiff_t toppos = marker_position (w->start);
ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos;
- ptrdiff_t beg, z;
+ ptrdiff_t begv = BUF_BEGV (b);
+ ptrdiff_t zv = BUF_ZV (b);
- if (! BUFFER_AUTO_NARROWED_P (b))
- {
- beg = BUF_BEGV (b);
- z = BUF_ZV (b);
- }
- else
- {
- beg = BUF_BEG (b);
- z = BUF_Z (b);
- }
-
- if (z <= botpos)
- return toppos <= beg ? "All" : "Bottom";
+ if (zv <= botpos)
+ return toppos <= begv ? "All" : "Bottom";
else
{
sprintf (decode_mode_spec_buf,
- &"Top%2d%%"[beg < toppos ? sizeof "Top" - 1 : 0],
- percent99 (botpos - beg, z - beg));
+ &"Top%2d%%"[begv < toppos ? sizeof "Top" - 1 : 0],
+ percent99 (botpos - begv, zv - begv));
return decode_mode_spec_buf;
}
}
@@ -27786,25 +27734,15 @@ decode_mode_spec (struct window *w, register int c, int field_width,
{
ptrdiff_t toppos = marker_position (w->start);
ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos;
- ptrdiff_t beg, z;
+ ptrdiff_t begv = BUF_BEGV (b);
+ ptrdiff_t zv = BUF_ZV (b);
int top_perc, bot_perc;
- if (! BUFFER_AUTO_NARROWED_P (b))
- {
- beg = BUF_BEGV (b);
- z = BUF_ZV (b);
- }
- else
- {
- beg = BUF_BEG (b);
- z = BUF_Z (b);
- }
-
- if ((toppos <= beg) && (z <= botpos))
+ if ((toppos <= begv) && (zv <= botpos))
return "All ";
- top_perc = toppos <= beg ? 0 : percent99 (toppos - beg, z - beg);
- bot_perc = z <= botpos ? 100 : percent99 (botpos - beg, z - beg);
+ top_perc = toppos <= begv ? 0 : percent99 (toppos - begv, zv - begv);
+ bot_perc = zv <= botpos ? 100 : percent99 (botpos - begv, zv - begv);
if (top_perc == bot_perc)
sprintf (decode_mode_spec_buf, "%d%%", top_perc);
@@ -35892,8 +35830,6 @@ be let-bound around code that needs to disable messages temporarily. */);
DEFSYM (Qinhibit_point_motion_hooks, "inhibit-point-motion-hooks");
DEFSYM (Qeval, "eval");
DEFSYM (QCdata, ":data");
- DEFSYM (Qneeded, "needed");
- DEFSYM (Qauto, "auto");
/* Names of text properties relevant for redisplay. */
DEFSYM (Qdisplay, "display");