aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-15 19:07:02 +0000
committerRichard M. Stallman1997-07-15 19:07:02 +0000
commitca85cf8a5a49c199e58a24b2d2a41b70a6ec548a (patch)
tree38ca8881d4909f1992943e1c40b11f56374abcfa
parent48fe8caca1c7a982e93d08b12a4f75c7ea0f2c19 (diff)
downloademacs-ca85cf8a5a49c199e58a24b2d2a41b70a6ec548a.tar.gz
emacs-ca85cf8a5a49c199e58a24b2d2a41b70a6ec548a.zip
(tmm-prompt): Use save-excursion around completing-read code.
(tmm-add-prompt): Clean up using save-selected-window and with-current-buffer.
-rw-r--r--lisp/tmm.el45
1 files changed, 21 insertions, 24 deletions
diff --git a/lisp/tmm.el b/lisp/tmm.el
index d294f41d4d2..3ca00def6e1 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -184,20 +184,21 @@ Its value should be an event that has a binding in MENU."
184 (setq history (append history history history history)) 184 (setq history (append history history history history))
185 (setq tmm-c-prompt (nth (- history-len 1 index-of-default) history)) 185 (setq tmm-c-prompt (nth (- history-len 1 index-of-default) history))
186 (add-hook 'minibuffer-setup-hook 'tmm-add-prompt) 186 (add-hook 'minibuffer-setup-hook 'tmm-add-prompt)
187 (unwind-protect 187 (save-excursion
188 (setq out 188 (unwind-protect
189 (completing-read 189 (setq out
190 (concat gl-str " (up/down to change, PgUp to menu): ") 190 (completing-read
191 tmm-km-list nil t nil 191 (concat gl-str " (up/down to change, PgUp to menu): ")
192 (cons 'history (- (* 2 history-len) index-of-default)))) 192 tmm-km-list nil t nil
193 (save-excursion 193 (cons 'history (- (* 2 history-len) index-of-default))))
194 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt) 194 (save-excursion
195 (if (get-buffer "*Completions*") 195 (remove-hook 'minibuffer-setup-hook 'tmm-add-prompt)
196 (progn 196 (if (get-buffer "*Completions*")
197 (set-buffer "*Completions*") 197 (progn
198 (use-local-map tmm-old-comp-map) 198 (set-buffer "*Completions*")
199 (bury-buffer (current-buffer))))) 199 (use-local-map tmm-old-comp-map)
200 ))) 200 (bury-buffer (current-buffer)))))
201 ))))
201 (setq choice (cdr (assoc out tmm-km-list))) 202 (setq choice (cdr (assoc out tmm-km-list)))
202 (and (null choice) 203 (and (null choice)
203 (> (length out) (length tmm-c-prompt)) 204 (> (length out) (length tmm-c-prompt))
@@ -323,21 +324,17 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
323 (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)) 324 (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))
324 (if tmm-completion-prompt 325 (if tmm-completion-prompt
325 (progn 326 (progn
326 (set-buffer "*Completions*") 327 (set-buffer "*Completions*")
327 (goto-char 1) 328 (goto-char 1)
328 (insert tmm-completion-prompt))) 329 (insert tmm-completion-prompt)))
329 ) 330 )
330 (save-excursion 331 (save-selected-window
331 (other-window 1) ; Electric-pop-up-window does 332 (other-window 1) ; Electric-pop-up-window does
332 ; not work in minibuffer 333 ; not work in minibuffer
333 (set-buffer (window-buffer (Electric-pop-up-window "*Completions*"))) 334 (Electric-pop-up-window "*Completions*")
335 (with-current-buffer "*Completions*"
336 (setq tmm-old-comp-map (tmm-define-keys nil))))
334 337
335 (setq tmm-old-comp-map (tmm-define-keys nil))
336
337 (select-window win) ; Cannot use
338 ; save-window-excursion, since
339 ; it restores the size
340 )
341 (insert tmm-c-prompt))) 338 (insert tmm-c-prompt)))
342 339
343(defun tmm-delete-map () 340(defun tmm-delete-map ()