From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: general customize-like data editor? Date: Wed, 14 Dec 2016 09:52:04 -0800 Message-ID: <87d1gumm9n.fsf@ericabrahamsen.net> References: <87pokuk0zb.fsf@lifelogs.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1481737949 29874 195.159.176.226 (14 Dec 2016 17:52:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2016 17:52:29 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 14 18:52:25 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHDj7-00077A-2F for ged-emacs-devel@m.gmane.org; Wed, 14 Dec 2016 18:52:25 +0100 Original-Received: from localhost ([::1]:49323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHDjB-0001YM-7l for ged-emacs-devel@m.gmane.org; Wed, 14 Dec 2016 12:52:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHDiz-0001NK-R2 for emacs-devel@gnu.org; Wed, 14 Dec 2016 12:52:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHDiw-0004tU-PW for emacs-devel@gnu.org; Wed, 14 Dec 2016 12:52:17 -0500 Original-Received: from [195.159.176.226] (port=52349 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cHDiw-0004tI-Ih for emacs-devel@gnu.org; Wed, 14 Dec 2016 12:52:14 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cHDip-0004J8-LS for emacs-devel@gnu.org; Wed, 14 Dec 2016 18:52:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 64 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:10ol322ceWEYIxIhXyxM+FERXnI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210462 Archived-At: Ted Zlatanov writes: > Several times[1] I've wished for a general data editor. > > It would behave like Customize but at the data level. The closest I've > found is `eieio-customize-object' from eieio-custom.el. The EIEIO > facilities make a lot of sense for this, and I don't think it's a big > burden for packages to map their *editable* structures to defclasses, > even if they don't buy into it generally. > > So my questions are: > > 1) are there non-EIEIO field editors, based on alists or plists when you > don't know all the fields in advance, but can specify their type? The > use case here is "I have a data structure with integer keys x, y, z; all > the rest should default to string editing." > > 2) inside Emacs, `eieio-customize-object' is only used by CEDET. Are > there other packages that use it? Any experiences, positive or negative? I've used it a grand total of once, and it works great. The code looks like this: (cl-defmethod ebdb-db-customize ((db ebdb-db)) (require 'eieio-custom) (eieio-customize-object db)) (cl-defmethod eieio-done-customizing ((db ebdb-db)) (setf (slot-value db 'dirty) t) (cl-call-next-method)) That's all I had to do! That plus :custom tags on the slot definitions. The only thing I find a little awkward is that you end up having semi-redundant information in the :type and :custom tags. > 3) currently `eieio-customize-object' is focused on editing a single > object. Are there table editors that would allow changing multiple > objects? For instance the process environment editor in > https://github.com/dgtized/list-environment.el could use that. The > use case here is "I have a data structure with a list of strings I'd > like to edit." This example sounds like you're customizing a single object, with a single slot, with a :type (list-of string) tag and a :custom (repeat string) tag (see what I mean about semi-redundancy?). So far as I know, this will work out of the box. Actually editing multiple objects in one Customize buffer would probably require new code. Eric > Clearly this parallels the Customize interface, which knows how to > validate and edit things like '(repeat string) etc. so if there are ways > to simply use that interface, that's probably easiest. But that doesn't > solve editing multiples as in (3) and seems to have a lot of hard-coded > behavior specific to customizing named variables. So I'm not sure what > to do. > > Thanks > Ted > > > [1] https://github.com/vmware/govmomi/issues/646 and https://github.com/dgtized/list-environment.el/issues/2 for instance