unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Barry OReilly <gundaetiapo@gmail.com>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <jwv7gbzannp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAFM41H0e2nSt=iaXmmP1NVRJbOfkS5fOpDDEsf-=Ea-6Kka5Fg@mail.gmail.com> (Barry OReilly's message of "Fri, 22 Nov 2013 17:14:52 -0500")

>> 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



      reply	other threads:[~2013-11-23  2:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 22:14 parse-partial-sexp to stop at any depth change (and Re: Fontifying outside of region passed to registered JIT lock function) Barry OReilly
2013-11-23  2:01 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7gbzannp.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=gundaetiapo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).