all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Keybinding Cycle for various Capture and Agenda Setups
@ 2020-11-29 20:13 daniela-spit
  2020-11-29 21:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 5+ messages in thread
From: daniela-spit @ 2020-11-29 20:13 UTC (permalink / raw)
  To: Help Gnu Emacs

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)





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-30  2:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-29 20:13 Keybinding Cycle for various Capture and Agenda Setups daniela-spit
2020-11-29 21:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-29 21:27   ` daniela-spit
2020-11-29 22:29     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-30  2:57       ` daniela-spit

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.