unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15479: Feature request: defcustom inherit type
@ 2013-09-28  6:20 Devin Homan
  2019-10-07 15:32 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Devin Homan @ 2013-09-28  6:20 UTC (permalink / raw)
  To: 15479

I think that it would be useful for client code to be able to create defcustom variables that
inherit their type properties from another defcustom variable so that changes in the provided code
are reflected in the client.  This would allow client code to create defcustom's that are used as
temporary, dynamic bindings that the user can customize without having to worry about additions to
the accepted types in the provided code.

For example, in the provided source there is:

(defcustom foo-bar "A" "Doc." :group foo :type '(string))

(defun foo-smash () "Doc." (message "%s" foo-bar))

(provide 'foo)

then the client code can have:

(require 'foo)

(defcustom cat-thing1 "B" "Doc." :group cat :type '(inherit foo-bar))

(defcustom cat-thing2 "C" "Doc." :group cat :type '(inherit foo-bar))

(let ((foo-bar cat-thing1)) (foo-smash))

(let ((foo-bar cat-thing2)) (foo-smash))

So if the maintainer of 'foo' decides to add an additional type, such as integer, then that change
will automatically be shown in 'cat'.





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

* bug#15479: Feature request: defcustom inherit type
  2013-09-28  6:20 bug#15479: Feature request: defcustom inherit type Devin Homan
@ 2019-10-07 15:32 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-07 15:32 UTC (permalink / raw)
  To: Devin Homan; +Cc: 15479

Devin Homan <devinwh7@gmail.com> writes:

> For example, in the provided source there is:
>
> (defcustom foo-bar "A" "Doc." :group foo :type '(string))
>
> (defun foo-smash () "Doc." (message "%s" foo-bar))
>
> (provide 'foo)
>
> then the client code can have:
>
> (require 'foo)
>
> (defcustom cat-thing1 "B" "Doc." :group cat :type '(inherit foo-bar))
>
> (defcustom cat-thing2 "C" "Doc." :group cat :type '(inherit foo-bar))

This sounds nice, but I don't think it's necessary to have an operator
for this.  You can just say

:type (get 'foo-bar 'custom-type)

and get the same effect.  So I'm closing this bug report.

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





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

end of thread, other threads:[~2019-10-07 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-28  6:20 bug#15479: Feature request: defcustom inherit type Devin Homan
2019-10-07 15:32 ` Lars Ingebrigtsen

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).