Stefan Reichör <[EMAIL PROTECTED]> writes:

> When I merge from your branch, I get the following conflict:
>
>   (cond
>    ((eq major-mode 'dired-mode)
>     (dired-get-marked-files))
>
>    ((eq major-mode 'dvc-diff-mode)
> <<<<<<< TREE
>     (or (remove nil dvc-buffer-marked-file-list)
>         (cond
>          ((eq selection-mode 'nil-if-none-marked)
>           nil)
>
>          ((eq selection-mode 'all-if-none-marked)
>           (dvc-diff-all-files))
>
>          (t (list (dvc-get-file-info-at-point))))))
>
>    (t (list (dvc-get-file-info-at-point)))))
> =======
>     (cond
>      ((eq selection-mode 'nil-if-none-marked)
>       (remove nil dvc-buffer-marked-file-list))
>
>      ((eq selection-mode 'all-if-none-marked)
>       (or dvc-buffer-marked-file-list
>           (dvc-diff-all-files)))
>
>      (t (list (dvc-get-file-info-at-point)))))
>
>    ((eq selection-mode 'nil-if-none-marked)
>     nil)
>
>    (t (list (dvc-get-file-info-at-point)))))
>>>>>>>> MERGE-SOURCE
>
> Michael and Stephen, could you please find out, which solution is correct.

The upper option is mine, the lower is Michael's.

Michael; it looks like you are handling `nil-if-none-marked' in modes
other than dired-mode and dvc-diff-mode.

For "other modes" only the buffer file name is available. So we have
these results:

selection-mode
nil                 buffer-file-name
nil-if-none-marked  nil
all-if-none-marked  buffer-file-name

That makes sense.

Just out of curiosity, what mode are you using that requires this?
Perhaps it should be supported here explicitly.

I'll add this in my version:

(defun dvc-current-file-list (&optional selection-mode)
  "Return a list of currently active files.
When in dired mode, return the marked files or the file under point.
In a DVC mode, return `dvc-buffer-marked-file-list' if non-nil;
otherwise the result depends on SELECTION-MODE:
* When 'nil-if-none-marked, return nil.
* When 'all-if-none-marked, return all files.
* Otherwise return result of calling `dvc-get-file-info-at-point'."
  (cond
   ((eq major-mode 'dired-mode)
    (dired-get-marked-files))

   ((eq major-mode 'dvc-diff-mode)
    (or (remove nil dvc-buffer-marked-file-list)
        (cond
         ((eq selection-mode 'nil-if-none-marked)
          nil)

         ((eq selection-mode 'all-if-none-marked)
          (dvc-diff-all-files))

         (t (list (dvc-get-file-info-at-point))))))

   (t
    ;; Some other mode. We assume it has no notion of "marked files",
    ;; so there are none marked. The only file name available is
    ;; buffer-file-name, so we could just return that. But some DVC
    ;; mode might set dvc-get-file-info-at-point-function without
    ;; updating this function, so support that.
    (if (eq selection-mode 'nil-if-none-marked)
        nil
      (list (dvc-get-file-info-at-point))))))

-- 
-- Stephe

_______________________________________________
Dvc-dev mailing list
[email protected]
https://mail.gna.org/listinfo/dvc-dev

Reply via email to