emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* refile workflow -- move to same heading in different file?
@ 2017-08-02 15:11 Raymond Zeitler
  2017-08-03 10:07 ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-02 15:11 UTC (permalink / raw)
  To: 'org-mode mailing list'

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

How do I customize org to refile from one file to another?  I am baffled
that org-refile is not set up to do this out-of-the-box.

 

versions:

Org mode version 9.0.9 (9.0.9-30-g796a78-elpa @
c:/Users/rayz/AppData/Roaming/RZHOME/.emacs.d/elpa/org-20170703/)

GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24

Windows 7 SP1

user is a member of the local administrator group

 

Details.

C-c C-w cannot seem to recognize any of my agenda files, even though
org-refile-targets is set to (in custom-set-variables):

(org-refile-targets (quote ((org-agenda-files :regexp . "Tasks"))))

 

Suppose org-agenda-files contains "~/proj1.org" "~/proj2.org" "~/proj3.org"
"~/todo.org".

 

My expectation is that when I press C-c C-w with point on a subheading of
Tasks in todo.org, I can specify, say proj1.org and get the subheading moved
to proj1.org under Tasks.  However, org-refile responds [No Match], even if
I provide the file as ~/proj1.org.  And Emacs is visiting proj1.org in
another buffer.

 

So I now do this manually:

 

Visit todo.org

For Each subheading of Tasks related to proj1.

    Place point at the start of subheading

    Invoke set-mark-command at end of subheading

    ; and BTW this is very tricky business, I guess due to narrowing

    kill

    switch buffer to proj1.org

    place point as close to column 1 under the Tasks line

    ; again very tricky business

    yank

    switch buffer back to todo.org

Next

 

(Sorry for posting pseudocode that resembles Vi$ual Ba$ic!  The org-babel
question for *that* is in queue.)

 

- Ray


