🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #188747

Defining abbrevs for LaTeX mode

#188747
From: Massimo Poesio
Date: Mon, 01 Jul 1991 15:06
68 lines
2760 bytes
I would like to define an abbrevs table to be used when I edit a 
LaTeX file which contains abbreviations for the most common 
LaTeX commands - so that, for example, I can type "\beSPC" 
and this gets expanded to "\begin", etc. 

I have tried to do this by creating an abbrev table and then defining 
abbreviations as said in the manual. So, I create  an abbrev-table:

(setq LaTeX-abbrev-table (make-abbrev-table))
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

I then set abbrev-mode  to t, and set the local abbrev table  to 
LaTeX-abbrev-table:

(setq abbrev-mode t)
t
(setq local-abbrev-table LaTeX-abbrev-table)
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

At this point, I try to define an abbreviation:

(define-abbrev LaTeX-abbrev-table "\be" "\begin" nil)
"e"
local-abbrev-table
[0 0 0 0 0 0 0 \e 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
(intern-soft "\be" LaTeX-abbrev-table)
\e

as you see, "\e" is interned instead of "\be". And the abbrev doesn't work - 
that is, if I type "\be", nothing happens. 
The problem seems to be that intern  makes the conversion:


(intern "\be" LaTeX-abbrev-table)
\e

so, I tried to quote the "\", but without success:

(define-abbrev LaTeX-abbrev-table "\\be" "\begin" nil)
"\\be"
(intern-soft "\\be" LaTeX-abbrev-table)
\\be

This time the abbrev gets inserted, but it still doesn't work. In case you were
wondering, I also tried to define my abbrev as follows:

(define-abbrev LaTeX-abbrev-table '\be "\begin" nil)

but this time define-abbrev complains that its argument is not a string.
Any ideas, short of avoiding the "\"? (I don't really want to define
"be" as an abbrev for "begin"!)

Thanks a lot




--

			Massimo Poesio
			University of Rochester
			Computer Science Department
			Rochester, NY 14627
			email:  poesio@cs.rochester.edu
			phone:  (716) 275-5605
Technical Details
Message-ID: <POESIO.91Jul1110628@nectarine.cs.rochester.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!ub!galileo.cc.rochester.edu!rochester!poesio

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,5e792484dff3cc72,start
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-07-01 08:47:11 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!zaphod.mps.ohio-state.edu!ub!galileo.cc.rochester.edu!rochester!poesio
From: poesio@cs.rochester.edu (Massimo Poesio)
Newsgroups: gnu.emacs.help
Subject: Defining abbrevs for LaTeX mode
Message-ID: <POESIO.91Jul1110628@nectarine.cs.rochester.edu>
Date: 1 Jul 91 15:06:28 GMT
Sender: poesio@cs.rochester.edu (Massimo Poesio)
Distribution: gnu
Organization: University of Rochester
Lines: 68
Nntp-Posting-Host: nectarine.cs.rochester.edu