Wrapping paredit-forward
Hi! How should I go about wrapping paredit-forward so that it will work in normal mode? The problem currently is that once you hit a ‘)’ at the end of a line you can’t go forward any more, as point will be /at/ the ‘)’, due to the way Evil works, not /after/ the ‘)’, as paredit expects it to be.
Nikolai Weibull <[email protected]> writes:
How should I go about wrapping paredit-forward so that it will work in normal mode?
The problem currently is that once you hit a ‘)’ at the end of a line you can’t go forward any more, as point will be /at/ the ‘)’, due to the way Evil works, not /after/ the ‘)’, as paredit expects it to be.
For me C-M-f (paredit-forward) puts the point after the closing paren, so successive C-M-f works as expected. I'm using the latest Evil, but this is working since a long time. I use evil-paredit too, but I see nothing there that could affect this.
On Thu, May 29, 2014 at 3:09 PM, Óscar Fuentes <[email protected]> wrote:
Nikolai Weibull <[email protected]> writes:
How should I go about wrapping paredit-forward so that it will work in normal mode?
The problem currently is that once you hit a ‘)’ at the end of a line you can’t go forward any more, as point will be /at/ the ‘)’, due to the way Evil works, not /after/ the ‘)’, as paredit expects it to be.
For me C-M-f (paredit-forward) puts the point after the closing paren, so successive C-M-f works as expected.
In /insert/ mode, yes. My question mentioned that I’m interested in using paredit-forward in /normal/ mode.
Nikolai Weibull <[email protected]> writes:
How should I go about wrapping paredit-forward so that it will work in normal mode?
The problem currently is that once you hit a ‘)’ at the end of a line you can’t go forward any more, as point will be /at/ the ‘)’, due to the way Evil works, not /after/ the ‘)’, as paredit expects it to be.
For me C-M-f (paredit-forward) puts the point after the closing paren, so successive C-M-f works as expected.
In /insert/ mode, yes. My question mentioned that I’m interested in using paredit-forward in /normal/ mode.
Sorry for not explicitly stating the fact on my previous message, but I was talking of normal mode all along. So there is something different on our setups that affects how paredit-forward works on normal mode... While looking again at my .emacs I found this: (setq evil-move-cursor-back nil) (setq evil-highlight-closing-paren-at-point-states nil) specifically evil-move-cursor-back is, most likely, what you want.
On Thu, May 29, 2014 at 6:06 PM, Óscar Fuentes <[email protected]> wrote:
Nikolai Weibull <[email protected]> writes:
How should I go about wrapping paredit-forward so that it will work in normal mode?
The problem currently is that once you hit a ‘)’ at the end of a line you can’t go forward any more, as point will be /at/ the ‘)’, due to the way Evil works, not /after/ the ‘)’, as paredit expects it to be.
For me C-M-f (paredit-forward) puts the point after the closing paren, so successive C-M-f works as expected.
In /insert/ mode, yes. My question mentioned that I’m interested in using paredit-forward in /normal/ mode.
Sorry for not explicitly stating the fact on my previous message, but I was talking of normal mode all along. So there is something different on our setups that affects how paredit-forward works on normal mode...
(Phew! I thought you were being a bit daft…I guess I’m a bit too used to work e-mail.)
While looking again at my .emacs I found this:
(setq evil-move-cursor-back nil) (setq evil-highlight-closing-paren-at-point-states nil)
specifically evil-move-cursor-back is, most likely, what you want.
Yes. Even though I prefer the Vi way of doing this (not because it makes a lot of sense, but because it’s what I’m used to), having access to this command alone is reason enough to make the switch. Perhaps I might finally do so. Here’s a possible solution that seems to work, but probably doesn’t take some edge case into account: (evil-define-motion evil-paredit-forward (count) "TBD." :type inclusive (if (and evil-move-cursor-back (eq last-command 'evil-paredit-forward) (= count 1) (not (eolp)) (save-excursion (forward-char) (eolp))) (forward-char)) (dotimes (i (or count 1)) (paredit-forward))) Comments? Thanks!
participants (2)
-
Nikolai Weibull -
Óscar Fuentes