From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Florian von Savigny Newsgroups: gmane.emacs.help Subject: Re: "Smart" quotes and dashes in PSGML Date: 28 Jul 2003 18:14:08 +0200 Organization: Linux Private Site Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1059409430 11621 80.91.224.249 (28 Jul 2003 16:23:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 28 Jul 2003 16:23:50 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 28 18:23:47 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19hAjA-0002fr-00 for ; Mon, 28 Jul 2003 18:20:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19hAfY-00027p-A2 for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Jul 2003 12:16:16 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.news.nacamar.de!news.belwue.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help Original-Lines: 86 Original-NNTP-Posting-Host: pd9506f6d.dip0.t-ipconnect.de Original-X-Trace: online.de 1059408832 31402 217.80.111.109 (28 Jul 2003 16:13:52 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Mon, 28 Jul 2003 16:13:52 +0000 (UTC) X-Newsreader: Gnus v5.7/Emacs 20.6 Original-Xref: shelby.stanford.edu comp.emacs:80522 gnu.emacs.help:115495 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11413 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11413 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.