My favorites | Sign in
Project Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 31: Executing lisp code after TAB
2 people starred this issue and may be notified of changes. Back to list
Status:  KnownIssue
Owner:  ----
Type-Enhancement
Priority-Medium


Sign in to add a comment
 
Reported by ropewalker99, Jul 18, 2008
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

I use MSF abbrevs since long for LATEX templates. I could replace it with
YASnippets (especially the compilation to one file etc.) if the elisp would
be (optionally) executed after going to the next field with TAB instead of
entering a single key.

e.g.:
# --
\section{${1:Name}}%
\index{${1:$(reftex-label)}}%

The reftex funktion takes a (depending on the files) long time to evaluate
the input $1, which makes the template useless to work with. msf abbrev
evaluates after finishing the field with tab, so the function is called once.

So my proposal would be to add some switch (or command) to have this behaviour.

Thank you



What version of the product are you using? On what operating system?


Please provide any additional information below.

 
Comment 1 by pluskid, Jul 19, 2008
Hmm, it is reasonable to have such a feature. But there will still need more
consideration, especially on how to integrate it with the original system (maybe as
you described, add a flag).
Comment 2 by everedgy, Jan 26, 2009
Would syntax like $,(some lisp code) be a sufficient flag for delayed lisp code
execution? The inspiration is from query-replace-regexp's \,(lisp code).
Comment 3 by ropewalker99, Feb 27, 2009
Sorry that I missed the mail and answer that late.

That syntax is of course fine. That would be $(lisp code) is executed after any key
input and $,(lisp code) is executed after TAB to jump to another field.
Comment 4 by joaotavora, Aug 29, 2009
Check out the documentation page "Writing snippets", you might find what you're looking for with primary field 
transformations and the variables `yas/modified-p' and `yas/moving-away-p'
Comment 5 by joaotavora, Sep 05, 2009
Won't take action on this enhancement issue until further feedback.
Status: WontFix
Labels: -Type-Defect Type-Enhancement
Comment 6 by joaotavora, Sep 13, 2009
See thread http://groups.google.com/group/smart-snippet/browse_thread/thread/282a90a118e1b662.

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))
Status: KnownIssue
Sign in to add a comment

Hosted by Google Code