Code Monkey home page Code Monkey logo

evil-cleverparens's People

Contributors

andrejlamov avatar bo-tato avatar braham-snyder avatar cmccloud avatar corasaurus-hex avatar frauh0lle avatar jgkamat avatar justbur avatar luxbock avatar madand avatar noctuid avatar nsavch avatar orlandow avatar robbyoconnor avatar syohex avatar tomdl89 avatar yurist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

evil-cleverparens's Issues

Yanking multiple lines

Ran into this today. Example

(when ready
  (let (a b)
    (setq a 1
          b 2)
    (command a b)))

use V to select the last three lines and y. Then moving somewhere else, p gives

(setq a 1
      b 2)
(command a b)))

notice the extra parens. The extra parens are not there if you just yy on the last line

Text objects does not work

As far as I understand - text objects should allow me operate on those objects while using yank/delete/etc operations. But df does not delete a form and non of the other such commands work. Am I missing something?

Some issues with > and <

I've been noticing some odd behavior with > and < in normal state.

  1. Can't barf an expression and end up with an empty sexp. This works fine with >

    (func ([)] (a)) => (func ( (a)[)])
    

    but I can't reverse this operation with <

  2. I've had some issues with the point not staying on the point after a barf or a slurp (sorry I can't come up with a working example right now, but I'll post it as soon as I do)

Insert at beginning of sexp

Hi again, I noticed that if I put the point on the first letter in a sexp and enter insert state cleverparens is adding an extra space between the point and the first letter. Is this intentional? If this doesn't happen for you I'll come up with some steps to reproduce. I'm pretty confident it happens consistently for me.

x/X causes "Wrong type argument: char-or-string-p, nil"

Any time I press x or X (bound to evil-cp-delete-char-or-splice/evil-cp-delete-char-or-splice-backwards, respectively). I get the error "Wrong type argument: char-or-string-p, nil".

I'm using evil-cleverparens with clojure-mode/cider/smartparens-config. This is likely an interaction with some other configuration of mine, however the problem only occurs when evil-cleverparens is enabled, not with any of the other modes alone.

Any tips on how to debug this would be appreciated!

How to move backwards and downwards into previous sexp?

I looked through the documentation and didn't see a way to move backwards and downwards into a sexp: something like paredit-backward-down (C-M-p). Actually, I don't see a command for moving forward and down into a list either: something like paredit-forward-down. I'm thinking this functionality must exist, so perhaps I'm just overlooking it...

Support C-w and DEL

I think it would be a good idea to have a safe equivalent of evil-delete-backward-word, evil-delete-backward-char, etc. One technique would be to do nothing, but there is also the route that lispy takes, which is to delete the entire sexp when deleting at (| or |). I think the latter makes the most sense.

Slightly wrong behavior for evil-cp-forward-sexp and evil-cp-backward-sexp at end of line

Hey, first of all thanks for this package, I think it's great.

I noticed a slightly annoying behavior for evil-cp-forward-sexp and evil-cp-backward-sexp (L and H). Consider this elisp file (| denotes the cursor):

'(|("aaa" . bbb)
  ("ccc" . ddd))

If evil-move-beyond-eol is t, then pressing L once moves the cursor after "bbb)":

'(("aaa" . bbb)|
  ("ccc" . ddd))

From here, I can press either L or H. If I press L:

'(("aaa" . bbb)
  ("ccc" . ddd)|)

Or if I press H:

'(|("aaa" . bbb)
  ("ccc" . ddd))

Which is exactly what I expect to happen, so I consider it a good behavior.

On the other hand, if evil-move-beyond-eol is nil, the behavior is a bit off. Starting from the same place as before:

'(|("aaa" . bbb)
  ("ccc" . ddd))

Pressing L once moves the cursor after "bbb" but before the ")". Because evil-move-beyond-eol is nil, this is the expected behavior (so far so good).

'(("aaa" . bbb|)
  ("ccc" . ddd))

