From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Branislav =?UTF-8?Q?Zahradn=C3=ADk?= Newsgroups: gmane.emacs.bugs Subject: bug#74509: Feature request - smerge-mode Date: Sun, 24 Nov 2024 09:17:56 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007cc2bb0627a4411c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10864"; mail-complaints-to="usenet@ciao.gmane.io" To: 74509@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 24 17:07:19 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tFF8p-0002gU-Em for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Nov 2024 17:07:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFF8d-0001bB-SZ; Sun, 24 Nov 2024 11:07:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFF8Y-0001ar-Cr for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 11:07:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tFF8Y-00076W-4Y for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 11:07:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=elD5vETX7KLlRSN0RMEFdaxwBfZ5SEi2xuWSqOk54uM=; b=r6jzd5IH6FVDGvLkVpucQpJrOuIGxmRp5J71TNDoKeoeuwZWbg1EYA3wGlWgtUKj+8uf8OPBYXcioEFEzUagG7XIjbQqHtgSC5R0WEEx+k6FhEW+nuMW2gsjoMN+xxw0FAO1F2j8SkTgqeIEnuHiquQlwqcRz639AryRjT6O8abun3NwQ7Bz9ac2mgafDEo1LuovY5T6HgfQWAjFM8Sj2hnF01MK730xbJn005BYNKpslehfg6y79/CGPOpyHwh0qnrA0Kv7EeuADCEX2Q1+6/j9hRhrxldKjArfQJDTs+I61Idqk3VGecmoA7oLWf9zT3mGZqzST106ICIiGaYdkg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tFF8X-0005td-Tv for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 11:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Branislav =?UTF-8?Q?Zahradn=C3=ADk?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Nov 2024 16:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74509 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173246436222587 (code B ref -1); Sun, 24 Nov 2024 16:07:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Nov 2024 16:06:02 +0000 Original-Received: from localhost ([127.0.0.1]:35816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFF7a-0005rz-0V for submit@debbugs.gnu.org; Sun, 24 Nov 2024 11:06:02 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:42688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tF7op-0005oU-6f for submit@debbugs.gnu.org; Sun, 24 Nov 2024 03:18:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tF7op-0006gb-0J for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 03:18:11 -0500 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tF7on-0004uc-7B for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 03:18:10 -0500 Original-Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d0062e9c80so4315074a12.2 for ; Sun, 24 Nov 2024 00:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732436287; x=1733041087; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=elD5vETX7KLlRSN0RMEFdaxwBfZ5SEi2xuWSqOk54uM=; b=fLth4hNJk5EM7pypef+lWBkJS5YqG81hZmmFOqVdB+cukfDgEm661pZ5Fo3i9u9dwk op6K1SkgyR5ka8GhI6AnRKcWDzV4fn9ja8mbBhqHZG8G34mbp3aiN8TNv8J7F7Y0y0dr rcwC6+qrZXTW9iRuabH1X/jydUHSrAmKYPB/4ooR6GWRXURNGxmg1j91wktqJ8Hm7WU8 41RH3SXJ4mpCGLby044GvHQCU+zPbXMrNXJmnxuUPIJGfaynKqDHEJJBFVGN6WlGMX7+ 30zOMo95OWxw9fKU1AwJtfvj+03qcyuEjCbDaHOlOkEyCdpohSHKovdh1VpmYOCQAV0N bEPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732436287; x=1733041087; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=elD5vETX7KLlRSN0RMEFdaxwBfZ5SEi2xuWSqOk54uM=; b=EEOzCu1S2pSkGYZXjZ3fJX5QZr0HrTSk2YAYsZ7scd2hW1+MoqVfallvE/iR+Suvqh 2l3ISXHwz1XqjR8Whm++NYtUdBfxqwU6u40wlcTijhjTxZ8RQmwi+PGKzJzhZpc7w3Jc L1ciq8RBe0fXm2ltAJQWdoUIwYm5965z6YaqdiqKSaUPqG6DshH73PI13SW003Jw3GhI SvIKA804nvdm/NPGjxzRBvMPjvFTpwRwT2ZL5vWNgO1Dd0IlhUkfjP/T7kR7yIXdk+aj QTZy92Qg5rs6pxK+XCmAzGLNT97AmizVp6/riHzrlRCavnM6adEr49//b59tAYTehn8+ 76bg== X-Gm-Message-State: AOJu0YzYyQ7QkCkWcto6VOx+E2zCf82rRPjyNUcA9oHBZyy15Lac4lre 47i6z6gQtwV/Ieb1+aqpA+qCDMrSnZ/Gkan7YlVgUcqrLZ1RPvTOtxFHT0UlTIfx/XMx8xTYhl3 AGuhIu+SSHgjl5BORpUeWwk3bSYZvQ2xZEUI= X-Gm-Gg: ASbGncuUW1n2qZhakZujWCGoVhJqjE+NFtY47GFGHtLtX4XRiC45NG29UYuncFeLe9T aFJ7/9BjxYFIBdo6F8NS4ljY495zENJQ= X-Google-Smtp-Source: AGHT+IHXEDPoGENVQfS3wK9/qed/Za1evdKUX3ISFMIqn4ReGbc8EnJMhrFDVNkLenP1+P4k2vynn85laJkKu2dWtgs= X-Received: by 2002:a05:6402:5253:b0:5cf:d154:838b with SMTP id 4fb4d7f45d1cf-5d0205faecfmr7169739a12.10.1732436287076; Sun, 24 Nov 2024 00:18:07 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=happy.barney@gmail.com; helo=mail-ed1-x535.google.com 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 24 Nov 2024 11:06:01 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295910 Archived-At: --0000000000007cc2bb0627a4411c Content-Type: text/plain; charset="UTF-8" Hi, first thank you all for your work. I didn't find better way how to request features so reporting it as bug. Recently I'm using smerge-mode little bit more than usually and I come with missing features # keybinding would be nice to provide default keybinding for smerge-swap: C-c ^ s # smerge-extend Helpful when user intent to keep both. Simple extend "current" with one line following conflict. In my work such line is usually: - empty line separating documentation sections - `}` line ending block / function default keybinding: C-c ^ x Here is my attempt to solve this problem. It works for me, but I'm not very skillful in elisp so it may not fit your standards. Best regards, Brano (defun smerge-extend () "Copy the line directly following the conflict into both upper and lower sections. This is useful when both versions need to share some common code that follows the conflict." (interactive) (smerge-match-conflict) (let ((beg (match-beginning 0)) (end (match-end 0)) (next-line "")) (save-excursion (goto-char end) (when (and (not (eobp)) (looking-at ".*$")) (setq next-line (concat (match-string 0) "\n")) (delete-region end (min (1+ (line-end-position)) (point-max))) )) (when (not (string= next-line "")) (save-excursion (smerge-match-conflict) (goto-char (match-end 3)) (insert next-line) ) (save-excursion (smerge-match-conflict) (goto-char (match-end 1)) (insert next-line) ) ) )) --0000000000007cc2bb0627a4411c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

