all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pretty-layout in html-mode
@ 2009-05-12  9:28 Chris Withers
  2009-05-12  9:58 ` ken
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-12  9:28 UTC (permalink / raw
  To: Emacs Help

Hi All,

In html-mode, how can I get the html layed out out sensibly?
(ie: I'm starting off with a file that has weird tabbing, spacing, etc, 
all over the place and I want it all normalised)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




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

* Re: pretty-layout in html-mode
  2009-05-12  9:28 pretty-layout in html-mode Chris Withers
@ 2009-05-12  9:58 ` ken
  2009-05-12  9:59   ` Chris Withers
       [not found]   ` <mailman.7055.1242122394.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: ken @ 2009-05-12  9:58 UTC (permalink / raw
  To: Chris Withers; +Cc: Emacs Help


On 05/12/2009 05:28 AM Chris Withers wrote:
> Hi All,
> 
> In html-mode, how can I get the html layed out out sensibly?
> (ie: I'm starting off with a file that has weird tabbing, spacing, etc,
> all over the place and I want it all normalised)
> ....

Using html-helper-mode, doing C-i properly indents the current line.  So
 in such files I start with the point on the first line, do C-i, then do
the same on the second line, and so on.  This of course doesn't work if
all the html code is on one line.  The tags and text you want to indent
properly must lie at the beginning of a new line (optionally with some
white space preceding it); that is, C-i won't insert newlines at proper
locations.  ("Proper location" is not an objective determination
anyway.)  But html-helper-mode does understand opening and closing tags
and (normally) indents these at the same level.

hth,
ken





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

* Re: pretty-layout in html-mode
  2009-05-12  9:58 ` ken
@ 2009-05-12  9:59   ` Chris Withers
  2009-05-12 11:03     ` tomas
       [not found]   ` <mailman.7055.1242122394.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-12  9:59 UTC (permalink / raw
  To: gebser; +Cc: Emacs Help

ken wrote:
> Using html-helper-mode, doing C-i properly indents the current line.  So
>  in such files I start with the point on the first line, do C-i, then do
> the same on the second line, and so on.  This of course doesn't work if
> all the html code is on one line.  The tags and text you want to indent
> properly must lie at the beginning of a new line (optionally with some
> white space preceding it); that is, C-i won't insert newlines at proper
> locations.  ("Proper location" is not an objective determination
> anyway.)  But html-helper-mode does understand opening and closing tags
> and (normally) indents these at the same level.

Thanks, but I'm looking for something more like:
- select region
- M-x unsuck-html-layout

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




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

* Re: pretty-layout in html-mode
       [not found]   ` <mailman.7055.1242122394.31690.help-gnu-emacs@gnu.org>
@ 2009-05-12 10:02     ` Anselm Helbig
  0 siblings, 0 replies; 8+ messages in thread
From: Anselm Helbig @ 2009-05-12 10:02 UTC (permalink / raw
  To: help-gnu-emacs

At Tue, 12 May 2009 10:59:57 +0100,
Chris Withers <chris@simplistix.co.uk> wrote:
> 
> ken wrote:
> > Using html-helper-mode, doing C-i properly indents the current line.  So
> >  in such files I start with the point on the first line, do C-i, then do
> > the same on the second line, and so on.  This of course doesn't work if
> > all the html code is on one line.  The tags and text you want to indent
> > properly must lie at the beginning of a new line (optionally with some
> > white space preceding it); that is, C-i won't insert newlines at proper
> > locations.  ("Proper location" is not an objective determination
> > anyway.)  But html-helper-mode does understand opening and closing tags
> > and (normally) indents these at the same level.
> 
> Thanks, but I'm looking for something more like:
> - select region
> - M-x unsuck-html-layout

You're looking for `indent-region' which is bound to C-M-\. I'm using
it with html-mode, works great. 

Regards, 

Anselm


-- 
Anselm Helbig 
mailto:anselm.helbig+news2009@googlemail.com


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

* Re: pretty-layout in html-mode
  2009-05-12 11:03     ` tomas
@ 2009-05-12 10:57       ` Chris Withers
  2009-05-12 11:14         ` tomas
       [not found]       ` <mailman.7058.1242125860.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Withers @ 2009-05-12 10:57 UTC (permalink / raw
  To: tomas; +Cc: Emacs Help

tomas@tuxteam.de wrote:
> I don't know at the moment how to pipe a region through an external
> process, but that should be feasible. Xmllint does a nice job at what
> you are trying:
> 
>   xmllint --html --format <your html file here>
> 
> Maybe others could chime in as to how one could pass the region (or the
> whole buffer) through an external program?

I'm hoping for something internal to emacs as, for tedious but 
unchangeable reasons, I'm stuck running on Windows...

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




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

* Re: pretty-layout in html-mode
  2009-05-12  9:59   ` Chris Withers
@ 2009-05-12 11:03     ` tomas
  2009-05-12 10:57       ` Chris Withers
       [not found]       ` <mailman.7058.1242125860.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: tomas @ 2009-05-12 11:03 UTC (permalink / raw
  To: Chris Withers; +Cc: Emacs Help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, May 12, 2009 at 10:59:57AM +0100, Chris Withers wrote:
> ken wrote:
>> Using html-helper-mode, doing C-i properly indents the current line.  So

[...]

> Thanks, but I'm looking for something more like:
> - select region
> - M-x unsuck-html-layout

I don't know at the moment how to pipe a region through an external
process, but that should be feasible. Xmllint does a nice job at what
you are trying:

  xmllint --html --format <your html file here>

Maybe others could chime in as to how one could pass the region (or the
whole buffer) through an external program?

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKCVeMBcgs9XrR2kYRAv7LAJkBcCi4I9bYb44uDjlE8hEmq6dnUwCdFlYZ
iPfIze+fKOzPo7ddCEOddn4=
=sc2q
-----END PGP SIGNATURE-----




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

* Re: pretty-layout in html-mode
  2009-05-12 10:57       ` Chris Withers
@ 2009-05-12 11:14         ` tomas
  0 siblings, 0 replies; 8+ messages in thread
From: tomas @ 2009-05-12 11:14 UTC (permalink / raw
  To: Chris Withers; +Cc: Emacs Help

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, May 12, 2009 at 11:57:42AM +0100, Chris Withers wrote:
> tomas@tuxteam.de wrote:
>> [external process mumbo jumbo]

> I'm hoping for something internal to emacs

As Anselm pointed out upthread, indent-region might work for you. Alas,
it doesn't take apart long lines. 

>                                             as, for tedious but unchangeable 
> reasons, I'm stuck running on Windows...

You have my most sincere condolences.

(but: xmllint, part of the libxml2 suite should be available on Windows)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKCVoDBcgs9XrR2kYRAjOCAJ92+wHyAoY65/TWlt3al96gKTeWDwCfartG
iLxeq4pPsIt0c/Ma4z/okZ0=
=KoY8
-----END PGP SIGNATURE-----




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

* Re: pretty-layout in html-mode
       [not found]       ` <mailman.7058.1242125860.31690.help-gnu-emacs@gnu.org>
@ 2009-05-12 14:58         ` B. T. Raven
  0 siblings, 0 replies; 8+ messages in thread
From: B. T. Raven @ 2009-05-12 14:58 UTC (permalink / raw
  To: help-gnu-emacs

Chris Withers wrote:
> tomas@tuxteam.de wrote:
>> I don't know at the moment how to pipe a region through an external
>> process, but that should be feasible. Xmllint does a nice job at what
>> you are trying:
>>
>>   xmllint --html --format <your html file here>
>>
>> Maybe others could chime in as to how one could pass the region (or the
>> whole buffer) through an external program?
> 
> I'm hoping for something internal to emacs as, for tedious but 
> unchangeable reasons, I'm stuck running on Windows...
> 
> Chris
> 

If the external program can be invoked as a standard filter then M-| 
(shell-command-on-region) might work. I ran it with sort and a sorted 
region was written to a new *Shell Command Output* buffer.

Ed


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

end of thread, other threads:[~2009-05-12 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12  9:28 pretty-layout in html-mode Chris Withers
2009-05-12  9:58 ` ken
2009-05-12  9:59   ` Chris Withers
2009-05-12 11:03     ` tomas
2009-05-12 10:57       ` Chris Withers
2009-05-12 11:14         ` tomas
     [not found]       ` <mailman.7058.1242125860.31690.help-gnu-emacs@gnu.org>
2009-05-12 14:58         ` B. T. Raven
     [not found]   ` <mailman.7055.1242122394.31690.help-gnu-emacs@gnu.org>
2009-05-12 10:02     ` Anselm Helbig

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.