unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: daniela-spit@gmx.it
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Keybinding Cycle for various Capture and Agenda Setups
Date: Sun, 29 Nov 2020 21:13:21 +0100	[thread overview]
Message-ID: <trinity-ef577386-3238-4557-9c1d-519325c6316d-1606680801203@3c-app-mailcom-bs12> (raw)

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)





             reply	other threads:[~2020-11-29 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 20:13 daniela-spit [this message]
2020-11-29 21:05 ` Keybinding Cycle for various Capture and Agenda Setups 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-ef577386-3238-4557-9c1d-519325c6316d-1606680801203@3c-app-mailcom-bs12 \
    --to=daniela-spit@gmx.it \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).