Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace evil -- first pass #118

Open
wants to merge 117 commits into
base: 2.0-integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
b71c30c
Fix links to point to current repo home at drym-org
countvajhula Feb 25, 2023
2588a52
Deprecate the Hydra modal provider
countvajhula Feb 25, 2023
88a016f
remove a leftover reference to `symex-modal-backend`
countvajhula Feb 25, 2023
7c10bc9
make a sentence a bit more clear
countvajhula Mar 7, 2023
caac021
note todo re: `symex-define-command`
countvajhula Sep 15, 2022
ecc9cfa
Add a basic `symex-define-command` macro
countvajhula Sep 15, 2022
b9d7921
abstract "tidy" operation over lisp and ts
countvajhula Sep 15, 2022
79ae4c5
define "clear" using `symex-define-command`
countvajhula Sep 15, 2022
73e5858
move/rename some interfaces to better reflect abstraction level
countvajhula Sep 15, 2022
313aca6
define "replace" as a proper primitive operation
countvajhula Sep 15, 2022
6490b64
Add `symex-define-insertion-command` macro
countvajhula Sep 15, 2022
cfaa4b6
define "open after" as an insertion command
countvajhula Sep 15, 2022
518697c
define "open before" as an insertion command
countvajhula Sep 15, 2022
3e3b164
note some todos
countvajhula Sep 29, 2022
e33e649
extract ts tidying and selection since it's in the wrapping command m…
countvajhula Sep 29, 2022
3f716ea
define deletion using the command macro
countvajhula Sep 29, 2022
00558f4
define more insertion commands using the macro
countvajhula Oct 7, 2022
e9f88ad
avoid startup issue with macro being undefined
countvajhula Oct 8, 2022
4f41375
reuse deletion code in `change`
countvajhula Feb 25, 2023
529190d
undo `change` with single undo, and follow this for all commands
countvajhula Feb 25, 2023
f3b51c9
declare emacs indent style for command macros
countvajhula Feb 25, 2023
d57b3a2
declare most transformations formally as symex commands
countvajhula Feb 25, 2023
eeff17d
fix symex-replace so undo works in one step
countvajhula Feb 25, 2023
f909f67
fix a selection issue affecting most commands wrt indented symexes
countvajhula Mar 1, 2023
bed2cf3
Improve primitive Lisp parsers
countvajhula Mar 7, 2023
d80a89d
improve primitive "up" motion to ensure valid posterior selection
countvajhula Mar 7, 2023
5ede7bb
Improve Lisp paste primitives
countvajhula Mar 7, 2023
051d05b
Simplify lisp tidy feature
countvajhula Mar 7, 2023
1b8053f
fix paste-after to select the pasted expression
countvajhula Mar 7, 2023
45bb156
a "hack" to enter strings
countvajhula Mar 9, 2023
acc34c3
don't stray from line on visual line motions
countvajhula Mar 9, 2023
f9009d5
fix hanging whitespace in append-newline
countvajhula Mar 9, 2023
ee470d5
fix infinite loop in shifting forward "the most" at the top level
countvajhula Mar 9, 2023
02557fc
fix join joining to previous on last expression (do nothing instead)
countvajhula Mar 9, 2023
2dc61c9
fix some calls to symex-tidy
countvajhula Mar 9, 2023
e948219
fix eval-print which was printing the next expression
countvajhula Mar 9, 2023
8ca5d31
simplify join-lines implementation
countvajhula Mar 9, 2023
cf3184d
tidy all affected symexes after joining lines
countvajhula Mar 9, 2023
67d0195
fix infinite loop in tidy-affected when on last symex
countvajhula Mar 9, 2023
6b1e09c
improve tidy-affected implementation, don't mutate point
countvajhula Mar 9, 2023
f052466
tidy affected symexes in appending newlines too
countvajhula Mar 9, 2023
119ca59
commit low-level utility that was left out
countvajhula Mar 9, 2023
0c996b7
improve lisp deletion primitive to handle a case better
countvajhula Mar 9, 2023
b6b763d
fix trailing whitespace in tidying
countvajhula Mar 9, 2023
55f7ebf
better handle another case in deletion
countvajhula Mar 9, 2023
a288ff4
fix open line below in the presence of an inline comment
countvajhula Mar 9, 2023
1bf6856
remove unused function
countvajhula Mar 9, 2023
2fe0076
rename functions to reflect toplevel private/public correctly
countvajhula Mar 9, 2023
f779d28
fix name
countvajhula Mar 9, 2023
fdd0945
handle a corner case in lisp primitive forward motion
countvajhula Mar 9, 2023
5a618cf
improve tidy-affected implementation, esp fix initial behavior
countvajhula Mar 9, 2023
c036020
improve paste implementation, handle some edge cases better
countvajhula Mar 9, 2023
973e673
add an extra newline in pasting at the toplevel for "island" symexes
countvajhula Mar 9, 2023
1e9599e
refine condition for adding newline padding while pasting
countvajhula Mar 9, 2023
dda2909
further refine toplevel newline padding criteria during paste
countvajhula Mar 10, 2023
d464a96
fix handling of some edge cases in paste
countvajhula Mar 10, 2023
4e8c05f
docs: some tips on debugging with macros present
countvajhula Mar 10, 2023
5d9503d
handle a case more naturally in lisp primitive deletion
countvajhula Mar 10, 2023
7dfa83e
Handle an edge case in adjusting point, at ( | abc ...)
countvajhula Mar 10, 2023
959b1b3
simplify "clear" implementation, handle more cases
countvajhula Mar 10, 2023
0dcc055
improve replace, fix some existing cases and handle more cases
countvajhula Mar 10, 2023
055c833
fix an edge case in join-lines at eol
countvajhula Mar 11, 2023
60ea788
handle more cases in symex-replace
countvajhula Mar 11, 2023
f54bec4
fix: nothing needs to be done in clear if already empty
countvajhula Mar 11, 2023
95726d6
fix some cases involving the use of quantifiers in paste-before
countvajhula Mar 11, 2023
6472a16
shed evil-cleverparens dependency
countvajhula Mar 11, 2023
a3f08ed
shed lispy dependency
countvajhula Mar 11, 2023
f189d13
update some docs
countvajhula Mar 13, 2023
4b95c1e
fix capture backwards when on first symex
countvajhula Mar 14, 2023
9e29994
fix a bug in paste-after that was causing an infinite loop
countvajhula Mar 14, 2023
c55260d
a couple of comments
countvajhula Mar 14, 2023
2ae554b
restore proper handling of deletion at eol
countvajhula Mar 15, 2023
e824c9d
fix handling of strings in deleting the last element in a multi-line …
countvajhula Mar 15, 2023
6482e0f
fix handling of empty forms in nearest selection
countvajhula Mar 15, 2023
926b325
fix selection after tidy-remaining
countvajhula Mar 15, 2023
6f0e4aa
improve another case in paste-after
countvajhula Mar 15, 2023
0ffbab0
make a note about behavior in an edge case
countvajhula Mar 15, 2023
89d191f
handle eob better in paste-after
countvajhula Mar 21, 2023
824be59
use forward-line instead of next-line (as advised by docs)
countvajhula Mar 21, 2023
6312375
fix delete putting an empty line in the kill ring
countvajhula Mar 23, 2023
07ea112
refactor paste to keep lisp code contained in the primitive layer
countvajhula Mar 28, 2023
c2b64cb
improve paste behavior in more corner cases
countvajhula Mar 28, 2023
ced5cde
handle a corner case better in adjusting point for emacs/vim
countvajhula Mar 28, 2023
051e197
use forward-line instead of previous-line (as suggested by docs)
countvajhula Mar 29, 2023
e6b650c
Merge pull request #107 from countvajhula/more-gardening-2
countvajhula Apr 11, 2023
d951d4f
organize emit code for lisp/ts
countvajhula Mar 18, 2023
c29e5e1
minor refactor in evaluator
countvajhula Mar 20, 2023
6a143a9
add delete and paste transformations to the DSL
countvajhula Mar 21, 2023
4d0058c
simplify an example in the docs
countvajhula Mar 22, 2023
f8a2b6b
fix: incorporate delete/paste result into the traversal computation
countvajhula Mar 22, 2023
3a7b65b
try returning success / failure in delete
countvajhula Mar 22, 2023
11647f4
use forward-line instead of next-line/previous-line
countvajhula Mar 22, 2023
56f331e
implement emit-forward as a Symex traversal with transformation
countvajhula Mar 22, 2023
6467052
count 0 executions as success when looping indefinitely in circuit
countvajhula Mar 22, 2023
b01909b
execute arbitrary operations in the DSL
countvajhula Mar 22, 2023
f59c782
Implement basic movements as traversals
countvajhula Mar 23, 2023
158c948
change delete syntax to specify "what" rather than a count
countvajhula Mar 23, 2023
64cbf28
Implement emit-forward using the DSL
countvajhula Mar 23, 2023
5d5ac53
handle a low level exception in tidy
countvajhula Apr 9, 2023
20eec1a
make symex-right-p behavior consistent with symex-left-p
countvajhula Apr 9, 2023
fe17390
don't change level in nearest selection
countvajhula Apr 9, 2023
30258ab
At the DSL level, paste does not move point
countvajhula Apr 9, 2023
097a8cf
be more explicit about structural recursion in traversal evaluation
countvajhula Apr 9, 2023
304aee1
at the DSL level, don't move point on paste before
countvajhula Apr 9, 2023
c8eb739
implement emit backward using the DSL
countvajhula Apr 9, 2023
263e73e
implement capture-backward in the DSL
countvajhula Apr 11, 2023
1a486c2
improve lisp deletion to return a status value
countvajhula Apr 11, 2023
25041ae
handle some low-level exceptions in determining paste padding
countvajhula Apr 11, 2023
4ddaebf
enter an empty form in low level "up" motion for consistency
countvajhula Apr 11, 2023
8aeb068
Improve command macro to preserve underlying return value
countvajhula Apr 11, 2023
533c7c6
handle a corner case in multiline emit/capture backward
countvajhula Apr 12, 2023
eceb2ba
Merge pull request #104 from countvajhula/dsl-transformations
countvajhula Apr 12, 2023
1b1bec7
more docs on debugging
countvajhula Apr 12, 2023
242392f
Replace evil -- first pass
devcarbon-com Apr 29, 2023
833f2bd
Fix change delimiter adding extra padding with \"
devcarbon-com Apr 29, 2023
793cb71
Expose user defined mode changes. Stub out evil states.
devcarbon-com May 1, 2023
ae5eb15
Enter symex mode when evil is available, not just when enabled.
devcarbon-com May 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions symex-interop.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
(defvar chimera-symex-mode)
(defvar rigpa-mode)

