Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-14 Thread Thorsten Jolitz
Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 Thorsten Jolitz tjol...@gmail.com writes:
 only that promptly another message is shown (I can't use sit-for in
 the program):

 sit-for was just to demonstrate the problem introduced solely by M-:.
 That problem is not present when using interactive commands (i.e. those
 a user can actually use), and no sit-for should be necessary in all
 pratical situations.

 ,-
 | Wrote /home/my/tmpdir/myfile
 `-

 Obviously you should find out what's writing to that file after your
 (message ...) statement. I'm not an outshine/outorg user, I have no idea
 what does it.

found it:

,-
| Command: write-region start end filename optional append visit
| 
| This function writes the region (of the current buffer) delimited by
| start and end into the file specified by filename.
| 
| [...]
| 
| Normally, write-region displays a message `Wrote file filename' in
| the echo area. If visit is neither t nor nil nor a string, then this
| message is inhibited. This feature is useful for programs that use
| files for internal purposes, files which the user does not need to
| know about.
`-

so 

,---
| (write-region nil nil filename nil 'VISIT)
`---

gets rid of the message.

-- 
cheers,
Thorsten




Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-13 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 Ok, I see ...  that seems to be a common pattern in Org-mode to make
 functions behave differently if called (non-)interactively, that
 sometimes causes confusion when using M-: instead of M-x.

Note that using M-: will always hide any (message foo) might have
been called because M-: outputs the return value of the function.
Usually you can recover those by inspecting the *Messages* buffer, but
in this case org uses org-unlogged-message so you can't see it there
either.

Try this :
M-: (prog1 (org-display-outline-path) (sit-for 2)) RET
It shows the message (for up to 2 seconds), and then it is hidden by the
return value (a string with properties) when the call to M-: terminates.

-- 
Nico.



Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-13 Thread Thorsten Jolitz
Nicolas Richard theonewiththeevill...@yahoo.fr writes:

 Thorsten Jolitz tjol...@gmail.com writes:
 Ok, I see ...  that seems to be a common pattern in Org-mode to make
 functions behave differently if called (non-)interactively, that
 sometimes causes confusion when using M-: instead of M-x.

 Note that using M-: will always hide any (message foo) might have
 been called because M-: outputs the return value of the function.
 Usually you can recover those by inspecting the *Messages* buffer, but
 in this case org uses org-unlogged-message so you can't see it there
 either.

 Try this :
 M-: (prog1 (org-display-outline-path) (sit-for 2)) RET
 It shows the message (for up to 2 seconds), and then it is hidden by the
 return value (a string with properties) when the call to M-: terminates.

Thanks for the hint, this does the job:

