emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Yasnippet/Org issue: messing up properties
@ 2013-02-07 11:51 Karl Voit
  2013-02-10 17:50 ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Karl Voit
  0 siblings, 1 reply; 11+ messages in thread
From: Karl Voit @ 2013-02-07 11:51 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I do face strange behavior when using yasnippet with Org-mode:

,----[ Snippet «test» ]
| # name : Testing yasnippet/org issue
| # --
|
| ** Test ${1:test}
| :PROPERTIES:
| :ID: $1
| :END:
`----

... results in ...

,----[ test.txt with entering «foo bar» as $1 ]
| ** Test foo bar
| :PROPERTIES:
| :ID: foo bar
| :END:
`----

... which is correct, when Org is not the major mode. However, when
executed with Org-mode as major mode, it results in:

,----[ test.org ]
| ** Test foo bar
| :PROPERTIES:
| foo bar
| :END:
`----

Therefore I guess that this is an Org-mode issue. Is somebody able
to help debug/fix this issue?

A slightly different example:

,----[ snippet ]
| ** Test ${1:test}
| :PROPERTIES:
| :ID: $1-myid
| :END:
`----

,----[ test.org ]
| ** Test foo bar
| :PROPERTIES:
| foo bar:ID:       test-myid
| :END:
`----

-> so the default text «test» does not get replaced by the «foo bar»
I enter as $1 and this time, the :ID: does not get removed.

Placing $1 outside of the PROPERTIES drawer, there does not seem to
be any problem.

My setup:
Org-mode version 7.9.3c (release_7.9.3c-816-g409ee8)
yasnippet (version 0.6.1b)

-- 
Karl Voit

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

* [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-07 11:51 Yasnippet/Org issue: messing up properties Karl Voit
@ 2013-02-10 17:50 ` Karl Voit
  2013-02-11 15:36   ` Bastien
  2013-02-14 13:11   ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Memnon Anon
  0 siblings, 2 replies; 11+ messages in thread
From: Karl Voit @ 2013-02-10 17:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

* Karl Voit <devnull@Karl-Voit.at> wrote:
>
> I do face strange behavior when using yasnippet with Org-mode:

So there does not seem to be anybody who is able to fix this issue.
Is there at least somebody who can confirm this weird bug?

Thanks!

> ,----[ Snippet «test» ]
>| # name : Testing yasnippet/org issue
>| # --
>|
>| ** Test ${1:test}
>| :PROPERTIES:
>| :ID: $1
>| :END:
> `----
>
> ... results in ...
>
> ,----[ test.txt with entering «foo bar» as $1 ]
>| ** Test foo bar
>| :PROPERTIES:
>| :ID: foo bar
>| :END:
> `----
>
> ... which is correct, when Org is not the major mode. However, when
> executed with Org-mode as major mode, it results in:
>
> ,----[ test.org ]
>| ** Test foo bar
>| :PROPERTIES:
>| foo bar
>| :END:
> `----
>
> Therefore I guess that this is an Org-mode issue. Is somebody able
> to help debug/fix this issue?
>
> A slightly different example:
>
> ,----[ snippet ]
>| ** Test ${1:test}
>| :PROPERTIES:
>| :ID: $1-myid
>| :END:
> `----
>
> ,----[ test.org ]
>| ** Test foo bar
>| :PROPERTIES:
>| foo bar:ID:       test-myid
>| :END:
> `----
>
> -> so the default text «test» does not get replaced by the «foo bar»
> I enter as $1 and this time, the :ID: does not get removed.
>
> Placing $1 outside of the PROPERTIES drawer, there does not seem to
> be any problem.
>
> My setup:
> Org-mode version 7.9.3c (release_7.9.3c-816-g409ee8)
> yasnippet (version 0.6.1b)

-- 
Karl Voit

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-10 17:50 ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Karl Voit
@ 2013-02-11 15:36   ` Bastien
  2013-02-11 16:31     ` A short introduction to YASnippet (was: [Bug] Yasnippet/Org: properties messed up when expanding $1) Karl Voit
  2013-02-14 13:11   ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Memnon Anon
  1 sibling, 1 reply; 11+ messages in thread
From: Bastien @ 2013-02-11 15:36 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

Hi Karl,

Karl Voit <devnull@Karl-Voit.at> writes:

>> I do face strange behavior when using yasnippet with Org-mode:
>
> So there does not seem to be anybody who is able to fix this issue.
> Is there at least somebody who can confirm this weird bug?

I've installed Yasnippet (from GNU ELPA) but I think I need more
help on how to test it... expanding with TAB in text-mode and in 
yas-minor-mode doesn't produce anything useful.  Can you make a
recipe for yas-n00bs?

Thanks!

-- 
 Bastien

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

* A short introduction to YASnippet (was: [Bug] Yasnippet/Org: properties messed up when expanding $1)
  2013-02-11 15:36   ` Bastien
@ 2013-02-11 16:31     ` Karl Voit
  0 siblings, 0 replies; 11+ messages in thread
