I am using Geany version 1.25 on Windows 7 x64.
I tried to send current selected text by setting `Context Menu >> Format >> Send selection to` but it isn't working.
I can't figure out how to send current open file's selected text to any of the below options:
1. Windows Terminal 2. Self-executable Batch file 3. Browser(firefox or chrome, running as command)
%s is not displaying anything at all, just blank.
Need solution for all above issues.
On 5 November 2015 at 06:03, Vivek viveklucky1848@gmail.com wrote:
I am using Geany version 1.25 on Windows 7 x64.
I tried to send current selected text by setting `Context Menu >> Format >> Send selection to` but it isn't working.
I can't figure out how to send current open file's selected text to any of the below options:
- Windows Terminal
- Self-executable Batch file
- Browser(firefox or chrome, running as command)
What exactly is the command you are using?
Do these programs read text from their standard input and send the result to their standard output? Note the output from the commands replaces the selection, see http://www.geany.org/manual/current/index.html#sending-text-through-custom-c....
%s is not displaying anything at all, just blank.
This does not relate to custom commands, its used in the context action command, see http://www.geany.org/manual/current/index.html#context-actions
Cheers Lex
Need solution for all above issues.
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Well is there any general global variable (like GEDIT_CURRENT_SELECTION for Gedit) which stores the currently selected word so I can send it to browser like "firefox http://php.net/%s" or "chrome http://php.net/%s" in Windows/Ubuntu linux geany ?
How many variables are there like (%s) in geany and where can I get list of them and their usage possibilities ?
On 5 November 2015 at 04:21, Lex Trotman elextr@gmail.com wrote:
On 5 November 2015 at 06:03, Vivek viveklucky1848@gmail.com wrote:
I am using Geany version 1.25 on Windows 7 x64.
I tried to send current selected text by setting `Context Menu >> Format
Send selection to` but it isn't working.
I can't figure out how to send current open file's selected text to any
of
the below options:
- Windows Terminal
- Self-executable Batch file
- Browser(firefox or chrome, running as command)
What exactly is the command you are using?
Do these programs read text from their standard input and send the result to their standard output? Note the output from the commands replaces the selection, see
http://www.geany.org/manual/current/index.html#sending-text-through-custom-c... .
%s is not displaying anything at all, just blank.
This does not relate to custom commands, its used in the context action command, see http://www.geany.org/manual/current/index.html#context-actions
Cheers Lex
Need solution for all above issues.
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 6 November 2015 at 05:14, VIVEK SHAH viveklucky1848@gmail.com wrote:
Well is there any general global variable (like GEDIT_CURRENT_SELECTION for Gedit) which stores the currently selected word so I can send it to browser like "firefox http://php.net/%s" or "chrome http://php.net/%s" in Windows/Ubuntu linux geany ?
The manual gives an example of using the context action for this.
How many variables are there like (%s) in geany and where can I get list of them and their usage possibilities ?
Substitutions applicable vary depending on the context, they are documented in the manual under the relevant context.
Cheers Lex
On 5 November 2015 at 04:21, Lex Trotman elextr@gmail.com wrote:
On 5 November 2015 at 06:03, Vivek viveklucky1848@gmail.com wrote:
I am using Geany version 1.25 on Windows 7 x64.
I tried to send current selected text by setting `Context Menu >> Format
Send selection to` but it isn't working.
I can't figure out how to send current open file's selected text to any of the below options:
- Windows Terminal
- Self-executable Batch file
- Browser(firefox or chrome, running as command)
What exactly is the command you are using?
Do these programs read text from their standard input and send the result to their standard output? Note the output from the commands replaces the selection, see
http://www.geany.org/manual/current/index.html#sending-text-through-custom-c....
%s is not displaying anything at all, just blank.
This does not relate to custom commands, its used in the context action command, see http://www.geany.org/manual/current/index.html#context-actions
Cheers Lex
Need solution for all above issues.
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Are you a fool or are u trying to make fool outta me ?
Do you really think, I haven't even tried the example in the documentation yet ?
I already told you I tried applying url into context menu action like 'firefox "http://www.php.net/%s"' or 'chrome "http://www.php.net/%s"' in Geany in Windows 7, but it's not working the url passed to browser is http://www.php.net/%s why %s is not interpreted it SHOULD be interpreted in all OSes including Windows.
On 6 November 2015 at 01:55, Lex Trotman elextr@gmail.com wrote:
On 6 November 2015 at 05:14, VIVEK SHAH viveklucky1848@gmail.com wrote:
Well is there any general global variable (like GEDIT_CURRENT_SELECTION
for
Gedit) which stores the currently selected word so I can send it to
browser
like "firefox http://php.net/%s" or "chrome http://php.net/%s" in Windows/Ubuntu linux geany ?
The manual gives an example of using the context action for this.
How many variables are there like (%s) in geany and where can I get list
of
them and their usage possibilities ?
Substitutions applicable vary depending on the context, they are documented in the manual under the relevant context.
Cheers Lex
On 5 November 2015 at 04:21, Lex Trotman elextr@gmail.com wrote:
On 5 November 2015 at 06:03, Vivek viveklucky1848@gmail.com wrote:
I am using Geany version 1.25 on Windows 7 x64.
I tried to send current selected text by setting `Context Menu >>
Format
Send selection to` but it isn't working.
I can't figure out how to send current open file's selected text to
any
of the below options:
- Windows Terminal
- Self-executable Batch file
- Browser(firefox or chrome, running as command)
What exactly is the command you are using?
Do these programs read text from their standard input and send the result to their standard output? Note the output from the commands replaces the selection, see
http://www.geany.org/manual/current/index.html#sending-text-through-custom-c... .
%s is not displaying anything at all, just blank.
This does not relate to custom commands, its used in the context action command, see http://www.geany.org/manual/current/index.html#context-actions
Cheers Lex
Need solution for all above issues.
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Hi,
On 07/11/2015 18:58, VIVEK SHAH wrote:
Are you a fool or are u trying to make fool outta me ?
Do you really think, I haven't even tried the example in the documentation yet ?
Calm down, we should be able to work it out.
I already told you I tried applying url into context menu action like 'firefox "http://www.php.net/%s"' or 'chrome "http://www.php.net/%s"' in Geany in Windows 7, but it's not working the url passed to browser is http://www.php.net/%s why %s is not interpreted it SHOULD be interpreted in all OSes including Windows.
It's unclear what you're trying to use: Geany has two *different* things, the "context action", which is configured in the Preferences under Tools, and "custom commands" that are configured in Edit -> Format -> Send Selection To -> Set Custom Commands.
The context action uses "%s" to receive the selected text/word under the cursor.
Custom commands receive the selected text through their *standard input*, not "%s". Custom commands are typically meant as filters: they receive some data and should output an altered version. Remember that the current document is *modified* with the output of that command (if it succeeds). You can somehow "trick" custom commands to pass the selected text to e.g. your browser and not modify the document, but to do so you need to:
1) read the standard input into a variable; 2) run the browser with that variable as argument; 3) return a non-0 value from your script to prevent text replacement.
For example, as UNIX shell script doing so could look like it (untested as it's probably not of much use):
``` #!/bin/sh
text=$(cat stdin) firefox "http://duckduckgo.com/?q=$text" exit 1 ```
How you do it on Windows depends on how Batch scripts (or PowerShell, or Python, or any other tool you like) read standard input, but I'm afraid I can't really help on that end, sorry.
On 6 November 2015 at 05:14, VIVEK SHAH <viveklucky1848@gmail.com mailto:viveklucky1848@gmail.com> wrote: Well is there any general global variable (like GEDIT_CURRENT_SELECTION for Gedit) which stores the currently selected word
No, Geany currently doesn't set environment variables like that. It could be a good thing to give more context (like filename, line, filetype and whatnot), but that's not yet implemented.
Regards, Colomban
Hey there,
VIVEK SHAH wrote:
Do you really think, I haven't even tried the example in the documentation yet ?
I already told you I tried applying url into context menu action like 'firefox "http://www.php.net/%s"' or 'chrome "http://www.php.net/%s"' in Geany in Windows 7, but it's not working the url passed to browser is http://www.php.net/%s why %s is not interpreted it SHOULD be interpreted in all OSes including Windows.
I took a look at this page:
http://www.geany.org/manual/current/index.html#sending-text-through-custom-c...
It's not written very clearly (sorry, devs!). Here's a more clear set of instructions that should get it working for you:
1) Left-click the Edit menu. 2) Left-click on Preferences. 3) Left-click on Tools. 4) Paste this into the Context action box: firefox "http://www.php.net/%s" 5) Left-click the Apply button. 6) Left-click the OK button.
Now you can select any text in Geany, right-click, and choose Context Action from the menu. It will run that action, replacing the %s with the selected text.
That's pretty cool. Thanks for asking about this. I had no idea Geany could do that. (:
Little Girl wrote > It's not written very clearly (sorry, devs!). Here's > a more clear set of instructions that should get it > working for you:
Thats _very_ helpful. Could you translate another bit of «Dynamic wildcards» for me?
At http://www.geany.org/manual/current/index.html#template-wildcards how do I make a keyboard short cut that will paste Wildcard «filename» into my file ? Preferably the full path-and-file name.
And (better still) would it be possible to add the current date or datetime on the following line ?
Richard H
On 11/07/2015 08:45 PM, Little Girl wrote:
Hey there,
VIVEK SHAH wrote:
...snip...
Hey there,
rch wrote:
Little Girl wrote > It's not written very clearly (sorry, devs!). Here's > a more clear set of instructions that should get it > working for you:
Thats _very_ helpful.
I'm glad it was of use. (:
Could you translate another bit of «Dynamic wildcards» for me?
I can try!
At
http://www.geany.org/manual/current/index.html#template-wildcards how do I make a keyboard short cut that will paste Wildcard «filename» into my file ? Preferably the full path-and-file name.
And (better still) would it be possible to add the current date or datetime on the following line ?
Well, there's good news and bad news. You can add a placeholder (that gets replaced by the current file's name when you save the file) and the date (or date and time) using the instructions at that link only when creating a new file, because those instructions are for creating and using a template. In the event that you want to try that, here's my version of those instructions specifically for adding the file name and date (or date and time):
==================== 1) Open your ~/.config/geany/templates/files directory in a file manager (you'll need to enable the display of hidden files to get to it). 2) Create a new text file in the directory with whatever name you'd like it to have (you could create myfirsttemplate.txt as an initial experiment). Note that Geany will automatically suggest the same extension for saving files created with that template. 3) Open the file you just created in Geany. 4) Type this into it: {untitled} {date} 5) Save the file. 6) Left-click File in the toolbar. 7) Left-click New (with Template) in the menu. 8) Left-click the name of your template. A new file will be created with untitled on the first line and the date on the second line. The cursor will be blinking at the beginning of the first line. 9) Use the arrow keys or the mouse to move the cursor below the two automatically inserted lines of text. 10) Press the Enter key *or* type something inside the file and press the Enter key. (Note: The Enter key is vital to Geany for some reason - it will not replace the wildcard without a press of that key.) 11) Left-click File in the toolbar. 12) Left-click Save As in the menu. 13) Type in a name for the file. 14) Left-click the Save button or press the Enter key. The untitled wildcard will be replaced with the file's name.
Alternative: If you'd rather have the date and time, replace {date} above with {datetime}. ====================
As for keyboard shortcuts, you can press Alt + E and then press E again and then use the arrow keys to select one of the date formats to insert the date into a message.
An alternative to that would be to press Alt + T and then press M to open the mini script interface. If you had already typed date into the text area, you could click the Execute button. Or you can type date into the text area and then click the Execute button, and then from then on you won't need to type it again. Note that the mini script interface offers the option to save scripts and load them, and that's really powerful since the sky's the limit on what you can do to a file if you know how to script it. (:
60840A_Geanyusers.txt 10.11.2015 08:00:43 CET
Thats magic (see above two lines)
Question:- Does this only work with template files that are empty except for the two lines {untitled} {date} ?
I tried adding those two lines at top of my existing Perl template text.pl which is 240 lines long.
The new Perl file opens with the date already nicely filled in; it looks like this
untitled 10.11.2015 08:11:12 CET #!/usr/bin/perl ...snip...
But when I save it using same procedure as for the txt file, the top line "untitled" does not change at all.
Perhaps I'll need to learn some scripting [1] R [1]
Note that the mini script interface offers the option to save scripts and load them, and that's really powerful since the sky's the limit on what you can do to a file if you know how to script it. (:
On 11/09/2015 12:07 AM, Little Girl wrote:
Hey there,
rch wrote:
Little Girl wrote > It's not written very clearly (sorry, devs!). Here's > a more clear set of instructions that should get it > working for you:
Thats _very_ helpful.
I'm glad it was of use. (:
Could you translate another bit of «Dynamic wildcards» for me?
I can try!
At
http://www.geany.org/manual/current/index.html#template-wildcards how do I make a keyboard short cut that will paste Wildcard «filename» into my file ? Preferably the full path-and-file name.
And (better still) would it be possible to add the current date or datetime on the following line ?
Well, there's good news and bad news. You can add a placeholder (that gets replaced by the current file's name when you save the file) and the date (or date and time) using the instructions at that link only when creating a new file, because those instructions are for creating and using a template. In the event that you want to try that, here's my version of those instructions specifically for adding the file name and date (or date and time):
====================
- Open your ~/.config/geany/templates/files directory in a file
manager (you'll need to enable the display of hidden files to get to it). 2) Create a new text file in the directory with whatever name you'd like it to have (you could create myfirsttemplate.txt as an initial experiment). Note that Geany will automatically suggest the same extension for saving files created with that template. 3) Open the file you just created in Geany. 4) Type this into it: {untitled} {date} 5) Save the file. 6) Left-click File in the toolbar. 7) Left-click New (with Template) in the menu. 8) Left-click the name of your template. A new file will be created with untitled on the first line and the date on the second line. The cursor will be blinking at the beginning of the first line. 9) Use the arrow keys or the mouse to move the cursor below the two automatically inserted lines of text. 10) Press the Enter key *or* type something inside the file and press the Enter key. (Note: The Enter key is vital to Geany for some reason
- it will not replace the wildcard without a press of that key.)
- Left-click File in the toolbar.
- Left-click Save As in the menu.
- Type in a name for the file.
- Left-click the Save button or press the Enter key. The untitled
wildcard will be replaced with the file's name.
Alternative: If you'd rather have the date and time, replace {date} above with {datetime}. ====================
As for keyboard shortcuts, you can press Alt + E and then press E again and then use the arrow keys to select one of the date formats to insert the date into a message.
An alternative to that would be to press Alt + T and then press M to open the mini script interface. If you had already typed date into the text area, you could click the Execute button. Or you can type date into the text area and then click the Execute button, and then from then on you won't need to type it again. Note that the mini script interface offers the option to save scripts and load them, and that's really powerful since the sky's the limit on what you can do to a file if you know how to script it. (:
Hey there,
I changed the title of this thread since we changed the topic. (:
rch wrote:
60840A_Geanyusers.txt 10.11.2015 08:00:43 CET
Thats magic (see above two lines)
Yeah, I've been having quite a bit of fun with them, too. (:
Question:- Does this only work with template files that are empty except for the two lines {untitled} {date} ?
Not at all. Check out all the wildcards here:
http://www.geany.org/manual/current/index.html#templates
At least one of them has a requirement (the filename wildcard must be in the first four lines of the template or it won't work), and you can read the descriptions of each one to find out more.
I see you're using GNU/Linux (if this were Windows, a different command would need to be used below to get your username), so try this template:
Title: {untitled} Date: {date}
Hello world!
This template was written by {command:whoami} and has been brought to you from within {geanyversion} for your viewing pleasure.
I tried adding those two lines at top of my existing Perl template text.pl which is 240 lines long. The new Perl file opens with the date already nicely filled in; it looks like this untitled 10.11.2015 08:11:12 CET #!/usr/bin/perl ...snip... But when I save it using same procedure as for the txt file, the top line "untitled" does not change at all.
That might be because you bumped the hash line (the one starting with #) down two lines. That needs to stay at the top of a perl script because that's where the system looks to try to find out what kind of file it's opening.
I'm not sure if your modification of that file would work if you moved the first two lines below the hash line, but I'm out of time this morning. I'll check back later today to see how it went, though.
Perhaps I'll need to learn some scripting [1] R
[1]
Note that the mini script interface offers the option to save scripts and load them, and that's really powerful since the sky's the limit on what you can do to a file if you know how to script it. (:
Yes, definitely. It's a blast, and you can start as small as you like and work your way up. If you can script, you can pretty well do anything on a computer. Now you just need to pick which language(s) you'd like to learn. Also, the command wildcard above will allow you to insert shell commands right into a template, so even if you start small and learn one new thing at a time, you can add those things into templates immediately. (:
Just a quick report, following your email
moved the first two lines below the hash line, but I'm out of time
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
What is curious is that {fileheader} → «foobar.pl» ; good (line 3 ) {untitled} → «untitled» ; bad (line 2)
RichardH
Using Geany ver 0.21 running under Ubuntu 12.04
--------------------------------------------- (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@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 ...
--
On 11/10/2015 04:33 PM, Little Girl wrote:
Hey there,
I changed the title of this thread since we changed the topic. (:
rch wrote:
60840A_Geanyusers.txt 10.11.2015 08:00:43 CET
Thats magic (see above two lines)
Yeah, I've been having quite a bit of fun with them, too. (:
Question:- Does this only work with template files that are empty except for the two lines {untitled} {date} ?
Not at all. Check out all the wildcards here:
http://www.geany.org/manual/current/index.html#templates
At least one of them has a requirement (the filename wildcard must be in the first four lines of the template or it won't work), and you can read the descriptions of each one to find out more.
I see you're using GNU/Linux (if this were Windows, a different command would need to be used below to get your username), so try this template:
Title: {untitled} Date: {date}
Hello world!
This template was written by {command:whoami} and has been brought to you from within {geanyversion} for your viewing pleasure.
I tried adding those two lines at top of my existing Perl template text.pl which is 240 lines long. The new Perl file opens with the date already nicely filled in; it looks like this untitled 10.11.2015 08:11:12 CET #!/usr/bin/perl ...snip... But when I save it using same procedure as for the txt file, the top line "untitled" does not change at all.
That might be because you bumped the hash line (the one starting with #) down two lines. That needs to stay at the top of a perl script because that's where the system looks to try to find out what kind of file it's opening.
I'm not sure if your modification of that file would work if you moved the first two lines below the hash line, but I'm out of time this morning. I'll check back later today to see how it went, though.
Perhaps I'll need to learn some scripting [1] R
[1]
Note that the mini script interface offers the option to save scripts and load them, and that's really powerful since the sky's the limit on what you can do to a file if you know how to script it. (:
Yes, definitely. It's a blast, and you can start as small as you like and work your way up. If you can script, you can pretty well do anything on a computer. Now you just need to pick which language(s) you'd like to learn. Also, the command wildcard above will allow you to insert shell commands right into a template, so even if you start small and learn one new thing at a time, you can add those things into templates immediately. (:
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@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.
On 11 November 2015 at 15:04, Little Girl littlergirl@gmail.com wrote:
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).
Yes untitled.xxx (where xxx is the file extension) has to be in the first three lines and only the first occurrence is replaced. This has nothing to do with templates, its a new-file save feature, and it does not appear to be documented, can you raise an issue so its not forgotten.
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).
There are no substitutes in the command, and the command stops at the first } so its going to be hard to include } in the command.
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)
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
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. (:
Indeed 0.21 is very old and no longer supported.
Cheers Lex
(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@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. _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
its a new-file save feature, and it does not appear to be documented, can you raise an issue so its not forgotten.
Done; see https://github.com/geany/geany/issues/753
Indeed 0.21 is very old
So am I
But now at least Geany is rejuvenated; with thanks to http://askubuntu.com/questions/88327/how-do-i-keep-geanys-versions-updated-a...
R
On 11/11/2015 08:36 AM, Lex Trotman wrote:
On 11 November 2015 at 15:04, Little Girl littlergirl@gmail.com wrote:
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).
Yes untitled.xxx (where xxx is the file extension) has to be in the first three lines and only the first occurrence is replaced. This has nothing to do with templates, its a new-file save feature, and it does not appear to be documented, can you raise an issue so its not forgotten.
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).
There are no substitutes in the command, and the command stops at the first } so its going to be hard to include } in the command.
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)
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
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. (:
Indeed 0.21 is very old and no longer supported.
Cheers Lex
... snip ...
Hey there,
Lex Trotman wrote:
On 11 November 2015 at 15:04, Little Girl littlergirl@gmail.com wrote:
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).
There are no substitutes in the command, and the command stops at the first } so its going to be hard to include } in the command.
Oh, I really need to kick myself in the head on that one. I should have realized the } is considered a full stop in the shell. (:
I just tried it with single quotes around the {ob}{untitled}{cb}, but that doesn't work either (it removes the path).
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
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. (:
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
On 12 November 2015 at 01:46, Little Girl littlergirl@gmail.com wrote:
Hey there,
Lex Trotman wrote:
On 11 November 2015 at 15:04, Little Girl littlergirl@gmail.com wrote:
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).
There are no substitutes in the command, and the command stops at the first } so its going to be hard to include } in the command.
I meant that Geany ends the substitution at the first } so: {command: something {ob}{untitled}{ob}} will be seen as the command "something {ob" or the command "something " depending if the {ob} is substituted before or after the command one (didn't check).
So it will never do anything useful.
Oh, I really need to kick myself in the head on that one. I should have realized the } is considered a full stop in the shell. (:
I just tried it with single quotes around the {ob}{untitled}{cb}, but that doesn't work either (it removes the path).
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
should work anywhere IIUC
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. (:
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
Actually if you put it that way it doesn't seem to be very useful that I can tell, but maybe somebody else has an idea.
Cheers Lex
-- Little Girl
There is no spoon. _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Suggestion:- What's the chance of an online Geany Cook Book with recipes for all the less obvious ways of getting things done in Geany?
Suggest follow the example of the Perl Cookbook http://my.safaribooksonline.com/0596003137 i.e.
**i.j Recipe**
_Problem_ Lorem ipsum dolor sit amet, consectetur adipisicing elit,
_Solution_ sed doeiusmod tempor incididunt ut labore et dolore magna aliqua.
_Discussion_ Ut enimad minim veniam, …
and with text in plain english :-).
RichardH
--
On 11/12/2015 12:47 AM, Lex Trotman wrote:
On 12 November 2015 at 01:46, Little Girl littlergirl@gmail.com wrote:
Hey there,
Lex Trotman wrote:
On 11 November 2015 at 15:04, Little Girl littlergirl@gmail.com wrote:
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).
There are no substitutes in the command, and the command stops at the first } so its going to be hard to include } in the command.
I meant that Geany ends the substitution at the first } so: {command: something {ob}{untitled}{ob}} will be seen as the command "something {ob" or the command "something " depending if the {ob} is substituted before or after the command one (didn't check).
So it will never do anything useful.
Oh, I really need to kick myself in the head on that one. I should have realized the } is considered a full stop in the shell. (:
I just tried it with single quotes around the {ob}{untitled}{cb}, but that doesn't work either (it removes the path).
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
should work anywhere IIUC
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. (:
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
Actually if you put it that way it doesn't seem to be very useful that I can tell, but maybe somebody else has an idea.
Cheers Lex
-- Little Girl
There is no spoon. _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 12 November 2015 at 14:48, rch rch@skynet.be wrote:
Suggestion:- What's the chance of an online Geany Cook Book with recipes for all the less obvious ways of getting things done in Geany?
Suggest follow the example of the Perl Cookbook http://my.safaribooksonline.com/0596003137 i.e.
**i.j Recipe**
_Problem_ Lorem ipsum dolor sit amet, consectetur adipisicing elit, _Solution_ sed doeiusmod tempor incididunt ut labore et dolore magna aliqua. _Discussion_ Ut enimad minim veniam, …
and with text in plain english :-).
Sure, just that "somebody" has to do it.
Cheers Lex
RichardH
--
Hey there,
Lex Trotman wrote:
On 12 November 2015 at 01:46, Little Girl littlergirl@gmail.com wrote:
I meant that Geany ends the substitution at the first } so: {command: something {ob}{untitled}{ob}} will be seen as the command "something {ob" or the command "something " depending if the {ob} is substituted before or after the command one (didn't check).
So it will never do anything useful.
Yep, and my failed attempts to get it to do anything useful bear that out. (:
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
should work anywhere IIUC
It only works in the first four lines of the template for me in Geany 1.25 under Linux Mint MATE 17.1 'Rebecca'. Maybe it's a bug?
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
Actually if you put it that way it doesn't seem to be very useful that I can tell, but maybe somebody else has an idea.
LOL! I'll mess around with using it in various ways and places in Geany to see where it would be of use, and if I figure it out, I'll share in here. (:
On 13 November 2015 at 01:38, Little Girl littlergirl@gmail.com wrote:
Hey there,
Lex Trotman wrote:
On 12 November 2015 at 01:46, Little Girl littlergirl@gmail.com wrote:
I meant that Geany ends the substitution at the first } so: {command: something {ob}{untitled}{ob}} will be seen as the command "something {ob" or the command "something " depending if the {ob} is substituted before or after the command one (didn't check).
So it will never do anything useful.
Yep, and my failed attempts to get it to do anything useful bear that out. (:
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
should work anywhere IIUC
It only works in the first four lines of the template for me in Geany 1.25 under Linux Mint MATE 17.1 'Rebecca'. Maybe it's a bug?
So probably worth saying where it doesn't work.
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
Actually if you put it that way it doesn't seem to be very useful that I can tell, but maybe somebody else has an idea.
LOL! I'll mess around with using it in various ways and places in Geany to see where it would be of use, and if I figure it out, I'll share in here. (:
A quick thought that I havn't time ATM to check, but maybe if its used on a comment template which can be pasted in after the file is saved it might be of some use, but not in new file templates.
Cheers Lex
-- Little Girl
There is no spoon. _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Hey there,
Lex Trotman wrote:
Little Girl wrote:
This works if it's in the first four lines of the template:
# file://{command:pwd}/{filename}
should work anywhere IIUC
It only works in the first four lines of the template for me in Geany 1.25 under Linux Mint MATE 17.1 'Rebecca'. Maybe it's a bug?
So probably worth saying where it doesn't work.
It doesn't work if it's on line 5 or below.
The $GEANY_FILENAME and friends are only given values if they are known, but the filename isn't known for a new file so the variable is set but to nothing. That may be your problem.
When would be a good time to use $GEANY_FILENAME?
Actually if you put it that way it doesn't seem to be very useful that I can tell, but maybe somebody else has an idea.
LOL! I'll mess around with using it in various ways and places in Geany to see where it would be of use, and if I figure it out, I'll share in here. (:
A quick thought that I havn't time ATM to check, but maybe if its used on a comment template which can be pasted in after the file is saved it might be of some use, but not in new file templates.
I see those in Edit --> Insert Comments, but haven't figured out how to edit them. Thanks for the idea, though. I'll be toying with Geany some more, will figure out how to edit those, and try inserting it there. (: