aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1997-08-15 19:26:07 +0000
committerRichard M. Stallman <[email protected]>1997-08-15 19:26:07 +0000
commit540a8bd25e435f304589dbdcaaa4ea790d27511b (patch)
tree14230000da1269cb84dd5fa07d4466a72abb5b9a /lisp/wid-edit.el
parent63abf6122ea8e8d315b98da92366ee2829d00c8b (diff)
(widget-before-change): Obey `inhibit-read-only'.
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 1d6de47722..b2beb229b3 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -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)