From: Lele Gaifax <lele@metapensiero.it>
To: help-gnu-emacs@gnu.org
Subject: Easier way to edit a splitted long string
Date: Fri, 04 Oct 2013 00:55:16 +0200 [thread overview]
Message-ID: <87vc1eufqj.fsf@nautilus.nautilus> (raw)
Hi all,
I'm looking for an easier way to edit a "template", that is a long
string representing a "prototype" text used to generate an HTML page,
contained in JavaScript source.
As an brief example, consider the following piece of code:
{
xtype: 'container',
itemId: 'header',
tpl: [
'<div class="header">',
' <div class="top">',
' <div class="profession">{profession}</div>',
' <span class="fullname">{fullname}</span>',
' <span class="location">{city} — {country}</span>',
' <span class="state">{state_label}</span>',
' </div>',
'</div>'
],
layout: {
type: 'hbox'
}
},
As you can see, the template is just a JS array of strings, one for each
line: before use, all the strings are "joined" (that is, concatenated)
together into a single big one.
As you may imagine, editing the template as is is very boring!
Today, chatting with a friend about it, I had a flashback about some
Emacs mode I used very long ago which I'm not able to find: it allowed
to edit long C comments in a recursive edit, "stripping" away the "box"
decoration (or just the start-comment and end-comment markers) as well
as the text indentation on enter, and restoring the same kind of
decoration on exit.
Applied to my case, that would mean entering into a recursive edit
buffer with the following content:
<div class="header">
<div class="top">
<div class="profession">{profession}</div>
<span class="fullname">{fullname}</span>
<span class="location">{city} — {country}</span>
<span class="state">{state_label}</span>
</div>
</div>
It does not seem so difficult to achieve (even for an elisp newbie as I
am) and I could give it a try, but I wonder if something similar already
exists.
Any hint will be very appreciated,
thanks a lot,
bye, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it | -- Fortunato Depero, 1929.
next reply other threads:[~2013-10-03 22:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 22:55 Lele Gaifax [this message]
[not found] <mailman.3359.1380840943.10748.help-gnu-emacs@gnu.org>
2013-10-04 21:55 ` Easier way to edit a splitted long string Pascal J. Bourguignon
2014-04-12 23:21 ` Lele Gaifax
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=87vc1eufqj.fsf@nautilus.nautilus \
--to=lele@metapensiero.it \
--cc=help-gnu-emacs@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.
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).