Comments (5)
Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):
Make `evil-last-sexp' work with closing parenthesis under point (fixed #17)
This is done by advicing preceeding-sexp' and
pp-last-sexp'.
from evil.
Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):
Make `evil-last-sexp' work with closing parenthesis under point (fixed #17)
This is done by advicing preceeding-sexp' and
pp-last-sexp'.
from evil.
Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):
Make `evil-last-sexp' work with closing parenthesis under point (fixed #17)
This is done by advicing preceeding-sexp' and
pp-last-sexp'.
from evil.
Original comment by Anonymous:
Thinks. I had to change them slightly so that they continued to work in insert-mode (I'm not sure if that was the intent, but I like it like that). But I have discovered one edge case (which also affects my solution): save-excursion means you can't move the cursor when doing eval-last-sexp in normal-mode. My current fix is to advise the "find the last sexp" functions instead:
(defadvice preceding-sexp (around evil)
"In normal-state, last sexp ends at point."
(if (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)
ad-do-it))
(defadvice pp-last-sexp (around evil)
"In normal-state, last sexp ends at point."
(if (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)
ad-do-it))
(I'm not sure why both of these functions exist.) I haven't noticed any problems with this. It's possible that if someone uses these functions noninteractively, things would break; in that case, I can't think of a better solution than "reimplement [pp-]eval-last-sexp". But in core, they don't seem to be used anywhere bad: just a helper function of eval-last-sexp, and pp-eval-last-sexp and pp-macroexpand-last-sexp, respectively.
from evil.
Original comment by Frank Fischer (Bitbucket: lyro, GitHub: lyro):
You may try the following code which advices some function when evil
is activated. If you use at least 35ff006 those modifications should
be activated if and only if evil is active. If those modifications
work they could go into evil's code.
;;; eval-last-sexp
(defadvice eval-last-sexp (around evil)
"Last sexp ends at point."
(when (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)))
;;; pp-eval-last-sexp
(defadvice pp-eval-last-sexp (around evil)
"Last sexp ends at point."
(when (evil-normal-state-p)
(save-excursion
(unless (or (eobp) (eolp)) (forward-char))
ad-do-it)))
from evil.
Related Issues (20)
- Substitution preview for "\#" is incorrect HOT 1
- How do I set a goal column in Evil? HOT 2
- How do I handle `Symbol’s function definition is void: evil-add-to-alist`? HOT 3
- Input method in search and in replace modes doesn't match the currently activated one in insert mode
- Cursor color does not persist HOT 6
- Unable to set certain variables by `:custom` in `use-package` HOT 1
- Incompatibility with package indent-bars HOT 3
- Ex command no longer completes command contain dash (-) HOT 4
- Can’t make ‘nil’ obsolete; did you forget a quote mark? HOT 2
- Arrow Keys behaves like in vi HOT 15
- missing characters when horizontal scrolling if fringe-mode off + truncate-lines + tab indentation
- evil-define-key is not restricted to the mode specified HOT 1
- Yanking to ?+ register does not work in Emacs >=29 HOT 6
- `evil-search` with `isearch` module does not respect `dired-isearch-filenames-mode` starting with Emacs 29
- Restrict adding certain buffers to jump list HOT 6
- `company-complete` results in `(evil-repeat-post-hook): (wrong-type-argument number-or-marker-p nil)`
- Missing Visual Mode command: v_g_CTRL-A HOT 3
- evil-visual-char is not inclusive when using goto-char? HOT 2
- `describe-char` doesn't work outside of evail unless `(ad-deactivate #'describe-char)` is evaluated HOT 5
- evil-mode text insertion breaks emacs text property inheritance (stickiness of text properties) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evil.