4.4BSD/usr/src/contrib/emacs-18.57/lisp/sun-fns.elc


(provide (quote sun-fns))

(require (quote sun-mouse))

(defconst cursor-pause-milliseconds 300 "\
*Number of milliseconds to display alternate cursor (usually the mark)")

(defun indicate-region (&optional pause) "\
Bounce cursor to mark for cursor-pause-milliseconds and back again" (byte-code "	` b!
b)" [pause cursor-pause-milliseconds point mark sit-for-millisecs] 3))

(defun mouse-move-point (window x y) "\
Move point to mouse cursor." (byte-code "!	
\">ȉ" [window x y last-command this-command select-window move-to-loc (mouse-copy mouse-delete mouse-yank-move) mouse-yank-move] 4))

(defun mouse-set-mark (window x y) "\
Set mark at mouse cursor." (byte-code " Ǝ	!`\"`!
b )))" [OriginallySelectedWindow window point x y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window move-to-loc set-mark indicate-region] 6))

(defun mouse-set-mark-and-select (window x y) "\
Set mark at mouse cursor, and select that window." (byte-code "!	
#" [window x y select-window mouse-set-mark] 5))

(defun mouse-set-mark-and-stuff (w x y) "\
Set mark at mouse cursor, and put region in stuff buffer." (byte-code "	
#  \"" [w x y mouse-set-mark-and-select sun-select-region region-beginning region-end] 6))

(defvar *mouse-drag-window* nil)

(defvar *mouse-drag-x* -1)

(defvar *mouse-drag-y* -1)

(defun mouse-drag-move-point (window x y) "\
Move point to mouse cursor, and allow dragging." (byte-code "	
#	
" [window x y *mouse-drag-window* *mouse-drag-x* *mouse-drag-y* mouse-move-point] 4))

(defun mouse-drag-set-mark-stuff (window x y) "\
The up click handler that goes with mouse-drag-move-point.
If mouse is in same WINDOW but at different X or Y than when
mouse-drag-move-point was last executed, set the mark at mouse
and put the region in the stuff buffer." (byte-code "	=
\"
\"?	
#\"" [*mouse-drag-window* window *mouse-drag-x* x *mouse-drag-y* y this-command last-command equal mouse-set-mark-and-stuff] 6))

(defun mouse-select-or-drag-move-point (window x y) "\
Select window if not selected, otherwise do mouse-drag-move-point." (byte-code " =	
#	
#" [window x y selected-window mouse-drag-move-point mouse-select-window] 6))

(defun mouse-exch-pt-and-mark (window x y) "\
Exchange point and mark." (byte-code "! " [window select-window exchange-point-and-mark] 3))

(defun mouse-call-kbd-macro (window x y) "\
Invokes last keyboard macro at mouse cursor." (byte-code "	
# " [window x y mouse-move-point call-last-kbd-macro] 4))

(defun mouse-mark-thing (window x y) "\
Set point and mark to text object using syntax table.
The resulting region is put in the sun-window stuff buffer.
Left or right Paren syntax marks an s-expression.  
Clicking at the end of a line marks the line including a trailing newline.  
If it doesn't recognize one of these it marks the character at point." (byte-code "	
#m
!`f!=)!`!![=5![=H!! [lW`T!![`T! *  \"" [window x y char syntax t mouse-move-point open-line 1 char-syntax 119 forward-word set-mark -1 40 mark-sexp 41 forward-char exchange-point-and-mark beginning-of-line indicate-region sun-select-region region-beginning region-end] 19))

(defun mouse-kill-thing (window x y) "\
Kill thing at mouse, and put point there." (byte-code "	
#  \"" [window x y mouse-mark-thing kill-region-and-unmark region-beginning region-end] 6))

(defun mouse-kill-thing-there (window x y) "\
Kill thing at mouse, leave point where it was.
See mouse-mark-thing for a description of the objects recognized." (byte-code " Ŏ	!	
#  \")))" [OriginallySelectedWindow window x y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window mouse-mark-thing kill-region region-beginning region-end] 8))

(defun mouse-save-thing (window x y &optional quiet) "\
Put thing at mouse in kill ring.
See mouse-mark-thing for a description of the objects recognized." (byte-code "	
#  \"?!" [window x y quiet mouse-mark-thing copy-region-as-kill region-beginning region-end message "Thing saved"] 6))

(defun mouse-save-thing-there (window x y &optional quiet) "\
Put thing at mouse in kill ring, leave point as is.
See mouse-mark-thing for a description of the objects recognized." (byte-code " Ǝ	!	
$)))" [OriginallySelectedWindow window x y quiet selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window mouse-save-thing] 7))

(defun mouse-copy-thing (window x y) "\
Put thing at mouse in kill ring, yank to point.
See mouse-mark-thing for a description of the objects recognized." (byte-code "Ɖ	
$ ȉ" [last-command window x y t this-command not-kill mouse-save-thing-there yank] 5))

(defun mouse-move-thing (window x y) "\
Kill thing at mouse, yank it to point.
See mouse-mark-thing for a description of the objects recognized." (byte-code "ʼn	
# lj" [last-command window x y this-command not-kill mouse-kill-thing-there yank] 4))

(defun mouse-yank-at-point (&optional window x y) "\
Yank from kill-ring at point; then cycle thru kill ring." (byte-code "=#` W` \"!
@c	 )% ĉ" [last-command before kill-ring-yank-pointer this-command yank mark delete-region rotate-yank-pointer 1 exchange-point-and-mark] 8))

(defun mouse-yank-at-mouse (window x y) "\
Yank from kill-ring at mouse; then cycle thru kill ring." (byte-code "	
#	
#" [window x y mouse-move-point mouse-yank-at-point] 5))

(defun mouse-save/delete/yank (&optional window x y) "\
Context sensitive save/delete/yank.
Consecutive clicks perform as follows:
    * first click saves region to kill ring,
    * second click kills region,
    * third click yanks from kill ring,
    * subsequent clicks cycle thru kill ring.
If mouse-move-point is performed after the first or second click,
the next click will do a yank, etc.  Except for a possible mouse-move-point,
this command is insensitive to mouse location." (byte-code "> ,=  \"ɉ,  \"!ʼn" [last-command this-command t (mouse-delete yank mouse-yank-move) mouse-yank-at-point mouse-copy kill-region region-beginning region-end mouse-delete copy-region-as-kill message "Region saved"] 10))

(defun mouse-split-horizontally (window x y) "\
Splits the window horizontally at mouse cursor." (byte-code " Ď	!
T!))" [OriginallySelectedWindow window x selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window split-window-horizontally] 4))

(defun mouse-split-vertically (window x y) "\
Split the window vertically at the mouse cursor." (byte-code " Ď	!
T!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window split-window-vertically] 4))

(defun mouse-select-window (window x y) "\
Selects the window, restoring point." (byte-code "!" [window select-window] 2))

(defun mouse-delete-other-windows (window x y) "\
Deletes all windows except the one mouse is in." (byte-code "!" [window delete-other-windows] 2))

(defun mouse-delete-window (window x y) "\
Deletes the window mouse is in." (byte-code "!" [window delete-window] 2))

(defun mouse-undo (window x y) "\
Invokes undo in the window mouse is in." (byte-code " Î	! ))" [OriginallySelectedWindow window selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window undo] 4))

(defun mouse-scroll-up (window x y) "\
Scrolls the window upward." (byte-code " Ď	!!!))" [OriginallySelectedWindow window nil selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window move-to-window-line 1 scroll-up] 5))

(defun mouse-scroll-down (window x y) "\
Scrolls the window downward." (byte-code " Ď	!!))" [OriginallySelectedWindow window nil selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-down] 4))

(defun mouse-scroll-proportional (window x y) "\
Scrolls the window proportionally corresponding to window
relative X divided by window width." (byte-code " Ď	!
 SYdb'e
deZ S\"\"\\b  ))" [OriginallySelectedWindow window x selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window window-width * / beginning-of-line what-cursor-position] 10))

(defun mouse-line-to-top (window x y) "\
Scrolls the line at the mouse cursor up to the top." (byte-code " Ď	!
!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-up] 4))

(defun mouse-top-to-line (window x y) "\
Scrolls the top line down to the mouse cursor." (byte-code " Ď	!
!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-down] 4))

(defun mouse-line-to-bottom (window x y) "\
Scrolls the line at the mouse cursor to the bottom." (byte-code " Ď	!
 Z\\!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-up 2 window-height] 7))

(defun mouse-bottom-to-line (window x y) "\
Scrolls the bottom line up to the mouse cursor." (byte-code " Ď	!
 Z\\!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-down 2 window-height] 7))

(defun mouse-line-to-middle (window x y) "\
Scrolls the line at the mouse cursor to the middle." (byte-code " Ď	!
 \"#!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-up - -1 / window-height 2] 10))

(defun mouse-middle-to-line (window x y) "\
Scrolls the line at the middle to the mouse cursor." (byte-code " Ď	! \"
#!))" [OriginallySelectedWindow window y selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window scroll-up - / window-height 2 1] 9))

(defmenu expand-menu ("Vertically" mouse-expand-vertically *menu-window*) ("Horizontally" mouse-expand-horizontally *menu-window*))

(defmenu delete-window-menu ("This One" delete-window *menu-window*) ("All Others" delete-other-windows *menu-window*))

(defmenu mouse-help-menu ("Text Region" mouse-help-region *menu-window* *menu-x* *menu-y* (quote text)) ("Scrollbar" mouse-help-region *menu-window* *menu-x* *menu-y* (quote scrollbar)) ("Modeline" mouse-help-region *menu-window* *menu-x* *menu-y* (quote modeline)) ("Minibuffer" mouse-help-region *menu-window* *menu-x* *menu-y* (quote minibuffer)))

(defmenu emacs-quit-menu ("Suspend" suspend-emacstool) ("Quit" save-buffers-kill-emacs))

(defmenu emacs-menu ("Emacs Menu") ("Stuff Selection" sun-yank-selection) ("Expand" . expand-menu) ("Delete Window" . delete-window-menu) ("Previous Buffer" mouse-select-previous-buffer *menu-window*) ("Save Buffers" save-some-buffers) ("List Directory" list-directory nil) ("Dired" dired nil) ("Mouse Help" . mouse-help-menu) ("Quit" . emacs-quit-menu))

(defun emacs-menu-eval (window x y) "\
Pop-up menu of editor commands." (byte-code "	T
S$" [window x y sun-menu-evaluate emacs-menu] 5))

(defun mouse-expand-horizontally (window) (byte-code " Ď	!\" ))" [OriginallySelectedWindow window t selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window enlarge-window 4 update-display] 5))

(defun mouse-expand-vertically (window) (byte-code " Î	!!))" [OriginallySelectedWindow window selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window enlarge-window 4] 4))

(defun mouse-select-previous-buffer (window) "\
Switch buffer in mouse window to most recently selected buffer." (byte-code " Î	! !))" [OriginallySelectedWindow window selected-window ((byte-code "!" [OriginallySelectedWindow select-window] 2)) select-window switch-to-buffer other-buffer] 5))

(defmenu minibuffer-menu ("Minibuffer" message "Just some miscellanous minibuffer commands") ("Stuff" sun-yank-selection) ("Do-It" exit-minibuffer) ("Abort" abort-recursive-edit) ("Suspend" suspend-emacs))

(defun minibuffer-menu-eval (window x y) "\
Pop-up menu of commands." (byte-code "	
S$" [window x y sun-menu-evaluate minibuffer-menu] 5))

(defun mini-move-point (window x y) (byte-code "	Z#" [window x mouse-move-point 6 0] 4))

(defun mini-set-mark-and-stuff (window x y) (byte-code "	Z#" [window x mouse-set-mark-and-stuff 6 0] 4))

(defun Buffer-at-mouse (w x y) "\
Calls Buffer-menu-buffer from mouse click." (byte-code "ċ" [w x y t ((byte-code "	
# !" [w x y t mouse-move-point beginning-of-line Buffer-menu-buffer] 4))] 1))

(defun mouse-buffer-bury (w x y) "\
Bury the indicated buffer." (byte-code "	
#!" [w x y bury-buffer Buffer-at-mouse] 5))

(defun mouse-buffer-select (w x y) "\
Put the indicated buffer in selected window." (byte-code "	
#! " [w x y switch-to-buffer Buffer-at-mouse list-buffers] 5))

(defun mouse-buffer-delete (w x y) "\
mark indicated buffer for delete" (byte-code "Ë" [w x y ((byte-code "	
# " [w x y mouse-move-point Buffer-menu-delete] 4))] 1))

(defun mouse-buffer-execute (w x y) "\
execute buffer-menu selections" (byte-code "Ë" [w x y ((byte-code "	
# " [w x y mouse-move-point Buffer-menu-execute] 4))] 1))

(defun enable-mouse-in-buffer-list nil "\
Call this to enable mouse selections in *Buffer List*
    LEFT puts the indicated buffer in the selected window.
    MIDDLE buries the indicated buffer.
    RIGHT marks the indicated buffer for deletion.
    MIDDLE-RIGHT deletes the marked buffers.
To unmark a buffer marked for deletion, select it with LEFT." (byte-code "" [((byte-code " q\"\"\"\"" [list-buffers "*Buffer List*" local-set-mouse (text middle) mouse-buffer-bury (text left) mouse-buffer-select (text right) mouse-buffer-delete (text middle right) mouse-buffer-execute] 7))] 1))

(global-set-mouse (quote (text left)) (quote mouse-drag-move-point))

(global-set-mouse (quote (text up left)) (quote mouse-drag-set-mark-stuff))

(global-set-mouse (quote (text shift left)) (quote mouse-exch-pt-and-mark))

(global-set-mouse (quote (text double left)) (quote mouse-exch-pt-and-mark))

(global-set-mouse (quote (text middle)) (quote mouse-set-mark-and-stuff))

(global-set-mouse (quote (text right)) (quote emacs-menu-eval))

(global-set-mouse (quote (text shift right)) (quote (sun-yank-selection)))

(global-set-mouse (quote (text double right)) (quote (sun-yank-selection)))

(global-set-mouse (quote (text shift middle)) (quote mouse-save/delete/yank))

(global-set-mouse (quote (text double middle)) (quote mouse-save/delete/yank))

(global-set-mouse (quote (text control middle)) (quote mouse-save-thing-there))

(global-set-mouse (quote (text control right)) (quote mouse-kill-thing-there))

(global-set-mouse (quote (text control left)) (quote mouse-yank-at-point))

(global-set-mouse (quote (text control middle left)) (quote mouse-copy-thing))

(global-set-mouse (quote (text control right left)) (quote mouse-move-thing))

(global-set-mouse (quote (text control right middle)) (quote mouse-mark-thing))

(global-set-mouse (quote (text shift control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (text double control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (text meta left)) (quote mouse-line-to-top))

(global-set-mouse (quote (text meta shift left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (text meta double left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (text meta middle)) (quote mouse-line-to-middle))

(global-set-mouse (quote (text meta shift middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (text meta double middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (text meta control middle)) (quote mouse-split-vertically))

(global-set-mouse (quote (text meta right)) (quote mouse-top-to-line))

(global-set-mouse (quote (text meta shift right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (text meta double right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (text meta control left)) (quote mouse-call-kbd-macro))

(global-set-mouse (quote (text meta control right)) (quote mouse-undo))

(global-set-mouse (quote (scrollbar left)) (quote mouse-line-to-top))

(global-set-mouse (quote (scrollbar shift left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (scrollbar double left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (scrollbar middle)) (quote mouse-line-to-middle))

(global-set-mouse (quote (scrollbar shift middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (scrollbar double middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (scrollbar control middle)) (quote mouse-split-vertically))

(global-set-mouse (quote (scrollbar right)) (quote mouse-top-to-line))

(global-set-mouse (quote (scrollbar shift right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (scrollbar double right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (scrollbar meta left)) (quote mouse-line-to-top))

(global-set-mouse (quote (scrollbar meta shift left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (scrollbar meta double left)) (quote mouse-line-to-bottom))

(global-set-mouse (quote (scrollbar meta middle)) (quote mouse-line-to-middle))

(global-set-mouse (quote (scrollbar meta shift middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (scrollbar meta double middle)) (quote mouse-middle-to-line))

(global-set-mouse (quote (scrollbar meta control middle)) (quote mouse-split-vertically))

(global-set-mouse (quote (scrollbar meta right)) (quote mouse-top-to-line))

(global-set-mouse (quote (scrollbar meta shift right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (scrollbar meta double right)) (quote mouse-bottom-to-line))

(global-set-mouse (quote (scrollbar shift control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (scrollbar double control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (modeline left)) (quote mouse-scroll-up))

(global-set-mouse (quote (modeline meta left)) (quote mouse-select-window))

(global-set-mouse (quote (modeline middle)) (quote mouse-scroll-proportional))

(global-set-mouse (quote (modeline meta middle)) (quote mouse-select-window))

(global-set-mouse (quote (modeline control middle)) (quote mouse-split-horizontally))

(global-set-mouse (quote (modeline right)) (quote mouse-scroll-down))

(global-set-mouse (quote (modeline meta right)) (quote mouse-select-window))

(global-set-mouse (quote (modeline control left)) (quote mouse-delete-other-windows))

(global-set-mouse (quote (modeline control right)) (quote mouse-delete-window))

(global-set-mouse (quote (modeline control left right)) (quote mouse-select-window))

(global-set-mouse (quote (modeline left right)) (quote mouse-select-window))

(global-set-mouse (quote (modeline shift control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (modeline double control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (minibuffer left)) (quote mini-move-point))

(global-set-mouse (quote (minibuffer middle)) (quote mini-set-mark-and-stuff))

(global-set-mouse (quote (minibuffer shift middle)) (quote (prev-complex-command)))

(global-set-mouse (quote (minibuffer double middle)) (quote (prev-complex-command)))

(global-set-mouse (quote (minibuffer control middle)) (quote (next-complex-command 1)))

(global-set-mouse (quote (minibuffer meta middle)) (quote (previous-complex-command 1)))

(global-set-mouse (quote (minibuffer right)) (quote minibuffer-menu-eval))

(global-set-mouse (quote (minibuffer shift control meta right)) (quote mouse-help-region))

(global-set-mouse (quote (minibuffer double control meta right)) (quote mouse-help-region))