From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Re: Diff could also show the changes within lines Date: Wed, 14 Nov 2012 15:31:51 +0100 Organization: Sebastien Vauban Message-ID: <80vcd8l0h4.fsf@somewhere.org> References: <87txu9arc8.fsf@gmail.com> <80d2zlvnos.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1352903719 7900 80.91.229.3 (14 Nov 2012 14:35:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Nov 2012 14:35:19 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Wed Nov 14 15:35:30 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TYe3p-0003ee-1Y for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Nov 2012 15:35:25 +0100 Original-Received: from localhost ([::1]:59813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYe3e-0007ky-U7 for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Nov 2012 09:35:14 -0500 Original-Path: usenet.stanford.edu!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 82 Injection-Info: mx04.eternal-september.org; posting-host="368fa3c7dc5c1bbe516391bd65bd1ab2"; logging-data="12321"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1/hUT4B0qoqqWyl+8FlPXF2" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:QgkpgAmzGa/kuwYjiBRygAw5ZyY= sha1:ipq4ApqZgst591Wb2jQqe/izIlQ= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:195362 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:87685 Archived-At: Hi Tom, Tom wrote: > Sebastien Vauban writes: >> I'd like to get that feature as well. However, the above code causes me >> 2=C2=A0problems: >>=20 >> - only the last hunk is getting refined, both in VC dir's buffer, or when >> reading (with Gnus) an email with a patch file in it; > > Currently I use this code added to the diff mode hook: > > (defun my-refine-all-diff-hunks () > (interactive) > (condition-case nil=20=20=20=20=20=20 > (save-excursion > (goto-char (point-min)) > (while (not (eobp)) > (diff-hunk-next))) > (error nil))) > > It works well for me, it highlights the changes in all hunks automaticall= y. > I use it only for diffing before checkin. > > But. It works only because the VC mercurial implementation calls the back= end > synchronously. In case of DVC it doesn't work for me, because DVC calls t= he > backend asynchronously, so when the diff hook is run the output is not th= ere > yet and I did not find a hook which is called when the async diff command= is > finished > > You may want to check how the diff output is produced in your use cases. = If > it is done asynchronously then the diff hook is not a suitable place to c= all > the highlighting code from. I'm not sure how to check for that, but I could reduce all my `.emacs' file= to an example file which shows the problem on the current development snapshot= of the future Emacs 24.3 (from 2012-10-22): --8<---------------cut here---------------start------------->8--- ;;; emacs-minimal.el (setenv "LC_ALL" "C") ;; enable Diff Auto Refine mode (highlight the changes with better ;; granularity) (defun my/diff-refine-all-hunks () (interactive) (condition-case nil (save-excursion (goto-char (point-min)) (while (not (eobp)) (diff-hunk-next))) (error nil))) (add-hook 'diff-mode-hook 'my/diff-refine-all-hunks) (message "%s" (emacs-version)) (sit-for 1) --8<---------------cut here---------------end--------------->8--- You can see, in the screencast on http://screencast.com/t/JOlsyWHh, that: - the cursor goes to the end of the diff - only the last diff is refined (see the string " for Diff" which should be highlighted in the first hunk) Best regards, Seb --=20 Sebastien Vauban