Re: Quail: FORGET-LAST-SELECTION

Kenichi Handa <[email protected]> Tue, 20 Apr 2004 17:19:38 +0900 (JST)
Newsgroups gmane.emacs.mule
Message-ID <[email protected]>
In article <[email protected]>, "Zhang Zhongyu" <[email protected]> writes:
> Last week I made a input method by quail-define-package. But I found if I set FORGET-LAST-SELECTION to "t", the quail-next-translation key is useless, only the first translation-block was shown.
> Is it a bug?

Yes, it's a bug.  I've just installed the attached fix in
CVS HEAD of emacs.

---
Ken'ichi HANDA
[email protected]

2004-04-20  Kenichi Handa  <[email protected]>

	* international/quail.el (quail-lookup-key): New optional arg
	NOT-RESET-INDICES.
	(quail-get-translations): Call quail-lookup-key with
	NOT-RESET-INDICES t.
	(quail-completion): Likewise.
	(quail-lookup-map-and-concat): Likewise.

Index: quail.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/quail.el,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -c -r1.134 -r1.135
cvs server: conflicting specifications of output style
*** quail.el	20 Apr 2004 07:06:58 -0000	1.134
--- quail.el	20 Apr 2004 08:18:02 -0000	1.135
***************
*** 1218,1224 ****
     (t
      (error "Invalid object in Quail map: %s" def))))
  
! (defun quail-lookup-key (key &optional len)
    "Lookup KEY of length LEN in the current Quail map and return the definition.
  The returned value is a Quail map specific to KEY."
    (or len
--- 1218,1224 ----
     (t
      (error "Invalid object in Quail map: %s" def))))
  
! (defun quail-lookup-key (key &optional len not-reset-indices)
    "Lookup KEY of length LEN in the current Quail map and return the definition.
  The returned value is a Quail map specific to KEY."
    (or len
***************
*** 1256,1262 ****
  	  (if (and (consp translation) (vectorp (cdr translation)))
  	      (progn
  		(setq quail-current-translations translation)
! 		(if (quail-forget-last-selection)
  		    (setcar (car quail-current-translations) 0))))))
      ;; We may have to reform cdr part of MAP.
      (if (and (cdr map) (functionp (cdr map)))
--- 1256,1262 ----
  	  (if (and (consp translation) (vectorp (cdr translation)))
  	      (progn
  		(setq quail-current-translations translation)
! 		(if (and (not not-reset-indices) (quail-forget-last-selection))
  		    (setcar (car quail-current-translations) 0))))))
      ;; We may have to reform cdr part of MAP.
      (if (and (cdr map) (functionp (cdr map)))
***************
*** 2043,2049 ****
  
  (defun quail-get-translations ()
    "Return a string containing the current possible translations."
!   (let ((map (quail-lookup-key quail-current-key))
  	(str (copy-sequence quail-current-key)))
      (if quail-current-translations
  	(quail-update-current-translations))
--- 2043,2049 ----
  
  (defun quail-get-translations ()
    "Return a string containing the current possible translations."
!   (let ((map (quail-lookup-key quail-current-key nil t))
  	(str (copy-sequence quail-current-key)))
      (if quail-current-translations
  	(quail-update-current-translations))
***************
*** 2114,2120 ****
    (quail-setup-completion-buf)
    (let ((win (get-buffer-window quail-completion-buf 'visible))
  	(key quail-current-key)
! 	(map (quail-lookup-key quail-current-key))
  	(require-update nil))
      (with-current-buffer quail-completion-buf
        (if (and win
--- 2114,2120 ----
    (quail-setup-completion-buf)
    (let ((win (get-buffer-window quail-completion-buf 'visible))
  	(key quail-current-key)
! 	(map (quail-lookup-key quail-current-key nil t))
  	(require-update nil))
      (with-current-buffer quail-completion-buf
        (if (and win
***************
*** 2695,2701 ****
  	 (translation-list nil)
  	 map)
      (while (> len 0)
!       (setq map (quail-lookup-key key len)
  	    len (1- len))
        (if map
  	  (let* ((def (quail-map-definition map))
--- 2695,2701 ----
  	 (translation-list nil)
  	 map)
      (while (> len 0)
!       (setq map (quail-lookup-key key len t)
  	    len (1- len))
        (if map
  	  (let* ((def (quail-map-definition map))