From: Karl Voit @ 2013-02-11 16:31 UTC (permalink / raw)
  To: emacs-orgmode

* Bastien <bzg@altern.org> wrote:
> Hi Karl,

Hi!

> I've installed Yasnippet (from GNU ELPA) but I think I need more
> help on how to test it... expanding with TAB in text-mode and in
> yas-minor-mode doesn't produce anything useful.  

Does it produce something at all?

> Can you make a recipe for yas-n00bs?

Sure.

If yasnippet is installed and loaded, you should get an additional
menu entry called «YASnippet». You find out, where your snippet
folder is located. Mine is «~/.emacs.d/snippets». yasnippet is
pretty straight forward: every text file within the snippet folder
is a defined snippet. If not stated otherwise in the header of the
file, the name of the snippet file is the command which is used to
expand.

You can define snippets that are only available in certain modes:
snippets within «$SNIPPETDIR/text-mode/org-mode» are only available
in Org-mode. Following snippet is only available in Org-mode and is
expanded by entering «test» followed by TAB:

,----[ Snippet «~/.emacs.d/snippets/text-mode/org-mode/test» ]
| # name : Testing yasnippet/org issue
| # --
|
| ** Test ${1:test}
| :PROPERTIES:
| :ID: $1
| :END:
`----

AFAIR the header is optional. Within the header, you can define
additional description, alternative name, author, and so forth.

If you add new snippets, you can choose «YASnippet/Reload
everything» from the Emacs menu. I guess this is «yas/reload-all».

Within a snippet, the first «$1» results in putting the cursor at
this point and «asking» the user to enter a string. You can define a
default string with «${1:test}» where «test» is the default string
for «$1».

All other occurrences of «$1» will be replaced by the very same user
string which is quite handy: you have to enter it only once and it
gets replaced multiple times.

The snippet above with «$1» as «foo bar» should result in:

,----[ expanded snippet «test» with «foo bar» ]
| ** Test foo bar
| :PROPERTIES:
| :ID: foo bar
| :END:
`----

For further documentation, please refer to [1].

At my side, any «$x» within the PROPERTIES drawer messes up the
line.


YASnippets are very easy to set up, very handy to use. IMHO,
everybody should use something like yasnippet in his/her daily
workflow.

  1. http://capitaomorte.github.com/yasnippet/#how-to-use-yasnippet
-- 
Karl Voit

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-10 17:50 ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Karl Voit
  2013-02-11 15:36   ` Bastien
@ 2013-02-14 13:11   ` Memnon Anon
  2013-02-15 14:44     ` Karl Voit
  1 sibling, 1 reply; 11+ messages in thread
From: Memnon Anon @ 2013-02-14 13:11 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> So there does not seem to be anybody who is able to fix this issue.
> Is there at least somebody who can confirm this weird bug?

I tried your snippet, everything fine here with:

Org-mode version 7.9.3e (7.9.3e-1032-g791a8d)
yas, latest git

hth
Memnon

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-14 13:11   ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Memnon Anon
@ 2013-02-15 14:44     ` Karl Voit
  2013-02-15 15:17       ` Karl Voit
  0 siblings, 1 reply; 11+ messages in thread
From: Karl Voit @ 2013-02-15 14:44 UTC (permalink / raw)
  To: emacs-orgmode

* Memnon Anon <gegendosenfleisch@googlemail.com> wrote:
> Karl Voit <devnull@Karl-Voit.at> writes:
>
>> So there does not seem to be anybody who is able to fix this issue.
>> Is there at least somebody who can confirm this weird bug?
>
> I tried your snippet, everything fine here with:
>
> Org-mode version 7.9.3e (7.9.3e-1032-g791a8d)
> yas, latest git

Oh, shit. I updated Org to latest git and I moved from Debian
yasnippet to github yasnippet (latest) and I still do have this
issue.

So it's my set-up which is causing this effect. Damn. I guess I have
to debug this by disabling parts of my config[1] ...

Thanks for your effort!

  1. https://github.com/novoid/dot-emacs
-- 
Karl Voit

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-15 14:44     ` Karl Voit
@ 2013-02-15 15:17       ` Karl Voit
  2013-02-15 17:38         ` Karl Voit
  2013-02-16 13:43         ` Rafael
  0 siblings, 2 replies; 11+ messages in thread
From: Karl Voit @ 2013-02-15 15:17 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
>
> I updated Org to latest git and I moved from Debian yasnippet to
> github yasnippet (latest) and I still do have this issue.
>
> So it's my set-up which is causing this effect. Damn. I guess I
> have to debug this by disabling parts of my config ...

So a quick test of my set-up with disabling all(!) of my Org-mode
settings caused the same issue. Therefore, it's not my Org-mode
set-up which is causing all this hazzle.

Next test: «emacs -q» and I loaded only yasnippet:

,----
| (defun my-load-local-el (part) ... )
| (my-load-local-el "contrib/yasnippet/yasnippet.el") ;; load-path
| (require 'yasnippet)
| (setq yas/root-directory "~/.emacs.d/snippets")
| (yas/load-directory yas/root-directory)
`----

