1

I was working on a mode, setq'ed them with my functions and... emacs broke (really)

For some reason these variable are global. I made them buffer-local, but is there a good reason for having them global in the first place or simply they forgot about them?

1 Answer 1

2

I can't think of a particular reason why it couldn't have been automatically buffer-local.

or simply they forgot about them?

More likely it was simply considered fine as it was, but you'd probably have to ask the person who added it.

In general some vars are defined as automatically buffer-local and some are not, and if you don't know then it's sensible to check before setting them (or you can use setq-local consistently when setting buffer-local values -- that's still fine if the variable is automatically buffer-local).

Personally, I always assume that setq may be setting a global value if I don't already know differently; so if I need a buffer-local value then I check my assumptions.

2
  • end-of-defun-function is not nil, it's a lambda for movement and it seems to be used a lot around. Woe on me to not check if it was buffer local in the first place, however Commented May 30, 2023 at 20:27
  • Ha. I too only looked at beginning-of-defun!
    – phils
    Commented May 30, 2023 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.