annotate lisp/hyperbole/hact.el @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents 376386a54a3c
children
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)
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
58 (cond ((fboundp 'compiled-function-interactive)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
59 (compiled-function-interactive action))
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
60 ((commandp action)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
61 (list 'interactive (aref action 5))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (commandp action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defun action:create (param-list body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "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
66 (if (symbolp body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (list 'function (cons 'lambda (cons param-list body)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defun action:kbd-macro (macro &optional repeat-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Returns Hyperbole action that executes a keyboard MACRO REPEAT-COUNT times."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (list 'execute-kbd-macro macro repeat-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (defun action:params (action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "Returns unmodified ACTION parameter list."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (cond ((null action) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ((symbolp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (car (cdr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (and (fboundp action) (hypb:indirect-function action)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ((listp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (if (eq (car action) 'autoload)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (error "(action:params): Autoload not supported: %s" action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (car (cdr action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ((hypb:v19-byte-code-p action)
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
85 (if (fboundp 'compiled-function-arglist)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
86 (compiled-function-arglist action)
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
87 ;; Turn into a list for extraction
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 0
diff changeset
88 (car (cdr (cons nil (append action nil))))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (defun action:param-list (action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "Returns list of actual ACTION parameters (removes '&' special forms)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (delq nil (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (lambda (param)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (if (= (aref (symbol-name param)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 0) ?&)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 nil param)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (action:params action))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defun action:path-args-abs (args-list &optional default-dirs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Return any paths in ARGS-LIST made absolute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 Uses optional DEFAULT-DIRS or 'default-directory'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 Other arguments are returned unchanged."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (mapcar (function (lambda (arg) (hpath:absolute-to arg default-dirs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 args-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defun action:path-args-rel (args-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 "Return any paths in ARGS-LIST below current directory made relative.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 Other paths are simply expanded. Non-path arguments are returned unchanged."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (let ((dir (hattr:get 'hbut:current 'dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (mapcar (function (lambda (arg) (hpath:relative-to arg dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 args-list)))
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 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;; actype class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (defmacro hact (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 "Performs action formed from rest of ARGS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 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
122 function. Runs 'action:act-hook' before performing action."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (eval (` (cons 'funcall (cons 'hrule:action (quote (, args)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defun actype:act (actype &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "Performs action formed from ACTYPE and rest of ARGS and returns value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 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
128 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
129 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
130 performing ACTION."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; Needed so relative paths are expanded properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (setq args (action:path-args-abs args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (let ((prefix-arg current-prefix-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (action (actype:action actype))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (act '(apply action args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (if (null action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (error "(actype:act): Null action for: '%s'" actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (let ((hist-elt (hhist:element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (run-hooks 'action:act-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (prog1 (or (cond ((or (symbolp action) (listp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (hypb:v19-byte-code-p action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (eval act))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ((and (stringp action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (let ((func (key-binding action)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (if (not (integerp action))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (setq action func))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (eval act))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (t (eval action)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (hhist:add hist-elt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defun actype:action (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 "Returns action part of ACTYPE (a symbol or symbol name).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ACTYPE may be a Hyperbole actype or Emacs Lisp function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (let (actname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (if (stringp actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (setq actname actype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 actype (intern actype))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (setq actname (symbol-name actype)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (cond ((htype:body (if (string-match "^actypes::" actname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 actype
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (intern-soft (concat "actypes::" actname)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ((fboundp actype) actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defmacro actype:create (type params doc &rest default-action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "Creates an action TYPE (an unquoted symbol) with PARAMS, described by DOC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 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
170 arguments). A call to this function is syntactically the same as for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 'defun', but a doc string is required.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 Returns symbol created when successful, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (list 'htype:create type 'actypes doc params default-action nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (fset 'defact 'actype:create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (put 'actype:create 'lisp-indent-function 'defun)
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:delete (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "Deletes an action TYPE (a symbol). Returns TYPE's symbol if it existed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (htype:delete type 'actypes))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defun actype:doc (hbut &optional full)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "Returns first line of act doc for HBUT (a Hyperbole button symbol).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 With optional FULL, returns full documentation string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 Returns nil when no documentation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (let* ((act (and (hbut:is-p hbut) (or (hattr:get hbut 'action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (hattr:get hbut 'actype))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (but-type (hattr:get hbut 'categ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (sym-p (and act (symbolp act)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (end-line) (doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (cond ((and but-type (fboundp but-type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq doc (htype:doc but-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; Is an implicit button, so use its doc string if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (sym-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (setq doc (htype:doc act))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (if (null doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq doc (substitute-command-keys doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (or full (setq end-line (string-match "[\n]" doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 doc (substring doc 0 end-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (defun actype:identity (&rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "Returns list of ARGS unchanged or if no ARGS, returns t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 Used as the setting of 'hrule:action' to inhibit action evaluation."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (or args t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (defun actype:interact (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "Interactively calls default action for ACTYPE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ACTYPE is a symbol that was previously defined with 'defact'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 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
213 calling form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (let ((action (htype:body
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (intern-soft (concat "actypes::" (symbol-name actype))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (and action (action:commandp action) (or (call-interactively action) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (defun actype:params (actype)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 "Returns list of ACTYPE's parameters."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (action:params (actype:action actype)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (provide 'hact)