From d66be5718bcab4b95f19f972c64fd8c79e0aacaa Mon Sep 17 00:00:00 2001 From: Geoff Voelker Date: Tue, 2 Sep 1997 23:53:22 +0000 Subject: [PATCH] (w32-handle-scroll-bar-event): On up and down events, place point at window start position. Bind f10 to menubar. Move keypad key definitions to w32-fns.el. (mouse-wheel-scroll-amount): New variable. (mouse-wheel-scroll-line, mouse-wheel-scroll-screen): New functions. Bind mouse-wheel events to mouse-wheel functions. --- lisp/term/w32-win.el | 67 ++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 3cc2986b69e..9867b964855 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -94,6 +94,7 @@ (select-window window) (cond ((eq bar-part 'up) + (goto-char (window-start window)) (scroll-down 1)) ((eq bar-part 'above-handle) (scroll-down)) @@ -102,6 +103,7 @@ ((eq bar-part 'below-handle) (scroll-up)) ((eq bar-part 'down) + (goto-char (window-start window)) (scroll-up 1)) ))) (select-window old-window)))) @@ -113,6 +115,35 @@ ;; (scroll-bar-mode nil) +(defvar mouse-wheel-scroll-amount 4 + "*Number of lines to scroll per click of the mouse wheel.") + +(defun mouse-wheel-scroll-line (event) + "Scroll the current buffer by `mouse-wheel-scroll-amount'." + (interactive "e") + (condition-case nil + (if (< (car (cdr (cdr event))) 0) + (scroll-up mouse-wheel-scroll-amount) + (scroll-down mouse-wheel-scroll-amount)) + (error nil))) + +;; for scroll-in-place.el, this way the -scroll-line and -scroll-screen +;; commands won't interact +(setq scroll-command-groups (list '(mouse-wheel-scroll-line))) + +(defun mouse-wheel-scroll-screen (event) + "Scroll the current buffer by `mouse-wheel-scroll-amount'." + (interactive "e") + (condition-case nil + (if (< (car (cdr (cdr event))) 0) + (scroll-up) + (scroll-down)) + (error nil))) + +;; Bind the mouse-wheel event: +(global-set-key [mouse-wheel] 'mouse-wheel-scroll-line) +(global-set-key [C-mouse-wheel] 'mouse-wheel-scroll-screen) + (defvar x-invocation-args) (defvar x-command-line-resources nil) @@ -462,8 +493,14 @@ The value may be different for frames on different X displays." (setq defined-colors (cons this-color defined-colors)))) defined-colors)) + ;;;; Function keys +;;; make f10 activate the real menubar rather than the mini-buffer menu +;;; navigation feature. +(global-set-key [f10] (lambda () + (interactive) (w32-send-sys-command ?\xf100))) + (defun iconify-or-deiconify-frame () "Iconify the selected frame, or deiconify if it's currently an icon." (interactive) @@ -474,36 +511,6 @@ The value may be different for frames on different X displays." (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame global-map) -;; Map certain keypad keys into ASCII characters -;; that people usually expect. -(define-key function-key-map [tab] [?\t]) -(define-key function-key-map [linefeed] [?\n]) -(define-key function-key-map [clear] [11]) -(define-key function-key-map [return] [13]) -(define-key function-key-map [escape] [?\e]) -(define-key function-key-map [M-tab] [?\M-\t]) -(define-key function-key-map [M-linefeed] [?\M-\n]) -(define-key function-key-map [M-clear] [?\M-\013]) -(define-key function-key-map [M-return] [?\M-\015]) -(define-key function-key-map [M-escape] [?\M-\e]) - -;; These don't do the right thing (voelker) -;(define-key function-key-map [backspace] [127]) -;(define-key function-key-map [delete] [127]) -;(define-key function-key-map [M-backspace] [?\M-\d]) -;(define-key function-key-map [M-delete] [?\M-\d]) - -;; These tell read-char how to convert -;; these special chars to ASCII. -(put 'tab 'ascii-character ?\t) -(put 'linefeed 'ascii-character ?\n) -(put 'clear 'ascii-character 12) -(put 'return 'ascii-character 13) -(put 'escape 'ascii-character ?\e) -;; These don't seem to be necessary (voelker) -;(put 'backspace 'ascii-character 127) -;(put 'delete 'ascii-character 127) - ;;;; Selections and cut buffers -- 2.39.2