first thank you all for = your work.

I didn't find better way how to req= uest features so reporting it as bug.

Recently I&#= 39;m using smerge-mode little bit more than usually and I come with
missing features

# keybinding

would be nice to provide default keybinding for smerge-swap: C-c ^ = s

# smerge-extend

Helpful when user intent to keep both.
Simple extend "c= urrent" with one line following conflict.
In my work such li= ne is usually:
- empty line separating documentation sections
- `}` line ending block / function

default = keybinding: C-c ^ x

Here is my attempt to= solve this problem. It works for me, but I'm not very skillful in elis= p so it may not fit your standards.

Best regards,<= /div>
Brano

(defun smerge-extend ()
=C2=A0 = "Copy the line directly following the conflict into both upper and low= er sections.
This is useful when both versions need to share some common= code that follows the conflict."
=C2=A0 (interactive)

=C2= =A0 (smerge-match-conflict)
=C2=A0 (let ((beg (match-beginning 0))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (end (match-end 0))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 (next-line ""))

=C2=A0 =C2=A0 (save-excursion
=C2= =A0 =C2=A0 =C2=A0 (goto-char end)
=C2=A0 =C2=A0 =C2=A0 (when (and (not (= eobp))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lo= oking-at ".*$"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq next-line (= concat (match-string 0) "\n"))
(delete-region end (min (1+ (= line-end-position)) (point-max)))
))

=C2=A0 =C2=A0 (when (not (= string=3D next-line ""))
=C2=A0 =C2=A0 =C2=A0 (save-excursion<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (smerge-match-conflict)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 (goto-char (match-end 3))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ins= ert next-line)
=C2=A0)

=C2=A0 =C2=A0 =C2=A0 (save-excursion
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (smerge-match-conflict)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (goto-char (match-end 1))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (insert= next-line)
=C2=A0)
=C2=A0)
))


--0000000000007cc2bb0627a4411c--