changeset 4733:4d378f483cf4

Set up keymap at load time. (iso-accents-mode): Not here. Just setq iso-accents-minor-mode. (iso-accents-minor-mode): Make it local in all buffers.
author Richard M. Stallman <rms@gnu.org>
date Fri, 17 Sep 1993 16:49:28 +0000
parents 22e673b984fc
children 488d0b668380
files lisp/international/iso-acc.el
diffstat 1 files changed, 30 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/iso-acc.el	Fri Sep 17 16:43:38 1993 +0000
+++ b/lisp/international/iso-acc.el	Fri Sep 17 16:49:28 1993 +0000
@@ -2,7 +2,7 @@
 ;;; Copyright (C) 1993 Free Software Foundation, Inc.
 
 ;; Author: Johan Vromans <jv@mh.nl>
-;; Version: 1.4
+;; Version: 1.7
 
 ;; This file is part of GNU Emacs.
 
@@ -22,10 +22,11 @@
 
 ;;; Commentary:
 
-;; Function `iso-accents' activates a minor mode (`iso-accents-minor-mode')
-;; in which typewriter "dead keys" are emulated.  The purpose of this
-;; emulation is to provide a simple means for inserting accented
-;; characters according to the ISO-8859-1 character set.
+;; Function `iso-accents-mode' activates a minor mode
+;; (`iso-accents-minor-mode') in which typewriter "dead keys" are
+;; emulated.  The purpose of this emulation is to provide a simple
+;; means for inserting accented characters according to the ISO-8859-1
+;; character set.
 ;;
 ;; In `iso-accents-minor-mode', pseudo accent characters are used to
 ;; introduce accented keys.  The pseudo-accent characterss are:
@@ -106,11 +107,11 @@
     )
   "Association list for ISO accent combinations.")
 
-(defun iso-accents-dead-key ()
+(defun iso-accents-accent-key ()
   "Modify the following character by adding an accent to it."
   (interactive)
 
-  ;; Pick up the dead-key.
+  ;; Pick up the accent character.
   (let ((first-char last-command-char))
 
     ;; Display it and backup.
@@ -136,14 +137,33 @@
 
 (defvar iso-accents-minor-mode nil
   "*Non-nil enables ISO-accents mode.
+Setting this variable makes it local to the current buffer.
 See `iso-accents-mode'."
+(make-variable-buffer-local 'iso-accents-minor-mode)
 
+;; A minor mode map `iso-accents-prefix-map' is used to activate the
+;; dead key handling depending on the value of iso-accents-minor-mode.
 (defvar iso-accents-prefix-map nil
   "Keymap for ISO-accents minor mode.")
 
+;; Create the minor-mode keymap, if needed.
+(or iso-accents-prefix-map
+    (progn
+      (setq iso-accents-prefix-map (make-sparse-keymap))
+      (define-key iso-accents-prefix-map "'"  'iso-accents-dead-key)
+      (define-key iso-accents-prefix-map "`"  'iso-accents-dead-key)
+      (define-key iso-accents-prefix-map "^"  'iso-accents-dead-key)
+      (define-key iso-accents-prefix-map "\"" 'iso-accents-dead-key)))
+
+;; Add the dead key minor mode map to the minor mode maps.
+(or (assq 'iso-accents-minor-mode minor-mode-map-alist)
+    (setq minor-mode-map-alist
+	  (cons (cons 'iso-accents-minor-mode iso-accents-prefix-map)
+		minor-mode-map-alist)))
+
 ;; It is a matter of taste if you want the minor mode indicated
 ;; in the mode line...
-;; If so, uncomment the next three lines.
+;; If so, uncomment the next four lines.
 ;; (or (assq 'iso-accents-minor-mode minor-mode-map-alist)
 ;;     (setq minor-mode-alist
 ;; 	  (append minor-mode-alist
@@ -151,7 +171,7 @@
 
 ;;;###autoload
 (defun iso-accents-mode (&optional arg)
-  "Toggle a minor mode in which accent modify the following letter.
+  "Toggle a minor mode in which accents modify the following letter.
 This permits easy insertion of accented characters according to ISO-8859-1.
 When Iso-accents mode is enabled, accent character keys
 \(', \", ^ and ~) do not self-insert; instead, they modify the following
@@ -159,16 +179,9 @@
 
 With an argument, a positive argument enables ISO-accents mode, 
 and a negative argument disables it."
-;; When called, a buffer local variable iso-accents-minor-mode is created
-;; to record iso-accents-minor-mode status.
-;; A minor mode map `iso-accents-prefix-map' is used to activate the dead
-;; key handling dependend on the value of iso-accents-minor-mode.
 
   (interactive "P")
 
-  ;; Create buffer local variable iso-accents-minor-mode.
-  (make-local-variable 'iso-accents-minor-mode)
-
   (if (if arg
 	  ;; Negative arg means switch it off.
 	  (<= (prefix-numeric-value arg) 0)
@@ -177,22 +190,6 @@
       (setq iso-accents-minor-mode nil)
 
     ;; Enable electric accents.
-    (setq iso-accents-minor-mode t)
-
-    ;; Create the minor-mode keymap, if needed.
-    (or iso-accents-prefix-map
-	(progn
-	  (setq iso-accents-prefix-map (make-sparse-keymap))
-	  (define-key iso-accents-prefix-map "'"  'iso-accents-dead-key)
-	  (define-key iso-accents-prefix-map "`"  'iso-accents-dead-key)
-	  (define-key iso-accents-prefix-map "^"  'iso-accents-dead-key)
-	  (define-key iso-accents-prefix-map "\"" 'iso-accents-dead-key)
-
-	  ;; Add the dead key minor mode map to the minor mode maps.
-	  (or (assq 'iso-accents-minor-mode minor-mode-map-alist)
-	      (setq minor-mode-map-alist
-		    (cons (cons 'iso-accents-minor-mode iso-accents-prefix-map)
-			  minor-mode-map-alist)))))))
+    (setq iso-accents-minor-mode t)))
 
 ;;; iso-acc.el ends here
-