From unknown Sat Jun 21 10:32:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#46538 <46538@debbugs.gnu.org> To: bug#46538 <46538@debbugs.gnu.org> Subject: Status: Patch: wrap around smerge-vc-next-conflict if current file still has conflicts Reply-To: bug#46538 <46538@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:32:20 +0000 retitle 46538 Patch: wrap around smerge-vc-next-conflict if current file st= ill has conflicts reassign 46538 emacs submitter 46538 Konstantin Kharlamov severity 46538 normal tag 46538 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 15 13:52:02 2021 Received: (at submit) by debbugs.gnu.org; 15 Feb 2021 18:52:02 +0000 Received: from localhost ([127.0.0.1]:38698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBiyW-0008MO-TY for submit@debbugs.gnu.org; Mon, 15 Feb 2021 13:52:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:46132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBiyS-0008ME-Ti for submit@debbugs.gnu.org; Mon, 15 Feb 2021 13:51:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBiyS-00082v-9q for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 13:51:56 -0500 Received: from forward103o.mail.yandex.net ([2a02:6b8:0:1a2d::606]:36056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBiyM-0007YE-0i for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 13:51:56 -0500 Received: from myt6-d2347e35b502.qloud-c.yandex.net (myt6-d2347e35b502.qloud-c.yandex.net [IPv6:2a02:6b8:c12:5fa8:0:640:d234:7e35]) by forward103o.mail.yandex.net (Yandex) with ESMTP id A41475F8047E for ; Mon, 15 Feb 2021 21:51:42 +0300 (MSK) Received: from myt5-ca5ec8faf378.qloud-c.yandex.net (myt5-ca5ec8faf378.qloud-c.yandex.net [2a02:6b8:c12:2514:0:640:ca5e:c8fa]) by myt6-d2347e35b502.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 461bo8rNrf-pgH0v3DP; Mon, 15 Feb 2021 21:51:42 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1613415102; bh=7H6qW7/VsnusKy/abg7Z/knDVuPnNjgw6ripQgWnOWA=; h=To:From:Subject:Message-ID:Date; b=M5JQcNK3kZYg8MwgWPkRc/fhhuNWo0f1LQT8REtr4WqZBT+v1EaUJIBcqvH/Ms0V2 ajimcHVzSWfyQOXJP1Jl5q5+6WdBlBm5RFg77OSuECaLV7BIb0Bxto8IEXzLBY5Y3l rVCyL/YeBZ9Rnk+8STh5P3CL5dgTsuidUGOR5o/M= Authentication-Results: myt6-d2347e35b502.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt5-ca5ec8faf378.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 8ZMnEIzMrv-pgJGAaHx; Mon, 15 Feb 2021 21:51:42 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: <5d10180be5f6a5a23c91b0ed150c111a225d79ff.camel@yandex.ru> Subject: Patch: wrap around smerge-vc-next-conflict if current file still has conflicts From: Konstantin Kharlamov To: bug-gnu-emacs@gnu.org Date: Mon, 15 Feb 2021 21:51:41 +0300 Content-Type: multipart/mixed; boundary="=-SFFqjDc149lkWpt3bYqg" User-Agent: Evolution 3.38.4 MIME-Version: 1.0 Received-SPF: pass client-ip=2a02:6b8:0:1a2d::606; envelope-from=hi-angel@yandex.ru; helo=forward103o.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-SFFqjDc149lkWpt3bYqg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Currently, if the buffer has conflict markers above the (point) and it's the last conflicted file, we bail out. A user pointed out¹ that it is a good idea to try to find conflicts in the current file as well. Indeed, it seems like more correct behaviour: going to the next conflict is whole purpose of the function, and current file might still have them. Attached patch implements additional check for conflicts just for the case when the buffer is the last conflicted file and all conflicts are above current point. 1: https://emacs.stackexchange.com/questions/63413/finding-git-conflict-in-the-same-buffer-if-cursor-is-at-end-of-the-buffer --=-SFFqjDc149lkWpt3bYqg Content-Disposition: attachment; filename="0001-vc-make-smerge-vc-next-conflict-wrap-around.patch" Content-Type: text/x-patch; name="0001-vc-make-smerge-vc-next-conflict-wrap-around.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 RnJvbSBmOGQ4ZjFjYmRiOTRmNzU3NjUxNjVhY2FjZDA4OWYxZTNjYzRhNzYzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBLb25zdGFudGluIEtoYXJsYW1vdiA8SGktQW5nZWxAeWFuZGV4 LnJ1PgpEYXRlOiBNb24sIDE1IEZlYiAyMDIxIDIxOjM3OjMzICswMzAwClN1YmplY3Q6IFtQQVRD SF0gdmM6IG1ha2Ugc21lcmdlLXZjLW5leHQtY29uZmxpY3Qgd3JhcCBhcm91bmQKCmxpc3AvdmMv c21lcmdlLW1vZGUuZWw6CihzbWVyZ2UtbmV4dC1zYWZlKTogYSB3cmFwcGVyIGFyb3VuZCBzbWVy Z2UtbmV4dCB0aGF0IGRvZXNuJ3QgdGhyb3cKYW4gZXJyb3IuCihzbWVyZ2UtdmMtbmV4dC1jb25m bGljdCk6IG1ha2UgaXQgd3JhcCBhcm91bmQgYSBmaWxlIGlmIGl0J3MgdGhlIGxhc3QKY29uZmxp Y3RlZCBmaWxlLCBhbmQgaXQgc3RpbGwgaGFzIGNvbmZsaWN0cwotLS0KIGxpc3AvdmMvc21lcmdl LW1vZGUuZWwgfCAyMCArKysrKysrKysrKysrKy0tLS0tLQogMSBmaWxlIGNoYW5nZWQsIDE0IGlu c2VydGlvbnMoKyksIDYgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlzcC92Yy9zbWVyZ2Ut bW9kZS5lbCBiL2xpc3AvdmMvc21lcmdlLW1vZGUuZWwKaW5kZXggM2IwOWRmZTVkMi4uMDU1ODI0 MDEyMCAxMDA2NDQKLS0tIGEvbGlzcC92Yy9zbWVyZ2UtbW9kZS5lbAorKysgYi9saXNwL3ZjL3Nt ZXJnZS1tb2RlLmVsCkBAIC0xNDQ2LDYgKzE0NDYsMTQgQEAgc21lcmdlLWNoYW5nZS1idWZmZXIt Y29uZmlybQogICAiSWYgbm9uLW5pbCwgcmVxdWVzdCBjb25maXJtYXRpb24gYmVmb3JlIG1vdmlu ZyB0byBhbm90aGVyIGJ1ZmZlci4iCiAgIDp0eXBlICdib29sZWFuKQogCisoZGVmdW4gc21lcmdl LW5leHQtc2FmZSAoKQorICAgICJUcmllcyB0byBtb3ZlIHRvIG5leHQgY29uZmxpY3QsIHJldHVy bnMgdCBvbiBzdWNjZXNzLCBuaWwKK290aGVyd2lzZSIKKyAgKGNvbmRpdGlvbi1jYXNlIGVycgor ICAgICAgKG5vdCAoc21lcmdlLW5leHQpKQorICAgICgnZXJyb3IKKyAgICAgbmlsKSkpCisKIChk ZWZ1biBzbWVyZ2UtdmMtbmV4dC1jb25mbGljdCAoKQogICAiR28gdG8gbmV4dCBjb25mbGljdCwg cG9zc2libHkgaW4gYW5vdGhlciBmaWxlLgogRmlyc3QgdHJpZXMgdG8gZ28gdG8gdGhlIG5leHQg Y29uZmxpY3QgaW4gdGhlIGN1cnJlbnQgYnVmZmVyLCBhbmQgaWYgbm90CkBAIC0xNDY5LDEyICsx NDc3LDEyIEBAIHNtZXJnZS12Yy1uZXh0LWNvbmZsaWN0CiAgICAgICAgICAoaWYgKGFuZCAoYnVm ZmVyLW1vZGlmaWVkLXApIGJ1ZmZlci1maWxlLW5hbWUpCiAgICAgICAgICAgICAgKHNhdmUtYnVm ZmVyKSkKICAgICAgICAgICh2Yy1maW5kLWNvbmZsaWN0ZWQtZmlsZSkKLSAgICAgICAgIChpZiAo ZXEgYnVmZmVyIChjdXJyZW50LWJ1ZmZlcikpCi0gICAgICAgICAgICAgOzsgRG8gbm90aGluZzog cHJlc3VtYWJseSBgdmMtZmluZC1jb25mbGljdGVkLWZpbGUnIGFscmVhZHkKLSAgICAgICAgICAg ICA7OyBlbWl0dGVkIGEgbWVzc2FnZSBleHBsYWluaW5nIHRoZXJlIGFyZW4ndCBhbnkgbW9yZSBj b25mbGljdHMuCi0gICAgICAgICAgICAgbmlsCi0gICAgICAgICAgIChnb3RvLWNoYXIgKHBvaW50 LW1pbikpCi0gICAgICAgICAgIChzbWVyZ2UtbmV4dCkpKSkpKSkKKyAgICAgICAgICh3aGVuIChl cSBidWZmZXIgKGN1cnJlbnQtYnVmZmVyKSkKKyAgICAgICAgICAgOzsgdHJ5IHRvIGZpbmQgYSBj b25mbGljdCBtYXJrZXIgaW4gY3VycmVudCBmaWxlIGFib3ZlIHRoZSBwb2ludAorICAgICAgICAg ICAobGV0ICgocHJldi1wb3MgKHBvaW50KSkpCisgICAgICAgICAgICAgKGdvdG8tY2hhciAocG9p bnQtbWluKSkKKyAgICAgICAgICAgICAod2hlbiAobm90IChzbWVyZ2UtbmV4dC1zYWZlKSkKKyAg ICAgICAgICAgICAgIChnb3RvLWNoYXIgcHJldi1wb3MpKSkpKSkpKSkKIAogKHByb3ZpZGUgJ3Nt ZXJnZS1tb2RlKQogCi0tIAoyLjMwLjEKCg== --=-SFFqjDc149lkWpt3bYqg-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 15 14:15:48 2021 Received: (at 46538) by debbugs.gnu.org; 15 Feb 2021 19:15:48 +0000 Received: from localhost ([127.0.0.1]:38711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjLX-0000VJ-MQ for submit@debbugs.gnu.org; Mon, 15 Feb 2021 14:15:48 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:51612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjLU-0000Uz-Q1 for 46538@debbugs.gnu.org; Mon, 15 Feb 2021 14:15:46 -0500 Received: by mail-wm1-f49.google.com with SMTP id r5so3836264wmp.1 for <46538@debbugs.gnu.org>; Mon, 15 Feb 2021 11:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=A58wvKHBG+jvU0IboNRJsqO5S/Avt1EJOBdWWFR1F1A=; b=gOqab4gI2uYRoINAxFdvuuTuccFWMWX7EOTkEFejmm2u54YzBy0fvklXo+y3FSUEAz lkZj2zwy4SMoy2cAyCOxU1CqBU4VIZLmMElooaG4+K/k4BfY8XuwL5dZ0fo/JurHMg6p olyvJ/xyJeEfUA0ssiix8rW2LbtV2WP1T+4JPJMbyzeZ6ocV1fcMuyFADYEhjwZsfXnu 7JgTu6rItmdRqsOXv3LhJo0dV4fNzslvNcOvu7nkmKCqKSQ24OsMLNk8dzb+HDCJXZlu jst7xFqfiEuNAb0zgQg85MUyqv5wwGjNUuLEZMq7Dy9aNhcgoJzaFw6WB16dnyPPYMpw vgKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=A58wvKHBG+jvU0IboNRJsqO5S/Avt1EJOBdWWFR1F1A=; b=HPqKLEq0k/cUZ5+MsAsEGHdxynffcB98r+YxkStiPOrLDszezc8nAoFnr2XUSFxnT/ UJsY3/otjAFKmzf4IFrCn+8M1voGQdgnOQljO9M2HQ7++BDo0eZfQjJXXKMFD5ASyL41 0hu86VB271zvdw1CeGlcOJoNMnBzXpiQqzW1+UUDZO7EsQN9PzG0zcTQP1yUehNpE1iw VcLmv0LKKj9iNNwuQQ+ond2E9k8XIunh3Xg/GG65YKlW6okjoN5Kun5SqGj/ktlXNYYP g1dMGgtZA5fT6u4bd+CkGNLedk6O9hnum6I9veKfWkwvbklfq6OaMiqvMUai8L5PhXVP +7BQ== X-Gm-Message-State: AOAM533j/RRQq2eXbsclJjw/xBxtz/YrnyW/GDr95lvbFeIFLkr/GVhB wU3YR5g9Qvbj3uNaoso2NGtsLg== X-Google-Smtp-Source: ABdhPJyOalieSWWK18R4yOgVgK3h0jUn487guIgycRqTzoi66RV6csg31mD59HkwACvKTEVbKFZTNQ== X-Received: by 2002:a1c:610b:: with SMTP id v11mr286859wmb.188.1613416539043; Mon, 15 Feb 2021 11:15:39 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:d15:339e:aa10:60f1]) by smtp.gmail.com with ESMTPSA id y1sm15468902wrr.41.2021.02.15.11.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 11:15:38 -0800 (PST) From: "Basil L. Contovounesios" To: Konstantin Kharlamov Subject: Re: bug#46538: Patch: wrap around smerge-vc-next-conflict if current file still has conflicts References: <5d10180be5f6a5a23c91b0ed150c111a225d79ff.camel@yandex.ru> Date: Mon, 15 Feb 2021 19:15:37 +0000 In-Reply-To: <5d10180be5f6a5a23c91b0ed150c111a225d79ff.camel@yandex.ru> (Konstantin Kharlamov's message of "Mon, 15 Feb 2021 21:51:41 +0300") Message-ID: <87wnv9ta5i.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46538 Cc: 46538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 46538 + patch quit Konstantin Kharlamov writes: > Attached patch implements additional check for conflicts just for the case when > the buffer is the last conflicted file and all conflicts are above current > point. Thanks, just a few nits from me. > From f8d8f1cbdb94f75765165acacd089f1e3cc4a763 Mon Sep 17 00:00:00 2001 > From: Konstantin Kharlamov > Date: Mon, 15 Feb 2021 21:37:33 +0300 > Subject: [PATCH] vc: make smerge-vc-next-conflict wrap around > > lisp/vc/smerge-mode.el: > (smerge-next-safe): a wrapper around smerge-next that doesn't throw > an error. > (smerge-vc-next-conflict): make it wrap around a file if it's the last > conflicted file, and it still has conflicts Please use proper sentences starting with a capital letter and ending in a full stop. > --- > lisp/vc/smerge-mode.el | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el > index 3b09dfe5d2..0558240120 100644 > --- a/lisp/vc/smerge-mode.el > +++ b/lisp/vc/smerge-mode.el > @@ -1446,6 +1446,14 @@ smerge-change-buffer-confirm > "If non-nil, request confirmation before moving to another buffer." > :type 'boolean) > > +(defun smerge-next-safe () > + "Tries to move to next conflict, returns t on success, nil ^^^^ Excess indentation. > +otherwise" The first line should contain a whole sentence, usually in the imperative; see (info "(elisp) Documentation Tips"). E.g.: "Try moving to next conflict. Return non-nil on success; nil otherwise." > + (condition-case err ^^^ This variable is unused, so just pass nil instead. > + (not (smerge-next)) > + ('error ^^ Conditions are usually unquoted. > + nil))) You can reuse the macro ignore-errors for this: (ignore-errors (not (smerge-next))) > (defun smerge-vc-next-conflict () > "Go to next conflict, possibly in another file. > First tries to go to the next conflict in the current buffer, and if not > @@ -1469,12 +1477,12 @@ smerge-vc-next-conflict > (if (and (buffer-modified-p) buffer-file-name) > (save-buffer)) > (vc-find-conflicted-file) > - (if (eq buffer (current-buffer)) > - ;; Do nothing: presumably `vc-find-conflicted-file' already > - ;; emitted a message explaining there aren't any more conflicts. > - nil > - (goto-char (point-min)) > - (smerge-next))))))) > + (when (eq buffer (current-buffer)) > + ;; try to find a conflict marker in current file above the point > + (let ((prev-pos (point))) > + (goto-char (point-min)) > + (when (not (smerge-next-safe)) ^^^^^^^^^^ Nit: when + not = unless > + (goto-char prev-pos))))))))) -- Basil From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 15 17:01:02 2021 Received: (at 46538) by debbugs.gnu.org; 15 Feb 2021 22:01:02 +0000 Received: from localhost ([127.0.0.1]:38844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBlvR-0006uX-MX for submit@debbugs.gnu.org; Mon, 15 Feb 2021 17:01:02 -0500 Received: from forward102j.mail.yandex.net ([5.45.198.243]:51924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBlvO-0006u0-Dr for 46538@debbugs.gnu.org; Mon, 15 Feb 2021 17:01:00 -0500 Received: from myt5-6c0659e8c6cb.qloud-c.yandex.net (myt5-6c0659e8c6cb.qloud-c.yandex.net [IPv6:2a02:6b8:c12:271e:0:640:6c06:59e8]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 4A09DF21914; Tue, 16 Feb 2021 01:00:51 +0300 (MSK) Received: from myt4-1dda227af9a8.qloud-c.yandex.net (myt4-1dda227af9a8.qloud-c.yandex.net [2a02:6b8:c00:3c83:0:640:1dda:227a]) by myt5-6c0659e8c6cb.qloud-c.yandex.net (mxback/Yandex) with ESMTP id NB8Pa9jLV0-0pI0qLVe; Tue, 16 Feb 2021 01:00:51 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1613426451; bh=D3MLwfP4mRvya3y/FCpIV5FGPYM5OR1oz1WTT5k+Ei8=; h=In-Reply-To:Cc:To:From:Subject:Message-ID:References:Date; b=Bdz28otwV8yhV1qqqbmKylrsL+S5xmlafAZqmR38CLYw7dYvr4lJqRyHApjky4CfH 6FwPDymoLVtYNuOP9OMz/i/vACgCB1bSwN/GlqgVyC94fky0NWmL1urVoQAdOXbkMg bCVmFRN+vNMhu8ZX/gPwWkFImoOuI0I0WCwMjTN4= Authentication-Results: myt5-6c0659e8c6cb.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt4-1dda227af9a8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id ZNjIhU8ZnY-0oKOwNl5; Tue, 16 Feb 2021 01:00:50 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: <34d88602bcc902d9e0e3f03817bdc105c81172a1.camel@yandex.ru> Subject: Re: bug#46538: Patch: wrap around smerge-vc-next-conflict if current file still has conflicts From: Konstantin Kharlamov To: "Basil L. Contovounesios" Date: Tue, 16 Feb 2021 01:00:49 +0300 In-Reply-To: <87wnv9ta5i.fsf@tcd.ie> References: <5d10180be5f6a5a23c91b0ed150c111a225d79ff.camel@yandex.ru> <87wnv9ta5i.fsf@tcd.ie> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 46538 Cc: 46538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Thank you! I will fix it up. Nice hint on the `ignore-errors` macro, I didn't know about it On Mon, 2021-02-15 at 19:15 +0000, Basil L. Contovounesios wrote: > tags 46538 + patch > quit > > Konstantin Kharlamov writes: > > > Attached patch implements additional check for conflicts just for the case > > when > > the buffer is the last conflicted file and all conflicts are above current > > point. > > Thanks, just a few nits from me. > > > From f8d8f1cbdb94f75765165acacd089f1e3cc4a763 Mon Sep 17 00:00:00 2001 > > From: Konstantin Kharlamov > > Date: Mon, 15 Feb 2021 21:37:33 +0300 > > Subject: [PATCH] vc: make smerge-vc-next-conflict wrap around > > > > lisp/vc/smerge-mode.el: > > (smerge-next-safe): a wrapper around smerge-next that doesn't throw > > an error. > > (smerge-vc-next-conflict): make it wrap around a file if it's the last > > conflicted file, and it still has conflicts > > Please use proper sentences starting with a capital letter and ending in > a full stop. > > > --- > >  lisp/vc/smerge-mode.el | 20 ++++++++++++++------ > >  1 file changed, 14 insertions(+), 6 deletions(-) > > > > diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el > > index 3b09dfe5d2..0558240120 100644 > > --- a/lisp/vc/smerge-mode.el > > +++ b/lisp/vc/smerge-mode.el > > @@ -1446,6 +1446,14 @@ smerge-change-buffer-confirm > >    "If non-nil, request confirmation before moving to another buffer." > >    :type 'boolean) > >   > > +(defun smerge-next-safe () > > +    "Tries to move to next conflict, returns t on success, nil >    ^^^^ > Excess indentation. > > > +otherwise" > > The first line should contain a whole sentence, usually in the > imperative; see (info "(elisp) Documentation Tips").  E.g.: > >     "Try moving to next conflict. >   Return non-nil on success; nil otherwise." > > > +  (condition-case err >                      ^^^ > This variable is unused, so just pass nil instead. > > > +      (not (smerge-next)) > > +    ('error >         ^^ > Conditions are usually unquoted. > > > +     nil))) > > You can reuse the macro ignore-errors for this: > >   (ignore-errors (not (smerge-next))) > > >  (defun smerge-vc-next-conflict () > >    "Go to next conflict, possibly in another file. > >  First tries to go to the next conflict in the current buffer, and if not > > @@ -1469,12 +1477,12 @@ smerge-vc-next-conflict > >           (if (and (buffer-modified-p) buffer-file-name) > >               (save-buffer)) > >           (vc-find-conflicted-file) > > -         (if (eq buffer (current-buffer)) > > -             ;; Do nothing: presumably `vc-find-conflicted-file' already > > -             ;; emitted a message explaining there aren't any more > > conflicts. > > -             nil > > -           (goto-char (point-min)) > > -           (smerge-next))))))) > > +         (when (eq buffer (current-buffer)) > > +           ;; try to find a conflict marker in current file above the point > > +           (let ((prev-pos (point))) > > +             (goto-char (point-min)) > > +             (when (not (smerge-next-safe)) >                 ^^^^^^^^^^ > Nit: when + not = unless > > > +               (goto-char prev-pos))))))))) > From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 15 17:25:22 2021 Received: (at 46538) by debbugs.gnu.org; 15 Feb 2021 22:25:22 +0000 Received: from localhost ([127.0.0.1]:38884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmJ0-0007WO-Ir for submit@debbugs.gnu.org; Mon, 15 Feb 2021 17:25:22 -0500 Received: from forward102o.mail.yandex.net ([37.140.190.182]:56766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBmIx-0007W6-53 for 46538@debbugs.gnu.org; Mon, 15 Feb 2021 17:25:21 -0500 Received: from myt6-08ca0b879dee.qloud-c.yandex.net (myt6-08ca0b879dee.qloud-c.yandex.net [IPv6:2a02:6b8:c12:12a2:0:640:8ca:b87]) by forward102o.mail.yandex.net (Yandex) with ESMTP id DA86766817E6; Tue, 16 Feb 2021 01:25:11 +0300 (MSK) Received: from myt4-1dda227af9a8.qloud-c.yandex.net (myt4-1dda227af9a8.qloud-c.yandex.net [2a02:6b8:c00:3c83:0:640:1dda:227a]) by myt6-08ca0b879dee.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 8Zz7hdTE5p-PBHWlrPh; Tue, 16 Feb 2021 01:25:11 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1613427911; bh=2jfLe4OnxzqBqOHEUohVsSjO7O6yTnbxi+J/A3EKf4Y=; h=In-Reply-To:Subject:To:From:Message-Id:Cc:References:Date; b=Ew1yRFIsfsk2eLHTtt03Gxvf15GgmsGwChXJmmZ0D5YmhNEY6oO9GqeLVqM9Ga7F+ C1H2mEwiYphP5eaR4+P45cDaT81Wvw2mICTGNOyxO1OC3ZGrkCytyoK0H0F4hiDocF OLNbZKNHt5xF+dvFAevYWC1FWyGKgiVdraI/VTHg= Authentication-Results: myt6-08ca0b879dee.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt4-1dda227af9a8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id qcmaJGowt3-PBKu9amW; Tue, 16 Feb 2021 01:25:11 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Konstantin Kharlamov To: 46538@debbugs.gnu.org Subject: [PATCH] vc: make smerge-vc-next-conflict wrap around Date: Tue, 16 Feb 2021 01:25:04 +0300 Message-Id: <20210215222504.281682-1-Hi-Angel@yandex.ru> X-Mailer: git-send-email 2.30.1 In-Reply-To: <87wnv9ta5i.fsf@tcd.ie> References: <87wnv9ta5i.fsf@tcd.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46538 Cc: contovob@tcd.ie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * lisp/vc/smerge-mode.el: (smerge-vc-next-conflict): While searching for conflict markers, wrap search around if current file is the last one with conflicts. --- lisp/vc/smerge-mode.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index 3b09dfe5d2..b825fd9837 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -1469,12 +1469,12 @@ smerge-vc-next-conflict (if (and (buffer-modified-p) buffer-file-name) (save-buffer)) (vc-find-conflicted-file) - (if (eq buffer (current-buffer)) - ;; Do nothing: presumably `vc-find-conflicted-file' already - ;; emitted a message explaining there aren't any more conflicts. - nil - (goto-char (point-min)) - (smerge-next))))))) + (when (eq buffer (current-buffer)) + ;; try to find a conflict marker in current file above the point + (let ((prev-pos (point))) + (goto-char (point-min)) + (unless (ignore-errors (not (smerge-next))) + (goto-char prev-pos))))))))) (provide 'smerge-mode) -- 2.30.1 From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 16 06:50:37 2021 Received: (at 46538) by debbugs.gnu.org; 16 Feb 2021 11:50:37 +0000 Received: from localhost ([127.0.0.1]:39563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBysG-0002XN-UC for submit@debbugs.gnu.org; Tue, 16 Feb 2021 06:50:37 -0500 Received: from quimby.gnus.org ([95.216.78.240]:51854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBysB-0002X0-SO for 46538@debbugs.gnu.org; Tue, 16 Feb 2021 06:50:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nXsnM5NsfcVQL7XaIwML5jEXH1SrAxOBYkl9C6QCOas=; b=VrKSlN06k2LEYqLlEHt7Q8K3Et SDH5ch/sVbiHGjODs3zKfRCQLWkC6j3+zIH82QQJn0xJ87pGGsBXKpNxOuoF94AZOAKT8GT8P99Vs pVOfgDjAYRwuLhDbfUPJMvN//WxIx21vZHcXu9AMXNNSDKTc1hXl5Jw/42X1t9kC/AeE=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lByrz-0004hc-VB; Tue, 16 Feb 2021 12:50:25 +0100 From: Lars Ingebrigtsen To: Konstantin Kharlamov Subject: Re: bug#46538: [PATCH] vc: make smerge-vc-next-conflict wrap around References: <87wnv9ta5i.fsf@tcd.ie> <20210215222504.281682-1-Hi-Angel@yandex.ru> X-Now-Playing: Sevdaliza's _ISON_: "Libertine" Date: Tue, 16 Feb 2021 12:50:18 +0100 In-Reply-To: <20210215222504.281682-1-Hi-Angel@yandex.ru> (Konstantin Kharlamov's message of "Tue, 16 Feb 2021 01:25:04 +0300") Message-ID: <87h7mcz0xx.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Konstantin Kharlamov writes: > * lisp/vc/smerge-mode.el: > (smerge-vc-next-conflict): While searching for conflict markers, wrap > search around if current file is the last one with conflicts. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46538 Cc: contovob@tcd.ie, 46538@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Konstantin Kharlamov writes: > * lisp/vc/smerge-mode.el: > (smerge-vc-next-conflict): While searching for conflict markers, wrap > search around if current file is the last one with conflicts. Looks good to me, so I've applied your patch to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 16 06:50:45 2021 Received: (at control) by debbugs.gnu.org; 16 Feb 2021 11:50:45 +0000 Received: from localhost ([127.0.0.1]:39566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBysP-0002Xl-8l for submit@debbugs.gnu.org; Tue, 16 Feb 2021 06:50:45 -0500 Received: from quimby.gnus.org ([95.216.78.240]:51868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBysN-0002XV-Pl for control@debbugs.gnu.org; Tue, 16 Feb 2021 06:50:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iYUbjgkI80HLJp8id0MTobLrfG9VAhnnnisHDALPheA=; b=uy8p0N3jN7/OUgVnezBqAMAPyq XZxXhmGS+ATXgW/B5aDh5GCN8F8Ph0o8lUKr2D1nnxZbMqMRLIjdfxN19MjWF33Z3CM/vELN2H8DE 1fwqNS8QZuQy8kdlA7BLKA/IyhQkYF9fH04uygEGsdQx/FHMjm9LEO35uNlPD4bcpF9U=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBysG-0004hl-4i for control@debbugs.gnu.org; Tue, 16 Feb 2021 12:50:38 +0100 Date: Tue, 16 Feb 2021 12:50:35 +0100 Message-Id: <87ft1wz0xg.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #46538 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 46538 fixed close 46538 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 46538 fixed close 46538 28.1 quit From unknown Sat Jun 21 10:32:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 17 Mar 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator