[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with co
From: |
Wedler, Christoph |
Subject: |
Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls |
Date: |
Fri, 15 Dec 2017 15:48:09 +0000 |
User-agent: |
Microsoft-MacOutlook/f.29.0.171205 |
Sorry for not having followed this discussion earlier - as the one who
has somehow introduced `prog-indentation-context', I probably should have...
If it works and you tell me how to do it, I have no issues with an
alternative way to make the indentation function of a "sub mode" work
for code chunks inside an "outer language" (like ANTLR grammar files).
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)
Now to the elements in `prog-indentation-context':
- FIRST-COLUMN: I understood that you want to keep (s/th like) that...
- (START . END) = the region of the code chunk: well, some indentation
engines got confused to see unknown code before code written in the
"sub-modes" - for some I could do `narrow-to-region' myself, other
engines did widen, like python. IMHO, modes with widening provide a
better indentation experience than those without, see below.
- PREVIOUS-CHUNKS: well, I was told to introduce this to be more
general... - some modes (like cc-mode) could be told that the code is
not some usual "top-level" code, but just some "normal statement".
(antlr-mode includes some ugly hack for cc-mode).
If all this is covered by a better way - fine with me! Even if does not cover
PREVIOUS-CHUNKS…
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)
- Christoph
P.S. antlr-mode 3.1.5 will have docstrings for all function and
variables - just the last 100 lines are missing. After that, I need to
adapt it to "the new way" and it could replace the very old antlr-mode
in Emacs (or move it to ELPA or whatever you like).
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Dmitry Gutov, 2017/12/01
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls,
Wedler, Christoph <=
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Stefan Monnier, 2017/12/16
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Dmitry Gutov, 2017/12/16
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Wedler, Christoph, 2017/12/18
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Dmitry Gutov, 2017/12/18
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Wedler, Christoph, 2017/12/18
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Dmitry Gutov, 2017/12/18
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Wedler, Christoph, 2017/12/19
- Re: [Emacs-diffs] scratch/widen-less a4ba846: Replace prog-widen with consolidating widen calls, Dmitry Gutov, 2017/12/19