Re: paredit+regex question

2014-03-04 Thread Oleh
Hi Erlis,

There's a full alternative to Paredit that I'm writing: 
https://github.com/abo-abo/lispy.
Try it out if you haven't yet, it's got some Clojure support, like inline 
function arguments
and jump-to-defintion (just a binding for cider-jump-to-def, really, but 
it's just one letter: "F").

Here's a Clojure screencast for jump-to-tag functionality (again just one 
letter: "g" or "G"): 
https://vimeo.com/86727658.

The documentation is here: http://abo-abo.github.io/lispy/.
Lispy is in active development, so if you have ideas or issues,
raise them here: https://github.com/abo-abo/lispy/issues?state=open.

Oleh

On Monday, March 3, 2014 10:09:47 PM UTC+1, Erlis Vidal wrote:
>
> Hi this is not a clojure question but I'm sure some one on this list can 
> help me. 
>
> I'm trying to write a regex using paredit and it looks like I cannot write 
> something like this 
>
> #"mypattern \d"
>
> whenever I type the character \ I see the text "Escaping character..." in 
> the minibuffer. It is waiting for another character and then it uses the 
> two characters as a single one, so I cannot delete only one, they are 
> together.
>
> I see how this can be useful for strings, but for regex this is not 
> helping. 
>
> I end up writing my regex like (re-pattern "mypattern \\d") instead of 
> using the short syntax. 
>
> Any idea how can I write the short syntax using paredit? 
>
> Thanks, 
> Erlis 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] lispy.el 0.8: jump to any Clojure tag in current directory screencast

2014-02-17 Thread Oleh
Sure.

1. Setup MELPA:

