[Geany-Users] Geany templates

Little Girl littlergirl at xxxxx
Wed Nov 11 05:04:20 UTC 2015


Hey there,

rch wrote:

> That does seem to be part of the  problem.
> Did that and I've now got a template
> which works almost but not quite.
> Template and output below the line at (a), (b)
 
> The following wildcards work nicely
>   {fileheader}, {datetime} and {geanyversion}
> See lines 3, 4, 5
 
> The following wild cards do not work
>   {untitled} and (trying to get the full path)
>   {command:readlink -f {ob}{untitled}{cb}}
> See lines 2, 6

I'm not sure what's up with this. It might be because there's already
one untitled in the template, so the second one isn't expanded on
save. It might also be that untitled has to be within the first X
number of rows in the file (although there's nothing about that in
the manual).

 Notice that the first one does expand perfectly when you save
the file. As for the opening and closing brace wildcards in
{ob}{untitled}{cb}, that could be because the command wildcard
literally runs a command in the shell and then sends its output back
into Geany. Since the Geany wildcards are unknown to the shell, it
either ignores them or has an error (not sure).

I tried it without the {ob} and {cb}, with quotes around it with and
without the {ob} and {cb}, and with $GEANY_FILENAME with and without
quotes around it. I couldn't get any of them to work. The shell isn't
getting the data it needs to finish the command. Maybe someone who's
reading along will jump in and suggest a better approach. (:
 
> What is curious is that
> {fileheader} → «foobar.pl» ; good (line 3 )
> {untitled}   → «untitled»  ; bad (line 2)

Line 2 actually isn't bad. Remember that you have to add something to
the file - either just a press of the Enter key or some typing and a
press of the Enter key. Once you do that and save the file, untitled
in line 2 will be replaced with the saved file name.
 
> Using Geany ver 0.21 running under Ubuntu 12.04

I'm using Geany version 1.25 under Linux Mint MATE 17.1 'Rebecca'.
You might want to upgrade to the latest version of Geany. (:

> ---------------------------------------------
> (a) Top six lines of template file (line numbers added)
> 
> #!/usr/bin/perl                      1
> # This is file {untitled}            2
> {fileheader}                         3
> # Made {datetime}                    4
> # By Geany version {geanyversion}    5
> # file://{command:readlink -f {ob}{untitled}{cb}} 6
> 
> (b) Top part of Perl script made by that template
> and saved as «foobar.pl»
> Lines numbered as in the template
> 
> # #!/usr/bin/perl                     1
> # This is file untitled               2
> #  foobar.pl                          3
> #
> #  Copyright 2015 RCH <rch at Ubuntu>
> #
> #  This program is free software; ...
> #  it under the terms of the GNU  ...
> ...etc..
> # Made 10.11.2015 20:47:12 CET        4
> # By Geany version Geany 0.21         5
> # file:///home/rch/{obuntitled}}      6
> ... snip ...

I'm getting similar results here.

-- 
Little Girl

There is no spoon.


More information about the Users mailing list