Japanese translation of message catalog for Sawfish Window-Manager
Revisão | 49672b617d9ccb4e61341cd6687c3bc0407498bc (tree) |
---|---|
Hora | 2010-06-06 10:33:02 |
Autor | Jeremy Hankins <nowan@nowa...> |
Commiter | Jeremy Hankins |
sawfish.wm.util.prompt now requires that helper functions be passed explicitly.
@@ -1,3 +1,11 @@ | ||
1 | +2010-05-23 Jeremy Hankins <nowan@nowan.org> | |
2 | + * lisp/sawfish/wm/util/prompt-extras.jl | |
3 | + * lisp/sawfish/wm/util/prompt-wm.jl | |
4 | + * lisp/sawfish/wm/util/prompt.jl: Changed the way prompt is called: | |
5 | + helper functions are now passed directly instead of implicitly | |
6 | + via let statements. Also reverts the previous compilation error | |
7 | + fix, since it's no longer necessary. | |
8 | + | |
1 | 9 | 2010-05-28 Jeremy Hankins <nowan@nowan.org> |
2 | 10 | * lisp/sawfish/wm/util/prompt.jl: Fix compilation error |
3 | 11 | -- [Harald van Dijk] |
@@ -24,6 +24,13 @@ | ||
24 | 24 | |
25 | 25 | (require 'rep.io.files) |
26 | 26 | |
27 | +(defvar prompt-list-fold-case nil | |
28 | + "Whether prompt-from-list should ignore case.") | |
29 | + | |
30 | +(defvar prompt-file-exclude '"\\.(o|jlc|x)$|~$|^#.*#$|^\\.\\.?$" | |
31 | + "A regexp, if it matches the file being considered for completion, the file | |
32 | +is rejected.") | |
33 | + | |
27 | 34 | ;;; completion/validation functions |
28 | 35 | |
29 | 36 | (define (prompt-complete-filename word) |
@@ -64,24 +71,27 @@ | ||
64 | 71 | (file-name-nondirectory (directory-file-name name))) |
65 | 72 | abbrev))) |
66 | 73 | |
67 | -(define (prompt-complete-from-list word) | |
68 | - (let (out) | |
69 | - (mapc (lambda (x) | |
70 | - (when (string-match (concat ?^ (quote-regexp word)) | |
71 | - x nil prompt-list-fold-case) | |
72 | - (setq out (cons x out)))) prompt-list) | |
73 | - out)) | |
74 | - | |
75 | -(define (prompt-validate-from-list name) | |
76 | - (if (null prompt-list-fold-case) | |
77 | - (and (member name prompt-list) name) | |
78 | - (catch 'exit | |
74 | +(define (prompt-list-completor prompt-list) | |
75 | + (lambda (word) | |
76 | + (let (out) | |
79 | 77 | (mapc (lambda (x) |
80 | - (when (string-match (concat ?^ (quote-regexp name) ?$) x nil t) | |
81 | - (throw 'exit name))) prompt-list)))) | |
78 | + (when (string-match (concat ?^ (quote-regexp word)) | |
79 | + x nil prompt-list-fold-case) | |
80 | + (setq out (cons x out)))) prompt-list) | |
81 | + out))) | |
82 | + | |
83 | +(define (prompt-list-validator prompt-list) | |
84 | + (lambda (name) | |
85 | + (if (null prompt-list-fold-case) | |
86 | + (and (member name prompt-list) name) | |
87 | + (catch 'exit | |
88 | + (mapc (lambda (x) | |
89 | + (when (string-match (concat ?^ (quote-regexp name) ?$) x nil t) | |
90 | + (throw 'exit name))) prompt-list))))) | |
82 | 91 | |
83 | 92 | ;;; entry points |
84 | 93 | |
94 | +(define filename-history (prompt-make-history)) | |
85 | 95 | (define (prompt-for-file #!optional title existing start default) |
86 | 96 | "Prompt for a file, if EXISTING is t only files which exist are |
87 | 97 | allowed to be entered." |
@@ -90,14 +100,17 @@ allowed to be entered." | ||
90 | 100 | (setq start (if (stringp start) |
91 | 101 | (expand-file-name start) |
92 | 102 | (file-name-as-directory default-directory))) |
93 | - (let* ((prompt-completion-fun prompt-complete-filename) | |
94 | - (prompt-validation-fun (and existing prompt-validate-filename)) | |
95 | - (prompt-abbrev-fun prompt-abbreviate-filename) | |
96 | - (str (prompt title start))) | |
103 | + (let ((str (prompt #:title title | |
104 | + #:start start | |
105 | + #:completion-fun prompt-complete-filename | |
106 | + #:validation-fun (and existing prompt-validate-filename) | |
107 | + #:abbrev-fun prompt-abbreviate-filename | |
108 | + #:history filename-history))) | |
97 | 109 | (when (and (string= str "") default) |
98 | 110 | (setq str default)) |
99 | 111 | str)) |
100 | 112 | |
113 | +(define directory-name-history (prompt-make-history)) | |
101 | 114 | (define (prompt-for-directory #!optional title existing start default) |
102 | 115 | "Prompt for a directory, if EXISTING is t only files which exist are |
103 | 116 | allowed to be entered." |
@@ -105,10 +118,12 @@ allowed to be entered." | ||
105 | 118 | (setq title "Enter filename:")) |
106 | 119 | (unless (stringp start) |
107 | 120 | (setq start (file-name-as-directory default-directory))) |
108 | - (let* ((prompt-completion-fun prompt-complete-directory) | |
109 | - (prompt-validation-fun (and existing prompt-validate-directory)) | |
110 | - (prompt-abbrev-fun prompt-abbreviate-filename) | |
111 | - (str (prompt title start))) | |
121 | + (let ((str (prompt #:title title | |
122 | + #:start start | |
123 | + #:completion-fun prompt-complete-directory | |
124 | + #:validation-fun (and existing prompt-validate-directory) | |
125 | + #:abbrev-fun prompt-abbreviate-filename | |
126 | + #:history directory-name-history))) | |
112 | 127 | (when (and (string= str "") default) |
113 | 128 | (setq str default)) |
114 | 129 | str)) |
@@ -117,26 +132,30 @@ allowed to be entered." | ||
117 | 132 | "Return a selected choice from the list of options (strings) OPTIONS. |
118 | 133 | PROMPT is the title displayed, START the starting choice. |
119 | 134 | Unless DONT-VALIDATE is t, only a member of PROMPT-LIST will be returned." |
120 | - (let ((prompt-list options) | |
121 | - (prompt-completion-fun prompt-complete-from-list) | |
122 | - (prompt-validation-fun (if dont-validate | |
123 | - nil | |
124 | - prompt-validate-from-list))) | |
125 | - (prompt title start))) | |
135 | + (prompt #:title title | |
136 | + #:start start | |
137 | + #:completion-fun (prompt-list-completor options) | |
138 | + #:validation-fun (if dont-validate | |
139 | + nil | |
140 | + (prompt-list-validator options)))) | |
126 | 141 | |
127 | 142 | (define (prompt-for-string #!optional title start) |
128 | - (let ((prompt-completion-fun prompt-complete-filename) | |
129 | - (prompt-validation-fun nil)) | |
130 | - (prompt (or title "Enter string: ") start))) | |
143 | + (prompt #:title (or title "Enter string: ") | |
144 | + #:start start | |
145 | + ;; XXX: Why is this completing on files??? | |
146 | + #:completion-fun prompt-complete-filename)) | |
131 | 147 | |
132 | 148 | (define (prompt-for-number #!optional title) |
133 | 149 | (let (num) |
134 | 150 | (while (not (numberp num)) |
135 | - (setq num (read-from-string (prompt (or title "Enter number: "))))) | |
151 | + (setq num (read-from-string (prompt | |
152 | + #:title (or title "Enter number: "))))) | |
136 | 153 | num)) |
137 | 154 | |
138 | 155 | (define (pwd-prompt title) |
139 | - (let ((prompt-display-fun (lambda (string) | |
140 | - (make-string (length string) ?*))) | |
141 | - (prompt-history nil)) | |
142 | - (prompt-for-string title))) | |
156 | + "Prompt for a string, hiding the string behind asterisks (e.g., for | |
157 | +a password)." | |
158 | + (prompt #:title title | |
159 | + #:history (make-fluid) ; Disable history | |
160 | + #:display-fun (lambda (string) | |
161 | + (make-string (length string) ?*)))) |
@@ -43,11 +43,12 @@ | ||
43 | 43 | (if (string-match re (car names)) |
44 | 44 | (cons (car names) (names-matching re (cdr names))) |
45 | 45 | (names-matching re (cdr names)))))) |
46 | - (prompt-completion-fun | |
46 | + (complete-windows | |
47 | 47 | (lambda (text) |
48 | 48 | (names-matching (format nil "^%s" text) |
49 | 49 | (sort (window-names (managed-windows))))))) |
50 | - (let ((window-title (prompt (or title (_ "Window:"))))) | |
50 | + (let ((window-title (prompt #:title (or title (_ "Window:")) | |
51 | + #:completion-fun complete-windows))) | |
51 | 52 | (unless (zerop (length window-title)) |
52 | 53 | (cdr (assoc window-title (mapcar (lambda (w) |
53 | 54 | (cons (window-name w) w)) |
@@ -70,10 +71,11 @@ | ||
70 | 71 | (if (string-match re (car names)) |
71 | 72 | (cons (car names) (names-matching re (cdr names))) |
72 | 73 | (names-matching re (cdr names)))))) |
73 | - (prompt-completion-fun | |
74 | + (complete-workspaces | |
74 | 75 | (lambda (text) |
75 | 76 | (names-matching (format nil "^%s" text) (workspaces))))) |
76 | - (let ((ws-title (prompt (or title (_ "Workspace:")))) | |
77 | + (let ((ws-title (prompt #:title (or title (_ "Workspace:")) | |
78 | + #:completion-fun complete-workspaces)) | |
77 | 79 | (wsl (workspaces))) |
78 | 80 | (unless (zerop (length ws-title)) |
79 | 81 | (let ((where (member ws-title wsl))) |
@@ -19,6 +19,7 @@ | ||
19 | 19 | prompt-for-function |
20 | 20 | prompt-for-variable |
21 | 21 | prompt-for-command |
22 | + prompt-make-history | |
22 | 23 | |
23 | 24 | ;; motion / editing commands |
24 | 25 | prompt-backward-character |
@@ -85,51 +86,31 @@ | ||
85 | 86 | "Regexp that determines which characters are to be considered part |
86 | 87 | of a word when moving.") |
87 | 88 | |
88 | - (defvar prompt-file-exclude '"\\.(o|jlc|x)$|~$|^#.*#$|^\\.\\.?$" | |
89 | - "A regexp, if it matches the file being considered for completion, | |
90 | -the file is rejected.") | |
91 | - | |
92 | - (defvar prompt-list nil | |
93 | - "List of possible entries for prompt-from-list.") | |
94 | - | |
95 | - (defvar prompt-list-fold-case nil | |
96 | - "Whether prompt-from-list should ignore case.") | |
97 | - | |
98 | - (defvar prompt-history (make-ring 16) | |
99 | - "Ring buffer containing strings most-recently entered through the `prompt' | |
100 | -function.") | |
101 | - | |
102 | 89 | (defvar prompt-window-position |
103 | 90 | (cons (- (quotient (screen-width) 2) 200) -200) |
104 | 91 | "A cons cell defining the screen position at which the `prompt' window is |
105 | 92 | displayed. See the `display-message' function for more details.") |
106 | 93 | |
107 | - (defvar prompt-result nil) | |
108 | - (defvar prompt-prompt nil) | |
109 | - (defvar prompt-completion-fun nil) | |
110 | - (defvar prompt-validation-fun nil) | |
111 | - (defvar prompt-abbrev-fun nil) | |
112 | - (defvar prompt-display-fun nil) | |
113 | - (defvar prompt-position 0) | |
114 | - (defvar prompt-completion-position nil) | |
115 | - (defvar prompt-completions nil) | |
116 | - (defvar prompt-completions-outdated nil) | |
117 | - (defvar prompt-history-pos nil) | |
118 | - (defvar prompt-saved nil) | |
119 | - (defvar prompt-attr nil) | |
120 | - | |
121 | - ;; Compilation hack: ensure that the compiler doesn't complain when | |
122 | - ;; these are treated like functions and passed values. | |
123 | - (eval-when-compile | |
124 | - (progn | |
125 | - (defvar prompt-completion-fun nil) | |
126 | - (defvar prompt-validation-fun nil) | |
127 | - (defvar prompt-abbrev-fun nil) | |
128 | - (defvar prompt-display-fun nil) | |
129 | - (setq prompt-completion-fun (lambda (#!rest) nil) | |
130 | - prompt-validation-fun (lambda (#!rest) nil) | |
131 | - prompt-abbrev-fun (lambda (#!rest) nil) | |
132 | - prompt-display-fun (lambda (#!rest) nil)))) | |
94 | + (define (prompt-make-history) | |
95 | + "Make a receptacle for prompt history." | |
96 | + (make-fluid (make-ring 16))) | |
97 | + | |
98 | + ;; Internal variables: | |
99 | + (define prompt-history-default (prompt-make-history)) | |
100 | + (define prompt-history nil) | |
101 | + (define prompt-result nil) | |
102 | + (define prompt-prompt nil) | |
103 | + (define prompt-completion-fun nil) | |
104 | + (define prompt-validation-fun nil) | |
105 | + (define prompt-abbrev-fun nil) | |
106 | + (define prompt-display-fun nil) | |
107 | + (define prompt-position 0) | |
108 | + (define prompt-completion-position nil) | |
109 | + (define prompt-completions nil) | |
110 | + (define prompt-completions-outdated nil) | |
111 | + (define prompt-history-pos nil) | |
112 | + (define prompt-saved nil) | |
113 | + (define prompt-attr nil) | |
133 | 114 | |
134 | 115 | |
135 | 116 | ;; From merlin |
@@ -149,11 +130,11 @@ displayed. See the `display-message' function for more details.") | ||
149 | 130 | (assq key alist) |
150 | 131 | (cons key default))) |
151 | 132 | |
152 | - (defun prompt-exit () | |
133 | + (define (prompt-exit) | |
153 | 134 | "Cancel string input." |
154 | 135 | (throw 'prompt-exit nil)) |
155 | 136 | |
156 | - (defun prompt-accept () | |
137 | + (define (prompt-accept) | |
157 | 138 | "End input and accept current string." |
158 | 139 | (let ((result (if (not prompt-validation-fun) |
159 | 140 | prompt-result |
@@ -166,7 +147,7 @@ displayed. See the `display-message' function for more details.") | ||
166 | 147 | (throw 'prompt-exit result)) |
167 | 148 | (beep)))) |
168 | 149 | |
169 | - (defun prompt-next (count) | |
150 | + (define (prompt-next count) | |
170 | 151 | (interactive "p") |
171 | 152 | (when prompt-history |
172 | 153 | (setq count (- prompt-history-pos count)) |
@@ -185,21 +166,21 @@ displayed. See the `display-message' function for more details.") | ||
185 | 166 | (prompt-end-of-line) |
186 | 167 | (prompt-update-display))) |
187 | 168 | |
188 | - (defun prompt-previous (count) | |
169 | + (define (prompt-previous count) | |
189 | 170 | (interactive "p") |
190 | 171 | (prompt-next (- count))) |
191 | 172 | |
192 | - (defun prompt-changed () | |
173 | + (define (prompt-changed) | |
193 | 174 | (setq prompt-completions-outdated t)) |
194 | 175 | |
195 | - (defun prompt-clear () | |
176 | + (define (prompt-clear) | |
196 | 177 | "Clear input buffer." |
197 | 178 | (setq prompt-result "") |
198 | 179 | (setq prompt-position 0) |
199 | 180 | (prompt-changed) |
200 | 181 | (prompt-update-display)) |
201 | 182 | |
202 | - (defun prompt-backspace () | |
183 | + (define (prompt-backspace) | |
203 | 184 | "Remove previous character from buffer." |
204 | 185 | (when (> prompt-position 0) |
205 | 186 | (let ((cutoff (max (- prompt-position 1) 0))) |
@@ -210,20 +191,20 @@ displayed. See the `display-message' function for more details.") | ||
210 | 191 | (prompt-changed) |
211 | 192 | (prompt-update-display)))) |
212 | 193 | |
213 | - (defun prompt-kill-line () | |
194 | + (define (prompt-kill-line) | |
214 | 195 | "Delete rest of line." |
215 | 196 | (setq prompt-result (substring prompt-result 0 prompt-position)) |
216 | 197 | (prompt-changed) |
217 | 198 | (prompt-update-display)) |
218 | 199 | |
219 | - (defun prompt-move (num) | |
200 | + (define (prompt-move num) | |
220 | 201 | "Move NUM characters forward or backward." |
221 | 202 | (let ((new-pos (+ prompt-position num))) |
222 | 203 | (and (>= new-pos 0) (<= new-pos (length prompt-result)) |
223 | 204 | (setq prompt-position new-pos) |
224 | 205 | (prompt-update-display)))) |
225 | 206 | |
226 | - (defun prompt-forward-word () | |
207 | + (define (prompt-forward-word) | |
227 | 208 | "Move to next non-word character." |
228 | 209 | (setq prompt-position (1+ prompt-position)) |
229 | 210 | (while (and (< prompt-position (length prompt-result)) |
@@ -234,7 +215,7 @@ displayed. See the `display-message' function for more details.") | ||
234 | 215 | (length prompt-result))) |
235 | 216 | (prompt-update-display)) |
236 | 217 | |
237 | - (defun prompt-backward-word () | |
218 | + (define (prompt-backward-word) | |
238 | 219 | "Move to previous non-word character." |
239 | 220 | (setq prompt-position (1- prompt-position)) |
240 | 221 | (while (and (> prompt-position 0) |
@@ -244,25 +225,25 @@ displayed. See the `display-message' function for more details.") | ||
244 | 225 | (setq prompt-position (max prompt-position 0)) |
245 | 226 | (prompt-update-display)) |
246 | 227 | |
247 | - (defun prompt-forward-character () | |
228 | + (define (prompt-forward-character) | |
248 | 229 | "Move forward one character." |
249 | 230 | (prompt-move 1)) |
250 | 231 | |
251 | - (defun prompt-backward-character () | |
232 | + (define (prompt-backward-character) | |
252 | 233 | "Move backward one character." |
253 | 234 | (prompt-move -1)) |
254 | 235 | |
255 | - (defun prompt-beginning-of-line () | |
236 | + (define (prompt-beginning-of-line) | |
256 | 237 | "Move to beginning of line." |
257 | 238 | (setq prompt-position 0) |
258 | 239 | (prompt-update-display)) |
259 | 240 | |
260 | - (defun prompt-end-of-line () | |
241 | + (define (prompt-end-of-line) | |
261 | 242 | "Move to end of line." |
262 | 243 | (setq prompt-position (length prompt-result)) |
263 | 244 | (prompt-update-display)) |
264 | 245 | |
265 | - (defun prompt-complete () | |
246 | + (define (prompt-complete) | |
266 | 247 | (if (and (not prompt-completions-outdated) prompt-completion-position) |
267 | 248 | (let |
268 | 249 | ((new (min (max 0 (- (length prompt-completions) |
@@ -290,7 +271,7 @@ displayed. See the `display-message' function for more details.") | ||
290 | 271 | (setq prompt-completion-position 0)))))) |
291 | 272 | (prompt-update-display)) |
292 | 273 | |
293 | - (defun prompt-format-completions () | |
274 | + (define (prompt-format-completions) | |
294 | 275 | (when (numberp prompt-completion-position) |
295 | 276 | (let ((compl (nthcdr prompt-completion-position prompt-completions)) |
296 | 277 | (continued nil)) |
@@ -307,7 +288,7 @@ displayed. See the `display-message' function for more details.") | ||
307 | 288 | compl)) |
308 | 289 | continued)))) |
309 | 290 | |
310 | - (defun prompt-update-display () | |
291 | + (define (prompt-update-display) | |
311 | 292 | (let ((result (if prompt-display-fun |
312 | 293 | (prompt-display-fun prompt-result) |
313 | 294 | prompt-result)) |
@@ -334,7 +315,7 @@ displayed. See the `display-message' function for more details.") | ||
334 | 315 | ))))) |
335 | 316 | |
336 | 317 | ;; Insert all unbound keys to result. |
337 | - (defun prompt-unbound-callback () | |
318 | + (define (prompt-unbound-callback) | |
338 | 319 | (let ((key (current-event-string))) |
339 | 320 | (setq prompt-result |
340 | 321 | (concat (substring prompt-result 0 prompt-position) |
@@ -345,8 +326,20 @@ displayed. See the `display-message' function for more details.") | ||
345 | 326 | (prompt-update-display) |
346 | 327 | t)) |
347 | 328 | |
348 | - (defun prompt (#!optional title start attributes) | |
349 | - "Prompt the user for a string." | |
329 | + (define (prompt #!key title start attributes completion-fun | |
330 | + validation-fun abbrev-fun display-fun history) | |
331 | + "Prompt the user for a string. All of the keyword options are | |
332 | +optional and have reasonable defaults. | |
333 | + | |
334 | + - `title' is the message displayed to prompt the user. | |
335 | + - `start' is an initial string automatically entered into the prompt. | |
336 | + - `attributes' can be used to set text attributes. | |
337 | + - `completion-fun' is a function used for tab completion. | |
338 | + - `validation-fun' is a function that checks input for validity. | |
339 | + - `abbrev-fun' is used to abbreviate possible completions for display. | |
340 | + - `display-fun' can be used to change the way entered text is displayed. | |
341 | + - `history' contains history. Use `prompt-make-history' to generate | |
342 | + an appropriate value." | |
350 | 343 | (unless (stringp title) |
351 | 344 | (setq title "Enter string:")) |
352 | 345 | (unless (string-match " $" title) |
@@ -354,52 +347,68 @@ displayed. See the `display-message' function for more details.") | ||
354 | 347 | (call-with-keyboard-grabbed |
355 | 348 | (lambda () |
356 | 349 | (unwind-protect |
357 | - (let* ((override-keymap prompt-keymap) | |
358 | - (prompt-result (or start "")) | |
359 | - (prompt-prompt title) | |
360 | - (prompt-position (length prompt-result)) | |
361 | - (prompt-history-pos 0) | |
362 | - (prompt-saved nil) | |
363 | - (prompt-attr attributes) | |
364 | - (prompt-completion-position nil) | |
365 | - (prompt-completions nil) | |
366 | - (prompt-completions-outdated t) | |
367 | - (unbound-key-hook (list prompt-unbound-callback))) | |
350 | + (let ((override-keymap prompt-keymap) | |
351 | + (unbound-key-hook (list prompt-unbound-callback))) | |
352 | + (setq prompt-history (fluid (or history | |
353 | + prompt-history-default)) | |
354 | + prompt-completion-fun completion-fun | |
355 | + prompt-validation-fun validation-fun | |
356 | + prompt-abbrev-fun abbrev-fun | |
357 | + prompt-display-fun display-fun | |
358 | + prompt-result (or start "") | |
359 | + prompt-prompt title | |
360 | + prompt-position (length prompt-result) | |
361 | + prompt-history-pos 0 | |
362 | + prompt-saved nil | |
363 | + prompt-attr attributes | |
364 | + prompt-completion-position nil | |
365 | + prompt-completions nil | |
366 | + prompt-completions-outdated t) | |
368 | 367 | (prompt-update-display) |
369 | 368 | (catch 'prompt-exit |
370 | 369 | (recursive-edit))) |
371 | 370 | (display-message nil))))) |
372 | 371 | |
373 | - (defun prompt-for-symbol (#!optional title predicate validator) | |
374 | - (let ((prompt-completion-fun | |
375 | - (lambda (x) | |
376 | - (mapcar symbol-name | |
377 | - (apropos (concat ?^ (quote-regexp x)) predicate)))) | |
378 | - (prompt-validation-fun | |
379 | - (lambda (x) | |
380 | - (let | |
381 | - ((symbol (intern x))) | |
382 | - (if validator | |
383 | - (and (validator symbol) symbol) | |
384 | - symbol))))) | |
385 | - (prompt title))) | |
386 | - | |
387 | - (defun prompt-for-function (#!optional title) | |
372 | + (define symbol-history (prompt-make-history)) | |
373 | + (define (prompt-for-symbol #!key title predicate validator history) | |
374 | + (prompt #:title title | |
375 | + #:completion-fun (lambda (x) | |
376 | + (mapcar symbol-name | |
377 | + (apropos (concat ?^ (quote-regexp x)) | |
378 | + predicate))) | |
379 | + #:validation-fun (lambda (x) | |
380 | + (let | |
381 | + ((symbol (intern x))) | |
382 | + (if validator | |
383 | + (and (validator symbol) symbol) | |
384 | + symbol))) | |
385 | + #:history (or history symbol-history))) | |
386 | + | |
387 | + (define function-history (prompt-make-history)) | |
388 | + (define (prompt-for-function #!optional title) | |
388 | 389 | "Prompt for a function." |
389 | - (prompt-for-symbol (or title "Enter name of function:") | |
390 | - (lambda (x) | |
391 | - (and (boundp x) | |
392 | - (let ((value (symbol-value x))) | |
393 | - (or (functionp value) | |
394 | - (macrop value) | |
395 | - (special-form-p value))))))) | |
396 | - | |
397 | - (defun prompt-for-variable (#!optional title) | |
390 | + (prompt-for-symbol #:title (or title "Enter name of function:") | |
391 | + #:predicate (lambda (x) | |
392 | + (and (boundp x) | |
393 | + (let ((value (symbol-value x))) | |
394 | + (or (functionp value) | |
395 | + (macrop value) | |
396 | + (special-form-p value))))) | |
397 | + #:history function-history)) | |
398 | + | |
399 | + (define variable-history (prompt-make-history)) | |
400 | + (define (prompt-for-variable #!optional title) | |
398 | 401 | "Prompt for a variable." |
399 | - (prompt-for-symbol (or title "Enter name of variable:") boundp)) | |
400 | - | |
401 | - (defun prompt-for-command (#!optional title) | |
402 | - (prompt-for-symbol title commandp commandp)) | |
402 | + (prompt-for-symbol #:title (or title "Enter name of variable:") | |
403 | + #:predicate boundp | |
404 | + #:history variable-history)) | |
405 | + | |
406 | + (define command-history (prompt-make-history)) | |
407 | + (define (prompt-for-command #!optional title) | |
408 | + (prompt-for-symbol #:title title | |
409 | + #:predicate commandp | |
410 | + #:validator commandp | |
411 | + #:history command-history)) | |
403 | 412 | |
404 | 413 | |
405 | 414 | ;;; autoloads |
@@ -13,6 +13,13 @@ they occurred between. For more detailed information see the | ||
13 | 13 | |
14 | 14 | @itemize @bullet |
15 | 15 | |
16 | +@item Bugfixes | |
17 | +@itemize @minus | |
18 | +@item The sawfish.wm.util.prompt no longer makes all of its internals | |
19 | +available globally, so helper functions must be passed explicitly rather | |
20 | +than implicitly via let statements. | |
21 | +@end itemize | |
22 | + | |
16 | 23 | @item New Features |
17 | 24 | @itemize @minus |
18 | 25 | @item Added border_with and border_color frame-part attributes |