-
Notifications
You must be signed in to change notification settings - Fork 72
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
Restore location when case split #465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the desired behavior is an improvement, but I don't think that the use of setq
here is the right way to do it. Did save-excursion
not work? And if not, why not let
-bind the variable rather than conjuring it up with setq
?
@@ -576,8 +576,10 @@ KILLFLAG is set if N was explicitly specified." | |||
(let ((result (car (idris-eval `(:case-split ,(cdr what) ,(car what)))))) | |||
(if (<= (length result) 2) | |||
(message "Can't case split %s" (car what)) | |||
(setq final-point (point)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is lexically scoped, so final-point
isn't around right now. Why not let
-bind it here, rather than using setq
?
@@ -588,8 +590,10 @@ KILLFLAG is set if N was explicitly specified." | |||
(let ((result (car (idris-eval `(:make-case ,(cdr what) ,(car what)))))) | |||
(if (<= (length result) 2) | |||
(message "Can't make cases from %s" (car what)) | |||
(setq final-point (point)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is lexically scoped, so final-point
isn't around right now. Why not let
-bind it here, rather than using setq
?
Also, did you test save-excursion
rather than using goto-char
like this?
Thanks! I'm a newbie to elisp. I will see if |
I'm happy to give feedback - sorry it took so long. |
Addresses feedback on idris-hackers#465 with small improvement for making case from hole where the point is moved back to position of `_` in `case _ of` as that is place user may most likely edit next. Closes idris-hackers#465
Addresses feedback on idris-hackers#465 with small improvement for making case from hole where the point is moved back to position of `_` in `case _ of` as that is place user may most likely edit next. Closes idris-hackers#465
I always find it annoying every time I do case split on a variable or hole, the cursor would be put on the last of the clause, and I need to move backward several lines to do some editing.