From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.help Subject: Re: editable-list widgets: how to create one child automatically Date: Thu, 14 Mar 2024 08:19:47 -0300 Message-ID: <3bd67ed7-9bad-4012-8af4-fad1af876fea@gmail.com> References: <871q8ebnnb.fsf@web.de> <2745da17-e046-47d6-8ce7-8647ada33451@gmail.com> <87o7bhwp3z.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18068"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Michael Heerdegen , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 14 12:20:31 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rkj8R-0004YY-M6 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 14 Mar 2024 12:20:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkj7z-0006CC-38; Thu, 14 Mar 2024 07:20:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkj7u-0006BD-3q for help-gnu-emacs@gnu.org; Thu, 14 Mar 2024 07:19:58 -0400 Original-Received: from mail-oo1-xc35.google.com ([2607:f8b0:4864:20::c35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rkj7s-0003jQ-Ji for help-gnu-emacs@gnu.org; Thu, 14 Mar 2024 07:19:57 -0400 Original-Received: by mail-oo1-xc35.google.com with SMTP id 006d021491bc7-5a43329565cso224936eaf.3 for ; Thu, 14 Mar 2024 04:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710415194; x=1711019994; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:newsgroups:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=u6f49gO0Z7q8lg7zUppPNeGLWMbmnToCHiJuZ0YkUWk=; b=AE8e9jcJ5objFFjAPF7zUboLe/RLKjJ7SncdwVZ362azi8mNgvsO2ey1Cot6Q/E3Z7 DrNpaqc3blViD4ylaUUTRr1xPX1JRfg8CCfN+wJFJsq3VLqOxNFhJtD2iYMz04ZqYQV7 SB6vgkd85x46kuRG5DwcnspV9rdLhKEgNulQbbLwjv/lusBqPzQpv01ITr7v2IVxlwRD vYzB+vZhhnOUHFTUdSzDTAEqRRm00cKwXK622dLOpvL3tdNzCRRJaiKMTha6/+LO/yid xoyk1JWjKOQbE6QUWEpVxLQbKtUSC2er9ZQEtbGrY6NrjTb/GNhz4ToPykBVMfA9ruiT kj9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710415194; x=1711019994; h=content-transfer-encoding:in-reply-to:from:content-language :references:newsgroups:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u6f49gO0Z7q8lg7zUppPNeGLWMbmnToCHiJuZ0YkUWk=; b=Jzj2JSvhFEr8jYo6R3SQlzdPj2KE4GhUyiw1Tz+P5SQNQwmvgCzBUEkLQh5bCGgk7A llTWSLisI2c3OL7S09xwMWI/rF5i2KSy+BvddpZuyEtm936hqwOm5NAy4MQiBOpeN6fy 5Q7W3lr54aot3SqOBBZHNFdXRGH/fWSJcwKq4nZ/4bhCRFDx4XZWsAvIIDi7KwQ6XqOz 1MVdmTvQQJIUdSzk74bS/MDZboTNPNJ+WEQI5H8uKAI8+KWL5jgZxduAN1kfYrfGQW3z YsxqGFJpcFKLIOwFNW9z5jHd9StpLpPuwgjiR5Bb5K20q9U0BcYFXDA0vK948RX5s1EJ nm9g== X-Forwarded-Encrypted: i=1; AJvYcCVrVvpQ6PiBPLwbG//7X95pm5/HLlS2wVWjUranng/jDMv3k5ET3UGTX6w0+Bd3IrnCFCt+MYAIYBXAkipZwuiel5Ou2zDB X-Gm-Message-State: AOJu0YyM3a1d09BUNdWJLCXb8VauSLsAEGgkE+HAkO8u//0N3Y2iQkmp +tFRtZfue5Krap1dfP6YUMw9tJmAgIfGZm4Np+9gcFyg3O1X0tHQZD58Brtz X-Google-Smtp-Source: AGHT+IHc7nCNiqSyyMKM5IOFqoU4MmnU4Sl55ttjU6FI4ACJxuRiM4995YzN8SeA6hLT/N2A4osjOg== X-Received: by 2002:a05:6358:8416:b0:17e:694d:57f9 with SMTP id b22-20020a056358841600b0017e694d57f9mr1601195rwk.31.1710415194080; Thu, 14 Mar 2024 04:19:54 -0700 (PDT) Original-Received: from [192.168.0.100] ([181.228.33.6]) by smtp.gmail.com with ESMTPSA id a2-20020a63bd02000000b005dbf22d6e1asm470217pgf.56.2024.03.14.04.19.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 04:19:53 -0700 (PDT) Original-Newsgroups: gmane.emacs.help Content-Language: en-US In-Reply-To: <87o7bhwp3z.fsf@web.de> Received-SPF: pass client-ip=2607:f8b0:4864:20::c35; envelope-from=maurooaranda@gmail.com; helo=mail-oo1-xc35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146090 Archived-At: On 13/3/24 22:58, Michael Heerdegen via Users list for the GNU Emacs text editor wrote: > Mauro Aranda writes: > >> (widget-create 'editable-list >> :value (list my-first-default) >> ;; Change according to the child type. >> '(editable-field)) >> >> Does that not do what you want? > > I think I can't use this: I don't create an ad-hoc widget, I need an > `define-widget' expression to define the widget to behave accordingly > when created. OK, but still the :value should be respected when given inside a define-widget. > And the widget this is about is a part of a group widget definition so > there will never be an explicit `widget-create' call by me, the widget > will always be created implicitly by the parent. > > And in this definition a :value spec is more or less ignored - in my > tests that child widget will always be created with a nil widget value. This shouldn't happen. But what I think is happening is that when you're creating the find widget, I guess when funcalling this: (defvar find-cmd-widget-default-start-fun (lambda () (setq-local find-cmd-widget-main-widget (widget-create 'find)))) The find widget gets created with a nil value, which, when trying to match against its children values, won't match when the editable-list has a different value, like (list default-directory) Because of that, the code understands that it should override the :value property of the editable-list to a nil value, hence the empty editable-list. So I think a better way is to provide a matching value for the find widget that will allow it to create its children with their default values.