Subject: bug#20357: 25.0.50; deactivate-mark behavior broken

From: Oleh Krehel <[email-masked]>
Date: Fri, 17 Apr 2015 18:02:57 +0200

Hi Stefan,

On Fri, Apr 17, 2015 at 4:31 PM, Stefan Monnier
<[email-masked]> wrote:
>> (let (deactivate-mark)
>>   (indent-region (region-beginning)
>>                  (region-end)))
>> Expected behavior: the mark isn't deactivated.
>> Actual behavior: the mark is deactivated.
>
> Oops, indeed.  Fixed with the patch below,
>
> diff --git a/lisp/indent.el b/lisp/indent.el
> index 74e73a6..18c1fd4 100644
> --- a/lisp/indent.el
> +++ b/lisp/indent.el
> @@ -537,7 +537,7 @@ column to indent to; if it is nil, use one of the three methods above."
>    ;; In most cases, reindenting modifies the buffer, but it may also
>    ;; leave it unmodified, in which case we have to deactivate the mark
>    ;; by hand.
> -  (deactivate-mark))
> +  (setq deactivate-mark t))
>
>  (defun indent-relative-maybe ()
>    "Indent a new line like previous nonblank line.

This is still not the correct behavior. Example code:

(with-temp-buffer
  (insert "foobar")
  (set-mark (point))
  (goto-char (point-min))
  (indent-region (point-min)
                 (point-max))
  mark-active)

In 24.5 it returns nil, which is correct. While in 25 it returns t.

Oleh