Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

recommended html modes

7 views
Skip to first unread message

prad

unread,
Mar 21, 2012, 3:39:11 AM3/21/12
to help-gn...@gnu.org
i'm using html-helper-mode and it is good, though it doesn't seem to be
able to do xhtml.

is there a recommended mode to use to do xhtml.

i tried nxhtml-mode about a year ago and it wreaked havoc with my system
for some reason.

--
in friendship,
prad


XeCycle

unread,
Mar 21, 2012, 8:19:22 AM3/21/12
to help-gn...@gnu.org
prad <pr...@towardsfreedom.com> writes:

> i'm using html-helper-mode and it is good, though it doesn't seem to be
> able to do xhtml.
>
> is there a recommended mode to use to do xhtml.
>
> i tried nxhtml-mode about a year ago and it wreaked havoc with my system
> for some reason.

nxhtml is the best one I've tried. If you cannot use it (like I
am) you can try some parts of it along with the built-in nxml
mode. I use PHP mode from nxhtml with nxml, and use
multi-web-mode to tie them together. multi-web-mode is buggy,
but can work anyway. After all, be sure to use nxml mode.

--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591

prad

unread,
Mar 21, 2012, 4:50:42 PM3/21/12
to help-gn...@gnu.org
XeCycle <XeC...@Gmail.com> writes:

> prad <pr...@towardsfreedom.com> writes:
>
>> i'm using html-helper-mode and it is good, though it doesn't seem to be
>> able to do xhtml.
>>
>> is there a recommended mode to use to do xhtml.
>>
>> i tried nxhtml-mode about a year ago and it wreaked havoc with my system
>> for some reason.
>
> nxhtml is the best one I've tried. If you cannot use it (like I
> am) you can try some parts of it along with the built-in nxml
> mode. I use PHP mode from nxhtml with nxml, and use
> multi-web-mode to tie them together. multi-web-mode is buggy,
> but can work anyway. After all, be sure to use nxml mode.
>
ok i can't get nxhtml mode to work, but i've been diddling around with
nxml mode and i like it! i've been looking through this doc:
http://www.gnu.org/software/emacs/manual/html_mono/nxml-mode.html

it's similar to the old html-mode in some ways, but much better!

now, i need to figure out how to stop html-helper-mode from taking over
when i open an html file, so i can jump right into nxml-mode. haven't
done much of that sort of thing.

thx for your help!

--
in friendship,
prad


PJ Weisberg

unread,
Mar 21, 2012, 7:13:48 PM3/21/12
to prad, help-gn...@gnu.org
On Wed, Mar 21, 2012 at 1:50 PM, prad <pr...@towardsfreedom.com> wrote:

> now, i need to figure out how to stop html-helper-mode from taking over
> when i open an html file, so i can jump right into nxml-mode. haven't
> done much of that sort of thing.

(push '("\\.s?html?$" . nxml-mode) auto-mode-alist)

Cheers!

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.

prad

unread,
Mar 21, 2012, 8:43:38 PM3/21/12
to help-gn...@gnu.org
PJ Weisberg <p...@irregularexpressions.net> writes:

> (push '("\\.s?html?$" . nxml-mode) auto-mode-alist)
>
hey thx pj!
never knew about auto-mode-alist!
(i thought you'd have to use hooks or something, but i never explored it.)

a quick question about nxml mode.

if i want to surround a paragraph with <p></p> is there a mechanism for
selecting the paragraph and enclosing it (eg M-ret does this in
html-helper-mode). i haven't been able to find something like this in
any of the docs on nxml i've come across so far.

--
in friendship,
prad


XeCycle

unread,
Mar 22, 2012, 1:42:24 AM3/22/12
to help-gn...@gnu.org
prad <pr...@towardsfreedom.com> writes:

> PJ Weisberg <p...@irregularexpressions.net> writes:
>
>> (push '("\\.s?html?$" . nxml-mode) auto-mode-alist)
>>
> hey thx pj!
> never knew about auto-mode-alist!
> (i thought you'd have to use hooks or something, but i never explored it.)

A more robust way is to use add-to-list 'auto-mode-alist.

> a quick question about nxml mode.
>
> if i want to surround a paragraph with <p></p> is there a mechanism for
> selecting the paragraph and enclosing it (eg M-ret does this in
> html-helper-mode). i haven't been able to find something like this in
> any of the docs on nxml i've come across so far.

Don't think it's provided, but it should be easy to write one.
It's just about marking the paragraph, insert <p> -> swap point
and mark -> insert </p>.

prad

unread,
Mar 22, 2012, 3:01:20 PM3/22/12
to help-gn...@gnu.org
XeCycle <XeC...@Gmail.com> writes:

> prad <pr...@towardsfreedom.com> writes:
>
>> PJ Weisberg <p...@irregularexpressions.net> writes:
>>
>>> (push '("\\.s?html?$" . nxml-mode) auto-mode-alist)
>>>
>> hey thx pj! never knew about auto-mode-alist! (i thought you'd have
>> to use hooks or something, but i never explored it.)
>
> A more robust way is to use add-to-list 'auto-mode-alist.
>
ok thx carl!
i did it that way.


>> a quick question about nxml mode.
>>
>> if i want to surround a paragraph with <p></p> is there a mechanism for
>> selecting the paragraph and enclosing it (eg M-ret does this in
>> html-helper-mode). i haven't been able to find something like this in
>> any of the docs on nxml i've come across so far.
>
> Don't think it's provided, but it should be easy to write one.
> It's just about marking the paragraph, insert <p> -> swap point
> and mark -> insert </p>.
>
inspired by your above comment, i gave this a shot - figured i'd better start learning elisp. :D

i don't know much about interactive etc, but i found the ref manual and
the gnu tutorial.

here's what i got and it does work (though i don't know if it is a good
way or not):

;; region wrapping with tag functions

(defun tag-enclose (tag)
"encloses region with inputted tag"
(interactive "sTag: ")
(wrap-with-tags))

(defun wrap-with-tags ()
"builds html tags from tag then wraps region"
(interactive)
(let* ((begend (region-parameters))
(beg (car begend))
(end (cadr begend))
(tagbeg (format "<%s>" tag))
(tagend (format "</%s>" tag)))
(goto-char end)
(insert tagend)
(goto-char beg)
(insert tagbeg)))

(defun region-parameters ()
"gets region beg and end"
(interactive)
(list (region-beginning) (region-end)))


i didn't do your swap idea because i haven't found that function yet.

however, i realized that i had to put the end tag on first, because as
soon as i do the beg tag, the positions all shift forward and my end
position isn't what it is supposed to be anymore. :D

--
in friendship,
prad


XeCycle

unread,
Mar 23, 2012, 11:35:34 AM3/23/12
to help-gn...@gnu.org
prad <pr...@towardsfreedom.com> writes:

> XeCycle <XeC...@Gmail.com> writes:

[...]

>> A more robust way is to use add-to-list 'auto-mode-alist.
>>
> ok thx carl!
> i did it that way.

Never mind.

[...]
Well, if you're curious, that's already bound to C-x C-x.

> however, i realized that i had to put the end tag on first,
> because as
> soon as i do the beg tag, the positions all shift forward and my
> end
> position isn't what it is supposed to be anymore. :D

The active region is always between the point and (active) mark.
When you insert text all marks after the point will be
automatically shifted accordingly. So I suggest using the point
and mark. Also you can have a look at (save-excursion
(save-restriction ...)).
0 new messages