From here, however, pressing either L or H doesn't bring me to where I want. If I press L, the cursor doesn't move at all.
If I press H, the cursor moves in front of "bbb" instead of returning to where it was:

'(("aaa" . |bbb)
  ("ccc" . ddd))

The two problems here are that in this case H doesn't do the reverse of L, and that I can't move forward in the list because of how evil-mode adjusts the cursor.
Will it be possible to modify evil-cp-forward-sexp and evil-cp-backward-sexp for the case where the cursor is on a closing paren and evil-move-beyond-eol is nil? If not,

Change modifier key for evil-cp-additional-bindings?

The documentation for evil-cp-additional-bindings says: "Alist containing additional functionality for evil-cleverparens via a modifier key (using the meta-key by default)." Is it possible to change the modifier key to (say) Alt?

Thanks!

Different style parens are auto-completed wrongly

When the variable evil-cleverparens-complete-parens-in-yanked-region is enabled, yanking a region with unbalanced parens on the right side results in them being auto-completed in the opposite order (see attached gif)

2018-09-11 22 48 52

Form text-object bug

(f ;; (
 'x)

Calling evil-cp-a-form with the point at f results in

Search failed. This means there is unmatched expression somewhere or we are at the beginning/end of file.
evil-cp-a-form: Wrong type argument: number-or-marker-p, nil

Delete operations override 0 (yank register)

Noticed evil-cp-delete-char-or-splice is calling evil-cp--yank which eventually checks

  (when evil-was-yanked-without-register
    (evil-set-register ?0 text)) ; "0 register contains last yanked text

where evil-was-yanked-without-register is t (for some reason).

With evil-cleverparens disabled, on a text of

a
b

yy on line a -> :reg -> a is in the 0 register
dd on line b -> :reg -> a is in the 0 register, b is in the 1 register (and others) (expected)

With evil-cleverparens enabled, with the same text
yy on line a -> :reg -> a is in the 0 register
dd on line b -> : reg -> b has replaced a in the 0 register (unexpected)

'x' hangs emacs in visual state

Best described with a video.

https://dl.dropboxusercontent.com/u/11400324/evilcleverparens.mov

(use-package evil-cleverparens
  :commands (evil-cleverparens-mode)
  :diminish (evil-cleverparens-mode)
  :init
  (setq evil-cleverparens-use-additional-bindings nil)
  (setq evil-cleverparens-use-additional-movement-keys nil)
  (dolist (hook '(lisp-mode-hook
                  emacs-lisp-mode-hook
                  lisp-interaction-mode-hook
                  clojure-mode-hook
                  cider-mode-hook
                  cider-repl-mode-hook))
    (add-hook hook (lambda ()
                     (evil-cleverparens-mode)))))

Separate Text Objects From evil-clever-parens-mode

Since the comment and form text objects work for more than just lisp modes (modes where the user would want evil-cleverparens-mode enabled), it might make sense to pull (evil-cp--enable-text-objects) out of evil-clever-parens-mode and add autoloads for each text object individually (which would also mean that the users could choose a different key for binding them if they wanted). For example, one might want to use the comment text object before ever entering some lisp mode, and currently, the text objects will not be defined/bound until the user has started the evil-cleverparens-mode once.

Please don't rebind keys every time the mode is enabled

Most of the key bindings go into the mode map, which only needs to be populated once. Binding the keys in the mode toggle function means that to change them I either need to manipulate the variables holding the bindings or rebind in a hook, both of which seem unnecessarily complicated. If you just define the keys in the map once, I can just change the binding in the map directly.

Keybindings go crazy in terminal

When running emacs in a terminal, evil-cleverparens does something extra-funky to the keybindings.

Steps:

  • run emacs in terminal mode (I've tried iTerm and terminal on OSX)
  • with evil and cleverparens mode on, move around the buffer using the arrow keys
  • feel slightly guilty for not using hjkl, but then shrug it off and move on
  • press v to enter visual mode
  • exit visual mode
  • press the up arrow

Result:

  • chaos, cats and dogs living together...
  • also, the up arrow appears to be interpreted now as M-O followd by A', with the result that you end up in insert mode, on a new line above the current function, with a capital letterA`.
  • some other bindings do weird things too - the arrow keys and the mouse-wheel are the ones I have noticed

Turning off cleverparens mode restores the normal functioning of the arrow keys. Also, as noted above, the weirdness does not start until you enter and then exit visual mode.

In case it matters, I see this behavior in Spacemacs.

HELP

After downloading emacs following http://eschulte.github.io/emacs24-starter-kit/#emacs-lisp-package-archive, I now want to enable Melpa.

The below is what I typed into an org document under the directory emacs.d :
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
#+END_SRC

upon typing C-c C-c, I get the response "Wrong type argument: listp, "http://melpa.org/packages/"

What am I doing wrong??? I'd greatly appreciate any help offered.

Enabling evil-cleverparens complains about void symbol state

I just updated packages and trying to enable cleverparens displays this error:

Symbol's value as variable is void: state

This is with Spacemacs, and I currently have installed:

  • evil-20160506.1021
  • paredit-20160324.1215
  • smartparens-20160511.812
  • dash-20160510.1127

Happy to help debug further, but I’m not much of an Emacs expert.

BTW, thank you so much for this package! I work with Clojure, and this does exactly what I want it do. It’s great.

x on parenthesis not working in some cases

Test case

(["]a" "b")

I'm not sure what's going on here, and I don't have time to test a bunch of cases right now, but if you hit x from the state above you get this which is not what I expected.

("[a]" "b")

handling comments

Hi again,

I was wondering if there was a way to intelligently deal with comments. Here's an example

(let (a)
  ;; a is ...
  (setq a 1))

Try dd on the last line. The closing paren moves into the comment and now we have a problem and need a manual fix. Is it possible to jump the comment or put the closing paren before the comment? Something that would keep the expression valid.

`C` puts cursor at beginning of next line.

evil-cp-change-line puts cursor on the next line if:

  1. It is called on or before an opening paren (sometimes)
  2. It is called on or before an opening bracket
  3. It is called before a closing paren or bracket

For example, calling in the following situation:

(defn foo [|a]
  bar)

Gives:

(defn foo []
  |bar)

While you almost certainly want

(defn foo [|]
  bar)

Minor bug in `yy`/`dd`

Given

(+ 1
   (+ 2 3
      4 5))

hitting yy on line 2 will copy the whitespace before the parens instead of the contents afterward. This surprising to me, but perhaps reasonable behavior. The issue comes when using dd on that line- it deletes + 2 3 but still yanks the whitespace before. I have found a simple patch for this which makes both yy and dd yank the text after the parens, which I will be uploading as a pr soon. It works by having evil-cp-yank skip preceeding whitespace before calling evil-cp--ignoring-yank.

evil-cp-change must move the cursor

evil-cp-change must move the cursor similar to evil-change e. g.

(|foo  "bar") 

evil-change will move the cursor when pressing ci" into the double quote, while evil-cp-change will keep the current cursor position.

whitespace after daf and dab

Hi, This is a minor annoyance for me, but maybe there's something you can do about it. Here's an example, where I'm using . to represent spaces

;;.A.sentence.in.a.comment
(progn.(a).(sequence).(of).(commands))

If I daw on "sentence", I get

;;.A.in.a.comment
(progn.(a).(sequence).(of).(commands))

but daf on sequence then gives

;;.A.in.a.comment
(progn.(a)..(of).(commands))

Notice when I delete "sentence" it also deletes one space, but I'm left with two spaces between (a) and (of), which I typically then have to fix right away.

Maybe this is too complicated to fix, but if it's not, I'd appreciate it if the behavior with regards to whitespace leftover was consistent.

By the way I've been using this package for a while now, and it really makes editing lisp much more pleasant, so thank you.

evil-cp-delete-line corner case

Given:

(spacemacs|define-transient-state sooheon-paste
  "\n[%
[_M-n_/_M-p_] cycles through yanked text, [_p_/_P_] pastes the same text above or
below. Anything."
  :bindings
  ("M-n" evil-paste-pop))

With cursor anywhere on line 4, D will return something like this:

(spacemacs|define-transient-state sooheon-paste
  "\n[%
[_M-n_/_M-p_] cycles through yanked text, [_p_/_P_] pastes the same text above or
M-n" evil-paste-pop))

with unbalanced parens. The snippet above is not valid elisp (I was looking for minimum reproducible fragment), but syntactically it's correct. The problem is that instead of deleting only to the end of the current string, it joins all the way to the start of the next string, deleting everything inbetween. I think the problem has something to with the weird characters in the string, as deleting the middle line of the multiline string makes this unreproducible.

Deleting and Copying Comments Containing Sexps

If I select commented lines that contain a sexp and hit d, I get weird behavior. For example, the following

;; (defcustom example t
;;   "example of commented sexp"
;;   :type 'boolean)

will become

()

This also happens when using the comment text object.

Furthermore, if I visually select that comment and hit y or use yac, only ";; " will be copied to the kill ring instead of all three lines.

Trying to delete comments with unbalanced parenthesis will also delete everything but the parens and actually cause the file to have mismatched parens.

cw swallows space after word

In regular evil and vim, cw in this case:

foo |bar baz

Will drop you into insert in:

foo | baz

In evil-cp, it seems to be:

foo |baz

which is unexpected. Is there a way around this? I don't plan to change my muscle memory to use ce :/

Disable conflicting key-bindings M-w and M-[

Hi,

I am looking for help in how to disable certain key bindings in evil-cleverparens mode eg: M-w, M-[ as these casuing conflicts with certain other modes I use.

It can be categorized as not an issue but any help with extra documentation will certainly help.

Would like yy to always paste on a new line

Here's a test case

(a
 (c (d e)))

If I do yy on the second line it doesn't copy the whole line which is fine, but if I then hit p right away I expect the paste to be on a new line below line 2 but it's not. the result is something like this

(a
 (c (d e))(c (d e)))

I would expect something like

(a
 (c (d e)))
 (c (d e))

That's different behavior from yyp on

(c (d e))

Do you agree that this is wrong?

I think it would be better to "pretend" that you yanked a whole line for pasting purposes even though you didn't

joining forces with lispy?

I am watching editing support for lisp and Clojure quite a while now. At the moment I am using lispy hinting the author if I find something od while using it.
Using Clojure as my default language I plan to switch from my prelude based emacs to spacemacs once there is a seamless integration of lisp editing support.
The author of lispy provides the best documentation and training tutorials known to me.

Despite the potential of becoming the sweet spot in editing between text and graphical ui, I still hesitate to recommend emacs and lisp editing support because it is hard to figure out which mode and key bindings to get used to for editing text trees - lisp and even similar applications like org document trees and markdown.

I feel it as a burden having to switch key bindings for each text format although I am semantically doing the same thing - editing trees of text in multiple files.

As I see it at the moment all these projects providing support for editing text trees target a very important issue in keyboard based human computer interaction.

This seems to be a hard problem at the core and I feel respect for people tackling this one.

Use '[[' and ']]' instead of bare '[' and ']'

Evil-unimpared uses [-<SPC> and ]-<SPC> to add spaces above and below the current line, but when you add evil-cleverparens-mode to the clojure-mode hook it clobbers the whole prefix space with evil-cp-previous-opening and evil-cp-next-closing.

If the mappings were to use [[ and ]] instead then the [ and ] prefix spaces would be left open for other packages to utilize as well.

disable evil-cleverparens `x` behavior

is there a way to disable evil-cleverparens x behavior?

it would be handy to turn this off so you can delete with x without accidentally dropping a set of parens.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.