purcell / ibuffer-vc

Let Emacs' ibuffer-mode group files by git project etc., and show file state
171 stars 11 forks source link

Please add support for SRC VCS #24

Closed bhepple closed 5 years ago

bhepple commented 5 years ago

When running M-x ibuffer when a buffer is under the SRC version control system, I get this error:

ibuffer-vc: don't know how to find root for vc backend 'SRC' - please submit a bug report or patch

FWIW SRC is the lightweight VCS developed by Eric S. Raymond in about 2014 - some links:

http://www.catb.org/esr/src/ https://gitlab.com/esr/src https://www.emacswiki.org/emacs/VersionControlAlways

This appears to be a fix:

--- ibuffer-vc.el   2018-10-23 15:38:47.610947309 +1000
@@ -131,8 +131,6 @@
                    ((memq backend '(cvs CVS)) (vc-find-root file-name "CVS"))
                    ((memq backend '(rcs RCS)) (or (vc-find-root file-name "RCS")
                                                   (concat file-name ",v")))
-                   ((memq backend '(src SRC)) (or (vc-find-root file-name ".src")
-                                                  (concat file-name ",v")))
                    (t (error "ibuffer-vc: don't know how to find root for vc backend '%s' - please submit a bug report or patch" backend)))))
             (cons backend root-dir)))))))
purcell commented 5 years ago

Can you give 3ce55ec a try please? It should at least eliminate the error, but I haven't been able to test it.

purcell commented 5 years ago

Actually, I just applied your suggested fix instead because I think it will be better.

bhepple commented 5 years ago

Thanks for looking at this. It seems to have fixed the immediate problem.

purcell commented 5 years ago

Great! Thanks for your help.

bhepple commented 5 years ago

Latest version ibuffer-vc-20181023.2136 is giving "Wrong number of arguments: memq, 3" I think a closing brace got dropped from the patch.

Here's the version from ibuffer-vc.el that works for me:

(defun ibuffer-vc-root (buf)
  "Return a cons cell (backend-name . root-dir) for BUF.
If the file is not under version control, nil is returned instead."
  (let ((file-name (with-current-buffer buf
                     (file-truename (or buffer-file-name
                    default-directory)))))
    (when (ibuffer-vc--include-file-p file-name)
      (let ((backend (ibuffer-vc--deduce-backend file-name)))
        (when backend
          (let* ((root-fn-name (intern (format "vc-%s-root" (downcase (symbol-name backend)))))
                 (root-dir
                  (cond
                   ((fboundp root-fn-name) (funcall root-fn-name file-name)) ; git, svn, hg, bzr (at least)
                   ((memq backend '(darcs DARCS)) (vc-darcs-find-root file-name))
                   ((memq backend '(cvs CVS)) (vc-find-root file-name "CVS"))
                   ((memq backend '(rcs RCS)) (or (vc-find-root file-name "RCS")
                                                  (concat file-name ",v")))
                   ((memq backend '(src SRC)) (or (vc-find-root file-name ".src")
                                                 (concat file-name ",v")))
                   (t (error "ibuffer-vc: don't know how to find root for vc backend '%s' - please submit a bug report or patch" backend)))))
            (cons backend root-dir)))))))
purcell commented 5 years ago

Doh, sorry Bob! Yes, a goof on my part. Fixed in 1a2dcdb.

bhepple commented 5 years ago

That one works! Thanks!