2

Use (interactive "^") instead of (interactive). C-h f interactive tells you, way down near the bottom: If the string begins with ^ and shift-select-mode is non-nil, Emacs first calls the function handle-shift-selection. In your case, the commands do not take an argument. But you can still use a string argument to interactive, in this case "^", to ...


2

You can probably do something like (defvar my-old-region-bounds nil) (advice-add 'handle-shift-selection :around (lambda (orig-fun) (let ((was-active (region-active-p))) (funcall orig-fun) (when (and was-active (not (region-active-p))) (setq-local my-old-region-bounds (cons (point-marker) (mark-marker))) ...


1

I found a solution, feel free to comment / improve. (advice-add 'handle-shift-selection :before (lambda () (setq-local was-active (region-active-p)))) (bind-key* "M-l" (lambda (arg) (interactive "^p") (if (and was-active (not (region-active-p))) (goto-char (region-end)) ...


1

You need to say that this command is a navigation command, by replacing your (interactive) with (interactive "^") C-h o interactive RET explains that: [...] If the string begins with ^ and shift-select-mode is non-nil, Emacs first calls the function handle-shift-selection. [...]


1

Base on the implementation of the function handle-shift-selection, you can try something like this (defun isearch-exit-mark-match () "Exit isearch and mark the current match." (interactive) (isearch-exit) (setq-local transient-mark-mode (cons 'only transient-mark-mode)) (push-mark isearch-other-end nil t)) (define-key isearch-mode-...


1

Based on clues from lawlist's comments, reading around the area of "Key Sequence Input" in the elisp info file, and an explanation of defadvice that even I can understand, here, I added this to my .emacs: (defadvice org-backward-paragraph (before set-up-shift-select-backward-paragraph activate) (interactive "^")) (defadvice org-forward-paragraph (...


1

Not built in but another package for this is called objed (I'm the author). You can mark any text object with m the point is moved to the next object of current type automatically. Unmark any object by navigating to it and press m again. Here is an example screencast:


1

You need to set variable transient-mark-mode to a special value: a cons with only as its car: (defun sandric/select-symbol-under-cursor () "Select symbol under cursor." (interactive) (unless (region-active-p) (let* ((bounds (bounds-of-thing-at-point 'symbol)) (beginning (car bounds)) (ending (cdr bounds))) (...


Only top voted, non community-wiki answers of a minimum length are eligible