[-- Attachment #2: Type: text/html, Size: 4399 bytes --]

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-02 15:11 refile workflow -- move to same heading in different file? Raymond Zeitler
@ 2017-08-03 10:07 ` Adam Porter
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Porter @ 2017-08-03 10:07 UTC (permalink / raw)
  To: emacs-orgmode

"Raymond Zeitler" <zeitra@yahoo.com> writes:

> C-c C-w cannot seem to recognize any of my agenda files, even though
> org-refile-targets is set to (in custom-set-variables):
>
> (org-refile-targets (quote ((org-agenda-files :regexp . "Tasks"))))
>
> Suppose org-agenda-files contains "~/proj1.org" "~/proj2.org" "~/proj3.org" "~/todo.org".
>
> My expectation is that when I press C-c C-w with point on a subheading
> of Tasks in todo.org, I can specify, say proj1.org and get the
> subheading moved to proj1.org under Tasks. However, org-refile
> responds [No Match], even if I provide the file as ~/proj1.org. And
> Emacs is visiting proj1.org in another buffer.

Hi Raymond,

Going on what you've provided, it sounds like it should work.  A few
suggestions:

1.  In case you haven't yet (but you probably have), check
describe-variable for org-refile-targets.

2.  If you have any doubt about org-refile-targets being set correctly,
experiment with setting it and calling org-refile inside a (let).

3.  I haven't used the default Emacs completion in years; I'm so used to
having Helm that when I have to run "emacs -q" now and then, completing
buffer names and such is painful!  :)  So I'd suggest temporarily, at
least, using Helm as the default completing-read method, which will make
it much easier to debug by showing you the full list of candidates.
That way, if it's empty to begin with, you know something's really
wrong; or if it's full, but it shows [No Match] after you type something
in, that should help you narrow down the cause.

Hope this helps.

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

* Re: refile workflow -- move to same heading in different file?
@ 2017-08-03 18:52 Raymond Zeitler
  2017-08-04  1:51 ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-03 18:52 UTC (permalink / raw)
  To: 'Adam Porter', emacs-orgmode

Thank you for responding.

1.  org-refile-targets ... value is ((org-agenda-files :regexp . "Tasks"))
Seems OK.  But then I see that org-refile-target-verify-function is nil,
which seems like a problem.  Mind you, this is the default configuration,
and I'm not sure what to change it to.

2.  I placed the let block below into a subheading of Tasks in my todo.org
and then evaluated it.  The error that Emacs returned follows that:
(let ((org-refile-targets (quote (((org-agenda-files) :regexp . "Tasks")))))
(org-refile))
org-find-base-buffer-visiting: Wrong type argument: stringp,
org-agenda-files

org-agenda-files evaluates to:
("~/HR.org" "~/1234.org" "~/2345.org" "~/3456.org" "~/4567.org"
"~/todo.org")
All those files exist, and they load when I invoke org-agenda.

I also tried the setting used by Sacha Chua(1), shown below.  The error that
Emacs returned follows that (but at least that's an error from the let
function and not an org function, so it might indicate a problem with how I
wrote it):
(let (org-refile-targets '((org-agenda-files . (:maxlevel . 3))))
(org-refile))
let: Invalid function: (org-agenda-files :maxlevel . 3)

Then on reddit there's naught-me's setting(2), upon which I based this:
(let ((org-refile-targets (quote ("~/HR.org" :maxlevel . 3) ("~/todo.org"
:regexp . "tasks"))) (org-refile))
This returns: funcall-interactively: End of file during parsing

I have no clue how to proceed.  And I spent far too much time on this.  Fun,
but very unproductive.

3. Helm is on my todo.org, actually, but I've put it off because of how
formidable it seems.

(1) http://pages.sachachua.com/.emacs.d/Sacha.html#org2789cb5
(2)
https://www.reddit.com/r/emacs/comments/4366f9/how_do_orgrefiletargets_work/

- Ray

-----Original Message-----
From: Emacs-orgmode [mailto:emacs-orgmode-bounces+zeitra=yahoo.com@gnu.org]
On Behalf Of Adam Porter
Sent: Thursday, August 03, 2017 6:08 AM
To: emacs-orgmode@gnu.org
Subject: Re: [O] refile workflow -- move to same heading in different file?

"Raymond Zeitler" <zeitra@yahoo.com> writes:

> C-c C-w cannot seem to recognize any of my agenda files, even though 
> org-refile-targets is set to (in custom-set-variables):
>
> (org-refile-targets (quote ((org-agenda-files :regexp . "Tasks"))))
>
> Suppose org-agenda-files contains "~/proj1.org" "~/proj2.org"
"~/proj3.org" "~/todo.org".
>
> My expectation is that when I press C-c C-w with point on a subheading 
> of Tasks in todo.org, I can specify, say proj1.org and get the 
> subheading moved to proj1.org under Tasks. However, org-refile 
> responds [No Match], even if I provide the file as ~/proj1.org. And 
> Emacs is visiting proj1.org in another buffer.

Hi Raymond,

Going on what you've provided, it sounds like it should work.  A few
suggestions:

1.  In case you haven't yet (but you probably have), check describe-variable
for org-refile-targets.

2.  If you have any doubt about org-refile-targets being set correctly,
experiment with setting it and calling org-refile inside a (let).

3.  I haven't used the default Emacs completion in years; I'm so used to
having Helm that when I have to run "emacs -q" now and then, completing
buffer names and such is painful!  :)  So I'd suggest temporarily, at least,
using Helm as the default completing-read method, which will make it much
easier to debug by showing you the full list of candidates.
That way, if it's empty to begin with, you know something's really wrong; or
if it's full, but it shows [No Match] after you type something in, that
should help you narrow down the cause.

Hope this helps.


----------------------------------------------------
This message has been processed by Firetrust Benign.

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-03 18:52 Raymond Zeitler
@ 2017-08-04  1:51 ` Adam Porter
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Porter @ 2017-08-04  1:51 UTC (permalink / raw)
  To: emacs-orgmode

"Raymond Zeitler" <zeitra@yahoo.com> writes:

> 1.  org-refile-targets ... value is ((org-agenda-files :regexp . "Tasks"))
> Seems OK.  But then I see that org-refile-target-verify-function is nil,
> which seems like a problem.  Mind you, this is the default configuration,
> and I'm not sure what to change it to.
>
> 2.  I placed the let block below into a subheading of Tasks in my todo.org
> and then evaluated it.  The error that Emacs returned follows that:
> (let ((org-refile-targets (quote (((org-agenda-files) :regexp . "Tasks")))))
> (org-refile))
> org-find-base-buffer-visiting: Wrong type argument: stringp,
> org-agenda-files

It seems that describe-variable isn't printing the variable structure
the way it really is, so then when you try to evaluate it, it doesn't
work.  Note that according to the docstring:

#+BEGIN_QUOTE
This is a list of cons cells.  Each cell contains:

- a specification of the files to be considered, either a list of files,
  or a symbol...
- A specification of how to find candidate refile targets.  This may be
  any of:
  ...
  - a cons cell (:regexp . "REGEXP") with a regular expression matching
    headlines that are refiling targets.
#+END_QUOTE

So the variable is a list, which should contain at least one cons cell,
and the cons cells should have another cons cell as their cdrs.

Try this, it seems to work for me:

(let ((org-refile-targets '((org-agenda-files . (:regexp . "Tasks")))))
  (org-refile))

This is one advantage of the customize system: it makes it harder to get
these structures wrong.  :)

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

* Re: refile workflow -- move to same heading in different file?
@ 2017-08-04  4:14 Raymond Zeitler
  2017-08-04 10:21 ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-04  4:14 UTC (permalink / raw)
  To: 'Adam Porter', emacs-orgmode

Adam Porter wrote:
> Try this, it seems to work for me:
> 
> (let ((org-refile-targets '((org-agenda-files . (:regexp . "Tasks")))))
>   (org-refile))
> 
> This is one advantage of the customize system: it makes it harder to get
> these structures wrong.  :)

I get the same [No Match] result that I was getting originally.  I'm really
not happy about needing yet another package just to get some basic
functionality to work.  Besides, "package-install RET helm RET" results in
yet another [No Match].  Makes me think I should wipe out Emacs entirely and
do a fresh installation.

Meanwhile, if Helm is needed to make this work, maybe it should be
documented.  I wonder if it works for anyone who's not using Helm....

Gosh, I was really hoping to be doing export to ODT or PDF by now!

- Ray

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-04  4:14 Raymond Zeitler
@ 2017-08-04 10:21 ` Adam Porter
  2017-08-04 10:53   ` Joost Kremers
  0 siblings, 1 reply; 14+ messages in thread
From: Adam Porter @ 2017-08-04 10:21 UTC (permalink / raw)
  To: emacs-orgmode

"Raymond Zeitler" <zeitra@yahoo.com> writes:

> I get the same [No Match] result that I was getting originally.

Sounds like something is wrong with your installation or config.  Did
you try with "emacs -q"?

> I'm really not happy about needing yet another package just to get
> some basic functionality to work.

I suggested that it would help the troubleshooting process, not that
it's required.

> Besides, "package-install RET helm RET" results in yet another [No
> Match].  

I guess you don't have MELPA configured.

> Makes me think I should wipe out Emacs entirely and do a fresh
> installation.

I would try with "emacs -q" first.  Although since you're on Windows, it
wouldn't surprise me if something isn't setup correctly.  How did you
install Emacs?

> Meanwhile, if Helm is needed to make this work, maybe it should be
> documented.  I wonder if it works for anyone who's not using Helm....

It's not, and it does.

> Gosh, I was really hoping to be doing export to ODT or PDF by now!

If you don't have time to fix it, you could export to HTML and convert
it with Pandoc.

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-04 10:21 ` Adam Porter
@ 2017-08-04 10:53   ` Joost Kremers
  2017-08-05  2:35     ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Joost Kremers @ 2017-08-04 10:53 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-orgmode


On Fri, Aug 04 2017, Adam Porter wrote:
> "Raymond Zeitler" <zeitra@yahoo.com> writes:
>> Gosh, I was really hoping to be doing export to ODT or PDF by 
>> now!
>
> If you don't have time to fix it, you could export to HTML and 
> convert
> it with Pandoc.

Why convert to HTML first? Pandoc can read Org files pretty well.

-- 
Joost Kremers
Life has its moments

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

* Re: refile workflow -- move to same heading in different file?
@ 2017-08-04 15:02 Raymond Zeitler
  2017-08-05  2:31 ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-04 15:02 UTC (permalink / raw)
  To: 'Adam Porter', emacs-orgmode

Adam Porter <adam@alphapapa.net> writes:

>"Raymond Zeitler" <zeitra@yahoo.com> writes:
-snip-
>> Makes me think I should wipe out Emacs entirely and do a fresh 
>> installation.

>I would try with "emacs -q" first.  Although since you're on Windows,
>it wouldn't surprise me if something isn't setup correctly.

With emacs -q I get the same [No Match] response.  But I was
pleasantly surprised that Org loaded automatically when I visited
~/todo.org, and the default layout was fairly pleasing.

>How did you install Emacs?

I unzipped emacs-25.2-x86_64.zip into c:\emacs-25.2_64 .  I installed
Org with package-list-packages and clicked on the link to install org.
Also, I started with a blank .emacs then added some old customizations
a little at a time.  Everything runs great, except for C-c C-w/.

I couldn't find installation instructions specifically for a Windows
non-administrator.  I know that C:\ is not accessible to non-admins,
so I considered putting it in %home%.  I might need to do that soon
due to new company policies.

>> Meanwhile, if Helm is needed to make this work, maybe it should be 
>> documented.  I wonder if it works for anyone who's not using Helm....

>It's not, and it does.

This is great info for me to have, so I'm motivated to keep trying.

Thanks for your help and patience.  Sorry I cluttered the list with
an Emacs config problem!

- Ray

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-04 15:02 Raymond Zeitler
@ 2017-08-05  2:31 ` Adam Porter
  2017-08-05 12:41   ` Raymond Zeitler
  0 siblings, 1 reply; 14+ messages in thread
From: Adam Porter @ 2017-08-05  2:31 UTC (permalink / raw)
  To: emacs-orgmode

"Raymond Zeitler" <zeitra@yahoo.com> writes:

> Thanks for your help and patience.  Sorry I cluttered the list with
> an Emacs config problem!

I'm glad to help if I can.  I noticed you didn't mention the part about
the structure of the org-refile-targets list.  Did you try the example I
gave?  That might have been the problem all along.

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-04 10:53   ` Joost Kremers
@ 2017-08-05  2:35     ` Adam Porter
  0 siblings, 0 replies; 14+ messages in thread
From: Adam Porter @ 2017-08-05  2:35 UTC (permalink / raw)
  To: emacs-orgmode

Joost Kremers <joostkremers@fastmail.fm> writes:

> Why convert to HTML first? Pandoc can read Org files pretty well.

Good point!  I must have had a brain cramp, since I have made two
packages that convert to Org with Pandoc... D:

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-05  2:31 ` Adam Porter
@ 2017-08-05 12:41   ` Raymond Zeitler
  2017-08-06  4:12     ` Raymond Zeitler
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-05 12:41 UTC (permalink / raw)
  To: Adam Porter, emacs-orgmode@gnu.org

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



 From: Adam Porter <adam@alphapapa.net>
Sent: Friday, August 4, 2017 10:36 PM

"Raymond Zeitler" <zeitra@yahoo.com> writes:

>> Thanks for your help and patience.  Sorry I cluttered the list with
>> an Emacs config problem!

>I'm glad to help if I can.  I noticed you didn't mention the part about
>the structure of the org-refile-targets list.  Did you try the example I
>gave?  That might have been the problem all along.

I did try that.  Same results.
I'm halfway through extensive testing, which includes two different fresh installations of Emacs on two different computers (both, regrettably, running Win 7).  I'll try adding MELPA, too to see if that helps.  If any other Windows users use org-refile (especially without MELPA or helm), please respond.



   

[-- Attachment #2: Type: text/html, Size: 2962 bytes --]

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-05 12:41   ` Raymond Zeitler
@ 2017-08-06  4:12     ` Raymond Zeitler
  2017-08-06 10:23       ` Adam Porter
  0 siblings, 1 reply; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-06  4:12 UTC (permalink / raw)
  To: Raymond Zeitler, Adam Porter, emacs-orgmode@gnu.org

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

A final update... it works.  Of course you knew that, but I was convinced otherwise.
One Internet search result for "Emacs No Match" linked to a subtopic of Completion in the Emacs manual.  So I read more about Completion and found that pressing "?" displays a list of all possible choices.
So I pressed "?" after C-c C-w and sawTasksTasks (HR.org)
One quick forehead slap later, I entered Tasks ( TAB. I got the desired completion of Tasks (HR.org), pressed RET, and viola!  It worked.
So this was classic error 18 because I was expecting to refile to ~/HR.org Tasks -- file name then heading.
Is the heading (file name) completion syntax explained anywhere in the documentation?  If so, I missed it big time.  LOL
I'm SO glad I got through this.  Now I can get back to work.
- Ray



      From: Raymond Zeitler <zeitra@yahoo.com>
 To: Adam Porter <adam@alphapapa.net>; "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org> 
 Sent: Saturday, August 5, 2017 8:42 AM
 Subject: Re: [O] refile workflow -- move to same heading in different file?
   
 From: Adam Porter <adam@alphapapa.net>
Sent: Friday, August 4, 2017 10:36 PM

"Raymond Zeitler" <zeitra@yahoo.com> writes:

>> Thanks for your help and patience.  Sorry I cluttered the list with
>> an Emacs config problem!

>I'm glad to help if I can.  I noticed you didn't mention the part about
>the structure of the org-refile-targets list.  Did you try the example I
>gave?  That might have been the problem all along.

I did try that.  Same results.
I'm halfway through extensive testing, which includes two different fresh installations of Emacs on two different computers (both, regrettably, running Win 7).  I'll try adding MELPA, too to see if that helps.  If any other Windows users use org-refile (especially without MELPA or helm), please respond.



   

   

[-- Attachment #2: Type: text/html, Size: 7455 bytes --]

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-06  4:12     ` Raymond Zeitler
@ 2017-08-06 10:23       ` Adam Porter
  2017-08-06 19:52         ` Raymond Zeitler
  0 siblings, 1 reply; 14+ messages in thread
From: Adam Porter @ 2017-08-06 10:23 UTC (permalink / raw)
  To: emacs-orgmode

Raymond Zeitler <zeitra@yahoo.com> writes:

Hi Ray,

> A final update... it works. Of course you knew that, but I was
> convinced otherwise.

Glad you got it working.  :)
>
> One Internet search result for "Emacs No Match" linked to a subtopic
> of Completion in the Emacs manual. So I read more about Completion and
> found that pressing "?" displays a list of all possible choices.
>
> So I pressed "?" after C-c C-w and saw
> Tasks
> Tasks (HR.org)
>
> One quick forehead slap later, I entered Tasks ( TAB. I got the
> desired completion of Tasks (HR.org), pressed RET, and viola! It
> worked.
>
> So this was classic error 18 because I was expecting to refile to
> ~/HR.org Tasks -- file name then heading.

This is why I recommended Helm.  It's just so much easier, because you
get a big window with all the potential completions listed, and then it
narrows down the list as you type.  You can type any part of any word
anywhere in any item, and it will narrow down to that item.  The default
Emacs completion is like stumbling around in the dark, by comparison.
Ivy is another good completion package, but it doesn't do nearly as much
(which some people prefer).

Anyway, if you install Helm, just run helm-mode, and then try
org-refile.  I think you'll like it.

> Is the heading (file name) completion syntax explained anywhere in the
> documentation? If so, I missed it big time. LOL

Check out the variable org-refile-use-outline-path.  It's nil by
default, but by setting it to 'file, it puts the filename first.

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

* Re: refile workflow -- move to same heading in different file?
  2017-08-06 10:23       ` Adam Porter
@ 2017-08-06 19:52         ` Raymond Zeitler
  0 siblings, 0 replies; 14+ messages in thread
From: Raymond Zeitler @ 2017-08-06 19:52 UTC (permalink / raw)
  To: Adam Porter, emacs-orgmode@gnu.org

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

Adam Porter <dam@alphapapa.net> writes:
>Raymond Zeitler <zeitra@yahoo.com> writes:
-snip-
>This is why I recommended Helm.
I'm glad you did, because when I got the same [No Match] response fromthe package installer, I realized you were right that Emacs wasn't setup correctly.
>Check out the variable org-refile-use-outline-path.  It's nil by>default, but by setting it to 'file, it puts the filename first.
YES! That was the missing piece!  Thanks so much!
- Ray






   

[-- Attachment #2: Type: text/html, Size: 2802 bytes --]

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

end of thread, other threads:[~2017-08-06 19:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02 15:11 refile workflow -- move to same heading in different file? Raymond Zeitler
2017-08-03 10:07 ` Adam Porter
  -- strict thread matches above, loose matches on Subject: below --
2017-08-03 18:52 Raymond Zeitler
2017-08-04  1:51 ` Adam Porter
2017-08-04  4:14 Raymond Zeitler
2017-08-04 10:21 ` Adam Porter
2017-08-04 10:53   ` Joost Kremers
2017-08-05  2:35     ` Adam Porter
2017-08-04 15:02 Raymond Zeitler
2017-08-05  2:31 ` Adam Porter
2017-08-05 12:41   ` Raymond Zeitler
2017-08-06  4:12     ` Raymond Zeitler
2017-08-06 10:23       ` Adam Porter
2017-08-06 19:52         ` Raymond Zeitler

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).