changeset 19357:e2131e9d3bf6

(widget-before-change): Obey `inhibit-read-only'.
author Richard M. Stallman <rms@gnu.org>
date Fri, 15 Aug 1997 19:26:07 +0000
parents 239b86c13fc3
children 33f430abc9ed
files lisp/wid-edit.el
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Fri Aug 15 19:24:41 1997 +0000
+++ b/lisp/wid-edit.el	Fri Aug 15 19:26:07 1997 +0000
@@ -1276,18 +1276,19 @@
 (defun widget-before-change (from to)
   ;; This is how, for example, a variable changes its state to `modified'.
   ;; when it is being edited.
-  (let ((from-field (widget-field-find from))
-	(to-field (widget-field-find to)))
-    (cond ((not (eq from-field to-field))
-	   (add-hook 'post-command-hook 'widget-add-change nil t)
-	   (error "Change should be restricted to a single field"))
-	  ((null from-field)
-	   (add-hook 'post-command-hook 'widget-add-change nil t)
-	   (error "Attempt to change text outside editable field"))
-	  (widget-field-use-before-change
-	   (condition-case nil
-	       (widget-apply from-field :notify from-field)
-	     (error (debug "Before Change")))))))
+  (unless inhibit-read-only
+    (let ((from-field (widget-field-find from))
+	  (to-field (widget-field-find to)))
+      (cond ((not (eq from-field to-field))
+	     (add-hook 'post-command-hook 'widget-add-change nil t)
+	     (error "Change should be restricted to a single field"))
+	    ((null from-field)
+	     (add-hook 'post-command-hook 'widget-add-change nil t)
+	     (error "Attempt to change text outside editable field"))
+	    (widget-field-use-before-change
+	     (condition-case nil
+		 (widget-apply from-field :notify from-field)
+	       (error (debug "Before Change"))))))))
 
 (defun widget-add-change ()
   (make-local-hook 'post-command-hook)