* 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
* Re: Keybinding Cycle for various Capture and Agenda Setups
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
0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-11-29 21:05 UTC (permalink / raw)
To: help-gnu-emacs
daniela-spit wrote:
OK, I have NO IDEA :D what you are doing, but -
> (defun typh-capture-set-instance (n)
>
> [...]
>
> (defun typh-agenda-set-instance (n)
but then
> (typh-capture-set-instance)
>
> [...]
>
> (typh-agenda-set-instance)
where's the n?
And, style points:
> (when (not
when not is `unless'!
> (global-set-key (kbd "H-a") #'typh-cycle-cap-agn)
You don't need the `kbd'. (ha)
Have you set up H as a prefix key? If so,
(global-set-key "\H-a" #'typh-cycle-cap-agn)
Good look!
luck :)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Keybinding Cycle for various Capture and Agenda Setups
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
0 siblings, 1 reply; 5+ messages in thread
From: daniela-spit @ 2020-11-29 21:27 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
> Sent: Sunday, November 29, 2020 at 10:05 PM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Keybinding Cycle for various Capture and Agenda Setups
>
> daniela-spit wrote:
>
> OK, I have NO IDEA :D what you are doing, but -
>
> > (defun typh-capture-set-instance (n)
> >
> > [...]
> >
> > (defun typh-agenda-set-instance (n)
>
> but then
>
> > (typh-capture-set-instance)
> >
> > [...]
> >
> > (typh-agenda-set-instance)
>
> where's the n?
Is that the problem?
> And, style points:
>
> > (when (not
>
> when not is `unless'!
Ok, Right.
> > (global-set-key (kbd "H-a") #'typh-cycle-cap-agn)
>
> You don't need the `kbd'. (ha)
>
> Have you set up H as a prefix key? If so,
Yes, I have.
> (global-set-key "\H-a" #'typh-cycle-cap-agn)
I use it as it is easier for those reading, as it is similar
to the way keybindings are described in the manual.
> Good look!
>
> luck :)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Keybinding Cycle for various Capture and Agenda Setups
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
0 siblings, 1 reply; 5+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-11-29 22:29 UTC (permalink / raw)
To: help-gnu-emacs
daniela-spit wrote:
>> OK, I have NO IDEA :D what you are doing, but -
>>
>>> (defun typh-capture-set-instance (n)
>>>
>>> [...]
>>>
>>> (defun typh-agenda-set-instance (n)
>>
>> but then
>>
>>> (typh-capture-set-instance)
>>>
>>> [...]
>>>
>>> (typh-agenda-set-instance)
>>
>> where's the n?
>
> Is that the problem?
I don't know if it's _the_ problem or _a_ problem but it is
a problem alright :)
Use the byte compiler!
It will tell your that
In typh-cycle-cap-agn:
... Warning: typh-capture-set-instance called with 0 arguments, but
requires 1
... Warning: typh-agenda-set-instance called with 0 arguments, but
requires 1
So step 1, get away with all warnings, and you are one step
closer to nowhere!
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Keybinding Cycle for various Capture and Agenda Setups
2020-11-29 22:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-11-30 2:57 ` daniela-spit
0 siblings, 0 replies; 5+ messages in thread
From: daniela-spit @ 2020-11-30 2:57 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
I think I get it now and can make some progress.
> Sent: Sunday, November 29, 2020 at 11:29 PM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Keybinding Cycle for various Capture and Agenda Setups
>
> daniela-spit wrote:
>
> >> OK, I have NO IDEA :D what you are doing, but -
> >>
> >>> (defun typh-capture-set-instance (n)
> >>>
> >>> [...]
> >>>
> >>> (defun typh-agenda-set-instance (n)
> >>
> >> but then
> >>
> >>> (typh-capture-set-instance)
> >>>
> >>> [...]
> >>>
> >>> (typh-agenda-set-instance)
> >>
> >> where's the n?
> >
> > Is that the problem?
>
> I don't know if it's _the_ problem or _a_ problem but it is
> a problem alright :)
:)
> Use the byte compiler!
>
> It will tell your that
>
> In typh-cycle-cap-agn:
> ... Warning: typh-capture-set-instance called with 0 arguments, but
> requires 1
> ... Warning: typh-agenda-set-instance called with 0 arguments, but
> requires 1
>
> So step 1, get away with all warnings, and you are one step
> closer to nowhere!
When I worked in France there was a road that took you to the woods,
then stopped.
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ 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.