[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plamo:14471] Re: emacs_isearch



  山内です.

>   skk は何もしなくてもうまくいくので,そのあたりを参考に
> すれば,Emacs を改造しなくても解決しそうな予感...

  どうも skk は i-search のあたり独自に処理してるような
感じですね.

  で,結局,i-search の問題は,以下のコードを .emacs に
追加するか,該当する部分を修正してコンパイルし直すと解決
するようです.ただ,副作用がちと恐いので,修正をご希望の
方は今はとりあえず .emacs に書いてみてください.

  あと,Canna の方は,

      (define-key isearch-mode-map "\C-o" 'isearch-toggle-input-method)

を書いておくといいと思います.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Emacs-21 + Tamago-4 の不具合を修正するコード
;; (Emacsのコードをちょびっといぢくっただけ :-P)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun read-multilingual-string-for-isearch (prompt &optional initial-input input-method)
  "Read a multilingual string from minibuffer, prompting with string PROMPT.
The input method selected last time is activated in minibuffer.
If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer
initially.
Optional 3rd argument INPUT-METHOD specifies the input method
to be activated instead of the one selected last time.  It is a symbol
or a string."
  (setq input-method
	(or input-method
	    current-input-method
	    default-input-method
	    (read-input-method-name "Input method: " nil t)))
  (if (and input-method (symbolp input-method))
      (setq input-method (symbol-name input-method)))
  (let ((prev-input-method current-input-method))
    (unwind-protect
	(progn
	  (setq map-for-isearch-multibyte-characters (make-sparse-keymap))
	  (define-key map-for-isearch-multibyte-characters "\C-s" [13])
	  (define-key map-for-isearch-multibyte-characters "\C-r" [13])
	  (set-keymap-parent 
	   map-for-isearch-multibyte-characters 
	   minibuffer-local-map)
	  (activate-input-method input-method)
	  (read-from-minibuffer prompt initial-input 
				map-for-isearch-multibyte-characters
				nil nil nil t))
      (activate-input-method prev-input-method))))

;;;###autoload
(defun isearch-process-search-multibyte-characters (last-char)
  (if (eq this-command 'isearch-printing-char)
      (let ((overriding-terminal-local-map nil)
	    (prompt (concat (isearch-message-prefix) isearch-message))
	    (minibuffer-local-map isearch-minibuffer-local-map)
	    str)
	(if isearch-input-method-function
	    (let (;; Let input method work rather tersely.
		  (input-method-verbose-flag nil))
	      (setq unread-command-events
		    (cons 'with-input-method
			  (cons last-char unread-command-events))
		    ;; Inherit current-input-method in a minibuffer.
		    str (read-string prompt nil nil nil t))
	      (if (not str)
		  ;; All inputs were deleted while the input method
		  ;; was working.
		  (setq str "")
		(if (and (= (length str) 1)
			 (= (aref str 0) last-char)
			 (>= last-char 128))
		    ;; The input method couldn't handle LAST-CHAR.
		    (setq str nil)))))

	(if (and (not str) (keyboard-coding-system))
	    (setq unread-command-events
		  (cons 'with-keyboard-coding
			(cons last-char unread-command-events))
		  str (read-string prompt)))

	(setq unread-command-events
	      (cons last-char unread-command-events))
	(setq str (read-multilingual-string-for-isearch
		   (concat (isearch-message-prefix) isearch-message)
		   nil
		   current-input-method))

	(if (and str (> (length str) 0))
	    (let ((unread-command-events nil))
	      (isearch-process-search-string str str))
	  (isearch-update)))
    (isearch-process-search-char last-char)))


#つっこみお待ちしてます.
==  Chisato Yamauchi  =================================
    Mail: cyamauch@hst.phyas.aichi-edu.ac.jp
          cyamauch@a.phys.nagoya-u.ac.jp
    URL: http://phe.phyas.aichi-edu.ac.jp/~cyamauch/ 

Follow-Ups
[plamo:14482] Re: emacs_isearch, Chisato Yamauchi
References
[plamo:14462] emacs_isearch, Chisato Yamauchi
[plamo:14466] Re: emacs_isearch, Chisato Yamauchi

[検索ページ] [メール一覧]
Plamo ML 公開システム