Skip to content

Ignore file escape syntax, status for all files in vc-src

While implementing the Emacs vc ignore feature that I have been waiting for since vc-cvs ;-), I came across vc-src. As long-time RCS user, I find this a very nifty tool (having ignore file support made me smile), so thanks for both vc and src.

  1. When testing the escape syntax for ignore files, by ignoring "test[56].xx" in the context below to make sure that neither "test5.xx" nor "test6.xx are erroneously ignored:

    VC backend : SRC
    
        unregistered         test5.xx
        unregistered         test6.xx
    *   unregistered         test[56].xx

    I found that the standard glob(7) escaping with a backslash does not work since the backslash obviously does not have a special meaning for SRC. It took me a second to realize that I could use character sets like [?] to do the trick:

    (defun vc-src-glob-escape (string)
      "Escape special glob characters in STRING."
      (save-match-data
        (if (string-match "[?*[]" string)
            (mapconcat (lambda (c)
                         (pcase c
                           (?? "[?]")
                           (?* "[*]")
                           (?\[ "[[]")
                           (_ (char-to-string c))))
                       string "")
          string)))

    Maybe it is useful to add this to the documentation. I guess I should add another case clause to escape a backslash, in case you plan to introduce the backslash escape syntax. You can see the full use case for the ignore feature in message 77, bug #37189.

  2. For an ignore feature it is useful to display both ignored and unregistered files in vc-dir-mode. When checking, why they were not displayed for SRC, I found the following comment in emacs/lisp/vc/vc-src.el:

    b1a765b3 (Eric S. Raymond 2014-12-02 181) (defun vc-src-dir-status-files (dir files update-function)
    1e81f676 (Eric S. Raymond 2014-11-20 182) ;; FIXME: Use one src status -a call for this

    Implementing this did indeed what I expected and I have submitted a patch at #39502 - [PATCH] Use one src status -a call for vc-src-dir-status-files - GNU bug report logs. However, it seems, that there isn't anyone available to review the correctness for SRC. Maybe you could have a look, it is just a short patch.

You can evaluate the ignore feature with x-vc-repair.el which backports the ignore feature down to Emacs 22 (SRC seems to be supported since Emacs 25, but you know that already :-)).