From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Little help with defcustom Date: Mon, 09 Nov 2020 20:14:11 +0100 Message-ID: <871rh2mjgc.fsf@fastmail.fm> References: <87pn4mps0g.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14767"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.6; emacs 27.1.50 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 09 20:14:59 2020 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 1kcCd0-0003gc-9B for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 09 Nov 2020 20:14:58 +0100 Original-Received: from localhost ([::1]:51668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kcCcz-0001uL-BC for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 09 Nov 2020 14:14:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcCcP-0001u0-KD for help-gnu-emacs@gnu.org; Mon, 09 Nov 2020 14:14:21 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:37447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kcCcN-0005xq-Dt for help-gnu-emacs@gnu.org; Mon, 09 Nov 2020 14:14:21 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 07C737ED for ; Mon, 9 Nov 2020 14:14:17 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 09 Nov 2020 14:14:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= references:from:to:subject:in-reply-to:date:message-id :mime-version:content-type; s=fm1; bh=orr9WN7fS2GxVOCe9eHCdeTQow JyhNPvA/PYcYSangg=; b=HtjGKV1RgRSeKMsFzJN2Wck87Q53i5Q44+0/l2gSDd z3OhMQx7A0FS5EQtqo0o1Me3gk8InZQ0zBrN3aCyH9PhkIL+ZcuEi2wwig7iJIFx RFKSbeVosao0sEyFskDAc0xtXBPwugBRNf2Gs6kgEoxR6J8yi8F4Gnc+Jcax9JW/ un6u/avd1vr6qTyeK6Hnm8n0PPIFNphbPb/MiOr8AREbEx7zQXHaybsRdzTyjIuO Du2IbOtaPyN0E+DlsnMyBLtnO0MYoc/a7gaPdCA2onHaFx/bw333WrWQjcGb6apJ WXX6ZcioGAMsKoWn1plYYYeRSrmyo6eR4FYw0eBj3THA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=orr9WN 7fS2GxVOCe9eHCdeTQowJyhNPvA/PYcYSangg=; b=JpaUCkre+rS8aHtikcxbfC Wv30cgG1elfFUhosTgSfR/UFA/3QVw3DZR/404ozXMPPT0CfLIsaQCoQVpL75EfJ nWfNhEzHAb6nlRex3065XytkPbELfHefe9pkn/73ynuwlQyxZIWFNrOHvp/QDsgz /ixaGICDA/szhyY1p/6Tolygm8rJ2Dgj5NoSXHvSTQnChlrWcI5ekc/vEmWu68I2 CU8/Jhl6I3C3mTnxhTQNuBrJBR+Ad/smoduCapfqfQVED1tElh+9HnoL6zw/HD5S aW+C7zS4fn25068Mgv9wXTP7xzcQ9Q90ZdCnJx8x0p0+OCg6CcyHwI3zflEw1TQw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudduhedguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfhgfhffvufgjfffkgggtsehttd ertddtredtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgv mhgvrhhssehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpefhudffuefhud elhffgleeukeegudevtedtudduhfefteeugedvvedtuddugffffeenucfkphepleehrdel tddrvddvgedrvdeffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from Swift.fastmail.com (ip5f5ae0e9.dynamic.kabel-deutschland.de [95.90.224.233]) by mail.messagingengine.com (Postfix) with ESMTPA id E8D3F306301C for ; Mon, 9 Nov 2020 14:14:16 -0500 (EST) In-reply-to: Received-SPF: pass client-ip=64.147.123.19; envelope-from=joostkremers@fastmail.fm; helo=wout3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/09 13:46:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:125140 Archived-At: On Mon, Nov 09 2020, Jean Louis wrote: > :type '(repeat > (list :tag "Dynamical User Sets" > (string :tag " Server") > (string :tag "Set name") > (string :tag " Node ID")))) [...] > I see that to achieve best formatting I have to pad with spaces those > strings. Is there maybe better way? Not that I know of, no. I never bother, but it would be nice to be able to align the fields. > Is there a way to make sure that field is not empty? Honestly, I don't know. The Elisp manual says there's a `:validate' keyword that can be used to provide a function for validating the input. I've never used it, but here's an example from the Emacs sources (`lisp/calendar/todo.el`): ``` (defcustom todo-prefix "" "String prefixed to todo items for visual distinction." :type '(string :validate (lambda (widget) (when (string= (widget-value widget) todo-item-mark) (widget-put widget :error (format-message "Invalid value: must be distinct from `todo-item-mark'")) widget))) :initialize 'custom-initialize-default :set 'todo-reset-prefix :group 'todo-display) ``` You could even test whether a field has the correct format. HTH -- Joost Kremers Life has its moments