unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: xml sgml & psgml
@ 2003-02-05 13:39 Adam Hardy
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Hardy @ 2003-02-05 13:39 UTC (permalink / raw)


Kai Großjohann wrote:
 > Adam Hardy <emacs@cyberspaceroad.com> 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"
;         "<?xml version=\"1.0\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD 
XHTML 1.0 Transitional//EN\" \"xhtml1-transitional.dtd\">" )
;       ( "XHTML 1.0 Frameset"
;         "<?xml version=\"1.0\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD 
XHTML 1.0 Frameset//EN\" \"xhtml1-frameset.dtd\">" )
; I use XHTML now!
;       ( "HTML 4.01 Transitional"
;        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 
Transitional//EN\">" )
;       ( "HTML 4.01 Strict"
;        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">" )
;       ( "HTML 4.01 Frameset"
;        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">" )
;       )
;)

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <mailman.1437.1044444190.21513.help-gnu-emacs@gnu.org>]
* xml sgml & psgml
@ 2003-02-05 11:19 Adam Hardy
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Hardy @ 2003-02-05 11:19 UTC (permalink / raw)


Hi All,

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.

I also put the latest version of sgml.el in my lisp directory because I 
read on the archives here that it enables indents.

I'm not the world's most experienced lisp programmer so I'm not sure 
about the following:

does psgml disable the functionality in sgml.el or build on it ?

does the sgml.el code get loaded alright or do I have to do that in my 
.emacs ?

how can I tell whether I'm using psgml or just sgml code?

Can anyone help?

TIA
Adam

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

end of thread, other threads:[~2003-02-07 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1447.1044452744.21513.help-gnu-emacs@gnu.org>
2003-02-05 15:19 ` xml sgml & psgml Kai Großjohann
2003-02-05 16:09   ` Adam Hardy
     [not found]   ` <mailman.1473.1044463439.21513.help-gnu-emacs@gnu.org>
2003-02-06 13:37     ` Kai Großjohann
     [not found]       ` <3E42D6C8.5000806@cyberspaceroad.com>
2003-02-07 14:47         ` Kai Großjohann
2003-02-05 13:39 Adam Hardy
     [not found] <mailman.1437.1044444190.21513.help-gnu-emacs@gnu.org>
2003-02-05 12:54 ` Kai Großjohann
  -- strict thread matches above, loose matches on Subject: below --
2003-02-05 11:19 Adam Hardy

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