/[emacs]/emacs/lisp/vc-hooks.el
ViewVC logotype

Diff of /emacs/lisp/vc-hooks.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.150 by monnier, Thu May 8 17:45:08 2003 UTC revision 1.151 by monnier, Sat May 31 17:43:28 2003 UTC
# Line 1  Line 1 
1  ;;; vc-hooks.el --- resident support for version-control  ;;; vc-hooks.el --- resident support for version-control
2    
3  ;; Copyright (C) 1992,93,94,95,96,98,99,2000  Free Software Foundation, Inc.  ;; Copyright (C) 1992,93,94,95,96,98,99,2000,2003
4    ;;           Free Software Foundation, Inc.
5    
6  ;; Author:     FSF (see vc.el for full credits)  ;; Author:     FSF (see vc.el for full credits)
7  ;; Maintainer: Andre Spiegel <spiegel@gnu.org>  ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
# Line 195  and else calls Line 196  and else calls
196      (apply 'vc-default-FUN BACKEND ARGS)      (apply 'vc-default-FUN BACKEND ARGS)
197    
198  It is usually called via the `vc-call' macro."  It is usually called via the `vc-call' macro."
199    (let ((f (cdr (assoc function-name (get backend 'vc-functions)))))    (let ((f (assoc function-name (get backend 'vc-functions))))
200      (unless f      (if f (setq f (cdr f))
201        (setq f (vc-find-backend-function backend function-name))        (setq f (vc-find-backend-function backend function-name))
202        (put backend 'vc-functions (cons (cons function-name f)        (push (cons function-name f) (get backend 'vc-functions)))
203                                         (get backend 'vc-functions))))      (cond
204      (if (consp f)       ((null f)
205          (apply (car f) (cdr f) args)        (error "Sorry, %s is not implemented for %s" function-name backend))
206        (apply f args))))       ((consp f) (apply (car f) (cdr f) args))
207         (t         (apply f args)))))
208    
209  (defmacro vc-call (fun file &rest args)  (defmacro vc-call (fun file &rest args)
210    ;; BEWARE!! `file' is evaluated twice!!    ;; BEWARE!! `file' is evaluated twice!!
# Line 649  current, and kill the buffer that visits Line 651  current, and kill the buffer that visits
651      (vc-file-clearprops buffer-file-name)      (vc-file-clearprops buffer-file-name)
652      (cond      (cond
653       ((vc-backend buffer-file-name)       ((vc-backend buffer-file-name)
654          ;; Compute the state and put it in the modeline.
655        (vc-mode-line buffer-file-name)        (vc-mode-line buffer-file-name)
656        (cond ((not vc-make-backup-files)        (unless vc-make-backup-files
657               ;; Use this variable, not make-backup-files,          ;; Use this variable, not make-backup-files,
658               ;; because this is for things that depend on the file name.          ;; because this is for things that depend on the file name.
659               (make-local-variable 'backup-inhibited)          (set (make-local-variable 'backup-inhibited) t)))
              (setq backup-inhibited t))))  
660       ((let* ((link (file-symlink-p buffer-file-name))       ((let* ((link (file-symlink-p buffer-file-name))
661               (link-type (and link (vc-backend (file-chase-links link)))))               (link-type (and link (vc-backend (file-chase-links link)))))
662          (if link-type          (cond ((not link-type) nil)     ;Nothing to do.
663              (cond ((eq vc-follow-symlinks nil)                ((eq vc-follow-symlinks nil)
664                     (message                 (message
665          "Warning: symbolic link to %s-controlled source file" link-type))          "Warning: symbolic link to %s-controlled source file" link-type))
666                    ((or (not (eq vc-follow-symlinks 'ask))                ((or (not (eq vc-follow-symlinks 'ask))
667                         ;; If we already visited this file by following                     ;; If we already visited this file by following
668                         ;; the link, don't ask again if we try to visit                     ;; the link, don't ask again if we try to visit
669                         ;; it again.  GUD does that, and repeated questions                     ;; it again.  GUD does that, and repeated questions
670                         ;; are painful.                     ;; are painful.
671                         (get-file-buffer                     (get-file-buffer
672                          (abbreviate-file-name                      (abbreviate-file-name
673                           (file-chase-links buffer-file-name))))                       (file-chase-links buffer-file-name))))
674    
675                     (vc-follow-link)                 (vc-follow-link)
676                     (message "Followed link to %s" buffer-file-name)                 (message "Followed link to %s" buffer-file-name)
677                     (vc-find-file-hook))                 (vc-find-file-hook))
678                    (t                (t
679                     (if (yes-or-no-p (format                 (if (yes-or-no-p (format
680          "Symbolic link to %s-controlled source file; follow link? " link-type))          "Symbolic link to %s-controlled source file; follow link? " link-type))
681                         (progn (vc-follow-link)                     (progn (vc-follow-link)
682                                (message "Followed link to %s" buffer-file-name)                            (message "Followed link to %s" buffer-file-name)
683                                (vc-find-file-hook))                            (vc-find-file-hook))
684                       (message                   (message
685          "Warning: editing through the link bypasses version control")          "Warning: editing through the link bypasses version control")
686                       )))))))))                   ))))))))
687    
688  (add-hook 'find-file-hook 'vc-find-file-hook)  (add-hook 'find-file-hook 'vc-find-file-hook)
689    

Legend:
Removed from v.1.150  
changed lines
  Added in v.1.151

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26