unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).