I'm a bit uncertain about which method to use for setting a variable: setq
, customize-set-variable
, or setopt
. I did some research online, and it seems that opinions on this matter are quite varied. Here are the options I'm considering:
Just use
setq
without overthinking it.Follow the suggestion from this website and use
customize-set-variable
when possible. https://macowners.club/posts/setq-vs-customize-set-variable/Use the
use-package
macro for configuring variables in the:custom
section. Nowuse-package
is part of Emacs core and I'm already using it for about 90% of my config.
These are the settings I want to review:
(setq-default
inhibit-startup-screen t ; Disable the startup screen
initial-scratch-message nil ; Empty the initial *scratch* buffer
indent-tabs-mode nil ; Insert space characters instead of tabs
tab-width 2 ; The number of spaces a tab is equal to
fill-column 78 ; Line length above which to break a line
cursor-type 'bar ; Display the cursor as a vertical bar)
Let's take the first one:
(setq inhibit-startup-screen t)
When I check how it looks with M-x customize-option
inhibit-startup-screen
the GUI interface says: CHANGED outside Customize.
(setopt inhibit-startup-screen t)
With setopt
, the same message: CHANGED outside Customize.
(customize-set-variable 'inhibit-startup-screen t)
On the other hand customize-set-variable
shows: SET for current session only, which according to the website I linked earlier might be the proper way of setting this variable? It's actually interesting that setopt
doesn't produce similar results, as it appears to have been added for user customizations according to what I read. Another possibility is that the message "SET for current session only" might not really matter?
If I go with "use-package," I think it'd be more elegant to customize all of these using the "emacs" package, right?
(use-package emacs
:ensure nil <-- configure a built-in package
:custom
..
.. move the variables here
..
..)
When I check how it looks with M-x customize-option
inhibit-startup-screen
when using use-package to customize, the GUI interface says: THEMED.
:-(
||| BTW, can you reduce that long section of your personal.emacs
? Most of it is not very helpful in finding the answer to this question. One who answers your question only needs to explain the principles; then you can review your.emacs
yourself.setopt
in Emacs.setopt
macro which did not exist when that older question was asked.