* Setting keybinding for org-support-shift-select t
@ 2020-10-04 10:55 Christopher Dimech
2020-10-04 11:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 10:55 UTC (permalink / raw)
To: Help Gnu Emacs
How can I construct a keybinding to set
org-support-shift-select t
Also how do I turn off org-support-shift-select in my .el file?
Regards
C*
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 10:55 Setting keybinding for org-support-shift-select t Christopher Dimech
@ 2020-10-04 11:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:31 ` Christopher Dimech
2020-10-04 11:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 11:23 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> how do I turn off org-support-shift-select in my
> .el file?
See the docstring,
C-h v org-support-shift-select RET
it says "The default of this variable is nil".
But you can set it to whatever like this:
(setq org-support-shift-select 'always)
Don't forget to byte-compile your init file(s)...
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 11:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 11:31 ` Christopher Dimech
2020-10-04 11:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 11:31 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
Got it, thank you.
A related job is how to disable org-support-shift-select
using a keybinding operation.
Regards
C*
> Sent: Sunday, October 04, 2020 at 12:23 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: Setting keybinding for org-support-shift-select t
>
> Christopher Dimech wrote:
>
> > how do I turn off org-support-shift-select in my
> > .el file?
>
> See the docstring,
>
> C-h v org-support-shift-select RET
>
> it says "The default of this variable is nil".
> But you can set it to whatever like this:
>
> (setq org-support-shift-select 'always)
>
> Don't forget to byte-compile your init file(s)...
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 10:55 Setting keybinding for org-support-shift-select t Christopher Dimech
2020-10-04 11:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 11:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 12:14 ` Christopher Dimech
1 sibling, 1 reply; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 11:34 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> How can I construct a keybinding to set
>
> org-support-shift-select t
Well, here's a "straight"forward way do it:
(require 'org)
(define-key org-mode-map "\M-]"
(lambda ()
(interactive)
(let ((vals (list nil t 'always)))
(nconc vals vals)
(setq org-support-shift-select
(cadr (member org-support-shift-select vals)) ))))
:)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 11:31 ` Christopher Dimech
@ 2020-10-04 11:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 11:49 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> Got it, thank you.
>
> A related job is how to disable
> org-support-shift-select using
> a keybinding operation.
(defun function-name ()
(interactive)
;; do whatever you want
)
(require 'some-mode)
(define-key some-mode-map "[\MODIFIER-]key[-...]" #'function-name)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 11:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 11:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 12:25 ` Christopher Dimech
0 siblings, 1 reply; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 11:52 UTC (permalink / raw)
To: help-gnu-emacs
> (require 'some-mode)
>
> (define-key some-mode-map "[\MODIFIER-]key[-...]" #'function-name)
E.g., it can look like this:
(require 'org)
(define-key org-mode-map "\C-c\C-c" #'org-latex-export-to-pdf)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 11:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 12:14 ` Christopher Dimech
0 siblings, 0 replies; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 12:14 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
Very neat. I like it.
Regards
C*
> Sent: Sunday, October 04, 2020 at 12:34 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: Setting keybinding for org-support-shift-select t
>
> Christopher Dimech wrote:
>
> > How can I construct a keybinding to set
> >
> > org-support-shift-select t
>
> Well, here's a "straight"forward way do it:
>
> (require 'org)
> (define-key org-mode-map "\M-]"
> (lambda ()
> (interactive)
> (let ((vals (list nil t 'always)))
> (nconc vals vals)
> (setq org-support-shift-select
> (cadr (member org-support-shift-select vals)) ))))
>
> :)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 11:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 12:25 ` Christopher Dimech
2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
2020-10-04 12:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 12:25 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
A problem I am encountering with keybindings is that I end up with very strange
key combinations. I rather type a key followed by a string as is done in Emacs
such as "M-x org-mode". Is there an relatively easy way to do this for one's own
operations?
Cheers
C*
> Sent: Sunday, October 04, 2020 at 12:52 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: Setting keybinding for org-support-shift-select t
>
> > (require 'some-mode)
> >
> > (define-key some-mode-map "[\MODIFIER-]key[-...]" #'function-name)
>
> E.g., it can look like this:
>
> (require 'org)
>
> (define-key org-mode-map "\C-c\C-c" #'org-latex-export-to-pdf)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 12:25 ` Christopher Dimech
@ 2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
2020-10-04 12:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 14:03 ` Christopher Dimech
2020-10-04 12:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 2 replies; 27+ messages in thread
From: 2QdxY4RzWzUUiLuE @ 2020-10-04 12:40 UTC (permalink / raw)
To: help-gnu-emacs
On 2020-10-04 at 14:25:27 +0200,
Christopher Dimech <dimech@gmx.com> wrote:
> A problem I am encountering with keybindings is that I end up with
> very strange key combinations. I rather type a key followed by a
> string as is done in Emacs such as "M-x org-mode". Is there an
> relatively easy way to do this for one's own operations?
The same way Emacs does it: define your function as interactive, e.g.:
(defun scroll-up-1-line () "Scroll up one line."
(interactive) (scroll-up 1))
interactive can handle functions that take parameters, too, and will
prompt you when you execute the function with M-x. It can also
interpret C-u and other numeric prefixes.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 12:25 ` Christopher Dimech
2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
@ 2020-10-04 12:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 12:48 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> A problem I am encountering with keybindings is
> that I end up with very strange key combinations.
Well, you don't end up with anything, really, not
this early on at least, just pick key combinations
that makes sense to you... redefine or remove them,
if you later on don't like 'em.
First check with C-h k KEY that they don't do
anything useful already...
> I rather type a key followed by a string as is done
> in Emacs such as "M-x org-mode". Is there an
> relatively easy way to do this for one's
> own operations?
They have to be interactive (or "commands"), that's
all
(defun my-best-command-yet ()
(interactive)
;; do whatever you want
)
M-x my-best-command-yet RET
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
@ 2020-10-04 12:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 14:03 ` Christopher Dimech
1 sibling, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 12:54 UTC (permalink / raw)
To: help-gnu-emacs
2QdxY4RzWzUUiLuE wrote:
> (defun scroll-up-1-line () "Scroll up one line."
> (interactive) (scroll-up 1))
We should compare notes!
(defun scroll-up-1 ()
(interactive)
(scroll-down 1) )
... or maybe it is less fun that way?
https://dataswamp.org/~incal/emacs-init/scroll.el
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
2020-10-04 12:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 14:03 ` Christopher Dimech
2020-10-04 15:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 14:03 UTC (permalink / raw)
To: 2QdxY4RzWzUUiLuE; +Cc: help-gnu-emacs
Let's try to do a simple thing
I have (global-set-key (kbd "<f1> a") 'org-agenda)
How can I use "<f1> agenda" to fire org-agenda.
Regards
C*
> Sent: Sunday, October 04, 2020 at 1:40 PM
> From: 2QdxY4RzWzUUiLuE@potatochowder.com
> To: help-gnu-emacs@gnu.org
> Subject: Re: Setting keybinding for org-support-shift-select t
>
> On 2020-10-04 at 14:25:27 +0200,
> Christopher Dimech <dimech@gmx.com> wrote:
>
> > A problem I am encountering with keybindings is that I end up with
> > very strange key combinations. I rather type a key followed by a
> > string as is done in Emacs such as "M-x org-mode". Is there an
> > relatively easy way to do this for one's own operations?
>
> The same way Emacs does it: define your function as interactive, e.g.:
>
> (defun scroll-up-1-line () "Scroll up one line."
> (interactive) (scroll-up 1))
>
> interactive can handle functions that take parameters, too, and will
> prompt you when you execute the function with M-x. It can also
> interpret C-u and other numeric prefixes.
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 14:03 ` Christopher Dimech
@ 2020-10-04 15:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 16:19 ` Christopher Dimech
2020-10-04 16:57 ` Christopher Dimech
0 siblings, 2 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 15:02 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> Let's try to do a simple thing [...]
>
> How can I use "<f1> agenda" to fire org-agenda.
(require 'org)
(defalias 'agenda #'org-agenda)
(global-set-key [f1] #'execute-extended-command)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 15:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 16:19 ` Christopher Dimech
2020-10-04 18:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 16:57 ` Christopher Dimech
1 sibling, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 16:19 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
That's great, but if I want to fire my own function, I have used
the following to bind it to "<f2> q". But what if I want to use
"<f2> myagendaa" to fire the function myagenda
( defun myagendaa ()
(interactive)
(org-agenda)
)
(global-set-key (kbd "<f1> q") 'myagenda)
> Sent: Sunday, October 04, 2020 at 4:02 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: Setting keybinding for org-support-shift-select t
>
> Christopher Dimech wrote:
>
> > Let's try to do a simple thing [...]
> >
> > How can I use "<f1> agenda" to fire org-agenda.
>
> (require 'org)
>
> (defalias 'agenda #'org-agenda)
>
> (global-set-key [f1] #'execute-extended-command)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 15:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 16:19 ` Christopher Dimech
@ 2020-10-04 16:57 ` Christopher Dimech
2020-10-04 17:08 ` Drew Adams
2020-10-04 19:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 2 replies; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 16:57 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
The following gives me problems if I have keybindings associated
with <f1> such as "<f1> q" to display agenda
(global-set-key [f1] #'execute-extended-command)
Next is my code
( defun myagendaa ()
(interactive)
(org-agenda)
)
(global-set-key (kbd "<f1> q") 'myagendaa)
(defalias 'agenda #'myagenda)
(global-set-key [f1] #'execute-extended-command)
When I hit <f1>, it is showing as though I hit <M-x>
> Sent: Sunday, October 04, 2020 at 4:02 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: Setting keybinding for org-support-shift-select t
>
> Christopher Dimech wrote:
>
> > Let's try to do a simple thing [...]
> >
> > How can I use "<f1> agenda" to fire org-agenda.
>
> (require 'org)
>
> (defalias 'agenda #'org-agenda)
>
> (global-set-key [f1] #'execute-extended-command)
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: Setting keybinding for org-support-shift-select t
2020-10-04 16:57 ` Christopher Dimech
@ 2020-10-04 17:08 ` Drew Adams
2020-10-04 17:36 ` Christopher Dimech
2020-10-04 19:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 27+ messages in thread
From: Drew Adams @ 2020-10-04 17:08 UTC (permalink / raw)
To: Christopher Dimech, moasenwood; +Cc: help-gnu-emacs
> The following gives me problems if I have keybindings associated
> with <f1> such as "<f1> q" to display agenda
>
> (global-set-key [f1] #'execute-extended-command)
It's not clear to me what you're asking/saying.
But yes, if `f1' is defined as a prefix key, and
you then instead bind it to a command (and not
to a keymap), then it's no longer a prefix key.
It either is or isn't a prefix key. If bound to
`execute-extended-command' then it's not, so
`f1 q' won't work - as soon as you hit `f1' the
command `execute-extended-command' is invoked.
If bound to a prefix key, when you hit `f1' Emacs
waits for you to hit one or more additional keys,
to complete the key sequence.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: RE: Setting keybinding for org-support-shift-select t
2020-10-04 17:08 ` Drew Adams
@ 2020-10-04 17:36 ` Christopher Dimech
2020-10-04 17:52 ` Drew Adams
0 siblings, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 17:36 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, moasenwood
I have usually used key bindings to do some operations I like. But then,
the keybindings became too cryptic for me to remember and thought of
using my user defined function names for the more complicated operations.
As you are saying, I can either have <f1> defined as a Prefix-Key
or use it to call my user defined functions. Hover I cannot use <f1>
to do both - calling functions and using keybindings.
So then I might have, for example, <f1> to use with keybindings and
<f2> to use with my user defined functions.
Correct me if I am wrong, but I think I understood you.
> Sent: Sunday, October 04, 2020 at 6:08 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>, moasenwood@zoho.eu
> Cc: help-gnu-emacs@gnu.org
> Subject: RE: Setting keybinding for org-support-shift-select t
>
> > The following gives me problems if I have keybindings associated
> > with <f1> such as "<f1> q" to display agenda
> >
> > (global-set-key [f1] #'execute-extended-command)
>
> It's not clear to me what you're asking/saying.
>
> But yes, if `f1' is defined as a prefix key, and
> you then instead bind it to a command (and not
> to a keymap), then it's no longer a prefix key.
>
> It either is or isn't a prefix key. If bound to
> `execute-extended-command' then it's not, so
> `f1 q' won't work - as soon as you hit `f1' the
> command `execute-extended-command' is invoked.
>
> If bound to a prefix key, when you hit `f1' Emacs
> waits for you to hit one or more additional keys,
> to complete the key sequence.
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: RE: Setting keybinding for org-support-shift-select t
2020-10-04 17:36 ` Christopher Dimech
@ 2020-10-04 17:52 ` Drew Adams
2020-10-04 18:10 ` Christopher Dimech
0 siblings, 1 reply; 27+ messages in thread
From: Drew Adams @ 2020-10-04 17:52 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, moasenwood
> I have usually used key bindings to do some operations I like. But then,
> the keybindings became too cryptic for me to remember and thought of
> using my user defined function names for the more complicated operations.
>
> As you are saying, I can either have <f1> defined as a Prefix-Key
> or use it to call my user defined functions. Hover I cannot use <f1>
> to do both - calling functions and using keybindings.
>
> So then I might have, for example, <f1> to use with keybindings and
> <f2> to use with my user defined functions.
>
> Correct me if I am wrong, but I think I understood you.
Yes, I believe you understood.
A key can _either_ be bound to a keymap (and to
a prefix command, which is, in effect, just that
keymap) _or_ be bound to a command (which is not
a prefix command, i.e., not just a keymap).
Removing the parenthetical qualifications: A key
can either be bound to a keymap or to a command,
not to both.
Either Emacs sees only a prefix key and waits for
the rest of a key sequence or Emacs sees a completed
sequence and invokes its command.
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: RE: RE: Setting keybinding for org-support-shift-select t
2020-10-04 17:52 ` Drew Adams
@ 2020-10-04 18:10 ` Christopher Dimech
2020-10-04 19:00 ` Drew Adams
2020-10-04 19:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 18:10 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, moasenwood
Instead of using
(global-set-key [f2] #'execute-extended-command)
can I call my function directly,
(global-set-key "[f2] fnm" #'myfunction)
Cheers
C*
> Sent: Sunday, October 04, 2020 at 6:52 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org, moasenwood@zoho.eu
> Subject: RE: RE: Setting keybinding for org-support-shift-select t
>
> > I have usually used key bindings to do some operations I like. But then,
> > the keybindings became too cryptic for me to remember and thought of
> > using my user defined function names for the more complicated operations.
> >
> > As you are saying, I can either have <f1> defined as a Prefix-Key
> > or use it to call my user defined functions. Hover I cannot use <f1>
> > to do both - calling functions and using keybindings.
> >
> > So then I might have, for example, <f1> to use with keybindings and
> > <f2> to use with my user defined functions.
> >
> > Correct me if I am wrong, but I think I understood you.
>
> Yes, I believe you understood.
>
> A key can _either_ be bound to a keymap (and to
> a prefix command, which is, in effect, just that
> keymap) _or_ be bound to a command (which is not
> a prefix command, i.e., not just a keymap).
>
> Removing the parenthetical qualifications: A key
> can either be bound to a keymap or to a command,
> not to both.
>
> Either Emacs sees only a prefix key and waits for
> the rest of a key sequence or Emacs sees a completed
> sequence and invokes its command.
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 16:19 ` Christopher Dimech
@ 2020-10-04 18:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 19:26 ` Christopher Dimech
0 siblings, 1 reply; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 18:57 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> but if I want to fire my own function
??? Is this an attempt at trolling? But OK ...
You invoke all interactive functions (commands) the
same way, it doesn't matter if it is your own or
anyone else's.
You can assign them to a keystroke (best for stuff
that is commonly used), and then choose any key or
key combination you'd like (see previous posts).
If you don't want to do that, but instead type the
entire function name, you can do
M-x function-name RET
M-: (function-name [ARGS]) RET
or type (function-name [ARGS]) and evaluate, as in
(forward-char 1)
^ evaluate me
You can also use aliases to type whatever you want
instead of the proper name.
> I have used the following to bind it to "<f2> q".
> But what if I want to use "<f2> myagendaa" to fire
> the function myagenda
Do you want to type it, use M-x function-name RET.
You don't need to do anything extra, just write the
interactive function and evaluate it.
If you instead want to assign it to some key, well...
do it!
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: RE: RE: Setting keybinding for org-support-shift-select t
2020-10-04 18:10 ` Christopher Dimech
@ 2020-10-04 19:00 ` Drew Adams
2020-10-05 3:55 ` Christopher Dimech
2020-10-04 19:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 27+ messages in thread
From: Drew Adams @ 2020-10-04 19:00 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs, moasenwood
> Instead of using
>
> (global-set-key [f2] #'execute-extended-command)
>
> can I call my function directly,
>
> (global-set-key "[f2] fnm" #'myfunction)
Not with that KEY argument to `global-set-key'.
You can bind your function to a legitimate KEY value.
(global-set-key (kbd "<f2> x") 'myfunction)
You need to read up on key bindings. Start with
`C-h r key bindings', which takes you here, but
in Emacs:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Key-Bindings.html
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 16:57 ` Christopher Dimech
2020-10-04 17:08 ` Drew Adams
@ 2020-10-04 19:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 19:10 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> The following gives me problems if I have
> keybindings associated with <f1> such as "<f1> q"
> to display agenda
>
> (global-set-key [f1] #'execute-extended-command)
>
> Next is my code
>
> ( defun myagendaa ()
> (interactive)
> (org-agenda)
> )
>
> (global-set-key (kbd "<f1> q") 'myagendaa)
>
> (defalias 'agenda #'myagenda)
> (global-set-key [f1] #'execute-extended-command)
>
> When I hit <f1>, it is showing as though I hit
> <M-x>
??? are you for real?
If you want to bind a shortcut to a command, then
yes, something like this is enough:
(require 'org-agenda)
(defun agenda ()
(interactive)
(org-agenda) )
(global-set-key [f1 ?q] #'agenda)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 18:10 ` Christopher Dimech
2020-10-04 19:00 ` Drew Adams
@ 2020-10-04 19:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 19:16 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> can I call my function directly,
>
> (global-set-key "[f2] fnm" #'myfunction)
Find out by evaluating that and see what happens...
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 18:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-04 19:26 ` Christopher Dimech
2020-10-04 19:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-04 19:26 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
Not a troll, but looking hard on various ways to do things, which would
then be useful for other when I release the code.
My idea is this:
Call the operation using the function name using "<f2> func-name".
But this is the same as doing "M-x func-name".
However, can I use the <f1> prefix before the function name
just to show just my functions, not all of them.
> Sent: Sunday, October 04, 2020 at 7:57 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: Setting keybinding for org-support-shift-select t
>
> Christopher Dimech wrote:
>
> > but if I want to fire my own function
>
> ??? Is this an attempt at trolling? But OK ...
>
> You invoke all interactive functions (commands) the
> same way, it doesn't matter if it is your own or
> anyone else's.
>
> You can assign them to a keystroke (best for stuff
> that is commonly used), and then choose any key or
> key combination you'd like (see previous posts).
>
> If you don't want to do that, but instead type the
> entire function name, you can do
>
> M-x function-name RET
>
> M-: (function-name [ARGS]) RET
>
> or type (function-name [ARGS]) and evaluate, as in
>
> (forward-char 1)
> ^ evaluate me
>
> You can also use aliases to type whatever you want
> instead of the proper name.
>
> > I have used the following to bind it to "<f2> q".
> > But what if I want to use "<f2> myagendaa" to fire
> > the function myagenda
>
> Do you want to type it, use M-x function-name RET.
> You don't need to do anything extra, just write the
> interactive function and evaluate it.
>
> If you instead want to assign it to some key, well...
> do it!
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-04 19:26 ` Christopher Dimech
@ 2020-10-04 19:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-04 19:34 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> My idea is this:
>
> Call the operation using the function name using
> "<f2> func-name". But this is the same as doing
> "M-x func-name".
>
> However, can I use the <f1> prefix before the
> function name just to show just my functions, not
> all of them.
Go ahead :)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: RE: RE: RE: Setting keybinding for org-support-shift-select t
2020-10-04 19:00 ` Drew Adams
@ 2020-10-05 3:55 ` Christopher Dimech
2020-10-05 4:12 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 27+ messages in thread
From: Christopher Dimech @ 2020-10-05 3:55 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, moasenwood
I am getting a bit confused on the to use
#'func-name
and when using
'func-name
Previously, in my code, I was not using the #, see below
( global-set-key (kbd "C-t l <down>") 'Line-Dw )
Cheers
C*
> Sent: Sunday, October 04, 2020 at 8:00 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org, moasenwood@zoho.eu
> Subject: RE: RE: RE: Setting keybinding for org-support-shift-select t
>
> > Instead of using
> >
> > (global-set-key [f2] #'execute-extended-command)
> >
> > can I call my function directly,
> >
> > (global-set-key "[f2] fnm" #'myfunction)
>
> Not with that KEY argument to `global-set-key'.
>
> You can bind your function to a legitimate KEY value.
>
> (global-set-key (kbd "<f2> x") 'myfunction)
>
> You need to read up on key bindings. Start with
> `C-h r key bindings', which takes you here, but
> in Emacs:
>
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Key-Bindings.html
>
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Setting keybinding for org-support-shift-select t
2020-10-05 3:55 ` Christopher Dimech
@ 2020-10-05 4:12 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 0 replies; 27+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-05 4:12 UTC (permalink / raw)
To: help-gnu-emacs
Christopher Dimech wrote:
> I am getting a bit confused on the to use
>
> #'func-name
>
> and when using
>
> 'func-name
>
> Previously, in my code, I was not using the #, see
> below
>
> ( global-set-key (kbd "C-t l <down>") 'Line-Dw )
Well then, it is one of many improvements you can
make to your code :)
The symbol's name should already tell you it is
intended to be used as a function (the function of the
symbol should be used). But for extra clarity, add
the sharp quote.
Also if you byte compile the code, which is
recommended for Elisp perfecting purposes, debugging,
and execution speed, _if_ you byte compile the code
the byte compiler will tell you if the function isn't
known to be defined... there was a thread about this
(WRT lambdas) recently, check it out if you can find
it (don't remember the subject TBH, I think we
hijacked another thread so probably won't even be in
the subject now that I say it...)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2020-10-05 4:12 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-04 10:55 Setting keybinding for org-support-shift-select t Christopher Dimech
2020-10-04 11:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:31 ` Christopher Dimech
2020-10-04 11:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 12:25 ` Christopher Dimech
2020-10-04 12:40 ` 2QdxY4RzWzUUiLuE
2020-10-04 12:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 14:03 ` Christopher Dimech
2020-10-04 15:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 16:19 ` Christopher Dimech
2020-10-04 18:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 19:26 ` Christopher Dimech
2020-10-04 19:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 16:57 ` Christopher Dimech
2020-10-04 17:08 ` Drew Adams
2020-10-04 17:36 ` Christopher Dimech
2020-10-04 17:52 ` Drew Adams
2020-10-04 18:10 ` Christopher Dimech
2020-10-04 19:00 ` Drew Adams
2020-10-05 3:55 ` Christopher Dimech
2020-10-05 4:12 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 19:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 19:10 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 12:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 11:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-04 12:14 ` Christopher Dimech
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.