changeset 18201:feea31893155

(quail-prefix-arg): New variable. (quail-start-translation): Make it handle a prefix argument. (quail-terminate-translation): Like wise.
author Kenichi Handa <handa@m17n.org>
date Tue, 10 Jun 1997 00:56:22 +0000
parents c913160e34a7
children 1fe28ee1b0cd
files lisp/international/quail.el
diffstat 1 files changed, 23 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/quail.el	Tue Jun 10 00:56:20 1997 +0000
+++ b/lisp/international/quail.el	Tue Jun 10 00:56:22 1997 +0000
@@ -849,9 +849,13 @@
 ;; If set to non-nil, exit conversion mode before starting new translation.
 (defvar quail-exit-conversion-mode nil)
 
-(defun quail-start-translation ()
+(defvar quail-prefix-arg nil)
+
+(defun quail-start-translation (arg)
   "Start translating the typed character in Quail mode."
-  (interactive "*")
+  (interactive "*p")
+  (setq prefix-arg arg)
+  (setq quail-prefix-arg arg)
   (setq unread-command-events
 	(cons last-command-event unread-command-events))
   ;; Check the possibility of translating the last key.
@@ -917,29 +921,30 @@
     ;; `post-command-hook'.
     (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t)))
 
+(defsubst quail-delete-region ()
+  "Delete the text in the current translation region of Quail."
+  (delete-region (overlay-start quail-overlay) (overlay-end quail-overlay)))
+
 (defun quail-terminate-translation ()
   "Terminate the translation of the current key."
   (let ((start (overlay-start quail-overlay)))
     (if (and start
 	     (< start (overlay-end quail-overlay)))
 	;; Here we simulate self-insert-command.
-	(let (last-command-char)
+	(let ((seq (string-to-sequence
+		    (buffer-substring (overlay-start quail-overlay)
+				      (overlay-end quail-overlay))
+		    'list))
+	      last-command-char)
 	  (goto-char start)
-	  ;; The first one might want to expand an abbrev.
-	  (setq last-command-char (following-char))
-	  (delete-char 1)
-	  (self-insert-command 1)
-	  (if (< (point) (overlay-end quail-overlay))
-	      (if overwrite-mode
-		  (while (< (point) (overlay-end quail-overlay))
-		    (setq last-command-char (following-char))
-		    (delete-char 1)
-		    (self-insert-command 1))
-		;; The last one might still want to auto-fill.
-		(goto-char (overlay-end quail-overlay))
-		(let ((last-command-char (preceding-char)))
-		  (delete-char -1)
-		  (self-insert-command 1)))))))
+	  (quail-delete-region)
+	  (setq last-command-char (car seq))
+	  (self-insert-command (or quail-prefix-arg 1))
+	  (setq seq (cdr seq))
+	  (while seq
+	    (setq last-command-char (car seq))
+	    (self-insert-command 1)
+	    (setq seq (cdr seq))))))
   (delete-overlay quail-overlay)
   (if (buffer-live-p quail-guidance-buf)
       (save-excursion
@@ -947,10 +952,6 @@
 	(erase-buffer)))
   (throw 'exit nil))
 
-(defsubst quail-delete-region ()
-  "Delete the text in the current translation region of Quail."
-  (delete-region (overlay-start quail-overlay) (overlay-end quail-overlay)))
-
 (defun quail-select-current ()
   "Select the current text shown in Quail translation region."
   (interactive)