0

By default, when I activate mark it just adds everything to the region up to the point which is behind the cursor (image below)

enter image description here

What I want to achieve, however, is to also include - as part of my region. It's especially helpful when I kill the region. Almost always when I jump to a target character (using avy), and kill the region, I miss the last character, which is what I jumped to.

1 Answer 1

1

In Emacs, the region is defined precisely (and only) as the stretch of text between point and the mark. The only way to achieve what you want is to position point where you want the region to extend to. The simplest, least automated way is to remember to execute forward-char (C-f in vanilla Emacs).

You may find these useful replacements for forward-word and backward-word:

(defun forward-to-word-boundary (arg)
  "Move forward until encountering the beginning or end of a word.
With ARG, do this that many times."
  (interactive "p")
  (or (eobp)
      (re-search-forward "\\w\\b\\|\\W\\b" nil t arg)
      (goto-char (point-max))))

(defun backward-to-word-boundary (arg)
  "Move backward until encountering the beginning or end of a word.
With ARG, do this that many times."
  (interactive "p")
  (or (bobp)
      (re-search-backward "\\b\\w\\|\\W\\b" nil t arg)
      (goto-char (point-min))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.