Search code examples
variablesemacsorg-mode

How do I set a variable value in emacs org mode?


The org-mode tutorial often talks about setting the value of a variable to change the behavior of the mode. For example, in this org-mode tutorial:

This warning is deactivated if the task gets scheduled and you set org-agenda-skip-deadline-prewarning-if-scheduled to t.

I have been searching for a while but it looks like knowing how to set an emacs variable value is an assumed knowledge in many tutorials.

Could someone please educate me how and where to set variables in the org-mode? Is it set in the .emacs file or in each org file? Do these questions even make sense or am I missing some important concepts?

Thank you very much!


Solution

  • With Customize

    If you want some help about a variable, you can use C-h v then Emacs will ask you the variable name.

    There if you enter org-agenda-skip-deadline-prewarning-if-scheduled you will see a buffer with the variable description. At the end you will see a clickable customize. Click it and you will see an interactive buffer from which you can change variable value (saved in your .emacs file).

    Note: you can directly use M-x customize-option + variable name

    With setq lisp function:

    Another way is to directly use this:

    (setq org-agenda-skip-deadline-prewarning-if-scheduled t)
    
    • in your .emacs file or
    • in the *scratch* buffer, then M-x eval-buffer

    (Your modification is immediate but not saved.)