Make vc-toggle-read-only an alias for toggle-read-only.

It hasn't worked in a VC sense since 2008-05-02T07:12:59Z!esr@snark.thyrsus.com, though this was
not documented at the time (grr).

* lisp/vc/vc-hooks.el (vc-toggle-read-only): Make it an obsolete alias
for toggle-read-only.  Note that this hasn't called vc-next-action
since 2008-05-02, though it wasn't documented at the time.

* lisp/files.el (toggle-read-only): Remove obsolete comment about
version control.

* doc/emacs/buffers.texi (Misc Buffer): Don't mention vc-toggle-read-only.

* lisp/cedet/ede.el (ede-maybe-checkout): Function deleted;
vc-toggle-read-only does not do version control now.

* lisp/cedet/ede/project-am.el (project-remove-file, project-add-file)
(project-new-target): Don't call ede-maybe-checkout.

* lisp/cedet/ede/util.el (ede-make-buffer-writable): Don't use
vc-toggle-read-only.

* lisp/vc/ediff-init.el (ediff-toggle-read-only-function): Use
toggle-read-only.
This commit is contained in:
Chong Yidong 2011-10-23 11:38:23 +08:00
parent 53ebff1ff0
commit 86c6068184
11 changed files with 44 additions and 56 deletions

View file

@ -1,3 +1,7 @@
2011-10-23 Chong Yidong <cyd@gnu.org>
* buffers.texi (Misc Buffer): Don't mention vc-toggle-read-only.
2011-10-22 Chong Yidong <cyd@gnu.org>
* windows.texi (Displaying Buffers): Fix broken lispref link.

View file

@ -231,13 +231,10 @@ whose access control says you cannot write it.
@findex toggle-read-only
If you wish to make changes in a read-only buffer, use the command
@kbd{C-x C-q} (@code{toggle-read-only}). It makes a read-only buffer
writable, and makes a writable buffer read-only. This
works by setting the variable @code{buffer-read-only}, which has a local
value in each buffer and makes the buffer read-only if its value is
non-@code{nil}. If you have files under version control, you may find
it convenient to bind @kbd{C-x C-q} to @code{vc-toggle-read-only}
instead. This will guard you against an operation that will confuse
most modern version-control systems. @xref{Version Control}.
writable, and makes a writable buffer read-only. This works by
setting the variable @code{buffer-read-only}, which has a local value
in each buffer and makes the buffer read-only if its value is
non-@code{nil}.
@findex rename-buffer
@kbd{M-x rename-buffer} changes the name of the current buffer. You

View file

