
(require (quote hhist))

(fset (quote action:commandp) (quote commandp))

(defun action:create (param-list body) "\
Create an action defined by PARAM-LIST and BODY, a list of Lisp forms." (byte-code "9ƒ	 ‚ Â	BB‡" [body param-list lambda] 3))

(defun action:act (hbut action &optional same-window) "\
Performs HBUT's ACTION.
An action may be a symbol, key sequence string, or any Lisp form.
Call 'action:kbd-macro' to create an action which executes a keyboard macro.
Optional SAME-WINDOW (only used by version 1 buttons) means output from
action should appear in same window." (byte-code "	ÌÍÎ\"!ÍÄ\"Ï?ƒ Ç‚† Ð 9ƒR Ñ!Ç
		GÒUƒ: Ó ‚N Ô!ƒG Õ!‚N Ö×Ñ!\"*‚€ <ƒ^ Õ!‚€ ;…s Ø!‰…s Ù!?ƒ| Õ!‚€ Õ!ˆÚ!),‡" [prefix-arg current-prefix-arg but-lbl hbut args act action nil hist-elt sym-name action-name t hbut:key-to-label hattr:get lbl-key (apply action (or args (if (> (length (action:param-list action)) 0) (list but-lbl)))) hhist:element symbol-name 2 hyperb:action-v1 boundp eval error "(action:act): Action not defined: '%s'" key-binding integerp hhist:add] 17))

(defun action:kbd-macro (macro &optional repeat-count) "\
Returns Hyperbole action that executes a keyboard MACRO REPEAT-COUNT times." (byte-code "Â	E‡" [macro repeat-count execute-kbd-macro] 3))

(defun action:params (action) "\
Returns unmodified ACTION parameter list." (byte-code "<ƒ	 ‚ 9… Á!… K‰ˆA@‡" [action fboundp] 3))

(defun action:param-list (action) "\
Returns list of actual ACTION parameters (removes '&' special forms)." (byte-code "ÂÀÃÄÅ	!\"\"‡" [nil action delq mapcar (lambda (param) (if (= (aref (symbol-name param) 0) 38) nil param)) action:params] 6))

(defun action:path-args-rel (args-list) "\
Return any paths in ARGS-LIST below current directory made relative.
Other paths are simply expanded.  Other arguments are returned unchanged." (byte-code "ÁÂ\"‡" [args-list mapcar hpath:relative-to] 3))

(defun actype:action (actype) "\
Returns action part of ACTYPE (a symbol or symbol name)." (byte-code "Â	;ƒ 	Ã	!‰‚ Ä	!‰ˆÅÆÇ\"ƒ# 	‚( ÈÉP!Ê\")‡" [actname actype nil intern symbol-name hattr:get string-match "::" intern-soft "actypes::" action] 7))

(fset (quote defact) (quote actype:create))

(defmacro actype:create (type params doc &rest default-action) "Creates an action TYPE (an unquoted symbol) with PARAMS, described by DOC.
The type uses PARAMS to perform DEFAULT-ACTION (list of the rest of the
arguments).  A call to this function is syntactically the same as for
'defun',  but a doc string is required.

Returns symbol created when successful, else nil." (byte-code "Å	\"‰ˆÆDÇÈÉ
%)‡" [default-action params plist type doc action:create action list htype:create actypes] 7))

(defun actype:delete (type) "\
Deletes an action TYPE (a symbol).  Returns TYPE's symbol if it existed." (byte-code "ÁÂ\"‡" [type htype:delete actypes] 3))

(defun actype:doc (hbut &optional full) "\
Returns first line of act doc for HBUT (a Hyperbole button symbol).
With optional FULL, returns full documentation string.
Returns nil when no documentation." (byte-code "Ç	!… È	É\"† È	Ê\"… 9ÄÄ
…& Ë!‰…? Ì!‰ˆ†? ÍÎ\"ÏO‰ˆ,‡" [act hbut sym-p end-line nil doc full hbut:is-p hattr:get action actype htype:doc substitute-command-keys string-match "[
]" 0] 9))

(defun actype:interact (actype) "\
Interactively calls default action for ACTYPE.
ACTYPE is a symbol that was previously defined with 'defact'.
Returns nil only when no action is found or the action has no interactive
calling form." (byte-code "ÃÄÅÆ	!P!À\"… Ç!… È!† Â)‡" [action actype t hattr:get intern-soft "actypes::" symbol-name action:commandp call-interactively] 6))

(defun actype:params (actype) "\
Returns list of ACTYPE's parameters." (byte-code "ÁÂ!!‡" [actype action:params actype:action] 3))

(provide (quote hact))
