unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-devel@gnu.org
Subject: Question about defcustom and :set-after
Date: Mon, 30 Apr 2018 17:00:28 -0700	[thread overview]
Message-ID: <87vac8z1lv.fsf@ericabrahamsen.net> (raw)

I've been trying to do some fairly deep refactoring to Gnus, and have
been frustrated by the fact that it's very difficult to set up a clean
test environment for Gnus that also has some data in it to work with.

So I started writing support for a Gnus mock environment: you call
`gnus-mock' and it starts up a Gnus session completely independent of
your own Gnus customizations, that has some dummy data in it that gets
flushed and restored each time you restart the mock session.

That involves saving all relevant customizations (and some defvars) and
putting them aside, then setting all customization options (and some
defvars) back to their default values, and starting Gnus.

It isn't working quite right for me, I think because some customization
options depend on other customization options, and if they're set in the
wrong order, things don't get overwritten cleanly.

In particular I'm looking at options like this one:

(defcustom gnus-directory (or (getenv "SAVEDIR")
			      (nnheader-concat gnus-home-directory "News/"))
  "Directory variable from which all other Gnus file variables are derived.

Note that Gnus is mostly loaded when the `.gnus.el' file is read.
This means that other directory variables that are initialized from
this variable won't be set properly if you set this variable in `.gnus.el'.
Set this variable in `.emacs' instead."
  :group 'gnus-files
  :type 'directory)

`gnus-home-directory' is also an option. Shouldn't this option declare a
:set-after dependency on `gnus-home-directory'? There have also been bug
reports over the years about weirdness in this area, and I wonder if it
isn't all related.

Is this what :set-after is for, and would it make sense to add that
property to all Gnus options that depend on other options?

Eric




             reply	other threads:[~2018-05-01  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  0:00 Eric Abrahamsen [this message]
2018-05-01  0:37 ` Question about defcustom and :set-after Stefan Monnier
2018-05-01  1:33   ` Eric Abrahamsen
2018-05-01  3:54     ` Stefan Monnier
2018-05-01 16:20       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vac8z1lv.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).