Re: [Geany-Devel] Smart tabs
On 17 July 2013 16:53, Thomas Martitz thomas.mart...@student.htw-berlin.dewrote: Am 17.07.2013 00:49, schrieb Thrawn: Thomas Martitz wrote: Bah, this everything must be a plugin really annoys me... What's wrong with you accepting new code in the core? Actually, I agree that custom indentation schemes are too troublesome to include in core... unless someone, somehow, has a spark of genius allowing them to invent a perfect one-scheme-fits-all approach. This idea - particularly the Lua script - is far from that. I didn't mean to suggest there is a one-scheme-fits-all solution. The core can totally have customizations to a generic algorithm (or even custom algorithms) on a per-language basis. What I question is the enforcement (I perceive it as such) to introduce all new functionality via (perhaps unreliable) plugins even if essential core features (indentation is clearly one of them) are concerned. There seems little, if any, consideration whether new stuff should go into the core or plugins. The plugin approach is the default and it seems hard to improve the core. Hi Thomas, There are two questions: 1. Should a general solution to language specific indentation go in core, most definitely yes, when we know what that is !!! So far such a solution has not been found, Colomban's regex prototype was closest but still had a high proportion of incorrect results leading to the conclusion that the approach was not capable enough. Implementing a bad approach in core and then having to try to fix/expand or replace it is just a waste of time. So as I said trying out indentation schemes in plugins makes it easier to replace them (but the user can always still use the old one if they like it better, they can't do that with in-core code that has been removed). There is a PR that demonstrates that plugins can be autoloaded by filetypes, so each plugin only needs to do one language, making them simpler and easier to get right. Then it will be possible to identify commonality that is suitable for implementing in core. 2. Should this particular function Thrawn is offering be in core? Since it is limited to one situation in one language (or group of {} languages) and he wants to implement it in Lua, no. Plugins are nice, but still not ideal. The authors might not be dependable, the code quality can be bad, they are not automatically loaded (which is I guess the point of them, however it means that users cannot not be automatically exposed to new functionality) and there's non-zero overhead in both memory usage and performance. The first two obviously don't apply for plugins that ship with Geany. Now that you mention it, there is probably no reason why we could not default enable some of the plugins shipped with geany, its just having the settings in the default config file. And possibly some more plugins could move to core (+1 for Enrico's Addons TODO for example :) Note that it is probable that Geany core could provide some more support for plugin indentation, but as yet nobody is sure what that consists of. Cheers Lex Best regards. __**_ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://lists.geany.org/cgi-bin/mailman/listinfo/devel ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Re: [Geany-Devel] Smart tabs
I haven't been following all of the details of the whole conversation, but I just wanted to throw in my two cents: I like how geany already keeps the indentation of the previous line and unindents with a single backspace independent of if the file is using tabs or spaces. Any custom formatting-as-you-go I hope is only enable-able, perhaps that's why it would be best suited as a plugin. Weather that plugin is in the core plugins or geany-plugins doesn't matter to me. One of the reasons I like geany is because its editing consistently across the different languages. I don't particularly like tools that automatically fix indentation as I type on curly braces or whatever. Also, most IDEs and editors can fit into two groups: full feature that can be stripped down, simple with enable-able features. I think of geany as the latter. I much prefer enabling plugins and features as I learn them or want them, rather than having more things pre-enabled as Lex suggests below. Anyway, that's just my food for thought. Thanks, Steve On 07/17/2013 02:01 AM, Lex Trotman wrote: On 17 July 2013 16:53, Thomas Martitz thomas.mart...@student.htw-berlin.de mailto:thomas.mart...@student.htw-berlin.de wrote: Am 17.07.2013 00:49, schrieb Thrawn: Thomas Martitz wrote: Bah, this everything must be a plugin really annoys me... What's wrong with you accepting new code in the core? Actually, I agree that custom indentation schemes are too troublesome to include in core... unless someone, somehow, has a spark of genius allowing them to invent a perfect one-scheme-fits-all approach. This idea - particularly the Lua script - is far from that. I didn't mean to suggest there is a one-scheme-fits-all solution. The core can totally have customizations to a generic algorithm (or even custom algorithms) on a per-language basis. What I question is the enforcement (I perceive it as such) to introduce all new functionality via (perhaps unreliable) plugins even if essential core features (indentation is clearly one of them) are concerned. There seems little, if any, consideration whether new stuff should go into the core or plugins. The plugin approach is the default and it seems hard to improve the core. Hi Thomas, There are two questions: 1. Should a general solution to language specific indentation go in core, most definitely yes, when we know what that is !!! So far such a solution has not been found, Colomban's regex prototype was closest but still had a high proportion of incorrect results leading to the conclusion that the approach was not capable enough. Implementing a bad approach in core and then having to try to fix/expand or replace it is just a waste of time. So as I said trying out indentation schemes in plugins makes it easier to replace them (but the user can always still use the old one if they like it better, they can't do that with in-core code that has been removed). There is a PR that demonstrates that plugins can be autoloaded by filetypes, so each plugin only needs to do one language, making them simpler and easier to get right. Then it will be possible to identify commonality that is suitable for implementing in core. 2. Should this particular function Thrawn is offering be in core? Since it is limited to one situation in one language (or group of {} languages) and he wants to implement it in Lua, no. Plugins are nice, but still not ideal. The authors might not be dependable, the code quality can be bad, they are not automatically loaded (which is I guess the point of them, however it means that users cannot not be automatically exposed to new functionality) and there's non-zero overhead in both memory usage and performance. The first two obviously don't apply for plugins that ship with Geany. Now that you mention it, there is probably no reason why we could not default enable some of the plugins shipped with geany, its just having the settings in the default config file. And possibly some more plugins could move to core (+1 for Enrico's Addons TODO for example :) Note that it is probable that Geany core could provide some more support for plugin indentation, but as yet nobody is sure what that consists of. Cheers Lex Best regards. ___ Devel mailing list Devel@lists.geany.org mailto:Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Re: [Geany-Devel] Smart tabs
On 16 July 2013 15:45, Thomas Martitz thomas.mart...@student.htw-berlin.dewrote: Am 16.07.2013 03:02, schrieb Lex Trotman: 2) There has been much discussion on the ML and several actual prototypes of improved indentation/alignment schemes that are flexible enough to address many languages (even just many C style languages is a hard problem). None of them have been sufficiently correct, enough of the time, to overcome the problems of being really annoying when they are incorrect. Therefore anything would have to be a plugin so that it can simply not be loaded if the user didn't want it. Also it would need to only operate when the correct language was being edited. Bah, this everything must be a plugin really annoys me. Indentation is really a core feature, whether smart or not, and is nowhere extra functionality provided by external code and authors. g-p has also shown that finding motivated plugin authors that maintain their stuff beyond the initial code drop is hard, so we should really not rely too much on plugins. Plugins can be part of the main Geany distribution too, like splitwindow and filebrowser, so thats not an argument against implementing in Geany or in a plugin. Implementing as a plugin also allows the use of languages other than C eg Lua as Thrawn proposed. Indentation schemes are very specific to languages and styles, it is not a simple single capability that can be designed, coded and forgotten. There have been several attempts at providing configurable approaches to indentation, including one by Colomban. But those could not cover even the simple algorithm that Thrawn proposes. A plugin for something like indentation allows people to replace it if they don't like what is provided, using Lua or Python if they like, or in C/C++. Code inside Geany can't so easily be replaced. The alternative is to hard code various schemes for each supported language, but somebody has to do it, and, as you say, maintain it. What's wrong with you accepting new code in the core? Nothing, but there are several reasons *not* to shove the first indentation scheme that is coded into core. Start with a plugin, if it produces a good result then it can be included in core. Cheers Lex PS @Thrawn, one thing that I neglected to mention was that you probably noted that Emacs indentations depend on a syntactic evaluation of the code to guide their operation. See http://www.gnu.org/software/emacs/manual/html_node/ccmode/Indentation-Engine-Basics.html#Indentation-Engine-Basics Adding such analysis could be a big job but in my experience Emacs does produce a reasonable result. Best regards. __**_ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-**bin/mailman/listinfo/develhttps://lists.geany.org/cgi-bin/mailman/listinfo/devel ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Re: [Geany-Devel] Smart tabs
On 16 July 2013 08:09, Thrawn shell_layer-ge...@yahoo.com.au wrote: Hi, folks. I recently came across some articles on the Emacs wiki about spaces vs tabs: http://www.emacswiki.org/emacs/SmartTabs http://www.emacswiki.org/emacs/TabsAreEvil Their argument is that tabs should be used for indentation, while spaces should be used to align text when a long line is split. Makes sense to me. Thats one style, if you *must* use tabs then its probably the best one, since it stays aligned no matter what size a tab is considered to be. Better just not to use tabs of course, you don't actually save much in the default case of 4 spaces per tab. But I understand that editing old code would have to conform to its standard. Is there, or should there be, support for this idea in Geany (or more likely in a plugin)? Probably this would not be suitable for Python, of course, but it works for C-style languages. 1) No there isn't, probably there should be, but... 2) There has been much discussion on the ML and several actual prototypes of improved indentation/alignment schemes that are flexible enough to address many languages (even just many C style languages is a hard problem). None of them have been sufficiently correct, enough of the time, to overcome the problems of being really annoying when they are incorrect. Therefore anything would have to be a plugin so that it can simply not be loaded if the user didn't want it. Also it would need to only operate when the correct language was being edited. 3) But there is no way to tell Geany to not apply indentation per file, so Geany will still do its thing independent of the plugin (and that includes moving } not just on enter). 4) So the plugin would have to keep changing the indentation settings in Geany to turn off Geany indentation as the user changed to/from a tab containing a C file to one containing some other language, but would somehow have to ensure that the right value is saved in the config file (not sure this is possible). I could probably write a Lua script that would split a long line using this idea: same number of tabs as the original, then spaces to align the new line with the last bracket on the previous one. Maybe bound to Shift+Enter. Splitting a line on user command is certainly an easier way to do it, I assume you mean last *unmatched* bracket on the line (that is not in a string or comment). Oh and don't forget C++ uses as brackets for templates, but don't confuse that with the places it uses them for gt and lt :) Finally plugins should *not* bind keys by default, they have no way of knowing if the user has already bound that key to something else (and of course multiple plugins binding the same key :). Cheers Lex Any thoughts? Thrawn ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel ___ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel