emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs doc changes


From: Giorgos Keramidas
Subject: Re: emacs doc changes
Date: Wed, 19 Apr 2006 21:34:41 +0300

On 2006-04-19 20:15, David Kastrup <address@hidden> wrote:
>Ted Zlatanov <address@hidden> writes:
>> On 19 Apr 2006, address@hidden wrote:
>>> Is there a reason not to use unified diffs ("diff -u") when
>>> available?  Of course, not all diff programs can provide them, but
>>> GNU diff does, and patch understands them just as well, and I find
>>> it quite more human-readable (if I consider myself representative
>>> for a human, that is).
>>
>> RMS has asked me for context diffs before, so I'm guessing unified
>> patches are less useful to Emacs maintainers...
>
> I am not sure about that: maybe it is just because not all diff
> programs can deliver unified.  That's why I was asking Eli.
>
>> I can provide -u as well, since I would just do "cvs diff -u"
>> instead of "cvs diff -c".
>
> Well, context diffs certainly are fine enough for use with "patch", so
> there is little reason to post another batch because of that.  I was
> more asking about a general policy.
>
> I have actually customized `diff-switches' to "-u" myself, and it
> would be interesting to hear whether that could cause trouble in any
> way when cooperating with other people.

I think that `context diffs' (poorly named, since -u diffs have context
too, if you ask me), are preferable in some situations.  Mostly when
whole blocks of text change in ways that also include re-indenting
and/or re-formatting of the text.

In the FreeBSD source tree, we prefer seeing unified diffs, but we also
encourage people not to re-wrap or otherwise re-indent code unless
strictly necessary.  This can be harder to read when Elisp source code
changes are part of the diff though, i.e.

|    (when (memq t (mapcar (lambda (buffer)
|                            (with-current-buffer buffer
|                              show-paren-mode))
|                          (buffer-list)))
|      (setq show-paren-idle-timer (run-with-idle-timer
|-                                  show-paren-delay t
|-                                  'old-show-paren-function)))
|+                                  show-paren-delay nil
|+                                  'show-paren-function)))

I can easily think of unified diffs getting *very* ugly with lots of
changes around a loop with several nesting levels.  A "diff -c" patch
tends to group blocks of code in separate areas, marked with '!', so
this would be:

|    (when (memq t (mapcar (lambda (buffer)
|                            (with-current-buffer buffer
|                              show-paren-mode))
|                          (buffer-list)))
|      (setq show-paren-idle-timer (run-with-idle-timer
|!                                  show-paren-delay t
|!                                  'old-show-paren-function)))
|-----------
|    (when (memq t (mapcar (lambda (buffer)
|                            (with-current-buffer buffer
|                              show-paren-mode))
|                          (buffer-list)))
|      (setq show-paren-idle-timer (run-with-idle-timer
|+                                  show-paren-delay nil
|+                                  'show-paren-function)))

Being slightly more verbose, this patch lets one quickly look at the
entire "new loop" without having to mentally "context switch" between
reading only the '-' lines or only the '+' lines.

But I'm just guessing here at why Emacs people prefer "diff -c" patches.

- Giorgos





reply via email to

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