all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Code cleanup.
Date: Mon, 23 Oct 2006 15:35:18 -0400	[thread overview]
Message-ID: <jwvy7r6g7dm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <85y7r7l00o.fsf@lola.goethe.zz> (David Kastrup's message of "Mon\, 23 Oct 2006 13\:55\:19 +0200")

> in the course of checking the code for call-interactively (I have a
> tendency to read code rather than the documentation), I felt a bit
> like coming upon an obfuscated C contest.

> I attach a patch (untested though) that does nothing except hopefully
> get a more readable code.

> Ok, so we are in freeze anyway, so tampering with any code that works
> by replacing it with code designed to be completely equivalent is
> probably not worth the potential trouble.

> At what stage of development (if at all) should such janitorial
> changes be usually applied?

> And are there others that would agree with my assessment concerning
> the readability here, or that would have even better ideas how this
> would be expressed more obvious?

I'd replace

      if (*tem == 'r')
	j += 2;
      else
	j++;

with
 
      j += (*tem == 'r' ? 2 : 1);

but overall, it's a bit better.  In any case, I'd rather move most of it
to elisp, adding an alist variable that maps letters to the
corresponding function.

> On a completely different tangent: wouldn't it be much more readable
> (though likely not completely correct in some perverse manner) if
> diff-mode actually had its TAB positions in column 9,17,25... instead
> of the customary 8,16,24...?  At least in context and unified diffs,
> that would _much_ better reflect the relative indentation of the
> actual change than the current behavior.

For unified diffs, yes.  But for plain context diffs like the one you sent,
it'd have to be 10, 18, 26, ... and for files mixing the two it'd have to
be.... oh no!

Of course, it could all be done with display properties added from
diff-font-lock-keywords (and work even for mixed diffs).


        Stefan

  parent reply	other threads:[~2006-10-23 19:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23 11:55 Code cleanup David Kastrup
2006-10-23 16:50 ` Kim F. Storm
2006-10-23 17:29   ` David Kastrup
2006-10-23 18:03     ` David Kastrup
2006-10-23 19:35 ` Stefan Monnier [this message]
2006-10-25 18:03 ` Richard Stallman
2006-10-25 19:01   ` David Kastrup

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

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

  git send-email \
    --in-reply-to=jwvy7r6g7dm.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.