From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: [PATCH] espresso-mode breaks on JSON input
Date: Sat, 12 Sep 2009 01:19:05 +0200 [thread overview]
Message-ID: <7b501d5c0909111619y192b2dccv79a2181c82438913@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
(N.B. I'm not sure if this patch belongs here.)
Using a buffer with the following contents (JSON), espresso-mode would
break telling me it expected a number or marker but got nil whenever I
tried to indent the region. I put together a patch which effectively
indents it correctly and doesn't report an error. It basically checks
that (char-before) is non-nil before comparing it to ?\).
[
{
"pk": 2,
"fields": {
"url": "http://abc.go.com/",
"name": "ABC"
}
}
]
Attached is the patch. I'm not sure about the format, but I hope it can be used.
--
Deniz Dogan
[-- Attachment #2: espresso-fix-json-indent-deniz.patch --]
[-- Type: application/octet-stream, Size: 762 bytes --]
diff -c /home/deniz/sources/espresso/espresso.el /home/deniz/.emacs.d/espresso.el
--- /home/deniz/sources/espresso/espresso.el 2009-09-12 01:08:12.000000000 +0200
+++ /home/deniz/.emacs.d/espresso.el 2009-09-12 01:09:13.000000000 +0200
@@ -1809,7 +1809,9 @@
(if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
(progn
(skip-syntax-backward " ")
- (when (= (char-before) ?\)) (backward-list))
+ (when (and (char-before)
+ (= (char-before) ?\)))
+ (backward-list))
(back-to-indentation)
(cond (same-indent-p
(current-column))
Diff finished. Sat Sep 12 01:09:22 2009
next reply other threads:[~2009-09-11 23:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 23:19 Deniz Dogan [this message]
2009-09-11 23:25 ` [PATCH] espresso-mode breaks on JSON input Daniel Colascione
2009-09-12 0:00 ` Chong Yidong
2009-09-12 4:18 ` 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=7b501d5c0909111619y192b2dccv79a2181c82438913@mail.gmail.com \
--to=deniz.a.m.dogan@gmail.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.