* Re: helm and org-refile
2014-06-17 11:01 ` Eric Abrahamsen
@ 2014-06-18 15:09 ` Sylvain Rousseau
2014-06-20 17:25 ` Eric Abrahamsen
0 siblings, 1 reply; 7+ messages in thread
From: Sylvain Rousseau @ 2014-06-18 15:09 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: Org Mode
[-- Attachment #1.1: Type: text/plain, Size: 2023 bytes --]
Here is the updated patch and config from my .emacs
(when (and (boundp 'org-completion-handler)
(require 'helm nil t))
(defun org-helm-completion-handler
(prompt collection &optional predicate require-match
initial-input hist def inherit-input-method)
(helm-comp-read prompt
collection
;; the character \ is filtered out by default ;(
:fc-transformer nil
:test predicate
:must-match require-match
:initial-input initial-input
:history hist
:default def))
(setq org-completion-handler 'org-helm-completion-handler))
2014-06-17 13:01 GMT+02:00 Eric Abrahamsen <eric@ericabrahamsen.net>:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
> > Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> >
> > Hi
> >
> >> I just started using helm, with some ambivalence. Turning on helm mode
> >> stompled all over my emacs, but for just that reason I suppose it might
> >> be worth trading my ido muscle memory for helm muscle memory.
> >
> > helm is truly amazing and impressive, and I did not even scratch the
> > surface of it, but 2 things bother me:
> >
> > - when using helm, I'm caught in the mini-buffer, no way to switch to
> > another workgroup/buffer to look up things ...
> > - helm is somehow too interactive, once done with it, the search/result
> buffers
> > disappear, while I would like them to stay around sometimes
> >
> > So not an answer to you question, but rather a related question - is
> > there a way around the problems described?
>
> As a three-hour-old Helm user, I answer with some trepidation... I've
> seen a bunch of helm-session-* stuff, and my guess is, that's what
> sessions are for: leaving off helm actions, and coming back to them. I
> think it's pretty clear how to come back to them, but as for the
> "leaving off"...
>
>
>
[-- Attachment #1.2: Type: text/html, Size: 2986 bytes --]
[-- Attachment #2: 0001-Add-custom-completion-function.patch --]
[-- Type: text/x-diff, Size: 8470 bytes --]
From db9c5bce8c994a41e23116f8cd9d695ffad431e1 Mon Sep 17 00:00:00 2001
From: thisirs <thisirs@gmail.com>
Date: Wed, 18 Jun 2014 15:36:14 +0200
Subject: [PATCH 1/5] Add custom completion function
---
lisp/org-capture.el | 2 +-
lisp/org.el | 114 ++++++++++++++++++++++++++--------------------------
2 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index c053640..81f13ca 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1707,7 +1707,7 @@ The template may still contain \"%?\" for cursor positioning."
(member char '("u" "U"))
nil nil (list org-end-time-was-given)))
(t
- (let (org-completion-use-ido)
+ (let (org-completion-handler)
(push (org-completing-read-no-i
(concat (if prompt prompt "Enter string")
(if default (concat " [" default "]"))
diff --git a/lisp/org.el b/lisp/org.el
index 44a4e44..17144e8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4297,23 +4297,16 @@ This is needed for font-lock setup.")
:tag "Org Completion"
:group 'org)
-(defcustom org-completion-use-ido nil
- "Non-nil means use ido completion wherever possible.
-Note that `ido-mode' must be active for this variable to be relevant.
-If you decide to turn this variable on, you might well want to turn off
-`org-outline-path-complete-in-steps'.
-See also `org-completion-use-iswitchb'."
+(defcustom org-completion-handler nil
+ "Non-nil means use other completion handler wherever possible.
+If you decide to turn this variable on, you might well want to
+turn off `org-outline-path-complete-in-steps'."
:group 'org-completion
- :type 'boolean)
-
-(defcustom org-completion-use-iswitchb nil
- "Non-nil means use iswitchb completion wherever possible.
-Note that `iswitchb-mode' must be active for this variable to be relevant.
-If you decide to turn this variable on, you might well want to turn off
-`org-outline-path-complete-in-steps'.
-Note that this variable has only an effect if `org-completion-use-ido' is nil."
- :group 'org-completion
- :type 'boolean)
+ :type '(choice
+ (const :tag "Default" nil)
+ (const :tag "Ido" ido)
+ (const :tag "Iswitchb" iswitchb)
+ (function :tag "Other")))
(defcustom org-completion-fallback-command 'hippie-expand
"The expansion command called by \\[pcomplete] in normal context.
@@ -10163,15 +10156,16 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
(unwind-protect
(progn
(setq link
- (org-completing-read
- "Link: "
- (append
- (mapcar (lambda (x) (concat x ":"))
- all-prefixes)
- (mapcar 'car org-stored-links))
- nil nil nil
- 'tmphist
- (caar org-stored-links)))
+ (let (org-completion-handler)
+ (org-completing-read
+ "Link: "
+ (append
+ (mapcar (lambda (x) (concat x ":"))
+ all-prefixes)
+ (mapcar 'car org-stored-links))
+ nil nil nil
+ 'tmphist
+ (caar org-stored-links))))
(if (not (string-match "\\S-" link))
(user-error "No link selected"))
(mapc (lambda(l)
@@ -10309,7 +10303,7 @@ See `read-file-name' for a description of parameters."
(apply 'org-icompleting-read args)))
(defun org-completing-read-no-i (&rest args)
- (let (org-completion-use-ido org-completion-use-iswitchb)
+ (let (org-completion-handler)
(apply 'org-completing-read args)))
(defun org-iswitchb-completing-read (prompt choices &rest args)
@@ -10323,27 +10317,36 @@ from."
(iswitchb-read-buffer prompt)))
(defun org-icompleting-read (&rest args)
- "Completing-read using `ido-mode' or `iswitchb' speedups if available."
+ "Completing-read using `ido-mode', `iswitchb' or other
+speedups if available."
(org-without-partial-completion
- (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 'car (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))
- (if (consp (car (nth 1 args)))
- (mapcar 'car (nth 1 args))
- (nth 1 args))
- (cddr args))
- (apply 'completing-read args)))))
+ (cond
+ ((and (eq org-completion-handler '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 'car (nth 1 args))
+ (nth 1 args))
+ (cddr args))))
+ ((and (eq org-completion-handler 'iswitchb)
+ (boundp 'iswitchb-mode) iswitchb-mode
+ (listp (second args)))
+ (apply 'org-iswitchb-completing-read (concat (car args))
+ (if (consp (car (nth 1 args)))
+ (mapcar 'car (nth 1 args))
+ (nth 1 args))
+ (cddr args)))
+ ((and (functionp org-completion-handler)
+ (listp (second args)))
+ (apply org-completion-handler (concat (car args))
+ (if (consp (car (nth 1 args)))
+ (mapcar 'car (nth 1 args))
+ (nth 1 args))
+ (cddr args)))
+ (t (apply 'completing-read args)))))
(defun org-extract-attributes (s)
"Extract the attributes cookie from a string and set as text property."
@@ -11641,7 +11644,7 @@ RFLOC can be a refile location obtained in a different way.
MSG is a string to replace \"Refile\" in the default prompt with
another verb. E.g. `org-copy' sets this parameter to \"Copy\".
-See also `org-refile-use-outline-path' and `org-completion-use-ido'.
+See also `org-refile-use-outline-path' and `org-completion-use-handler'.
If you are using target caching (see `org-refile-use-cache'), you
have to clear the target cache in order to find new targets.
@@ -11936,8 +11939,7 @@ this is used for the GOTO interface."
(defun org-olpath-completing-read (prompt collection &rest args)
"Read an outline path like a file name."
(let ((thetable collection)
- (org-completion-use-ido nil) ; does not work with ido.
- (org-completion-use-iswitchb nil)) ; or iswitchb
+ org-completion-handler) ; not working with other completion handler
(apply
'org-icompleting-read prompt
(lambda (string predicate &optional flag)
@@ -15271,7 +15273,7 @@ When INCREMENT is non-nil, set the property to the next allowed value."
(car (nth (1- rpl) allowed))
(org-completing-read "Effort: " allowed nil))))
(t
- (let (org-completion-use-ido org-completion-use-iswitchb)
+ (let (org-completion-handler)
(org-completing-read
(concat "Effort " (if (and cur (string-match "\\S-" cur))
(concat "[" cur "]") "")
@@ -15866,7 +15868,7 @@ This is computed according to `org-property-set-functions-alist'."
(funcall set-function prompt allowed nil
(not (get-text-property 0 'org-unrestricted
(caar allowed))))
- (let (org-completion-use-ido org-completion-use-iswitchb)
+ (let (org-completion-handler)
(funcall set-function prompt
(mapcar 'list (org-property-values property))
nil nil "" nil cur)))))
@@ -17926,16 +17928,14 @@ changes from another. I believe the procedure must be like this:
With one prefix argument, restrict available buffers to files.
With two prefix arguments, restrict available buffers to agenda files.
-Defaults to `iswitchb' for buffer name completion.
-Set `org-completion-use-ido' to make it use ido instead."
+Defaults to `iswitchb' for buffer name completion. Set
+`org-completion-handler' to make it use ido or other completion
+function instead."
(interactive "P")
(let ((blist (cond ((equal arg '(4)) (org-buffer-list 'files))
((equal arg '(16)) (org-buffer-list 'agenda))
(t (org-buffer-list))))
- (org-completion-use-iswitchb org-completion-use-iswitchb)
- (org-completion-use-ido org-completion-use-ido))
- (unless (or org-completion-use-ido org-completion-use-iswitchb)
- (setq org-completion-use-iswitchb t))
+ (org-completion-handler (or org-completion-handler 'iswitchb)))
(org-pop-to-buffer-same-window
(org-icompleting-read "Org buffer: "
(mapcar 'list (mapcar 'buffer-name blist))
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread