[PATCH] emacs: globally replace non-branching "(if COND (progn ..." with "(when ..."

Pieter Praet pieter at praet.org
Sun Jan 29 23:03:59 PST 2012


On Sat, 28 Jan 2012 08:41:36 -0400, David Bremner <david at tethera.net> wrote:
> On Sat, 14 Jan 2012 10:17:18 +0100, Pieter Praet <pieter at praet.org> wrote:
> > Less code, same results, without sacrificing readability.
> > 
> 
> This looks OK, although the re-indenting makes these kind of changes
> painful to review (not that I'm suggesting we should re-indent, just
> some random complaining).
> 

You can use `diff-refine-hunk' to see what the actual changes are.

Try this:

  #+begin_src emacs-lisp
    (global-set-key (kbd "C-c /")
                    (lambda()
                      "Refine display of unified diff hunks"
                      (interactive)
                      (save-excursion
                        (goto-char (point-min))
                        (while (re-search-forward
                                diff-hunk-header-re-unified
                                nil t)
                          (diff-refine-hunk)))))
  #+end_src

Work pretty much *anywhere*.

Note: it does NOT work in `notmuch-show-mode' (not even with
`notmuch-wash-convert-inline-patch-to-part' disabled), but this is
easily solved by first running `notmuch-show-view-raw-message' ("V")
and `diff-mode' (to fontify the buffer)...

> d
> 
> 


Peace

-- 
Pieter


More information about the notmuch mailing list