@@ -236,8 +236,7 @@ minibuffer."
236
236
; ; Construct a menu of the choices
237
237
; ; and then use it for prompting for a single character.
238
238
(let* ((next-digit ?0 )
239
- (map (make-sparse-keymap ))
240
- choice some-choice-enabled value)
239
+ alist choice some-choice-enabled value)
241
240
(with-current-buffer (get-buffer-create " widget-choose" )
242
241
(erase-buffer )
243
242
(insert " Available choices:\n\n " )
@@ -247,7 +246,7 @@ minibuffer."
247
246
(let* ((name (substitute-command-keys (car choice)))
248
247
(function (cdr choice )))
249
248
(insert (format " %c = %s \n " next-digit name))
250
- (define-key map ( vector next-digit) function)
249
+ (push ( cons next-digit function) alist )
251
250
(setq some-choice-enabled t )))
252
251
; ; Allocate digits to disabled alternatives
253
252
; ; so that the digit of a given alternative never varies.
@@ -257,33 +256,17 @@ minibuffer."
257
256
(forward-line ))
258
257
(or some-choice-enabled
259
258
(error " None of the choices is currently meaningful " ))
260
- (define-key map [?\M -\C -v] 'scroll-other-window )
261
- (define-key map [?\M --] 'negative-argument )
262
259
(save-window-excursion
263
- (let ((buf (get-buffer " widget-choose" )))
264
- (display-buffer buf
265
- '(display-buffer-in-direction
266
- (direction . bottom)
267
- (window-height . fit-window-to-buffer)))
268
- (let ((cursor-in-echo-area t )
269
- (arg 1 ))
270
- (while (not value)
271
- (setq value (lookup-key map (read-key-sequence (format " %s : " title))))
272
- (unless value
273
- (user-error " Canceled" ))
274
- (when
275
- (cond ((eq value 'scroll-other-window )
276
- (let ((minibuffer-scroll-window
277
- (get-buffer-window buf)))
278
- (if (> 0 arg)
279
- (scroll-other-window-down
280
- (window-height minibuffer-scroll-window))
281
- (scroll-other-window ))
282
- (setq arg 1 )))
283
- ((eq value 'negative-argument )
284
- (setq arg -1 )))
285
- (setq value nil ))))))
286
- value))))
260
+ ; ; Select window to be able to scroll it from minibuffer
261
+ (with-selected-window
262
+ (display-buffer (get-buffer " widget-choose" )
263
+ '(display-buffer-in-direction
264
+ (direction . bottom)
265
+ (window-height . fit-window-to-buffer)))
266
+ (setq value (read-char-from-minibuffer
267
+ (format " %s : " title)
268
+ (mapcar #'car alist)))))
269
+ (cdr (assoc value alist))))))
287
270
288
271
; ;; Widget text specifications.
289
272
; ;
0 commit comments