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: Sat, 10 Nov 2012 09:58:59 +0100 Organization: Sebastien Vauban Message-ID: <80d2zlvnos.fsf@somewhere.org> References: <87txu9arc8.fsf@gmail.com> 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 1352538018 18663 80.91.229.3 (10 Nov 2012 09:00:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Nov 2012 09:00:18 +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 Sat Nov 10 10:00:26 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 1TX6vR-0007dT-Bc for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Nov 2012 10:00:25 +0100 Original-Received: from localhost ([::1]:49024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TX6vE-0004ke-H3 for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Nov 2012 04:00:12 -0500 Original-Path: usenet.stanford.edu!goblin3!goblin2!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: 63 Injection-Info: mx04.eternal-september.org; posting-host="5da807328d6a3351ee2b595083918cf6"; logging-data="27193"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1+C+eQ6dnalidljro29RwL9" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:1M09rBQWyrEa/gplS/na5XFIuNI= sha1:VZmcjr2NTm0UKyi87VX7vEMOgPU= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:195303 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:87625 Archived-At: Hello Tom, Stefan and all, Tom wrote: > Tom gmail.com> writes: >> >> (diff-auto-refine-mode 1) > > Turns out it only refines one hunk (the current) and the others only if y= ou > use hunk navigation commands (diff-auto-refine-mode does this which is on= by > default in Emacs 24). So to refine all hunks automatically, do this in the > diff hook: > > (save-excursion > (goto-char (point-min)) > (while (not (eobp)) > (diff-hunk-next)))) I'd like to get that feature as well. However, the above code causes me 2=C2=A0problems: - 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; - occasionally, an error message "no hunk found" when reading an email with= a patch file in it. I patched your code to try and avoid those problems, by: - adding a condition-case nil... error construct - using save-excursion - using an explicit goto-char min - ... Here is my current code: --8<---------------cut here---------------start------------->8--- ;; enable Diff Auto Refine mode (highlight the changes with better ;; granularity) (add-hook 'diff-mode-hook (lambda () ;; refine all hunks automatically (when (>=3D (diff-end-of-hunk) 1) ;; avoid "No hunk found" error (goto-char (point-min)) (while (not (eobp)) (diff-hunk-next))) (goto-char (point-min)))) --8<---------------cut here---------------end--------------->8--- ... but that does not help... I still have the two above mentioned problems... Any idea? Best regards, Seb -- Sebastien Vauban