Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
18c8a18e
Commit
18c8a18e
authored
Mar 16, 1993
by
Paul Eggert
Browse files
Merge today's change by eric with everybody else's
change (from 1992/08/04 through 1993/02/24).
parent
2e94b813
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
28 deletions
+42
-28
lisp/vc-hooks.el
lisp/vc-hooks.el
+42
-28
No files found.
lisp/vc-hooks.el
View file @
18c8a18e
...
...
@@ -5,7 +5,7 @@
;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
;; Version: 5.0
;; $Id: vc-hooks.el,v 1.
4
8 1993/03/1
5
2
1:42:57 esr
Exp $
;; $Id: vc-hooks.el,v 1.8
.1.1
1993/03/1
6
2
0:17:07 eggert
Exp $
;; This file is part of GNU Emacs.
...
...
@@ -68,29 +68,40 @@ the make-backup-files variable. Otherwise, prevents backups being made.")
;;; actual version-control code starts here
(
defun
vc-registered
(
file
)
;; Search for a master corresponding to the given file
(
let
((
dirname
(
or
(
file-name-directory
file
)
""
))
(
basename
(
file-name-nondirectory
file
)))
(
catch
'found
(
mapcar
(
function
(
lambda
(
s
)
(
let
((
trial
(
format
(
car
s
)
dirname
basename
)))
(
if
(
and
(
file-exists-p
trial
)
;; Make sure the file we found with name
;; TRIAL is not the source file itself.
;; That can happen with RCS-style names
;; if the file name is truncated
;; (e.g. to 14 chars). See if either
;; directory or attributes differ.
(
or
(
not
(
string=
dirname
(
file-name-directory
trial
)))
(
not
(
equal
(
file-attributes
file
)
(
file-attributes
trial
)))))
(
throw
'found
(
cons
trial
(
cdr
s
)))))))
vc-master-templates
)
nil
)
))
(
let
(
handler
handlers
)
(
if
(
boundp
'file-name-handler-alist
)
(
save-match-data
(
setq
handlers
file-name-handler-alist
)
(
while
(
and
(
consp
handlers
)
(
null
handler
))
(
if
(
and
(
consp
(
car
handlers
))
(
stringp
(
car
(
car
handlers
)))
(
string-match
(
car
(
car
handlers
))
file
))
(
setq
handler
(
cdr
(
car
handlers
))))
(
setq
handlers
(
cdr
handlers
)))))
(
if
handler
(
funcall
handler
'vc-registered
file
)
;; Search for a master corresponding to the given file
(
let
((
dirname
(
or
(
file-name-directory
file
)
""
))
(
basename
(
file-name-nondirectory
file
)))
(
catch
'found
(
mapcar
(
function
(
lambda
(
s
)
(
let
((
trial
(
format
(
car
s
)
dirname
basename
)))
(
if
(
and
(
file-exists-p
trial
)
;; Make sure the file we found with name
;; TRIAL is not the source file itself.
;; That can happen with RCS-style names
;; if the file name is truncated
;; (e.g. to 14 chars). See if either
;; directory or attributes differ.
(
or
(
not
(
string=
dirname
(
file-name-directory
trial
)))
(
not
(
equal
(
file-attributes
file
)
(
file-attributes
trial
)))))
(
throw
'found
(
cons
trial
(
cdr
s
)))))))
vc-master-templates
)
nil
)))))
(
defun
vc-backend-deduce
(
file
)
"Return the version-control type of a file, nil if it is not registered"
...
...
@@ -99,7 +110,7 @@ the make-backup-files variable. Otherwise, prevents backups being made.")
(
vc-file-setprop
file
'vc-backend
(
cdr
(
vc-registered
file
))))))
(
defun
vc-toggle-read-only
()
"If the file in the current buffer i
d
under version control, perform the
"If the file in the current buffer i
s
under version control, perform the
logical next version-control action; otherwise, just toggle the buffer's
read-only flag."
(
interactive
)
...
...
@@ -111,6 +122,7 @@ read-only flag."
"Set `vc-mode-string' to display type of version control for FILE.
The value is set in the current buffer, which should be the buffer
visiting FILE."
(
interactive
(
list
buffer-file-name
nil
))
(
let
((
vc-type
(
vc-backend-deduce
file
)))
(
if
vc-type
(
progn
...
...
@@ -125,6 +137,9 @@ visiting FILE."
;;; install a call to the above as a find-file hook
(
defun
vc-find-file-hook
()
;; Recompute whether file is version controlled,
;; if user has killed the buffer and revisited.
(
vc-file-setprop
buffer-file-name
'vc-backend
nil
)
(
if
(
and
(
vc-mode-line
buffer-file-name
)
(
not
vc-make-backup-files
))
(
progn
(
make-local-variable
'make-backup-files
)
...
...
@@ -158,7 +173,7 @@ Returns t if checkout was successful, nil otherwise."
(
define-key
global-map
"\C-xv"
vc-prefix-map
)
(
define-key
vc-prefix-map
"a"
'vc-update-change-log
)
(
define-key
vc-prefix-map
"c"
'vc-cancel-version
)
(
define-key
vc-prefix-map
"
=
"
'vc-di
ff
)
(
define-key
vc-prefix-map
"
d
"
'vc-di
rectory
)
(
define-key
vc-prefix-map
"h"
'vc-insert-headers
)
(
define-key
vc-prefix-map
"i"
'vc-register
)
(
define-key
vc-prefix-map
"l"
'vc-print-log
)
...
...
@@ -166,10 +181,9 @@ Returns t if checkout was successful, nil otherwise."
(
define-key
vc-prefix-map
"s"
'vc-create-snapshot
)
(
define-key
vc-prefix-map
"u"
'vc-revert-buffer
)
(
define-key
vc-prefix-map
"v"
'vc-next-action
)
(
define-key
vc-prefix-map
"
d
"
'vc-di
rectory
)
(
define-key
vc-prefix-map
"
=
"
'vc-di
ff
)
))
(
provide
'vc-hooks
)
;;; vc-hooks.el ends here
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment