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: Mon, 10 Feb 2014 16:55:24 +0100 Organization: Sebastien Vauban Message-ID: <867g930xoz.fsf@somewhere.org> References: <86y51mx3x2.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392048009 14265 80.91.229.3 (10 Feb 2014 16:00:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Feb 2014 16:00:09 +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 Mon Feb 10 17:00:18 2014 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 1WCtHN-0003d0-Qx for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 17:00:17 +0100 Original-Received: from localhost ([::1]:56232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtHN-0001zN-IG for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 11:00:17 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 83 Injection-Info: mx05.eternal-september.org; posting-host="402b34550bd938aa98825778083dce0e"; logging-data="16989"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX18otGg8IONLJq5t2I3wwTX8" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:X5eX5D/YLKxJmcOE+0u0KXS1zis= sha1:xztTPrPtjsgDdwfCIlQZBRluPm0= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:203751 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:96021 Archived-At: Hello Michael, Michael Heerdegen wrote: > "Sebastien Vauban" writes: > >> Now, while it's still being called, and still going in the `while' loop, >> it does not refine any hunk anymore... > > Did you try to edebug (this looks like a good exercise in debugging!)? I did, in a minimal Emacs configuration: --8<---------------cut here---------------start------------->8--- (load-theme 'leuven t) ;; mode for viewing/editing context diffs (with-eval-after-load "diff-mode" (defun my-diff-make-fine-diffs () "Enable Diff Auto Refine mode." (interactive) (message ">>> BEGIN <<<") (let (diff-auto-refine-mode) (condition-case nil (save-excursion (goto-char (point-min)) (while (not (eobp)) (diff-hunk-next) (diff-refine-hunk) (message ">> I've refined the next hunk... <<"))) (error nil)) (run-at-time 0.0 nil (lambda () (if (eq major-mode 'diff-mode) ;; put back the cursor only if still in a Diff buffer ;; after the delay (goto-char (point-min)))))) (message ">>> END <<<")) (defun my--diff-make-fine-diffs-if-necessary () "Auto-refine only the regions of 14,000 bytes or less." ;; check for auto-refine limit (unless (> (buffer-size) 14000) (my-diff-make-fine-diffs))) (add-hook 'diff-mode-hook 'my--diff-make-fine-diffs-if-necessary)) --8<---------------cut here---------------end--------------->8--- Weirdly enough, it does not work when done automatically, well when done interactively... In *all* cases, I see (in the *Messages* buffer): --8<---------------cut here---------------start------------->8--- >>> BEGIN <<< >> I've refined the next hunk... << [2 times] >>> END <<< --8<---------------cut here---------------end--------------->8--- ... so, even when done by the hook, I see those messages, as if the refining was done, but it's not visible in the Diff buffer, as you can see on http://screencast.com/t/e7et4xeO. When Edebugging, or when going to the *vc-diff* buffer and calling M-x my-diff-make-fine-diffs, the same messages appear in the *Messages* buffer, but the buffer is well colored differently, as you can see on http://screencast.com/t/K2VdxlF2fMld. So, I don't understand anything anymore... and don't know how to proceed to further debug this... Side (though important) question: when Edebugging, as soon as I step through the function, the *vc-diff* buffer disappears from my sight. I always have to switch to it, and check what changed, to see what's going on. Is there a way to make the buffer (on which the code is applied) stay visible during the stepping session? Best regards, Seb -- Sebastien Vauban