From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: prad Newsgroups: gmane.emacs.help Subject: Re: recommended html modes Date: Thu, 22 Mar 2012 12:01:20 -0700 Message-ID: <87bonompdr.fsf@psinom.home> References: <87r4wmpfmo.fsf@psinom.home> <873992no39.fsf@Gmail.com> <871uolptjx.fsf@psinom.home> <87obrpo479.fsf@psinom.home> <87k42dnqdb.fsf@Gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1332443429 23409 80.91.229.3 (22 Mar 2012 19:10:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 22 Mar 2012 19:10:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 22 20:10:25 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SAnOz-0003iu-6a for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Mar 2012 20:10:25 +0100 Original-Received: from localhost ([::1]:43347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAnOy-0004zp-GS for geh-help-gnu-emacs@m.gmane.org; Thu, 22 Mar 2012 15:10:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAnOs-0004yM-9o for help-gnu-emacs@gnu.org; Thu, 22 Mar 2012 15:10:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAnOl-000424-W5 for help-gnu-emacs@gnu.org; Thu, 22 Mar 2012 15:10:17 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAnOl-00041g-QC for help-gnu-emacs@gnu.org; Thu, 22 Mar 2012 15:10:11 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SAnOh-0003Y3-Kp for help-gnu-emacs@gnu.org; Thu, 22 Mar 2012 20:10:07 +0100 Original-Received: from s0106000acd1d509c.du.shawcable.net ([70.67.174.161]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Mar 2012 20:10:07 +0100 Original-Received: from prad by s0106000acd1d509c.du.shawcable.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Mar 2012 20:10:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: s0106000acd1d509c.du.shawcable.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:fWmP9HZErPxX5fdULHVfaSOE0eE= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84092 Archived-At: XeCycle writes: > prad writes: > >> PJ Weisberg 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

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

-> swap point > and mark -> insert

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