emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thomas Holst <Thomas_Holst@gmx.de>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: org mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [gnorb] completion for `gnorb-gnus-incoming-do-todo'
Date: Sun, 16 Aug 2015 16:37:38 +0200	[thread overview]
Message-ID: <87si7jfgel@gmx.de> (raw)
In-Reply-To: <877fovvqh9.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 16 Aug 2015 11:53:22 +0800")

[-- Attachment #1: Type: text/plain, Size: 2120 bytes --]

· Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

>>
>> [ ... snip ... ]
>>
>> [ ... snip completion issue with gnorb ... ]
>
> No worries, glad it's sorted!
>
>> But maybe someone can give me a hint how to get helm working here.
>>
>> As mentioned above I have
>>
>> #+begin_src emacs_lisp
>>   (setq org-refile-use-outline-path 'file)
>> #+end_src
>>
>> Because I can travel along the path in steps
>>
>> file <TAB>
>>   1. Heading <TAB>
>>   ...
>>   n. heading <RET>
>>
>> with completion working for each step. With helm enabled for `org-goto'
>> and `org-refile' I see canditates for completion, but neither <TAB> nor
>> M-j have any effect. Minibuffer does not change. When I set
>> `org-refile-use-outline-path' to nil, I get tons of candidates for
>> completion but <TAB> has also no effect. And if I hit <RETURN> with an
>> incomplete input I get an error. This behaviour was the reason why I
>> disabled helm for `org-refile' and `org-goto' to begin with.
>>
>> So has anyone helm working for `org-refile' and `org-goto'? I would
>> appreciate any help here. Thanks.
>
> It works fine here! Have you started from "emacs -Q"? That's usually the
> best first step.

ok here is what I did to reproduce behavior with ECM

  emacs -Q -l "minimal.el"

with minimal.el:

