all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74509: Feature request - smerge-mode
@ 2024-11-24  8:17 Branislav Zahradník
  2024-11-30 10:28 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Branislav Zahradník @ 2024-11-24  8:17 UTC (permalink / raw)
  To: 74509

[-- 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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-12-22  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24  8:17 bug#74509: Feature request - smerge-mode Branislav Zahradník
2024-11-30 10:28 ` 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
2024-12-22  2:54               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-22  9:46                 ` Branislav Zahradník

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.