GNU bug report logs - #32991
27.0.50; diff-auto-refine-mode a no-op

Previous Next

Package: emacs;

Reported by: charles <at> aurox.ch

Date: Mon, 8 Oct 2018 18:28:01 UTC

Severity: normal

Tags: fixed

Found in version 27.0.50

Fixed in version 27.1

Done: charles <at> aurox.ch

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: charles <at> aurox.ch (Charles A. Roelli)
Cc: 32991 <at> debbugs.gnu.org
Subject: bug#32991: 27.0.50; diff-auto-refine-mode a no-op
Date: Sun, 13 Jan 2019 18:33:15 -0500
> -(defcustom diff-font-lock-refine t
> -  "If non-nil, font-lock highlighting includes hunk refinement."
> +(defcustom diff-refine 'font-lock
> +  "If non-nil, enable hunk refinement.
> +
> +The value `font-lock' means to refine during font-lock.
> +The value `navigation' means to refine each hunk as you visit it
> +with `diff-hunk-next' or `diff-hunk-prev'.
> +
> +You can always manually refine a hunk with `diff-refine-hunk'."
>    :version "27.1"
> -  :type 'boolean)
> +  :type '(choice (const :tag "Don't refine hunks" nil)
> +                 (const :tag "Refine hunks during font-lock" font-lock)
> +                 (const :tag "Refine hunks during navigation" navigation)))

Good.

> -(define-minor-mode diff-auto-refine-mode
> -  "Toggle automatic diff hunk finer highlighting (Diff Auto Refine mode).
> -
> -Diff Auto Refine mode is a buffer-local minor mode used with
> -`diff-mode'.  When enabled, Emacs automatically highlights
> -changes in detail as the user visits hunks.  When transitioning
> -from disabled to enabled, it tries to refine the current hunk, as
> -well."
> -  :group 'diff-mode :init-value t :lighter nil ;; " Auto-Refine"
> -  (when diff-auto-refine-mode
> -    (condition-case-unless-debug nil (diff-refine-hunk) (error nil))))

I think for backward compatiblity reason, we should keep this minor
mode, tho mark it obsolete and change its code to set diff-refine to
`navigation`.

> -;; Define diff-{hunk,file}-{prev,next}
> -(easy-mmode-define-navigation
> - diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view
[...]
> +(defun diff-hunk-next (&optional count interactive)
[...]
> +(defun diff-hunk-prev (&optional count interactive)

This change seems unrelated.  I'd rather we stick to the refinement itself.

>  ;; Define smerge-next and smerge-prev
>  (easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
> -  (if diff-auto-refine-mode
> +  (if (eq diff-refine 'navigation)
>        (condition-case nil (smerge-refine) (error nil))))

Hmm... I want to set my `diff-refined` to `font-lock` yet I also want my
smerge conflicts to be refined when I navigate to them.
Maybe the test here should be just whether diff-refine is non-nil?


        Stefan




This bug report was last modified 6 years and 76 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.