Function: cperl-emulate-lazy-lock

cperl-emulate-lazy-lock is an interactive and byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-emulate-lazy-lock &optional WINDOW-SIZE)

Documentation

Emulate lazy-lock without condition-case, so debug-on-error works.

Start fontifying the buffer from the start (or end) using the given WINDOW-SIZE (units is lines). Negative WINDOW-SIZE starts at end, and goes backwards; default is -50. This function is not CPerl-specific; it may be used to debug problems with delayed incremental fontification.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-emulate-lazy-lock (&optional window-size)
  "Emulate `lazy-lock' without `condition-case', so `debug-on-error' works.
Start fontifying the buffer from the start (or end) using the given
WINDOW-SIZE (units is lines).  Negative WINDOW-SIZE starts at end, and
goes backwards; default is -50.  This function is not CPerl-specific; it
may be used to debug problems with delayed incremental fontification."
  (interactive
   "nSize of window for incremental fontification, negative goes backwards: ")
  (or window-size (setq window-size -50))
  (let ((pos (if (> window-size 0)
		 (point-min)
	       (point-max)))
	p)
    (goto-char pos)
    (normal-mode)
    ;; Why needed???  With older font-locks???
    (setq-local font-lock-cache-position (make-marker))
    (while (if (> window-size 0)
	       (< pos (point-max))
	     (> pos (point-min)))
      (setq p (progn
		(forward-line window-size)
		(point)))
      (font-lock-fontify-region (min p pos) (max p pos))
      (setq pos p))))