]> git.eshelyaron.com Git - emacs.git/commitdiff
(tmm-completion-delete-prompt): Don't hardcode point-min==1.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 14 Apr 2008 18:13:16 +0000 (18:13 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 14 Apr 2008 18:13:16 +0000 (18:13 +0000)
(tmm-add-prompt): Make sure completion-setup-hook is preserved even in
case of an error in display-completion-list.

lisp/ChangeLog
lisp/tmm.el

index 9b26b79300535d21990cc7186bfa5dd7e458c198..a43325c7b5b805a46b5fc238af929579ce8dfacc 100644 (file)
@@ -1,5 +1,9 @@
 2008-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * tmm.el (tmm-completion-delete-prompt): Don't hardcode point-min==1.
+       (tmm-add-prompt): Make sure completion-setup-hook is preserved even in
+       case of an error in display-completion-list.
+
        * filecache.el (file-cache-completions-keymap): Move init from
        file-cache-completion-setup-function into declaration.
        (file-cache-minibuffer-complete): Simplify.
index e8d98388afc32e2f9b15ffe0503140c59a08c417..b04e0c28d9f313dc286d9c68a8df8e86f0eb362d 100644 (file)
@@ -345,8 +345,8 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
 
 (defun tmm-completion-delete-prompt ()
   (set-buffer standard-output)
-  (goto-char 1)
-  (delete-region 1 (search-forward "Possible completions are:\n")))
+  (goto-char (point-min))
+  (delete-region (point) (search-forward "Possible completions are:\n")))
 
 (defun tmm-remove-inactive-mouse-face ()
   "Remove the mouse-face property from inactive menu items."
@@ -378,9 +378,10 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
         (or tmm-completion-prompt
             (add-hook 'completion-setup-hook
                       'tmm-completion-delete-prompt 'append))
-       (with-output-to-temp-buffer "*Completions*"
-         (display-completion-list completions))
-        (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))
+        (unwind-protect
+            (with-output-to-temp-buffer "*Completions*"
+              (display-completion-list completions))
+          (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)))
       (set-buffer "*Completions*")
       (tmm-remove-inactive-mouse-face)
       (when tmm-completion-prompt