emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: Syntax and Hard Newlines


From: Stefan Monnier
Subject: Re: Patch: Syntax and Hard Newlines
Date: Tue, 28 Nov 2006 23:57:04 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

> many times so that got a Perl file of 268274172 bytes (257 MB).  I
> then evaluated the following forms:
[...]
> Can I conclude from this result that `parse-sexp-lookup-properties'
> has no effect over syntax parsing?

I believe so, yes.

Although I wonder why you did

   (let (old-time
         time-diff
         (parse-sexp-lookup-properties nil))
    (save-window-excursion
      (switch-to-buffer "1.pl")
      (font-lock-mode -1)
      (goto-char 268273054)
      (jit-lock-mode nil)
      (font-lock-mode 1)
      (setq old-time (current-time))
      (parse-partial-sexp 1 (point))
      (setq time-diff (time-subtract (current-time)
                                   old-time)))

rather than

    (with-current-buffer (find-file-noselect "1.pl")
      (font-lock-mode -1)
      (setq font-lock-support-mode nil)
      (font-lock-mode 1)
      (let ((old-time (current-time))
            (parse-sexp-lookup-properties nil))
        (parse-partial-sexp (point-min) (point-max))
        (time-subtract (current-time) old-time)))

The main difference is that:/ your code did:
- misused switch-to-buffer and generally fiddled unnecessarily with windows
- failed to disable jit-lock, so the buffer probably had no syntax-table
  (or face) property set anywhere while running parse-partial-sexp.
- did not bind parse-sexp-lookup-properties right before running
  parse-partial-sexp which is safer: perl-mode sets
  parse-sexp-lookup-properties via font-lock-defaults, so your let-binding
  of parse-sexp-lookup-properties to nil outside may be overridden when
  turning on font-lock-mode.
  But I believe that this did not affect your measurements because
  font-lock-mode had been turned ON before, so when you turned it on the
  second time, font-lock-set-defaults didn't do anything.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]