* Re: "Smart" quotes and dashes in PSGML
[not found] <pan.2003.07.19.16.31.24.555973@dzr-web.com>
@ 2003-07-28 16:14 ` Florian von Savigny
2003-07-28 16:51 ` Benjamin Riefenstahl
2003-07-28 16:54 ` Kai Großjohann
0 siblings, 2 replies; 3+ messages in thread
From: Florian von Savigny @ 2003-07-28 16:14 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3045 bytes --]
Here's another solution that appears crude rather then sophisticated
to me, as does Kevin's, but it is tested and works.
It's for the characters äöüÄÖÜß (which may not be what you precisely
need), but it only has to be changed like a template to cover other
characters / keys. Of course you don't have to do it as one compact
set either. I have, for instance, independently bound ~ to insert the
entity ­ (soft hyphen, which I frequently need), M-Space to
(nobreak space), and so on.
Incidentally, it's a pity something like the following doesn't work:
(define-key sgml-mode-map [?ä] '(lambda (insert "\ä\;")))
since that would save writing all those stupid little function
definitions (real elisp programmers will moan about my poor grasp of
it, though -- I keep forgetting even the difference between progn and
lambda).
(defun sgml-insert-auml ()
(interactive)
(insert "\ä\;"))
(defun sgml-insert-ouml ()
(interactive)
(insert "\ö\;"))
; and so on ...
; the following works only because I have (set-keyboard-coding-system
; 'iso-latin-1) in .emacs. Otherwise, I'd have to use the unibyte
; representations like [223] for ß, for instance
(defun sgml-iso-ent-no-direct-insert ()
(define-key sgml-mode-map [?ä] 'self-insert-command)
(define-key sgml-mode-map [?ö] 'self-insert-command)
(define-key sgml-mode-map [?ü] 'self-insert-command)
(define-key sgml-mode-map [?Ä] 'self-insert-command)
(define-key sgml-mode-map [?Ö] 'self-insert-command)
(define-key sgml-mode-map [?Ü] 'self-insert-command)
(define-key sgml-mode-map [?ß] 'self-insert-command)
(message "Direct ISO entity input for äöüÄÖÜß switched OFF"))
(defun sgml-iso-ent-direct-insert ()
(define-key sgml-mode-map [?ä] 'sgml-insert-auml) ; [228]
(define-key sgml-mode-map [?ö] 'sgml-insert-ouml) ; [246]
(define-key sgml-mode-map [?ü] 'sgml-insert-uuml) ; [252]
(define-key sgml-mode-map [?Ä] 'sgml-insert-Auml) ; [196]
(define-key sgml-mode-map [?Ö] 'sgml-insert-Ouml) ; [214]
(define-key sgml-mode-map [?Ü] 'sgml-insert-Uuml) ; [220]
(define-key sgml-mode-map [?ß] 'sgml-insert-szlig) ; [223]
(message "Direct ISO entity input for äöüÄÖÜß switched ON"))
(defun sgml-toggle-iso-ent-direct-insert ()
"For äöüÄÖÜß, toggle between inserting character or ISO entity"
(interactive)
(if (where-is-internal 'sgml-insert-auml sgml-mode-map)
; in other words: if that is bound to a key,
; all the others will be, too
(sgml-iso-ent-no-direct-insert)
(sgml-iso-ent-direct-insert)))
; finally, maybe more comfortable:
(add-hook 'sgml-mode-hook
'(lambda ()
(sgml-iso-ent-direct-insert)
(define-key sgml-mode-map "\C-c&"
'sgml-toggle-iso-ent-direct-insert)))
--
Florian v. Savigny
If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.
^ permalink raw reply [flat|nested] 3+ messages in thread