]> git.eshelyaron.com Git - emacs.git/commitdiff
(widget-before-change): Obey `inhibit-read-only'.
authorRichard M. Stallman <rms@gnu.org>
Fri, 15 Aug 1997 19:26:07 +0000 (19:26 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 15 Aug 1997 19:26:07 +0000 (19:26 +0000)
lisp/wid-edit.el

index 1d6de477221c6c156ad78be1e1d704d49b2e8ead..b2beb229b3b013c5273eff41713278d840df151e 100644 (file)
@@ -1276,18 +1276,19 @@ Unlike (get-char-property POS 'field) this, works with empty fields too."
 (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)