unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* recommended html modes
@ 2012-03-21  7:39 prad
  2012-03-21 12:19 ` XeCycle
  0 siblings, 1 reply; 8+ messages in thread
From: prad @ 2012-03-21  7:39 UTC (permalink / raw)
  To: help-gnu-emacs

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




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

* Re: recommended html modes
  2012-03-21  7:39 recommended html modes prad
@ 2012-03-21 12:19 ` XeCycle
  2012-03-21 20:50   ` prad
  0 siblings, 1 reply; 8+ messages in thread
From: XeCycle @ 2012-03-21 12:19 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

prad <prad@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

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

* Re: recommended html modes
  2012-03-21 12:19 ` XeCycle
@ 2012-03-21 20:50   ` prad
  2012-03-21 23:13     ` PJ Weisberg
  0 siblings, 1 reply; 8+ messages in thread
From: prad @ 2012-03-21 20:50 UTC (permalink / raw)
  To: help-gnu-emacs

XeCycle <XeCycle@Gmail.com> writes:

> prad <prad@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




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

* Re: recommended html modes
  2012-03-21 20:50   ` prad
@ 2012-03-21 23:13     ` PJ Weisberg
  2012-03-22  0:43       ` prad
  0 siblings, 1 reply; 8+ messages in thread
From: PJ Weisberg @ 2012-03-21 23:13 UTC (permalink / raw)
  To: prad; +Cc: help-gnu-emacs

On Wed, Mar 21, 2012 at 1:50 PM, prad <prad@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.



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

* Re: recommended html modes
  2012-03-21 23:13     ` PJ Weisberg
@ 2012-03-22  0:43       ` prad
  2012-03-22  5:42         ` XeCycle
  0 siblings, 1 reply; 8+ messages in thread
From: prad @ 2012-03-22  0:43 UTC (permalink / raw)
  To: help-gnu-emacs

PJ Weisberg <pj@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




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

* Re: recommended html modes
  2012-03-22  0:43       ` prad
@ 2012-03-22  5:42         ` XeCycle
  2012-03-22 19:01           ` prad
  0 siblings, 1 reply; 8+ messages in thread
From: XeCycle @ 2012-03-22  5:42 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

prad <prad@towardsfreedom.com> writes:

> PJ Weisberg <pj@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>.

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

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

* Re: recommended html modes
  2012-03-22  5:42         ` XeCycle
@ 2012-03-22 19:01           ` prad
  2012-03-23 15:35             ` XeCycle
  0 siblings, 1 reply; 8+ messages in thread
From: prad @ 2012-03-22 19:01 UTC (permalink / raw)
  To: help-gnu-emacs

XeCycle <XeCycle@Gmail.com> writes:

> prad <prad@towardsfreedom.com> writes:
>
>> PJ Weisberg <pj@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




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

* Re: recommended html modes
  2012-03-22 19:01           ` prad
@ 2012-03-23 15:35             ` XeCycle
  0 siblings, 0 replies; 8+ messages in thread
From: XeCycle @ 2012-03-23 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]

prad <prad@towardsfreedom.com> writes:

> XeCycle <XeCycle@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.

[...]

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

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

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

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

end of thread, other threads:[~2012-03-23 15:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21  7:39 recommended html modes prad
2012-03-21 12:19 ` XeCycle
2012-03-21 20:50   ` prad
2012-03-21 23:13     ` PJ Weisberg
2012-03-22  0:43       ` prad
2012-03-22  5:42         ` XeCycle
2012-03-22 19:01           ` prad
2012-03-23 15:35             ` XeCycle

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