Browse Source

Fix `org-without-partial-completion' again.

This uses the macro David Maus suggests.  In particular, it doesn't
use the (let (pc-mode ...)) binding, which, as David states, could
cause leakage if the pc-mode variable is used within ,@body.
Bastien Guerry 14 years ago
parent
commit
65815f64a4
1 changed files with 4 additions and 4 deletions
  1. 4 4
      lisp/org-macs.el

+ 4 - 4
lisp/org-macs.el

@@ -112,13 +112,13 @@ Also, do not record undo information."
        (org-move-to-column _col))))
 
 (defmacro org-without-partial-completion (&rest body)
-  `(let ((pc-mode (and (boundp 'partial-completion-mode)
-		       partial-completion-mode)))
+  `(when (and (boundp 'partial-completion-mode)
+	      (fboundp 'partial-completion-mode))
      (unwind-protect
 	 (progn
-	   (when pc-mode (funcall pc-mode -1))
+	   (partial-completion-mode -1)
 	   ,@body)
-       (when pc-mode (funcall pc-mode 1)))))
+       (partial-completion-mode 1))))
 
 (defmacro org-maybe-intangible (props)
   "Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22.