sxy
sxy

Reputation: 317

How to override the keybindings for Emacs Org mode org-property-next-allowed-values and org-property-previous-allowed-value

S-RIGHT is the default keybinding for (org-property-next-allowed-values) and S-LEFT for (org-property-previous-allowed-value) according to https://orgmode.org/manual/Property-Syntax.html. These keybindings are used to cycle through the TODO keywords as well as schedule dates.

I want to change the keybinding to C-RIGHT and C-LEFT, respectively so that they don't interfere with my normal editing. (I use S-LEFT, S-RIGHT for text selection).

I tried to add the following lines to my init.el:

The above 2 lines successfully disabled the 2 keybindings.

Then I added the following 2 lines to remap the keybindings:

However, emacs (I use AquaEmacs on Mac) doesn't recognize the "org-property-previous-allowed-value" and "org-property-next-allowed-values".

I wonder what did I do wrong here? Thanks

Upvotes: 0

Views: 1030

Answers (1)

NickD
NickD

Reputation: 6412

<S-right> is bound to org-shiftright by default, which does different things depending on context. It only does org-property-next-allowed-value if you cursor is on a property.

I don't know why you are having problems with the rebinding, hence my comment asking for clarification. But I thing that you probably don't want to redefine keys at all. Try adding

(setq org-support-shift-select 'always)

to your init file instead. The doc string for org-support-shift-select says (among other things - you should do C-h v org-support-shift-select RET and read the whole thing if you decide to go this way):

In Emacs 23, when ‘shift-select-mode’ is on, shifted cursor keys start selecting a region, or enlarge regions started in this way. In Org mode, in special contexts, these same keys are used for other purposes, important enough to compete with shift selection. Org tries to balance these needs by supporting ‘shift-select-mode’ outside these special contexts, under control of this variable.

...

If you set this variable to the symbol ‘always’, then the keys will not be special in headlines, property lines, item lines, and table cells, to make shift selection work there as well. If this is what you want, you can use the following alternative commands: ‘C-c C-t’ and ‘C-c ,’ to change TODO state and priority, ‘C-u C-u C-c C-t’ can be used to switch TODO sets, ‘C-c -’ to cycle item bullet types, and properties can be edited by hand or in column view.

However, when the cursor is on a timestamp, shift-cursor commands will still edit the time stamp - this is just too good to give up.

Upvotes: 0

Related Questions