branch: externals/hyperbole commit 540c4a3d746ac9bc7f1fd6ed9dcb002ca8692312 Author: Mats Lidell <mats.lid...@lidells.se> Commit: GitHub <nore...@github.com>
add hypb smerge (#716) --- ChangeLog | 4 ++++ hibtypes.el | 23 ++++++++++++++++++++++- hui-mouse.el | 28 ++++++++++++++++++++-------- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4479cb8357..97b151a159 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2025-04-26 Mats Lidell <ma...@gnu.org> +* hibtypes.el (smerge): Add ibut smerge. + +* hui-mouse.el (smart-magit): Add smerge support in magit-status-mode. + * hywiki.el (hywiki-word-face-at-p): Add optional pos to enable reuse. * test/hy-test-helpers.el (hy-test-word-face-at-region): Simplify by diff --git a/hibtypes.el b/hibtypes.el index 3d9be82144..83f8e8e5be 100644 --- a/hibtypes.el +++ b/hibtypes.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Sep-91 at 20:45:31 -;; Last-Mod: 19-Apr-25 at 17:51:14 by Bob Weiner +;; Last-Mod: 26-Apr-25 at 10:19:22 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -45,6 +45,7 @@ (require 'org-macs) ;; for org-uuid-regexp (require 'subr-x) ;; for string-trim (require 'thingatpt) +(eval-when-compile (require 'smerge-mode)) ;;; ************************************************************************ ;;; Public declarations @@ -1737,6 +1738,26 @@ If a boolean function or variable, display its value." ;; If you want to to disable ALL Hyperbole support within Org major ;; and minor modes, set the custom option `hsys-org-enable-smart-keys' to nil. +;;; ======================================================================== +;;; Resolve merge conflicts in smerge-mode +;;; ======================================================================== + +(defib smerge () + "Act on conflicts in merge buffers, i.e. when smerge-mode is active." + (when (bound-and-true-p smerge-mode) + (let (op) + (save-excursion + (beginning-of-line) + (cond ((looking-at smerge-end-re) + (setq op 'smerge-keep-lower)) + ((looking-at smerge-begin-re) + (setq op 'smerge-keep-upper)) + ((looking-at smerge-lower-re) + (setq op 'smerge-keep-all)))) + (when op + (ibut:label-set (match-string-no-properties 0) (match-beginning 0) (match-end 0)) + (hact op))))) + (run-hooks 'hibtypes-end-load-hook) (provide 'hibtypes) diff --git a/hui-mouse.el b/hui-mouse.el index 79b9584993..075b88a9a5 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 15-Apr-25 at 12:51:50 by Mats Lidell +;; Last-Mod: 25-Apr-25 at 23:35:04 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1575,13 +1575,25 @@ If key is pressed: point (\"RET\" key binding) but display based on the value of `hpath:display-where'." (interactive) - (cond ((last-line-p) - (call-interactively (key-binding "q"))) - ((eolp) - (smart-scroll-up)) - (t - (let ((magit-display-buffer-function #'hpath:display-buffer)) - (call-interactively #'smart-magit-tab))))) + (let (op) + (cond ((last-line-p) + (call-interactively (key-binding "q"))) + ((eolp) + (smart-scroll-up)) + ((and + (eq major-mode 'magit-status-mode) + (save-excursion + (beginning-of-line) + (cond ((looking-at (regexp-quote "++>>>>>>>")) + (setq op 'magit-smerge-keep-lower)) + ((looking-at (regexp-quote "++<<<<<<<")) + (setq op 'magit-smerge-keep-upper)) + ((looking-at (regexp-quote "++=======")) + (setq op 'magit-smerge-keep-all))))) + (call-interactively op)) + (t + (let ((magit-display-buffer-function #'hpath:display-buffer)) + (call-interactively #'smart-magit-tab)))))) (defun smart-magit-assist () "Use an assist key or mouse key to jump to source and to hide/show changes.