diff options
| author | Simon Marshall | 1997-06-27 06:59:46 +0000 |
|---|---|---|
| committer | Simon Marshall | 1997-06-27 06:59:46 +0000 |
| commit | b14fbaa0082b9404d0f507f58bb02603f669167d (patch) | |
| tree | 08e8a9b1ab54aa7341e456e6360dafe92590883f | |
| parent | 46f26fcf29c75548e793e6625d7b3b1f73db1d05 (diff) | |
| download | emacs-b14fbaa0082b9404d0f507f58bb02603f669167d.tar.gz emacs-b14fbaa0082b9404d0f507f58bb02603f669167d.zip | |
wrap inhibit-point-motion-hooks where nec.
| -rw-r--r-- | lisp/lazy-lock.el | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/lisp/lazy-lock.el b/lisp/lazy-lock.el index 4f7dee3bf8f..10d1355849f 100644 --- a/lisp/lazy-lock.el +++ b/lisp/lazy-lock.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Simon Marshall <simon@gnu.ai.mit.edu> | 5 | ;; Author: Simon Marshall <simon@gnu.ai.mit.edu> |
| 6 | ;; Keywords: faces files | 6 | ;; Keywords: faces files |
| 7 | ;; Version: 2.08.02 | 7 | ;; Version: 2.08.03 |
| 8 | 8 | ||
| 9 | ;;; This file is part of GNU Emacs. | 9 | ;;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -256,6 +256,7 @@ | |||
| 256 | ;; - Added Custom support | 256 | ;; - Added Custom support |
| 257 | ;; 2.08--2.09: | 257 | ;; 2.08--2.09: |
| 258 | ;; - Removed `byte-*' variables from `eval-when-compile' (Erik Naggum hint) | 258 | ;; - Removed `byte-*' variables from `eval-when-compile' (Erik Naggum hint) |
| 259 | ;; - Made various wrapping `inhibit-point-motion-hooks' (Vinicius Latorre hint) | ||
| 259 | 260 | ||
| 260 | ;;; Code: | 261 | ;;; Code: |
| 261 | 262 | ||
| @@ -312,7 +313,7 @@ The value returned is the value of the last form in BODY." | |||
| 312 | ; "Submit via mail a bug report on lazy-lock.el." | 313 | ; "Submit via mail a bug report on lazy-lock.el." |
| 313 | ; (interactive) | 314 | ; (interactive) |
| 314 | ; (let ((reporter-prompt-for-summary-p t)) | 315 | ; (let ((reporter-prompt-for-summary-p t)) |
| 315 | ; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08.02" | 316 | ; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08.03" |
| 316 | ; '(lazy-lock-minimum-size lazy-lock-defer-on-the-fly | 317 | ; '(lazy-lock-minimum-size lazy-lock-defer-on-the-fly |
| 317 | ; lazy-lock-defer-on-scrolling lazy-lock-defer-contextually | 318 | ; lazy-lock-defer-on-scrolling lazy-lock-defer-contextually |
| 318 | ; lazy-lock-defer-time lazy-lock-stealth-time | 319 | ; lazy-lock-defer-time lazy-lock-stealth-time |
| @@ -421,7 +422,7 @@ The value of this variable is used when Lazy Lock mode is turned on." | |||
| 421 | :group 'lazy-lock) | 422 | :group 'lazy-lock) |
| 422 | 423 | ||
| 423 | (defcustom lazy-lock-defer-time | 424 | (defcustom lazy-lock-defer-time |
| 424 | (if (featurep 'lisp-float-type) (/ (float 1) (float 3)) 1) | 425 | (if (featurep 'lisp-float-type) (/ (float 1) (float 4)) 1) |
| 425 | "*Time in seconds to delay before beginning deferred fontification. | 426 | "*Time in seconds to delay before beginning deferred fontification. |
| 426 | Deferred fontification occurs if there is no input within this time. | 427 | Deferred fontification occurs if there is no input within this time. |
| 427 | If nil, means fontification is never deferred, regardless of the values of the | 428 | If nil, means fontification is never deferred, regardless of the values of the |
| @@ -705,10 +706,11 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." | |||
| 705 | ;; Called from `window-scroll-functions'. | 706 | ;; Called from `window-scroll-functions'. |
| 706 | ;; Fontify WINDOW from WINDOW-START following the scroll. We cannot use | 707 | ;; Fontify WINDOW from WINDOW-START following the scroll. We cannot use |
| 707 | ;; `window-end' so we work out what it would be via `vertical-motion'. | 708 | ;; `window-end' so we work out what it would be via `vertical-motion'. |
| 708 | (save-excursion | 709 | (let ((inhibit-point-motion-hooks t)) |
| 709 | (goto-char window-start) | 710 | (save-excursion |
| 710 | (vertical-motion (window-height window) window) | 711 | (goto-char window-start) |
| 711 | (lazy-lock-fontify-region window-start (point))) | 712 | (vertical-motion (window-height window) window) |
| 713 | (lazy-lock-fontify-region window-start (point)))) | ||
| 712 | ;; A prior deletion that did not cause scrolling, followed by a scroll, would | 714 | ;; A prior deletion that did not cause scrolling, followed by a scroll, would |
| 713 | ;; result in an unnecessary trigger after this if we did not cancel it now. | 715 | ;; result in an unnecessary trigger after this if we did not cancel it now. |
| 714 | (set-window-redisplay-end-trigger window nil)) | 716 | (set-window-redisplay-end-trigger window nil)) |
| @@ -770,10 +772,11 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." | |||
| 770 | ;; out what it would be via `vertical-motion'. | 772 | ;; out what it would be via `vertical-motion'. |
| 771 | ;; We could probably just use `lazy-lock-fontify-after-scroll' without loss: | 773 | ;; We could probably just use `lazy-lock-fontify-after-scroll' without loss: |
| 772 | ;; (lazy-lock-fontify-after-scroll window (window-start window)) | 774 | ;; (lazy-lock-fontify-after-scroll window (window-start window)) |
| 773 | (save-excursion | 775 | (let ((inhibit-point-motion-hooks t)) |
| 774 | (goto-char (window-start window)) | 776 | (save-excursion |
| 775 | (vertical-motion (window-height window) window) | 777 | (goto-char (window-start window)) |
| 776 | (lazy-lock-fontify-region trigger-point (point)))) | 778 | (vertical-motion (window-height window) window) |
| 779 | (lazy-lock-fontify-region trigger-point (point))))) | ||
| 777 | 780 | ||
| 778 | ;; 2. Modified text must be marked as unfontified so it can be identified and | 781 | ;; 2. Modified text must be marked as unfontified so it can be identified and |
| 779 | ;; fontified later when Emacs is idle. Deferral occurs by adding one of | 782 | ;; fontified later when Emacs is idle. Deferral occurs by adding one of |
| @@ -930,32 +933,33 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." | |||
| 930 | 933 | ||
| 931 | (defun lazy-lock-fontify-chunk () | 934 | (defun lazy-lock-fontify-chunk () |
| 932 | ;; Fontify the nearest chunk, for stealth, in the current buffer. | 935 | ;; Fontify the nearest chunk, for stealth, in the current buffer. |
| 933 | (save-excursion | 936 | (let ((inhibit-point-motion-hooks t)) |
| 934 | (save-restriction | 937 | (save-excursion |
| 935 | (widen) | 938 | (save-restriction |
| 936 | ;; Move to end of line in case the character at point is not fontified. | 939 | (widen) |
| 937 | (end-of-line) | 940 | ;; Move to end of line in case the character at point is not fontified. |
| 938 | ;; Find where the previous, and next, unfontified regions end, and begin. | 941 | (end-of-line) |
| 939 | (let ((prev (previous-single-property-change (point) 'lazy-lock)) | 942 | ;; Find where the previous (next) unfontified regions end (begin). |
| 940 | (next (text-property-any (point) (point-max) 'lazy-lock nil))) | 943 | (let ((prev (previous-single-property-change (point) 'lazy-lock)) |
| 941 | ;; Fontify from the nearest unfontified position. | 944 | (next (text-property-any (point) (point-max) 'lazy-lock nil))) |
| 942 | (if (or (null prev) (and next (< (- next (point)) (- (point) prev)))) | 945 | ;; Fontify from the nearest unfontified position. |
| 943 | ;; The next, or neither, region is the nearest not fontified. | 946 | (if (or (null prev) (and next (< (- next (point)) (- (point) prev)))) |
| 947 | ;; The next, or neither, region is the nearest not fontified. | ||
| 948 | (lazy-lock-fontify-region | ||
| 949 | (progn (goto-char (or next (point-min))) | ||
| 950 | (beginning-of-line) | ||
| 951 | (point)) | ||
| 952 | (progn (goto-char (or next (point-min))) | ||
| 953 | (forward-line lazy-lock-stealth-lines) | ||
| 954 | (point))) | ||
| 955 | ;; The previous region is the nearest not fontified. | ||
| 944 | (lazy-lock-fontify-region | 956 | (lazy-lock-fontify-region |
| 945 | (progn (goto-char (or next (point-min))) | 957 | (progn (goto-char prev) |
| 946 | (beginning-of-line) | 958 | (forward-line (- lazy-lock-stealth-lines)) |
| 947 | (point)) | 959 | (point)) |
| 948 | (progn (goto-char (or next (point-min))) | 960 | (progn (goto-char prev) |
| 949 | (forward-line lazy-lock-stealth-lines) | 961 | (forward-line) |
| 950 | (point))) | 962 | (point))))))))) |
| 951 | ;; The previous region is the nearest not fontified. | ||
| 952 | (lazy-lock-fontify-region | ||
| 953 | (progn (goto-char prev) | ||
| 954 | (forward-line (- lazy-lock-stealth-lines)) | ||
| 955 | (point)) | ||
| 956 | (progn (goto-char prev) | ||
| 957 | (forward-line) | ||
| 958 | (point)))))))) | ||
| 959 | 963 | ||
| 960 | (defun lazy-lock-fontify-window (window) | 964 | (defun lazy-lock-fontify-window (window) |
| 961 | ;; Fontify in WINDOW between `window-start' and `window-end'. | 965 | ;; Fontify in WINDOW between `window-start' and `window-end'. |
| @@ -968,13 +972,14 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." | |||
| 968 | ;; Where we cannot use `window-start' and `window-end' we do `window-height' | 972 | ;; Where we cannot use `window-start' and `window-end' we do `window-height' |
| 969 | ;; lines around point. That way we guarantee to have done enough. | 973 | ;; lines around point. That way we guarantee to have done enough. |
| 970 | (with-current-buffer (window-buffer window) | 974 | (with-current-buffer (window-buffer window) |
| 971 | (lazy-lock-fontify-region | 975 | (let ((inhibit-point-motion-hooks t)) |
| 972 | (save-excursion | 976 | (lazy-lock-fontify-region |
| 973 | (goto-char (window-point window)) | 977 | (save-excursion |
| 974 | (vertical-motion (- (window-height window)) window) (point)) | 978 | (goto-char (window-point window)) |
| 975 | (save-excursion | 979 | (vertical-motion (- (window-height window)) window) (point)) |
| 976 | (goto-char (window-point window)) | 980 | (save-excursion |
| 977 | (vertical-motion (window-height window) window) (point))))) | 981 | (goto-char (window-point window)) |
| 982 | (vertical-motion (window-height window) window) (point)))))) | ||
| 978 | 983 | ||
| 979 | (defun lazy-lock-unfontified-p () | 984 | (defun lazy-lock-unfontified-p () |
| 980 | ;; Return non-nil if there is anywhere still to be fontified. | 985 | ;; Return non-nil if there is anywhere still to be fontified. |