[Geany] quick find behavior
Hi I'd like different behavior from ctrl-g (currently find next). Originally I was going to ask if there was a way of making it like Chrome where in addition to jumping to the next result it also moves focus to the quick search box and highlights the current content of the quick search box so you can easily replace it. This is not as disruptive as it might sound as you can always dismiss the quick search box and move focus to the search result by hitting escape. Having played around with the keybindings a bit I'm also interested in something that does all that and copies the current text selection to the quick search box. Are there any existing options for anything like this? If it matters any I currently have 1.22 on win7. G ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
[Geany] Scoped Ruby declarations, with a hackish patch
Hi guys, I saw that the ruby parser don't properly generate tags declarations like: class Foo::Bar end which should generate a tag Bar with the scope Foo; but it generates a tag Foo and simply ignores Bar. This seems to apply to modules, classes and methods at least -- almost everything. So I wanted to fix that. Unfortunately the scoping code in CTags don't really support to easily put several scopes at the same level, e.g. if you want to push several scope you gotta handle the popping yourself. And since there is one single block end, it's tricky to do. Since I was way too lazy (and didn't even found a good implementation) to fix that, I just did it the dirty way: reading the whole Foo::Bar as a single tag name (Foo.Bar) and tuning the code registering the tag to split this on the last ., putting the left part (if any) in the scope. Patch attached. This is quite dirty, but works fine unless a legitimate tag may include a . in its name, which doesn't seem the case currently looking at the parser. Note that Ruby isn't the only language that allows such kind of scoping. For example, Vala allows to prefix stuff with a namespace -- and there is the same problem here. So, especially Nick, what do you guys think of this? Is this patch too dirty? Do somebody have a better idea? Or is this too dirty and we don't care because nobody writes ruby anyway? In one word: opinions? Thanks, Colomban From f0da754670cca4d4c3ddd0c8d7295881372ba3b6 Mon Sep 17 00:00:00 2001 From: Colomban Wendling b...@herbesfolles.org Date: Thu, 6 Sep 2012 20:45:57 +0200 Subject: [PATCH] Correctly parse Ruby declarations with inline scoping Generate the appropriate tags for declarations like: class Foo::Bar::Baz end The implementation here is quite hackish but works fairly reliably. --- tagmanager/ctags/ruby.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/tagmanager/ctags/ruby.c b/tagmanager/ctags/ruby.c index a614eb1..c7695ef 100644 --- a/tagmanager/ctags/ruby.c +++ b/tagmanager/ctags/ruby.c @@ -132,11 +132,26 @@ static void emitRubyTag (vString* name, rubyKind kind) { tagEntryInfo tag; vString* scope; + const char *this_name; vStringTerminate (name); scope = stringListToScope (nesting); - initTagEntry (tag, vStringValue (name)); + /* extract scope and actual name from tag name in case of tags like + * class Foo::Bar::Baz which are parsed as a single name, Foo.Bar.Baz */ + this_name = strrchr (vStringValue (name), '.'); + if (this_name) + { + if (vStringLength (scope) 0) + vStringPut (scope, '.'); + vStringNCat (scope, name, this_name - vStringValue (name)); + vStringTerminate (scope); + this_name ++; + } + else + this_name = vStringValue (name); + + initTagEntry (tag, this_name); if (vStringLength (scope) 0) { tag.extensionFields.scope [0] = class; tag.extensionFields.scope [1] = vStringValue (scope); @@ -230,7 +245,26 @@ static void readAndEmitTag (const unsigned char** cp, rubyKind expected_kind) if (isspace (**cp)) { vString *name = vStringNew (); - rubyKind actual_kind = parseIdentifier (cp, name, expected_kind); + vString *chunk = vStringNew (); + rubyKind actual_kind; + unsigned int i = 0; + + /* parse the identifier, allowing scoping like class Foo::Bar::Baz */ + while (1) + { + actual_kind = parseIdentifier (cp, chunk, expected_kind); + if (i++ 0) +vStringPut (name, '.'); + vStringCat (name, chunk); + vStringClear (chunk); + + if (actual_kind != K_UNDEFINED (*cp)[0] == ':' (*cp)[1] == ':') +*cp += 2; + else +break; + } + vStringDelete (chunk); + vStringTerminate (name); if (actual_kind == K_UNDEFINED || vStringLength (name) == 0) { -- 1.7.10.4 ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] Scoped Ruby declarations, with a hackish patch
Le 06/09/2012 20:58, Colomban Wendling a écrit : Hi guys, I saw that the ruby parser don't properly generate tags declarations like: class Foo::Bar end which should generate a tag Bar with the scope Foo; but it generates a tag Foo and simply ignores Bar. This seems to apply to modules, classes and methods at least -- almost everything. So I wanted to fix that. Unfortunately the scoping code in CTags don't really support to easily put several scopes at the same level, e.g. if you want to push several scope you gotta handle the popping yourself. And since there is one single block end, it's tricky to do. Since I was way too lazy (and didn't even found a good implementation) to fix that, I just did it the dirty way: reading the whole Foo::Bar as a single tag name (Foo.Bar) and tuning the code registering the tag to split this on the last ., putting the left part (if any) in the scope. Patch attached. Ah, I forgot to mention that it'd be awesome if some true Ruby users could test the patch and check whether it breaks anything I didn't see :) ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] Scoped Ruby declarations, with a hackish patch
On 7 September 2012 04:58, Colomban Wendling lists@herbesfolles.org wrote: Hi guys, I saw that the ruby parser don't properly generate tags declarations like: class Foo::Bar end which should generate a tag Bar with the scope Foo; but it generates a tag Foo and simply ignores Bar. This seems to apply to modules, classes and methods at least -- almost everything. So I wanted to fix that. Unfortunately the scoping code in CTags don't really support to easily put several scopes at the same level, e.g. if you want to push several scope you gotta handle the popping yourself. And since there is one single block end, it's tricky to do. Since I was way too lazy (and didn't even found a good implementation) to fix that, I just did it the dirty way: reading the whole Foo::Bar This is of course what C++ does when the declarations are not visible eg a::b::f(){}; makes a function 'a::b::f' if the declarations of a and b are not visible (eg in a closed .hpp file), if they are visible it puts f inside the declaration of b. Compare the symbols pane entrys for the definitions of f() and g() in the attached. I'm not a rubyist but I assume that Foo doesn't need to be declared before Bar in the above example and thats the problem. From the C++ example what you would need to do is autodeclare Foo (as what?) so you had somewhere to put Bar. as a single tag name (Foo.Bar) and tuning the code registering the tag to split this on the last ., putting the left part (if any) in the scope. Patch attached. This is quite dirty, but works fine unless a legitimate tag may include a . in its name, which doesn't seem the case currently looking at the parser. Note that Ruby isn't the only language that allows such kind of scoping. For example, Vala allows to prefix stuff with a namespace -- and there is the same problem here. But it is statically declared so it should work like C++ should it not? Cheers Lex So, especially Nick, what do you guys think of this? Is this patch too dirty? Do somebody have a better idea? Or is this too dirty and we don't care because nobody writes ruby anyway? In one word: opinions? Thanks, Colomban ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany namespace x { class y { void f(); }; }; void x::y::f(){}; void a::b::g(){}; ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] quick find behavior
On 7 September 2012 01:33, Gordon Wrigley gordon.wrig...@gmail.com wrote: Hi I'd like different behavior from ctrl-g (currently find next). Originally I was going to ask if there was a way of making it like Chrome where in addition to jumping to the next result it also moves focus to the quick search box and highlights the current content of the quick search box so you can easily replace it. I'm assuming that by quick search box you mean the toolbar search entry? The keybinding focus-switch to search bar (default f7) works pretty close to the way you describe. I re-define ctrlf to use that since its way less disruptive than the search dialog. Cheers Lex This is not as disruptive as it might sound as you can always dismiss the quick search box and move focus to the search result by hitting escape. Having played around with the keybindings a bit I'm also interested in something that does all that and copies the current text selection to the quick search box. Are there any existing options for anything like this? If it matters any I currently have 1.22 on win7. G ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] Scoped Ruby declarations, with a hackish patch
Le 07/09/2012 00:49, Lex Trotman a écrit : On 7 September 2012 04:58, Colomban Wendling lists@herbesfolles.org wrote: Hi guys, I saw that the ruby parser don't properly generate tags declarations like: class Foo::Bar end which should generate a tag Bar with the scope Foo; but it generates a tag Foo and simply ignores Bar. This seems to apply to modules, classes and methods at least -- almost everything. So I wanted to fix that. Unfortunately the scoping code in CTags don't really support to easily put several scopes at the same level, e.g. if you want to push several scope you gotta handle the popping yourself. And since there is one single block end, it's tricky to do. Since I was way too lazy (and didn't even found a good implementation) to fix that, I just did it the dirty way: reading the whole Foo::Bar This is of course what C++ does when the declarations are not visible eg a::b::f(){}; makes a function 'a::b::f' if the declarations of a and b are not visible (eg in a closed .hpp file), if they are visible it puts f inside the declaration of b. Compare the symbols pane entrys for the definitions of f() and g() in the attached. I don't think you got what I meant. I'm not talking about what you see in the symbol list, I'm talking about how the tags get parsed. Of course the symbol list shows something like A::B::C if A and B are not declared, but that's just because symbol C has scope A::B and we display the scope if we can't display the actual parent. OK, maybe I could take a look at how the C++ parser parses A::B::C, maybe they have a better solution; but what I'm saying is that the parser first reads identifiers A, B and C and put them in a single string (with a separator of course) as if it was the identifier itself, and splits it back later in A::B and C and uses the first as an additional scope and the last as the symbol name. This means that if the separator token (:: in the example) can appear in a legitimate, non-scoped identifier, it'd break. And the code is quite ugly since it first packs to later unpack. A nicer approach would perhaps be to have a separation between blocks and scope, e.g. a stack of blocks each accepting a multi-level scope, instead of assuming block level == scope level. Something like: struct Block { char *scope[]; struct Block children[]; } thus the code: namespace Foo {} class Foo::Bar { class Baz {} } method Foo::Bar::something {} would give: Block root = { .scope = {} .children = { { .scope = { Foo } .children = {} }, { .scope = { Foo, Bar }, .children = { { .scope = { Baz }, .children = {} } } }, { .scope = { Foo, Bar, something }, .children = {} } } } Of course in practice we only need one block (with parents) at a time, so we could simply use a two-dimensional array instead of such a complex tree. E.g. hierarchy inside class Baz would be: { { Foo, Bar }, { Baz } } but if it was written like: namespace Foo { class Bar { class Baz {} } } the hierarchy would've been { { Foo }, { Bar }, { Baz } } e.g. classic, where each block level corresponds to only one scope -- like it is now. But again, I'm only talking about how the parser is written. I'm not a rubyist but I assume that Foo doesn't need to be declared before Bar in the above example and thats the problem. From the C++ example what you would need to do is autodeclare Foo (as what?) so you had somewhere to put Bar. Nope, basic test shows that Ruby wants the levels to be declared, so there is no need for auto-declaration. However I think Vala's namespaces needs the feature, e.g. the following: namespace Foo.Bar {} declares both namespaces Foo and Foo::Bar for that scope, and class Foo.Bar () {} declares namespace Foo and class Foo::Bar. as a single tag name (Foo.Bar) and tuning the code registering the tag to split this on the last ., putting the left part (if any) in the scope. Patch attached. This is quite dirty, but works fine unless a legitimate tag may include a . in its name, which doesn't seem the case currently looking at the parser. Note that Ruby isn't the only language that allows such kind of scoping. For example,
Re: [Geany] Scoped Ruby declarations, with a hackish patch
[...] OK, maybe I could take a look at how the C++ parser parses A::B::C, maybe they have a better solution; but what I'm saying is that the Yeah, without much knowledge of Ruby or Vala I was just suggesting that C++ *seemed* to work different so it might be worth a look despite the convolutions of c.c. Cheers Lex [...] PS my quick look says c.c might use the same implementation as you did, but I'm not sure, and am not going to try to follow the spaghetti further ;) ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
[Geany] setting up 'plaintext' file type
Hi, I've been using geany for a couple months and really like it as my nedit replacement, but I'm running into an annoying problem that I'm not sure how to resolve. I maintain a running notes file in my public_html directory, its extension is one of our invisible php includes but I don't want the file syntax-highlighting as a php file, I want to be able to create a plaintext file type that I can select that has basically no formatting whatsoever. Unfortunately, nothing I've tried so far seems to work, if there are tags like ? etc in the file they trigger these really visually annoying blue underline marks on every line for the rest of the file. If I leave the file as php, most of it gets formatted as string code due to single and double quotes and that also makes it hard to read. I would really love to be able to set up some kind of config that just treats the text as simple plaintext, plain white or whatever colour text on a nice black background. Any help would be much appreciated! Thanks! Miranda ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] setting up 'plaintext' file type
On 7 September 2012 12:50, Miranda Hawarden-Ogata hawar...@ifa.hawaii.edu wrote: Hi, I've been using geany for a couple months and really like it as my nedit replacement, but I'm running into an annoying problem that I'm not sure how to resolve. I maintain a running notes file in my public_html directory, its extension is one of our invisible php includes but I don't want the file syntax-highlighting as a php file, I want to be able to create a plaintext file type that I can select that has basically no formatting whatsoever. If the extension you use doesn't apply to anything you want highlighted then you can take it out of the filetypes.extensions file so it won't be recognised as a filetype. Otherwise you can set the filetype to none and it should not highlight anything menu-document-set filetype-none Cheers Lex Unfortunately, nothing I've tried so far seems to work, if there are tags like ? etc in the file they trigger these really visually annoying blue underline marks on every line for the rest of the file. If I leave the file as php, most of it gets formatted as string code due to single and double quotes and that also makes it hard to read. I would really love to be able to set up some kind of config that just treats the text as simple plaintext, plain white or whatever colour text on a nice black background. Any help would be much appreciated! Thanks! Miranda ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Re: [Geany] setting up 'plaintext' file type
On 12-09-06 07:50 PM, Miranda Hawarden-Ogata wrote: Hi, I've been using geany for a couple months and really like it as my nedit replacement, but I'm running into an annoying problem that I'm not sure how to resolve. I maintain a running notes file in my public_html directory, its extension is one of our invisible php includes but I don't want the file syntax-highlighting as a php file, I want to be able to create a plaintext file type that I can select that has basically no formatting whatsoever. Unfortunately, nothing I've tried so far seems to work, if there are tags like ? etc in the file they trigger these really visually annoying blue underline marks on every line for the rest of the file. If I leave the file as php, most of it gets formatted as string code due to single and double quotes and that also makes it hard to read. I would really love to be able to set up some kind of config that just treats the text as simple plaintext, plain white or whatever colour text on a nice black background. Any help would be much appreciated! Besides what Lex said, you can also put -*- None -*- as the first line of the file (without quotation marks). That should cause Geany to detect the filetype None and stop doing any type of highlighting. Cheers, Matthew Brush ___ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
[Geany-devel] Scoped Ruby declarations, with a hackish patch
Hi guys, I saw that the ruby parser don't properly generate tags declarations like: class Foo::Bar end which should generate a tag Bar with the scope Foo; but it generates a tag Foo and simply ignores Bar. This seems to apply to modules, classes and methods at least -- almost everything. So I wanted to fix that. Unfortunately the scoping code in CTags don't really support to easily put several scopes at the same level, e.g. if you want to push several scope you gotta handle the popping yourself. And since there is one single block end, it's tricky to do. Since I was way too lazy (and didn't even found a good implementation) to fix that, I just did it the dirty way: reading the whole Foo::Bar as a single tag name (Foo.Bar) and tuning the code registering the tag to split this on the last ., putting the left part (if any) in the scope. Patch attached. This is quite dirty, but works fine unless a legitimate tag may include a . in its name, which doesn't seem the case currently looking at the parser. Note that Ruby isn't the only language that allows such kind of scoping. For example, Vala allows to prefix stuff with a namespace -- and there is the same problem here. So, especially Nick, what do you guys think of this? Is this patch too dirty? Do somebody have a better idea? Or is this too dirty and we don't care because nobody writes ruby anyway? In one word: opinions? Thanks, Colomban From f0da754670cca4d4c3ddd0c8d7295881372ba3b6 Mon Sep 17 00:00:00 2001 From: Colomban Wendling b...@herbesfolles.org Date: Thu, 6 Sep 2012 20:45:57 +0200 Subject: [PATCH] Correctly parse Ruby declarations with inline scoping Generate the appropriate tags for declarations like: class Foo::Bar::Baz end The implementation here is quite hackish but works fairly reliably. --- tagmanager/ctags/ruby.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/tagmanager/ctags/ruby.c b/tagmanager/ctags/ruby.c index a614eb1..c7695ef 100644 --- a/tagmanager/ctags/ruby.c +++ b/tagmanager/ctags/ruby.c @@ -132,11 +132,26 @@ static void emitRubyTag (vString* name, rubyKind kind) { tagEntryInfo tag; vString* scope; + const char *this_name; vStringTerminate (name); scope = stringListToScope (nesting); - initTagEntry (tag, vStringValue (name)); + /* extract scope and actual name from tag name in case of tags like + * class Foo::Bar::Baz which are parsed as a single name, Foo.Bar.Baz */ + this_name = strrchr (vStringValue (name), '.'); + if (this_name) + { + if (vStringLength (scope) 0) + vStringPut (scope, '.'); + vStringNCat (scope, name, this_name - vStringValue (name)); + vStringTerminate (scope); + this_name ++; + } + else + this_name = vStringValue (name); + + initTagEntry (tag, this_name); if (vStringLength (scope) 0) { tag.extensionFields.scope [0] = class; tag.extensionFields.scope [1] = vStringValue (scope); @@ -230,7 +245,26 @@ static void readAndEmitTag (const unsigned char** cp, rubyKind expected_kind) if (isspace (**cp)) { vString *name = vStringNew (); - rubyKind actual_kind = parseIdentifier (cp, name, expected_kind); + vString *chunk = vStringNew (); + rubyKind actual_kind; + unsigned int i = 0; + + /* parse the identifier, allowing scoping like class Foo::Bar::Baz */ + while (1) + { + actual_kind = parseIdentifier (cp, chunk, expected_kind); + if (i++ 0) +vStringPut (name, '.'); + vStringCat (name, chunk); + vStringClear (chunk); + + if (actual_kind != K_UNDEFINED (*cp)[0] == ':' (*cp)[1] == ':') +*cp += 2; + else +break; + } + vStringDelete (chunk); + vStringTerminate (name); if (actual_kind == K_UNDEFINED || vStringLength (name) == 0) { -- 1.7.10.4 ___ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel