* lisp/font-lock.el (font-lock-flush, font-lock-ensure): New functions.

(font-lock-fontify-buffer): Mark interactive-only.
(font-lock-multiline, font-lock-fontified, font-lock-set-defaults):
Make buffer-local.
(font-lock-specified-p): Remove redundant boundp check.
(font-lock-flush-function, font-lock-ensure-function): New vars.
(font-lock-turn-on-thing-lock): Set them.
(font-lock-default-fontify-buffer): Obey font-lock-dont-widen.
(font-lock-after-change-function): Make `old-len' optional.
(font-lock-set-defaults): Remove redundant `set' of font-lock-defaults.
Call font-lock-flush, just in case.
* lisp/progmodes/verilog-mode.el (verilog-preprocess): Disable workaround in
recent Emacsen.
* lisp/progmodes/vera-mode.el (vera-fontify-buffer): Declare obsolete.
(vera-mode-map, vera-mode-menu): Remove bindings to it.
* lisp/progmodes/idlw-help.el (idlwave-help-fontify): Use font-lock-ensure
and with-syntax-table.
* lisp/textmodes/conf-mode.el (conf-quote-normal):
* lisp/progmodes/sh-script.el (sh-set-shell):
* lisp/progmodes/prog-mode.el (prettify-symbols-mode):
* lisp/progmodes/f90.el (f90-font-lock-n):
* lisp/progmodes/cwarn.el (cwarn-mode):
* lisp/nxml/nxml-mode.el (nxml-toggle-char-ref-extra-display):
* lisp/progmodes/compile.el (compilation-setup, compilation--unsetup):
* lisp/hi-lock.el (hi-lock-mode, hi-lock-unface-buffer)
(hi-lock-set-pattern, hi-lock-set-file-patterns): Use font-lock-flush.
* lisp/mail/rmail.el (rmail-variables): Set font-lock-dont-widen instead of
font-lock-fontify-buffer-function and
font-lock-unfontify-buffer-function.
(rmail-unfontify-buffer-function, rmail-fontify-message):
Use with-silent-modifications.
* lisp/htmlfontify.el (hfy-force-fontification): Use jit-lock-fontify-now
and font-lock-ensure.
* lisp/bs.el (bs-show-in-buffer): Use font-lock-ensure.
* lisp/gnus/mm-view.el (mm-display-inline-fontify): Use font-lock-ensure.
* lisp/gnus/gnus-cite.el (gnus-message-citation-mode): Use font-lock-flush.
* lisp/org/org-compat.el (org-font-lock-ensure): New function.
* lisp/org/ox-odt.el (org-odt-do-format-code):
* lisp/org/ox-html.el (org-html-fontify-code):
* lisp/org/org.el (org-fontify-like-in-org-mode):
* lisp/org/org-src.el (org-src-font-lock-fontify-block):
* lisp/org/org-clock.el (org-clock-get-clocktable): Use it.
* lisp/org/ox-org.el (org-org-publish-to-org): Use it.  Avoid using find-file
from Elisp.
* test/automated/ruby-mode-tests.el (ruby-assert-face): Use font-lock-ensure.
(ruby-interpolation-keeps-non-quote-syntax): Use syntax-propertize.
This commit is contained in:
Stefan Monnier 2014-05-28 23:45:29 -04:00
parent 2662ca5cd9
commit 6711a21f11
33 changed files with 564 additions and 461 deletions

View file

@ -77,6 +77,10 @@ performance improvements when pasting large amounts of text.
* Changes in Specialized Modes and Packages in Emacs 24.5
** font-lock
*** New functions font-lock-ensure and font-lock-flush that should be used
instead of font-lock-fontify-buffer when called from Elisp.
---
** The Rmail commands d, C-d and u now handle repeat counts
to delete or undelete multiple messages.

View file

