After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 107044 - RFE: add hooks for indentation of text
RFE: add hooks for indentation of text
Status: RESOLVED DUPLICATE of bug 736727
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
gedit QA volunteers
: 301456 (view as bug list)
Depends on:
Blocks: 171551
 
 
Reported: 2003-02-25 16:14 UTC by Julien Olivier
Modified: 2016-08-07 14:50 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
IRC conversation on auto indetation (13.18 KB, text/plain)
2005-04-17 20:20 UTC, Paolo Maggi
Details

Description Julien Olivier 2003-02-25 16:14:43 UTC
I'd like my code to be automatically indented. For
example, if I write:

int main()
{
if(TRUE)
printf("test\n");
return(1);
}

Gedit should automatically change it to:

int main()
{
    if(TRUE)
        printf("test\n");
    return(1);
}

That would be even better if gedit could use the
same indentation as
Emacs so that you don't break other people's code
when editing it
(especially when working on CVS projects).
Comment 1 Paolo Maggi 2003-04-13 10:27:37 UTC
Changing product to gtksourceview, since gedit will use it as text widget.
Comment 2 Gustavo Giráldez 2003-04-17 07:11:17 UTC
I don't think this belongs in gtksourceview.  Looks like a perfect
candidate for a gedit plugin, and it should be implemented by default
in glimmer.  But it's too high level for the widget (to start with,
it's language dependent).  We do need to provide good hooks into the
view/buffer to ease its implementation.  Paolo, what do you think?
Comment 3 Paolo Maggi 2005-04-17 20:20:20 UTC
Created attachment 45366 [details]
IRC conversation on auto indetation

I'm attaching this IRC conversation I had with gustavo and tberman on Feb. 21,
2004 since I have just found it on my old PC and I don't want to lose it again.

I think it contains a good proposal for implementing auto indetation in
GtkSourceView.
Comment 4 Jeroen Zwartepoorte 2005-08-05 10:48:43 UTC
We should provide API hooks from which gedit, MonoDevelop and anjuta can hookup
their own indentation code that indents C, C#, Python etc.

GtkSourceView should define a default indentation hook that binds TAB and
SHIFT_TAB to indent a text block with the tab size.
Comment 5 Jeroen Zwartepoorte 2005-08-05 10:51:58 UTC
*** Bug 132824 has been marked as a duplicate of this bug. ***
Comment 6 Jeroen Zwartepoorte 2005-08-05 10:56:27 UTC
*** Bug 307048 has been marked as a duplicate of this bug. ***
Comment 7 Jeroen Zwartepoorte 2005-08-05 14:02:40 UTC
*** Bug 301456 has been marked as a duplicate of this bug. ***
Comment 8 Daniel Brodie 2006-05-08 21:25:08 UTC
Now that gtksourceview is now getting folding ability (and therefore the ability to define what is a 'block') this could possibly be added to gedit based on that feature. If the previous line created a new block, indent; if it closed a block, dedent; if neither, keep indentation.

a little more information on this could be added to the syntax for specifying the code folding for the extra information (should the end code block be dedented or only after etc...)
Comment 9 Jean-Philippe Fleury 2008-12-08 02:27:44 UTC
There's the Gemini Gedit Plugin:

http://www.garyharan.com/index.php/2006/11/16/gemini-gedit-plugin-for-all-those-textmate-fans/

that does a kind of block indentation:

If we type a curly bracket:

{

then a bracket } is automatically added, the cursor between them. By pressing <Return>, we have the cursor ready to type indented code:

{
	Cursor
}
Comment 10 Jeremy Nickurak 2011-06-17 22:05:04 UTC
That link seems to be broken. https://github.com/gmate/gmate/tree/master/plugins/gedit2/gemini is active (thanks jp on irc), but doesn't work with gedit 3.x as far as i can tell.

Anything currently maintained? This makes dev work with gedit pretty much a non-starter here.
Comment 11 Jean-Philippe Fleury 2011-06-18 02:09:54 UTC
@Jeremy: gmate (and so gemini) is being ported to gedit 3. See the following report:

"Make gmate compatible with gedit 3"
https://github.com/gmate/gmate/issues/65
Comment 12 Sébastien Wilmet 2016-08-07 14:50:39 UTC
Bug #736727 has more activity, with some initial patches.

*** This bug has been marked as a duplicate of bug 736727 ***