Re: [code] Dealing with % before a snippet-placeholder

From: Mitchell <m.att.foicica.com>
Date: Thu, 12 Nov 2015 09:40:06 -0500 (EST)

Hi Martin,

On Wed, 11 Nov 2015, docmorchel . wrote:

> Hi all,
>
> How would I get a percent sign in front of the substituted placeholder?
> The snippet result (actually part of it) should consist of a percent sign
> followed by some digits, eg. '%12'. My two attempts, which failed were:
>
> snippets.pm = {
> re1 = '%%%1(digits)',
> re2 = '%%1(digits)',
> }

This is a bug and has been fixed in hg[1] and will be in the next nightly.
Thanks for the report.

> And to sneak in another snippets-question:
> In one of my snippets I want to have the current date as placeholder. What
> is considered to be best practise to have dynamic content (I came up with
> the following: date = "%1("..os.date('%Y/%m/%d')..")")

I'd recommend using `%1(%<os.date("%Y/%m/%d")>)`. With your method, if you
keep Textadept open more than a day, then your snippet will be out-dated
:)

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 12 Nov 2015 - 09:40:06 EST

This archive was generated by hypermail 2.2.0 : Fri 13 Nov 2015 - 06:47:37 EST