Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-02-05 Thread Samuel Wales
one thing i don't understand is why there need to be 2 olpaths for the
identical location.

in maint i get both in ido [when it is in same file].  i only need 1
[always].  the bugs aside, there is no reason to /have/ to choose one.
 right?

so why are 2 included?

On 1/29/14, Bastien b...@gnu.org wrote:
 Hi Samuel,

 Samuel Wales samolog...@gmail.com writes:

 i have very little capacity to do this properly, doing the best i can
 so you get timely feedback.  perhaps this gives you a little to go on.
   if not, this will take much longer.

 Thanks -- I'll explore this using ido, which I do not use ordinarily.

 If other users want to chim in and test, that'd be great too,
 especially for the bugfixes I explained in my previous email.

 --
  Bastien



-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-02-05 Thread Bastien
Samuel Wales samolog...@gmail.com writes:

 one thing i don't understand is why there need to be 2 olpaths for the
 identical location.

Well, this is the part of the bug that I never managed to reproduce.
If you have time for a recipe that produces just this bug, let's go.
I wish someone else could report the same bug too -- that'd give us
another perspective, and more food for thought.

Anyway, I hope we can fix this soon.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-29 Thread Bastien
Hi Samuel,

Samuel Wales samolog...@gmail.com writes:

 Would this also get rid of the current-file special case?  If so, this
 sounds good to me and I will test it.

Please test the attached patch against maint and let me know what
issues it fixes for you.

Thanks,

