From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Adam Hardy Newsgroups: gmane.emacs.help Subject: Re: xml sgml & psgml Date: Wed, 05 Feb 2003 14:39:31 +0100 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3E411413.4070208@cyberspaceroad.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1044452722 22393 80.91.224.249 (5 Feb 2003 13:45:22 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 5 Feb 2003 13:45:22 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18gPra-0005og-00 for ; Wed, 05 Feb 2003 14:45:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18gPsE-0007ap-07 for gnu-help-gnu-emacs@m.gmane.org; Wed, 05 Feb 2003 08:45:58 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18gPqi-00079n-00 for help-gnu-emacs@gnu.org; Wed, 05 Feb 2003 08:44:24 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18gPnO-00055E-00 for help-gnu-emacs@gnu.org; Wed, 05 Feb 2003 08:40:59 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.185]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18gPlM-0004fD-00 for help-gnu-emacs@gnu.org; Wed, 05 Feb 2003 08:38:53 -0500 Original-Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 18gPlM-00041s-00 for help-gnu-emacs@gnu.org; Wed, 05 Feb 2003 14:38:52 +0100 Original-Received: from [212.202.192.70] (helo=cyberspaceroad.com) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 18gPlM-0001w9-00 for help-gnu-emacs@gnu.org; Wed, 05 Feb 2003 14:38:52 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021202 X-Accept-Language: en-us, en Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6328 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6328 Kai Großjohann wrote: > Adam Hardy writes: > > >>I'm editing some xml files and I am having a few problems. I installed >>the latest version of psgml from sourceforge and put some config code >>in my .emacs but I am unable to get indentation to work. > > > Often, it helps to (setq sgml-indent-data t), but you don't give > enough information to see whether it will help. I don't have that in my .emacs - but adding it makes it work. I don't suppose it's got electric support? How did you find out about that? I found what I found through searching with google. Reading the lisp code was too difficult at my level of understanding to serve as documentation. To answer another of my original questions, would the following .emacs config enable psgml? And can I do anything to test whether this psgml is enabled? ;;; Set up PSGML ; Add PSGML to load-path so Emacs can find it. ; Note the forward slashes in the path... this is platform-independent so I ; would suggest using them over back slashes. If you use back slashes, they ; MUST BE doubled, as Emacs treats backslash as an escape character. (setq load-path (append (list nil "/usr/share/emacs/21.2/lisp/psgml-1.3.1") load-path)) ; Use PSGML for sgml and xml major modes. (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) (autoload 'xml-mode "psgml" "Major mode to edit XML files." t) ;;; Set up file-extension/mode associations. ; Note that I use xml-mode for html... that's because i'm writing ; XHTML and I want my html to conform to XML. (setq auto-mode-alist (append '( ("\\.sgml" . sgml-mode) ("\\.idd" . sgml-mode) ("\\.ide" . sgml-mode) ("\\.htm" . xml-mode) ("\\.html" . xml-mode) ("\\.xml" . xml-mode) ("\\.xsl" . xml-mode) ("\\.fo" . xml-mode) ) auto-mode-alist ) ) ;;; Set up and enable syntax coloring. ; Create faces to assign markup categories. (make-face 'sgml-doctype-face) (make-face 'sgml-pi-face) (make-face 'sgml-comment-face) (make-face 'sgml-sgml-face) (make-face 'sgml-start-tag-face) (make-face 'sgml-end-tag-face) (make-face 'sgml-entity-face) ; Assign attributes to faces. Background of white assumed. (set-face-foreground 'sgml-doctype-face "blue1") (set-face-foreground 'sgml-sgml-face "cyan1") (set-face-foreground 'sgml-pi-face "magenta") (set-face-foreground 'sgml-comment-face "purple") (set-face-foreground 'sgml-start-tag-face "Red") (set-face-foreground 'sgml-end-tag-face "Red") (set-face-foreground 'sgml-entity-face "Blue") ; Assign faces to markup categories. (setq sgml-markup-faces '((doctype . sgml-doctype-face) (pi . sgml-pi-face) (comment . sgml-comment-face) (sgml . sgml-sgml-face) (comment . sgml-comment-face) (start-tag . sgml-start-tag-face) (end-tag . sgml-end-tag-face) (entity . sgml-entity-face))) ; PSGML - enable face settings (setq sgml-set-face t) ; Auto-activate parsing the DTD when a document is loaded. ; If this isn't enabled, syntax coloring won't take affect until ; you manually invoke "DTD->Parse DTD" (setq sgml-auto-activate-dtd t) ;;; Set up my "DTD->Insert DTD" menu. ;(setq sgml-custom-dtd ' ; ( ; ( "XHTML 1.0 Transitional" ; "\n" ) ; ( "XHTML 1.0 Frameset" ; "\n" ) ; I use XHTML now! ; ( "HTML 4.01 Transitional" ; "" ) ; ( "HTML 4.01 Strict" ; "" ) ; ( "HTML 4.01 Frameset" ; "" ) ; ) ;) ; From Lennart Staflin - re-enabling launch of browser (from original HTML mode) (defun my-psgml-hook () (local-set-key "\C-c\C-b" 'browse-url-of-buffer) ) (add-hook 'sgml-mode-hook 'my-psgml-hook)