From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Diff faces Date: Mon, 15 Oct 2007 00:30:29 +0300 Organization: JURTA Message-ID: <87ir594b8f.fsf@jurta.org> References: <87tzoxqk2y.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1192398872 1122 80.91.229.12 (14 Oct 2007 21:54:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Oct 2007 21:54:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 14 23:54:21 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IhBPg-0001dC-Rs for ged-emacs-devel@m.gmane.org; Sun, 14 Oct 2007 23:54:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IhBPa-0002AG-20 for ged-emacs-devel@m.gmane.org; Sun, 14 Oct 2007 17:54:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IhBPW-00029s-03 for emacs-devel@gnu.org; Sun, 14 Oct 2007 17:54:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IhBPT-00029g-MX for emacs-devel@gnu.org; Sun, 14 Oct 2007 17:54:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IhBPT-00029d-Db for emacs-devel@gnu.org; Sun, 14 Oct 2007 17:54:07 -0400 Original-Received: from gnome.kiev.sovam.com ([212.109.32.24]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IhBPT-0005wg-1K for emacs-devel@gnu.org; Sun, 14 Oct 2007 17:54:07 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by gnome.kiev.sovam.com with esmtp (Exim 4.67 (FreeBSD)) (envelope-from ) id 1IhBPR-000Jp3-EY; Mon, 15 Oct 2007 00:54:05 +0300 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1IhBPP-00086R-7g; Mon, 15 Oct 2007 00:54:03 +0300 In-Reply-To: (Stefan Monnier's message of "Thu\, 11 Oct 2007 21\:21\:19 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-Scanner-Signature: e5a023dad48cfed04c9aaaf8a25ccfed X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1603 [Oct 14 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Info: {TO: local part of email appears in body} X-SpamTest-Method: none X-SpamTest-Rate: 35 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:80873 Archived-At: >> Wouldn't it be better to use the same colors for equivalent faces of >> ediff, smerge and diff-mode? So that ediff-fine-diff-B, diff-fine-change >> and smerge-refined-change will be the same and so on. > > Could be. My use of faces (i.e. "mostly no colors, only font/size/darkness > changes") is rather atypical and I simply cannot imagine how people live > with the default angry fruit-salad, so I prefer to let other people deal > with it. I like the current shadows-of-gray color scheme used in diff-mode. And even ediff uses similar gray colors to highlight inactive hunks. The only complaint I currently have is that the yellow color of the new face `diff-fine-change' doesn't fit into this scheme. What do you think about changing it to a shadow of gray? Alternatively, you could use fruit-salad colors only for the refined hunk in diff-mode (similar to the colors of the active hunk in ediff). BTW, I think the current character-wise refinement in diff-mode and in smerge-mode is not very useful. More useful would be to refine it on the word or symbol basis. I have an experimental patch that produces good results. It splits original hunks symbol-by-symbol (though word-by-word works as well) and compares them ignoring whitespace differences. Would you like to improve diff-mode and smerge-mode with something like this? Index: lisp/smerge-mode.el =================================================================== RCS file: /sources/emacs/emacs/lisp/smerge-mode.el,v retrieving revision 1.53 diff -u -r1.53 smerge-mode.el --- lisp/smerge-mode.el 9 Oct 2007 03:38:56 -0000 1.53 +++ lisp/smerge-mode.el 14 Oct 2007 21:30:03 -0000 @@ -667,22 +667,33 @@ (insert-buffer-substring buf beg end) (when preproc (goto-char (point-min)) (funcall preproc)) (goto-char (point-min)) + (while (search-forward "\n" nil t) + (replace-match "" nil nil)) + (goto-char (point-min)) (while (not (eobp)) - (forward-char 1) + (save-match-data (forward-symbol 1)) ;; We add \n after each char except after \n, so we get one line per ;; text char, where each line contains just one char, except for \n ;; chars which are represented by the empty line. - (unless (eq (char-before) ?\n) (insert ?\n))) + (insert ?\n)) (let ((coding-system-for-write 'emacs-mule)) (write-region (point-min) (point-max) file nil 'nomessage))))) (defun smerge-refine-highlight-change (buf beg match-num1 match-num2 props) (let* ((startline (string-to-number (match-string match-num1))) + (len1 (1- startline)) + (len2 (if (match-end match-num2) + (string-to-number (match-string match-num2)) + startline)) (ol (make-overlay - (+ beg startline -1) - (+ beg (if (match-end match-num2) - (string-to-number (match-string match-num2)) - startline)) + (with-current-buffer buf + (goto-char beg) + (save-match-data (forward-symbol len1)) + (point)) + (with-current-buffer buf + (goto-char beg) + (save-match-data (forward-symbol len2)) + (point)) buf ;; Make them tend to shrink rather than spread when editing. 'front-advance nil))) @@ -710,7 +721,7 @@ (let ((coding-system-for-read 'emacs-mule)) ;; Don't forget -a to make sure diff treats it as a text file ;; even if it contains \0 and such. - (call-process diff-command nil t nil "-a" file1 file2)) + (call-process diff-command nil t nil "-awb" file1 file2)) ;; Process diff's output. (goto-char (point-min)) (while (not (eobp)) -- Juri Linkov http://www.jurta.org/emacs/