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
4cffd221
Commit
4cffd221
authored
Aug 01, 2006
by
Stefan Monnier
Browse files
(font-lock-extend-jit-lock-region-after-change): New fun.
(font-lock-turn-on-thing-lock): Use it.
parent
374f4f51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletion
+37
-1
lisp/ChangeLog
lisp/ChangeLog
+3
-0
lisp/font-lock.el
lisp/font-lock.el
+34
-1
No files found.
lisp/ChangeLog
View file @
4cffd221
2006-08-01 Stefan Monnier <monnier@iro.umontreal.ca>
* font-lock.el (font-lock-extend-jit-lock-region-after-change): New fun.
(font-lock-turn-on-thing-lock): Use it.
* longlines.el (longlines-show-region): Make it work on read-only
buffers as well.
...
...
lisp/font-lock.el
View file @
4cffd221
...
...
@@ -893,7 +893,11 @@ The value of this variable is used when Font Lock mode is turned on."
(
set
(
make-local-variable
'font-lock-fontified
)
t
)
;; Use jit-lock.
(
jit-lock-register
'font-lock-fontify-region
(
not
font-lock-keywords-only
))))))
(
not
font-lock-keywords-only
))
;; Tell jit-lock how we extend the region to refontify.
(
add-hook
'jit-lock-after-change-extend-region-functions
'font-lock-extend-jit-lock-region-after-change
nil
t
)))))
(
defun
font-lock-turn-off-thing-lock
()
(
cond
((
and
(
boundp
'fast-lock-mode
)
fast-lock-mode
)
...
...
@@ -1096,6 +1100,35 @@ what properties to clear before refontifying a region.")
end
(
progn
(
goto-char
end
)
(
line-beginning-position
2
))))
(
font-lock-fontify-region
beg
end
)))))
(
defvar
jit-lock-start
)
(
defvar
jit-lock-end
)
(
defun
font-lock-extend-jit-lock-region-after-change
(
beg
end
old-len
)
(
let
((
region
(
font-lock-extend-region
beg
end
old-len
)))
(
if
region
(
setq
jit-lock-start
(
min
jit-lock-start
(
car
region
))
jit-lock-end
(
max
jit-lock-end
(
cdr
region
)))
(
save-excursion
(
goto-char
beg
)
(
forward-line
0
)
(
setq
jit-lock-start
(
min
jit-lock-start
(
if
(
and
(
not
(
eobp
))
(
get-text-property
(
point
)
'font-lock-multiline
))
(
or
(
previous-single-property-change
(
point
)
'font-lock-multiline
)
(
point-min
))
(
point
))))
(
goto-char
end
)
(
forward-line
1
)
(
setq
jit-lock-end
(
max
jit-lock-end
(
if
(
and
(
not
(
bobp
))
(
get-text-property
(
1-
(
point
))
'font-lock-multiline
))
(
or
(
next-single-property-change
(
1-
(
point
))
'font-lock-multiline
)
(
point-max
))
(
point
))))))))
(
defun
font-lock-fontify-block
(
&optional
arg
)
"Fontify some lines the way `font-lock-fontify-buffer' would.
The lines could be a function or paragraph, or a specified number of lines.
...
...
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