aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-08-15 19:26:07 +0000
committerRichard M. Stallman1997-08-15 19:26:07 +0000
commit540a8bd25e435f304589dbdcaaa4ea790d27511b (patch)
tree14230000da1269cb84dd5fa07d4466a72abb5b9a
parent63abf6122ea8e8d315b98da92366ee2829d00c8b (diff)
downloademacs-540a8bd25e435f304589dbdcaaa4ea790d27511b.tar.gz
emacs-540a8bd25e435f304589dbdcaaa4ea790d27511b.zip
(widget-before-change): Obey `inhibit-read-only'.
-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 1d6de477221..b2beb229b3b 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."
1276(defun widget-before-change (from to) 1276(defun widget-before-change (from to)
1277 ;; This is how, for example, a variable changes its state to `modified'. 1277 ;; This is how, for example, a variable changes its state to `modified'.
1278 ;; when it is being edited. 1278 ;; when it is being edited.
1279 (let ((from-field (widget-field-find from)) 1279 (unless inhibit-read-only
1280 (to-field (widget-field-find to))) 1280 (let ((from-field (widget-field-find from))
1281 (cond ((not (eq from-field to-field)) 1281 (to-field (widget-field-find to)))
1282 (add-hook 'post-command-hook 'widget-add-change nil t) 1282 (cond ((not (eq from-field to-field))
1283 (error "Change should be restricted to a single field")) 1283 (add-hook 'post-command-hook 'widget-add-change nil t)
1284 ((null from-field) 1284 (error "Change should be restricted to a single field"))
1285 (add-hook 'post-command-hook 'widget-add-change nil t) 1285 ((null from-field)
1286 (error "Attempt to change text outside editable field")) 1286 (add-hook 'post-command-hook 'widget-add-change nil t)
1287 (widget-field-use-before-change 1287 (error "Attempt to change text outside editable field"))
1288 (condition-case nil 1288 (widget-field-use-before-change
1289 (widget-apply from-field :notify from-field) 1289 (condition-case nil
1290 (error (debug "Before Change"))))))) 1290 (widget-apply from-field :notify from-field)
1291 (error (debug "Before Change"))))))))
1291 1292
1292(defun widget-add-change () 1293(defun widget-add-change ()
1293 (make-local-hook 'post-command-hook) 1294 (make-local-hook 'post-command-hook)