all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: emacs-devel@gnu.org
Subject: Re: toggling diff-auto-refine
Date: Sun, 30 Dec 2007 18:03:22 +0100	[thread overview]
Message-ID: <87tzm0nmhx.fsf@ambire.localdomain> (raw)
In-Reply-To: <87prwpr42e.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Sat, 29 Dec 2007 15:03:21 +0100")

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

i see that smerge-mode.el has a similar feature,
so now have expanded the initial proposal slightly.

patch description:

  Merge `smerge-auto-refine' and `diff-auto-refine'
  variables into `diff-auto-refine' minor mode.

motivation:

  for convenience.  w/o the minor mode, you have to do

   M-: (setq diff-auto-refine (not diff-auto-refine)) RET

  followed by `C-c C-b' (diff-refine-hunk) when you want it.
  w/ the minor mode, you can do

   M-x diff-auto-refine RET

entry for lisp/ChangeLog:

  * smerge-mode.el: Require diff-mode when compiling.
  (smerge-auto-refine): Delete defcustom var.
  (smerge-next, smerge-prev): Use diff-auto-refine.
  * diff-mode.el (diff-auto-refine): Delete defcustom var.
  (diff-auto-refine): New minor mode (command + var).

diff below.  any objections?

thi


_______________________________________________________

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: .ttn.diff-auto-refine.diff --]
[-- Type: text/x-diff, Size: 3600 bytes --]

*** lisp/smerge-mode.el.~1.58.~	Fri Nov 23 08:59:10 2007
--- lisp/smerge-mode.el	Sun Dec 30 17:23:09 2007
***************
*** 46,52 ****
  
  ;;; Code:
  
! (eval-when-compile (require 'cl))
  
  
  ;;; The real definition comes later.
--- 46,52 ----
  
  ;;; Code:
  
! (eval-when-compile (require 'cl) (require 'diff-mode))
  
  
  ;;; The real definition comes later.
***************
*** 79,89 ****
    :group 'smerge
    :type 'boolean)
  
- (defcustom smerge-auto-refine t
-   "Automatically highlight changes in detail as the user visits conflicts."
-   :group 'smerge
-   :type 'boolean)
- 
  (defface smerge-mine
    '((((min-colors 88) (background light))
       (:foreground "blue1"))
--- 79,84 ----
***************
*** 258,264 ****
  
  ;; Define smerge-next and smerge-prev
  (easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
!   (if smerge-auto-refine
        (condition-case nil (smerge-refine) (error nil))))
  
  (defconst smerge-match-names ["conflict" "mine" "base" "other"])
--- 253,259 ----
  
  ;; Define smerge-next and smerge-prev
  (easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
!   (if diff-auto-refine
        (condition-case nil (smerge-refine) (error nil))))
  
  (defconst smerge-match-names ["conflict" "mine" "base" "other"])
*** lisp/diff-mode.el.~1.122.~	Tue Oct 30 11:53:38 2007
--- lisp/diff-mode.el	Sun Dec 30 17:18:58 2007
***************
*** 90,100 ****
    :type 'boolean
    :group 'diff-mode)
  
- (defcustom diff-auto-refine t
-   "Automatically highlight changes in detail as the user visits hunks."
-   :type 'boolean
-   :group 'diff-mode)
- 
  (defcustom diff-mode-hook nil
    "Run after setting up the `diff-mode' major mode."
    :type 'hook
--- 90,95 ----
***************
*** 198,203 ****
--- 193,209 ----
    `((,diff-minor-mode-prefix . ,diff-mode-shared-map))
    "Keymap for `diff-minor-mode'.  See also `diff-mode-shared-map'.")
  
+ (define-minor-mode diff-auto-refine
+   "Automatically highlight changes in detail as the user visits hunks.
+ Additionally, when in Diff mode, refine the current hunk.
+ When not in Diff mode, clear variable `diff-auto-refine' unconditionally."
+   :group 'diff-mode :init-value nil :lighter " Auto-Refine"
+   ;; If the "auto refinement" concept becomes useful in
+   ;; other contexts, we can remove this sanity check.  --ttn
+   (setq diff-auto-refine (when (eq 'diff-mode major-mode)
+                            diff-auto-refine))
+   (when diff-auto-refine
+     (condition-case-no-debug nil (diff-refine-hunk) (error nil))))
  
  ;;;;
  ;;;; font-lock support
*** etc/NEWS.~1.1632.~	Sat Dec 29 01:19:53 2007
--- etc/NEWS	Sun Dec 30 17:24:36 2007
***************
*** 258,267 ****
  This is enabled if isearch-buffers-multi is non-nil.
  
  ** smerge-refine highlights word-level details of changes in conflict.
- It's used automatically as you move through conflicts, see smerge-auto-refine.
- 
  ** diff-refine-hunk highlights word-level details of changes in a diff hunk.
! It's used automatically as you move through hunks, see diff-auto-refine.
  
  ** archive-mode has basic support to browse Rar archives.
  
--- 258,266 ----
  This is enabled if isearch-buffers-multi is non-nil.
  
  ** smerge-refine highlights word-level details of changes in conflict.
  ** diff-refine-hunk highlights word-level details of changes in a diff hunk.
! Both of these can be done automatically as you move through hunks.
! See diff-auto-refine.
  
  ** archive-mode has basic support to browse Rar archives.
  


Diffs between working revision and workfile end here.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-12-30 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-29 14:03 toggling diff-auto-refine Thien-Thi Nguyen
2007-12-30 17:03 ` Thien-Thi Nguyen [this message]
2008-01-02  2:37 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tzm0nmhx.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.