
(defvar smart-key-depress-window nil "\
The last window in which the Smart Key was depressed or nil.")

(defvar smart-key-meta-depress-window nil "\
The last window in which the secondary Smart Key was depressed or nil.")

(defvar smart-key-release-window nil "\
The last window in which the Smart Key was released or nil.")

(defvar smart-key-meta-release-window nil "\
The last window in which the secondary Smart Key was released or nil.")

(defvar smart-key-depress-prev-point nil "\
Marker at point prior to last primary Smart Key depress.
Note that this may be a buffer different than where the depress occurs.")

(defvar smart-key-meta-depress-prev-point nil "\
Marker at point prior to last secondary Smart Key depress.
Note that this may be a buffer different than where the depress occurs.")

(defvar smart-key-release-prev-point nil "\
Marker at point prior to last primary Smart Key release.
Note that this may be a buffer different than where the release occurs.")

(defvar smart-key-meta-release-prev-point nil "\
Marker at point prior to last secondary Smart Key release.
Note that this may be a buffer different than where the release occurs.")

(defvar *smart-key-cancelled* nil "\
When non-nil, cancels last Smart Key depress.")

(defvar *smart-key-meta-cancelled* nil "\
When non-nil, cancels last secondary Smart Key depress.")

(defvar *smart-key-help-p* nil "\
When non-nil, forces display of help for next Smart Key release.")

(defvar *smart-key-meta-help-p* nil "\
When non-nil, forces display of help for next secondary Smart Key release.")

(defun smart-key-mouse (&rest args) "\
Set point to the current mouse cursor position and execute 'smart-key'.
Any ARGS will be passed to 'smart-key-mouse-func'." (interactive) (byte-code "	Ã‰ˆƒ ÃÃ‰‚- ƒ ÈÃÃ#‚- ÉÃ\"†- ÈÊÃ#)‡" [smart-key-alist smart-key-mouse-alist *smart-key-depressed* nil *smart-key-cancelled* *smart-key-meta-depressed* args t smart-key-mouse-func smart-key-mouse-help smart-key] 6))

(defun smart-key-mouse-meta (&rest args) "\
Set point to the current mouse cursor position and execute 'smart-key-meta'.
Any ARGS will be passed to 'smart-key-mouse-func'." (interactive) (byte-code "	Ã‰ˆƒ ÃÃ‰‚- ƒ ÈÃÆ#‚- ÉÆ\"†- ÈÊÆ#)‡" [smart-key-alist smart-key-mouse-alist *smart-key-meta-depressed* nil *smart-key-meta-cancelled* *smart-key-depressed* t args smart-key-mouse-func smart-key-mouse-help smart-key-meta] 6))

(defun smart-key-mouse-func (func meta set-point-arg-list) "\
Executes FUNC for META Smart Key and sets point from SET-POINT-ARG-LIST.
FUNC may be nil in which case no function is called.
SET-POINT-ARG-LIST is passed to the call of the command bound to
'mouse-set-point-command'.  Returns nil if 'mouse-set-point-command' variable
is not bound to a valid function." (byte-code "Ñ!…^ Ò
!ƒ Ó 	Ô ‰‚' Ó 	Ô ‰	ˆ
Õ=…> Ö ƒ9 ×‹‚; Ó ‰ˆ‰ˆ?ƒO Ï‚[ Ø!ˆÏÏ‰ˆÐ)‡" [mouse-set-point-command release-args set-point-arg-list meta smart-key-meta-release-window *smart-key-meta-release-args* smart-key-meta-release-prev-point smart-key-release-window *smart-key-release-args* smart-key-release-prev-point major-mode *smart-key-mouse-prev-window* *smart-key-mouse-prefix-arg* current-prefix-arg func nil t fboundp smart-key-mouse-set-point selected-window point-marker br-mode br-in-view-window-p ((br-next-class-window) (selected-window)) funcall] 11))

(defun smart-key-mouse-help (secondary args) "\
If a Smart Key help flag is set and other Smart Key is not down, shows help.
Takes two args:  SECONDARY should be non-nil iff called from a secondary
Smart Key command, ARGS is a list of arguments passed to
'smart-key-mouse-func'.
Returns t if help is displayed, nil otherwise." (byte-code "Æ
ƒ	 ‚
 ?ÊŽ… 	ƒ& Æ‰ˆËÌ
#ˆÈ‚< 	…, 	…< Æ‰	ˆËÍ
#ˆÈ‰)*‡" [help-shown other-key-released secondary *smart-key-depressed* *smart-key-meta-depressed* *smart-key-help-p* nil args t *smart-key-meta-help-p* ((byte-code "… ÂÂ‰ˆÄ‡" [help-shown *smart-key-cancelled* nil *smart-key-meta-cancelled* t] 2)) smart-key-mouse-func smart-key-help smart-key-meta-help] 5))

(defun smart-key nil "\
Use one key to perform functions that vary by buffer.
Default function is given by 'smart-key-other-mode-cmd' variable.
Returns t unless 'smart-key-other-mode-cmd' variable is not bound to a valid
function." (interactive) (byte-code "ÃÀ!† Ä	!… Å	!ˆÂ‡" [nil smart-key-other-mode-cmd t smart-key-execute fboundp funcall] 4))

(defun smart-key-meta nil "\
Use one meta-key to perform functions that vary by buffer.
Default function is given by 'smart-key-meta-other-mode-cmd' variable.
Returns non-nil unless 'smart-key-meta-other-mode-cmd' variable is not bound
to a valid function." (interactive) (byte-code "ÂÀ!† Ã	!… Ä	!ˆÀ‡" [t smart-key-meta-other-mode-cmd smart-key-execute fboundp funcall] 4))

(defun smart-key-execute (meta) "\
Evaluate form (or META form) for first non-nil predicate from 'smart-key-alist'.
Non-nil META means evaluate second form, otherwise evaluate first form.
Returns non-nil iff a non-nil predicate is found." (byte-code "	ÅÅ?… @‰…5 Æ
@!‰ƒ- Æƒ& 
AA‚) 
A@!‚1 A‰ˆ‚ ˆ+‡" [pred-forms smart-key-alist pred-form pred-t meta nil eval] 5))

(defun smart-key-help (&optional meta) "\
Display doc associated with Smart Key command in current context.
Non-nil optional META means use smart-key-meta command, otherwise evaluate
smart-key command.  Returns non-nil iff associated documentation is found." (interactive "P") (byte-code "	ÏÏÏÏÏ?… @‰…* Ð
@!‰†& A‰ˆ‚ ˆƒE ƒ: 
AA‚= 
A@@‰‚U ƒO ‚Q 	‰ˆ…\\ 9ƒÖ Ñ!‰ˆ
@ÒÓÔ!�ÕÖ×ƒ� Ø‚‚ Ù\"!ˆÚ ˆÕÛ!ˆÕ†“ Ü!ˆÚ ˆÕÝ!ˆÕ!ˆ…³ ÕÞ!ˆÚ ˆÚ ˆÕ!ˆß>…Ì ÕÖàáâÎ\"\"!ˆãäåæâ!\"!ˆÚ ‘+ˆÙ‚ã çèƒá Ø‚â Ù\"‰
ˆ.‡" [pred-forms smart-key-alist pred-form pred-t call cmd-sym doc meta smart-key-meta-other-mode-cmd smart-key-other-mode-cmd *smart-key-help-msg* condition temp-buffer-show-hook temp-buffer-show-function t nil eval documentation (lambda (buf) (byte-code "qˆÂ‰ˆÃÄ!… Ä ƒ# ŠÅ ˆÆÇ !ˆÈÉ\")‚' ÈÉ\"‡" [buf buffer-read-only t fboundp br-in-browser br-to-view-window select-window previous-window display-buffer other-win] 9)) hypb:help-buf-name "Smart" princ format "A click of the %sSmart Key" "secondary " "" terpri "WHEN  " "there is no matching Smart Key entry" "CALLS " " WHICH:" (hui:hbut-act hui:hbut-help) "

BUTTON SPECIFICS:

%s
" actype:doc hbut:current hattr:report nthcdr 2 hattr:list message "No %sSmart Key command for current context."] 25))

(defun smart-key-meta-help nil "\
Display doc associated with secondary Smart Key command in current context.
Returns non-nil iff associated documentation is found." (interactive "P") (smart-key-help (quote meta)))

(defun smart-key-help-hide nil "\
Restores display to configuration prior to help buffer display.
Point must be in the help buffer." (byte-code "p	ƒ Ã	!‚ ÄÅ !ˆÆ!ˆÂ‰)‡" [buf *smart-key-screen-config* nil set-window-configuration switch-to-buffer other-buffer bury-buffer] 6))

(defun smart-key-help-show (buffer &optional current-window) "\
Saves prior screen configuration if BUFFER displays help.  Displays BUFFER.
Also sets help buffer's mode to Emacs Lisp mode so smart-lisp function work
on it.

Optional second arg CURRENT-WINDOW non-nil forces display of buffer within
the current window.  By default, it is displayed in another window." (byte-code "Ç!… È!‰ˆ;…( ÉÊ\"…( ÁËÌÍÎ!\">?…( Ï ‰ˆÐ!ƒ: Ñ!ˆÒ ‚= Ó!‰ˆÉÊÈ!\"…S ŠqˆÔ )*‡" [buffer t *smart-key-screen-config* buf wind current-window minibuffer-scroll-window bufferp buffer-name string-match "Help\\*$" mapcar (lambda (wind) (string-match "Help\\*$" buffer)) hypb:window-list no-mini current-window-configuration get-buffer-create switch-to-buffer selected-window display-buffer emacs-lisp-mode] 14))

(defun smart-key-operate (arg) "\
Uses the keyboard to emulate Smart Mouse Key drag actions.
Each invocation alternates between starting a drag and ending it.
Prefix ARG non-nil means emulate secondary Mouse Key rather than primary." (interactive "P") (byte-code "ƒ  	ƒ Ã ˆÄÅ!‚ Æ ˆÄÇÈÉ!ÈÊ!#‚6 
ƒ- Ë ˆÄÌ!‚6 Í ˆÄÎÈÊ!\"‡" [arg *smart-key-meta-depressed* *smart-key-depressed* smart-key-mouse-meta message "Secondary Smart Key released." sm-depress-meta "Secondary Smart Key depressed; go to release point and hit {%s %s}." substitute-command-keys "\\[universal-argument]" "\\[smart-key-operate]" smart-key-mouse "Smart Key released." sm-depress "Smart Key depressed; go to release point and hit {%s}."] 13))

(defun smart-key-summarize (&optional current-window) "\
Displays smart key operation summary in help buffer.
Optional arg CURRENT-WINDOW non-nil forces display of buffer within
the current window.  By default, it is displayed in another window." (byte-code "ÈÉ	\"ÊË!Ì
!ÇÍ!…R ÎÏ!… Ï …\" Ð ˆÑ ‰ˆÒŽƒ4 Ó!‚> Ô
\"ˆÓÌ
!!ˆÇ‰ˆÕ ˆÖ!ˆebˆ×Ç!),‡" [doc-file hyperb:dir buf-name wind owind current-window buffer-read-only nil expand-file-name "hmouse-doc.txt" hypb:help-buf-name "Smart" get-buffer-window file-readable-p fboundp br-in-browser br-to-view-window selected-window ((select-window owind)) select-window smart-key-help-show erase-buffer insert-file-contents set-buffer-modified-p] 16))

(defvar *smart-key-depress-args* nil "\
List of event args from most recent depress of the Smart Mouse Key.")

(defvar *smart-key-meta-depress-args* nil "\
List of mouse event args from most recent secondary Smart Mouse Key depress.")

(defvar *smart-key-release-args* nil "\
List of event args from most recent release of the Smart Mouse Key.")

(defvar *smart-key-meta-release-args* nil "\
List of mouse event args from most recent secondary Smart Mouse Key release.")

(defvar *smart-key-mouse-prev-window* nil "\
Window point was in prior to current invocation of 'smart-key-mouse(-meta)'.")

(defvar *smart-key-mouse-prefix-arg* nil "\
Prefix argument to pass to 'smart-br-cmd-select'.")

(defvar *smart-key-depressed* nil "\
t while Smart key is depressed.")

(defvar *smart-key-meta-depressed* nil "\
t while Smart key is depressed.")

(defvar *smart-key-help-msg* "" "\
Holds last Smart key help message.")

(defvar *smart-key-screen-config* nil "\
Screen configuration prior to display of a help buffer.")

(or (boundp (quote smart-scroll-proportional)) (setq smart-scroll-proportional nil))

(defun scroll-down-eol nil "\
Scrolls down according to value of smart-scroll-proportional.
If smart-scroll-proportional is nil (the default) or if
point is on the bottom window line, scrolls down (backward) a windowful.
Otherwise, tries to bring current line to bottom of window.
Leaves point at end of line and returns t if scrolled, nil if not." (interactive) (byte-code "Á
ƒV Ç ÈÉ 8ZÊd!…) ËÌ d\"Šdbˆnƒ% ‚' S))…2 U†; Í ÎZUƒO Êe!ƒJ Æ‰‚L Ï ‚R ÐÑ!*‚d Êe!ƒb Æ‰‚d Ï ˆÒ ˆ†r Ó ˆÔÕ!ˆ)‡" [rtn t smart-scroll-proportional wind-line max-line mx nil hypb:screen-line 1 window-edges pos-visible-in-window-p count-lines window-start window-height 2 scroll-down recenter -1 end-of-line beep message "Beginning of buffer"] 15))

(defun scroll-up-eol nil "\
Scrolls up according to value of smart-scroll-proportional.
If smart-scroll-proportional is nil (the default) or if
point is on the top window line, scrolls up (forward) a windowful.
Otherwise, tries to bring current line to top of window.
Leaves point at end of line and returns t if scrolled, nil if not." (interactive) (byte-code "Á
ƒ, Å ÆÇ 8ZÈUƒ% Éd!ƒ  Ä‰‚\" Ê ‚( ËÈ!)‚: Éd!ƒ8 Ä‰‚: Ê ˆÌ ˆ†H Í ˆÎÏ!ˆ)‡" [rtn t smart-scroll-proportional wind-line nil hypb:screen-line 1 window-edges 0 pos-visible-in-window-p scroll-up recenter end-of-line beep message "End of buffer"] 11))

(require (quote h-skip-bytec) "h-skip-bytec.lsp")

(defun smart-key-set-point (set-point-arg-list) "\
Sets point to cursor position using SET-POINT-ARG-LIST and returns t.
If 'mouse-set-point-command' is not bound to a function, this does nothing
and returns nil." (byte-code "Æ!…> ÇÁ!… 	ƒ È	!ˆÂ‰‚+ ÇÃ!…+ …+ É!ˆÂ‰ˆƒ7 Ê\"‚: Ê!†> Å‡" [mouse-set-point-command drag-zone nil drag-button set-point-arg-list t fboundp boundp delete-zone delete-button funcall] 8))

(provide (quote hmouse-drv))
