unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42801: 26.3; customize-apropos shows bogus State buttons after saving
@ 2020-08-10 16:27 Szunti
  2020-08-11 13:47 ` Mauro Aranda
  0 siblings, 1 reply; 4+ messages in thread
From: Szunti @ 2020-08-10 16:27 UTC (permalink / raw)
  To: 42801

After deleting user-emacs-directory (because can't save custom variables
with -Q), started emacs and did the following:

1) M-x customize-apropos RET inhibit RET
2) Toggled Inhibit Startup Screen's value:
Stepped with TAB-s to Inhibit Startup Screen's arrow, RET to open the
details, another TAB onto Toggle button and RET
3) Then typed C-x C-s, confirmed with yes RET

After this the customization buffer refreshed and all options despite
closed, got a State button with STANDARD value.

S-TAB thrice to get onto the State button of the previous option
(Inhibit Startup Echo Area Message) and after RET on the State button,
the echo area tells,

Symbol’s function definition is void: nil

In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
of 2020-05-19 built on felixonmars2
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Arch Linux

Recent messages:
Change the state of this item.
widget-apply: Symbol’s function definition is void: nil
Show or hide rest of the documentation.
Hide or show this option.
Change the state of this item.
user-error: Canceled
Show or hide rest of the documentation.
Create customization buffer for this group.
Show the value of this option.
Change the state of this item.
widget-apply: Symbol’s function definition is void: nil
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
--with-modules 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt'
CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
value of $LC_TIME: C
value of $LANG: hu_HU.utf8
locale-coding-system: utf-8-unix

Major mode: Custom

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils apropos cus-edit easymenu cus-start
cus-load wid-edit cl-loaddefs cl-lib elec-pair time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 120540 10887)
(symbols 48 21950 1)
(miscs 40 503 405)
(strings 32 32148 1208)
(string-bytes 1 840406)
(vectors 16 15666)
(vector-slots 8 518108 7434)
(floats 8 61 152)
(intervals 56 448 2)
(buffers 992 15))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#42801: 26.3; customize-apropos shows bogus State buttons after saving
  2020-08-10 16:27 bug#42801: 26.3; customize-apropos shows bogus State buttons after saving Szunti
@ 2020-08-11 13:47 ` Mauro Aranda
  2020-08-14 14:41   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Aranda @ 2020-08-11 13:47 UTC (permalink / raw)
  To: Szunti; +Cc: 42801


[-- Attachment #1.1: Type: text/plain, Size: 1284 bytes --]

tags 42801 patch
quit

Szunti <szunti@gmail.com> writes:

> 1) M-x customize-apropos RET inhibit RET
> 2) Toggled Inhibit Startup Screen's value:
> Stepped with TAB-s to Inhibit Startup Screen's arrow, RET to open the
> details, another TAB onto Toggle button and RET
> 3) Then typed C-x C-s, confirmed with yes RET
>
> After this the customization buffer refreshed and all options despite
> closed, got a State button with STANDARD value.
>
> S-TAB thrice to get onto the State button of the previous option
> (Inhibit Startup Echo Area Message) and after RET on the State button,
> the echo area tells,
>
> Symbol’s function definition is void: nil

Thanks for the bug report.

I can reproduce this bug in Emacs 26.3.  On current master, the bug
manifests
differently: we don't get the State buttons, but we do get the message:
Symbol's function definition is void: nil

