all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Branislav Zahradník" <happy.barney@gmail.com>
To: 74509@debbugs.gnu.org
Subject: bug#74509: Feature request - smerge-mode
Date: Sun, 24 Nov 2024 09:17:56 +0100	[thread overview]
Message-ID: <CAB=rbOkfWKuZycbuaxEyZsPcYQ2CPuiGS67KzQfRRysboySexA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]

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)
 )
 )
))

[-- Attachment #2: Type: text/html, Size: 2192 bytes --]

             reply	other threads:[~2024-11-24  8:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24  8:17 Branislav Zahradník [this message]
2024-11-30 10:28 ` bug#74509: Feature request - smerge-mode Eli Zaretskii
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='CAB=rbOkfWKuZycbuaxEyZsPcYQ2CPuiGS67KzQfRRysboySexA@mail.gmail.com' \
    --to=happy.barney@gmail.com \
    --cc=74509@debbugs.gnu.org \
    /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.