I want to know how to fetch (from a geanylua script) the current value of 
(geany's) 'comment_single' variable, which is defined in the 'filetype.foo' for 
the current open document.

The (geanylua function) geany.fileinfo(), returns (for the currently open 
document type,) a table, which includes 'opener' & 'closer', (table keys to 
the) values for 'comment_open' (start a multi-line comment) & 'comment_close' 
(end a multi-line comment). But it returns nothing for the single line version!

I have searched the Internet (trying variations on 'geany/geanylua single line 
comment tokens/strings') but I can't locate any helpful info...

So I then tried, (and failed,) to find (in geany's GitHub code) the 'call or 
variable' used by the geany menu command 'Edit>>Format>>Comment Line(s)'. It 
must must make some type of call, to obtain the current value of 
'comment_single' 

my current solution (is a bodge) for use in my geanylua scripts:

1. get the filetype (for the current open document)
2. attempt to open the relevant file ~/.config/geany/filedefs/filetype.foo
3. if the file exists
    4. search the file for the string 'comment_single'
    5. get the 'comment_single' value (eg '--')
6. else
    7. attempt to open the relevant file /usr/share/geany/filedefs/filetype.foo
    8. if the file exists
         9. search the file for the string 'comment_single'
        10. get the 'comment_single' value (eg '--')

This can't possibly be a suitable solution (for evaluating a simple variable), 
it's overly long, overly complex and relies on 'hard coded' file locations.

Interestingly for steps 5 and 10, I should also have previously obtained the 
string for (the value of) 'comment_single' in 'filetype.conf', thus allowing 
for a more 'accurate and robust' evaluation of the (string) value of 
'comment_single' in filetype.foo!

This nicely demonstrates, (IMO,) why the geanylua function ('geany.fileinfo()') 
should also return the current value of 'comment_single' in its results table.

I understand that geanylua has no current 'Maintainer', (to make any changes). 
This seems weird (to me) as geanylua is such an immensely useful plugin for 
geany!

I considered doing this myself, but as I last used 'C' extensively 38 years 
ago, and I have exactly one month of experience of using lua. I decided, that I 
am probably not (currently) the best candidate.

regards to all


-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/discussions/4174
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/repo-discussions/[email protected]>

Reply via email to