unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Easier way to edit a splitted long string
@ 2013-10-03 22:55 Lele Gaifax
  0 siblings, 0 replies; 6+ messages in thread
From: Lele Gaifax @ 2013-10-03 22:55 UTC (permalink / raw)
  To: help-gnu-emacs

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} &mdash; {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} &mdash; {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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-15  7:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2014-04-14 23:43     ` How can avoid "assignment to free variable" warning? Lele Gaifax
2014-04-14 23:50       ` Stefan Monnier
2014-04-15  7:45         ` Lele Gaifax
2013-10-03 22:55 Easier way to edit a splitted long string Lele Gaifax

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).