Skip to content

Selection being automatically undone after command ends? #407

Answered by okamsn
okamsn asked this question in Q&A
Discussion options

You must be logged in to vote

Answer is to wrap modifications to the buffer with setting deactivate-mark to nil.

Example from other reply:

(defun my-meow-delete-surrounds (thing)
  "Delete the delimiters that define the chosen thing, then select what remains."
  (interactive (list (meow-thing-prompt "Thing: ")))
  (pcase-let* ((`(,bounds-beg . ,bounds-end) (meow--parse-bounds-of-thing-char thing))
               (`(,inner-beg . ,inner-end) (meow--parse-inner-of-thing-char thing))
               (beg-dist (- inner-beg bounds-beg)))
    (let ((deactivate-mark nil))
      (delete-region bounds-beg inner-beg)
      (delete-region (- inner-end  beg-dist)
                     (- bounds-end beg-dist)))
    (meow--select-range 

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@DogLooksGood
Comment options

@okamsn
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by okamsn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants