Merge branch 'agenda-subtree-kill-with-subtree-feedback'
[org-mode/org-tableheadings.git] / lisp / org-keys.el
blobd103957a91435642779fb02c398721807f5ee331
1 ;;; org-keys.el --- Key bindings for Org mode -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018 Free Software Foundation, Inc.
5 ;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20 ;;; Commentary:
22 ;; This library adds bindings for Org mode buffers. It also
23 ;; implements both Speed keys and Babel speed keys. See manual for
24 ;; details.
26 ;;; Code:
28 (defvar org-outline-regexp)
30 (declare-function org-add-note "org" ())
31 (declare-function org-agenda "org" (&optional arg org-keys restriction))
32 (declare-function org-agenda-file-to-front "org" (&optional to-end))
33 (declare-function org-agenda-remove-restriction-lock "org" (&optional noupdate))
34 (declare-function org-agenda-set-restriction-lock "org" (&optional type))
35 (declare-function org-archive-subtree "org" (&optional find-done))
36 (declare-function org-archive-subtree-default "org" ())
37 (declare-function org-archive-subtree-default-with-confirmation "org" ())
38 (declare-function org-archive-to-archive-sibling "org" ())
39 (declare-function org-at-heading-p "org" (&optional ignored))
40 (declare-function org-attach "org" ())
41 (declare-function org-backward-element "org" ())
42 (declare-function org-backward-heading-same-level "org" (arg &optional invisible-ok))
43 (declare-function org-backward-paragraph "org" ())
44 (declare-function org-backward-sentence "org" (&optional arg))
45 (declare-function org-beginning-of-line "org" (&optional n))
46 (declare-function org-clock-cancel "org" ())
47 (declare-function org-clock-display "org" (&optional arg))
48 (declare-function org-clock-goto "org" (&optional select))
49 (declare-function org-clock-in "org" (&optional select start-time))
50 (declare-function org-clock-in-last "org" (&optional arg))
51 (declare-function org-clock-out "org" (&optional switch-to-state fail-quietly at-time))
52 (declare-function org-clone-subtree-with-time-shift "org" (n &optional shift))
53 (declare-function org-columns "org" (&optional global columns-fmt-string))
54 (declare-function org-comment-dwim "org" (arg))
55 (declare-function org-copy "org" ())
56 (declare-function org-copy-special "org" ())
57 (declare-function org-copy-visible "org" (beg end))
58 (declare-function org-ctrl-c-ctrl-c "org" (&optional arg))
59 (declare-function org-ctrl-c-minus "org" ())
60 (declare-function org-ctrl-c-ret "org" ())
61 (declare-function org-ctrl-c-star "org" ())
62 (declare-function org-ctrl-c-tab "org" (&optional arg))
63 (declare-function org-cut-special "org" ())
64 (declare-function org-cut-subtree "org" (&optional n))
65 (declare-function org-cycle "org" (&optional arg))
66 (declare-function org-cycle-agenda-files "org" ())
67 (declare-function org-date-from-calendar "org" ())
68 (declare-function org-dynamic-block-insert-dblock "org" (&optional arg))
69 (declare-function org-dblock-update "org" (&optional arg))
70 (declare-function org-deadline "org" (arg1 &optional time))
71 (declare-function org-decrease-number-at-point "org" (&optional inc))
72 (declare-function org-delete-backward-char "org" (n))
73 (declare-function org-delete-char "org" (n))
74 (declare-function org-delete-indentation "org" (&optional arg))
75 (declare-function org-demote-subtree "org" ())
76 (declare-function org-display-outline-path "org" (&optional file current separator just-return-string))
77 (declare-function org-down-element "org" ())
78 (declare-function org-edit-special "org" (&optional arg))
79 (declare-function org-element-at-point "org-element" ())
80 (declare-function org-element-type "org-element" (element))
81 (declare-function org-emphasize "org" (&optional char))
82 (declare-function org-end-of-line "org" (&optional n))
83 (declare-function org-entry-put "org" (pom property value))
84 (declare-function org-eval-in-calendar "org" (form &optional keepdate))
85 (declare-function org-evaluate-time-range "org" (&optional to-buffer))
86 (declare-function org-export-dispatch "org" (&optional arg))
87 (declare-function org-feed-goto-inbox "org" (feed))
88 (declare-function org-feed-update-all "org" ())
89 (declare-function org-fill-paragraph "org" (&optional justify region))
90 (declare-function org-find-file-at-mouse "org" (ev))
91 (declare-function org-footnote-action "org" (&optional special))
92 (declare-function org-force-cycle-archived "org" ())
93 (declare-function org-force-self-insert "org" (n))
94 (declare-function org-forward-element "org" ())
95 (declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok))
96 (declare-function org-forward-paragraph "org" ())
97 (declare-function org-forward-sentence "org" (&optional arg))
98 (declare-function org-goto "org" (&optional alternative-interface))
99 (declare-function org-goto-calendar "org" (&optional arg))
100 (declare-function org-inc-effort "org" ())
101 (declare-function org-increase-number-at-point "org" (&optional inc))
102 (declare-function org-info-find-node "org" (&optional nodename))
103 (declare-function org-insert-all-links "org" (arg &optional pre post))
104 (declare-function org-insert-drawer "org" (&optional arg drawer))
105 (declare-function org-insert-heading-respect-content "org" (&optional invisible-ok))
106 (declare-function org-insert-last-stored-link "org" (arg))
107 (declare-function org-insert-link "org" (&optional complete-file link-location default-description))
108 (declare-function org-insert-structure-template "org" (type))
109 (declare-function org-insert-todo-heading "org" (arg &optional force-heading))
110 (declare-function org-insert-todo-heading-respect-content "org" (&optional force-state))
111 (declare-function org-kill-line "org" (&optional arg))
112 (declare-function org-kill-note-or-show-branches "org" ())
113 (declare-function org-list-make-subtree "org" ())
114 (declare-function org-mark-element "org" ())
115 (declare-function org-mark-ring-goto "org" (&optional n))
116 (declare-function org-mark-ring-push "org" (&optional pos buffer))
117 (declare-function org-mark-subtree "org" (&optional up))
118 (declare-function org-match-sparse-tree "org" (&optional todo-only match))
119 (declare-function org-meta-return "org" (&optional arg))
120 (declare-function org-metadown "org" (&optional _arg))
121 (declare-function org-metaleft "org" (&optional _))
122 (declare-function org-metaright "org" (&optional _arg))
123 (declare-function org-metaup "org" (&optional _arg))
124 (declare-function org-narrow-to-block "org" ())
125 (declare-function org-narrow-to-element "org" ())
126 (declare-function org-narrow-to-subtree "org" ())
127 (declare-function org-next-block "org" (arg &optional backward block-regexp))
128 (declare-function org-next-link "org" (&optional search-backward))
129 (declare-function org-next-visible-heading "org" (arg))
130 (declare-function org-open-at-mouse "org" (ev))
131 (declare-function org-open-at-point "org" (&optional arg reference-buffer))
132 (declare-function org-open-line "org" (n))
133 (declare-function org-paste-special "org" (arg))
134 (declare-function org-plot/gnuplot "org-plot" (&optional params))
135 (declare-function org-previous-block "org" (arg &optional block-regexp))
136 (declare-function org-previous-link "org" ())
137 (declare-function org-previous-visible-heading "org" (arg))
138 (declare-function org-priority "org" (&optional action show))
139 (declare-function org-promote-subtree "org" ())
140 (declare-function org-redisplay-inline-images "org" ())
141 (declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg))
142 (declare-function org-reftex-citation "org" ())
143 (declare-function org-reload "org" (&optional arg1))
144 (declare-function org-remove-file "org" (&optional file))
145 (declare-function org-resolve-clocks "org" (&optional only-dangling-p prompt-fn last-valid))
146 (declare-function org-return "org" (&optional indent))
147 (declare-function org-return-indent "org" ())
148 (declare-function org-reveal "org" (&optional siblings))
149 (declare-function org-schedule "org" (arg &optional time))
150 (declare-function org-self-insert-command "org" (N))
151 (declare-function org-set-effort "org" (&optional increment value))
152 (declare-function org-set-property "org" (property value))
153 (declare-function org-set-property-and-value "org" (use-last))
154 (declare-function org-set-tags-command "org" (&optional arg))
155 (declare-function org-shiftcontroldown "org" (&optional n))
156 (declare-function org-shiftcontrolleft "org" ())
157 (declare-function org-shiftcontrolright "org" ())
158 (declare-function org-shiftcontrolup "org" (&optional n))
159 (declare-function org-shiftdown "org" (&optional arg))
160 (declare-function org-shiftleft "org" (&optional arg))
161 (declare-function org-shiftmetadown "org" (&optional _arg))
162 (declare-function org-shiftmetaleft "org" ())
163 (declare-function org-shiftmetaright "org" ())
164 (declare-function org-shiftmetaup "org" (&optional arg))
165 (declare-function org-shiftright "org" (&optional arg))
166 (declare-function org-shifttab "org" (&optional arg))
167 (declare-function org-shiftup "org" (&optional arg))
168 (declare-function org-show-all "org" (&optional types))
169 (declare-function org-show-children "org" (&optional level))
170 (declare-function org-show-subtree "org" ())
171 (declare-function org-sort "org" (&optional with-case))
172 (declare-function org-sparse-tree "org" (&optional arg type))
173 (declare-function org-table-blank-field "org" ())
174 (declare-function org-table-copy-down "org" (n))
175 (declare-function org-table-create-or-convert-from-region "org" (arg))
176 (declare-function org-table-create-with-table\.el "org-table" ())
177 (declare-function org-table-edit-field "org" (arg))
178 (declare-function org-table-eval-formula "org" (&optional arg equation suppress-align suppress-const suppress-store suppress-analysis))
179 (declare-function org-table-field-info "org" (arg))
180 (declare-function org-table-rotate-recalc-marks "org" (&optional newchar))
181 (declare-function org-table-sum "org" (&optional beg end nlast))
182 (declare-function org-table-toggle-coordinate-overlays "org" ())
183 (declare-function org-table-toggle-formula-debugger "org" ())
184 (declare-function org-time-stamp "org" (arg &optional inactive))
185 (declare-function org-time-stamp-inactive "org" (&optional arg))
186 (declare-function org-timer "org" (&optional restart no-insert))
187 (declare-function org-timer-item "org" (&optional arg))
188 (declare-function org-timer-pause-or-continue "org" (&optional stop))
189 (declare-function org-timer-set-timer "org" (&optional opt))
190 (declare-function org-timer-start "org" (&optional offset))
191 (declare-function org-timer-stop "org" ())
192 (declare-function org-todo "org" (&optional arg1))
193 (declare-function org-toggle-archive-tag "org" (&optional find-done))
194 (declare-function org-toggle-checkbox "org" (&optional toggle-presence))
195 (declare-function org-toggle-comment "org" ())
196 (declare-function org-toggle-fixed-width "org" ())
197 (declare-function org-toggle-inline-images "org" (&optional include-linked))
198 (declare-function org-latex-preview "org" (&optional arg))
199 (declare-function org-toggle-narrow-to-subtree "org" ())
200 (declare-function org-toggle-ordered-property "org" ())
201 (declare-function org-toggle-pretty-entities "org" ())
202 (declare-function org-toggle-tags-groups "org" ())
203 (declare-function org-toggle-time-stamp-overlays "org" ())
204 (declare-function org-transpose-element "org" ())
205 (declare-function org-transpose-words "org" ())
206 (declare-function org-tree-to-indirect-buffer "org" (&optional arg))
207 (declare-function org-up-element "org" ())
208 (declare-function org-update-statistics-cookies "org" (all))
209 (declare-function org-yank "org" (&optional arg))
210 (declare-function orgtbl-ascii-plot "org-table" (&optional ask))
214 ;;; Variables
216 (defvar org-mode-map (make-sparse-keymap)
217 "Keymap fo Org mode.")
219 (defcustom org-replace-disputed-keys nil
220 "Non-nil means use alternative key bindings for some keys.
222 Org mode uses S-<cursor> keys for changing timestamps and priorities.
223 These keys are also used by other packages like Shift Select mode,
224 CUA mode or Windmove. If you want to use Org mode together with
225 one of these other modes, or more generally if you would like to
226 move some Org mode commands to other keys, set this variable and
227 configure the keys with the variable `org-disputed-keys'.
229 This option is only relevant at load-time of Org mode, and must be set
230 *before* org.el is loaded. Changing it requires a restart of Emacs to
231 become effective."
232 :group 'org-startup
233 :type 'boolean
234 :safe #'booleanp)
236 (defcustom org-use-extra-keys nil
237 "Non-nil means use extra key sequence definitions for certain commands.
238 This happens automatically if `window-system' is nil. This
239 variable lets you do the same manually. You must set it before
240 loading Org."
241 :group 'org-startup
242 :type 'boolean
243 :safe #'booleanp)
245 (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
247 (defcustom org-disputed-keys
248 '(([(shift up)] . [(meta p)])
249 ([(shift down)] . [(meta n)])
250 ([(shift left)] . [(meta -)])
251 ([(shift right)] . [(meta +)])
252 ([(control shift right)] . [(meta shift +)])
253 ([(control shift left)] . [(meta shift -)]))
254 "Keys for which Org mode and other modes compete.
255 This is an alist, cars are the default keys, second element specifies
256 the alternative to use when `org-replace-disputed-keys' is t.
258 Keys can be specified in any syntax supported by `define-key'.
259 The value of this option takes effect only at Org mode startup,
260 therefore you'll have to restart Emacs to apply it after changing."
261 :group 'org-startup
262 :type 'alist)
264 (defcustom org-mouse-1-follows-link
265 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
266 "Non-nil means mouse-1 on a link will follow the link.
267 A longer mouse click will still set point. Needs to be set
268 before org.el is loaded."
269 :group 'org-link-follow
270 :version "26.1"
271 :package-version '(Org . "8.3")
272 :type '(choice
273 (const :tag "A double click follows the link" double)
274 (const :tag "Unconditionally follow the link with mouse-1" t)
275 (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))
276 :safe t)
278 (defcustom org-tab-follows-link nil
279 "Non-nil means on links TAB will follow the link.
280 Needs to be set before Org is loaded.
281 This really should not be used, it does not make sense, and the
282 implementation is bad."
283 :group 'org-link-follow
284 :type 'boolean)
286 (defcustom org-follow-link-hook nil
287 "Hook that is run after a link has been followed."
288 :group 'org-link-follow
289 :type 'hook)
291 (defcustom org-return-follows-link nil
292 "Non-nil means on links RET will follow the link.
293 In tables, the special behavior of RET has precedence."
294 :group 'org-link-follow
295 :type 'boolean
296 :safe t)
299 ;;; Functions
301 ;;;; Base functions
302 (defun org-key (key)
303 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
304 Or return the original if not disputed."
305 (when org-replace-disputed-keys
306 (let* ((nkey (key-description key))
307 (x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey))
308 org-disputed-keys)))
309 (setq key (if x (cdr x) key))))
310 key)
312 (defun org-defkey (keymap key def)
313 "Define a key, possibly translated, as returned by `org-key'."
314 (define-key keymap (org-key key) def))
316 (defun org-remap (map &rest commands)
317 "In MAP, remap the functions given in COMMANDS.
318 COMMANDS is a list of alternating OLDDEF NEWDEF command names."
319 (let (new old)
320 (while commands
321 (setq old (pop commands) new (pop commands))
322 (org-defkey map (vector 'remap old) new))))
325 ;;; Mouse map
327 (defvar org-mouse-map (make-sparse-keymap))
328 (org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse)
329 (org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse)
331 (when org-mouse-1-follows-link
332 (org-defkey org-mouse-map [follow-link] 'mouse-face))
334 (when org-tab-follows-link
335 (org-defkey org-mouse-map (kbd "<tab>") #'org-open-at-point)
336 (org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point))
339 ;;; Read date map
341 (defvar org-read-date-minibuffer-local-map
342 (let* ((map (make-sparse-keymap)))
343 (set-keymap-parent map minibuffer-local-map)
344 (org-defkey map (kbd ".")
345 (lambda () (interactive)
346 ;; Are we at the beginning of the prompt?
347 (if (looking-back "^[^:]+: "
348 (let ((inhibit-field-text-motion t))
349 (line-beginning-position)))
350 (org-eval-in-calendar '(calendar-goto-today))
351 (insert "."))))
352 (org-defkey map (kbd "C-.")
353 (lambda () (interactive)
354 (org-eval-in-calendar '(calendar-goto-today))))
355 (org-defkey map (kbd "M-S-<left>")
356 (lambda () (interactive)
357 (org-eval-in-calendar '(calendar-backward-month 1))))
358 (org-defkey map (kbd "ESC S-<left>")
359 (lambda () (interactive)
360 (org-eval-in-calendar '(calendar-backward-month 1))))
361 (org-defkey map (kbd "M-S-<right>")
362 (lambda () (interactive)
363 (org-eval-in-calendar '(calendar-forward-month 1))))
364 (org-defkey map (kbd "ESC S-<right>")
365 (lambda () (interactive)
366 (org-eval-in-calendar '(calendar-forward-month 1))))
367 (org-defkey map (kbd "M-S-<up>")
368 (lambda () (interactive)
369 (org-eval-in-calendar '(calendar-backward-year 1))))
370 (org-defkey map (kbd "ESC S-<up>")
371 (lambda () (interactive)
372 (org-eval-in-calendar '(calendar-backward-year 1))))
373 (org-defkey map (kbd "M-S-<down>")
374 (lambda () (interactive)
375 (org-eval-in-calendar '(calendar-forward-year 1))))
376 (org-defkey map (kbd "ESC S-<down>")
377 (lambda () (interactive)
378 (org-eval-in-calendar '(calendar-forward-year 1))))
379 (org-defkey map (kbd "S-<up>")
380 (lambda () (interactive)
381 (org-eval-in-calendar '(calendar-backward-week 1))))
382 (org-defkey map (kbd "S-<down>")
383 (lambda () (interactive)
384 (org-eval-in-calendar '(calendar-forward-week 1))))
385 (org-defkey map (kbd "S-<left>")
386 (lambda () (interactive)
387 (org-eval-in-calendar '(calendar-backward-day 1))))
388 (org-defkey map (kbd "S-<right>")
389 (lambda () (interactive)
390 (org-eval-in-calendar '(calendar-forward-day 1))))
391 (org-defkey map (kbd "!")
392 (lambda () (interactive)
393 (org-eval-in-calendar '(diary-view-entries))
394 (message "")))
395 (org-defkey map (kbd ">")
396 (lambda () (interactive)
397 (org-eval-in-calendar '(calendar-scroll-left 1))))
398 (org-defkey map (kbd "<")
399 (lambda () (interactive)
400 (org-eval-in-calendar '(calendar-scroll-right 1))))
401 (org-defkey map (kbd "C-v")
402 (lambda () (interactive)
403 (org-eval-in-calendar
404 '(calendar-scroll-left-three-months 1))))
405 (org-defkey map (kbd "M-v")
406 (lambda () (interactive)
407 (org-eval-in-calendar
408 '(calendar-scroll-right-three-months 1))))
409 map)
410 "Keymap for minibuffer commands when using `org-read-date'.")
413 ;;; Global bindings
415 ;;;; Outline functions
416 (define-key org-mode-map [menu-bar headings] 'undefined)
417 (define-key org-mode-map [menu-bar hide] 'undefined)
418 (define-key org-mode-map [menu-bar show] 'undefined)
420 (define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree)
421 (define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree)
422 (define-key org-mode-map [remap outline-forward-same-level]
423 #'org-forward-heading-same-level)
424 (define-key org-mode-map [remap outline-backward-same-level]
425 #'org-backward-heading-same-level)
426 (define-key org-mode-map [remap outline-show-branches]
427 #'org-kill-note-or-show-branches)
428 (define-key org-mode-map [remap outline-promote] #'org-promote-subtree)
429 (define-key org-mode-map [remap outline-demote] #'org-demote-subtree)
430 (define-key org-mode-map [remap outline-insert-heading] #'org-ctrl-c-ret)
431 (define-key org-mode-map [remap outline-next-visible-heading]
432 #'org-next-visible-heading)
433 (define-key org-mode-map [remap outline-previous-visible-heading]
434 #'org-previous-visible-heading)
435 (define-key org-mode-map [remap show-children] #'org-show-children)
437 ;;;; Make `C-c C-x' a prefix key
438 (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
440 ;;;; TAB key with modifiers
441 (org-defkey org-mode-map (kbd "C-i") #'org-cycle)
442 (org-defkey org-mode-map (kbd "<tab>") #'org-cycle)
443 (org-defkey org-mode-map (kbd "C-<tab>") #'org-force-cycle-archived)
444 (org-defkey org-mode-map (kbd "M-<tab>") #'pcomplete)
445 (org-defkey org-mode-map (kbd "M-TAB") #'pcomplete)
446 (org-defkey org-mode-map (kbd "ESC <tab>") #'pcomplete)
447 (org-defkey org-mode-map (kbd "ESC TAB") #'pcomplete)
449 (org-defkey org-mode-map (kbd "<S-iso-leftab>") #'org-shifttab)
450 (org-defkey org-mode-map (kbd "S-<tab>") #'org-shifttab)
451 (org-defkey org-mode-map (kbd "S-TAB") #'org-shifttab)
452 (define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
454 ;;;; RET/<return> key with modifiers
455 (org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down)
456 (org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down)
457 (org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading)
458 (org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading)
459 (org-defkey org-mode-map (kbd "ESC S-<return>") #'org-insert-todo-heading)
460 (org-defkey org-mode-map (kbd "ESC S-RET") #'org-insert-todo-heading)
461 (org-defkey org-mode-map (kbd "M-<return>") #'org-meta-return)
462 (org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
463 (org-defkey org-mode-map (kbd "ESC <return>") #'org-meta-return)
464 (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
466 ;;;; Cursor keys with modifiers
467 (org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
468 (org-defkey org-mode-map (kbd "M-<right>") #'org-metaright)
469 (org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
470 (org-defkey org-mode-map (kbd "M-<up>") #'org-metaup)
471 (org-defkey org-mode-map (kbd "ESC <up>") #'org-metaup)
472 (org-defkey org-mode-map (kbd "M-<down>") #'org-metadown)
473 (org-defkey org-mode-map (kbd "ESC <down>") #'org-metadown)
475 (org-defkey org-mode-map (kbd "C-M-S-<right>") #'org-increase-number-at-point)
476 (org-defkey org-mode-map (kbd "C-M-S-<left>") #'org-decrease-number-at-point)
477 (org-defkey org-mode-map (kbd "M-S-<left>") #'org-shiftmetaleft)
478 (org-defkey org-mode-map (kbd "ESC S-<left>") #'org-shiftmetaleft)
479 (org-defkey org-mode-map (kbd "M-S-<right>") #'org-shiftmetaright)
480 (org-defkey org-mode-map (kbd "ESC S-<right>") #'org-shiftmetaright)
481 (org-defkey org-mode-map (kbd "M-S-<up>") #'org-shiftmetaup)
482 (org-defkey org-mode-map (kbd "ESC S-<up>") #'org-shiftmetaup)
483 (org-defkey org-mode-map (kbd "M-S-<down>") #'org-shiftmetadown)
484 (org-defkey org-mode-map (kbd "ESC S-<down>") #'org-shiftmetadown)
486 (org-defkey org-mode-map (kbd "S-<up>") #'org-shiftup)
487 (org-defkey org-mode-map (kbd "S-<down>") #'org-shiftdown)
488 (org-defkey org-mode-map (kbd "S-<left>") #'org-shiftleft)
489 (org-defkey org-mode-map (kbd "S-<right>") #'org-shiftright)
491 (org-defkey org-mode-map (kbd "C-S-<right>") #'org-shiftcontrolright)
492 (org-defkey org-mode-map (kbd "C-S-<left>") #'org-shiftcontrolleft)
493 (org-defkey org-mode-map (kbd "C-S-<up>") #'org-shiftcontrolup)
494 (org-defkey org-mode-map (kbd "C-S-<down>") #'org-shiftcontroldown)
496 ;;;; Extra keys for TTY access.
498 ;; We only set them when really needed because otherwise the
499 ;; menus don't show the simple keys
501 (when (or org-use-extra-keys (not window-system))
502 (org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down)
503 (org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return)
504 (org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading)
505 (org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return)
506 (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
507 (org-defkey org-mode-map (kbd "ESC <left>") #'org-metaleft)
508 (org-defkey org-mode-map (kbd "C-c C-x l") #'org-metaleft)
509 (org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
510 (org-defkey org-mode-map (kbd "C-c C-x r") #'org-metaright)
511 (org-defkey org-mode-map (kbd "C-c C-x u") #'org-metaup)
512 (org-defkey org-mode-map (kbd "C-c C-x d") #'org-metadown)
513 (org-defkey org-mode-map (kbd "C-c C-x L") #'org-shiftmetaleft)
514 (org-defkey org-mode-map (kbd "C-c C-x R") #'org-shiftmetaright)
515 (org-defkey org-mode-map (kbd "C-c C-x U") #'org-shiftmetaup)
516 (org-defkey org-mode-map (kbd "C-c C-x D") #'org-shiftmetadown)
517 (org-defkey org-mode-map (kbd "C-c <up>") #'org-shiftup)
518 (org-defkey org-mode-map (kbd "C-c <down>") #'org-shiftdown)
519 (org-defkey org-mode-map (kbd "C-c <left>") #'org-shiftleft)
520 (org-defkey org-mode-map (kbd "C-c <right>") #'org-shiftright)
521 (org-defkey org-mode-map (kbd "C-c C-x <right>") #'org-shiftcontrolright)
522 (org-defkey org-mode-map (kbd "C-c C-x <left>") #'org-shiftcontrolleft))
524 ;;;; Narrow map
525 (org-defkey narrow-map "s" #'org-narrow-to-subtree)
526 (org-defkey narrow-map "b" #'org-narrow-to-block)
527 (org-defkey narrow-map "e" #'org-narrow-to-element)
529 ;;;; Remap usual Emacs bindings
530 (org-remap org-mode-map
531 'self-insert-command 'org-self-insert-command
532 'delete-char 'org-delete-char
533 'delete-backward-char 'org-delete-backward-char
534 'kill-line 'org-kill-line
535 'open-line 'org-open-line
536 'yank 'org-yank
537 'comment-dwim 'org-comment-dwim
538 'move-beginning-of-line 'org-beginning-of-line
539 'move-end-of-line 'org-end-of-line
540 'forward-paragraph 'org-forward-paragraph
541 'backward-paragraph 'org-backward-paragraph
542 'backward-sentence 'org-backward-sentence
543 'forward-sentence 'org-forward-sentence
544 'fill-paragraph 'org-fill-paragraph
545 'delete-indentation 'org-delete-indentation
546 'transpose-words 'org-transpose-words)
548 ;;;; All the other keys
549 (org-defkey org-mode-map (kbd "|") #'org-force-self-insert)
550 (org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal)
551 (org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element)
552 (org-defkey org-mode-map (kbd "M-}") #'org-forward-element)
553 (org-defkey org-mode-map (kbd "ESC }") #'org-forward-element)
554 (org-defkey org-mode-map (kbd "M-{") #'org-backward-element)
555 (org-defkey org-mode-map (kbd "ESC {") #'org-backward-element)
556 (org-defkey org-mode-map (kbd "C-c C-^") #'org-up-element)
557 (org-defkey org-mode-map (kbd "C-c C-_") #'org-down-element)
558 (org-defkey org-mode-map (kbd "C-c C-f") #'org-forward-heading-same-level)
559 (org-defkey org-mode-map (kbd "C-c C-b") #'org-backward-heading-same-level)
560 (org-defkey org-mode-map (kbd "C-c M-f") #'org-next-block)
561 (org-defkey org-mode-map (kbd "C-c M-b") #'org-previous-block)
562 (org-defkey org-mode-map (kbd "C-c $") #'org-archive-subtree)
563 (org-defkey org-mode-map (kbd "C-c C-x C-s") #'org-archive-subtree)
564 (org-defkey org-mode-map (kbd "C-c C-x C-a") #'org-archive-subtree-default)
565 (org-defkey org-mode-map (kbd "C-c C-x d") #'org-insert-drawer)
566 (org-defkey org-mode-map (kbd "C-c C-x a") #'org-toggle-archive-tag)
567 (org-defkey org-mode-map (kbd "C-c C-x A") #'org-archive-to-archive-sibling)
568 (org-defkey org-mode-map (kbd "C-c C-x b") #'org-tree-to-indirect-buffer)
569 (org-defkey org-mode-map (kbd "C-c C-x q") #'org-toggle-tags-groups)
570 (org-defkey org-mode-map (kbd "C-c C-j") #'org-goto)
571 (org-defkey org-mode-map (kbd "C-c C-t") #'org-todo)
572 (org-defkey org-mode-map (kbd "C-c C-q") #'org-set-tags-command)
573 (org-defkey org-mode-map (kbd "C-c C-s") #'org-schedule)
574 (org-defkey org-mode-map (kbd "C-c C-d") #'org-deadline)
575 (org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment)
576 (org-defkey org-mode-map (kbd "C-c C-w") #'org-refile)
577 (org-defkey org-mode-map (kbd "C-c M-w") #'org-copy)
578 (org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved
579 (org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r.
580 (org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret)
581 (org-defkey org-mode-map (kbd "C-c C-x c") #'org-clone-subtree-with-time-shift)
582 (org-defkey org-mode-map (kbd "C-c C-x v") #'org-copy-visible)
583 (org-defkey org-mode-map (kbd "C-<return>") #'org-insert-heading-respect-content)
584 (org-defkey org-mode-map (kbd "C-S-<return>") #'org-insert-todo-heading-respect-content)
585 (org-defkey org-mode-map (kbd "C-c C-x C-n") #'org-next-link)
586 (org-defkey org-mode-map (kbd "C-c C-x C-p") #'org-previous-link)
587 (org-defkey org-mode-map (kbd "C-c C-l") #'org-insert-link)
588 (org-defkey org-mode-map (kbd "C-c M-l") #'org-insert-last-stored-link)
589 (org-defkey org-mode-map (kbd "C-c C-M-l") #'org-insert-all-links)
590 (org-defkey org-mode-map (kbd "C-c C-o") #'org-open-at-point)
591 (org-defkey org-mode-map (kbd "C-c %") #'org-mark-ring-push)
592 (org-defkey org-mode-map (kbd "C-c &") #'org-mark-ring-goto)
593 (org-defkey org-mode-map (kbd "C-c C-z") #'org-add-note) ;alternative binding
594 (org-defkey org-mode-map (kbd "C-c .") #'org-time-stamp) ;minor-mode reserved
595 (org-defkey org-mode-map (kbd "C-c !") #'org-time-stamp-inactive) ;minor-mode r.
596 (org-defkey org-mode-map (kbd "C-c ,") #'org-priority) ;minor-mode reserved
597 (org-defkey org-mode-map (kbd "C-c C-y") #'org-evaluate-time-range)
598 (org-defkey org-mode-map (kbd "C-c >") #'org-goto-calendar)
599 (org-defkey org-mode-map (kbd "C-c <") #'org-date-from-calendar)
600 (org-defkey org-mode-map (kbd "C-,") #'org-cycle-agenda-files)
601 (org-defkey org-mode-map (kbd "C-'") #'org-cycle-agenda-files)
602 (org-defkey org-mode-map (kbd "C-c [") #'org-agenda-file-to-front)
603 (org-defkey org-mode-map (kbd "C-c ]") #'org-remove-file)
604 (org-defkey org-mode-map (kbd "C-c C-x <") #'org-agenda-set-restriction-lock)
605 (org-defkey org-mode-map (kbd "C-c C-x >") #'org-agenda-remove-restriction-lock)
606 (org-defkey org-mode-map (kbd "C-c -") #'org-ctrl-c-minus)
607 (org-defkey org-mode-map (kbd "C-c *") #'org-ctrl-c-star)
608 (org-defkey org-mode-map (kbd "C-c TAB") #'org-ctrl-c-tab)
609 (org-defkey org-mode-map (kbd "C-c ^") #'org-sort)
610 (org-defkey org-mode-map (kbd "C-c C-c") #'org-ctrl-c-ctrl-c)
611 (org-defkey org-mode-map (kbd "C-c C-k") #'org-kill-note-or-show-branches)
612 (org-defkey org-mode-map (kbd "C-c #") #'org-update-statistics-cookies)
613 (org-defkey org-mode-map (kbd "RET") #'org-return)
614 (org-defkey org-mode-map (kbd "C-j") #'org-return-indent)
615 (org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info)
616 (org-defkey org-mode-map (kbd "C-c SPC") #'org-table-blank-field)
617 (org-defkey org-mode-map (kbd "C-c +") #'org-table-sum)
618 (org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula)
619 (org-defkey org-mode-map (kbd "C-c '") #'org-edit-special)
620 (org-defkey org-mode-map (kbd "C-c `") #'org-table-edit-field)
621 (org-defkey org-mode-map (kbd "C-c \" a") #'orgtbl-ascii-plot)
622 (org-defkey org-mode-map (kbd "C-c \" g") #'org-plot/gnuplot)
623 (org-defkey org-mode-map (kbd "C-c |") #'org-table-create-or-convert-from-region)
624 (org-defkey org-mode-map (kbd "C-#") #'org-table-rotate-recalc-marks)
625 (org-defkey org-mode-map (kbd "C-c ~") #'org-table-create-with-table.el)
626 (org-defkey org-mode-map (kbd "C-c C-a") #'org-attach)
627 (org-defkey org-mode-map (kbd "C-c }") #'org-table-toggle-coordinate-overlays)
628 (org-defkey org-mode-map (kbd "C-c {") #'org-table-toggle-formula-debugger)
629 (org-defkey org-mode-map (kbd "C-c C-e") #'org-export-dispatch)
630 (org-defkey org-mode-map (kbd "C-c :") #'org-toggle-fixed-width)
631 (org-defkey org-mode-map (kbd "C-c C-x C-f") #'org-emphasize)
632 (org-defkey org-mode-map (kbd "C-c C-x f") #'org-footnote-action)
633 (org-defkey org-mode-map (kbd "C-c @") #'org-mark-subtree)
634 (org-defkey org-mode-map (kbd "M-h") #'org-mark-element)
635 (org-defkey org-mode-map (kbd "ESC h") #'org-mark-element)
636 (org-defkey org-mode-map (kbd "C-c C-*") #'org-list-make-subtree)
637 (org-defkey org-mode-map (kbd "C-c C-x C-w") #'org-cut-special)
638 (org-defkey org-mode-map (kbd "C-c C-x M-w") #'org-copy-special)
639 (org-defkey org-mode-map (kbd "C-c C-x C-y") #'org-paste-special)
640 (org-defkey org-mode-map (kbd "C-c C-x C-t") #'org-toggle-time-stamp-overlays)
641 (org-defkey org-mode-map (kbd "C-c C-x C-i") #'org-clock-in)
642 (org-defkey org-mode-map (kbd "C-c C-x C-x") #'org-clock-in-last)
643 (org-defkey org-mode-map (kbd "C-c C-x C-z") #'org-resolve-clocks)
644 (org-defkey org-mode-map (kbd "C-c C-x C-o") #'org-clock-out)
645 (org-defkey org-mode-map (kbd "C-c C-x C-j") #'org-clock-goto)
646 (org-defkey org-mode-map (kbd "C-c C-x C-q") #'org-clock-cancel)
647 (org-defkey org-mode-map (kbd "C-c C-x C-d") #'org-clock-display)
648 (org-defkey org-mode-map (kbd "C-c C-x x") #'org-dynamic-block-insert-dblock)
649 (org-defkey org-mode-map (kbd "C-c C-x C-u") #'org-dblock-update)
650 (org-defkey org-mode-map (kbd "C-c C-x C-l") #'org-latex-preview)
651 (org-defkey org-mode-map (kbd "C-c C-x C-v") #'org-toggle-inline-images)
652 (org-defkey org-mode-map (kbd "C-c C-x C-M-v") #'org-redisplay-inline-images)
653 (org-defkey org-mode-map (kbd "C-c C-x \\") #'org-toggle-pretty-entities)
654 (org-defkey org-mode-map (kbd "C-c C-x C-b") #'org-toggle-checkbox)
655 (org-defkey org-mode-map (kbd "C-c C-x p") #'org-set-property)
656 (org-defkey org-mode-map (kbd "C-c C-x P") #'org-set-property-and-value)
657 (org-defkey org-mode-map (kbd "C-c C-x e") #'org-set-effort)
658 (org-defkey org-mode-map (kbd "C-c C-x E") #'org-inc-effort)
659 (org-defkey org-mode-map (kbd "C-c C-x o") #'org-toggle-ordered-property)
660 (org-defkey org-mode-map (kbd "C-c C-,") #'org-insert-structure-template)
661 (org-defkey org-mode-map (kbd "C-c C-x .") #'org-timer)
662 (org-defkey org-mode-map (kbd "C-c C-x -") #'org-timer-item)
663 (org-defkey org-mode-map (kbd "C-c C-x 0") #'org-timer-start)
664 (org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop)
665 (org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer)
666 (org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue)
667 (org-defkey org-mode-map (kbd "C-c C-x C-c") #'org-columns)
668 (org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload)
669 (org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all)
670 (org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox)
671 (org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation)
672 (org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node)
675 ;;; Speed keys
677 (defcustom org-use-speed-commands nil
678 "Non-nil means activate single letter commands at beginning of a headline.
679 This may also be a function to test for appropriate locations where speed
680 commands should be active.
682 For example, to activate speed commands when the point is on any
683 star at the beginning of the headline, you can do this:
685 (setq org-use-speed-commands
686 (lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))"
687 :group 'org-structure
688 :type '(choice
689 (const :tag "Never" nil)
690 (const :tag "At beginning of headline stars" t)
691 (function)))
693 (defcustom org-speed-commands-user nil
694 "Alist of additional speed commands.
695 This list will be checked before `org-speed-commands-default'
696 when the variable `org-use-speed-commands' is non-nil
697 and when the cursor is at the beginning of a headline.
698 The car of each entry is a string with a single letter, which must
699 be assigned to `self-insert-command' in the global map.
700 The cdr is either a command to be called interactively, a function
701 to be called, or a form to be evaluated.
702 An entry that is just a list with a single string will be interpreted
703 as a descriptive headline that will be added when listing the speed
704 commands in the Help buffer using the `?' speed command."
705 :group 'org-structure
706 :type '(repeat :value ("k" . ignore)
707 (choice :value ("k" . ignore)
708 (list :tag "Descriptive Headline" (string :tag "Headline"))
709 (cons :tag "Letter and Command"
710 (string :tag "Command letter")
711 (choice
712 (function)
713 (sexp))))))
715 (defcustom org-speed-command-hook
716 '(org-speed-command-activate org-babel-speed-command-activate)
717 "Hook for activating speed commands at strategic locations.
718 Hook functions are called in sequence until a valid handler is
719 found.
721 Each hook takes a single argument, a user-pressed command key
722 which is also a `self-insert-command' from the global map.
724 Within the hook, examine the cursor position and the command key
725 and return nil or a valid handler as appropriate. Handler could
726 be one of an interactive command, a function, or a form.
728 Set `org-use-speed-commands' to non-nil value to enable this
729 hook. The default setting is `org-speed-command-activate'."
730 :group 'org-structure
731 :version "24.1"
732 :type 'hook)
734 (defconst org-speed-commands-default
735 '(("Outline Navigation")
736 ("n" . (org-speed-move-safe 'org-next-visible-heading))
737 ("p" . (org-speed-move-safe 'org-previous-visible-heading))
738 ("f" . (org-speed-move-safe 'org-forward-heading-same-level))
739 ("b" . (org-speed-move-safe 'org-backward-heading-same-level))
740 ("F" . org-next-block)
741 ("B" . org-previous-block)
742 ("u" . (org-speed-move-safe 'outline-up-heading))
743 ("j" . org-goto)
744 ("g" . (org-refile t))
745 ("Outline Visibility")
746 ("c" . org-cycle)
747 ("C" . org-shifttab)
748 (" " . org-display-outline-path)
749 ("s" . org-toggle-narrow-to-subtree)
750 ("k" . org-cut-subtree)
751 ("=" . org-columns)
752 ("Outline Structure Editing")
753 ("U" . org-metaup)
754 ("D" . org-metadown)
755 ("r" . org-metaright)
756 ("l" . org-metaleft)
757 ("R" . org-shiftmetaright)
758 ("L" . org-shiftmetaleft)
759 ("i" . (progn (forward-char 1) (call-interactively
760 'org-insert-heading-respect-content)))
761 ("^" . org-sort)
762 ("w" . org-refile)
763 ("a" . org-archive-subtree-default-with-confirmation)
764 ("@" . org-mark-subtree)
765 ("#" . org-toggle-comment)
766 ("Clock Commands")
767 ("I" . org-clock-in)
768 ("O" . org-clock-out)
769 ("Meta Data Editing")
770 ("t" . org-todo)
771 ("," . (org-priority))
772 ("0" . (org-priority ?\ ))
773 ("1" . (org-priority ?A))
774 ("2" . (org-priority ?B))
775 ("3" . (org-priority ?C))
776 (":" . org-set-tags-command)
777 ("e" . org-set-effort)
778 ("E" . org-inc-effort)
779 ("W" . (lambda(m) (interactive "sMinutes before warning: ")
780 (org-entry-put (point) "APPT_WARNTIME" m)))
781 ("Agenda Views etc")
782 ("v" . org-agenda)
783 ("/" . org-sparse-tree)
784 ("Misc")
785 ("o" . org-open-at-point)
786 ("?" . org-speed-command-help)
787 ("<" . (org-agenda-set-restriction-lock 'subtree))
788 (">" . (org-agenda-remove-restriction-lock)))
789 "The default speed commands.")
791 (defun org-print-speed-command (e)
792 (if (> (length (car e)) 1)
793 (progn
794 (princ "\n")
795 (princ (car e))
796 (princ "\n")
797 (princ (make-string (length (car e)) ?-))
798 (princ "\n"))
799 (princ (car e))
800 (princ " ")
801 (if (symbolp (cdr e))
802 (princ (symbol-name (cdr e)))
803 (prin1 (cdr e)))
804 (princ "\n")))
806 (defun org-speed-command-help ()
807 "Show the available speed commands."
808 (interactive)
809 (unless org-use-speed-commands
810 (user-error "Speed commands are not activated, customize `org-use-speed-commands'"))
811 (with-output-to-temp-buffer "*Help*"
812 (princ "User-defined Speed commands\n===========================\n")
813 (mapc #'org-print-speed-command org-speed-commands-user)
814 (princ "\n")
815 (princ "Built-in Speed commands\n=======================\n")
816 (mapc #'org-print-speed-command org-speed-commands-default))
817 (with-current-buffer "*Help*"
818 (setq truncate-lines t)))
820 (defun org-speed-move-safe (cmd)
821 "Execute CMD, but make sure that the cursor always ends up in a headline.
822 If not, return to the original position and throw an error."
823 (interactive)
824 (let ((pos (point)))
825 (call-interactively cmd)
826 (unless (and (bolp) (org-at-heading-p))
827 (goto-char pos)
828 (error "Boundary reached while executing %s" cmd))))
830 (defun org-speed-command-activate (keys)
831 "Hook for activating single-letter speed commands.
832 `org-speed-commands-default' specifies a minimal command set.
833 Use `org-speed-commands-user' for further customization."
834 (when (or (and (bolp) (looking-at org-outline-regexp))
835 (and (functionp org-use-speed-commands)
836 (funcall org-use-speed-commands)))
837 (cdr (assoc keys (append org-speed-commands-user
838 org-speed-commands-default)))))
841 ;;; Babel speed keys
843 (defvar org-babel-key-prefix "\C-c\C-v"
844 "The key prefix for Babel interactive key-bindings.
845 See `org-babel-key-bindings' for the list of interactive Babel
846 functions which are assigned key bindings, and see
847 `org-babel-map' for the actual babel keymap.")
849 (defvar org-babel-map (make-sparse-keymap)
850 "The keymap for interactive Babel functions.")
852 (defvar org-babel-key-bindings
853 '(("p" . org-babel-previous-src-block)
854 ("\C-p" . org-babel-previous-src-block)
855 ("n" . org-babel-next-src-block)
856 ("\C-n" . org-babel-next-src-block)
857 ("e" . org-babel-execute-maybe)
858 ("\C-e" . org-babel-execute-maybe)
859 ("o" . org-babel-open-src-block-result)
860 ("\C-o" . org-babel-open-src-block-result)
861 ("\C-v" . org-babel-expand-src-block)
862 ("v" . org-babel-expand-src-block)
863 ("u" . org-babel-goto-src-block-head)
864 ("\C-u" . org-babel-goto-src-block-head)
865 ("g" . org-babel-goto-named-src-block)
866 ("r" . org-babel-goto-named-result)
867 ("\C-r" . org-babel-goto-named-result)
868 ("\C-b" . org-babel-execute-buffer)
869 ("b" . org-babel-execute-buffer)
870 ("\C-s" . org-babel-execute-subtree)
871 ("s" . org-babel-execute-subtree)
872 ("\C-d" . org-babel-demarcate-block)
873 ("d" . org-babel-demarcate-block)
874 ("\C-t" . org-babel-tangle)
875 ("t" . org-babel-tangle)
876 ("\C-f" . org-babel-tangle-file)
877 ("f" . org-babel-tangle-file)
878 ("\C-c" . org-babel-check-src-block)
879 ("c" . org-babel-check-src-block)
880 ("\C-j" . org-babel-insert-header-arg)
881 ("j" . org-babel-insert-header-arg)
882 ("\C-l" . org-babel-load-in-session)
883 ("l" . org-babel-load-in-session)
884 ("\C-i" . org-babel-lob-ingest)
885 ("i" . org-babel-lob-ingest)
886 ("\C-I" . org-babel-view-src-block-info)
887 ("I" . org-babel-view-src-block-info)
888 ("\C-z" . org-babel-switch-to-session)
889 ("z" . org-babel-switch-to-session-with-code)
890 ("\C-a" . org-babel-sha1-hash)
891 ("a" . org-babel-sha1-hash)
892 ("h" . org-babel-describe-bindings)
893 ("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
894 ("x" . org-babel-do-key-sequence-in-edit-buffer)
895 ("k" . org-babel-remove-result-one-or-many)
896 ("\C-\M-h" . org-babel-mark-block))
897 "Alist of key bindings and interactive Babel functions.
898 This list associates interactive Babel functions
899 with keys. Each element of this list will add an entry to the
900 `org-babel-map' using the letter key which is the `car' of the
901 a-list placed behind the generic `org-babel-key-prefix'.")
903 (define-key org-mode-map org-babel-key-prefix org-babel-map)
904 (pcase-dolist (`(,key . ,def) org-babel-key-bindings)
905 (define-key org-babel-map key def))
907 (defun org-babel-speed-command-activate (keys)
908 "Hook for activating single-letter code block commands."
909 (when (and (bolp)
910 (let ((case-fold-search t)) (looking-at "[ \t]*#\\+begin_src"))
911 (eq 'src-block (org-element-type (org-element-at-point))))
912 (cdr (assoc keys org-babel-key-bindings))))
914 ;;;###autoload
915 (defun org-babel-describe-bindings ()
916 "Describe all keybindings behind `org-babel-key-prefix'."
917 (interactive)
918 (describe-bindings org-babel-key-prefix))
921 (provide 'org-keys)
922 ;;; org-keys.el ends here