unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Wedler, Christoph" <christoph.wedler@sap.com>
To: Dmitry Gutov <dgutov@yandex.ru>, Eli Zaretskii <eliz@gnu.org>,
	"monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls
Date: Mon, 18 Dec 2017 12:39:09 +0000	[thread overview]
Message-ID: <578E6C44-1D80-42BF-91A2-94C44355A1D8@sap.com> (raw)
In-Reply-To: <8e5adcd7-e085-e8d2-085f-398c660cd34d@yandex.ru>

Dmitry Gutov wrote:

> Is there a reason why you called narrow-to-region in
> antlr-python-indent-action-line anyway, even when using
> prog-indentation-context?  Because you do that, though, the "new way"
> should work with your code automatically.

Prophesy, I guess ;-)

> I'm attaching a patch with some minor cleanup, though.

To be honest, I am not so sure about the cleanup.  I think it is better
to dynamically bind `syntax-ppss-cache' and `syntax-ppss-last' while
letting python-mode do its thing: neither should python-mode use the
cache state set from the ANTLR syntax, nor should antlr-mode later use
the syntax state set by pathon-mode.  Or do I miss something?

> Please try it with a build of Emacs from the 'widen-less' branch. Do you 
> know how to build it?

It seems to have worked, even on a MacOS - good!  To do it without much
Additional installation for the moment, I used
    ./configure --with-ns --without-makeinfo --with-gnutls=no

>> I you want to try some ANTLR grammar examples yourself, I would
>> recommend:
>>   - antlr-mode 3.1.4
>>     from https://sourceforge.net/projects/antlr-mode/files/
>>   - example grammar files, especially lines 46 to 51 in
>>     https://github.com/antlr/examples-v3/blob/master/Python/C/C.g
>>   - and others in that repo (mentioned in line 100 of antlr-mode.el)

> antlr-mode.el says these examples are to see the syntax highlighting. 
> Any particular file and place to see how indentation works out? I 
> couldn't find one from a cursory search.

Are you sure that you use antlr-mode 3.1.5 (not the one from Emacs)?
Everything works for me with Emacs-26.0.90, too – I also tried an empty
init.el…

>> Now to a mode with non-widening indentation function: emacs-lisp mode:
>> Consider the following code
>>      (defun foo ()
>>        (+ 1 3))
>>
>> I would assume that the indentation of line 2 does not change
>> when I narrow to line 2 - but Emacs-25.1.1 now deletes the first 2
>> spaces of line 2...  (yes; I also need to update to a newer Emacs)

> Try out the widen-less branch!

Ehem, still the same...

> And also, can we get your help with the manual? It still says:

> Examples include
>  @dfn{literate programming} source files that combine documentation and
>  snippets of source code, Yacc/Bison programs that include snippets of
>  plain C code, etc.  To correctly indent the embedded chunks, the primary
>  mode needs to delegate the indentation to another mode's indentation
>  engine (e.g., call @code{c-indent-defun} for C code or
>  @code{python-indent-line} for Python)

> I.e., it still mentions C and c-indent-defun (?). But c-indent-defun 
> does not work for embedded chunks (yet)!

> Can we replace that mentions with JS and js-indent-line, for instance? 
> Would that still make sense?

Yes, using `js-indent-line' is a better example.
`c-indent-line' (c-indent-defun looks like a typo) is tricky - see my
ugly function `antlr-indent-line' (but I have a TODO...)

P.S. I will probably "borrow" (aka "steal") from mhtml-mode.el later...




  reply	other threads:[~2017-12-18 12:39 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 15:48 [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls Wedler, Christoph
2017-12-16 15:00 ` Stefan Monnier
2017-12-16 17:34 ` Dmitry Gutov
2017-12-18 12:39   ` Wedler, Christoph [this message]
2017-12-18 14:50     ` Dmitry Gutov
2017-12-18 17:41       ` Wedler, Christoph
2017-12-19  0:27         ` Dmitry Gutov
2017-12-19 11:27           ` Wedler, Christoph
2017-12-20  0:07             ` Dmitry Gutov
     [not found] <20171129233237.27462.23351@vcs0.savannah.gnu.org>
     [not found] ` <20171129233238.504B5204F1@vcs0.savannah.gnu.org>
