]> git.donarmstrong.com Git - lib.git/blob - emacs_el/vc-svn17.el
fix missing ) for org-mode
[lib.git] / emacs_el / vc-svn17.el
1 ;;; vc-svn17.el --- Subversion 1.7 support for vc-svn on Emacs23
2
3 ;; Copyright (C) 2012  Taiki SUGAWARA <buzz.taiki@gmail.com>
4
5 ;; Author: Taiki SUGAWARA <buzz.taiki@gmail.com>
6 ;; Maintainer: Taiki SUGAWARA <buzz.taiki@gmail.com>
7 ;; Version: 0.01
8 ;; URL: https://github.com/buzztaiki/vc-svn17-el
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;; This package provides subversion 1.7 support for vc-svn on Emacs23.
26 ;; 
27 ;; To use this package, put followings in your .emacs:
28 ;; 
29 ;;     (require 'vc-svn17)
30
31 ;;; Code:
32
33 (require 'vc-svn)
34
35 (defmacro vc-svn17-defun (name args &rest body)
36   (declare (indent defun))
37   `(when (<= emacs-major-version 23)
38      ,(if (stringp (car body))
39           `(defun ,name ,args ,(car body) ,@(cdr body))
40         `(defun ,name ,args nil ,@body))))
41
42 (defmacro vc-svn17-repfun (name args &rest body)
43   (declare (indent defun))
44   `(when (<= emacs-major-version 23)
45      (defadvice ,name (around vc-svn17 ,args activate)
46        (setq ad-return-value ,@body))))
47
48
49 (vc-svn17-defun vc-svn-root (file)
50   (vc-find-root file vc-svn-admin-directory))
51
52 (vc-svn17-repfun vc-svn-registered (file)
53   (when (vc-svn-root file)
54     (with-temp-buffer
55       (cd (file-name-directory file))
56       (let* (process-file-side-effects
57              (status
58               (condition-case nil
59                   ;; Ignore all errors.
60                   (vc-svn-command t t file "status" "-v")
61                 (error nil))))
62         (when (eq 0 status)
63           (let ((parsed (vc-svn-parse-status file)))
64             (and parsed (not (memq parsed '(ignored unregistered))))))))))
65
66 (vc-svn17-repfun vc-svn-responsible-p (file)
67   (vc-svn-root file))
68
69 (vc-svn17-repfun vc-svn-repository-hostname (dirname)
70   (with-temp-buffer
71     (let (process-file-side-effects)
72       (vc-svn-command t t dirname "info"))
73     (goto-char (point-min))
74     (when (re-search-forward "^URL: *\\(.*\\)" nil t)
75       (match-string 1))))
76
77 (provide 'vc-svn17)
78 ;;; vc-svn17.el ends here