bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17544: 24.3; [PATCH] Improved diff-mode navigation/manipulation


From: npostavs
Subject: bug#17544: 24.3; [PATCH] Improved diff-mode navigation/manipulation
Date: Sat, 03 Sep 2016 23:27:50 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Dima Kogan <dima@secretsauce.net> writes:

>
>> and the whole issue of testing called-interactively-p that goes with
>> it.  Can you explain?
>
> I'm guessing the interactivity checking in diff-hunk-next and
> diff-hunk-prev was intended to keep scripts working as before. Again, it
> has been too long to remember specifically.

IMO, it would make more sense to just define your new commands directly,
something like:

    (defun diff-hunk-next-command (&optional count)
      "<A useful description goes here>."
      (interactive "p")
      (let ((start (point)))
        (let ((hunk-bounds (diff-bounds-of-hunk)))
          (goto-char (car hunk-bounds)))
        (diff-hunk-next count)
        (when (not (looking-at diff-hunk-header-re))
          (goto-char start)
          (user-error "No next hunk"))))   

And then just give the *binding* of `diff-hunk-next' to
`diff-hunk-next-command'.  No need to make a higher order wrapper
function just for defining 2 functions.





reply via email to

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