From: Eli Zaretskii <eliz@gnu.org>
To: "Branislav Zahradník" <happy.barney@gmail.com>,
"Stefan Monnier" <monnier@iro.umontreal.ca>
Cc: 74509@debbugs.gnu.org
Subject: bug#74509: Feature request - smerge-mode
Date: Sat, 30 Nov 2024 12:28:35 +0200 [thread overview]
Message-ID: <86bjxx817w.fsf@gnu.org> (raw)
In-Reply-To: <CAB=rbOkfWKuZycbuaxEyZsPcYQ2CPuiGS67KzQfRRysboySexA@mail.gmail.com> (message from Branislav Zahradník on Sun, 24 Nov 2024 09:17:56 +0100)
> From: Branislav Zahradník <happy.barney@gmail.com>
> Date: Sun, 24 Nov 2024 09:17:56 +0100
>
> 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)
> )
> )
> ))
Stefan, any comments or suggestions?
next prev parent reply other threads:[~2024-11-30 10:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 8:17 bug#74509: Feature request - smerge-mode Branislav Zahradník
2024-11-30 10:28 ` Eli Zaretskii [this message]
2024-12-01 23:51 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 7:59 ` Branislav Zahradník
2024-12-03 3:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-03 6:39 ` Branislav Zahradník
2024-12-21 8:47 ` Eli Zaretskii
2024-12-21 15:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86bjxx817w.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=74509@debbugs.gnu.org \
--cc=happy.barney@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.