all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: emacs-devel@gnu.org
Subject: Re: Raw strings (experimental patches inside)
Date: Mon, 06 Aug 2012 12:55:56 +0200	[thread overview]
Message-ID: <871ujkthkz.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: jwvboio4wg3.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I have a CL reader, written in CL.  One could port it to emacs-24 easily
>> enough I'd say.  It's AGPL3, I wouldn't mind assigning the copyright of
>> a derived work of it to the FSF for inclusion in emacs.
>
> I think the problem is to get emacs-lisp-mode to understand it.

Indeed, CL reader macros are a problem for editors.  But the only practical
solution involves having the CL reader (and thus the whole CL language)
implemented in the editor.  Therefore including emacs-cl would indeed be
more indicated (bar a rewrite of emacs in Common Lisp).


In general, you need to be able to read the reader macro to know where
it starts and where it ends.  Reading is recursive, and reading a reader
macro may involve reading other embedded reader macros, thus you can
obtain a tree of ranges.

For indenting, we need in general more information, but this could be
provided by a table mapping reader macros and indenting rules.

To give a taste of the problem, here is an example of the kind of Common
Lisp code I'm working with now:

    (with-handle (viewh view)
      [viewh setNeedsDisplayInRect:(nsrect #@(10 10) 
                                           #@(200 100))])

Here, we have:
- one standard CL reader macro for #\(
- one non standardreader macro for #\[
- one non standard dispatching reader macro for #\# #\@.

The syntax of the text inside [] is complex, similar to Objective-C, and
we would like to have Objective-C-like font-locking and indenting, but
the parts in parentheses in this reader macro are actually read by the
standard CL reader macro for #\(, and here we want the normal Common
Lisp font-locking and indenting.

The dispatching reader macro for #\# #\@ here is a usual example of CL
reader macros, where the syntax following it is read with the standard
CL lisp reader (contrarily to what's read by the #\[ reader macro).

That information however can only be learned by executing the reader
macro and taking note of what reader macros are run.  There are
difficulties such as the fact that reader macros may seek in the stream
and read some parts twice, but a conforming reader macro should not have
side effects preventing its repeated use on the same text, so the editor
itself can do that.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.




  reply	other threads:[~2012-08-06 10:55 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03  2:02 Raw strings (experimental patches inside) Aurélien Aptel
2012-08-03  9:45 ` Pascal J. Bourguignon
2012-08-03 17:45   ` Aurélien Aptel
2012-08-04 19:41     ` Pascal J. Bourguignon
2012-08-05  0:16       ` Aurélien Aptel
2012-08-05 11:36         ` Pascal J. Bourguignon
2012-08-05  7:13       ` Lars Brinkhoff
2012-08-06  1:55       ` Stefan Monnier
2012-08-06 10:55         ` Pascal J. Bourguignon [this message]
2012-08-06 16:16           ` Stefan Monnier
2012-08-06 16:40             ` Pascal J. Bourguignon
2012-08-03 22:43 ` Stefan Monnier
2012-08-04 14:38   ` Ivan Andrus
2012-08-04 23:47     ` Stefan Monnier
2012-08-05  0:13       ` Aurélien Aptel
2012-08-06 16:17         ` Stefan Monnier
2012-08-10  1:33       ` Vr Rm
2012-08-10  5:08         ` Stephen J. Turnbull
2012-08-10  6:07           ` [OT] " Jambunathan K
2012-08-10 15:13           ` Stefan Monnier
2012-08-10 17:28             ` Stephen J. Turnbull
2012-08-10 18:50               ` Stefan Monnier
2012-08-11  7:27                 ` Stephen J. Turnbull
2012-08-11 11:05                 ` Dmitri Paduchikh
2012-08-12  0:29                   ` Stephen J. Turnbull
2012-08-10 21:11           ` Vr Rm
2012-08-10 23:03             ` Davis Herring
2012-08-10 23:24               ` Learning Emacs regexp (was: Re: Raw strings (experimental patches inside)) chad
2012-08-11  7:39             ` Raw strings (experimental patches inside) Stephen J. Turnbull
  -- strict thread matches above, loose matches on Subject: below --
2012-08-10 22:33 Dmitry Gutov
2012-08-11  7:49 ` Stephen J. Turnbull
2012-08-11 17:05   ` Dmitry Gutov
2012-08-11 17:57     ` Andreas Schwab
2012-08-11 18:22       ` Dmitry Gutov
2012-08-12  0:23     ` Stephen J. Turnbull
2012-08-11 13:30 ` Stefan Monnier

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=871ujkthkz.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=emacs-devel@gnu.org \
    /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.