[comp.emacs] GNU Emacs TeX-mode slashes and backslashes

lind@entropy.ms.washington.edu (Doug Lind) (02/01/88)

        To Make Typing Backslashes In Tex-Mode Easier, I Have
	Redefined The Slash Key ("/") To Type A Backslash Using The
	Following Line In Tex-Mode.El:

	     (Define-Key Tex-Mode-Map "/"        'Backslash)

	Where 'Backslash Is Defined By (Fset 'Backslash "\\"). This
	Works Fine. But Trying To Define A Key To Insert A Slash
	Is A Problem. Doing The Obvious Either Leads To Some Sort
	Infinite Regress Error, Or Printing A Backslash, Not A
	Slash. Any Gnu Emacs Wizards Out There With The (Un-
	Doubtedly Simple) Solution?

	        Doug Lind
	        Lind@perron.Ms.Washington.Edu
	        Univ. Of Wash. Math. Dept.

	

shirono@grasp.cis.upenn.edu (Roberto Shironoshita) (02/01/88)

In article <735@entropy.ms.washington.edu> lind@entropy.ms.washington.edu (Doug Lind) writes:
>        To Make Typing Backslashes In Tex-Mode Easier, I Have
>	Redefined The Slash Key ("/") To Type A Backslash Using The
>	Following Line In Tex-Mode.El:
>
>	     (Define-Key Tex-Mode-Map "/"        'Backslash)
>
>	Where 'Backslash Is Defined By (Fset 'Backslash "\\"). This
>	Works Fine. But Trying To Define A Key To Insert A Slash
>	Is A Problem. Doing The Obvious Either Leads To Some Sort
>	Infinite Regress Error, Or Printing A Backslash, Not A
>	Slash. Any Gnu Emacs Wizards Out There With The (Un-
>	Doubtedly Simple) Solution?

I like this implementation better (why not, I wrote it myself ;-).

(define-key TeX-mode-map "/" 'TeX-insert-backslash)
(define-key TeX-mode-map "\\" 'TeX-insert-slash)

(defun TeX-insert-backslash ()
  "Insert a \\"
  (interactive)
  (insert "\\")
)

(defun TeX-insert-slash ()
  "Insert a /"
  (interactive)
  (insert "/")
)


                                   Roberto Shironoshita

-----------------------------------------------------------------------
Disclaimer 1:  The opinions expressed here are my own.  The University
	       need not share them, or even be aware of them.
Disclaimer 2:  Like most humans, I'm bound to err at times.  I believe
	       what I have said, but agree that I may be wrong.

  @@@@@@@@@\         Full Name:    Roberto Shironoshita
   @@     @@         Occupation:   BSE candidate in Computer Science
   @@     @@         Organization: University of Pennsylvania
   @@@@@@@@/
   @@                Network Address:
   @@                    PENNnet:  shirono@eniac.seas
  @@@@                   Internet: shirono@eniac.seas.upenn.edu