#+begin_src emacs_lisp
  ;; minimal.el to test org-refile helm
  ;; most recent org-mode from git
  (add-to-list 'load-path "/home/thommy/git-emacs/org-mode/lisp")

  (require 'org)

  (setq org-use-speed-commands t) ;; `g' on begining of heading calls `(org-refile t)'
  (setq org-refile-use-outline-path 'file)

  (find-file "/home/thommy/git-emacs/gnorb/gnorb.org") ;; just any org-file works


  ;; most recent helm from git
  (add-to-list 'load-path "~/git-emacs/helm")
  (require 'helm-config)
  (helm-mode 1)
#+end_src

Now when I hit `g' at begining of a headline I get "gnorb.org" as a
candidate for first step. But no key (<TAB>, C - i, C - z) does
completion. If I hit <RET> with partial or complete input for first step
(e.g. "gn" or "gnorb.org") I get an error:

  progn: Wrong type argument: integer-or-marker-p, nil

Backtrace:

[-- Attachment #2: backtrace --]
[-- Type: text/plain, Size: 13682 bytes --]

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto)))
  (if (and arg (not (equal arg 3))) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto))) (if regionp (progn (org-kill-new (buffer-substring region-start region-end)) (org-save-markers-in-region region-start region-end)) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file)))) (setq reversed (org-notes-order-reversed-p)) (save-excursion (save-restriction (widen) (if pos (progn (goto-char pos) (looking-at org-outline-regexp) (setq level (org-get-valid-level ... 1)) (goto-char (if reversed ... ...))) (setq level 1) (if (not reversed) (goto-char (point-max)) (goto-char (point-min)) (or (outline-next-heading) (goto-char ...)))) (if (not (bolp)) (newline)) (org-paste-subtree level nil nil t) (if org-log-refile (progn (org-add-log-setup (quote refile) nil nil (quote findpos) org-log-refile) (if (eq org-log-refile ...) nil (save-excursion ...)))) (and org-auto-align-tags (let ((org-loop-over-headlines-in-active-region nil)) (org-set-tags nil t))) (let ((bookmark-name (plist-get org-bookmark-names-plist :last-refile))) (if bookmark-name (progn (condition-case err ... ...)))) (if (and (boundp (quote org-refile-for-capture)) org-refile-for-capture) (progn (let (...) (if bookmark-name ...)) (move-marker org-capture-last-stored-marker (point)))) (if (fboundp (quote deactivate-mark)) (deactivate-mark)) (run-hooks (quote org-after-refile-insert-hook))))) (if org-refile-keep nil (if regionp (delete-region (point) (+ (point) (- region-end region-start))) (delete-region (and (org-back-to-heading t) (point)) (min (1+ (buffer-size)) (org-end-of-subtree t t) (point))))) (if (featurep (quote org-inlinetask)) (progn (org-inlinetask-remove-END-maybe))) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file))
  (progn (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and (not arg) pos (equal (buffer-file-name) file) (if regionp (and (>= pos region-start) (<= pos region-end)) (and (>= pos (point)) (< pos (save-excursion (org-end-of-subtree t t)))))) (error "Cannot refile to position inside the tree or region")) (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if (and arg (not (equal arg 3))) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto))) (if regionp (progn (org-kill-new (buffer-substring region-start region-end)) (org-save-markers-in-region region-start region-end)) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file)))) (setq reversed (org-notes-order-reversed-p)) (save-excursion (save-restriction (widen) (if pos (progn (goto-char pos) (looking-at org-outline-regexp) (setq level ...) (goto-char ...)) (setq level 1) (if (not reversed) (goto-char ...) (goto-char ...) (or ... ...))) (if (not (bolp)) (newline)) (org-paste-subtree level nil nil t) (if org-log-refile (progn (org-add-log-setup ... nil nil ... org-log-refile) (if ... nil ...))) (and org-auto-align-tags (let (...) (org-set-tags nil t))) (let ((bookmark-name ...)) (if bookmark-name (progn ...))) (if (and (boundp ...) org-refile-for-capture) (progn (let ... ...) (move-marker org-capture-last-stored-marker ...))) (if (fboundp (quote deactivate-mark)) (deactivate-mark)) (run-hooks (quote org-after-refile-insert-hook))))) (if org-refile-keep nil (if regionp (delete-region (point) (+ (point) (- region-end region-start))) (delete-region (and (org-back-to-heading t) (point)) (min (1+ (buffer-size)) (org-end-of-subtree t t) (point))))) (if (featurep (quote org-inlinetask)) (progn (org-inlinetask-remove-END-maybe))) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file)))
  (if (or (and (equal arg 2) org-clock-hd-marker (marker-buffer org-clock-hd-marker) (prog1 (setq it (list (or org-clock-heading "running clock") (buffer-file-name (marker-buffer org-clock-hd-marker)) "" (marker-position org-clock-hd-marker))) (setq arg nil))) (setq it (or rfloc (let (heading-text) (save-excursion (if (and arg ...) nil (org-back-to-heading t) (setq heading-text ...)) (org-refile-get-location (cond ... ... ...) default-buffer (and ... org-refile-allow-creating-parent-nodes) arg)))))) (progn (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and (not arg) pos (equal (buffer-file-name) file) (if regionp (and (>= pos region-start) (<= pos region-end)) (and (>= pos (point)) (< pos (save-excursion ...))))) (error "Cannot refile to position inside the tree or region")) (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if (and arg (not (equal arg 3))) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto))) (if regionp (progn (org-kill-new (buffer-substring region-start region-end)) (org-save-markers-in-region region-start region-end)) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file)))) (setq reversed (org-notes-order-reversed-p)) (save-excursion (save-restriction (widen) (if pos (progn ... ... ... ...) (setq level 1) (if ... ... ... ...)) (if (not ...) (newline)) (org-paste-subtree level nil nil t) (if org-log-refile (progn ... ...)) (and org-auto-align-tags (let ... ...)) (let (...) (if bookmark-name ...)) (if (and ... org-refile-for-capture) (progn ... ...)) (if (fboundp ...) (deactivate-mark)) (run-hooks (quote org-after-refile-insert-hook))))) (if org-refile-keep nil (if regionp (delete-region (point) (+ (point) (- region-end region-start))) (delete-region (and (org-back-to-heading t) (point)) (min (1+ ...) (org-end-of-subtree t t) (point))))) (if (featurep (quote org-inlinetask)) (progn (org-inlinetask-remove-END-maybe))) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file))))
  (if (equal arg (quote (16))) (org-refile-goto-last-stored) (if (or (and (equal arg 2) org-clock-hd-marker (marker-buffer org-clock-hd-marker) (prog1 (setq it (list (or org-clock-heading "running clock") (buffer-file-name ...) "" (marker-position org-clock-hd-marker))) (setq arg nil))) (setq it (or rfloc (let (heading-text) (save-excursion (if ... nil ... ...) (org-refile-get-location ... default-buffer ... arg)))))) (progn (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and (not arg) pos (equal (buffer-file-name) file) (if regionp (and (>= pos region-start) (<= pos region-end)) (and (>= pos ...) (< pos ...)))) (error "Cannot refile to position inside the tree or region")) (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if (and arg (not (equal arg 3))) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto))) (if regionp (progn (org-kill-new (buffer-substring region-start region-end)) (org-save-markers-in-region region-start region-end)) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer (setq nbuf (or ... ...))) (setq reversed (org-notes-order-reversed-p)) (save-excursion (save-restriction (widen) (if pos ... ... ...) (if ... ...) (org-paste-subtree level nil nil t) (if org-log-refile ...) (and org-auto-align-tags ...) (let ... ...) (if ... ...) (if ... ...) (run-hooks ...)))) (if org-refile-keep nil (if regionp (delete-region (point) (+ ... ...)) (delete-region (and ... ...) (min ... ... ...)))) (if (featurep (quote org-inlinetask)) (progn (org-inlinetask-remove-END-maybe))) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file)))))
  (let* ((actionmsg (cond (msg msg) ((equal arg 3) "Refile (and keep)") (t "Refile"))) (cbuf (current-buffer)) (regionp (org-region-active-p)) (region-start (and regionp (region-beginning))) (region-end (and regionp (region-end))) (filename (buffer-file-name (buffer-base-buffer cbuf))) (org-refile-keep (if (equal arg 3) t org-refile-keep)) pos it nbuf file re level reversed) (setq last-command nil) (if regionp (progn (goto-char region-start) (or (bolp) (goto-char (point-at-bol))) (setq region-start (point)) (if (or (org-kill-is-subtree-p (buffer-substring region-start region-end)) (prog1 org-refile-active-region-within-subtree (let (...) (org-toggle-heading) (setq region-end ...)))) nil (user-error "The region is not a (sequence of) subtree(s)")))) (if (equal arg (quote (16))) (org-refile-goto-last-stored) (if (or (and (equal arg 2) org-clock-hd-marker (marker-buffer org-clock-hd-marker) (prog1 (setq it (list ... ... "" ...)) (setq arg nil))) (setq it (or rfloc (let (heading-text) (save-excursion ... ...))))) (progn (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and (not arg) pos (equal (buffer-file-name) file) (if regionp (and ... ...) (and ... ...))) (error "Cannot refile to position inside the tree or region")) (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if (and arg (not (equal arg 3))) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context (quote org-goto))) (if regionp (progn (org-kill-new ...) (org-save-markers-in-region region-start region-end)) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer (setq nbuf ...)) (setq reversed (org-notes-order-reversed-p)) (save-excursion (save-restriction ... ... ... ... ... ... ... ... ... ...))) (if org-refile-keep nil (if regionp (delete-region ... ...) (delete-region ... ...))) (if (featurep (quote org-inlinetask)) (progn (org-inlinetask-remove-END-maybe))) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file))))))
  (if (member arg (quote (0 (64)))) (org-refile-cache-clear) (let* ((actionmsg (cond (msg msg) ((equal arg 3) "Refile (and keep)") (t "Refile"))) (cbuf (current-buffer)) (regionp (org-region-active-p)) (region-start (and regionp (region-beginning))) (region-end (and regionp (region-end))) (filename (buffer-file-name (buffer-base-buffer cbuf))) (org-refile-keep (if (equal arg 3) t org-refile-keep)) pos it nbuf file re level reversed) (setq last-command nil) (if regionp (progn (goto-char region-start) (or (bolp) (goto-char (point-at-bol))) (setq region-start (point)) (if (or (org-kill-is-subtree-p (buffer-substring region-start region-end)) (prog1 org-refile-active-region-within-subtree (let ... ... ...))) nil (user-error "The region is not a (sequence of) subtree(s)")))) (if (equal arg (quote (16))) (org-refile-goto-last-stored) (if (or (and (equal arg 2) org-clock-hd-marker (marker-buffer org-clock-hd-marker) (prog1 (setq it ...) (setq arg nil))) (setq it (or rfloc (let ... ...)))) (progn (setq file (nth 1 it) re (nth 2 it) pos (nth 3 it)) (if (and (not arg) pos (equal ... file) (if regionp ... ...)) (error "Cannot refile to position inside the tree or region")) (setq nbuf (or (find-buffer-visiting file) (find-file-noselect file))) (if (and arg (not ...)) (progn (org-pop-to-buffer-same-window nbuf) (goto-char pos) (org-show-context ...)) (if regionp (progn ... ...) (org-copy-subtree 1 nil t)) (save-current-buffer (set-buffer ...) (setq reversed ...) (save-excursion ...)) (if org-refile-keep nil (if regionp ... ...)) (if (featurep ...) (progn ...)) (setq org-markers-to-move nil) (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file)))))))
  org-refile(t)
  eval((org-refile t))
  (cond ((commandp org-speed-command) (setq this-command org-speed-command) (call-interactively org-speed-command)) ((functionp org-speed-command) (funcall org-speed-command)) ((and org-speed-command (listp org-speed-command)) (eval org-speed-command)) (t (let (org-use-speed-commands) (call-interactively (quote org-self-insert-command)))))
  (cond ((and org-use-speed-commands (let ((kv (this-command-keys-vector))) (setq org-speed-command (run-hook-with-args-until-success (quote org-speed-command-hook) (make-string 1 (aref kv ...)))))) (cond ((commandp org-speed-command) (setq this-command org-speed-command) (call-interactively org-speed-command)) ((functionp org-speed-command) (funcall org-speed-command)) ((and org-speed-command (listp org-speed-command)) (eval org-speed-command)) (t (let (org-use-speed-commands) (call-interactively (quote org-self-insert-command)))))) ((and (org-table-p) (progn (and (featurep (quote org-table)) org-table-auto-blank-field (memq last-command (quote (org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))) (if (or (equal ... 32) (looking-at "[^|\n]*  |")) (let (org-table-may-need-update) (org-table-blank-field)) (org-table-blank-field))) t) (eq N 1) (looking-at "[^|\n]*  |")) (let (org-table-may-need-update) (goto-char (1- (match-end 0))) (backward-delete-char 1) (goto-char (match-beginning 0)) (self-insert-command N))) (t (setq org-table-may-need-update t) (self-insert-command N) (org-fix-tags-on-the-fly) (if org-self-insert-cluster-for-undo (if (not (eq last-command (quote org-self-insert-command))) (setq org-self-insert-command-undo-counter 1) (if (>= org-self-insert-command-undo-counter 20) (setq org-self-insert-command-undo-counter 1) (and (> org-self-insert-command-undo-counter 0) buffer-undo-list (listp buffer-undo-list) (not (cadr buffer-undo-list)) (setcdr buffer-undo-list (cddr buffer-undo-list))) (setq org-self-insert-command-undo-counter (1+ org-self-insert-command-undo-counter)))))))
  org-self-insert-command(1)
  call-interactively(org-self-insert-command nil nil)
  command-execute(org-self-insert-command)

[-- Attachment #3: Type: text/plain, Size: 168 bytes --]


Same happens if I open two org-files and set `org-refile-targets'
accordingly.

Thanks for looking into this - although it has nothing to do with gnorb.

-- 
  Thomas

  reply	other threads:[~2015-08-16 14:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 12:24 [gnorb] completion for `gnorb-gnus-incoming-do-todo' Thomas Holst
2015-08-12 13:53 ` Eric Abrahamsen
     [not found] ` <8737zosjan.fsf@ericabrahamsen.net>
2015-08-12 16:19   ` Thomas Holst
2015-08-15  4:45     ` Eric Abrahamsen
2015-08-15 15:31       ` Thomas Holst
2015-08-16  3:53         ` Eric Abrahamsen
2015-08-16 14:37           ` Thomas Holst [this message]
2015-08-17  7:01             ` Eric Abrahamsen
2015-08-17  8:38               ` Thomas Holst

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=87si7jfgel@gmx.de \
    --to=thomas_holst@gmx.de \
    --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).