unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 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

* Re: xml sgml & psgml
       [not found] <mailman.1437.1044444190.21513.help-gnu-emacs@gnu.org>
@ 2003-02-05 12:54 ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-02-05 12:54 UTC (permalink / raw)


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.
-- 
A turnip curses Elvis

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

* 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

* Re: xml sgml & psgml
       [not found] <mailman.1447.1044452744.21513.help-gnu-emacs@gnu.org>
@ 2003-02-05 15:19 ` Kai Großjohann
  2003-02-05 16:09   ` Adam Hardy
       [not found]   ` <mailman.1473.1044463439.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-02-05 15:19 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> I don't have that in my .emacs - but adding it makes it work.

Great.

> I don't suppose it's got electric support?

Non sequitur?  What's "it"?  What do you mean by electric?

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

I highly recommend reading the documentation :-)

For example, C-h v sgml- TAB TAB gives you a list of related
variables, choosing one of them with completion will show you the
documentation for that variable.

Also, psgml has an info file which describes lots of stuff.  Just hit
C-h i d, then look for the PSGML line.  (If you have installed it
correctly.)

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

The config looks okay (except for the load-path frobbing which looks
really weird).  You can look in the menu bar, if there are menu items
Markup, SGML, and DTD, then you should be fine.
-- 
A turnip curses Elvis

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

* Re: xml sgml & psgml
  2003-02-05 15:19 ` Kai Großjohann
@ 2003-02-05 16:09   ` Adam Hardy
       [not found]   ` <mailman.1473.1044463439.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Adam Hardy @ 2003-02-05 16:09 UTC (permalink / raw)


Kai Großjohann wrote:
>>I don't suppose it's got electric support?
> 
> 
> Non sequitur?  What's "it"?  What do you mean by electric?

electric characters are particular characters which cause indentation to 
happen as soon as you type them, ie. < or / or >

This is in C and Java mode.

> Also, psgml has an info file which describes lots of stuff.  Just hit
> C-h i d, then look for the PSGML line.  (If you have installed it
> correctly.)

excellent. Just what I was looking for. Never had a clue it was there!

> The config looks okay (except for the load-path frobbing which looks
> really weird).  You can look in the menu bar, if there are menu items
> Markup, SGML, and DTD, then you should be fine.

load-path frobbing? What's frobbing? Sounds like hitting it with a dead 
rabbit!

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

* Re: xml sgml & psgml
       [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>
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Großjohann @ 2003-02-06 13:37 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> Kai Großjohann wrote:
>>>I don't suppose it's got electric support?
>> Non sequitur?  What's "it"?  What do you mean by electric?
>
> electric characters are particular characters which cause indentation
> to happen as soon as you type them, ie. < or / or >
>
> This is in C and Java mode.

Ah, now I understand.  No, I don't think that psgml is electric.
You'd have to do that yourself.  But it should be fairly simple.  How
about sharing the results?  Post psgml-electric.el to
gnu.emacs.sources :-)

>> The config looks okay (except for the load-path frobbing which looks
>> really weird).  You can look in the menu bar, if there are menu items
>> Markup, SGML, and DTD, then you should be fine.
>
> load-path frobbing? What's frobbing? Sounds like hitting it with a
> dead rabbit!

No that's like waving dead chickens.

>From Jargon File (4.3.0, 30 APR 2001) :

  frob /frob/ 1. n. [MIT; very common] The TMRC definition was "FROB =
     a protruding arm or trunnion"; by metaphoric extension, a `frob' is any
     random small thing; an object that you can comfortably hold in one hand;
     something you can frob (sense 2). See frobnitz. 2. vt. Abbreviated
     form of frobnicate. 3. [from the MUD world] A command on some MUDs
     that changes a player's experience level (this can be used to make
     wizards); also, to request wizard privileges on the `professional
     courtesy' grounds that one is a wizard elsewhere. The command is
     actually `frobnicate' but is universally abbreviated to the shorter
     form.
  
I got it from www.dict.org.
-- 
A turnip curses Elvis

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

* Re: xml sgml & psgml
       [not found]       ` <3E42D6C8.5000806@cyberspaceroad.com>
@ 2003-02-07 14:47         ` Kai Großjohann
  0 siblings, 0 replies; 7+ messages in thread
From: Kai Großjohann @ 2003-02-07 14:47 UTC (permalink / raw)


Adam Hardy <emacs@cyberspaceroad.com> writes:

> If I knew where to start, I might have a go at it, but I'm finding it
> slightly difficult just coping with the .emacs lisp at the moment.
> I'm desperately trying to make progress on a java project at the
> moment, but in fact in the long term I may look at the whole psgml
> thing, and see if I can learn enough about it to program lisp properly.

You will notice that Lisp itself is not that difficult.  Just spend
the time to learn it -- it's a small language, like C.

It's the library functions that make it difficult.  But luckily, you
can learn those in an on-demand fashion and don't need to have a
complete overview of those.
-- 
A turnip curses Elvis

^ 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 --
2003-02-05 11:19 xml sgml & psgml 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 13:39 Adam Hardy
     [not found] <mailman.1447.1044452744.21513.help-gnu-emacs@gnu.org>
2003-02-05 15:19 ` 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

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