Skip to content

Commit c8217a3

Browse files
authored
Fix rust-insert-dbg for emacs-version < 25. (#339)
1 parent 1b3db88 commit c8217a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rust-mode.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,8 +1805,11 @@ visit the new file."
18051805
(defun rust-insert-dbg ()
18061806
"Insert the dbg! macro."
18071807
(cond ((region-active-p)
1808-
(insert-parentheses)
1809-
(backward-char 1))
1808+
(when (< (mark) (point))
1809+
(exchange-point-and-mark))
1810+
(let ((old-point (point)))
1811+
(insert-parentheses)
1812+
(goto-char old-point)))
18101813
(t
18111814
(insert "(")
18121815
(forward-sexp)

0 commit comments

Comments
 (0)