Subject: Re: bug#10056: 24.0.91; Mark deactivation

From: Juri Linkov <[email-masked]>
Date: Sun, 09 Dec 2012 01:03:52 +0200

>> As I pointed out previously in this thread, the mark should be
>> deactivated (in general - there can be some exceptions) after any
>> command that operates on the active region.  Not doing so is annoying,

The problem is how to implement a general rule "the mark should be
deactivated after any command that operates on the active region".
One way to define "operates on the active region" is when a command
uses `region-beginning' and `region-end'.  You can try this definition
by evaluating:

(defun deactivate-mark--advice () (setq deactivate-mark t))
(advice-add 'region-beginning :after #'deactivate-mark--advice)
(advice-add 'region-end       :after #'deactivate-mark--advice)

Does this do what you want with the following functions?

>> There are still cases where I observe this misbehavior.  Namely:
>>
>>   kill-region [1]
>>   kill-rectangle [1]
>>   prepend-to-register
>>   append-to-register
>>   narrow-to-region [2]
>>   c-indent-line-or-region [3]
>>   delete-duplicate-lines [3]
>>   delete-matching-lines [3]
>>   delete-non-matching-lines [3]
>>   delete-blank-lines [3]
>
> Add "fill-paragraph [3]" to the above list.  Important use-case.

Does this have a side effect undesirable for other functions?