Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged


As @Drew suggested, C-M-t does what you want. The rule is like this: Put point in the middle of two sexps. Press C-M-t (which runs transpose-sexp). The left sexp is always moved to the right along with point. This is very important, otherwise you will be confused to no end. Or, you can simply think that this is not transposing but simply to move forward, ...


The commands are defined, but not bound to a key by default. You can add them to the paredit map with this: (eval-after-load 'paredit '(progn (define-key paredit-mode-map (kbd "{") 'paredit-open-curly) (define-key paredit-mode-map (kbd "}") 'paredit-close-curly))) You may prefer to add them to particular programming mode keymaps, ...


i (lispy-tab) from lispy does just that. Below is a screenshot of an ERT test visualization (using xv (lispy-view-test)).


Perhaps you're looking for indent-pp-sexp, which is bound to C-M-q by default in emacs lisp mode. With a prefix argument (e.g. C-u C-M-q) this will "pretty print" the sexp at point.


It's possible to do it with lispy, which is an advanced form of paredit-mode. For your use case: w moves up s moves down The only thing is that the cursor has to be at paren, which it is in your example: (+ 1 |(+ 2 3) 4) You can also move several sexps at once with w and s, if you mark them with a region. See the documentation for more info.


The problem you mentioned is why I remove the functions try-expand-line and try-expand-list from the list of functions hippie-expand uses to produce expansions. This doesn't really solve the problem but may be an acceptable workaround. (dolist (f '(try-expand-line try-expand-list)) (setq hippie-expand-try-functions-list (remq f hippie-expand-try-...


I think paredit-splice, M-s, will do that. Point may need to be inside the expression you want to 'unwrap'.


C-q runs the command quoted-insert and reads the next character and itputs it as it is (works everywhere on my emacs configuration). So I think that C-q " and C-q ) should do what you want.


Evil keymaps override the default global keymaps. To learn more, you may want to read: The Emacs manual on keymaps Mastering Emacs Key Bindings If you want to override Evil keys, you'd need to do so to the Evil keymaps themselves: (define-key evil-insert-state-map (kbd "C-)") #'paredit-forward-slurp-sexp) (define-key evil-normal-state-map (kbd "C-)") #'...


Tagedit is what you want. From the README: tagedit-forward-slurp-tag moves the next sibling into this tag. tagedit-forward-barf-tag moves the last child out of this tag. tagedit-raise-tag replaces the parent tag with this tag. tagedit-splice-tag replaces the parent tag with its contents. tagedit-join-tags combines two tags into one, prompting for tagname ...


You should do M-x list-packages. Then do C-s to search for paredit. If it does not appear in the list, then your package source is not configured properly and you are not getting the list you are expecting. I just checked melpa on my local and paredit is present, so your invocation should have worked.


The only way to navigate and manipulate atoms in lispy is to mark them with a region. This is because if the point is around the item and the region is not active, the alpha keys should self-insert instead of calling commands. Sexps example Start with (| is the point): |(progn (foo) (bar)) Press fs to get: (progn (bar) |(foo)) Equivalent atoms ...


Emacs comes with such command out of the box, transpose-sexps. It's bound to C-M-t by default.


The problem only occurs after you've turned paredit on and off: this is because clojure-mode adds a hook to paredit-mode, and that hook adds some paredit-mode keybindings to the clojure-mode map. In other words, turning on paredit-mode makes changes to clojure-mode keybindings and those changes stick even if you turn off paredit-mode. The really surprising ...


Since no one here has come up with an answer that is sufficient for my needs, I've continued with my aforementioned implementation which uses paredit-backward-delete under certain conditions. What I've come up with isn't very pretty (nor very efficient), but it works well enough and seems to keep true to the spirit of paredit from an end-user perspective. ...


Here is another command (from library misc-cmds.el) that does pretty much what you request. Just bind it to a single key (C-M-t or whatever). Use it to move a sexp both forward and backward repeatedly. A negative prefix arg transposes backward, like transpose-sexp, but it also leaves point ready to do another backward transposition. And when repeating, a ...

Only top voted, non community-wiki answers of a minimum length are eligible