Search code examples
variablesemacsdocumentationorg-mode

How can I check whether a variable has a buffer-local value in Emacs `org-mode`?


How can I check that the value for org-drill-cram-hours has been set in the buffer (emacs-org-mode)?

# Local Variables:
# org-drill-cram-hours: 0
# org-drill-hide-item-headings-p: t
# End:
  1. I have the above in the TOP OF MY org-mode buffer.
  2. I re-opened the file using C-x C-v after adding these values.
  3. I don't think the local variable value is set, cause when I run org-drill-cram, it does not do what is expected (go over all the buffer points i.e.).

I want to check the local value set for org-drill-cram-hours, but when I do C-h v org-drill-cram-hours, I don't see the buffer-local value.

org-drill-cram-hours is a variable defined in ‘org-drill.el’.
Its value is 12

What am I missing? I don't want to use setq or C-h v variable to SET the value.

P.S.
(However if I change the variable value through C-h v var, then org-drill-cram works as expected.)


Solution

  • Just use C-h v org-drill-cram-hours with that buffer current.

    That tells you (1) the buffer-local value, if there is one, and (2) the global value. If it doesn't specify a buffer-local value then you haven't defined one for that buffer.


    For example, if buffer foobar has a buffer-local value then C-h v org-drill-cram-hours shows this:

    org-drill-cram-hours is a variable defined in `org-drill.el'.
    Its value is 0
    Original value was 12
    Local in buffer foobar; global value is 12