paredit

Swap parentheses and square brackets in Emacs Paredit

雨燕双飞 提交于 2019-12-06 08:42:43
问题 How can I define a command in paredit mode that swaps parentheses and square brackets? 回答1: The following code does what you request. You can bind swap-parens to whatever key binding you want. (defvar swap-paren-pairs '("()" "[]")) (defun swap-parens-at-points (b e) (let ((open-char (buffer-substring b (+ b 1))) (paren-pair-list (append swap-paren-pairs swap-paren-pairs))) (while paren-pair-list (if (eq (aref open-char 0) (aref (car paren-pair-list) 0)) (save-excursion (setq to-replace (cadr

Just getting used to paredit in emacs on OS X - how come C-) doesn't work?

喜你入骨 提交于 2019-12-05 04:55:31
I've recently set up a Common Lisp programming environment in Mac OS X Leopard. One emacs module which I've found to be indispensable is paredit. Paredit is doing its part to help me wrangle my Lisp code more easily, but I've ran into a bit of a snare. C-), bound to paredit-forward-slurp-sexp , is not forward slurping sexps but instead echoing the number 0 . I'm using a Mac, alternating between iTerm and Terminal. The same problem is present in both apps. I tried the same key combination in GNU Emacs' GUI version, and lo, it worked. Unfortunately the graphical version of Emacs does not satisfy

Swap parentheses and square brackets in Emacs Paredit

不羁的心 提交于 2019-12-04 13:58:52
How can I define a command in paredit mode that swaps parentheses and square brackets? The following code does what you request. You can bind swap-parens to whatever key binding you want. (defvar swap-paren-pairs '("()" "[]")) (defun swap-parens-at-points (b e) (let ((open-char (buffer-substring b (+ b 1))) (paren-pair-list (append swap-paren-pairs swap-paren-pairs))) (while paren-pair-list (if (eq (aref open-char 0) (aref (car paren-pair-list) 0)) (save-excursion (setq to-replace (cadr paren-pair-list)) (goto-char b) (delete-char 1) (insert (aref to-replace 0)) (goto-char (- e 1)) (delete

paredit curly brace matching in swank-clojure repl

杀马特。学长 韩版系。学妹 提交于 2019-12-03 12:32:40
问题 I am using emacs 24 on Windows 7 and have installed technomancy's clojure-mode along with paredit 23 beta. I load the source file from my leiningen project and get a repl using clojure-jack-in. The problem is that while paredit is enabled in both Clojure mode and the repl, curly braces are not matched in the repl only in source files. How can I get it to match braces in the repl as well? 回答1: I added the following to my .emacs file, that does the trick for me (I did not invent this myself, it

paredit curly brace matching in swank-clojure repl

独自空忆成欢 提交于 2019-12-03 03:00:16
I am using emacs 24 on Windows 7 and have installed technomancy's clojure-mode along with paredit 23 beta. I load the source file from my leiningen project and get a repl using clojure-jack-in. The problem is that while paredit is enabled in both Clojure mode and the repl, curly braces are not matched in the repl only in source files. How can I get it to match braces in the repl as well? I added the following to my .emacs file, that does the trick for me (I did not invent this myself, it's a snippet I found somewhere online - but I can't remember where): (defun setup-slime-repl-paredit ()

Emacs Clojure mode without paredit

可紊 提交于 2019-12-03 01:36:57
I'm using the Clojure mode package from ELPA. Otherwise everything is fine, but I just can't stand paredit mode. I can't seem to turn it off easily, now I just disable it for every buffer I open. I tried setting this variable to nil: (setq clojure-enable-paredit nil) But paredit still appears. Any ideas? Not an answer to your actual question, but give paredit mode a chance. I, too, was really annoyed with it automatically closing my parens, and refusing to delete just a single paren for me. But doing this enables it to be certain at all times that the buffer is a well-balanced sexp, so it can

I can't find a light table cheat sheet

不羁岁月 提交于 2019-11-28 19:17:09
问题 Does anyone have a cheatsheet for LightTable, even better for the paredit plugin, it seems my google-fu is not up to finding one? 回答1: I don't think a general cheat sheet for LightTable exists yet! But for the paredit plugin...I hope the following helps Paredit Commands :paredit.unwrap.parent (a b (c | d) e) => (a b c | d e) :paredit.grow.left (a b (c | d) e) => (a (b c | d)) :paredit.grow.right (a b (c | d) e) => (a b (c | d e)) :paredit.shrink.left (a b (c | d) e) => (a b c | (d) e)