changeset 104076:5a8c46298f5a

* view.el (view-mode-enable): Don't define Helper-return-blurb if it's not needed.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 26 Jul 2009 23:06:49 +0000
parents c7151fe5a933
children 3abca9a8122f
files lisp/ChangeLog lisp/view.el
diffstat 2 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jul 26 19:20:51 2009 +0000
+++ b/lisp/ChangeLog	Sun Jul 26 23:06:49 2009 +0000
@@ -1,3 +1,8 @@
+2009-07-26  Chong Yidong  <cyd@stupidchicken.com>
+
+	* view.el (view-mode-enable): Don't define Helper-return-blurb if
+	it's not needed.
+
 2009-07-25  Eli Zaretskii  <eliz@gnu.org>
 
 	Fix Bug#3888:
--- a/lisp/view.el	Sun Jul 26 19:20:51 2009 +0000
+++ b/lisp/view.el	Sun Jul 26 23:06:49 2009 +0000
@@ -120,9 +120,6 @@
 (defvar view-old-Helper-return-blurb)
 (make-variable-buffer-local 'view-old-Helper-return-blurb)
 
-;; Just to avoid warnings.
-(defvar Helper-return-blurb)
-
 (defvar view-page-size nil
   "Default number of lines to scroll by View page commands.
 If nil that means use the window size.")
@@ -492,14 +489,15 @@
 	view-page-size nil
 	view-half-page-size nil
 	view-old-buffer-read-only buffer-read-only
-	buffer-read-only t
-	view-old-Helper-return-blurb (and (boundp 'Helper-return-blurb)
-					  Helper-return-blurb)
-	Helper-return-blurb
-	(format "continue viewing %s"
-		(if (buffer-file-name)
-		    (file-name-nondirectory (buffer-file-name))
-		  (buffer-name))))
+	buffer-read-only t)
+  (if (boundp 'Helper-return-blurb)
+      (setq view-old-Helper-return-blurb (and (boundp 'Helper-return-blurb)
+					      Helper-return-blurb)
+	    Helper-return-blurb
+	    (format "continue viewing %s"
+		    (if (buffer-file-name)
+			(file-name-nondirectory (buffer-file-name))
+		      (buffer-name)))))
   (force-mode-line-update)
   (run-hooks 'view-mode-hook))
 
@@ -516,8 +514,9 @@
   ;; so that View mode stays off if toggle-read-only is called.
   (if (local-variable-p 'view-read-only)
       (kill-local-variable 'view-read-only))
-  (setq view-mode nil
-	Helper-return-blurb view-old-Helper-return-blurb)
+  (setq view-mode nil)
+  (if (boundp 'Helper-return-blurb)
+      (setq Helper-return-blurb view-old-Helper-return-blurb))
   (if buffer-read-only
       (setq buffer-read-only view-old-buffer-read-only)))