From: Sylvain Rousseau <thisirs@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: helm and org-refile
Date: Wed, 18 Jun 2014 17:09:35 +0200 [thread overview]
Message-ID: <CAJ8n832=n7MifAtLOefeUb=b4WdLHQQ52V8B9D8VBpkR0iUKqw@mail.gmail.com> (raw)
In-Reply-To: <87mwdbiyuc.fsf@ericabrahamsen.net>
[-- 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
next prev parent reply other threads:[~2014-06-18 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 10:20 helm and org-refile Eric Abrahamsen
2014-06-17 10:32 ` Thorsten Jolitz
2014-06-17 11:01 ` Eric Abrahamsen
2014-06-18 15:09 ` Sylvain Rousseau [this message]
2014-06-20 17:25 ` Eric Abrahamsen
2014-06-23 20:17 ` Michael Bach
2014-06-23 22:18 ` Eric Abrahamsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJ8n832=n7MifAtLOefeUb=b4WdLHQQ52V8B9D8VBpkR0iUKqw@mail.gmail.com' \
--to=thisirs@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=eric@ericabrahamsen.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).