unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Keith Waclena <keith@lib.uchicago.edu>
To: Samuel Wales <samologist@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: fine differences for entire diff in diff mode
Date: Fri, 06 Jul 2018 11:06:07 -0500	[thread overview]
Message-ID: <x7po00nyc0.fsf@lib.uchicago.edu> (raw)
In-Reply-To: <CAJcAo8sdZJs9bTTLQXacDcxtVsQLC=q75SBNaTJMF7rBy28Spw@mail.gmail.com> (Samuel Wales's message of "Tue, 19 Jun 2018 13:02:28 -0700")

Samuel Wales <samologist@gmail.com> writes:

> i know that i can do fine differences for a hunk.
>
> is there a command to do fine differences for the entire buffer?
>
> thanks.

I wanted the same thing and couldn't find it, so I wrote this:

(defun kw-diff-highlights ()
  "Plow through all the hunks in this diff, which has the side-effect of refining
the micro-differences in each."
  (save-excursion
    (goto-char (point-min))
    (let ((pr (make-progress-reporter "Refining diff hunks... ")))
      (condition-case err
          (while t                      ; loop exited when diff-hunk-next raises an error at EOB
            (progress-reporter-update pr)
            (diff-hunk-next))
        (user-error nil)
        (error (message "kw-diff-highlights: unexpected error: %S" err)))
      (progress-reporter-done pr))))

(add-hook 'diff-mode-hook 'kw-diff-highlights)


--
Keith Waclena / Arch Linux / OCaml / M-x / ATKQJ / YASD / gc'e'a' / \clef treble
http://www.lib.uchicago.edu/keith/    gpg 5DA89C7DECA0D55A
n.p.: I'll Make You Sorry (Screaming Females)



  parent reply	other threads:[~2018-07-06 16:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 20:02 fine differences for entire diff in diff mode Samuel Wales
2018-07-05 18:55 ` Samuel Wales
2018-07-06 16:06 ` Keith Waclena [this message]
2018-07-06 21:33   ` Samuel Wales
2018-07-11 14:28 ` Stefan Monnier
2018-07-11 16:51   ` Andy Moreton
2018-07-15 13:33     ` Stefan Monnier
2018-07-21 23:39   ` Samuel Wales

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=x7po00nyc0.fsf@lib.uchicago.edu \
    --to=keith@lib.uchicago.edu \
    --cc=help-gnu-emacs@gnu.org \
    --cc=samologist@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).