Skip to content

[Fix 489] Inserting parens before comment form doesn't move point #490

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
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* [#483](https://github.com/clojure-emacs/clojure-mode/issues/483): Support alignment for reader conditionals, with the new `clojure-align-reader-conditionals` user option.

### Bugs fixed

* [#489](https://github.com/clojure-emacs/clojure-mode/issues/489) Inserting parens before comment form doesn't move point

## 5.9.1 (2018-08-27)

* [#485](https://github.com/clojure-emacs/clojure-mode/issues/485): Fix a regression in `end-f-defun`.
Expand Down
8 changes: 4 additions & 4 deletions clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1967,8 +1967,7 @@ This will skip over sexps that don't represent objects, so that ^hints and
"Return truthy if the first form matches FIRST-FORM."
(condition-case nil
(save-excursion
(end-of-defun)
(clojure-backward-logical-sexp 1)
(beginning-of-defun)
(forward-char 1)
(clojure-forward-logical-sexp 1)
(clojure-backward-logical-sexp 1)
Expand Down Expand Up @@ -2022,10 +2021,11 @@ many times."
(save-match-data
(let ((original-position (point))
clojure-comment-start clojure-comment-end)
(beginning-of-defun)
(setq clojure-comment-start (point))
(end-of-defun)
(setq clojure-comment-end (point))
(clojure-backward-logical-sexp 1) ;; beginning of comment form
(setq clojure-comment-start (point))
(beginning-of-defun)
(forward-char 1) ;; skip paren so we start at comment
(clojure-forward-logical-sexp) ;; skip past the comment form itself
(if-let ((sexp-start (clojure-find-first (lambda (beg-pos)
Expand Down
10 changes: 9 additions & 1 deletion test/clojure-mode-sexp-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ and point left there."
(wrong))"
(let ((clojure-toplevel-inside-comment-form t))
(beginning-of-defun))
(should (looking-at-p "[[:space:]]*(right)"))))
(should (looking-at-p "[[:space:]]*(right)")))
(clojure-buffer-with-text
"
(formA)
|
(formB)"
(let ((clojure-toplevel-inside-comment-form t))
(beginning-of-defun)
(should (looking-at-p "(formA)")))))

(ert-deftest test-clojure-end-of-defun-function ()
(clojure-buffer-with-text
Expand Down