From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Code cleanup. Date: Mon, 23 Oct 2006 15:35:18 -0400 Message-ID: References: <85y7r7l00o.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161632209 10505 80.91.229.2 (23 Oct 2006 19:36:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 Oct 2006 19:36:49 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 23 21:36:43 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gc5b7-0002PU-6t for ged-emacs-devel@m.gmane.org; Mon, 23 Oct 2006 21:36:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gc5b6-0002oU-Ns for ged-emacs-devel@m.gmane.org; Mon, 23 Oct 2006 15:36:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gc5a4-0002CR-5k for emacs-devel@gnu.org; Mon, 23 Oct 2006 15:35:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gc5a2-0002Bv-IN for emacs-devel@gnu.org; Mon, 23 Oct 2006 15:35:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gc5a2-0002Bo-5o for emacs-devel@gnu.org; Mon, 23 Oct 2006 15:35:26 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gc5a1-0001nK-8j; Mon, 23 Oct 2006 15:35:25 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 70A142CF161; Mon, 23 Oct 2006 15:35:24 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id DAD323FE0; Mon, 23 Oct 2006 15:35:18 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id C35D46CABE; Mon, 23 Oct 2006 15:35:18 -0400 (EDT) Original-To: David Kastrup In-Reply-To: <85y7r7l00o.fsf@lola.goethe.zz> (David Kastrup's message of "Mon\, 23 Oct 2006 13\:55\:19 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61057 Archived-At: > 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