@ -1,3 +1,40 @@
2014-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
* font-lock.el (font-lock-flush, font-lock-ensure): New functions.
(font-lock-fontify-buffer): Mark interactive-only.
(font-lock-multiline, font-lock-fontified, font-lock-set-defaults):
Make buffer-local.
(font-lock-specified-p): Remove redundant boundp check.
(font-lock-flush-function, font-lock-ensure-function): New vars.
(font-lock-turn-on-thing-lock): Set them.
(font-lock-default-fontify-buffer): Obey font-lock-dont-widen.
(font-lock-after-change-function): Make `old-len' optional.
(font-lock-set-defaults): Remove redundant `set' of font-lock-defaults.
Call font-lock-flush, just in case.
* progmodes/verilog-mode.el (verilog-preprocess): Disable workaround in
recent Emacsen.
* progmodes/vera-mode.el (vera-fontify-buffer): Declare obsolete.
(vera-mode-map, vera-mode-menu): Remove bindings to it.
* progmodes/idlw-help.el (idlwave-help-fontify): Use font-lock-ensure
and with-syntax-table.
* textmodes/conf-mode.el (conf-quote-normal):
* progmodes/sh-script.el (sh-set-shell):
* progmodes/prog-mode.el (prettify-symbols-mode):
* progmodes/f90.el (f90-font-lock-n):
* progmodes/cwarn.el (cwarn-mode):
* nxml/nxml-mode.el (nxml-toggle-char-ref-extra-display):
* progmodes/compile.el (compilation-setup, compilation--unsetup):
* hi-lock.el (hi-lock-mode, hi-lock-unface-buffer)
(hi-lock-set-pattern, hi-lock-set-file-patterns): Use font-lock-flush.
* mail/rmail.el (rmail-variables): Set font-lock-dont-widen instead of
font-lock-fontify-buffer-function and
font-lock-unfontify-buffer-function.
(rmail-unfontify-buffer-function, rmail-fontify-message):
Use with-silent-modifications.
* htmlfontify.el (hfy-force-fontification): Use jit-lock-fontify-now
and font-lock-ensure.
* bs.el (bs-show-in-buffer): Use font-lock-ensure.
2014-05-28 Thien-Thi Nguyen <ttn@gnu.org>
* emacs-lisp/package.el (package-generate-autoloads):

View file

@ -1143,7 +1143,7 @@ and move point to current buffer."
(delete-char -1)
(bs--set-window-height)
(bs--goto-current-buffer)
(font-lock-fontify-buffer)
(font-lock-ensure)
(bs-apply-sort-faces)
(set-buffer-modified-p nil)))

View file

