all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution.
Date: Sat, 25 Feb 2017 21:22:36 +0000	[thread overview]
Message-ID: <20170225212236.GD2592@acm> (raw)
In-Reply-To: <jwvr32m83up.fsf-monnier+gmane.emacs.devel@gnu.org>

Hello, Stefan

On Sat, Feb 25, 2017 at 14:42:06 -0500, Stefan Monnier wrote:
> Sounds fairly close to some of the ideas I toyed with.

Excellent!

> Here are a few comments:

> >   o - Ambiguity involved with narrowed regions - sometimes programs and
> >     users wish to see syntactic entities (e.g. strings, comments) as
> >     though point-min were a syntactically neutral position - other times
> >     they want the syntax to be relative to the beginning of the buffer.

> I don't think this need is very serious for users.
> So, I think we should focus on those cases where this is used by Elisp
> code.

I don't really see the distinction between users and code here.  If we
implement for one, it will work for the other, won't it?

> >   o - There will be two new syntax classes introduced for use in syntax
> >     table text properties: "island open" and "island close".  Together,
> >     these enclose an "island", a region of the buffer syntactically
> >     disjoint from the text outside of the region.

> [ I like to consider that strings and comments are also a form of
>   "island", although we're probably better off supporting them in
>   a special way like we do now.  ]

I think that's just confusing the meaning of "island", which I'd like to
keep clear and unambiguous.  Something to be decided is how we'd handle
an island within a comment or string.

> I think we should try not to limit ourselves to nesting of islands.
> IOW, we should strive to find a design where a single char can close an
> island and open another one.

That would need just a minor extension of what I set out, I think.
Something like an "island swap" syntax class.  This might find use in
languages like lex and yacc.

> >   o - narrow-to-region will be given an optional argument which, if set,
> >     directs Emacs to make the new region an island.  Thus, C-u C-x n n
> >     would enable a user to narrow to a "comment within a string" and edit
> >     it as though it were a comment.

> How would this work (especially for uses from Elisp)?
> Would it set syntax-table text-properties?

Yes, it would.  It would put an island open syntax-table property on the
character before START, and and island close on the character after END.
This would isolate the region syntactically from its surroudings.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2017-02-25 21:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 13:53 Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution Alan Mackenzie
2017-02-25 19:42 ` Stefan Monnier
2017-02-25 21:22   ` Alan Mackenzie [this message]
2017-02-26  2:32     ` Stefan Monnier
2017-02-26 12:06       ` Alan Mackenzie
2017-02-26 12:24         ` Yuri Khan
2017-02-26 16:10           ` Alan Mackenzie
2017-02-26 13:47         ` Stefan Monnier
2017-02-26 16:37           ` Alan Mackenzie
2017-02-27  4:05             ` Stefan Monnier
2017-02-27 19:05               ` Alan Mackenzie
2017-02-27 20:52                 ` Stefan Monnier
2017-02-27 23:22                   ` Stefan Monnier
2017-02-27 23:48                     ` Dmitry Gutov
2017-02-28 18:58                   ` Alan Mackenzie
2017-02-28 19:09                     ` Stefan Monnier
2017-02-28 20:27                       ` Alan Mackenzie
2017-03-02 22:28                         ` Alan Mackenzie
2017-03-03 12:47 ` Filipp Gunbin
2017-03-04 19:41 ` Tom Tromey
2017-03-24 23:41   ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=20170225212236.GD2592@acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.