#+begin_src emacs-lisp
  (  . (outshine-use-outorg
  (lambda ()
(message
 %s (substring-no-properties
   (org-display-outline-path
  'WHOLE-BUFFER-P))
#+end_src

only that promptly another message is shown (I can't use sit-for in
the program):

,-
| Wrote /home/my/tmpdir/myfile
`-

I have to get rid of that one ...

-- 
cheers,
Thorsten




Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-13 Thread Nicolas Richard
Thorsten Jolitz tjol...@gmail.com writes:
 only that promptly another message is shown (I can't use sit-for in
 the program):

sit-for was just to demonstrate the problem introduced solely by M-:.
That problem is not present when using interactive commands (i.e. those
a user can actually use), and no sit-for should be necessary in all
pratical situations.

 ,-
 | Wrote /home/my/tmpdir/myfile
 `-

Obviously you should find out what's writing to that file after your
(message ...) statement. I'm not an outshine/outorg user, I have no idea
what does it.

-- 
Nico.



[O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Thorsten Jolitz

Hi List, 

while 

,-
| M-x org-display-outline-path 
`-

works as expected for me, neither

,---
| M-: (org-display-outline-path)
`---

nor

,---
| M-: (call-interactively 'org-display-outline-path)
`---

return what they should. Can anybody confirm this?

How is this function supposed to be called from another program? Why
does it have (interactive P) if the prefix arg is never used? Or do I
simply miss something important here?

-- 
cheers,
Thorsten





Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Bastien
Hi Thorsten,

Thorsten Jolitz tjol...@gmail.com writes:

 How is this function supposed to be called from another program? Why
 does it have (interactive P) if the prefix arg is never used? Or do I
 simply miss something important here?

I think you miss the fact that it displays a path only if the headline
is not a top-level headline.

HTH,

-- 
 Bastien



Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Thorsten Jolitz
Bastien b...@gnu.org writes:

Hi Bastien,

 Thorsten Jolitz tjol...@gmail.com writes:

 How is this function supposed to be called from another program? Why
 does it have (interactive P) if the prefix arg is never used? Or do I
 simply miss something important here?

 I think you miss the fact that it displays a path only if the headline
 is not a top-level headline.

Not really, on the same 2nd level headline calling it with M-x and M-:
give different messages, and only in the first case a useful one. 

With point at start of ** 2nd level

#+begin_src org
* 1st level
Hello 
** 2nd level
Work
#+end_src

,-
| Eval: (org-display-outline-path)
| Eval: (call-interactively 'org-display-outline-path)
`-

both print this in the message buffer

,--
| byte-code: End of buffer
| #(1st level 0 9 (face org-level-1))
`--

while using M-x shows the string 1st Level as expected.

-- 
cheers,
Thorsten




Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Bastien
Thorsten Jolitz tjol...@gmail.com writes:

 both print this in the message buffer

 ,--
 | byte-code: End of buffer
 | #(1st level 0 9 (face org-level-1))
 `--

 while using M-x shows the string 1st Level as expected.

There is no problem here.

#(1st level 0 9 (face org-level-1))

is just the internal representation of a fontified string.

Or am I missing something?

-- 
 Bastien



Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Thorsten Jolitz
Bastien b...@gnu.org writes:

 Thorsten Jolitz tjol...@gmail.com writes:

 both print this in the message buffer

 ,--
 | byte-code: End of buffer
 | #(1st level 0 9 (face org-level-1))
 `--

 while using M-x shows the string 1st Level as expected.

 There is no problem here.

 #(1st level 0 9 (face org-level-1))

 is just the internal representation of a fontified string.

I know, but...

 Or am I missing something?

can you write a function (not a command) that calls this function, and
you see in the minibuffer what you expect?

#+begin_src emacs-lisp
  (defun callOrgDisplay ()
(call-interactively 'org-display-outline-path))
#+end_src

#+results:
: callOrgDisplay

#+begin_src org
* 1st Level
** 2nd Level 
#+end_src

,-
| M-: (callOrgDisplay)
`-

with point on the second level headline shows that internal string
representation. Only if I make `callOrgDisplay' itself a command by
adding (interactive) and call it with M-x, the string without properties
is shown.

-- 
cheers,
Thorsten




Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Bastien
Thorsten Jolitz tjol...@gmail.com writes:

 ,-
 | M-: (callOrgDisplay)
 `-

 with point on the second level headline shows that internal string
 representation. Only if I make `callOrgDisplay' itself a command by
 adding (interactive) and call it with M-x, the string without properties
 is shown.

... yes, that's on purpose.  In a program, the output of the
non-interactive version will be a string: you can safely ignore
text properties of this string if you want to further process it.

-- 
 Bastien



Re: [O] M-: (org-display-outline-path) doesn't work correctly

2014-03-12 Thread Thorsten Jolitz
Bastien b...@gnu.org writes:

 Thorsten Jolitz tjol...@gmail.com writes:

 ,-
 | M-: (callOrgDisplay)
 `-

 with point on the second level headline shows that internal string
 representation. Only if I make `callOrgDisplay' itself a command by
 adding (interactive) and call it with M-x, the string without properties
 is shown.

 ... yes, that's on purpose.  In a program, the output of the
 non-interactive version will be a string: you can safely ignore
 text properties of this string if you want to further process it.

Ok, I see ...  that seems to be a common pattern in Org-mode to make
functions behave differently if called (non-)interactively, that
sometimes causes confusion when using M-: instead of M-x.

-- 
cheers,
Thorsten