diff --git a/lisp/org.el b/lisp/org.el
index 23126b3..9a648dd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11308,7 +11308,7 @@ on the system \/user@host:\.
 			   txt (org-link-display-format (match-string 4))
 			   txt (replace-regexp-in-string \\( *\[[0-9]+/?[0-9]*%?\]\\)+$  txt)
 			   re (format org-complex-heading-regexp-format
-	  (regexp-quote (match-string 4
+	  (regexp-quote (match-string-no-properties 4
 			 (when org-refile-use-outline-path
 			   (setq txt (mapconcat
   'org-protect-slash
@@ -11641,6 +11641,12 @@ prefix argument (`C-u C-u C-u C-c C-w').
   (bookmark-jump org-refile-last-stored)
   (message This is the location of the last refile))
 
+(defsubst org-refile--get-location (answ tbl)
+  (or (assoc answ tbl)
+  (assoc (concat answ /) tbl)
+  (assoc answ org-refile-target-table)
+  (assoc (concat answ /) org-refile-target-table)))
+
 (defun org-refile-get-location (optional prompt default-buffer new-nodes
 	  no-exclude)
   Prompt the user for a refile location, using PROMPT.
@@ -11692,10 +11698,9 @@ this is used for the GOTO interface.
   (concat  (default  cbnex  : ))
 	 pa answ parent-target child parent old-hist)
 (setq old-hist org-refile-history)
-(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
+(setq answ (funcall cfunc prompt tbl nil (if new-nodes 'confirm t)
 			nil 'org-refile-history (or cdef (car org-refile-history
-(setq pa (or (assoc answ tbl) (assoc (concat answ /) tbl)))
-(if pa
+(if (setq pa (org-refile--get-location answ tbl))
 	(progn
 	  (org-refile-check-position pa)
 	  (when (or (not org-refile-history)
@@ -11712,8 +11717,7 @@ this is used for the GOTO interface.
 	  (progn
 	(setq parent (match-string 1 answ)
 		  child (match-string 2 answ))
-	(setq parent-target (or (assoc parent tbl)
-(assoc (concat parent /) tbl)))
+	(setq parent-target (org-refile--get-location parent tbl))
 	(when (and parent-target
 		   (or (eq new-nodes t)
 			   (and (eq new-nodes 'confirm)

-- 
 Bastien


Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-29 Thread Samuel Wales
with the patch on maint, sometimes refile goto from the scratch buffer
shows 2 olpaths for the same location.  one has the filename and the
other does not.  selecting the default results in:

Debugger entered--Lisp error: (error Invalid target location)
  signal(error (Invalid target location))
  user-error(Invalid target location)
  org-refile-get-location(Goto nil nil 4)
  org-refile(4)
  alpha-org-goto-1()
  alpha-org-goto-restricted()
  call-interactively(alpha-org-goto-restricted nil nil)

where restricted goto let-binds org refile targets.  so it seems about
the same as before?  i don't see the need for 2 olpaths to point to
the same location.

could be pilot error?


On 1/29/14, Bastien b...@gnu.org wrote:
 Hi Samuel,

 Samuel Wales samolog...@gmail.com writes:

 Would this also get rid of the current-file special case?  If so, this
 sounds good to me and I will test it.

 Please test the attached patch against maint and let me know what
 issues it fixes for you.

 Thanks,




-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-29 Thread Bastien
Hi Samuel,

please provide a reproducible recipe, it's really hard to explore
those kind of bugs otherwise.

The patch should fix at least these two bugs:

- you enter A headline/ as a refile target but A headline/
  is not in the current file: before the patch, it throws an error,
  after the patch it refiles to A headline/.

- you enter A headline/a_non_existent_headline as a refile target
  and have (setq org-refile-allow-creating-parent-nodes t).  Before
  the patch, if A headline/ is not in the current file, it will fail
  silently.  Now the prompt asks for confirmation and will refile to
  the correct location by guessing the filename right.

Thanks for letting me know.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-29 Thread Bastien
Hi Samuel,

Samuel Wales samolog...@gmail.com writes:

 i have very little capacity to do this properly, doing the best i can
 so you get timely feedback.  perhaps this gives you a little to go on.
   if not, this will take much longer.

Thanks -- I'll explore this using ido, which I do not use ordinarily.

If other users want to chim in and test, that'd be great too,
especially for the bugfixes I explained in my previous email.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-28 Thread Bastien
Hi Samuel,

Samuel Wales samolog...@gmail.com writes:

 Are you talking about 2 olpaths pointing to different files?

Yes.

In this case, I suggest this: hitting RET will not throw an error,
but offer further expansion like this:

  Emacs (myfile.org)
  Emacs (anotherfile.org)

 Is what shows the same as what is used to disambiguate?  Can we have
 the full path name + olpath in Lisp and only show the olpath?  That
 would be ideal.

If you think the suggestion above is a progress, I'll try to implement
it and see if other cases are covered as well.

This is an issue that also annoys me sometimes.

So thanks for your input on this, and for further testing.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-28 Thread Samuel Wales
On 1/28/14, Bastien b...@gnu.org wrote:
 Are you talking about 2 olpaths pointing to different files?

 Yes.

I hope this is the reason for the bugs, because it sounds fixable.

 In this case, I suggest this: hitting RET will not throw an error,
 but offer further expansion like this:

   Emacs (myfile.org)
   Emacs (anotherfile.org)

Would this also get rid of the current-file special case?  If so, this
sounds good to me and I will test it.

If not, then to judge from current behavior in Ido, there will still
be the need to disambiguate 2 olpaths pointing to the /same/ file
(the current file treated as a special case and the current file
treated normally).

Thank you for listening and finding a solution.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-26 Thread Bastien
Samuel Wales samolog...@gmail.com writes:

 When I run refile goto in the same buffer, it goes to the correct
 location and then does that.  When I run refile goto in a different
 buffer, it does not go anywhere and it does that.

Because for now you need to add the file name when refiling to
a different buffer.

I agree we should provide a better error, or just ask again.

I don't see how to remove the need for the file name though.
Taking into account that several buffers may contain subtrees
with the same headline.

If you have any idea, please let us know.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-26 Thread Samuel Wales
Hi Bastien,

Thank you for commenting and providing a clue.

If I understand correctly, I don't see the need for any error or
asking again, as it is always obvious what I, at least, want to do.
It shows an olpath, so what I want is to refile or goto that olpath in
every case.

I also don't see the need for a distinction between this file and not
this file.  I never care what file I am in when I refile or goto.

===

It is the default Ido selection (after typing emacs) that errors,
which seems like an indication that we need a different solution.  In
other cases, the default Ido selection always misfiles with no error
(ECM similar to the thread leader message but without an error).
Thus, you end up with stuff in the wrong place, silently.  And in a
third case, it silently fails.  So you think you refiled but you did
not.

All three bugs happen quite frequently.  Error, misfile, or silently
doing nothing.

===

If the distinction between current file and non-current file is the
reason, can we make it consistent by adding the filename for the same
buffer also?  That way all choices are equivalent.

I find it confusing, as I never care what file I am in when I refile
or goto.  I don't think of Org as a single-file tree, but as a forest
of equal trees.  To have to think about this is the same file and
no, I am going to a different file interrupts the refile for me; I
never make that distinction.

org-refile-use-outline-path set to file or full file path seems to not
affect the result.

===

Perhaps somebody else who uses Ido refiling can test the thread leader
case (/computer/emacs/myorg, refile to myorg, try to refile to
emacs) and comment?

===

Are you talking about 2 olpaths pointing to different files?  I never
have that use case, because I always show the olpath and never repeat
it.

But what does happen is that I get one olpath that causes an error and
another that does not.  And the one that causes the error is always
the Ido default, so I can't press RET.

===

Is what shows the same as what is used to disambiguate?  Can we have
the full path name + olpath in Lisp and only show the olpath?  That
would be ideal.

I wanted to make this message shorter, but this is the best I was able to do.

Thanks.

Samuel


On 1/26/14, Bastien b...@gnu.org wrote:
 Samuel Wales samolog...@gmail.com writes:

 When I run refile goto in the same buffer, it goes to the correct
 location and then does that.  When I run refile goto in a different
 buffer, it does not go anywhere and it does that.

 Because for now you need to add the file name when refiling to
 a different buffer.

 I agree we should provide a better error, or just ask again.

 I don't see how to remove the need for the file name though.
 Taking into account that several buffers may contain subtrees
 with the same headline.

 If you have any idea, please let us know.

 --
  Bastien



-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-25 Thread Samuel Wales
I seem to get this:

Debugger entered--Lisp error: (error Invalid target location)
  signal(error (Invalid target location))
  user-error(Invalid target location)
  org-refile-get-location(Goto nil nil 4)
  org-refile(4)

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2014-01-25 Thread Samuel Wales
When I run refile goto in the same buffer, it goes to the correct
location and then does that.  When I run refile goto in a different
buffer, it does not go anywhere and it does that.

IMO the behavior should be the same regardless of what buffer I start
refile goto in.

On 1/25/14, Samuel Wales samolog...@gmail.com wrote:
 I seem to get this:

 Debugger entered--Lisp error: (error Invalid target location)
   signal(error (Invalid target location))
   user-error(Invalid target location)
   org-refile-get-location(Goto nil nil 4)
   org-refile(4)

 --
 The Kafka Pandemic: http://thekafkapandemic.blogspot.com

 The disease DOES progress.  MANY people have died from it.  ANYBODY can get
 it.

 Denmark: free Karina Hansen NOW.



-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2013-11-13 Thread Bastien
Hi Samuel,

Samuel Wales samolog...@gmail.com writes:

 I use ido.

I don't use ido so it's hard for me to mentally picture the problem
correctly.

Anyway, the error message was wrong in many circumstances, e.g. when
the user tries to refile and only mention the headline/, not the
target file.  I've enhance the error message in these cases (in
master.)

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2013-11-13 Thread Samuel Wales
Thank you.

Please note that the fact that it errors instead of refiling is a bug,
even if the error message is more accurate.

On 11/13/13, Bastien b...@gnu.org wrote:
 Hi Samuel,

 Samuel Wales samolog...@gmail.com writes:

 I use ido.

 I don't use ido so it's hard for me to mentally picture the problem
 correctly.

 Anyway, the error message was wrong in many circumstances, e.g. when
 the user tries to refile and only mention the headline/, not the
 target file.  I've enhance the error message in these cases (in
 master.)

 --
  Bastien



-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2013-11-13 Thread Bastien
Samuel Wales samolog...@gmail.com writes:

 Please note that the fact that it errors instead of refiling is a bug,
 even if the error message is more accurate.

In the cases I have in mind (which are probably not the same than
yours), the target file is unspecified and refiling cannot happen
because it needs to know the target file... so this is not a bug
for me -- hopefully someone who does not use ido can hit the bug
too and report it.

-- 
 Bastien



Re: [O] bug: Please save the buffer to a file before refiling when the buffer is already saved

2013-11-13 Thread Samuel Wales
I suspect it is the arguments used for ido.

I previously reported that Org incorrectly treats the current file
differently from other files.  This causes ido to think that some
olpaths are files and others are directories.  This might be related.

On 11/13/13, Bastien b...@gnu.org wrote:
 In the cases I have in mind (which are probably not the same than
 yours), the target file is unspecified and refiling cannot happen
 because it needs to know the target file... so this is not a bug
 for me -- hopefully someone who does not use ido can hit the bug
 too and report it.

 --
  Bastien



-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.