0

So I can put a line like, (setq-default global-linum-mode t) or (setq-default electric-par-mode t) in my init file, and I can check with C-h v that the variables are in fact set to t (they are), but unless I actually M-x them on inside a file, they’re not having any effect. What might be going on?

I’m on an ssh terminal to a Debian Raspberry Pi, if relevant.

Drew
  • 75,699
  • 9
  • 109
  • 225
cryptograthor
  • 225
  • 1
  • 10
  • Another near duplicate: https://emacs.stackexchange.com/q/17031/105. – Drew Oct 26 '19 at 01:34
  • What do you mean M-x them? M-x set-variable? – JeanPierre Oct 26 '19 at 07:53
  • @JeanPierre I meant doing this twice: `m-x RET`, which appears to toggle the variable. The first toggle turns it off (though it never worked as if it was on, the variable claimed to be on, or t, rather), the second turns it on – cryptograthor Oct 26 '19 at 08:47
  • @drew Yeah, that solved my problem, thanks. I’m now curious what the difference between customize-set-variable and setq is however, and the post only says that they are different, not what the difference is. – cryptograthor Oct 26 '19 at 08:48
  • I think the answer to that other question answers what you're asking: `customize-set-variable' uses the `:set` property for the variable (option), and `setq` does not. – Drew Oct 26 '19 at 16:01

1 Answers1

0

You can get help for a particular variable via C-h v global-linum-mode. This will show you:

global-linum-mode is a variable defined in ‘linum.el’. Its value is nil

Documentation:
Non-nil if Global Linum mode is enabled.
See the ‘global-linum-mode’ command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node ‘Easy Customization’)
or call the function ‘global-linum-mode’.

So you can either set the value via the customization menu, or call the function (global-linum-mode) in your init, instead of using (setq-default global-linum-mode t).

There is a similar message waiting for you behind C-h v electric-pair-mode.

Tyler
  • 21,719
  • 1
  • 52
  • 92
  • Yep. I’ve taken a look at these. They’re both set to “t”. But my editor doesn’t act like it. – cryptograthor Oct 25 '19 at 22:08
  • I’m not sure what you mean by the customization menu. – cryptograthor Oct 25 '19 at 22:09
  • Doing this fixes one problem (the mode turns on and has effect), but causes others: slow startup and an error message about the mode: (`use-package :ensure t :init ()) – cryptograthor Oct 25 '19 at 22:17
  • 1. Setting the variables to `t` doesn't do anything, as the help message states (I put that part in **bold**) 2. Just putting the single line `(global-linum-mode)` in your init shouldn't cause an error related to use-package. I don't think we have all the information we need to fix this. – Tyler Oct 26 '19 at 02:15
  • Sorry. You did, and I didn’t realize what was meant. I hadn’t considered just putting `(global-linum-mode)` in my init, that actually worked, in addition to `use-package`, and `customize-set-variable`. So now I’m curious why one would ever use `setq`. – cryptograthor Oct 26 '19 at 08:51