次のページ 前のページ 目次へ

11. XEmacs

通常は、 William M. Perrymwheel.el emacs パッケージを使うべきです。しかし、このリンクを動かす前に mwheel.el のベータ版 (Feb 23 1998) のローカルコピー、または下記の私が作成した未完成のコードを 使うこともできます。

.el ファイル (デフォルトは  /.emacs) にどれか一つを加えてください。

;;=============================================================================
;;                    scroll on  mouse wheel
;;=============================================================================

;; scroll on wheel of mouses
(define-key global-map 'button4
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down 5)
      (select-window curwin)
)))
(define-key global-map [(shift button4)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down 1)
      (select-window curwin)
)))
(define-key global-map [(control button4)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down)
      (select-window curwin)
)))

(define-key global-map 'button5
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up 5)
      (select-window curwin)
)))
(define-key global-map [(shift button5)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up 1)
      (select-window curwin)
)))
(define-key global-map [(control button5)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up)
      (select-window curwin)
)))

そして関連する話題として、数字キーで XEmacs のナビゲートをする以下のコード も使用できます。

;;=============================================================================
;;                    scroll on numpad
;;=============================================================================

(define-key global-map 'kp_9 'scroll-down)
(define-key global-map 'kp_3 'scroll-up)
(define-key global-map 'kp_6
  '(lambda (&rest args) (interactive)  (other-window 1)))
(define-key global-map 'kp_4
  '(lambda (&rest args) (interactive)  (other-window -1)))
(define-key global-map 'kp_2
  '(lambda (&rest args) (interactive)  (scroll-up 1)))
(define-key global-map 'kp_8
  '(lambda (&rest args) (interactive) (scroll-down 1)))
(define-key global-map 'kp_7 'beginning-of-buffer)
(define-key global-map 'kp_1 'end-of-buffer)
(define-key global-map 'kp_5
  '(lambda (&rest args) (interactive)  (recenter 0)))


次のページ 前のページ 目次へ