From 86c606818495d9411fd5d6b1477f9a097eb18020 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 23 Oct 2011 11:38:23 +0800 Subject: [PATCH] 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. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/buffers.texi | 11 ++++------- etc/NEWS | 7 ++++++- lisp/ChangeLog | 12 ++++++++++++ lisp/cedet/ChangeLog | 11 +++++++++++ lisp/cedet/ede.el | 10 ---------- lisp/cedet/ede/project-am.el | 6 ------ lisp/cedet/ede/util.el | 7 +------ lisp/files.el | 6 +----- lisp/vc/ediff-init.el | 8 +++----- lisp/vc/vc-hooks.el | 18 ++---------------- 11 files changed, 44 insertions(+), 56 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index b90165cf55d..726f565e83e 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2011-10-23 Chong Yidong + + * buffers.texi (Misc Buffer): Don't mention vc-toggle-read-only. + 2011-10-22 Chong Yidong * windows.texi (Displaying Buffers): Fix broken lispref link. diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 5eba954773c..aed5473ac15 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -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 diff --git a/etc/NEWS b/etc/NEWS index 7b970807fe2..68e5720330d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c29f9cd4c7d..09e2e7dc1de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2011-10-23 Chong Yidong + + * 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 Fix bug #9560, sporadic wrong indentation; improve instrumentation diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index e622715ea2d..3dd0e6f78fd 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,14 @@ +2011-10-23 Chong Yidong + + * 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 * ede.el (ede-minor-mode,global-ede-mode): diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 2b5ca2ca3a2..14f09517b1d 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -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. ;; diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el index 88cf67e22ed..ec54d8151bc 100644 --- a/lisp/cedet/ede/project-am.el +++ b/lisp/cedet/ede/project-am.el @@ -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)) diff --git a/lisp/cedet/ede/util.el b/lisp/cedet/ede/util.el index fc4536ba88a..053180d4a8b 100644 --- a/lisp/cedet/ede/util.el +++ b/lisp/cedet/ede/util.el @@ -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) diff --git a/lisp/files.el b/lisp/files.el index 6321cff91fd..3ed9bd5a272 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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. diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 0d904ec85c4..eeaa2cfa927 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -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. diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index e7bfd273732..35fa11c2e5e 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -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. -- 2.39.5