(package-initialize)
(add-to-list 'package-archives
 '("melpa" . "http://melpa.milkbox.net/packages/";))

2. Install `lispy` from MELPA:

M-x package-install lispy

3. Get `clojure-semantic` from git:

cd ~/git
git clone https://github.com/kototama/clojure-semantic

4. Add to your ~/.emacs:

(add-to-list 'load-path "~/git/clojure-semantic")
(load "~/git/clojure-semantic/clojure.el")

5. Optionally, if you don't want to enable `lispy-mode` manually for each 
file,
you can set it to be on automatically:


(mapc (lambda(h) (add-hook h (lambda() (lispy-mode 1
  '(emacs-lisp-mode-hook
lisp-interaction-mode-hook
clojure-mode-hook
scheme-mode-hook
lisp-mode-hook))

6. Restart Emacs or load manually all the stuff from above and open
some Clojure project. You can call `lispy-goto` with "g" when
the point is in special position and `lispy-mode` is active or you can do 
M-x lispy-goto.
Special position means the point is before ([{ or after )]} or the region 
is active,
you can read more about it at 
https://github.com/abo-abo/lispy#special-positions-and-key-bindings .

You can call `lispy-goto-local` with "G". It will offer the tags just in 
current file, not
in whole directory.

7. Write back to me if this works so I can put up these steps as a tutorial 
somewhere.
If it doesn't work, write anyway and I'll give more details.

Oleh



On Sunday, February 16, 2014 4:28:27 PM UTC+1, Olli Piepponen wrote:
>
> This looks very neat, but I was unable to figure out how to use 
> lispy/clojure-semantic the way you were doing in your screencast. Could you 
> give a breakdown of how this works?
>
> On Saturday, February 15, 2014 4:46:48 AM UTC+7, Oleh wrote:
>>
>> Hi all,
>>
>> As a follow-up to this post - 
>> https://groups.google.com/forum/#!topic/clojure/B7dTW5PDcPM,
>> it's now possible to jump to any Clojure tag in current directory.
>> No project definitions required: CEDET will parse every source file in 
>> current directory.
>> The tags are completed with helm plugin, so it's quite fast to find a 
>> candidate to jump to.
>>
>> As a showcase, I've took this popular Clojure statistics package: 
>> https://github.com/liebke/incanter
>>
>> The screencast is here: https://vimeo.com/86727658.
>>
>> lispy is here: https://github.com/abo-abo/lispy
>> clojure-semantic is here: https://github.com/kototama/clojure-semantic
>>
>> There's currently a bug in clojure-semantic the prevents permanent 
>> storage of parsed tags,
>> maybe someone with some expertise could look into that. 
>> Also, it's generated by a bison-like grammar, so if you know bison (I 
>> don't unfortunately),
>> you could extend clojure-semantic to distinguish stuff like defmacro, 
>> defmulti, defmethod etc.
>>
>> Same functionality is also available for Emacs Lisp, Scheme and Common 
>> Lisp, if you like using
>> anything else besides Clojure:)
>>
>> regards,
>> Oleh
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] lispy.el 0.8: jump to any Clojure tag in current directory screencast

2014-02-14 Thread Oleh
Hi all,

As a follow-up to this post - 
https://groups.google.com/forum/#!topic/clojure/B7dTW5PDcPM,
it's now possible to jump to any Clojure tag in current directory.
No project definitions required: CEDET will parse every source file in 
current directory.
The tags are completed with helm plugin, so it's quite fast to find a 
candidate to jump to.

As a showcase, I've took this popular Clojure statistics package: 
https://github.com/liebke/incanter

The screencast is here: https://vimeo.com/86727658.

lispy is here: https://github.com/abo-abo/lispy
clojure-semantic is here: https://github.com/kototama/clojure-semantic

There's currently a bug in clojure-semantic the prevents permanent storage 
of parsed tags,
maybe someone with some expertise could look into that. 
Also, it's generated by a bison-like grammar, so if you know bison (I don't 
unfortunately),
you could extend clojure-semantic to distinguish stuff like defmacro, 
defmulti, defmethod etc.

Same functionality is also available for Emacs Lisp, Scheme and Common 
Lisp, if you like using
anything else besides Clojure:)

regards,
Oleh

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: lispy.el - a vi-like Paredit. Some Clojure features added.

2014-02-04 Thread Oleh
OK, I've added a second screencast as both video and gif:
https://raw.github.com/abo-abo/lispy/master/doc/screencast-2.ogv
https://raw.github.com/abo-abo/lispy/master/doc/screencast-2.gif

Oleh

On Tuesday, February 4, 2014 7:41:15 AM UTC+1, Benjamin Peter wrote:
>
> Thanks but it is playing way too fast considering you have to monitor two 
> windows. (buffer and keys).

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: lispy.el - a vi-like Paredit. Some Clojure features added.

2014-02-03 Thread Oleh
I've added a screencast at
https://raw.github.com/abo-abo/lispy/master/doc/screencast-1.gif

I'm not experienced with screencasts, so I'm not sure if this one will 
attract people 
or scare them away. In any case, it does cover some of the features in a 
combination.

Oleh



On Monday, February 3, 2014 5:41:09 PM UTC+1, Benjamin Peter wrote:
>
> Hello Oleh,
>
> thank you, this looks cool. Haven't tried such addon yet but this looks 
> inviting.
>
> Bye
>
> Ben.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


lispy.el - a vi-like Paredit. Some Clojure features added.

2014-02-02 Thread Oleh
Hi all,

I've recently added some Clojure support to
https://github.com/abo-abo/lispy.

A short description of the package is that it's all the Paredit
functions (and more) bound to unprefixed keys, e.g. "a", "c", "1", "2"
etc. Nothing to do with evil package. Keys call commands instead
of self-inserting when the point is in positions called special
(marked here with |):

|(defn sqr |[x]| |(* x x)|)|

This comes together nicely since you rarely want to self-insert in those 
positions.

Just to show how succinct the usage can be, you can transform
from this:

|(defn sqr [x] (* x x))

with just "4c" to this:

|(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))

and further with "3j" to this:

(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
|(defn sqr [x] (* x x))
(defn sqr [x] (* x x))

and further with "2;" to this:

(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
;; (defn sqr [x] (* x x))
;; (defn sqr [x] (* x x))

Here's another example that shows how to transform

|(map sqr (filter odd? [1 2 3 4 5]))

to

(->> [1 2 3 4 5]
 (map sqr)
 (filter odd?))|

I show it in a run-able test form (many more tests at github):

(should
 (string=
  (lispy-with
   "|(map sqr (filter odd? [1 2 3 4 5]))" "2(->>]<]<]wwlM")
  "(->> [1 2 3 4 5]\n  (map sqr)\n  (filter odd?))|"))

The steps are:

1. "2(" - wrap with parens. 
2. "->>" - self-insert (because point isn't special).
3. "]" - forward list - point becomes special.
4. "<" - barf.
5. "]<]" - forward, barf, forward.
6. "ww" - move sexp up twice.
7. "l" - exit list forwards.
8. "M" - transform sexp to multi-line.
9. you can "e" - eval to see if code works.

Full description and some screenshots can be found at 
https://github.com/abo-abo/lispy.

Here's a list of Clojure-specific features (cider is used for most):

- look up doc inline in an overlay with "C-1"
- look up function arguments inline with "C-2"
- eval with "e"
- eval and insert with "E"
- goto symbol in file with "g" (clojure-semantic required)
- goto definition with "F"

The package is available in MELPA if you want to give it a go.
Feedback welcome.

regards,
Oleh



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.