Emacs: how to get the default theme?

后端 未结 5 1995
悲&欢浪女
悲&欢浪女 2021-02-13 03:18

I\'ve been using the default theme with about 10 faces changed via custom-set-faces for a while now. But from time to time I want to try out a couple of the custom

相关标签:
5条回答
  • 2021-02-13 03:27

    Others have mentioned ways to try to work around the problem. I'll just point out that there is, so far, an inherent problem with Emacs custom themes, in terms of trying to "undo" them and get back to a previous, possibly customized but not custom-themed state.

    Particularly if you want to do this non-interactively, e.g., in the code for a command that lets users try themes out but also lets them cancel (e.g. C-g) and return to the previous state, before theming.

    You can disable all themes that were ever enabled in the session, but that will not return your session to its state before the themes were enabled. Disabling a theme is, in effect, only relative to other themes, not to an uncustomized state or (especially) to other, non-theme customizations.

    See also:

    • http://lists.gnu.org/archive/html/help-gnu-emacs/2014-02/msg00334.html
    • http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15687

    (Oh, and FWIW, color themes, which were presumably the inspiration for Emacs custom themes, do not have this problem. And they work fine with all Emacs versions, including the latest. They have different limitations from custom themes, however. It would be good for the custom theme implementation to be fixed/completed, so custom themes can completely replace color themes.)

    0 讨论(0)
  • 2021-02-13 03:27

    I have something like this in my emacs config to change themes:

    (defun zenburn ()
    "Activate zenburn theme."
    (interactive)
    (setq dark-theme t)
    ;; disable other themes before setting this theme
    (disable-theme 'soft-stone)
    (disable-theme 'leuven)
    (load-theme 'zenburn t))
    
    0 讨论(0)
  • 2021-02-13 03:28

    This is like a year after the original, but just solved a similar problem by M-x customize-face then entering default.

    Customize Face: Default will give you a GUI with options for things like font, foreground and background colors, etc.

    Go to the top area marked Operate on all settings in this buffer: and click on Revert and in the dropdown, Erase Customizations.

    Finally, reload/evaluate your .emacs or init.el file.

    This worked for me, while trying to manually disable (almost all) themes and float around .el files hadn't.

    0 讨论(0)
  • 2021-02-13 03:41

    Adding another answer here since you don't necessarily know the current theme:

    This removes all custom themes.

    (dolist (theme custom-enabled-themes)
      (disable-theme theme))
    
    0 讨论(0)
  • 2021-02-13 03:45

    It seems that disable-theme does what you want.

    UPDATE

    Here is one way to get the 'default theme template'

    1) Disable any additional theme (using disable-theme)

    2) Invoke the command customize-create-theme it will open a customize interface, which lists all the default faces, which you can customize and create your own theme

    If the customize-create-theme is called with theme name it will list all the faces that are set by the theme.

    0 讨论(0)
提交回复
热议问题