;; stub out evil-state in case evil is not installed.
(when (not (boundp 'evil-state))
(setq evil-state nil))
;; temporary stubbing non-evil modal users
(when (not (boundp 'evil))
(setq evil-state nil)
(defun evil-emacslike-state ())
(defun evil-normallike-state ())
(defun evil-nil-state ()))

;; misc bindings defined elsewhere
(declare-function rigpa-enter-higher-level "ext:ignore")
Expand Down Expand Up @@ -89,7 +92,9 @@ right symex when we enter Symex mode."
((symex--evil-enabled-p)
(evil-normal-state))
((symex--evil-installed-p)
(evil-emacs-state))))
(evil-emacs-state))
((fboundp 'symex-user-defined-higher-mode)
(symex-user-defined-higher-mode))))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@countvajhula I'm not sure if there a is a better way or a standard way of exposing user functions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use symex-meow here rather than expose it to an arbitrary user customization.


(defun symex-enter-lower ()
"Exit symex mode via an 'enter'."
Expand All @@ -99,7 +104,9 @@ right symex when we enter Symex mode."
((symex--evil-enabled-p)
(evil-insert-state))
((symex--evil-installed-p)
(evil-emacs-state))))
(evil-emacs-state))
((fboundp 'symex-user-defined-lower-mode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, we don't need these. When the symex-meow module is added, we can add an extra case at each of these sites.

(symex-user-defined-lower-mode))))

(defun symex-enter-lowest ()
"Enter the lowest (manual) editing level."
Expand All @@ -109,7 +116,9 @@ right symex when we enter Symex mode."
((symex--evil-enabled-p)
(evil-insert-state))
((symex--evil-installed-p)
(evil-emacs-state))))
(evil-emacs-state))
((fboundp 'symex-user-defined-lowest-mode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as others.

(symex-user-defined-lowest-mode))))

(defun symex--set-scroll-margin ()
"Set a convenient scroll margin for symex mode, after storing the original value."
Expand Down
2 changes: 1 addition & 1 deletion symex-transformations-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
(newline-and-indent)
(forward-line -1)
(indent-according-to-mode)
(move-end-of-line)
(move-end-of-line 1)
(unless (or (symex--current-line-empty-p)
(save-excursion (backward-char)
(symex-left-p)))
Expand Down