summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-07-08 23:31:56 +0200
committerGregory Heytings <gregory@heytings.org>2022-07-08 23:31:56 +0200
commite31cffb5abfe68b62047532765a2076ac4885475 (patch)
treed0642db75c1bfbbe11e50d8f48511a9f1ea94f5a /lisp/files.el
parent9ea9533f1789ce61daf99b9bd484af3ce2780472 (diff)
downloademacs-e31cffb5abfe68b62047532765a2076ac4885475.tar.gz
emacs-e31cffb5abfe68b62047532765a2076ac4885475.tar.bz2
emacs-e31cffb5abfe68b62047532765a2076ac4885475.zip
Revert commits 9ea9533f17, c0c4600ece, 7b19ce51fc, 051d2a1e36 and eb6d2fb58d.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el37
1 files changed, 11 insertions, 26 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 9d7273cb1c7..0e6f1a935db 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2692,9 +2692,9 @@ the file contents into it using `insert-file-contents-literally'."
"Number of characters to which display is restricted in `auto-narrow-mode'.
When `auto-narrow-mode' is in effect, the number of characters
-displayed above and below point is at least one third and at most
-two thirds of `auto-narrow-display-line-length', except at the
-beginning and end of the buffer."
+displayed above and below point is one third of
+`auto-narrow-display-line-length', except at the beginning and
+end of the buffer."
:group 'files
:group 'find-file
:version "29.1"
@@ -2706,40 +2706,30 @@ beginning and end of the buffer."
beginning-of-buffer end-of-buffer goto-char goto-line
mark-sexp mark-defun mark-paragraph mark-whole-buffer mark-page
exchange-point-and-mark pop-global-mark set-mark-command jump-to-register
- bookmark-jump undo)
+ bookmark-jump)
"Commands for which display is automatically widened in `auto-narrow-mode'."
:group 'files
:group 'find-file
:version "29.1"
:type '(repeat function))
-(defcustom auto-narrow-hook '(turn-off-font-lock-mode)
- "List of functions to be called when `auto-narrow-mode' is entered."
- :group 'find-file
- :type 'hook
- :version "29.1"
- :type '(repeat function))
-
(defvar-local auto-narrow--widen-automatically nil
"Internal variable used by `auto-narrow-mode'.")
(defvar-local auto-narrow--isearch-widen-automatically nil
"Internal variable used by `auto-narrow-mode'.")
-(defvar-local auto-narrow--isearch-lazy-highlight nil
- "Internal variable used by `auto-narrow-mode'.")
-
-(defun auto-narrow--reset-isearch-lazy-highlight ()
- "Internal function used by `auto-narrow-mode'."
- (when auto-narrow-mode
- (setq-local isearch-lazy-highlight auto-narrow--isearch-lazy-highlight)))
-
(defvar-local auto-narrow--initialized nil
"Internal variable used by `auto-narrow-mode'.")
(defun auto-narrow-pre-command-function ()
"Conditionally widen display when `auto-narrow-mode' is in effect."
(when auto-narrow-mode
+ (unless auto-narrow--initialized
+ (setq auto-narrow--widen-automatically widen-automatically
+ auto-narrow--isearch-widen-automatically isearch-widen-automatically
+ auto-narrow--narrowing-state 'auto
+ auto-narrow--initialized t))
(setq-local widen-automatically t
isearch-widen-automatically t)
(if (memq this-command '(narrow-to-region narrow-to-defun narrow-to-page))
@@ -2757,13 +2747,7 @@ beginning and end of the buffer."
(when (and auto-narrow-mode
(not (eq auto-narrow--narrowing-state 'explicit)))
(unless auto-narrow--initialized
- (run-hooks 'auto-narrow-hook)
- (add-hook 'isearch-mode-end-hook #'auto-narrow--reset-isearch-lazy-highlight)
- (setq auto-narrow--widen-automatically widen-automatically
- auto-narrow--isearch-widen-automatically isearch-widen-automatically
- auto-narrow--isearch-lazy-highlight isearch-lazy-highlight
- auto-narrow--narrowing-state 'auto
- auto-narrow--initialized t))
+ (setq auto-narrow--narrowing-state 'auto))
(let (point cur-point-min buf-point-min buf-point-max size)
(setq point (point) cur-point-min (point-min)
size (/ auto-narrow-display-length 3))
@@ -2793,6 +2777,7 @@ in a buffer. It restricts display, but not editing, to
executing any of the commands listed in `auto-narrow-widen-automatically'."
:group 'files
:version "29.1"
+ :after-hook (progn (put 'auto-narrow-mode 'permanent-local t))
(if auto-narrow-mode
(auto-narrow-post-command-function)
(when (not (eq auto-narrow--narrowing-state 'explicit))