Account Options

  1. Sign in
Google Groups Home
« Groups Home
Issue 31 in yasnippet: Executing lisp code after TAB
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
codesite-nore...@google.com  
View profile  
 More options Sep 5 2009, 8:07 am
From: codesite-nore...@google.com
Date: Sat, 05 Sep 2009 12:07:03 +0000
Local: Sat, Sep 5 2009 8:07 am
Subject: Issue 31 in yasnippet: Executing lisp code after TAB
Updates:
        Status: WontFix
        Labels: -Type-Defect Type-Enhancement

Comment #5 on issue 31 by joaotavora: Executing lisp code after TAB
http://code.google.com/p/yasnippet/issues/detail?id=31

Won't take action on this enhancement issue until further feedback.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Straka  
View profile  
 More options Sep 11 2009, 5:39 am
From: Peter Straka <ropewalke...@gmail.com>
Date: Fri, 11 Sep 2009 02:39:51 -0700 (PDT)
Local: Fri, Sep 11 2009 5:39 am
Subject: Re: Issue 31 in yasnippet: Executing lisp code after TAB
Hello,

In issue 100 nearly the same task is discussed. Mine is different to
this because I want to call the function after i filled out a field
and reftex-label uses this filed as input. #100 calls the function
immediately after expansion.

I tried to combine your answer and the answer to #100, but it does not
work yet:

I try:

\section{${1:Titel der Tour?}}%
\index{${1:$(if (eq yas/moving-away-p t) (reftex-label nil 'dont-
insert))}}%

$1 is mirrored but reftex is not called. it jumpes directly to next
field.

Secondly I tried:

\section{${1:Titel der Tour?}}%
\index{$1}%
\index{${2:$$(if (eq yas/moving-away-p t) (reftex-label nil 'dont-
insert))}}%
%
$2 is only a dummy, I press TAB. reftex-label is called indeed,
suggests the label. I press enter to accept, but noting is inserted
and yas jumps to the next input field

Maybe you have another idea?

Thanks, Peter

On 5 Sep., 14:07, codesite-nore...@google.com wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
João Távora  
View profile  
 More options Sep 12 2009, 7:54 am
From: João Távora <joaotav...@gmail.com>
Date: Sat, 12 Sep 2009 13:54:11 +0200
Local: Sat, Sep 12 2009 7:54 am
Subject: Re: Issue 31 in yasnippet: Executing lisp code after TAB
OK, some feedback finally...

Mirror transformations are basically functions of the text (text or  
yas/text variable) that is present on the field they mirror. YASnippet  
wasn't designed to handle stuff such as side effects, which is one of  
the things that might make your intention work.

Consider the following *workaround*, check if it works

`(progn (setq my-reftex-cache nil) "")`
\section{${1:"Titel der Tour"$(if yas/moving-away-p
                    (progn (setq my-reftex-cache (reftex-label nil  
'dont-insert))
                           (yas/update-mirrors snippet))
                  (setq my-reftex-cache nil))}}%
\index{${1:$(or my-reftex-cache
                 "waiting...")}}%

The my-reftex-cache variable implements the side-effect communication  
between the field and the mirror. Then you need the first progn line  
to initialize the variable. Then you need a **really** dirty hack  
where you force a mirror update. This is not guaranteed to work in the  
future (or in the present, for that matter), since it uses internal  
yasnippet workings which might change in the future.

But I ask you if you'd rather not use this:

\section{${1:"Titel der Tour"}}%
\index{${2:"waiting..."$(unless yas/modified-p (reftex-label nil 'dont-
insert))}}%

The only *inconvenient * here is that you get a chance to change the  
value inserted by reftex-label. Other than that, it's much cleaner,  
and is the "recommended" way.

Naturally, I didn't think of your scenario when I designed this  
feature. Its possible to make the first alternative cleaner in the  
future, I'll leave the issue open, maybe retitle it.

Bye,
J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
codesite-nore...@google.com  
View profile  
 More options Sep 13 2009, 11:01 am
From: codesite-nore...@google.com
Date: Sun, 13 Sep 2009 15:01:30 +0000
Local: Sun, Sep 13 2009 11:01 am
Subject: Issue 31 in yasnippet: Executing lisp code after TAB
Updates:
        Status: KnownIssue

Comment #6 on issue 31 by joaotavora: Executing lisp code after TAB
http://code.google.com/p/yasnippet/issues/detail?id=31

See thread  
http://groups.google.com/group/smart-snippet/browse_thread/thread/282....

Additionally, the following snippet can help the drawback of the second  
alternative:

\section{${1:"Titel der Tour"}}%
\index{${2:"waiting..."$(unless yas/modified-p (prog1 (reftex-label  
nil 'dont-insert)

(yas/schedule-field-skip)))}}%
$0

and some supporting elisp code...

(defun yas/schedule-field-skip ()
   (add-hook 'post-command-hook 'yas/field-skip-once 'append 'local))

(defun yas/field-skip-once ()
   (condition-case err
       (yas/next-field)
     (error nil))
   (remove-hook 'post-command-hook 'yas/field-skip-once 'local))

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Straka  
View profile  
 More options Sep 14 2009, 6:01 am
From: Peter Straka <ropewalke...@gmail.com>
Date: Mon, 14 Sep 2009 03:01:31 -0700 (PDT)
Local: Mon, Sep 14 2009 6:01 am
Subject: Re: Issue 31 in yasnippet: Executing lisp code after TAB
Hello,

thank you very much! I can now completely substitute msf abbrev with
yasnippet.

The version 2 works, and with the additional code it is perfect, the
same behaviour as in msf.

For the record: The snippet has to be slightly modified, because
reftex-label with parameter dont-insert does not write the \label{}.
So the complete snippet is:

\section{${1:Title}}%
\index{$1}%
\label{${2:"waiting..."$(unless yas/modified-p (prog1 (reftex-label
nil 'dont-insert)
(yas/schedule-field-skip)))}}%

On 13 Sep., 17:01, codesite-nore...@google.com wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »