changeset 72160:183934d15fbb

(wdired-change-to-wdired-mode, wdired-change-to-dired-mode): Throw error if buffer is not in Dired and Wdired mode, respectively.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Fri, 28 Jul 2006 20:57:45 +0000
parents 97e2fe60196f
children 736ffad44f50
files lisp/wdired.el
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wdired.el	Fri Jul 28 18:08:11 2006 +0000
+++ b/lisp/wdired.el	Fri Jul 28 20:57:45 2006 +0000
@@ -238,6 +238,8 @@
 
 See `wdired-mode'."
   (interactive)
+  (or (eq major-mode 'dired-mode)
+      (error "Not a Dired buffer"))
   (set (make-local-variable 'wdired-old-content)
        (buffer-substring (point-min) (point-max)))
   (set (make-local-variable 'wdired-old-point) (point))
@@ -328,6 +330,8 @@
 
 (defun wdired-change-to-dired-mode ()
   "Change the mode back to dired."
+  (or (eq major-mode 'wdired-mode)
+      (error "Not a Wdired buffer"))
   (let ((inhibit-read-only t))
     (remove-text-properties (point-min) (point-max)
 			    '(read-only nil local-map nil)))