diff options
| author | Gregory Heytings | 2022-07-06 10:04:38 +0000 |
|---|---|---|
| committer | Gregory Heytings | 2022-07-06 12:06:53 +0200 |
| commit | eb6d2fb58da56583490b18f4bfd705844b42180f (patch) | |
| tree | 15caaaf61ce6562daf5c1411c0f666b76b6b1af7 /src/buffer.h | |
| parent | 38b3780f6e1bdcbb2a9a7dde76fa55da36e2774f (diff) | |
| download | emacs-eb6d2fb58da56583490b18f4bfd705844b42180f.tar.gz emacs-eb6d2fb58da56583490b18f4bfd705844b42180f.zip | |
Various improvements to auto-narrow mode.
* lisp/files.el (auto-narrow-display-length): Improve docstring.
(auto-narrow-widen-automatically): Add 'undo' to the command list.
(auto-narrow-hook): New defcustom.
(auto-narrow-pre-command-function, auto-narrow-post-command-function):
Move initialization code.
(auto-narrow-mode): Do not make the 'auto-narrow-mode' permanent local
anymore.
* lisp/font-lock.el (turn-off-font-lock-mode): New convenience function.
* src/xdisp.c (set_vertical_scroll_bar): Fix typo.
(redisplay_window): Use the new convenience function.
* src/buffer.h (BUFFER_NEEDS_AUTO_NARROWING_P,
BUFFER_AUTO_NARROWED_NON_NARROWED_P): Two new convenience functions.
* src/window.c (Frecenter): Do not recenter auto-narrowed buffers that
are not actually narrowed.
* etc/NEWS: Improvement.
* doc/emacs/display.texi (Auto-Narrowing): Improvement.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 19faa844e02..84492737b0e 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -1120,12 +1120,28 @@ BUFFER_CHECK_INDIRECTION (struct buffer *b) | |||
| 1120 | } | 1120 | } |
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | /* Check the state of auto-narrowed buffers. */ | ||
| 1124 | |||
| 1125 | INLINE bool | ||
| 1126 | BUFFER_NEEDS_AUTO_NARROWING_P (struct buffer *b) | ||
| 1127 | { | ||
| 1128 | return EQ (BVAR (b, auto_narrow__narrowing_state), Qneeded); | ||
| 1129 | } | ||
| 1130 | |||
| 1123 | INLINE bool | 1131 | INLINE bool |
| 1124 | BUFFER_AUTO_NARROWED_P (struct buffer *b) | 1132 | BUFFER_AUTO_NARROWED_P (struct buffer *b) |
| 1125 | { | 1133 | { |
| 1126 | return EQ (BVAR (b, auto_narrow__narrowing_state), Qauto); | 1134 | return EQ (BVAR (b, auto_narrow__narrowing_state), Qauto); |
| 1127 | } | 1135 | } |
| 1128 | 1136 | ||
| 1137 | INLINE bool | ||
| 1138 | BUFFER_AUTO_NARROWED_NON_NARROWED_P (struct buffer *b) | ||
| 1139 | { | ||
| 1140 | return BUFFER_AUTO_NARROWED_P (b) | ||
| 1141 | && BUF_BEG (b) == BUF_BEGV (b) | ||
| 1142 | && BUF_Z (b) == BUF_ZV (b); | ||
| 1143 | } | ||
| 1144 | |||
| 1129 | /* This structure holds the default values of the buffer-local variables | 1145 | /* This structure holds the default values of the buffer-local variables |
| 1130 | that have special slots in each buffer. | 1146 | that have special slots in each buffer. |
| 1131 | The default value occupies the same slot in this structure | 1147 | The default value occupies the same slot in this structure |