[Geany] idea for Lisp/Scheme/Clojure indentation support (plug-in?)

Lex Trotman elextr at xxxxx
Wed Jun 6 12:50:38 UTC 2012


On 6 June 2012 05:18, John Gabriele <jmg3000 at 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 at uvena.de
> https://lists.uvena.de/cgi-bin/mailman/listinfo/geany



More information about the Users mailing list