Hi,
I'd like to be able to use Geany for writing Clojure code, but indentation for Lisps (Clojure, Scheme, and Common Lisp, for example) calls for function args to line up vertically. For example, if my cursor is at the "^" (see below), I'd want to easily get it to "@":
~~~ (+ (some-func 1 2 3)^ @ ~~~
Here's another example:
~~~ (defn foo [x] (foobarbaz x (fn [y] ... (let [a ... b ... ]^ @ ~~~
It seems to me that a fairly simple way to get the cursor to where it's wanted is, in quite a large number of cases, would be:
1. if a close-paren immediately preceeds the cursor, find out how far indented the matching paren is, and indent the next line that far, or
2. if there isn't a close-paren before the cursor, just look back to find the closest open-paren, note how far it's indented, and just indent the next line same.
That is, when your cursor is at the end of a line: instead of hitting Return, you'd hit a key bound to such a command as described above.
Could something like this be implemented as a plug-in?
Thanks, ---John
On 6 June 2012 05:18, John Gabriele jmg3000@gmail.com wrote:
Hi,
I'd like to be able to use Geany for writing Clojure code, but indentation for Lisps (Clojure, Scheme, and Common Lisp, for example) calls for function args to line up vertically. For example, if my cursor is at the "^" (see below), I'd want to easily get it to "@":
(+ (some-func 1 2 3)^ @
Here's another example:
(defn foo [x] (foobarbaz x (fn [y] ... (let [a ... b ... ]^ @
It seems to me that a fairly simple way to get the cursor to where it's wanted is, in quite a large number of cases, would be:
1. if a close-paren immediately preceeds the cursor, find out how far indented the matching paren is, and indent the next line that far, or
2. if there isn't a close-paren before the cursor, just look back to find the closest open-paren, note how far it's indented, and just indent the next line same.
That is, when your cursor is at the end of a line: instead of hitting Return, you'd hit a key bound to such a command as described above.
Could something like this be implemented as a plug-in?
Sure you can just connect to the editor-notify signal, check for char-added is a return and process it how you want then return true to stop the normal indentation happening.
And of course you should check the filetype is lisp before you do anything.
Cheers Lex
Thanks, ---John _______________________________________________ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Wed, Jun 6, 2012 at 8:50 AM, Lex Trotman elextr@gmail.com wrote:
On 6 June 2012 05:18, John Gabriele jmg3000@gmail.com wrote:
Hi,
I'd like to be able to use Geany for writing Clojure code, {snip}
Could something like this be implemented as a plug-in?
Sure you can just connect to the editor-notify signal, check for char-added is a return and process it how you want then return true to stop the normal indentation happening.
Thanks, Lex. I found [the plug-in how-to](http://www.geany.org/manual/reference/howto.html) and will have a look.
And of course you should check the filetype is lisp before you do anything.
Actually, I've gone ahead and created my own Clojure custom filetype (~/.config/geany/filedefs/filetypes.Clojure.conf), which uses the Lisp lexer.
---John
On 7 June 2012 01:28, John Gabriele jmg3000@gmail.com wrote:
On Wed, Jun 6, 2012 at 8:50 AM, Lex Trotman elextr@gmail.com wrote:
On 6 June 2012 05:18, John Gabriele jmg3000@gmail.com wrote:
Hi,
I'd like to be able to use Geany for writing Clojure code, {snip}
Could something like this be implemented as a plug-in?
Sure you can just connect to the editor-notify signal, check for char-added is a return and process it how you want then return true to stop the normal indentation happening.
Thanks, Lex. I found [the plug-in how-to](http://www.geany.org/manual/reference/howto.html) and will have a look.
And of course you should check the filetype is lisp before you do anything.
Actually, I've gone ahead and created my own Clojure custom filetype (~/.config/geany/filedefs/filetypes.Clojure.conf), which uses the Lisp lexer.
Thats ok, but you shouldn't prevent users of other lisps from using your plugin, maybe accept a list of filetypes.
Cheers Lex
---John _______________________________________________ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany