[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Keybinding Cycle for various Capture and Agenda Setups
From: |
daniela-spit |
Subject: |
Keybinding Cycle for various Capture and Agenda Setups |
Date: |
Sun, 29 Nov 2020 21:13:21 +0100 |
I have made a few different templates for Org Capture and different
setups for Org Agenda. One basically uses typh-capture-set-instance
and typh-agenda-set-instance to perform the switch. The approach works.
Now I am trying to make a keybinding that can switch between
typh-capture-set-instance and typh-agenda-set-instance, then have
emacs ask me what selection I want.
Have encountered a problem on an appropriate way to set a keybinding
for what I want to do - mainly get a rapid way to change the instance
of Capture and of Agenda according to my instance setup.
;; ----------------------------------------------------------------------
(defun typh-capture-set-instance (n)
"Sets an instance for Note Capture.\n
Options: [1. cap-inst-earth] [2. cap-inst-atmosphere] [3. cap-inst-energy]"
(interactive "n Select [1. earth] [2. atmosphere] [3. energy]: ")
(pcase n
(1 (cap-inst-earth))
(2 (cap-inst-atmosphere))
(3 (cap-inst-energy))
(_ (progn (message "Org Capture value N not assigned.")
(message "See file.el"))) ))
;; ----------------------------------------------------------------------
(defun typh-agenda-set-instance (n)
"Sets an instance for Org Agenda.\n
Options: [1. agn-inst-earth] [2. agn-inst-atmosphere] [3. agn-inst-energy]"
(interactive
"n Agenda Select [1. earth] [2. atmosphere] [3. energy]: ")
(pcase n
(1 (agn-inst-earth))
(2 (agn-inst-atmosphere))
(3 (agn-inst-energy))
(_ (progn (message "Org Capture value N not assigned.")
(message "See file.el"))) ))
;; By default use Capture anh Agenda for Shiva
(cap-earth)
(agn-earth)
(defun typh-cycle-cap-agn ()
"Cycles setup for Note Capture and Org Agenda."
(interactive)
(when (not (eq last-command this-command))
(put this-command 'state 0))
(cond
((equal 0 (get this-command 'state))
(typh-capture-set-instance)
(put this-command 'state 1))
((equal 1 (get this-command 'state))
(typh-agenda-set-instance)
(put this-command 'state 0)) ))
(global-set-key (kbd "H-a") #'typh-cycle-cap-agn)
- Keybinding Cycle for various Capture and Agenda Setups,
daniela-spit <=