[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Diff could also show the changes within lines

From: Sebastien Vauban
Subject: Diff could also show the changes within lines
Date: Fri, 07 Feb 2014 17:50:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)


This code, obtained after several iterations in October 2012 [1], did work
for some time.

Though, I can't get it working anymore with GNU Emacs
(i686-pc-mingw32) of 2013-10-19.

--8<---------------cut here---------------start------------->8---
  ;; mode for viewing/editing context diffs
  (with-eval-after-load "diff-mode"

    ;; highlight the changes with better granularity
    (defun my-diff-make-fine-diffs ()
      (let (diff-auto-refine-mode)      ; avoid refining the hunks redundantly 
        (condition-case nil
              (goto-char (point-min))
              (while (not (eobp))
                (diff-refine-hunk)))    ; ... when this does it.
          (error nil))
        (run-at-time 0.0 nil
                     (lambda ()
                       (if (eq major-mode 'diff-mode)
                           ;; put back the cursor only if still in a Diff buffer
                           ;; after the delay
                           (goto-char (point-min)))))))

    (defun my-diff-make-fine-diffs-if-necessary ()
      "Auto-refine only the small regions."
      (unless (> (buffer-size) 20000)

    ;; enable Diff Auto-Refine mode
    (add-hook 'diff-mode-hook
--8<---------------cut here---------------end--------------->8---

Now, while it's still being called, and still going in the `while' loop,
it does not refine any hunk anymore...

Any idea on what could go wrong?

Best regards,

[1] See!msg/

Sebastien Vauban

reply via email to

[Prev in Thread] Current Thread [Next in Thread]