Hi,
I attached two simple patches that make geany easier to use for me.
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key. Ideally, a pop-up with features for easy file selection using the keyboard (similar to the tag completion in the editor window) would be best but I don't really have experience with GUI programming. The "Files" plugin allows selecting a file by typing but the project I use geany with has sources scattered all over the place (and the open dialogue box doesn't allow fast switching either).
The second patch adjusts the indentation if there is an open bracket on the previous line (similar to emacs but only checks the previous line). This is useful when writing function arguments on multiple lines, multiple conditions in an if statement, lists in Python etc. The indentation is done with spaces rather than a combination of spaces and tabs. I find this more useful since it doesn't break the code alignment if I change the tab width. It doesn't check whether the bracket is inside a string or comment (the existing code doesn't check for a brace inside comment either).
Please feel free to modify them.
Regards.
On 13/12/2007, Catalin Marinas catalin.marinas@gmail.com wrote:
The second patch adjusts the indentation if there is an open bracket on the previous line (similar to emacs but only checks the previous line). This is useful when writing function arguments on multiple lines, multiple conditions in an if statement, lists in Python etc.
I attached an updated version of this patch to take into account braces as well if the language doesn't use them for blocks (this is mainly to do nicer indentation of Python dictionaries).
On Thu, 13 Dec 2007 11:43:53 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
snip The indentation is done with spaces rather than a combination of spaces and tabs. I find this more useful since it doesn't break the
I like this feature and I think we should add it. But before, please change the code so that it respects the document->use_tabs setting. Inserting only spaces is a no go, I prefer to use tabs for indentation. You (and many other people) like to indent only with spaces, therefore there is an option to choose whether to use tabs or not. Your code should take care of this. When not using tabs, simply add only spaces, a mix of tabs and spaces if the user has chosen to use tabs. I didn't have a look at it but get_whitespace() might be useful.
Regards, Enrico
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 13 Dec 2007 11:43:53 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
snip The indentation is done with spaces rather than a combination of spaces and tabs. I find this more useful since it doesn't break the
I like this feature and I think we should add it. But before, please change the code so that it respects the document->use_tabs setting. Inserting only spaces is a no go, I prefer to use tabs for indentation. You (and many other people) like to indent only with spaces, therefore there is an option to choose whether to use tabs or not. Your code should take care of this. When not using tabs, simply add only spaces, a mix of tabs and spaces if the user has chosen to use tabs. I didn't have a look at it but get_whitespace() might be useful.
My comment was probably a bit misleading, I use tabs indentation myself as well.
The patch uses tabs for the first part of the line indentation (it actually copies the previous one). If there is an additional indentation for an open bracket, it uses spaces for the rest of the line.
For example (using dots instead of spaces below and spaces for the corresponding tab), with 4-spaces per tab:
void some_func(void) { if (a == 10 && ....b == 20) {
} }
viewing the code in an editor set to 8 spaces per tab, the "if" conditions are still aligned (I view geany code with 8 spaces per tab and the ifs don't look at nice :-)):
void some_func(void) { if (a == 10 && ....b == 20) {
} }
If I generate a tab instead of spaces on the first editor (with 4 spaces per tab), viewing the code in the second editor would look like below:
void some_func(void) { if (a == 10 && b == 20) {
} }
hence, the "if" conditions are no longer aligned.
While I can argue more about this (emacs also does the wrong thing IMHO), I can probably change the patch to use get_whitespace() or something similar.
On 14/12/2007, Catalin Marinas catalin.marinas@gmail.com wrote:
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 13 Dec 2007 11:43:53 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
snip The indentation is done with spaces rather than a combination of spaces and tabs. I find this more useful since it doesn't break the
I like this feature and I think we should add it. But before, please change the code so that it respects the document->use_tabs setting. Inserting only spaces is a no go, I prefer to use tabs for indentation. You (and many other people) like to indent only with spaces, therefore there is an option to choose whether to use tabs or not. Your code should take care of this. When not using tabs, simply add only spaces, a mix of tabs and spaces if the user has chosen to use tabs. I didn't have a look at it but get_whitespace() might be useful.
My comment was probably a bit misleading, I use tabs indentation myself as well.
The patch uses tabs for the first part of the line indentation (it actually copies the previous one). If there is an additional indentation for an open bracket, it uses spaces for the rest of the line.
For example (using dots instead of spaces below and spaces for the corresponding tab), with 4-spaces per tab:
void some_func(void) { if (a == 10 && ....b == 20) {
}
}
viewing the code in an editor set to 8 spaces per tab, the "if" conditions are still aligned (I view geany code with 8 spaces per tab and the ifs don't look at nice :-)):
void some_func(void) { if (a == 10 && ....b == 20) {
}
}
Just ignore this patch for now, it needs a bit more thinking. In the case above, if the brace is at the same line with "if", it indents like below:
void some_func(void) { if (a == 10 && ....b == 20) { .... some code; } }
Using tabs wouldn't help either as in the case above (8 spaces/tab) it would use spaces anyway.
A solution would be to detect when the block finished but this would mean parsing more than one previous line for the start of the block at every new line inserted (is this an expensive operation in geany?).
It might be better to have a more generic solution to always parse to the beginning of the block, including blocks delimited by braces for some languages.
On Mon, 17 Dec 2007 15:27:17 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
On 14/12/2007, Catalin Marinas catalin.marinas@gmail.com wrote:
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 13 Dec 2007 11:43:53 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
snip The indentation is done with spaces rather than a combination of spaces and tabs. I find this more useful since it doesn't break the
I like this feature and I think we should add it. But before, please change the code so that it respects the document->use_tabs setting. Inserting only spaces is a no go, I prefer to use tabs for indentation. You (and many other people) like to indent only with spaces, therefore there is an option to choose whether to use tabs or not. Your code should take care of this. When not using tabs, simply add only spaces, a mix of tabs and spaces if the user has chosen to use tabs. I didn't have a look at it but get_whitespace() might be useful.
My comment was probably a bit misleading, I use tabs indentation myself as well.
The patch uses tabs for the first part of the line indentation (it actually copies the previous one). If there is an additional indentation for an open bracket, it uses spaces for the rest of the line.
For example (using dots instead of spaces below and spaces for the corresponding tab), with 4-spaces per tab:
void some_func(void) { if (a == 10 && ....b == 20) {
}
}
viewing the code in an editor set to 8 spaces per tab, the "if" conditions are still aligned (I view geany code with 8 spaces per tab and the ifs don't look at nice :-)):
void some_func(void) { if (a == 10 && ....b == 20) {
}
}
Just ignore this patch for now, it needs a bit more thinking. In the case above, if the brace is at the same line with "if", it indents like below:
void some_func(void) { if (a == 10 && ....b == 20) { .... some code; } }
Using tabs wouldn't help either as in the case above (8 spaces/tab) it would use spaces anyway.
A solution would be to detect when the block finished but this would mean parsing more than one previous line for the start of the block at every new line inserted (is this an expensive operation in geany?).
Depends on many lines you check ;-). But maybe editor.c's brace_match() helps.
I won't work on this. If you find a reasonable solution, just post it and we can think about it.
Regards, Enrico
On Thu, 13 Dec 2007 11:31:33 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
Hi,
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes
Alt-Home and Alt-End are already used by Scintilla, see http://geany.uvena.de/manual/index.html#scintilla-keyboard-commands.
really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key. Ideally, a pop-up with features for easy file selection using the keyboard (similar to the tag completion in the editor window) would be best but
Try pressing the Menu key(the key left to the right Ctrl key on Windows keyboards) or if you don't have it, use Shift-F10. Both are default GTK keybindings. You can also change this keybinding in your ~/.gtkrc-2.0 by adding something like this: binding "CallPopupMenu" { bind "<Shift>F11" { "popup-menu" () } } class "GtkNotebook" binding "CallPopupMenu"
Regards, Enrico
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 13 Dec 2007 11:31:33 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes
Alt-Home and Alt-End are already used by Scintilla, see http://geany.uvena.de/manual/index.html#scintilla-keyboard-commands.
I didn't know but what does "Go to start of display line" do for Alt-Home (I would have to re-compile Geany to find out :-)). It sounds similar to what simple Home does.
really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key. Ideally, a pop-up with features for easy file selection using the keyboard (similar to the tag completion in the editor window) would be best but
Try pressing the Menu key(the key left to the right Ctrl key on Windows keyboards) or if you don't have it, use Shift-F10.
I do this already but with 30-40 files opened, the list gets pretty big and is unsorted, making it difficult to quickly find a file. To be easier, I added the "move tab first/last" key bindings so that I keep the files I need mostly at the beginning. I open many of the files just to look at the code rather than editing them and use the find tag commands (the Linux kernel is pretty big).
Regards.
On Fri, 14 Dec 2007 16:15:47 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Thu, 13 Dec 2007 11:31:33 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes
Alt-Home and Alt-End are already used by Scintilla, see http://geany.uvena.de/manual/index.html#scintilla-keyboard-commands.
I didn't know but what does "Go to start of display line" do for Alt-Home (I would have to re-compile Geany to find out :-)). It sounds
Er, why?
similar to what simple Home does.
Similar but not the same. Alt-Home is a dumb Home ;-). To be more exactly, pressing Home puts the cursor at the first non-whitespace character. When pressing it again, it puts the cursor to the very first column of the line. Alt-Home always put the cursor at the very first column.
really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key. Ideally, a pop-up with features for easy file selection using the keyboard (similar to the tag completion in the editor window) would be best but
Try pressing the Menu key(the key left to the right Ctrl key on Windows keyboards) or if you don't have it, use Shift-F10.
I do this already but with 30-40 files opened, the list gets pretty big and is unsorted, making it difficult to quickly find a file. To be easier, I added the "move tab first/last" key bindings so that I keep the files I need mostly at the beginning. I open many of the files
Ok I got it. Choose two unused keybindings and we go ahead.
Regards, Enrico
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Fri, 14 Dec 2007 16:15:47 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
I do this already but with 30-40 files opened, the list gets pretty big and is unsorted, making it difficult to quickly find a file. To be easier, I added the "move tab first/last" key bindings so that I keep the files I need mostly at the beginning. I open many of the files
Ok I got it. Choose two unused keybindings and we go ahead.
What about:
Alt-Ins and Alt-Del
or
Alt-Shift-PgUp and Alt-Shift-PgDn
or
Alt-Ctrl-PgUp and Alt-Ctrl-PgDn
Any preference? I'm more inclined to the second but no strong preference.
On Fri, 14 Dec 2007 17:00:40 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Fri, 14 Dec 2007 16:15:47 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
I do this already but with 30-40 files opened, the list gets pretty big and is unsorted, making it difficult to quickly find a file. To be easier, I added the "move tab first/last" key bindings so that I keep the files I need mostly at the beginning. I open many of the files
Ok I got it. Choose two unused keybindings and we go ahead.
What about:
Alt-Ins and Alt-Del
At least Xfce users would be disapointed by these because Alt-Delete removes a workspace, Alt-Insert adds one. Removing whole workspaces unintentionally can be annoying ;-).
Alt-Shift-PgUp and Alt-Shift-PgDn
Alt-Shift-PgDn hides the current window on Xfce.
Alt-Ctrl-PgUp and Alt-Ctrl-PgDn
Alt-Ctrl-PgDn switches to the next workspace on Xfce.
Any preference? I'm more inclined to the second but no strong preference.
I'm not sure whether and how other window managers use the above suggestions but at least xfwm4(window manager of Xfce) uses the above ones. I added the actions but let them undefined by default (SVN r2104). So, anyone who wants to use them can bind them to any key combos he likes.
Regards, Enrico
On 16/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Fri, 14 Dec 2007 17:00:40 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
On 14/12/2007, Enrico Tröger enrico.troeger@uvena.de wrote:
On Fri, 14 Dec 2007 16:15:47 +0000, "Catalin Marinas" catalin.marinas@gmail.com wrote:
I do this already but with 30-40 files opened, the list gets pretty big and is unsorted, making it difficult to quickly find a file. To be easier, I added the "move tab first/last" key bindings so that I keep the files I need mostly at the beginning. I open many of the files
Ok I got it. Choose two unused keybindings and we go ahead.
I added the actions but let them undefined by default (SVN r2104). So, anyone who wants to use them can bind them to any key combos he likes.
Great, thanks.
Hello,
The genaylua plugin doesn't want to compile with svn 2106. This error appears many times:
lua_doc.c:26: error: ‘GeanyData’ has no member named ‘document’
I've compiled it several times before without a problem. Am I doing something wrong or has something changed?
Thanks
Steve
On Dec 20, 2007 11:31 AM, Steve steve@trinidadgraphics.com wrote:
Hello,
The genaylua plugin doesn't want to compile with svn 2106. This error appears many times:
lua_doc.c:26: error: 'GeanyData' has no member named 'document'
I've compiled it several times before without a problem. Am I doing something wrong or has something changed?
Something has changed - for each time you see this error, you need to change 'document' to 'documents' in the genaylua sources.
( There are a couple of #define's in geanylua.h that also reference the geany_data->document. Fixing these will eliminate several errors.)
If you still can't get it working, let me know, and I'll send you a patch.
I am currently converting the geanylua makefile over to use autotools, which is turning out to be some work. I plan to release an updated version as soon as I get that working.
- Jeff
On Thu, 20 Dec 2007 17:38:58 -0600 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
On Dec 20, 2007 11:31 AM, Steve steve@trinidadgraphics.com wrote:
Hello,
The genaylua plugin doesn't want to compile with svn 2106. This error appears many times:
lua_doc.c:26: error: 'GeanyData' has no member named 'document'
I've compiled it several times before without a problem. Am I doing something wrong or has something changed?
Something has changed - for each time you see this error, you need to change 'document' to 'documents' in the genaylua sources.
( There are a couple of #define's in geanylua.h that also reference the geany_data->document. Fixing these will eliminate several errors.)
That did the trick. Thanks. The plugin is great, by the way.
Regards,
Steve
On Dec 20, 2007 7:56 PM, Steve steve@trinidadgraphics.com wrote:
That did the trick. Thanks. The plugin is great, by the way.
Thanks - it's nice to know somebody is actually using it :-)
- Jeff
On Fri, 21 Dec 2007 02:07:01 -0600 "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
On Dec 20, 2007 7:56 PM, Steve steve@trinidadgraphics.com wrote:
That did the trick. Thanks. The plugin is great, by the way.
Thanks - it's nice to know somebody is actually using it :-)
- Jeff
Every day.
Steve
On Thu, 20 Dec 2007 17:38:58 -0600, "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
On Dec 20, 2007 11:31 AM, Steve steve@trinidadgraphics.com wrote:
Hello,
The genaylua plugin doesn't want to compile with svn 2106. This error appears many times:
lua_doc.c:26: error: 'GeanyData' has no member named 'document'
I've compiled it several times before without a problem. Am I doing something wrong or has something changed?
Something has changed - for each time you see this error, you need to change 'document' to 'documents' in the genaylua sources.
( There are a couple of #define's in geanylua.h that also reference the geany_data->document. Fixing these will eliminate several errors.)
This is because we had to change some field names in the plugin API. To avoid future problems it's probably a good idea to use the macros in plugins/pluginmacros.h.
Regards, Enrico
On Dec 21, 2007 4:32 AM, Enrico Tröger enrico.troeger@uvena.de wrote:
To avoid future problems it's probably a good idea to use the macros in plugins/pluginmacros.h.
Okay, I am converting geanylua over to use the "pluginmacros.h" file, but I see something that looks a little bit strange:
src/document.h:71 extern GArray *doc_array;
plugins/pluginmacros.h:31 #define doc_array geany_data->doc_array
- Jeff
On Mon, 24 Dec 2007 11:24:46 -0600, "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
On Dec 21, 2007 4:32 AM, Enrico Tröger enrico.troeger@uvena.de wrote:
To avoid future problems it's probably a good idea to use the macros in plugins/pluginmacros.h.
Okay, I am converting geanylua over to use the "pluginmacros.h" file, but I see something that looks a little bit strange:
src/document.h:71 extern GArray *doc_array; plugins/pluginmacros.h:31 #define doc_array geany_data->doc_array
Plugins don't have direct access to the doc_array of document.h (except they "fetch" the pointer explicitly). But plugins can acces the doc_array via the geany_data structure and therefore the doc_array macro exists. Without the macro there will be many undefined references to doc_array because the doc_array from document.h isn't available for plugins.
Maybe it is a bit confusing because of the same names for the variable, field name and the macro but it works ;-).
Regards, Enrico
On Thu, 13 Dec 2007 11:31:33 +0000 "Catalin Marinas" catalin.marinas@gmail.com wrote:
[...]
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key.
Thanks, great idea. Although is it me or are they the wrong way round?
Regards, Nick
On Fri, 21 Dec 2007 17:42:07 +0000, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Thu, 13 Dec 2007 11:31:33 +0000 "Catalin Marinas" catalin.marinas@gmail.com wrote:
[...]
The first one is support for "move document first/last" via <Alt>-Home and <Alt>-End. I end up opening tens of files and navigation becomes really difficult (and I don't like using the mouse). With these key bindings, I can easily move tabs I use most often to the beginning and quickly switch between them with the context menu key.
Thanks, great idea. Although is it me or are they the wrong way round?
Yes they are. I added support for the left to right tab order setting and while testing it I confused myself. After rethinking where the start and end should be, I changed the code and now it should be correct.
Regards, Enrico