Comments (3)
Maybe new commands or an option could be added, but I think the default commands should always act on atoms. For now, you could use general-predicated-dispatch
(or the equivalent if you don't use general), for example, to create your own version that behaves differently in comments.
from lispyville.
Hmm... My reading of the relevant section in the Emacs manual leaves me nearly convinced that comments aren't considered "atoms" in the lisp sense. I get the sense that comment and code spaces are orthogonal, and that the concepts of "list" and "atom" have meaning only in the latter.
At any rate, I have atom-motions
disabled for now because it makes editing comments so painful. Thanks for the suggested workaround. I'll try to look at general-predicated-dispatch
(and General, more generally) when I get some free time...
from lispyville.
Here is a self contained example (general.el not needed):
(cl-defmacro general-predicate-dispatch
(fallback-def &rest defs
&key docstring
&allow-other-keys)
(declare (indent 1))
"Create a menu item that will run FALLBACK-DEF or a definition from DEFS.
DEFS consists of <predicate> <definition> pairs. Binding this menu-item to a key
will cause that key to act as the corresponding definition (a command, keymap,
etc) for the first matched predicate. If no predicate is matched FALLBACK-DEF
will be run. When FALLBACK-DEF is nil and no predicates are matched, the keymap
with the next highest precedence for the pressed key will be checked. DOCSTRING
can be specified as a description for the menu item."
;; remove keyword arguments from defs and sort defs into pairs
(let ((defs (cl-loop for (key value) on defs by 'cddr
unless (keywordp key)
collect (list key value))))
`'(menu-item
,(or docstring "") nil
:filter (lambda (&optional _)
(cond ,@(mapcar (lambda (pred-def)
`(,(car pred-def) ,(cadr pred-def)))
defs)
(t ,fallback-def))))))
(define-key lispyville-mode-map
[remap evil-forward-word-begin]
(general-predicate-dispatch #'lispyville-forward-atom-begin
(lispy--in-string-or-comment-p) #'evil-forward-word-begin))
(lispy--in-string-or-comment-p)
could be replaced with (lispy--in-comment-p)
or whatever.
from lispyville.
Related Issues (20)
- lispyville-toggle-mark-type appears to lose final character of selection on transition to visual state HOT 2
- Set text objects only in lispyville-mode HOT 2
- Don't delete quote characters when keeping open paren
- feature request: lispyville-beginning-of-previous-defun
- Possible solution for inner and outer local objects HOT 1
- Slurping/Barfing strings (" characters) HOT 2
- Using lispyville operators as drop-in replacements HOT 5
- Installation documentation? HOT 3
- Prettify escapes atoms in Clojure that starts with "." HOT 4
- How to transpose in normal mode? HOT 2
- What is the recommended way to delete an sexp? HOT 1
- lispyville-change word is too greedy HOT 6
- Issues with lispyville-delete-char-or-splice.
- [Guix] 5 tests fail HOT 8
- Are `lispy-splice`, `lispy-kill` and `lispy-splice` supposed to work in insert mode? HOT 2
- Evil navigation
- lispy-raise-some not working due to lispy-right-p HOT 2
- evil-replace counterpart? HOT 2
- [ binding conflicts with ability to type it in some languages like Racket HOT 1
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 lispyville.