@ -1475,16 +1475,16 @@ Optional integers MON and YR are used instead of today's date."
(set-window-vscroll nil 0))
(sit-for 0))
(and (bound-and-true-p font-lock-mode)
(font-lock-fontify-buffer))
(font-lock-fontify-buffer)) ;FIXME: Why?
(and calendar-mark-holidays-flag
;;; (calendar-date-is-valid-p today) ; useful for BC dates
;; (calendar-date-is-valid-p today) ; useful for BC dates
(calendar-mark-holidays)
(and in-calendar-window (sit-for 0)))
(unwind-protect
(if calendar-mark-diary-entries-flag (diary-mark-entries))
(if today-visible
(run-hooks 'calendar-today-visible-hook)
(run-hooks 'calendar-today-invisible-hook)))))
(run-hooks (if today-visible
'calendar-today-visible-hook
'calendar-today-invisible-hook)))))
(defun calendar-generate (month year)
"Generate a three-month Gregorian calendar centered around MONTH, YEAR."

View file

@ -601,14 +601,14 @@ This is normally set via `font-lock-defaults'.")
Currently, valid mode names are `fast-lock-mode', `jit-lock-mode' and
`lazy-lock-mode'. This is normally set via `font-lock-defaults'.")
(defvar font-lock-multiline nil
(defvar-local font-lock-multiline nil
"Whether font-lock should cater to multiline keywords.
If nil, don't try to handle multiline patterns.
If t, always handle multiline patterns.
If `undecided', don't try to handle multiline patterns until you see one.
Major/minor modes can set this variable if they know which option applies.")
(defvar font-lock-fontified nil) ; Whether we have fontified the buffer.
(defvar-local font-lock-fontified nil) ; Whether we have fontified the buffer.
;; Font Lock mode.
@ -626,6 +626,8 @@ Major/minor modes can set this variable if they know which option applies.")
;; Shut up the byte compiler.
(defvar font-lock-face-attributes)) ; Obsolete but respected if set.
(defvar-local font-lock-set-defaults nil) ; Whether we have set up defaults.
(defun font-lock-specified-p (mode)
"Return non-nil if the current buffer is ready for fontification.
The MODE argument, if non-nil, means Font Lock mode is about to
@ -634,7 +636,6 @@ be enabled."
(and (boundp 'font-lock-keywords)
font-lock-keywords)
(and mode
(boundp 'font-lock-set-defaults)
font-lock-set-defaults
font-lock-major-mode
(not (eq font-lock-major-mode major-mode)))))
@ -921,6 +922,14 @@ The value of this variable is used when Font Lock mode is turned on."
;; Prepare for jit-lock
(remove-hook 'after-change-functions
'font-lock-after-change-function t)
(set (make-local-variable 'font-lock-flush-function)
'jit-lock-refontify)
(set (make-local-variable 'font-lock-ensure-function)
'jit-lock-fontify-now)
;; Prevent font-lock-fontify-buffer from fontifying eagerly the whole
;; buffer. This is important for things like CWarn mode which
;; adds/removes a few keywords and does a refontify (which takes ages on
;; large files).
(set (make-local-variable 'font-lock-fontify-buffer-function)
'jit-lock-refontify)
;; Don't fontify eagerly (and don't abort if the buffer is large).
@ -1025,12 +1034,23 @@ This function should preserve the match-data.
The region it returns may start or end in the middle of a line.")
(make-variable-buffer-local 'font-lock-extend-after-change-region-function)
(defun font-lock-fontify-buffer ()
(defun font-lock-fontify-buffer (&optional interactively)
"Fontify the current buffer the way the function `font-lock-mode' would."
(interactive)
(declare
;; When called from Lisp, this function is a big mess. The caller usually
;; expects one of the following behaviors:
;; - refresh the highlighting (because the font-lock-keywords have been
;; changed).
;; - apply font-lock highlighting even if font-lock-mode is not enabled.
;; - reset the highlighting rules because font-lock-defaults
;; has been changed (and then rehighlight everything).
;; Of course, this function doesn't do all of the above in all situations
;; (e.g. depending on whether jit-lock is in use) and it can't guess what
;; the caller wants.
(interactive-only "use font-lock-ensure or font-lock-flush instead."))
(interactive "p")
(font-lock-set-defaults)
(let ((font-lock-verbose (or font-lock-verbose
(called-interactively-p 'interactive))))
(let ((font-lock-verbose (or font-lock-verbose interactively)))
(funcall font-lock-fontify-buffer-function)))
(defun font-lock-unfontify-buffer ()
@ -1049,6 +1069,31 @@ This works by calling `font-lock-unfontify-region-function'."
(save-buffer-state
(funcall font-lock-unfontify-region-function beg end)))
(defvar font-lock-flush-function #'font-lock-after-change-function
"Function to use to mark a region for refontification.
Called with two arguments BEG and END.")
(defun font-lock-flush (&optional beg end)
"Declare the region BEG...END's fontification as out-of-date.
If the region is not specified, it defaults to the whole buffer."
(and font-lock-mode
font-lock-fontified
(funcall font-lock-flush-function
(or beg (point-min)) (or end (point-max)))))
(defvar font-lock-ensure-function
(lambda (_beg _end)
(unless font-lock-fontified (font-lock-default-fontify-buffer)))
"Function to make sure a region has been fontified.
Called with two arguments BEG and END.")
(defun font-lock-ensure (&optional beg end)
"Make sure the region BEG...END has been fontified.
If the region is not specified, it defaults to the whole buffer."
(font-lock-set-defaults)
(funcall font-lock-ensure-function
(or beg (point-min)) (or end (point-max))))
(defun font-lock-default-fontify-buffer ()
"Fontify the whole buffer using `font-lock-fontify-region-function'."
(let ((verbose (if (numberp font-lock-verbose)
@ -1059,7 +1104,7 @@ This works by calling `font-lock-unfontify-region-function'."
(format "Fontifying %s..." (buffer-name)))
;; Make sure we fontify etc. in the whole buffer.
(save-restriction
(widen)
(unless font-lock-dont-widen (widen))
(condition-case nil
(save-excursion
(save-match-data
@ -1201,7 +1246,7 @@ This function is the default `font-lock-unfontify-region-function'."
'(face font-lock-multiline)))))
;; Called when any modification is made to buffer text.
(defun font-lock-after-change-function (beg end old-len)
(defun font-lock-after-change-function (beg end &optional old-len)
(save-excursion
(let ((inhibit-point-motion-hooks t)
(inhibit-quit t)
@ -1786,8 +1831,6 @@ A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to
(t
(car keywords))))
(defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
(defun font-lock-refresh-defaults ()
"Restart fontification in current buffer after recomputing from defaults.
Recompute fontification variables using `font-lock-defaults' and
@ -1815,9 +1858,7 @@ Sets various variables using `font-lock-defaults' and
(unless (and font-lock-set-defaults
(eq font-lock-major-mode major-mode))
(setq font-lock-major-mode major-mode)
(set (make-local-variable 'font-lock-set-defaults) t)
(make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline)
(setq font-lock-set-defaults t)
(let* ((defaults font-lock-defaults)
(keywords
(font-lock-choose-keywords (nth 0 defaults)
@ -1825,7 +1866,6 @@ Sets various variables using `font-lock-defaults' and
(local (cdr (assq major-mode font-lock-keywords-alist)))
(removed-keywords
(cdr-safe (assq major-mode font-lock-removed-keywords-alist))))
(set (make-local-variable 'font-lock-defaults) defaults)
;; Syntactic fontification?
(if (nth 1 defaults)
(set (make-local-variable 'font-lock-keywords-only) t)
@ -1868,7 +1908,8 @@ Sets various variables using `font-lock-defaults' and
;; Now compile the keywords.
(unless (eq (car font-lock-keywords) t)
(setq font-lock-keywords
(font-lock-compile-keywords font-lock-keywords))))))
(font-lock-compile-keywords font-lock-keywords))))
(font-lock-flush)))
;;; Color etc. support.

View file

@ -1,7 +1,12 @@
2014-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
* mm-view.el (mm-display-inline-fontify): Use font-lock-ensure.
* gnus-cite.el (gnus-message-citation-mode): Use font-lock-flush.
2014-05-15 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part): Don't
delete next part button; keep spacing between buttons.
* gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part):
Don't delete next part button; keep spacing between buttons.
2014-05-14 Katsumi Yamaoka <yamaoka@jpl.org>
@ -45,8 +50,8 @@
* mm-decode.el (mm-display-part): Don't insert a newline in the top.
(mm-shr): Make undisplayer unbreakable.
* mm-view.el (mm-inline-image-emacs, mm-inline-image-xemacs): Don't
insert excessive newline.
* mm-view.el (mm-inline-image-emacs, mm-inline-image-xemacs):
Don't insert excessive newline.
(mm-inline-text-html-render-with-w3m, mm-inline-text)
(mm-insert-inline): Make undisplayer unbreakable.
@ -148,8 +153,8 @@
2014-03-23 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-mime-buttonize-attachments-in-header): Display
buttons that are hidden in unselected alternative part as well.
* gnus-art.el (gnus-mime-buttonize-attachments-in-header):
Display buttons that are hidden in unselected alternative part as well.
(gnus-mime-display-alternative): Redraw attachment buttons in header.
* gmm-utils.el (gmm-labels): Add edebug spec.

View file

@ -1204,7 +1204,8 @@ When enabled, it automatically turns on `font-lock-mode'."
nil ;; init-value
"" ;; lighter
nil ;; keymap
(when (eq major-mode 'message-mode)
(when (eq major-mode 'message-mode) ;FIXME: Use derived-mode-p.
;; FIXME: Use font-lock-add-keywords!
(let ((defaults (car (if (featurep 'xemacs)
(get 'message-mode 'font-lock-defaults)
font-lock-defaults)))
@ -1233,8 +1234,10 @@ When enabled, it automatically turns on `font-lock-mode'."
font-lock-keywords nil))
(setq font-lock-set-defaults nil))
(font-lock-set-defaults)
(cond ((symbol-value 'font-lock-mode)
(font-lock-fontify-buffer))
(cond (font-lock-mode
(if (fboundp 'font-lock-flush)
(font-lock-flush)
(font-lock-fontify-buffer)))
(gnus-message-citation-mode
(font-lock-mode 1)))))

View file

@ -520,9 +520,11 @@ If MODE is not set, try to find mode automatically."
(set-auto-mode)))
;; The mode function might have already turned on font-lock.
;; Do not fontify if the guess mode is fundamental.
(unless (or (symbol-value 'font-lock-mode)
(unless (or font-lock-mode
(eq major-mode 'fundamental-mode))
(font-lock-fontify-buffer))))
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(font-lock-fontify-buffer)))))
;; By default, XEmacs font-lock uses non-duplicable text
;; properties. This code forces all the text properties
;; to be copied along with the text.

View file

@ -391,7 +391,7 @@ versions before 22 use the following in your init file:
(font-lock-remove-keywords nil hi-lock-file-patterns)
(setq hi-lock-file-patterns nil))
(remove-overlays nil nil 'hi-lock-overlay t)
(when font-lock-fontified (font-lock-fontify-buffer)))
(font-lock-flush))
(define-key-after menu-bar-edit-menu [hi-lock] nil)
(remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t)))
@ -601,7 +601,7 @@ then remove all hi-lock highlighting."
(delq keyword hi-lock-interactive-patterns))
(remove-overlays
nil nil 'hi-lock-overlay-regexp (hi-lock--hashcons (car keyword)))
(when font-lock-fontified (font-lock-fontify-buffer)))))
(font-lock-flush))))
;;;###autoload
(defun hi-lock-write-interactive-patterns ()
@ -695,7 +695,7 @@ with completion and history."
(if (and font-lock-mode (font-lock-specified-p major-mode))
(progn
(font-lock-add-keywords nil (list pattern) t)
(font-lock-fontify-buffer))
(font-lock-flush))
(let* ((range-min (- (point) (/ hi-lock-highlight-range 2)))
(range-max (+ (point) (/ hi-lock-highlight-range 2)))
(search-start
@ -719,7 +719,7 @@ with completion and history."
(font-lock-remove-keywords nil hi-lock-file-patterns)
(setq hi-lock-file-patterns patterns)
(font-lock-add-keywords nil hi-lock-file-patterns t)
(font-lock-fontify-buffer)))
(font-lock-flush)))
(defun hi-lock-find-patterns ()
"Find patterns in current buffer for hi-lock."

View file

@ -1809,17 +1809,25 @@ fontified. This is a simple convenience wrapper around
(eval-and-compile (require 'font-lock))
(if (boundp 'font-lock-cache-position)
(or font-lock-cache-position
(set 'font-lock-cache-position (make-marker))))
(if (not noninteractive)
(progn
(message "hfy interactive mode (%S %S)" window-system major-mode)
(when (and font-lock-defaults
font-lock-mode)
(font-lock-fontify-region (point-min) (point-max) nil)))
(setq font-lock-cache-position (make-marker))))
(cond
(noninteractive
(message "hfy batch mode (%s:%S)"
(or (buffer-file-name) (buffer-name)) major-mode)
(when font-lock-defaults
(font-lock-fontify-buffer)) ))
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(when font-lock-defaults
(font-lock-fontify-buffer))))
((fboundp #'jit-lock-fontify-now)
(message "hfy jit-lock mode (%S %S)" window-system major-mode)
(jit-lock-fontify-now))
(t
(message "hfy interactive mode (%S %S)" window-system major-mode)
;; If jit-lock is not in use, then the buffer is already fontified!
;; (when (and font-lock-defaults
;; font-lock-mode)
;; (font-lock-fontify-region (point-min) (point-max) nil))
)))
;;;###autoload
(defun htmlfontify-buffer (&optional srcdir file)

View file

@ -318,10 +318,6 @@ Only applies to the current buffer."
(remove-hook 'jit-lock-functions fun t)
(unless jit-lock-functions (jit-lock-mode nil)))
;; This function is used to prevent font-lock-fontify-buffer from
;; fontifying eagerly the whole buffer. This is important for
;; things like CWarn mode which adds/removes a few keywords and
;; does a refontify (which takes ages on large files).
(defun jit-lock-refontify (&optional beg end)
"Force refontification of the region BEG..END (default whole buffer)."
(with-buffer-prepared-for-jit-lock

View file

@ -1507,8 +1507,7 @@ If so restore the actual mbox message collection."
'(rmail-font-lock-keywords
t t nil nil
(font-lock-maximum-size . nil)
(font-lock-fontify-buffer-function . rmail-fontify-buffer-function)
(font-lock-unfontify-buffer-function . rmail-unfontify-buffer-function)
(font-lock-dont-widen . t)
(font-lock-inhibit-thing-lock . (lazy-lock-mode fast-lock-mode))))
(make-local-variable 'require-final-newline)
(setq require-final-newline nil)
@ -4314,31 +4313,21 @@ This has an effect only if a summary buffer exists."
(defun rmail-unfontify-buffer-function ()
;; This function's symbol is bound to font-lock-fontify-unbuffer-function.
(let ((modified (buffer-modified-p))
(buffer-undo-list t) (inhibit-read-only t)
before-change-functions after-change-functions
buffer-file-name buffer-file-truename)
(with-silent-modifications
(save-restriction
(widen)
(remove-hook 'rmail-show-message-hook 'rmail-fontify-message t)
(remove-text-properties (point-min) (point-max) '(rmail-fontified nil))
(font-lock-default-unfontify-buffer)
(and (not modified) (buffer-modified-p)
(restore-buffer-modified-p nil)))))
(font-lock-default-unfontify-buffer))))
(defun rmail-fontify-message ()
;; Fontify the current message if it is not already fontified.
(if (text-property-any (point-min) (point-max) 'rmail-fontified nil)
(let ((modified (buffer-modified-p))
(buffer-undo-list t) (inhibit-read-only t)
before-change-functions after-change-functions
buffer-file-name buffer-file-truename)
(with-silent-modifications
(save-excursion
(save-match-data
(add-text-properties (point-min) (point-max) '(rmail-fontified t))
(font-lock-fontify-region (point-min) (point-max))
(and (not modified) (buffer-modified-p)
(restore-buffer-modified-p nil)))))))
(font-lock-fontify-region (point-min) (point-max)))))))
;;; Speedbar support for RMAIL files.
(defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"

View file

@ -2567,7 +2567,7 @@ With a prefix argument, inserts the character directly."
(> (prefix-numeric-value arg) 0))))
(when (not (eq new nxml-char-ref-extra-display))
(setq nxml-char-ref-extra-display new)
(font-lock-fontify-buffer))))
(font-lock-flush))))
(put 'nxml-char-ref 'evaporate t)

