GNU bug report logs -
#27552
25.2.50; Indentation problem in rnc-mode
Previous Next
Reported by: Ivan Andrus <darthandrus <at> gmail.com>
Date: Sat, 1 Jul 2017 20:35:01 UTC
Severity: minor
Tags: moreinfo
Found in version 25.2.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27552 in the body.
You can then email your comments to 27552 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Sat, 01 Jul 2017 20:35:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ivan Andrus <darthandrus <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 01 Jul 2017 20:35:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The RNC snippet below (from
http://cs.brown.edu/courses/cs196-9/slidestore/relaxng.html) shows an
indentation problem when using multiple opening namespace/datatypes
clauses.
-Ivan
default namespace rng = "http://relaxng.org/ns/structure/1.0"
namespace local = ""
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
start = pattern
pattern =
element element { (nameQName | nameClass), (common & pattern+) }
| element attribute { (nameQName | nameClass), (common & pattern?) }
| element group|interleave|choice|optional
|zeroOrMore|oneOrMore|list|mixed { common & pattern+ }
| element ref|parentRef { nameNCName, common }
| element empty|notAllowed|text { common }
| element data { type, param*, (common & exceptPattern?) }
| element value { commonAttributes, type?, xsd:string }
| element externalRef { href, common }
| element grammar { common & grammarContent* }
In GNU Emacs 25.2.50.5 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1421))
of 2017-06-28 built on iandrus-osx
Repository revision: efe7a7f79f8eb9c716136561821d350b69456b55
Windowing system distributor 'Apple', version 10.3.1404
Configured using:
'configure --without-makeinfo PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig'
Configured features:
JPEG RSVG DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: RNC
Minor modes in effect:
achievements-mode: t
highlight-symbol-mode: t
which-function-mode: t
show-paren-mode: t
global-semantic-stickyfunc-mode: t
save-place-mode: t
msb-mode: t
minibuffer-depth-indicate-mode: t
gud-tooltip-mode: t
global-hl-line-mode: t
delete-selection-mode: t
guide-key-mode: t
auto-insert-mode: t
yas-global-mode: t
yas-minor-mode: t
ido-everywhere: t
beacon-mode: t
global-page-break-lines-mode: t
gvol-mode: t
diff-auto-refine-mode: t
magit-auto-revert-mode: t
global-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
shell-dirtrack-mode: t
TeX-PDF-mode: t
global-edit-server-edit-mode: t
auto-image-file-mode: t
desktop-save-mode: t
drag-stuff-global-mode: t
drag-stuff-mode: t
recentf-mode: t
global-anzu-mode: t
anzu-mode: t
keyfreq-autosave-mode: t
keyfreq-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Tue, 17 May 2022 19:26:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 27552 <at> debbugs.gnu.org (full text, mbox):
Ivan Andrus <darthandrus <at> gmail.com> writes:
> The RNC snippet below (from
> http://cs.brown.edu/courses/cs196-9/slidestore/relaxng.html) shows an
> indentation problem when using multiple opening namespace/datatypes
> clauses.
>
> -Ivan
>
> default namespace rng = "http://relaxng.org/ns/structure/1.0"
> namespace local = ""
> datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
>
> start = pattern
>
> pattern =
> element element { (nameQName | nameClass), (common & pattern+) }
> | element attribute { (nameQName | nameClass), (common & pattern?) }
> | element group|interleave|choice|optional
(defun rnc-smie-rules (kind token)
(pcase (cons kind token)
(`(:list-intro . "element") t)
(`(:elem . empty-line-token) " ; ")
(`(:before . ,(or "include" "default" "namespace" "datatypes")) 0)
[...]
(`(:after . ,(or "=" "|=" "&=")) smie-indent-basic)
I guess this "=" rule is for stuff like the "pattern =" etc. But it
leads to things like this being indented more for each line:
default namesace rng = "http://relaxng.org/ns/structure/1.0"
namespace local = ""
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
I betcha this is easy to express in smie, but I have no idea how, so
I've added Stefan to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 17 May 2022 19:26:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Wed, 15 Jun 2022 14:26:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 27552 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> I guess this "=" rule is for stuff like the "pattern =" etc. But it
> leads to things like this being indented more for each line:
>
> default namesace rng = "http://relaxng.org/ns/structure/1.0"
> namespace local = ""
> datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
Or... is the problem here that we don't end pattern with a newline?
Because the "assignment" ends at the newline in this case.
(smie-prec2->grammar
(smie-bnf->prec2
'((id) (atom) (args)
(header (header "include" atom))
(decls (id "=" pattern) (id "|=" pattern) (id "&=" pattern)
(decls " ; " decls))
(pattern ("element" args) ("attribute" args)
("list" args) ("mixed" args)
("parent" id) ("external" id)
("grammar" atom)
("{" pattern "}")
(pattern "," pattern)
(pattern "&" pattern)
(pattern "|" pattern)
(pattern "?")
(pattern "*")
(pattern "+")))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Wed, 15 Jun 2022 15:16:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 27552 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen [2022-06-15 16:25:29] wrote:
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> I guess this "=" rule is for stuff like the "pattern =" etc. But it
>> leads to things like this being indented more for each line:
>>
>> default namesace rng = "http://relaxng.org/ns/structure/1.0"
>> namespace local = ""
>> datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
Part of the problem is that the grammar we use is incorrect, so we
parse incorrectly, and we have to patch things up in the indentation
rules :-(
> Or... is the problem here that we don't end pattern with a newline?
Kind of, yes. There are various places where we could try and fix
this problem, but this might be the simplest, indeed.
I pushed the patch below which does that.
Stefan
diff --git a/rnc-mode.el b/rnc-mode.el
index 30f3c39970..33363d2057 100644
--- a/rnc-mode.el
+++ b/rnc-mode.el
@@ -1,6 +1,6 @@
;;; rnc-mode.el --- Emacs mode to edit Relax-NG Compact files -*- lexical-binding:t -*-
-;; Copyright (C) 1994-1998, 2001-2016 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2022 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
;; Keywords: xml relaxng
@@ -96,11 +96,18 @@
'((assoc "," "&" "|") (nonassoc "?" "*" "+"))
)))
+(defconst rnc-smie--def-regexp
+ (concat "\\(?:\\(?:namespace\\|datatypes\\)[ \t\n]+\\)?"
+ "\\(?:\\s_\\|\\sw\\)+[ \t\n]*[|&]?=")
+ "Regexp matching a \"definition\".
+Any line that starts with this is presumed to start a new definition,
+so the preceding newline is turned into an implicit \" ; \" token.")
+
(defun rnc-smie-forward-token ()
(let ((start (point)))
(forward-comment (point-max))
(if (and (> (point) start)
- (looking-at "\\(?:\\s_\\|\\sw\\)+[ \t\n]*[|&]?=")
+ (looking-at rnc-smie--def-regexp)
(save-excursion
(goto-char start)
(forward-comment -1)
@@ -120,7 +127,7 @@
(let ((pos (point)))
(goto-char start)
(prog1
- (looking-at "\\(?:\\s_\\|\\sw\\)+[ \t\n]*[|&]?=")
+ (looking-at rnc-smie--def-regexp)
(goto-char pos))))
" ; "
(if (looking-back "\\s." (1- (point)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Wed, 15 Jun 2022 15:58:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 27552 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Kind of, yes. There are various places where we could try and fix
> this problem, but this might be the simplest, indeed.
> I pushed the patch below which does that.
Thanks; I can confirm that that fixes this issue, so I'm closing this
bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 29.1, send any further explanations to
27552 <at> debbugs.gnu.org and Ivan Andrus <darthandrus <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 15 Jun 2022 15:58:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Sat, 02 Jul 2022 20:45:02 GMT)
Full text and
rfc822 format available.
Message #24 received at 27552 <at> debbugs.gnu.org (full text, mbox):
First off, thank you very much for fixing this!
I noticed, however, that it's not updated in ELPA because the version wasn't updated. Then I was going to check out the GNU ELPA repository and maybe try bumping the version myself, but I failed (tried several times):
$ git clone git://git.sv.gnu.org/emacs/elpaa
Cloning into 'elpa'...
remote: Counting objects: 420700, done.
remote: Compressing objects: 100% (122372/122372), done.
warning: object 40b50e2bcb5b674697e3e2a41627564f810880c4: gitignoreSymlink: .gitignore is a symlink
warning: object da777249505761d5c51406d4a0d268629f146f8e: gitignoreSymlink: .gitignore is a symlink
warning: object fa73f7d32f618bd46247364932cac8aa591ed8b9: gitignoreSymlink: .gitignore is a symlink
warning: object 6bca01e6638f0e92ce277c1497c8f1175236315a: gitignoreSymlink: .gitignore is a symlink
warning: object 4246bb45961f0e8ed4ccb123648d55a2f043524c: gitignoreSymlink: .gitignore is a symlink
error: object 2699d230e3b592ae42506d7b5c969a7ac6a4593c: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
fatal: fetch-pack: invalid index-pack output
But that's a separate issue, I'll probably bring it up on Emacs devel, but I thought I actually send this email before I forget a second time. :)
-Ivan
> On Jun 15, 2022, at 09:56, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>> Kind of, yes. There are various places where we could try and fix
>> this problem, but this might be the simplest, indeed.
>> I pushed the patch below which does that.
>
> Thanks; I can confirm that that fixes this issue, so I'm closing this
> bug report.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27552
; Package
emacs
.
(Sat, 02 Jul 2022 21:38:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 27552 <at> debbugs.gnu.org (full text, mbox):
> $ git clone git://git.sv.gnu.org/emacs/elpaa
`elpa.git` is fairly large, you don't want to clone all of it just for
`rnc-mode`. Try something like:
git clone --single-branch git://git.sv.gnu.org/emacs/elpa
cd elpa
make # Initial setup, only needed once.
make packages/rnc-mode # Fetches rnc-mode and sets it up.
make packages/rnc-mode # Generate autoloads, <foo>-pkg,el, and compile.
-- Stefan
> Cloning into 'elpa'...
> remote: Counting objects: 420700, done.
> remote: Compressing objects: 100% (122372/122372), done.
> warning: object 40b50e2bcb5b674697e3e2a41627564f810880c4: gitignoreSymlink: .gitignore is a symlink
> warning: object da777249505761d5c51406d4a0d268629f146f8e: gitignoreSymlink: .gitignore is a symlink
> warning: object fa73f7d32f618bd46247364932cac8aa591ed8b9: gitignoreSymlink: .gitignore is a symlink
> warning: object 6bca01e6638f0e92ce277c1497c8f1175236315a: gitignoreSymlink: .gitignore is a symlink
> warning: object 4246bb45961f0e8ed4ccb123648d55a2f043524c: gitignoreSymlink: .gitignore is a symlink
> error: object 2699d230e3b592ae42506d7b5c969a7ac6a4593c: zeroPaddedFilemode:
> contains zero-padded file modes
> fatal: fsck error in packed object
> fatal: fetch-pack: invalid index-pack output
If you do want to clone it all, then I think you'll need
[fetch "fsck"]
zeroPaddedFilemode = warn
in your `~/.gitconfig` because we were unlucky to have some entries in
our Git history (generated by some earlier version of Git) which Git
later decided should use a different format. IIRC we had that in our
old `master` branch which should be gone now, but since then we
inherited some other occurrence of the problem from the history of
some package.
I bumped the version so a new 0.3 should appear soonish, tho.
Stefan
> But that's a separate issue, I'll probably bring it up on Emacs devel, but
> I thought I actually send this email before I forget a second time. :)
>
> -Ivan
>
>> On Jun 15, 2022, at 09:56, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>>
>> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>>
>>> Kind of, yes. There are various places where we could try and fix
>>> this problem, but this might be the simplest, indeed.
>>> I pushed the patch below which does that.
>>
>> Thanks; I can confirm that that fixes this issue, so I'm closing this
>> bug report.
>>
>> --
>> (domestic pets only, the antidote for overdose, milk.)
>> bloggy blog: http://lars.ingebrigtsen.no
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 31 Jul 2022 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.