[Mew-dist 63] keyswitch

Kazuhiko Yamamoto 山本和彦 kazu at example.com
1996年 11月 20日 (水) 23:41:09 JST


正しい keysitch は、こうじゃないかと思い立ち実装しました。みなさんが昔
困っていた状況を僕だけでは全て試せないので、取り合えずコードを送ります。
At your risk で御使用下さい。

P.S.

ヘッダで C-u x などができます。

--かず

(defun mew-vector-car (vec n)
  (let* ((newvec (make-vector n nil))
	 (i 0))
    (while (< i n)
      (aset newvec i (aref vec i))
      (setq i (1+ i))
      )
    newvec
    ))

(defun mew-draft-keyswitch ()
  (interactive)
  (let ((func) (key (this-command-keys)))
    (setq key (mew-command-key-sequence key 'mew-draft-keyswitch))
    (cond
     ((and (markerp mew-draft-buffer-attach) (mew-draft-in-attach-p))
      (setq func (lookup-key mew-draft-attach-map key)))
     ((and (markerp mew-draft-buffer-header) (mew-draft-in-header-p))
      (setq func (lookup-key mew-draft-header-map key)))
     (t 
      (setq func (lookup-key mew-draft-body-map key))
      )
     )
    (if (not (integerp func))
	()
      (if (vectorp key) (setq key (mew-vector-car key func))
	(setq key (substring key 0 func)))
      (setq func (lookup-key (current-global-map) key))
      (cond
       ((and (markerp mew-draft-buffer-attach) (mew-draft-in-attach-p))
	(setq func (lookup-key mew-draft-attach-map key)))
       ((and (markerp mew-draft-buffer-header) (mew-draft-in-header-p))
	(setq func (lookup-key mew-draft-header-map key)))
       (t 
	(setq func (lookup-key mew-draft-body-map key))
	)
       )
      )
    (if func
	()
      (setq func (lookup-key (current-global-map) key))
      (if (not (integerp func))
	  ()
	(if (vectorp key) (setq key (mew-vector-car key func))
	  (setq key (substring key 0 func)))
	(setq func (lookup-key (current-global-map) key))
	)
      )
    (if (null func)
	(insert key) ;; just in case
      (setq this-command func)
      (call-interactively func))
    ))



Mew-dist メーリングリストの案内