Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Up: Variables


57.3.1 Examining and Setting Variables

C-h v var <RET>
Display the value and documentation of variable var (describe-variable).
M-x set-variable <RET> var <RET> value <RET>
Change the value of variable var to value.

To examine the value of a single variable, use C-h v (describe-variable), which reads a variable name using the minibuffer, with completion. It displays both the value and the documentation of the variable. For example,

     C-h v fill-column <RET>

displays something like this:

     fill-column's value is 70
     
     Documentation:
     *Column beyond which automatic line-wrapping should happen.
     Automatically becomes buffer-local when set in any fashion.

The star at the beginning of the documentation indicates that this variable is a user option. C-h v is not restricted to user options; it allows any variable name.

The most convenient way to set a specific user option variable is with M-x set-variable. This reads the variable name with the minibuffer (with completion), and then reads a Lisp expression for the new value using the minibuffer a second time (you can insert the old value into the minibuffer for editing via M-n). For example,

     M-x set-variable <RET> fill-column <RET> 75 <RET>

sets fill-column to 75.

M-x set-variable is limited to user option variables, but you can set any variable with a Lisp expression, using the function setq. Here is a setq expression to set fill-column:

     (setq fill-column 75)

To execute an expression like this one, go to the ‘*scratch*’ buffer, type in the expression, and then type C-j. See Lisp Interaction.

Setting variables, like all means of customizing Emacs except where otherwise stated, affects only the current Emacs session. The only way to alter the variable in future sessions is to put something in the ~/.emacs file to set it those sessions (see Init File).


 
 
  Published under the terms of the GNU General Public License Design by Interspire