In most modern editors, after canceling a selection by a left/right motion, the cursor will be moved to the beginning/end of the previously-selected region correspondingly. Similarly, if we cancel a selection by a up/down motion, the cursor will be moved up/down one line from the beginning/end of the previously-selected region correspondingly.
Could we have the same behaviors in Emacs under
I tried to define my own movement function:
(bind-key* "M-l" (lambda (arg) (interactive "^p") (if (use-region-p) (goto-char (region-end)) (syntax-subword-forward arg))))
But it doesn't work. The
goto-char never run even if I am selecting a region. Is it because I used
(interactive "^p")? Any solution?