File diff suppressed because it is too large Load diff

View file

@ -1927,7 +1927,7 @@ fontified, and then returned."
(org-mode)
(org-create-dblock props)
(org-update-dblock)
(font-lock-fontify-buffer)
(org-font-lock-ensure)
(forward-line 2)
(buffer-substring (point) (progn
(re-search-forward "^[ \t]*#\\+END" nil t)

View file

@ -489,6 +489,11 @@ LIMIT."
(looking-at (concat "\\(?:" regexp "\\)\\'")))))
(not (null pos)))))
(defalias 'org-font-lock-ensure
(if (fboundp 'org-font-lock-ensure)
#'font-lock-ensure
(lambda (_beg _end) (font-lock-fontify-buffer))))
(defun org-floor* (x &optional y)
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."

View file

@ -923,7 +923,7 @@ fontification of code blocks see `org-src-fontify-block' and
(delete-region (point-min) (point-max))
(insert string " ") ;; so there's a final property change
(unless (eq major-mode lang-mode) (funcall lang-mode))
(font-lock-fontify-buffer)
(org-font-lock-ensure)
(setq pos (point-min))
(while (setq next (next-single-property-change pos 'face))
(put-text-property

View file

@ -6355,7 +6355,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
(insert s)
(let ((org-odd-levels-only odd-levels))
(org-mode)
(font-lock-fontify-buffer)
(org-font-lock-ensure)
(buffer-string))))
(defvar org-m nil)

View file

@ -1856,7 +1856,7 @@ is the language used for CODE, as a string, or nil."
(funcall lang-mode)
(insert code)
;; Fontify buffer.
(font-lock-fontify-buffer)
(org-font-lock-ensure)
;; Remove formatting on newline characters.
(save-excursion
(let ((beg (point-min))

View file

@ -3127,7 +3127,7 @@ and prefix with \"OrgSrc\". For example,
(with-temp-buffer
(insert code)
(funcall lang-mode)
(font-lock-fontify-buffer)
(org-font-lock-ensure)
(buffer-string))))
(fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
'org-odt--encode-plain-text))

View file

@ -223,12 +223,13 @@ Return output file name."
(html-ext (concat "." (or (plist-get plist :html-extension)
org-html-extension "html")))
(visitingp (find-buffer-visiting filename))
(work-buffer (or visitingp (find-file filename)))
(work-buffer (or visitingp (find-file-noselect filename)))
newbuf)
(font-lock-fontify-buffer)
(show-all)
(org-show-block-all)
(setq newbuf (htmlize-buffer))
(with-current-buffer work-buffer
(org-font-lock-ensure)
(show-all)
(org-show-block-all)
(setq newbuf (htmlize-buffer)))
(with-current-buffer newbuf
(when org-org-htmlized-css-url
(goto-char (point-min))
@ -237,10 +238,12 @@ Return output file name."
(replace-match
(format
"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">"
org-org-htmlized-css-url) t t)))
org-org-htmlized-css-url)
t t)))
(write-file (concat pub-dir (file-name-nondirectory filename) html-ext)))
(kill-buffer newbuf)
(unless visitingp (kill-buffer work-buffer)))
;; FIXME: Why? Which buffer is this supposed to apply to?
(set-buffer-modified-p nil)))

View file

@ -2069,8 +2069,7 @@ Optional argument MINOR indicates this is called from
(if minor
(progn
(font-lock-add-keywords nil (compilation-mode-font-lock-keywords))
(if font-lock-mode
(font-lock-fontify-buffer)))
(font-lock-flush))
(setq font-lock-defaults '(compilation-mode-font-lock-keywords t))))
(defun compilation--unsetup ()
@ -2079,8 +2078,7 @@ Optional argument MINOR indicates this is called from
(remove-hook 'before-change-functions 'compilation--flush-parse t)
(kill-local-variable 'compilation--parsed)
(compilation--remove-properties)
(if font-lock-mode
(font-lock-fontify-buffer)))
(font-lock-flush))
;;;###autoload
(define-minor-mode compilation-shell-minor-mode

View file

@ -188,7 +188,7 @@ and disable it otherwise. If called from Lisp, enable the mode
if ARG is omitted or nil."
:group 'cwarn :lighter cwarn-mode-text
(cwarn-font-lock-keywords cwarn-mode)
(if font-lock-mode (font-lock-fontify-buffer)))
(font-lock-flush))
;;;###autoload
(define-obsolete-function-alias 'turn-on-cwarn-mode 'cwarn-mode "24.1")

View file

@ -830,7 +830,7 @@ Can be overridden by the value of `font-lock-maximum-decoration'.")
(font-lock-mode 1)
(setq font-lock-keywords
(symbol-value (intern-soft (format "f90-font-lock-keywords-%d" n))))
(font-lock-fontify-buffer))
(font-lock-flush))
(defun f90-font-lock-1 ()
"Set `font-lock-keywords' to `f90-font-lock-keywords-1'."

View file

@ -1177,15 +1177,13 @@ Useful when source code is displayed as help. See the option
(if (featurep 'font-lock)
(let ((major-mode 'idlwave-mode)
(font-lock-verbose
(if (called-interactively-p 'interactive) font-lock-verbose nil))
(syntax-table (syntax-table)))
(unwind-protect
(progn
(set-syntax-table idlwave-mode-syntax-table)
(set (make-local-variable 'font-lock-defaults)
idlwave-font-lock-defaults)
(font-lock-fontify-buffer))
(set-syntax-table syntax-table)))))
(if (called-interactively-p 'interactive) font-lock-verbose nil)))
(with-syntax-table idlwave-mode-syntax-table
(set (make-local-variable 'font-lock-defaults)
idlwave-font-lock-defaults)
(if (fboundp 'font-lock-ensure)
(font-lock-ensure)
(font-lock-fontify-buffer))))))
(defun idlwave-help-error (name type class keyword)

View file

@ -116,7 +116,7 @@ support it."
(font-lock-add-keywords nil prettify-symbols--keywords)
(setq-local font-lock-extra-managed-props
(cons 'composition font-lock-extra-managed-props))
(font-lock-fontify-buffer))
(font-lock-flush))
;; Turn off
(when prettify-symbols--keywords
(font-lock-remove-keywords nil prettify-symbols--keywords)

View file

@ -3340,8 +3340,6 @@ PREFIX is the prefix of the search regexp."
["Mark clause" prolog-mark-clause t]
["Mark predicate" prolog-mark-predicate t]
["Mark paragraph" mark-paragraph t]
;;"---"
;;["Fontify buffer" font-lock-fontify-buffer t]
))
(defun prolog-menu ()

View file

@ -2323,7 +2323,7 @@ Calls the value of `sh-set-shell-hook' if set."
(when font-lock-mode
(setq font-lock-set-defaults nil)
(font-lock-set-defaults)
(font-lock-fontify-buffer))
(font-lock-flush))
(setq sh-shell-process nil)
(run-hooks 'sh-set-shell-hook))

View file

@ -138,7 +138,6 @@ If nil, TAB always indents current line."
(define-key map "\C-c\t" 'indent-according-to-mode)
(define-key map "\M-\C-\\" 'vera-indent-region)
(define-key map "\C-c\C-c" 'vera-comment-uncomment-region)
(define-key map "\C-c\C-f" 'vera-fontify-buffer)
(define-key map "\C-c\C-v" 'vera-version)
(define-key map "\M-\t" 'tab-to-tab-stop)
;; Electric key bindings.
@ -172,8 +171,6 @@ If nil, TAB always indents current line."
["Indent Region" vera-indent-region (mark)]
["Indent Buffer" vera-indent-buffer t]
"--"
["Fontify Buffer" vera-fontify-buffer t]
"--"
["Documentation" describe-mode]
["Version" vera-version t]
["Bug Report..." vera-submit-bug-report t]
@ -686,7 +683,8 @@ Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'."
"Font lock mode face used to highlight interface names."
:group 'font-lock-highlighting-faces)
(defalias 'vera-fontify-buffer 'font-lock-fontify-buffer)
(define-obsolete-function-alias 'vera-fontify-buffer
'font-lock-fontify-buffer "24.5")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Indentation

View file

@ -5094,7 +5094,11 @@ FILENAME to find directory to run in, or defaults to `buffer-file-name`."
(verilog-mode)
;; Without this force, it takes a few idle seconds
;; to get the color, which is very jarring
(when fontlocked (font-lock-fontify-buffer))))))
(unless (fboundp 'font-lock-ensure)
;; We should use font-lock-ensure in preference to
;; font-lock-fontify-buffer, but IIUC the problem this is supposed to
;; solve only appears in Emacsen older than font-lock-ensure anyway.
(when fontlocked (font-lock-fontify-buffer)))))))
;;

View file

@ -311,8 +311,7 @@ unbalanced, but hey...)"
(when (or (not arg) (= (prefix-numeric-value arg) 2))
(modify-syntax-entry ?\" "." table))
(set-syntax-table table)
(when font-lock-mode
(font-lock-fontify-buffer))))
(font-lock-flush)))
(defun conf-outline-level ()

View file

@ -1,3 +1,8 @@
2014-05-29 Stefan Monnier <monnier@iro.umontreal.ca>
* automated/ruby-mode-tests.el (ruby-assert-face): Use font-lock-ensure.
(ruby-interpolation-keeps-non-quote-syntax): Use syntax-propertize.
2014-05-21 Michal Nazarewicz <mina86@mina86.com>
* automated/tildify-tests.el: New file.

View file

@ -61,7 +61,7 @@ VALUES-PLIST is a list with alternating index and value elements."
(defun ruby-assert-face (content pos face)
(ruby-with-temp-buffer content
(font-lock-fontify-buffer)
(font-lock-ensure nil nil 'force)
(should (eq face (get-text-property pos 'face)))))
(ert-deftest ruby-indent-after-symbol-made-from-string-interpolation ()
@ -420,7 +420,7 @@ VALUES-PLIST is a list with alternating index and value elements."
(ruby-with-temp-buffer s
(goto-char (point-min))
(ruby-mode)
(font-lock-fontify-buffer)
(syntax-propertize (point-max))
(search-forward "tee")
(should (string= (thing-at-point 'symbol) "tee")))))