@ -853,7 +853,12 @@ binding `log-view-expanded-log-entry-function' to a suitable function.
of a file similar to `vc-diff', but using ediff backend.
+++
*** The option vc-initial-comment was removed in Emacs 23.2, but
*** The option `vc-initial-comment' was removed in Emacs 23.2, but
this was not advertised at the time.
+++
*** `vc-toggle-read-only' is an obsolete alias for `toggle-read-only'.
Since Emacs 23, it has done the same thing as `toggle-read-only', but
this was not advertised at the time.
** FIXME: xdg-open for browse-url and reportbug, 2010/08.

View file

@ -1,3 +1,15 @@
2011-10-23 Chong Yidong <cyd@gnu.org>
* files.el (toggle-read-only): Remove obsolete comment about
version control.
* vc/vc-hooks.el (vc-toggle-read-only): Make it an obsolete alias
for toggle-read-only. Note that this hasn't called vc-next-action
since 2008-05-02, though it wasn't documented at the time.
* vc/ediff-init.el (ediff-toggle-read-only-function): Use
toggle-read-only.
2011-10-22 Alan Mackenzie <bug-cc-mode@gnu.org>
Fix bug #9560, sporadic wrong indentation; improve instrumentation

View file

@ -1,3 +1,14 @@
2011-10-23 Chong Yidong <cyd@gnu.org>
* ede.el (ede-maybe-checkout): Function deleted;
vc-toggle-read-only does not do version control now.
* ede/util.el (ede-make-buffer-writable): Don't use
vc-toggle-read-only.
* ede/project-am.el (project-remove-file, project-add-file)
(project-new-target): Don't call ede-maybe-checkout.
2011-10-19 Chong Yidong <cyd@gnu.org>
* ede.el (ede-minor-mode,global-ede-mode):

View file

@ -1179,16 +1179,6 @@ See also `ede-map-subprojects'."
Return the first non-nil value returned by PROC."
(eval (cons 'or (ede-map-targets this proc))))
;;; VC Handling
;;
(defun ede-maybe-checkout (&optional buffer)
"Check BUFFER out of VC if necessary."
(save-excursion
(if buffer (set-buffer buffer))
(if (and buffer-read-only vc-mode
(y-or-n-p "Checkout Makefile.am from VC? "))
(vc-toggle-read-only))))
;;; Some language specific methods.
;;

View file

@ -214,7 +214,6 @@ OT is the object target. DIR is the directory to start in."
target (project-am-preferred-target-type (buffer-file-name)))))
(ede-with-projectfile ot
(makefile-move-to-macro (project-am-macro ot))
(ede-maybe-checkout)
(makefile-end-of-command)
(insert " " ofn)
(makefile-fill-paragraph nil)
@ -226,10 +225,6 @@ OT is the object target. DIR is the directory to start in."
"Remove the current buffer from any project targets."
(ede-with-projectfile ot
(makefile-move-to-macro (project-am-macro ot))
(if (and buffer-read-only vc-mode
(y-or-n-p "Checkout Makefile.am from VC? "))
(vc-toggle-read-only t))
(ede-maybe-checkout)
(makefile-navigate-macro (concat " *" (regexp-quote (ede-name fnnd))))
(replace-match "" t t nil 0)
(makefile-fill-paragraph nil)
@ -271,7 +266,6 @@ buffer being in order to provide a smart default target type."
(if (not ot) (error "Error creating target object %S" ntype))
(ede-with-projectfile ot
(goto-char (point-min))
(ede-maybe-checkout)
(makefile-next-dependency)
(if (= (point) (point-min))
(goto-char (point-max))

View file

@ -87,12 +87,7 @@ their sources to VERSION."
If BUFFER isn't specified, use the current buffer."
(save-excursion
(if buffer (set-buffer buffer))
(if buffer-read-only
(if (and vc-mode
(y-or-n-p (format "Check out %s? " (buffer-file-name))))
(vc-toggle-read-only)
(if (not vc-mode)
(toggle-read-only -1))))))
(toggle-read-only -1)))
(provide 'ede/util)

View file

@ -4700,11 +4700,7 @@ and `view-read-only' is non-nil, enter view mode."
(not (eq (get major-mode 'mode-class) 'special)))
(view-mode-enter))
(t (setq buffer-read-only (not buffer-read-only))
(force-mode-line-update)))
(if (memq (vc-backend buffer-file-name) '(RCS SCCS))
(message "%s" (substitute-command-keys
(concat "File is under version-control; "
"use \\[vc-next-action] to check in/out"))))))
(force-mode-line-update)))))
(defun insert-file (filename)
"Insert contents of file FILENAME into buffer after point.

View file

@ -1340,11 +1340,9 @@ this variable represents.")
ovr-list))))))))
(defvar ediff-toggle-read-only-function nil
"*Specifies the function to be used to toggle read-only.
If nil, Ediff tries to deduce the function from the binding of C-x C-q.
Normally, this is the `toggle-read-only' function, but, if version
control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.")
(defvar ediff-toggle-read-only-function 'toggle-read-only
"Function to be used to toggle read-only status of the buffer.
If nil, Ediff tries using the command bound to C-x C-q.")
(defcustom ediff-make-buffers-readonly-at-startup nil
"Make all variant buffers read-only when Ediff starts up.

View file

@ -648,22 +648,8 @@ this function."
(throw 'found trial))))
templates))))
(defun vc-toggle-read-only (&optional verbose)
"Change read-only status of current buffer, perhaps via version control.
If the buffer is visiting a file registered with version control,
throw an error, because this is not a safe or really meaningful operation
on any version-control system newer than RCS.
Otherwise, just change the read-only flag of the buffer.
If you bind this function to \\[toggle-read-only], then Emacs
will properly intercept all attempts to toggle the read-only flag
on version-controlled buffer."
(interactive "P")
(if (vc-backend buffer-file-name)
(error "Toggling the readability of a version controlled file is likely to wreak havoc")
(toggle-read-only)))
(define-obsolete-function-alias
'vc-toggle-read-only 'toggle-read-only "24.1")
(defun vc-default-make-version-backups-p (backend file)
"Return non-nil if unmodified versions should be backed up locally.