annotate lisp/hyperbole/hact.el @ 80:1ce6082ce73f r20-0b90

Import from CVS: tag r20-0b90
author cvs
date Mon, 13 Aug 2007 09:06:37 +0200
parents 376386a54a3c
children 929b76928fce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hact.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Hyperbole button action handling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; ORG: Brown U.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 18-Sep-91 at 02:57:09
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; LAST-MOD: 14-Apr-95 at 15:57:11 by Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (require 'hhist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defvar hrule:action 'actype:act
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 "Value is a function of any number of arguments that executes actions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 Variable is used to vary actual effect of evaluating a Hyperbole action,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 e.g. to inhibit actions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; action class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (defun action:commandp (function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 "Return interactive calling form if FUNCTION has one, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (let ((action
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (cond ((null function) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ((symbolp function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (and (fboundp function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (hypb:indirect-function function)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ((and (listp function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (eq (car function) 'autoload))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (error "(action:commandp): Autoload not supported: %s" function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (t function))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (if (hypb:v19-byte-code-p action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (if (commandp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (list 'interactive (aref action 5)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (commandp action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (defun action:create (param-list body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 "Create an action defined by PARAM-LIST and BODY, a list of Lisp forms."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (if (symbolp body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (list 'function (cons 'lambda (cons param-list body)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defun action:kbd-macro (macro &optional repeat-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Returns Hyperbole action that executes a keyboard MACRO REPEAT-COUNT times."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (list 'execute-kbd-macro macro repeat-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun action:params (action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Returns unmodified ACTION parameter list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (cond ((null action) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ((symbolp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (car (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (and (fboundp action) (hypb:indirect-function action)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ((listp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (if (eq (car action) 'autoload)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (error "(action:params): Autoload not supported: %s" action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (car (cdr action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ((hypb:v19-byte-code-p action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;; Turn into a list for extraction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (car (cdr (cons nil (append action nil)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (defun action:param-list (action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 "Returns list of actual ACTION parameters (removes '&' special forms)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (delq nil (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (lambda (param)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (if (= (aref (symbol-name param)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 0) ?&)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 nil param)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (action:params action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defun action:path-args-abs (args-list &optional default-dirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 "Return any paths in ARGS-LIST made absolute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 Uses optional DEFAULT-DIRS or 'default-directory'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Other arguments are returned unchanged."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (mapcar (function (lambda (arg) (hpath:absolute-to arg default-dirs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 args-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (defun action:path-args-rel (args-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 "Return any paths in ARGS-LIST below current directory made relative.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 Other paths are simply expanded. Non-path arguments are returned unchanged."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (let ((dir (hattr:get 'hbut:current 'dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (mapcar (function (lambda (arg) (hpath:relative-to arg dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 args-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;; actype class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defmacro hact (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "Performs action formed from rest of ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 First arg may be a symbol or symbol name for either an action type or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 function. Runs 'action:act-hook' before performing action."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (eval (` (cons 'funcall (cons 'hrule:action (quote (, args)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defun actype:act (actype &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 "Performs action formed from ACTYPE and rest of ARGS and returns value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 If value is nil, however, t is returned instead, to ensure that implicit button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 types register the performance of the action. ACTYPE may be a symbol or symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 name for either an action type or a function. Runs 'action:act-hook' before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 performing ACTION."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; Needed so relative paths are expanded properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (setq args (action:path-args-abs args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (let ((prefix-arg current-prefix-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (action (actype:action actype))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (act '(apply action args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (if (null action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (error "(actype:act): Null action for: '%s'" actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (let ((hist-elt (hhist:element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (run-hooks 'action:act-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (prog1 (or (cond ((or (symbolp action) (listp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (hypb:v19-byte-code-p action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (eval act))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ((and (stringp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (let ((func (key-binding action)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (if (not (integerp action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (setq action func))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (eval act))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (t (eval action)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (hhist:add hist-elt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (defun actype:action (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "Returns action part of ACTYPE (a symbol or symbol name).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ACTYPE may be a Hyperbole actype or Emacs Lisp function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (let (actname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (if (stringp actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (setq actname actype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 actype (intern actype))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (setq actname (symbol-name actype)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (cond ((htype:body (if (string-match "^actypes::" actname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 actype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (intern-soft (concat "actypes::" actname)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ((fboundp actype) actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (defmacro actype:create (type params doc &rest default-action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 "Creates an action TYPE (an unquoted symbol) with PARAMS, described by DOC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 The type uses PARAMS to perform DEFAULT-ACTION (list of the rest of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 arguments). A call to this function is syntactically the same as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 'defun', but a doc string is required.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Returns symbol created when successful, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (list 'htype:create type 'actypes doc params default-action nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (fset 'defact 'actype:create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (put 'actype:create 'lisp-indent-function 'defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defun actype:delete (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "Deletes an action TYPE (a symbol). Returns TYPE's symbol if it existed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (htype:delete type 'actypes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (defun actype:doc (hbut &optional full)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "Returns first line of act doc for HBUT (a Hyperbole button symbol).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 With optional FULL, returns full documentation string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Returns nil when no documentation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (let* ((act (and (hbut:is-p hbut) (or (hattr:get hbut 'action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (hattr:get hbut 'actype))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (but-type (hattr:get hbut 'categ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (sym-p (and act (symbolp act)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (end-line) (doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (cond ((and but-type (fboundp but-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (setq doc (htype:doc but-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; Is an implicit button, so use its doc string if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (sym-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq doc (htype:doc act))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (if (null doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (setq doc (substitute-command-keys doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (or full (setq end-line (string-match "[\n]" doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 doc (substring doc 0 end-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (defun actype:identity (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "Returns list of ARGS unchanged or if no ARGS, returns t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 Used as the setting of 'hrule:action' to inhibit action evaluation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (or args t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (defun actype:interact (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "Interactively calls default action for ACTYPE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ACTYPE is a symbol that was previously defined with 'defact'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 Returns nil only when no action is found or the action has no interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 calling form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (let ((action (htype:body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (intern-soft (concat "actypes::" (symbol-name actype))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (and action (action:commandp action) (or (call-interactively action) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (defun actype:params (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 "Returns list of ACTYPE's parameters."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (action:params (actype:action actype)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (provide 'hact)