;; /usr/local/share/emacs/29.0.90/lisp/vc/smerge-mode.el.gz:299
(defun smerge-keep-n (n)
(smerge-remove-props (match-beginning 0) (match-end 0))
;; We used to use replace-match, but that did not preserve markers so well.
(delete-region (match-end n) (match-end 0)) ;; lsp-bridge会监控到变化,search-backward-regexp 会代替掉global的matching beginning
(delete-region (match-beginning 0) (match-beginning n))) ;; match-beginning已经被修改 (match-beginning n)会返回nil, delete-region失败
(defun smerge-keep-n (n)
(smerge-remove-props (match-beginning 0) (match-end 0))
;; We used to use replace-match, but that did not preserve markers so well.
(delete-region (match-end n) (match-end 0)) ;;<=== 这行,执行成功
(delete-region (match-beginning 0) (match-beginning n)))
(defun smerge-keep-n (n)
(smerge-remove-props (match-beginning 0) (match-end 0))
;; We used to use replace-match, but that did not preserve markers so well.
(delete-region (match-end n) (match-end 0))
(delete-region (match-beginning 0) (match-beginning n))) ;;<=== 这行,失败了
结果上看buffer变成了这样,因为前三行没能被删掉
<<<<<<< HEAD
this.code.doThat(true, false);
=======
this.code.doThis(true);
this.var = blah;
The functions you use in these hooks should save and restore the match data if they do anything that uses regular expressions; otherwise, they will interfere in bizarre ways with the editing operations that call them.