emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-olpath-completing-read is not friendly with partial-completion-mode
@ 2009-10-16  6:52 Levin Du
  2009-10-16 16:27 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Levin Du @ 2009-10-16  6:52 UTC (permalink / raw)
  To: Org-mode Mode

Try this:

(partial-completion-mode t)
(funcall 'org-olpath-completing-read "? "
         '("todo1.org/tasks/"
          "todo1.org/tasks/normal/"
          "todo1.org/tasks/urgent/"
          "note.org/")
         nil t nil nil)

todo<tab><tab>

It stays on todo1.org/ (Sole completion)



my raw patch:
diff --git a/vendor/org/org.el b/vendor/org/org.el
index d3d886f..f3a02cf 100644
--- a/vendor/org/org.el
+++ b/vendor/org/org.el
@@ -7780,23 +7780,29 @@ from."

 (defun org-icompleting-read (&rest args)
   "Completing-read using `ido-mode' or `iswitchb' speedups if available"
-  (if (and org-completion-use-ido
-	   (fboundp 'ido-completing-read)
-	   (boundp 'ido-mode) ido-mode
-	   (listp (second args)))
-      (let ((ido-enter-matching-directory nil))
-	(apply 'ido-completing-read (concat (car args))
-	       (if (consp (car (nth 1 args)))
-		   (mapcar (lambda (x) (car x)) (nth 1 args))
-		 (nth 1 args))
-	       (cddr args)))
-    (if (and org-completion-use-iswitchb
-	     (boundp 'iswitchb-mode) iswitchb-mode
-	     (listp (second args)))
-	(apply 'org-iswitchb-completing-read (concat (car args))
-	       (mapcar (lambda (x) (car x)) (nth 1 args))
-	       (cddr args))
-      (apply 'completing-read args))))
+  (let ((saved-pc-mode partial-completion-mode))
+    (when saved-pc-mode
+      (partial-completion-mode 0))
+    (unwind-protect
+        (if (and org-completion-use-ido
+                 (fboundp 'ido-completing-read)
+                 (boundp 'ido-mode) ido-mode
+                 (listp (second args)))
+            (let ((ido-enter-matching-directory nil))
+              (apply 'ido-completing-read (concat (car args))
+                     (if (consp (car (nth 1 args)))
+                         (mapcar (lambda (x) (car x)) (nth 1 args))
+                       (nth 1 args))
+                     (cddr args)))
+          (if (and org-completion-use-iswitchb
+                   (boundp 'iswitchb-mode) iswitchb-mode
+                   (listp (second args)))
+              (apply 'org-iswitchb-completing-read (concat (car args))
+                     (mapcar (lambda (x) (car x)) (nth 1 args))
+                     (cddr args))
+            (apply 'completing-read args)))
+      (when saved-pc-mode
+        (partial-completion-mode 1)))))

 (defun org-extract-attributes (s)
   "Extract the attributes cookie from a string and set as text property."
@@ -8890,7 +8896,6 @@ See also `org-refile-use-outline-path' and
`org-completion-use-ido'"
   (unless org-refile-target-table
     (error "No refile targets"))
   (let* ((cbuf (current-buffer))
-	 (partial-completion-mode nil)
 	 (cfn (buffer-file-name (buffer-base-buffer cbuf)))
 	 (cfunc (if (and org-refile-use-outline-path
 			 org-outline-path-complete-in-steps)


Hope it helps.

Regards,
Levin

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: org-olpath-completing-read is not friendly with partial-completion-mode
  2009-10-16  6:52 org-olpath-completing-read is not friendly with partial-completion-mode Levin Du
@ 2009-10-16 16:27 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-10-16 16:27 UTC (permalink / raw)
  To: Levin Du; +Cc: Org-mode Mode

Hi Levin,

I am already turning off partial completion mode for a number of
relevant completion prompts, even have defined a macro org-without- 
partial-completion for this purpose.

In what particular circumstance are you hit by this problem?

- Carsten

On Oct 16, 2009, at 8:52 AM, Levin Du wrote:

> Try this:
>
> (partial-completion-mode t)
> (funcall 'org-olpath-completing-read "? "
>         '("todo1.org/tasks/"
>          "todo1.org/tasks/normal/"
>          "todo1.org/tasks/urgent/"
>          "note.org/")
>         nil t nil nil)
>
> todo<tab><tab>
>
> It stays on todo1.org/ (Sole completion)
>
>
>
> my raw patch:
> diff --git a/vendor/org/org.el b/vendor/org/org.el
> index d3d886f..f3a02cf 100644
> --- a/vendor/org/org.el
> +++ b/vendor/org/org.el
> @@ -7780,23 +7780,29 @@ from."
>
> (defun org-icompleting-read (&rest args)
>   "Completing-read using `ido-mode' or `iswitchb' speedups if  
> available"
> -  (if (and org-completion-use-ido
> -	   (fboundp 'ido-completing-read)
> -	   (boundp 'ido-mode) ido-mode
> -	   (listp (second args)))
> -      (let ((ido-enter-matching-directory nil))
> -	(apply 'ido-completing-read (concat (car args))
> -	       (if (consp (car (nth 1 args)))
> -		   (mapcar (lambda (x) (car x)) (nth 1 args))
> -		 (nth 1 args))
> -	       (cddr args)))
> -    (if (and org-completion-use-iswitchb
> -	     (boundp 'iswitchb-mode) iswitchb-mode
> -	     (listp (second args)))
> -	(apply 'org-iswitchb-completing-read (concat (car args))
> -	       (mapcar (lambda (x) (car x)) (nth 1 args))
> -	       (cddr args))
> -      (apply 'completing-read args))))
> +  (let ((saved-pc-mode partial-completion-mode))
> +    (when saved-pc-mode
> +      (partial-completion-mode 0))
> +    (unwind-protect
> +        (if (and org-completion-use-ido
> +                 (fboundp 'ido-completing-read)
> +                 (boundp 'ido-mode) ido-mode
> +                 (listp (second args)))
> +            (let ((ido-enter-matching-directory nil))
> +              (apply 'ido-completing-read (concat (car args))
> +                     (if (consp (car (nth 1 args)))
> +                         (mapcar (lambda (x) (car x)) (nth 1 args))
> +                       (nth 1 args))
> +                     (cddr args)))
> +          (if (and org-completion-use-iswitchb
> +                   (boundp 'iswitchb-mode) iswitchb-mode
> +                   (listp (second args)))
> +              (apply 'org-iswitchb-completing-read (concat (car  
> args))
> +                     (mapcar (lambda (x) (car x)) (nth 1 args))
> +                     (cddr args))
> +            (apply 'completing-read args)))
> +      (when saved-pc-mode
> +        (partial-completion-mode 1)))))
>
> (defun org-extract-attributes (s)
>   "Extract the attributes cookie from a string and set as text  
> property."
> @@ -8890,7 +8896,6 @@ See also `org-refile-use-outline-path' and
> `org-completion-use-ido'"
>   (unless org-refile-target-table
>     (error "No refile targets"))
>   (let* ((cbuf (current-buffer))
> -	 (partial-completion-mode nil)
> 	 (cfn (buffer-file-name (buffer-base-buffer cbuf)))
> 	 (cfunc (if (and org-refile-use-outline-path
> 			 org-outline-path-complete-in-steps)
>
>
> Hope it helps.
>
> Regards,
> Levin
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-16 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-16  6:52 org-olpath-completing-read is not friendly with partial-completion-mode Levin Du
2009-10-16 16:27 ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).