[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode 94a88cdb99 07/18: Restore position after case s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode 94a88cdb99 07/18: Restore position after case split |
Date: |
Thu, 8 Dec 2022 05:59:07 -0500 (EST) |
branch: elpa/idris-mode
commit 94a88cdb99bc9f6a7a3ec50750f079baac49f549
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>
Restore position after case split
Addresses feedback on https://github.com/idris-hackers/idris-mode/pull/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 https://github.com/idris-hackers/idris-mode/pull/465
---
idris-commands.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/idris-commands.el b/idris-commands.el
index 54f3d1cc55..5074131425 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -570,19 +570,20 @@ Useful for writing papers or slides."
(defun idris-case-split ()
- "Case split the pattern variable at point"
+ "Case split the pattern variable at point."
(interactive)
(let ((what (idris-thing-at-point)))
(when (car what)
(save-excursion (idris-load-file-sync))
- (let ((result (car (idris-eval `(:case-split ,(cdr what) ,(car what))))))
+ (let ((result (car (idris-eval `(:case-split ,(cdr what) ,(car what)))))
+ (initial-position (point)))
(if (<= (length result) 2)
(message "Can't case split %s" (car what))
(delete-region (line-beginning-position) (line-end-position))
(if (> idris-protocol-version 1)
(insert (substring result 0 (length result)))
- (insert (substring result 0 (1- (length result))))
- ))))))
+ (insert (substring result 0 (1- (length result)))))
+ (goto-char initial-position))))))
(defun idris-make-cases-from-hole ()
"Make a case expression from the metavariable at point."
@@ -596,8 +597,8 @@ Useful for writing papers or slides."
(delete-region (line-beginning-position) (line-end-position))
(if (> idris-protocol-version 1)
(insert (substring result 0 (length result)))
- (insert (substring result 0 (1- (length result))))
- ))))))
+ (insert (substring result 0 (1- (length result)))))
+ (search-backward "_ of\n"))))))
(defun idris-case-dwim ()
"If point is on a hole name, make it into a case expression.
- [nongnu] elpa/idris-mode updated (4a36953e76 -> 744f773bb4), ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 8c1a079a8e 03/18: Use idris-notes-buffer-name in idris-notes-quit, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 3f7eef3569 02/18: Split idris-list-compiler-notes to idris-compiler-notes-list-show, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 3d460800a4 01/18: Remove unecessary pop or display notes buffer, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode a971194d56 14/18: Merge pull request #582 from keram/notes-error-buffer-code-cleanup, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 51caa5f3a5 15/18: Merge pull request #585 from keram/emacs28-and-cache-v3, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 43aead3c46 05/18: Make idris-compiler-notes-list-show more similar with idris-hole-list-show, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 68fe8e115f 06/18: Move idris-list-compiler-notes into idris-commands.el, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 80861674a6 08/18: Debug CI idris2 failure 2 - try retry to wait for idris version in idris-switch-working-directory, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 94a88cdb99 07/18: Restore position after case split,
ELPA Syncer <=
- [nongnu] elpa/idris-mode 888bf9614f 04/18: Make notes buffer special and make the show function similar to holes one, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 063a63b770 17/18: Merge pull request #586 from idris-hackers/revert-583-update-pr-465, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 9a4a9641b9 10/18: [ new ] intro command - backport from idris2-mode, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 5b3c88dc1d 11/18: Add test for idris-refine, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode a9d12c89e2 12/18: Add Emacs 28.2 to test matrix and, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode b39a08790e 13/18: Merge pull request #583 from keram/update-pr-465, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 744f773bb4 18/18: Merge pull request #578 from keram/backport-pr-21-intro, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode cab95f1fca 09/18: wip test, ELPA Syncer, 2022/12/08
- [nongnu] elpa/idris-mode 9ebd0a7d26 16/18: Revert "Restore position after case split", ELPA Syncer, 2022/12/08