[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ntemacs hangs when openning the attached file
From: |
Alan Mackenzie |
Subject: |
Re: ntemacs hangs when openning the attached file |
Date: |
Sat, 24 May 2008 13:16:36 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Stefan!
On Fri, May 23, 2008 at 05:36:34PM -0400, Stefan Monnier wrote:
> > The problem was that c-neutralize-syntax-in-CPP was inefficiently
> > coded. I've optimised it using essentially only Emacs primitives in
> > the defun's main loop. It now runs almost 2 orders of magnitude
> > faster.
> Sounds good.
> > Eli, I'd appreciate it very much indeed if you could review this new
> > code, please - earlier versions of it were peculiarly troublesome.
> Don't know about Eli.
That's OK. You'll do instead. ;-) (Thanks!)
> But here's some comments:
> > + ;; Note: SPEED _MATTERS_ IN THIS FUNCTION!!!
> > + ;;
> > ;; This function might do invisible changes.
> ^^
> make
I hereby resign from my role as project linguistic pedant. ;-) That one
(and ~100 others) have been in the source for ~5 years, put there by
Martin. How could I miss this??
> > + (setq pps-position beg pps-state nil)
> It would be a lot more lispy to explicitly let-bind pps-position and
> pps-state here, rather than declare them earlier without initializing
> them and then initializing them here.
I'd thought that that would just be an unnecessary extra `let'. However,
having tried it, it does make the code a bit clearer. So yes, thank you
- I'll be doing this more in the future.
> > (while (and (< (point) end)
> > (search-forward-regexp c-anchored-cpp-prefix end t))
> > ;; If we've found a "#" inside a string/comment, ignore it.
> > ! (setq pps-state
> > ! (parse-partial-sexp pps-position (point) nil nil pps-state)
> > ! pps-position (point))
> > ! (unless (or (nth 3 pps-state) ; in a string?
> > ! (nth 4 pps-state)) ; in a comment?
> > (setq mbeg+1 (point))
> > (c-end-of-macro) ; Do we need to go forward 1 char here? No!
> > ! (c-neutralize-CPP-line mbeg+1 (point))
> > ! (setq pps-state
> > ! (parse-partial-sexp pps-position (point) nil nil pps-state)
> > ! pps-position (point))))))
> I have the impression that this second call to parse-partial-sexp is
> unnecessary.
DUH!!! Of course! Wake up, Alan! That's the whole point of the call to
`c-neutralize-CPP-line', just above. Thanks!
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
Re: ntemacs hangs when openning the attached file, Richard M Stallman, 2008/05/07