diff options
| author | Nathan Moreau <nathan.moreau@m4x.org> | 2019-11-03 01:09:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-03 01:09:43 +0100 |
| commit | c8217a3a7b3f1ef0c101f040d182c08833d0f38e (patch) | |
| tree | 868ec097fe7af33695b808d518f7a620f3bcf8cc | |
| parent | 1b3db883bccb0956e5f05b7312485b2b7a5fa70f (diff) | |
| download | rust-mode-c8217a3a7b3f1ef0c101f040d182c08833d0f38e.tar.gz | |
Fix rust-insert-dbg for emacs-version < 25. (#339)
| -rw-r--r-- | rust-mode.el | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el index 42b8d82..b381893 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1805,8 +1805,11 @@ visit the new file." (defun rust-insert-dbg () "Insert the dbg! macro." (cond ((region-active-p) - (insert-parentheses) - (backward-char 1)) + (when (< (mark) (point)) + (exchange-point-and-mark)) + (let ((old-point (point))) + (insert-parentheses) + (goto-char old-point))) (t (insert "(") (forward-sexp) |