And yes, I still got the issue. :-(

I guess I have to do a bug report to yasnippet.

-- 
Karl Voit

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-15 15:17       ` Karl Voit
@ 2013-02-15 17:38         ` Karl Voit
  2013-02-15 22:40           ` Bastien
  2013-02-16 13:43         ` Rafael
  1 sibling, 1 reply; 11+ messages in thread
From: Karl Voit @ 2013-02-15 17:38 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
>
> I guess I have to do a bug report to yasnippet.

Bugreport: https://github.com/capitaomorte/yasnippet/issues/362

I cut down this issue to a minimal example: it's the combination of
heading followed by a line with two colons and a text after the
replacement string:

,----[ Snippet: ]
| * Test
| :ID: ${1:test}-after
`----

,----[ Expected result: ]
| * Test
| :ID: foo bar-afte
`----

,----[ But unfortunately: ]
| * Test
| foo bar  :test:     test-after
`----

When the heading OR one colon OR the string after the replacement is
omitted, it's working as expected though :-O

-- 
Karl Voit

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-15 17:38         ` Karl Voit
@ 2013-02-15 22:40           ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2013-02-15 22:40 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

Hi Karl,

Karl Voit <devnull@Karl-Voit.at> writes:

> Bugreport: https://github.com/capitaomorte/yasnippet/issues/362

You've been quick on narrowing the problem, this didn't leave me a
chance to learn yasnippet!  Next time :)

-- 
 Bastien

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-15 15:17       ` Karl Voit
  2013-02-15 17:38         ` Karl Voit
@ 2013-02-16 13:43         ` Rafael
  2013-02-16 15:36           ` Karl Voit
  1 sibling, 1 reply; 11+ messages in thread
From: Rafael @ 2013-02-16 13:43 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> * Karl Voit <devnull@Karl-Voit.at> wrote:
>>
>> I updated Org to latest git and I moved from Debian yasnippet to
>> github yasnippet (latest) and I still do have this issue.
>>
>> So it's my set-up which is causing this effect. Damn. I guess I
>> have to debug this by disabling parts of my config ...
>
> So a quick test of my set-up with disabling all(!) of my Org-mode
> settings caused the same issue. Therefore, it's not my Org-mode
> set-up which is causing all this hazzle.
>
> Next test: «emacs -q» and I loaded only yasnippet:
>
> ,----
> | (defun my-load-local-el (part) ... )
> | (my-load-local-el "contrib/yasnippet/yasnippet.el") ;; load-path
> | (require 'yasnippet)
> | (setq yas/root-directory "~/.emacs.d/snippets")
> | (yas/load-directory yas/root-directory)
> `----
>
> And yes, I still got the issue. :-(
>
> I guess I have to do a bug report to yasnippet.

I think I have the newest (github) yasnippet, and doing C-h f on
yas/load-directory, it says that it is an obsolete function,
recommending yas-load-directory instead. Maybe it is worth a try.

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

* Re: [Bug] Yasnippet/Org: properties messed up when expanding $1
  2013-02-16 13:43         ` Rafael
@ 2013-02-16 15:36           ` Karl Voit
  0 siblings, 0 replies; 11+ messages in thread
From: Karl Voit @ 2013-02-16 15:36 UTC (permalink / raw)
  To: emacs-orgmode

* Rafael <rvf0068@gmail.com> wrote:
>
> I think I have the newest (github) yasnippet, and doing C-h f on
> yas/load-directory, it says that it is an obsolete function,
> recommending yas-load-directory instead. Maybe it is worth a try.

Thanks for the hint but it does not change my behavior :-(

As a matter of fact, while debugging the issue, I was using
«YASnippet > Reload everything» from the menu bar between each test.

-- 
Karl Voit

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

end of thread, other threads:[~2013-02-16 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-07 11:51 Yasnippet/Org issue: messing up properties Karl Voit
2013-02-10 17:50 ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Karl Voit
2013-02-11 15:36   ` Bastien
2013-02-11 16:31     ` A short introduction to YASnippet (was: [Bug] Yasnippet/Org: properties messed up when expanding $1) Karl Voit
2013-02-14 13:11   ` [Bug] Yasnippet/Org: properties messed up when expanding $1 Memnon Anon
2013-02-15 14:44     ` Karl Voit
2013-02-15 15:17       ` Karl Voit
2013-02-15 17:38         ` Karl Voit
2013-02-15 22:40           ` Bastien
2013-02-16 13:43         ` Rafael
2013-02-16 15:36           ` Karl Voit

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