47 |
;; These functions follow the sun-mouse-handler convention of being called |
;; These functions follow the sun-mouse-handler convention of being called |
48 |
;; with three arguments: (window x-pos y-pos) |
;; with three arguments: (window x-pos y-pos) |
49 |
;; This makes it easy for a mouse executed command to know where the mouse is. |
;; This makes it easy for a mouse executed command to know where the mouse is. |
50 |
;; Use the macro "eval-in-window" to execute a function |
;; Use the macro "eval-in-window" to execute a function |
51 |
;; in a temporarily selected window. |
;; in a temporarily selected window. |
52 |
;; |
;; |
53 |
;; If you have a function that must be called with other arguments |
;; If you have a function that must be called with other arguments |
157 |
(defun mouse-mark-thing (window x y) |
(defun mouse-mark-thing (window x y) |
158 |
"Set point and mark to text object using syntax table. |
"Set point and mark to text object using syntax table. |
159 |
The resulting region is put in the sun-window stuff buffer. |
The resulting region is put in the sun-window stuff buffer. |
160 |
Left or right Paren syntax marks an s-expression. |
Left or right Paren syntax marks an s-expression. |
161 |
Clicking at the end of a line marks the line including a trailing newline. |
Clicking at the end of a line marks the line including a trailing newline. |
162 |
If it doesn't recognize one of these it marks the character at point." |
If it doesn't recognize one of these it marks the character at point." |
163 |
(mouse-move-point window x y) |
(mouse-move-point window x y) |
164 |
(if (eobp) (open-line 1)) |
(if (eobp) (open-line 1)) |
197 |
(defun mouse-kill-thing-there (window x y) |
(defun mouse-kill-thing-there (window x y) |
198 |
"Kill thing at mouse, leave point where it was. |
"Kill thing at mouse, leave point where it was. |
199 |
See mouse-mark-thing for a description of the objects recognized." |
See mouse-mark-thing for a description of the objects recognized." |
200 |
(eval-in-window window |
(eval-in-window window |
201 |
(save-excursion |
(save-excursion |
202 |
(mouse-mark-thing window x y) |
(mouse-mark-thing window x y) |
203 |
(kill-region (region-beginning) (region-end)))) |
(kill-region (region-beginning) (region-end)))) |
319 |
(defun mouse-scroll-proportional (window x y) |
(defun mouse-scroll-proportional (window x y) |
320 |
"Scrolls the window proportionally corresponding to window |
"Scrolls the window proportionally corresponding to window |
321 |
relative X divided by window width." |
relative X divided by window width." |
322 |
(eval-in-window window |
(eval-in-window window |
323 |
(if (>= x (1- (window-width))) |
(if (>= x (1- (window-width))) |
324 |
;; When x is maximum (equal to or 1 less than window width), |
;; When x is maximum (equal to or 1 less than window width), |
325 |
;; goto end of buffer. We check for this special case |
;; goto end of buffer. We check for this special case |
382 |
("Minibuffer" |
("Minibuffer" |
383 |
mouse-help-region *menu-window* *menu-x* *menu-y* 'minibuffer) |
mouse-help-region *menu-window* *menu-x* *menu-y* 'minibuffer) |
384 |
) |
) |
385 |
|
|
386 |
(defmenu emacs-quit-menu |
(defmenu emacs-quit-menu |
387 |
("Suspend" suspend-emacstool) |
("Suspend" suspend-emacstool) |
388 |
("Quit" save-buffers-kill-emacs)) |
("Quit" save-buffers-kill-emacs)) |
419 |
;;; |
;;; |
420 |
;;; minibuffer menu |
;;; minibuffer menu |
421 |
;;; |
;;; |
422 |
(defmenu minibuffer-menu |
(defmenu minibuffer-menu |
423 |
("Minibuffer" message "Just some miscellaneous minibuffer commands") |
("Minibuffer" message "Just some miscellaneous minibuffer commands") |
424 |
("Stuff" sun-yank-selection) |
("Stuff" sun-yank-selection) |
425 |
("Do-It" exit-minibuffer) |
("Do-It" exit-minibuffer) |
439 |
(mouse-set-mark-and-stuff window (- x 6) 0)) |
(mouse-set-mark-and-stuff window (- x 6) 0)) |
440 |
|
|
441 |
|
|
442 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
443 |
;;; Buffer-mode Mouse commands |
;;; Buffer-mode Mouse commands |
444 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
445 |
|
|
446 |
(defun Buffer-at-mouse (w x y) |
(defun Buffer-at-mouse (w x y) |
447 |
"Calls Buffer-menu-buffer from mouse click." |
"Calls Buffer-menu-buffer from mouse click." |
448 |
(save-window-excursion |
(save-window-excursion |
449 |
(mouse-move-point w x y) |
(mouse-move-point w x y) |
450 |
(beginning-of-line) |
(beginning-of-line) |
451 |
(Buffer-menu-buffer t))) |
(Buffer-menu-buffer t))) |
474 |
(mouse-move-point w x y) |
(mouse-move-point w x y) |
475 |
(Buffer-menu-execute) |
(Buffer-menu-execute) |
476 |
)) |
)) |
477 |
|
|
478 |
(defun enable-mouse-in-buffer-list () |
(defun enable-mouse-in-buffer-list () |
479 |
"Call this to enable mouse selections in *Buffer List* |
"Call this to enable mouse selections in *Buffer List* |
480 |
LEFT puts the indicated buffer in the selected window. |
LEFT puts the indicated buffer in the selected window. |
486 |
(list-buffers) ; Initialize *Buffer List* |
(list-buffers) ; Initialize *Buffer List* |
487 |
(set-buffer "*Buffer List*") |
(set-buffer "*Buffer List*") |
488 |
(local-set-mouse '(text middle) 'mouse-buffer-bury) |
(local-set-mouse '(text middle) 'mouse-buffer-bury) |
489 |
(local-set-mouse '(text left) 'mouse-buffer-select) |
(local-set-mouse '(text left) 'mouse-buffer-select) |
490 |
(local-set-mouse '(text right) 'mouse-buffer-delete) |
(local-set-mouse '(text right) 'mouse-buffer-delete) |
491 |
(local-set-mouse '(text middle right) 'mouse-buffer-execute) |
(local-set-mouse '(text middle right) 'mouse-buffer-execute) |
492 |
) |
) |