Mercurial > emacs
comparison lisp/mouse.el @ 1980:263033210413
* mouse.el (mouse-split-window-vertically): If the user clicks too
close to the top or bottom of a window, split at the closest
reasonable line. Give a helpful error message if the window is
too small to be split anywhere.
(mouse-split-window-horizontally): Similar changes.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 02 Mar 1993 07:29:05 +0000 |
parents | 04fb1d3d6992 |
children | 95996f2ad1c6 |
comparison
equal
deleted
inserted
replaced
1979:0582c70595f1 | 1980:263033210413 |
---|---|
105 The window is split at the line clicked on. | 105 The window is split at the line clicked on. |
106 This command must be bound to a mouse click." | 106 This command must be bound to a mouse click." |
107 (interactive "@e") | 107 (interactive "@e") |
108 (let ((start (event-start click))) | 108 (let ((start (event-start click))) |
109 (select-window (posn-window start)) | 109 (select-window (posn-window start)) |
110 (split-window-vertically (1+ (cdr (posn-col-row click)))))) | 110 (let ((new-height (1+ (cdr (posn-col-row (event-end click))))) |
111 (first-line window-min-height) | |
112 (last-line (- (window-height) window-min-height))) | |
113 (if (< last-line first-line) | |
114 (error "window too short to split") | |
115 (split-window-vertically | |
116 (min (max new-height first-line) last-line)))))) | |
111 | 117 |
112 (defun mouse-split-window-horizontally (click) | 118 (defun mouse-split-window-horizontally (click) |
113 "Select Emacs window mouse is on, then split it horizontally in half. | 119 "Select Emacs window mouse is on, then split it horizontally in half. |
114 The window is split at the column clicked on. | 120 The window is split at the column clicked on. |
115 This command must be bound to a mouse click." | 121 This command must be bound to a mouse click." |
116 (interactive "@e") | 122 (interactive "@e") |
117 (split-window-horizontally (1+ (car (posn-col-row (event-end click)))))) | 123 (let ((start (event-start click))) |
124 (select-window (posn-window start)) | |
125 (let ((new-width (1+ (car (posn-col-row (event-end click))))) | |
126 (first-col window-min-width) | |
127 (last-col (- (window-width) window-min-width))) | |
128 (if (< last-col first-col) | |
129 (error "window too narrow to split") | |
130 (split-window-horizontally | |
131 (min (max new-width first-col) last-col)))))) | |
118 | 132 |
119 (defun mouse-set-point (click) | 133 (defun mouse-set-point (click) |
120 "Move point to the position clicked on with the mouse. | 134 "Move point to the position clicked on with the mouse. |
121 This must be bound to a mouse click." | 135 This must be bound to a mouse click." |
122 (interactive "e") | 136 (interactive "e") |
238 (if buf | 252 (if buf |
239 (progn | 253 (progn |
240 (select-window window) | 254 (select-window window) |
241 (switch-to-buffer buf)))))) | 255 (switch-to-buffer buf)))))) |
242 | 256 |
243 ;;; These need to be rewritten for the new scrollbar implementation. | 257 ;;; These need to be rewritten for the new scroll bar implementation. |
244 | 258 |
245 ;;;!! ;; Commands for the scroll bar. | 259 ;;;!! ;; Commands for the scroll bar. |
246 ;;;!! | 260 ;;;!! |
247 ;;;!! (defun mouse-scroll-down (click) | 261 ;;;!! (defun mouse-scroll-down (click) |
248 ;;;!! (interactive "@e") | 262 ;;;!! (interactive "@e") |
480 ;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) | 494 ;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) |
481 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) | 495 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) |
482 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) | 496 ;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) |
483 ;;;!! | 497 ;;;!! |
484 ;;;!! ;; | 498 ;;;!! ;; |
485 ;;;!! ;; This scrolls while button is depressed. Use preferable in scrollbar. | 499 ;;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar. |
486 ;;;!! ;; | 500 ;;;!! ;; |
487 ;;;!! | 501 ;;;!! |
488 ;;;!! (defvar scrolled-lines 0) | 502 ;;;!! (defvar scrolled-lines 0) |
489 ;;;!! (defconst scroll-speed 1) | 503 ;;;!! (defconst scroll-speed 1) |
490 ;;;!! | 504 ;;;!! |