help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Switching sets of variables


From: Andreas Röhler
Subject: Re: Switching sets of variables
Date: Thu, 04 Mar 2010 08:19:12 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Sven Bretfeld wrote:
> Hi to all
> 
> I want to have two sets of different values for the same variables and
> switch between these sets.
> 
> For example:
> 
> ,----First set: org-mode settings for my private context
> |
> |   (defvar org-gtd-file "~/private.org")
> |   (setq org-todo-keywords '((type "NEXT" "WAITING" "APPT" "DONE")))
> |   (setq org-tag-alist '(("OFFICE" . ?o)
> |                       ("HOME" . ?h)
> |                       ("READING" . ?r)
> |                       ("SHOPPING" . ?s)))
> `----
> 
> ,----Second set: org-mode settings for office organization
> | 
> |   (defvar org-gtd-file "~/institute.org")
> |   (setq org-todo-keywords '((type "PRESENT" "HOLIDAY" "DELEGATED" "DONE")))
> |   (setq org-tag-alist '(("ANNE" . ?a)
> |                       ("MARY" . ?m)
> |                       ("JOE" . ?j)
> |                       ("FRED" . ?f)))
> | 
> `----
> 
> I want to have a function that switches between these sets. How could
> that be done?
> 
> Thanks for help,
> 
> Sven
> 
> 
> 


Maybe define a variable, indicating the state

(defvar privat-org nil
  "If privat-org settings are active, otherwise institute-settings.")

then some function setting the vars with setq as you have shown.

(defun my-toggle-var-sets ()
  (interactive)
  (if privat-org
      (my-institute-settings)
    (my-private-settings)))

Both forms should set `privat-org' respectivly.

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]