Dear Geany devs,
Some time ago I received the attached patch though this list (from
Enrico?). I really love the added functionality to prevent duplicate
automatically added quotes and brackets.
Can this be added to Geany itself? Ideally this would be activated
with a checkbox in prefs > editor > completions.
I attach three patches:
1. Keybindings to insert new line after/before current
2. Snippet keybindings support
3. Automatically insert additional indentation in XML/HTML files if
previous line ends with an opening tag
They must be unrelated and can be applied independently of each other.
Some of the patches have drawbacks. Before "polishing" them, I want to
know whether they are useful and may go to trunk.
The drawback of the first patch is that I doubt it's so useful. I know
Vi[m] provides shortcuts for these actions ('o' and 'O' in normal
mode), but their necessity is questionable for me. I implemented this
to ease XML editing with tag autocompletion turned on. Suppose you
need to write to consequent <li>'s. Without this patch you need to
press End+Enter after writing the first <li> to place the cursor where
you need to start the second. With my patch, you only need to press
one shortcut you can assign in Preferences > Keybindings :)
The drawback of the third patch is that it's not completed. If user
likes to leave HTML tags like <br> "unclosed", she would be disturbed by
automatic indentation caused by my patch, so a check box in Preferences
is desirable. I'll code it as soon as we decide this patch can go to
Speaking about the second patch, here is an example of assigning a
keybinding (I currently use it in my user snippets.conf):
# special group to define keybindings
# keybindings' format resembles the one used in Preferences >
# Keybindings tab
Keybindings may be assigned either in user or global snippets.conf (I'm
not sure if the latter is useful). Another decision I made is to allow
keybindings for snippets in [Special] section (like "block_cursor" used
above). While "block_cursor" snippet is not very useful when you have
to type its name, it is useful when you just have to press a shortcut.
And, as usual for me, all of these patches lack user documentation…
I've found one more issue with Geany's "Safe file saving" option. When using g_file_set_contents(), file ownership and permissions are replaced with those for a new file. That fully conforms to GLib documentation (http://library.gnome.org/devel/glib/unstable/glib-File-Utilities.html#g-fil…), but is not good sometimes (e.g. editing an executable script file).
I propose to use GIO API (GFile) instead of g_file_set_contents; the patch is attached. This solution, however, raises some questions:
- It does work for my system (Ubuntu 9.10), but will it work for others, especially Windows? It seems that GIO is also available on Win32, but it requires some testing
- This cannot be named "Safe" file saving, as it does not create a backup first (we can call g_file_replace_contents with make_backup = TRUE, but it would not delete this backup file when the operation completes). Maybe there should be some other configuration option to use (or not to use) this setting? Or should I replace "unsafe" file saving with GIO functions instead of replacing "safe"?
Or even more - make this option work like in GEdit (which, I suppose, uses g_file_replace_contents for both cases, with make_backup=TRUE in "safe" case), adding the corresponding checkbox to preferences dialog?
What do you think?
Sorry for reposting this message but i just realized i didn't include
the "[PATCH]" prefix in the subject of my previous mail to this list, so
the original text follows:
i already searched for this feature, in case someone else was
already working on it or if it simply was a bad idea to implement.
For now, i haven't found anything nor something against it so i
implemented this simple feature, that basically ensure no mixed line
endings control characters (le-cc) will be saved in the document, patch
is attached (i used the latest SVN head, 5089).
Let me explain the use case: i'm currently working on a project where
some of the files contains mixed line endings control characters, ie.,
some lines end with just CR, other with just LF: there is an easy way to
convert everyone of these control charaters to something else via
"Document->Set line endings->Convert and set ..." but this isn't
something i always manage to remember to do and, better, i would like
the editor to take care of that for me.
So this patch add just that: in the "Preferences->Files->Saving files"
dialog i added a checkbox and, if checked, the editor will always
convert any le-cc to the one currently actively on the document via
I also would like to propose a change in the way le-cc are presented to
the user, but i'll do a new post eventually.
This is an alternate implementation of Eugene's X11 session support.
The main difference is that the state each running Geany is saved
into a separate temporary Geany configuration file.
Each Geany is restored exactly it was before the session was closed,
including open files, options (including applied but unsaved),
per-document options (even if no project file is open) etc.
There are no races when saving geany.conf, it's not saved at all. If
you want to save the options, so that the next Geany will use them,
just go to the Geany you want the options from and save them,
exactly as you would do before the session was closed.
Should there be "main" and "option-saving" instances, which ones,
and how should they differ from the "secondary" instances? As Eugene
pointed out, this is not related to the session management, at least
with this SM implementation.
The patch applies against the latest svn-4933. Of course, it should
not be included in 0.19, I only finished it today. Some parts of
Eugene's SM were reverted, since they were not required.
I sent in a patch on April 23rd, but have not received any accept /
reject notice, possibly because I didn't tag it with [patch], so here
it is again. Resolves feature request #2990915 as illustrated here:
When comment_use_indent is set to true in per-filetype config,
comments are no longer indented on a line-by-line basis, but have the
indentation of the least indented line in the block. This looks a lot
In addition, empty lines are commented out by default. In the original
patch, I introduced a new option for it, but Thomas Martitz suggested
that this is not preferable.
I am just curious what the current thought is on compiling with GIO when
The only reason I ask is that it (seems to) solve the GVfs bug issues at
least after I applied Алексей's patch and for me that is really a huge
benefit, but yet I understand the added complexity and maintainability
I was following the other "Safe file saving - permissions issue" thread
but it I couldn't tell if a decision had been reached, and it covered a
few other topics.
p.s. I know all the arguments against FTP, but sometimes my hands are
tied (clients are reluctant to change), despite protest. =)
I have one more feature idea and would like to ask if it is something
that others would like to see too before I start implementing it. I'm
working on a project where everyone expresses his personality by using
different tab width for indenting - I have already seen sources with
tab size of 2, 3, 4, 5, 6 and 8 (it's just a matter of time until I
see a source with tab width 7). Of course, these people (or people who
were editing the same source afterwards) also use spaces so sometimes
it happens that I have e.g. tab size set to 4 but the other file I
edit has tab size 2 and it uses spaces too, so what I see is that the
lines using tab get indented less than the lines using spaces. I
usually ignore it, but sometimes the code is so unreadable that I have
to change the tab size. And this is the problem - with geany you have
to do it either per project or globally, it's not possible for a
single file. So I have to switch it in the project settings, look at
the file, and switch it back again because I return back to a file
with different indent size.
I would propose to have one more entry in the Document menu called
e.g. "Tab size" and placed under "Indent type" with a submenu
containing numbers from 2 to 8 (I hope there is nobody so crazy that
he would use tab for a single char indent or go over 8 characters)
with a radio button selecting the active selection. The user could
change the default tab size of the active document to anything he
wishes. This settings could also be saved into the project/session
file so the files get reloaded with the same tab size settings. What
do you think about this feature?
I have been trying all the top ten Linux distributions (from
distrowatch) for the last couple of weeks since opensuse end of lifed
a version by not just stopping updates, but removing the repositories
Linux Mint (number three on the downloads) has a software rating
system and I noticed that Geany was at the top of the ratings for
programming software, congratulations guys.