Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org layer overrides user configuration set in org-customize #5170

Closed
opie4624 opened this issue Feb 21, 2016 · 10 comments
Closed

Org layer overrides user configuration set in org-customize #5170

opie4624 opened this issue Feb 21, 2016 · 10 comments

Comments

@opie4624
Copy link
Contributor

Fixed in #5168

@opie4624
Copy link
Contributor Author

This actually happens in other layers besides Org, it just hasn't affected me. This is why the fix proposed in #5168 includes a portion of code in core-spacemacs.el and a portion in layers/org/packages.el.

@syl20bnr
Copy link
Owner

Can you provide repro steps ?

Also can you try to put your customized settings inside a with-eval-after-load or a use-package post config hook ?

@syl20bnr syl20bnr changed the title Org layer overrides user configuration set in org-customize Fixes #5168 - Org layer overrides user configuration set in org-customize Mar 5, 2016
@syl20bnr syl20bnr changed the title Fixes #5168 - Org layer overrides user configuration set in org-customize Org layer overrides user configuration set in org-customize Mar 5, 2016
@opie4624
Copy link
Contributor Author

Sorry for the super late response. 😐

Reproducing the issue:

  1. M-x customize-variable org-default-notes-file
  2. Set any file you like; mine is set to Inbox.org.
  3. Restart Emacs
  4. M-m a o c (Org Capture) file's task into notes.org

Emacs moves customize'd settings to a known place in the .emacs file each time, so moving it doesn't seem to help.

@opie4624
Copy link
Contributor Author

@syl20bnr My primary concern over blindly stepping on customized variables is that it effectively breaks documentation for the packages themselves. For example, the chapter on using and setting up Org Capture mode starts out encouraging users to use M-x customize-variable to configure the variables that Capture uses. Many of these are also set using setq in the layer files which execute after customize variables are setup.

Should this be a broader issue to establish a variable setting method used in layers other than setq that would respect any existing customized variables where appropriate?

@ruibinx
Copy link

ruibinx commented May 24, 2016

Moving auto-generated custom variables into dotspacemacs/user-config fixes this problem.

@opie4624
Copy link
Contributor Author

Correct. This fixes the problem, but breaks any usage of customize.

On Tue, May 24, 2016 at 12:09 PM Xing Robin notifications@github.com
wrote:

Moving auto-generated custom variables into dotspacemacs/user-config
fixes this problem.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#5170 (comment)

syl20bnr added a commit that referenced this issue Nov 23, 2016
New function `dotspacmacs/emacs-custom-settings` wrapping Emacs
custom settings sexps.
`dotspacemacs/emacs-custom-settings` is called just after the user
configuration (`dotspacemacs/user-config`)

Customize cannot write its auto-generated sexps inside a function, to
accomplish this we trick Emacs by setting the custom file to a file
in `.cache` directory, the path to this file is defined by the variable
`spacemacs--custom-file`. At the startup of Emacs we read this file
to insert its content inside the function
`dotspacemacs/emacs-custom-settings` in the dotfile, this is done in the
function `spacemacs/write-custom-settings-to-dotfile`.

I don't think we need to write the custom settings to the dotfile when
exiting Emacs as well, since we do it at startup at the very beginning
(i.e. before actually loading the dotfile) we should be OK.

Fixes #5170
@syl20bnr
Copy link
Owner

Should be fixed in develop with commit e699f18

@ksjogo
Copy link
Contributor

ksjogo commented Nov 29, 2016

This change broke some '--batch' '--eval' Emacs calls relying on customized values (e.g. 'paradox-github-token' for emacs upgrades via the command line). Is the function not called when in script mode?

Also the application of unsafe dir locals and their writing seems to cause issue, but I need to further pin that down.

@ksjogo
Copy link
Contributor

ksjogo commented Dec 1, 2016

Any customization I try with the gui at the moment will result in a "selected deleted buffer".

korayal pushed a commit to korayal/spacemacs that referenced this issue Dec 15, 2016
New function `dotspacmacs/emacs-custom-settings` wrapping Emacs
custom settings sexps.
`dotspacemacs/emacs-custom-settings` is called just after the user
configuration (`dotspacemacs/user-config`)

Customize cannot write its auto-generated sexps inside a function, to
accomplish this we trick Emacs by setting the custom file to a file
in `.cache` directory, the path to this file is defined by the variable
`spacemacs--custom-file`. At the startup of Emacs we read this file
to insert its content inside the function
`dotspacemacs/emacs-custom-settings` in the dotfile, this is done in the
function `spacemacs/write-custom-settings-to-dotfile`.

I don't think we need to write the custom settings to the dotfile when
exiting Emacs as well, since we do it at startup at the very beginning
(i.e. before actually loading the dotfile) we should be OK.

Fixes syl20bnr#5170
@et2010
Copy link
Contributor

et2010 commented Dec 16, 2016

This change broke some '--batch' '--eval' Emacs calls relying on customized values (e.g. 'paradox-github-token' for emacs upgrades via the command line).

Any customization I try with the gui at the moment will result in a "selected deleted buffer".

I think I got the same issue: #7963

@syl20bnr syl20bnr closed this as completed Apr 2, 2017
CodingSolo pushed a commit to CodingSolo/spacemacs that referenced this issue Oct 29, 2018
New function `dotspacmacs/emacs-custom-settings` wrapping Emacs
custom settings sexps.
`dotspacemacs/emacs-custom-settings` is called just after the user
configuration (`dotspacemacs/user-config`)

Customize cannot write its auto-generated sexps inside a function, to
accomplish this we trick Emacs by setting the custom file to a file
in `.cache` directory, the path to this file is defined by the variable
`spacemacs--custom-file`. At the startup of Emacs we read this file
to insert its content inside the function
`dotspacemacs/emacs-custom-settings` in the dotfile, this is done in the
function `spacemacs/write-custom-settings-to-dotfile`.

I don't think we need to write the custom settings to the dotfile when
exiting Emacs as well, since we do it at startup at the very beginning
(i.e. before actually loading the dotfile) we should be OK.

Fixes syl20bnr#5170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants