[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parse-partial-sexp to stop at any depth change (and Re: Fontifying o
From: |
Stefan Monnier |
Subject: |
Re: parse-partial-sexp to stop at any depth change (and Re: Fontifying outside of region passed to registered JIT lock function) |
Date: |
Fri, 22 Nov 2013 21:01:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>> insert a "display only" close-paren (with suitable coloring).
> There's probably less potential to cause user confusion if it colors
> existing parens rather than color parens that are not really a part of
> the file content.
But if that existing paren is before window-start, the user won't see
it. Using fake close-parens might not be the best choice, but I think
the idea of having some visual indicator saying "not enough
whitespace here or missing close parens on previous lines" between BOL
and the first non-whitespace char can be workable. This visual
indicator can be to just highlight the indentation space, but as you say
there might not be any indentation space, so inserting a display-only
char can be a good solution. Now which char to use is up to you.
> One issue is my usage of parse-partial-sexp. This function's interface
> doesn't make it easy to stop if there's a change of depth either up or
> down, so for code simplicity I went one char at a time:
> (parse-partial-sexp (point)
> (1+ (point))
> nil
> nil
> parse-state
> nil)
Yuck! Look at (nth 9 (syntax-ppss)): it's a list of the positions of
the open-parens that aren't closed yet.
Stefan