Skip to main content
mention, emacs behavior was also changed
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (unless (smerge-next-safe)
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive. And changed behavior accordingly of the built-in emacs function with similar functional.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (unless (smerge-next-safe)
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (unless (smerge-next-safe)
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive. And changed behavior accordingly of the built-in emacs function with similar functional.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

replace `when not` with `unless`
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (when (notunless (smerge-next-safe))
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (when (not (smerge-next-safe))
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (unless (smerge-next-safe)
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

added 12 characters in body
Source Link
Hi-Angel
  • 878
  • 10
  • 19

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char 0(point-min))
          (when (not (smerge-next-safe))
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char 0)
          (when (not (smerge-next-safe))
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

Good idea. Here's a next-conflict function that wraps around whenever there is no more conflicted files, but the current one still has conflicts:

(defun next-conflict ()
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (when (eq buffer (current-buffer))
        (let ((prev-pos (point)))
          (goto-char (point-min))
          (when (not (smerge-next-safe))
            (goto-char prev-pos)
            (message "No conflicts found")))))))

I modified the answer you are referring to as well (it was mine answer) as such behavior is more intuitive.

Might be worth noting that I looked at how smerge-next is defined, and it is defined with easy-mmode-define-navigation macro. As far as I look through the macro there's no way to make smerge-next wrap around the search (e.g. by changing some variable or something like that), so I open-coded the wrapping higher the stack.

added 109 characters in body
Source Link
Hi-Angel
  • 878
  • 10
  • 19
Loading
Source Link
Hi-Angel
  • 878
  • 10
  • 19
Loading