2017-11-30  1:53   ` Stefan Monnier
2017-11-30  8:59     ` Dmitry Gutov
2017-11-30 10:58       ` Dmitry Gutov
2017-11-30 15:31         ` Tom Tromey
2017-11-30 21:28           ` Dmitry Gutov
2017-11-30 21:46         ` Alan Mackenzie
2017-11-30 23:09           ` Dmitry Gutov
2017-12-01 15:49             ` Alan Mackenzie
2017-12-01 16:26               ` Stefan Monnier
2017-12-01 18:20                 ` Alan Mackenzie
2017-12-01 18:59                 ` Dmitry Gutov
2017-12-01 19:51                   ` Stefan Monnier
2017-12-01 20:50                     ` Dmitry Gutov
2017-12-02  2:24                       ` Stefan Monnier
2017-12-02 20:01                         ` Dmitry Gutov
2017-12-02 23:47                           ` Stefan Monnier
2017-12-03  3:38                             ` Eli Zaretskii
2017-12-03 23:43                               ` Dmitry Gutov
2017-12-04  3:38                                 ` Eli Zaretskii
2017-12-04 11:53                                   ` Dmitry Gutov
2017-12-04 16:41                                     ` Eli Zaretskii
2017-12-04 17:45                                       ` Stefan Monnier
2017-12-05  0:10                                       ` Dmitry Gutov
2017-12-03 16:42                             ` Dmitry Gutov
2017-12-03 21:23                               ` Stefan Monnier
2017-12-03 23:58                                 ` Dmitry Gutov
2017-12-01 17:06               ` Drew Adams
2017-12-01 18:03               ` Stefan Monnier
2017-12-01 21:27                 ` Vitalie Spinu
2017-12-01 21:38                   ` Dmitry Gutov
2017-12-01 22:45                 ` Alan Mackenzie
2017-12-02  2:53                   ` Stefan Monnier
2017-12-02 14:02                     ` Tom Tromey
2017-12-02 23:48                   ` Richard Stallman
2017-12-01 19:13               ` Dmitry Gutov
2017-12-01 22:35                 ` Alan Mackenzie
2017-12-01 23:24                   ` Dmitry Gutov
2017-12-02  2:47                     ` Stefan Monnier
2017-12-02 20:28                       ` Alan Mackenzie
2017-12-03  0:03                         ` Stefan Monnier
2017-12-03 12:18                           ` Alan Mackenzie
2017-12-03 16:02                             ` Dmitry Gutov
2017-12-03  3:52                         ` Dmitry Gutov
2017-12-03 14:54                           ` Alan Mackenzie
2017-12-03 18:40                             ` Stefan Monnier
2017-12-03 22:26                               ` Alan Mackenzie
2017-12-03 23:42                                 ` Stefan Monnier
2017-12-03 23:53                             ` Dmitry Gutov
2017-12-02  8:27                     ` Eli Zaretskii
2017-12-02 10:50                       ` Dmitry Gutov
2017-12-02 11:10                         ` Eli Zaretskii
2017-12-02 16:41                           ` Stefan Monnier
2017-12-02 17:13                             ` Eli Zaretskii
2017-12-02 17:53                               ` Stefan Monnier
2017-12-02 18:33                                 ` Eli Zaretskii
2017-12-02 20:18                               ` Dmitry Gutov
2017-12-02 20:14                           ` Dmitry Gutov
2017-12-02 20:58                             ` Eli Zaretskii
2017-12-02 21:35                               ` Dmitry Gutov
2017-12-03 15:28                                 ` Eli Zaretskii
2017-12-03 16:35                                   ` Dmitry Gutov
2017-12-03 17:20                                     ` Eli Zaretskii
2017-12-03 19:43                                       ` Dmitry Gutov
2017-12-04 15:52                                         ` Eli Zaretskii
2017-12-04 16:35                                           ` Stefan Monnier
2017-12-04 16:56                                             ` Eli Zaretskii
2017-12-04 22:57                                               ` Dmitry Gutov
2017-12-04 23:27                                           ` Dmitry Gutov
2017-12-03 18:59                                     ` Alan Mackenzie
2017-12-03 19:25                                       ` Eli Zaretskii
2017-12-03 21:20                                         ` Alan Mackenzie
2017-12-04 16:10                                           ` Eli Zaretskii
2017-12-04 16:23                                             ` Alan Mackenzie
2017-12-04 16:48                                               ` Eli Zaretskii
2017-12-03 22:01                                       ` Stefan Monnier
2017-12-04  0:37                                       ` Dmitry Gutov
2017-12-04 15:52                                         ` Alan Mackenzie
2017-12-04 16:46                                           ` Eli Zaretskii
2017-12-05 13:08                                           ` Dmitry Gutov
2017-12-03 21:52                                   ` Stefan Monnier
2017-12-04  0:03                                     ` Dmitry Gutov
2017-12-04 16:12                                     ` Eli Zaretskii
2017-12-04 16:49                                       ` Stefan Monnier
2017-12-04 17:28                                         ` Eli Zaretskii
2017-12-04 21:52                                           ` Dmitry Gutov
2017-12-05  5:08                                             ` Eli Zaretskii
2017-12-05  5:33                                               ` Eli Zaretskii
2017-12-05 10:55                                                 ` Dmitry Gutov
2017-12-05 17:53                                                   ` Eli Zaretskii
2017-12-05 18:40                                                     ` Dmitry Gutov
2017-12-05 20:49                                                       ` Eli Zaretskii
2017-12-05 23:16                                                         ` Dmitry Gutov
2017-12-06  9:28                                                           ` Eli Zaretskii
2017-12-06 13:36                                                             ` Dmitry Gutov
2017-12-08 16:41                                                               ` Eli Zaretskii
2017-12-09 15:17                                                                 ` Dmitry Gutov
2017-12-09 15:43                                                                   ` Eli Zaretskii
2017-12-10 19:59                                                                     ` Dmitry Gutov
2017-12-10 20:04                                                                       ` Eli Zaretskii
2017-12-05 12:55                                               ` Dmitry Gutov
2017-12-05 17:57                                                 ` Eli Zaretskii
2017-12-05 18:54                                                   ` Dmitry Gutov
2017-12-05 20:48                                                     ` Eli Zaretskii
2017-12-05 21:08                                                       ` Ingo Lohmar
2017-12-06  9:26                                                         ` Eli Zaretskii
2017-12-06 13:37                                                       ` Dmitry Gutov

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=578E6C44-1D80-42BF-91A2-94C44355A1D8@sap.com \
    --to=christoph.wedler@sap.com \
    --cc=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --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 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).