-
-
Notifications
You must be signed in to change notification settings - Fork 248
Fix clojure-find-ns #661
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
Merged
Merged
Fix clojure-find-ns #661
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Merge branch 'master' into fix-clojure-find-ns
- Loading branch information
commit 01d8d30afea1d5f6f7b7a90b22c947736c12d0a2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are viewing a condensed version of this merge commit. You can view the full changes here.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Perhaps we should add some comments here?
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.
The change is to handle whitespace before comment form. Not sure if this is the best way to do it though.
Added a couple of comments now to make the intent more clear.
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.
My point was mainly that it looks a bit weird that we're going forward and backwards back-to-back. If that's used often in the code we can make a function I guess.
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.
Agreed. But I am not sure what is the correct abstraction anymore as it's more of a hack.
This is the third occurrence in the codebase but there are other places where similar logic was used with different functions and some places where edge cases are not handled. Even my current change will still break if there are multiple expressions in the same line.
Looks like all these extra steps are only needed in many places because of
beginning-of-defunbehaving 'incorrectly'.For ex:
Now running
(clojure-beginning-of-defun-function)or(beginning-of-defun)from any of the inner expressions takes the cursur to the beginning of the line (before 1).The expected behaviour IMO from the name would be having the cursor before
(defn.The docstring mentions this but there is no way to easy way to control the end location of the cursor.
clojure-mode uses beginning-of-defun a lot so there are a lot of unhandled edge cases.
For example take these two code blocks:
Run
M-x cider-eval-defun-at-point(C-c C-c) inside (+ 1 2) and the result is different in the two scenarios.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.
tldr: IIUC bad choice of abstraction from
beginning-of-defunfn has propagated many edge cases possibly in all lisp modes.Maybe I am missing something basic or someone already solved this issue.
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.
@bbatsov I have raised a separate PR for replacing
beginning-of-defunfn completely here.#663
After merging that PR these two lines here can be removed.
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.
Thanks for diving deep into this!
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.
Merged latest master and removed the extra lines here.
Will wait for @vemv to resolve the other conversation.