diff options
| author | Eli Zaretskii | 2023-05-07 09:13:10 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-05-07 09:13:10 +0300 |
| commit | 910a7b30dfd185eda78caf48e6f634a6a6e086f1 (patch) | |
| tree | c436cfa6160e75e97e6d9a6036974c1c0bbf9f75 | |
| parent | e205f68717e960a929e5657e8351ba6ef0e5f480 (diff) | |
| download | emacs-910a7b30dfd185eda78caf48e6f634a6a6e086f1.tar.gz emacs-910a7b30dfd185eda78caf48e6f634a6a6e086f1.zip | |
Fix beginning/end-of-defun with tree-sitter
* lisp/treesit.el (treesit-beginning-of-defun)
(treesit-end-of-defun): Push mark, as other beginning/end-of-defun
functions do.
| -rw-r--r-- | lisp/treesit.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el index 1d4749c8cd2..147b052d287 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -1862,6 +1862,10 @@ This is a tree-sitter equivalent of `beginning-of-defun'. | |||
| 1862 | Behavior of this function depends on `treesit-defun-type-regexp' | 1862 | Behavior of this function depends on `treesit-defun-type-regexp' |
| 1863 | and `treesit-defun-skipper'." | 1863 | and `treesit-defun-skipper'." |
| 1864 | (interactive "^p") | 1864 | (interactive "^p") |
| 1865 | (or (not (eq this-command 'treesit-beginning-of-defun)) | ||
| 1866 | (eq last-command 'treesit-beginning-of-defun) | ||
| 1867 | (and transient-mark-mode mark-active) | ||
| 1868 | (push-mark)) | ||
| 1865 | (let ((orig-point (point)) | 1869 | (let ((orig-point (point)) |
| 1866 | (success nil)) | 1870 | (success nil)) |
| 1867 | (catch 'done | 1871 | (catch 'done |
| @@ -1892,6 +1896,10 @@ this function depends on `treesit-defun-type-regexp' and | |||
| 1892 | (interactive "^p\nd") | 1896 | (interactive "^p\nd") |
| 1893 | (let ((orig-point (point))) | 1897 | (let ((orig-point (point))) |
| 1894 | (if (or (null arg) (= arg 0)) (setq arg 1)) | 1898 | (if (or (null arg) (= arg 0)) (setq arg 1)) |
| 1899 | (or (not (eq this-command 'treesit-end-of-defun)) | ||
| 1900 | (eq last-command 'treesit-end-of-defun) | ||
| 1901 | (and transient-mark-mode mark-active) | ||
| 1902 | (push-mark)) | ||
| 1895 | (catch 'done | 1903 | (catch 'done |
| 1896 | (dotimes (_ 2) ; Not making progress is better than infloop. | 1904 | (dotimes (_ 2) ; Not making progress is better than infloop. |
| 1897 | 1905 | ||