summaryrefslogtreecommitdiff
path: root/lisp/cus-edit.el
diff options
context:
space:
mode:
authorMauro Aranda <maurooaranda@gmail.com>2025-02-15 09:26:46 -0300
committerStefan Kangas <stefankangas@gmail.com>2025-02-23 01:15:24 +0100
commitf549cedaa2721bfc463fe714c00016aed21f7b5c (patch)
treeffb237831e7a5669d0029122fd7eee137b93a5cc /lisp/cus-edit.el
parent2044f6d9592cdec3a916c0d3c0a8a079c479db61 (diff)
downloademacs-f549cedaa2721bfc463fe714c00016aed21f7b5c.tar.gz
emacs-f549cedaa2721bfc463fe714c00016aed21f7b5c.tar.bz2
emacs-f549cedaa2721bfc463fe714c00016aed21f7b5c.zip
Fix comparison of current values for the key-sequence :type
* lisp/cus-edit.el (custom-variable-modified-p): Round-trip the option value before comparing it against the widget's value. This mostly fixes comparison against the obsolete key-sequence widget, but could fix other corner cases, when the widget accepts different types as values. (Bug#76156) * test/lisp/cus-edit-tests.el (cus-edit-test-bug76156) (cus-edit-test-bug76156-2): New test options. (cus-edit-test-unedited-option): New test.
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r--lisp/cus-edit.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 9addb078d87..5ce940bd0e5 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -3054,11 +3054,18 @@ To check for other states, call `custom-variable-state'."
(let* ((form (widget-get widget :custom-form))
(symbol (widget-get widget :value))
(get (or (get symbol 'custom-get) 'default-value))
- (value (if (default-boundp symbol)
- (condition-case nil
- (funcall get symbol)
- (error (throw 'get-error t)))
- (symbol-value symbol)))
+ (value-widget (car (widget-get widget :children)))
+ ;; Round-trip the value, for the sake of widgets that accept
+ ;; values of different types (e.g., the obsolete key-sequence widget
+ ;; which takes either strings or vectors. (Bug#76156)
+ (value
+ (widget-apply value-widget :value-to-external
+ (widget-apply value-widget :value-to-internal
+ (if (default-boundp symbol)
+ (condition-case nil
+ (funcall get symbol)
+ (error (throw 'get-error t)))
+ (symbol-value symbol)))))
(orig-value (widget-value (car (widget-get widget :children)))))
(not (equal (if (memq form '(lisp mismatch))
;; Mimic `custom-variable-value-create'.