The difference lies in `custom-variable-modified-p' bugging out before we
draw
the bogus State buttons for all options, because it is not supposed to
handle
hidden widgets.

The bug is that Custom-save recalculates the state and redraws all widgets,
even the hidden ones.  I propose the attached patch, that changes
Custom-save to only act on edited widgets in the buffer.

[-- Attachment #1.2: Type: text/html, Size: 1496 bytes --]

[-- Attachment #2: 0001-Make-sure-we-only-act-on-edited-widgets-in-Custom-sa.patch --]
[-- Type: text/x-patch, Size: 1917 bytes --]

From a659dcb694f8eb890d33f3ee1e5972ea7455ee64 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Tue, 11 Aug 2020 09:36:10 -0300
Subject: [PATCH] Make sure we only act on edited widgets in Custom-save

* lisp/cus-edit.el (Custom-save): Only act on edited widgets in the
  buffer.  If we attempt to redraw all widgets, we confuse
  custom-variable-modified-p, or we end up drawing State buttons for
  all options, including the hidden ones.  (Bug#42801)
---
 lisp/cus-edit.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 16695967df..c8cc6b800b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -801,16 +801,19 @@ Custom-save
 If a setting was edited and set before, this saves it.  If a
 setting was merely edited before, this sets it then saves it."
   (interactive)
-  (when (custom-command-apply
-	 (lambda (child)
-	   (when (memq (widget-get child :custom-state)
-		       '(modified set changed rogue))
-	     (widget-apply child :custom-mark-to-save)))
-	 "Save all settings in this buffer? " t)
-    ;; Save changes to buffer and redraw.
-    (custom-save-all)
-    (dolist (child custom-options)
-      (widget-apply child :custom-state-set-and-redraw))))
+  (let (edited-widgets)
+    (when (custom-command-apply
+	   (lambda (child)
+	     (when (memq (widget-get child :custom-state)
+		         '(modified set changed rogue))
+               (push child edited-widgets)
+	       (widget-apply child :custom-mark-to-save)))
+	   "Save all settings in this buffer? " t)
+      ;; Save changes to buffer.
+      (custom-save-all)
+      ;; Redraw and recalculate the state when necessary.
+      (dolist (widget edited-widgets)
+        (widget-apply widget :custom-state-set-and-redraw)))))
 
 (defun custom-reset (_widget &optional event)
   "Select item from reset menu."
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#42801: 26.3; customize-apropos shows bogus State buttons after saving
  2020-08-11 13:47 ` Mauro Aranda
@ 2020-08-14 14:41   ` Lars Ingebrigtsen
  2020-08-16 14:05     ` Mauro Aranda
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-14 14:41 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Szunti, 42801

Mauro Aranda <maurooaranda@gmail.com> writes:

> I can reproduce this bug in Emacs 26.3.  On current master, the bug manifests
> differently: we don't get the State buttons, but we do get the message:
> Symbol's function definition is void: nil
>
> The difference lies in `custom-variable-modified-p' bugging out before we draw
> the bogus State buttons for all options, because it is not supposed to handle
> hidden widgets.
>
> The bug is that Custom-save recalculates the state and redraws all widgets,
> even the hidden ones.  I propose the attached patch, that changes
> Custom-save to only act on edited widgets in the buffer.

Thanks; applied to Emacs 28.1.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#42801: 26.3; customize-apropos shows bogus State buttons after saving
  2020-08-14 14:41   ` Lars Ingebrigtsen
@ 2020-08-16 14:05     ` Mauro Aranda
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Aranda @ 2020-08-16 14:05 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Szunti, 42801

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
>> I can reproduce this bug in Emacs 26.3.  On current master, the bug
manifests
>> differently: we don't get the State buttons, but we do get the message:
>> Symbol's function definition is void: nil
>>
>> The difference lies in `custom-variable-modified-p' bugging out before
we draw
>> the bogus State buttons for all options, because it is not supposed to
handle
>> hidden widgets.
>>
>> The bug is that Custom-save recalculates the state and redraws all
widgets,
>> even the hidden ones.  I propose the attached patch, that changes
>> Custom-save to only act on edited widgets in the buffer.
>
> Thanks; applied to Emacs 28.1.

Thank you!

[-- Attachment #2: Type: text/html, Size: 998 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-16 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 16:27 bug#42801: 26.3; customize-apropos shows bogus State buttons after saving Szunti
2020-08-11 13:47 ` Mauro Aranda
2020-08-14 14:41   ` Lars Ingebrigtsen
2020-08-16 14:05     ` Mauro Aranda

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).