From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#17544: 24.3; [PATCH] Improved diff-mode navigation/manipulation Date: Sat, 22 Oct 2016 22:49:21 -0400 Message-ID: <87mvhvsrta.fsf@users.sourceforge.net> References: <87ha4jgw53.fsf@secretsauce.net> <87si0ion1c.fsf@gnus.org> <87k2et8hr4.fsf@secretsauce.net> <83a8fpe1dr.fsf@gnu.org> <87h99w8ynv.fsf@secretsauce.net> <87k2es9weh.fsf@users.sourceforge.net> <87oa4018r3.fsf@secretsauce.net> <87twdi6rm9.fsf@secretsauce.net> <87h997nkqp.fsf@secretsauce.net> <874m44tmge.fsf@users.sourceforge.net> <87h983rg9c.fsf@secretsauce.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1477190964 14384 195.159.176.226 (23 Oct 2016 02:49:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Oct 2016 02:49:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Andreas Schwab , 17544@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 23 04:49:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1by8qT-0001mN-FU for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Oct 2016 04:49:09 +0200 Original-Received: from localhost ([::1]:39457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1by8qV-0002wm-MX for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Oct 2016 22:49:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1by8qP-0002wh-V7 for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2016 22:49:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1by8qM-00073i-SJ for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2016 22:49:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59545) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1by8qM-00073R-OW for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2016 22:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1by8qM-0003NG-CY for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2016 22:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Oct 2016 02:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17544 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 17544-submit@debbugs.gnu.org id=B17544.147719093112949 (code B ref 17544); Sun, 23 Oct 2016 02:49:02 +0000 Original-Received: (at 17544) by debbugs.gnu.org; 23 Oct 2016 02:48:51 +0000 Original-Received: from localhost ([127.0.0.1]:46711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1by8qA-0003Mn-O3 for submit@debbugs.gnu.org; Sat, 22 Oct 2016 22:48:50 -0400 Original-Received: from mail-it0-f47.google.com ([209.85.214.47]:37383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1by8q9-0003Mb-5c for 17544@debbugs.gnu.org; Sat, 22 Oct 2016 22:48:49 -0400 Original-Received: by mail-it0-f47.google.com with SMTP id m138so80401750itm.0 for <17544@debbugs.gnu.org>; Sat, 22 Oct 2016 19:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1cvKZZULAVlA8eb/+EieI9sje1Yi1eBygKDg2Kcri5k=; b=L54h/R9MfXE8EBq0DKnKTpemaHI1hA187v12AKnZbUdqv0cq1suzhCR518xfxZ7UBO RjL3xBd+6VdRRo9ag2uB/dh581qIoul0cZthDEKYzJqf7yQKQzOlSsL3otW7s3IN8K8w okJYjcOXNVKH+Dhe606oYPac83giRBPtt7YpW8eNKV+rZ7T2F6+yTcKMJWYbnoDvf75U 6nmiXph7sqZy25/zm5SeKaVnZ/cSySWhs9QDNq9z2kul9eZv54qMYMfkQXG/OQzsPOim +g0TfBNwKn4CTZviwPgYmsEmSV1QaGpMj90njUev0+f1hirKO+7fvIM8LAOp7OaNp0Jt xlcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=1cvKZZULAVlA8eb/+EieI9sje1Yi1eBygKDg2Kcri5k=; b=CxtZSUf6mH0b37ceZY1TwgkJPe7EzxIYd8b2wiA6aMs8C4kUfNj5+oK/BTPkamjN5z ORIiUr67siQ1OBWaG7Znb49hU/VlHTYWdhJbu/DDizyTEIHoU9trB0camRt9pJR5qVv6 2o2PhRhPEqF5CJX6kGIEMsdO0rnpJNWWCwnMQM8H2vgF2Sb5ers5ILQk8iJU6HFFbywt TWJfOAZhPxGap+pn9xX5kOgi6JCWVn6rjZBLOd7GJSafTtxTFDVc2nReI4B4FCr4zpnd 91fyF9bY4kWmEzYCgyEBXKrN8JGxOiF/l7dcsQSS4ab26J/bn7RKfzRnOuYAHOYdvro6 LMrg== X-Gm-Message-State: ABUngvdlTXI3NvgzXPHzNrsxME5tEeMEdEZBBiG1w09HYZPFWjvf2sujMoZLskue3XRkog== X-Received: by 10.107.138.65 with SMTP id m62mr9372340iod.213.1477190923523; Sat, 22 Oct 2016 19:48:43 -0700 (PDT) Original-Received: from zony ([45.2.7.130]) by smtp.googlemail.com with ESMTPSA id i102sm4814540iod.10.2016.10.22.19.48.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Oct 2016 19:48:43 -0700 (PDT) In-Reply-To: <87h983rg9c.fsf@secretsauce.net> (Dima Kogan's message of "Sat, 22 Oct 2016 18:44:15 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124864 Archived-At: Dima Kogan writes: > npostavs@users.sourceforge.net writes: > >> Dima Kogan writes: >> >>> Here's yet another revised patch. The (call-interactively) at the end of >>> (diff-apply-hunk) was important, it turns out. This would force it to >>> use the new logic to move to the next hunk, instead of the legacy logic. >>> I purposely left the behavior of (diff-next-hunk) unchanged from before >>> when running non-interactively, and here I explicitly want the new >>> behavior. >> >> If both behaviours are needed, it would be much better if lisp code >> could choose between them without having to use call-interactively, >> that's quite an awkward interface. > > Hi. I'm open to suggestions. The goal was to retain the previous logic > for any existing code, but to provide improved user-facing behavior. > Given this, it doesn't seem to me to be too awkward to pass-on the > "interactive-p" state to child functions. > But you're synthesizing interactiveness in diff-apply-hunk, so it looks like interactiveness is not what you actually care about. You could do something like this instead: (defun diff-hunk-next (&optional count skip-hunk-start) "Go to the next COUNT'th hunk" (interactive (list (prefix-numeric-value current-prefix-arg) t)) (diff--wrap-navigation skip-hunk-start "next hunk" 'diff--internal-hunk-next diff-hunk-header-re (lambda () (goto-char (car (diff-bounds-of-hunk)))) count)) Then instead of (call-interactively 'diff-hunk-next) you can just do (diff-hunk-next nil t) > Am I wrong to want to preserve > existing behavior for elisp code? If so, then the entire old path can > simply go away unconditionally. Maybe. What about the other calls to diff-hunk-next? Was there a reason you kept them the same?