Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
6a02d88b
Commit
6a02d88b
authored
Jun 24, 1996
by
Simon Marshall
Browse files
Test for lazy-lock-mode before swapping hooks.
parent
369cc657
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
30 deletions
+26
-30
lisp/lazy-lock.el
lisp/lazy-lock.el
+26
-30
No files found.
lisp/lazy-lock.el
View file @
6a02d88b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
;; Keywords: faces files
;; Keywords: faces files
;; Version: 2.0
5
;; Version: 2.0
6
;;; This file is part of GNU Emacs.
;;; This file is part of GNU Emacs.
...
@@ -38,10 +38,7 @@
...
@@ -38,10 +38,7 @@
;;
;;
;; Put in your ~/.emacs:
;; Put in your ~/.emacs:
;;
;;
;; (autoload 'turn-on-lazy-lock "lazy-lock"
;; (setq font-lock-support-mode 'lazy-lock-mode)
;; "Unconditionally turn on Lazy Lock mode.")
;;
;; (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
;;
;;
;; Start up a new Emacs and use font-lock as usual (except that you can use the
;; Start up a new Emacs and use font-lock as usual (except that you can use the
;; so-called "gaudier" fontification regexps on big files without frustration).
;; so-called "gaudier" fontification regexps on big files without frustration).
...
@@ -159,7 +156,7 @@
...
@@ -159,7 +156,7 @@
;; Lazy Lock mode does not work efficiently with Outline mode. This is because
;; Lazy Lock mode does not work efficiently with Outline mode. This is because
;; when in Outline mode, although text may be hidden (not visible in the
;; when in Outline mode, although text may be hidden (not visible in the
;; window), the text is visible to Emacs Lisp code (not surprisingly) and Lazy
;; window), the text is visible to Emacs Lisp code (not surprisingly) and Lazy
;; Lock fontifies it mercilessly.
Hopefully this
will be fixed one day.
;; Lock fontifies it mercilessly.
Maybe it
will be fixed one day.
;;
;;
;; Because buffer text is not necessarily fontified, other packages that expect
;; Because buffer text is not necessarily fontified, other packages that expect
;; buffer text to be fontified in Font Lock mode either might not work as
;; buffer text to be fontified in Font Lock mode either might not work as
...
@@ -175,8 +172,8 @@
...
@@ -175,8 +172,8 @@
;; the echoing of keystrokes in the minibuffer. This is because of the way
;; the echoing of keystrokes in the minibuffer. This is because of the way
;; deferral and stealth have to be implemented for Emacs 19.30. Upgrade!
;; deferral and stealth have to be implemented for Emacs 19.30. Upgrade!
;;
;;
;; Currently XEmacs does not have the features to support
lazy-lock.el. Maybe
;; Currently XEmacs does not have the features to support
this version of
;; it will one day.
;;
lazy-lock.el. Maybe
it will one day.
;; Feedback:
;; Feedback:
;;
;;
...
@@ -231,6 +228,8 @@
...
@@ -231,6 +228,8 @@
;; - Returned `lazy-lock-fontify-after-install' hack (Darren Hall hint)
;; - Returned `lazy-lock-fontify-after-install' hack (Darren Hall hint)
;; - Added `lazy-lock-defer-driven' functionality (Scott Byer hint)
;; - Added `lazy-lock-defer-driven' functionality (Scott Byer hint)
;; - Made `lazy-lock-mode' wrap `font-lock-support-mode'
;; - Made `lazy-lock-mode' wrap `font-lock-support-mode'
;; 2.05--2.06:
;; - Made `lazy-lock-fontify-after-defer' swap correctly (Scott Byer report)
(
require
'font-lock
)
(
require
'font-lock
)
...
@@ -294,20 +293,21 @@ The value of this variable is used when Lazy Lock mode is turned on.")
...
@@ -294,20 +293,21 @@ The value of this variable is used when Lazy Lock mode is turned on.")
(
defvar
lazy-lock-defer-driven
nil
(
defvar
lazy-lock-defer-driven
nil
"*If non-nil, means fontification should be defer-driven.
"*If non-nil, means fontification should be defer-driven.
If nil, means demand-driven fontification is performed. This means when
the
If nil, means demand-driven fontification is performed. This means when
window
scroll
s
into unfontified areas of the buffer, those areas are
scroll
ing
into unfontified areas of the buffer, those areas are
immediately
immediately
fontified. Thus scrolling never presents unfontified areas.
fontified. Thus scrolling never presents unfontified areas.
However, since
However, since
fontification occurs during scrolling, scrolling may be slow.
fontification occurs during scrolling, scrolling may be slow.
If t, means defer-driven fontification is performed. This means fontification
If t, means defer-driven fontification is performed. This means fontification
of those areas is deferred. Thus scrolling may present momentarily unfontified
of those areas is deferred. Thus scrolling may present momentarily unfontified
areas. However, since fontification does not occur during scrolling, scrolling
areas. However, since fontification does not occur during scrolling, scrolling
will be faster than demand-driven fontification.
will be faster than demand-driven fontification.
If non-nil and non-t, means buffer demand-driven fontification is performed
If any other value, e.g., `eventually', means demand-driven fontification is
until the buffer is fontified, then buffer fontification becomes defer-driven.
performed until the buffer is fontified, then buffer fontification becomes
Thus scrolling never presents unfontified areas until the buffer is fontified,
defer-driven. Thus scrolling never presents unfontified areas until the buffer
at which point subsequent scrolling may present future buffer insertions
is first fontified, after which subsequent scrolling may present future buffer
momentarily unfontified. However, since fontification does not occur during
insertions momentarily unfontified. However, since fontification does not
scrolling once the buffer is fontified, scrolling will become faster.
occur during scrolling after the buffer is first fontified, scrolling will
become faster.
The value of this variable is used when Lazy Lock mode is turned on."
)
The value of this variable is used when Lazy Lock mode is turned on."
)
...
@@ -333,7 +333,7 @@ If nil, means stealth fontification is never performed.
...
@@ -333,7 +333,7 @@ If nil, means stealth fontification is never performed.
The value of this variable is used when Lazy Lock mode is turned on."
)
The value of this variable is used when Lazy Lock mode is turned on."
)
(
defvar
lazy-lock-stealth-lines
(
if
font-lock-maximum-decoration
100
2
0
0
)
(
defvar
lazy-lock-stealth-lines
(
if
font-lock-maximum-decoration
100
2
5
0
)
"*Maximum size of a chunk of stealth fontification.
"*Maximum size of a chunk of stealth fontification.
Each iteration of stealth fontification can fontify this number of lines.
Each iteration of stealth fontification can fontify this number of lines.
To speed up input response during stealth fontification, at the cost of stealth
To speed up input response during stealth fontification, at the cost of stealth
...
@@ -346,7 +346,7 @@ Each iteration of stealth fontification is separated by this amount of time.
...
@@ -346,7 +346,7 @@ Each iteration of stealth fontification is separated by this amount of time.
To reduce machine load during stealth fontification, at the cost of stealth
To reduce machine load during stealth fontification, at the cost of stealth
taking longer to fontify, you could increase the value of this variable."
)
taking longer to fontify, you could increase the value of this variable."
)
(
defvar
lazy-lock-stealth-verbose
font-lock-verbose
(
defvar
lazy-lock-stealth-verbose
(
not
(
null
font-lock-verbose
))
"*If non-nil, means stealth fontification should show status messages."
)
"*If non-nil, means stealth fontification should show status messages."
)
(
defvar
lazy-lock-mode
nil
)
(
defvar
lazy-lock-mode
nil
)
...
@@ -412,7 +412,7 @@ Use \\[lazy-lock-submit-bug-report] to send bug reports or feedback."
...
@@ -412,7 +412,7 @@ Use \\[lazy-lock-submit-bug-report] to send bug reports or feedback."
"Submit via mail a bug report on lazy-lock.el."
"Submit via mail a bug report on lazy-lock.el."
(
interactive
)
(
interactive
)
(
let
((
reporter-prompt-for-summary-p
t
))
(
let
((
reporter-prompt-for-summary-p
t
))
(
reporter-submit-bug-report
"simon@gnu.ai.mit.edu"
"lazy-lock 2.0
5
"
(
reporter-submit-bug-report
"simon@gnu.ai.mit.edu"
"lazy-lock 2.0
6
"
'
(
lazy-lock-minimum-size
lazy-lock-defer-driven
lazy-lock-defer-time
'
(
lazy-lock-minimum-size
lazy-lock-defer-driven
lazy-lock-defer-time
lazy-lock-stealth-time
lazy-lock-stealth-nice
lazy-lock-stealth-lines
lazy-lock-stealth-time
lazy-lock-stealth-nice
lazy-lock-stealth-lines
lazy-lock-stealth-verbose
)
lazy-lock-stealth-verbose
)
...
@@ -598,10 +598,10 @@ In the `*scratch*' buffer, evaluate:"))))
...
@@ -598,10 +598,10 @@ In the `*scratch*' buffer, evaluate:"))))
(
lazy-lock-fontify-window
(
car
windows
))
(
lazy-lock-fontify-window
(
car
windows
))
(
setq
windows
(
cdr
windows
)))
(
setq
windows
(
cdr
windows
)))
(
setq
lazy-lock-buffers
(
cdr
lazy-lock-buffers
))))
(
setq
lazy-lock-buffers
(
cdr
lazy-lock-buffers
))))
;; Add hook if fontification should be defer-driven
from now on
.
;; Add hook if fontification should
now
be defer-driven
in this buffer
.
(
unless
(
or
(
not
lazy-lock-defer-driven
)
(
eq
lazy-lock-defer-driven
t
)
(
when
(
and
lazy-lock-mode
lazy-lock-defer-driven
(
memq
'lazy-lock-
defer
-after-scroll
window-scroll-functions
)
(
memq
'lazy-lock-
fontify
-after-scroll
window-scroll-functions
)
(
input-pending-p
)
(
lazy-lock-unfontified-p
))
(
not
(
or
(
input-pending-p
)
(
lazy-lock-unfontified-p
))
))
(
remove-hook
'window-scroll-functions
'lazy-lock-fontify-after-scroll
t
)
(
remove-hook
'window-scroll-functions
'lazy-lock-fontify-after-scroll
t
)
(
add-hook
'window-scroll-functions
'lazy-lock-defer-after-scroll
nil
t
)))
(
add-hook
'window-scroll-functions
'lazy-lock-defer-after-scroll
nil
t
)))
...
@@ -628,8 +628,7 @@ In the `*scratch*' buffer, evaluate:"))))
...
@@ -628,8 +628,7 @@ In the `*scratch*' buffer, evaluate:"))))
(
lazy-lock-fontify-chunk
)))
(
lazy-lock-fontify-chunk
)))
(
setq
buffers
(
cdr
buffers
))))
(
setq
buffers
(
cdr
buffers
))))
(
when
message
(
when
message
(
message
"Fontifying stealthily...%s"
(
if
continue
"done"
"quit"
)))
(
message
"Fontifying stealthily...%s"
(
if
continue
"done"
"quit"
))))))
)))
(
defun
lazy-lock-fontify-after-outline
()
(
defun
lazy-lock-fontify-after-outline
()
;; Called from `outline-view-change-hook'.
;; Called from `outline-view-change-hook'.
...
@@ -813,9 +812,6 @@ In the `*scratch*' buffer, evaluate:"))))
...
@@ -813,9 +812,6 @@ In the `*scratch*' buffer, evaluate:"))))
;; Install ourselves:
;; Install ourselves:
;; We don't install ourselves on `font-lock-mode-hook' as other packages can be
;; used with font-lock.el, and lazy-lock.el should be dumpable without forcing
;; people to get lazy or making it difficult for people to use alternatives.
(
add-hook
'window-size-change-functions
'lazy-lock-fontify-after-resize
)
(
add-hook
'window-size-change-functions
'lazy-lock-fontify-after-resize
)
(
add-hook
'redisplay-end-trigger-functions
'lazy-lock-fontify-after-trigger
)
(
add-hook
'redisplay-end-trigger-functions
'lazy-lock-fontify-after-trigger
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment