mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-28 07:44:49 +00:00
org.el (orgstruct-setup): Bind all intermediate key translations.
* org.el (orgstruct-setup): Bind all intermediate key translations.
This commit is contained in:
parent
847637f4bd
commit
8a3e48bd21
44
lisp/org.el
44
lisp/org.el
@ -8960,26 +8960,30 @@ buffer. It will also recognize item context in multiline items."
|
||||
(let ((f (or (car-safe cell) cell))
|
||||
(disable-when-heading-prefix (cdr-safe cell)))
|
||||
(when (fboundp f)
|
||||
(dolist (binding (nconc (where-is-internal f org-mode-map)
|
||||
(where-is-internal f outline-mode-map)))
|
||||
;; TODO use local-function-key-map
|
||||
(dolist (rep '(("<tab>" . "TAB")
|
||||
("<return>" . "RET")
|
||||
("<escape>" . "ESC")
|
||||
("<delete>" . "DEL")))
|
||||
(setq binding (read-kbd-macro
|
||||
(let ((case-fold-search))
|
||||
(replace-regexp-in-string
|
||||
(regexp-quote (cdr rep))
|
||||
(car rep)
|
||||
(key-description binding))))))
|
||||
(let ((key (lookup-key orgstruct-mode-map binding)))
|
||||
(when (or (not key) (numberp key))
|
||||
(condition-case nil
|
||||
(org-defkey orgstruct-mode-map
|
||||
binding
|
||||
(orgstruct-make-binding f binding disable-when-heading-prefix))
|
||||
(error nil))))))))
|
||||
(let ((new-bindings))
|
||||
(dolist (binding (nconc (where-is-internal f org-mode-map)
|
||||
(where-is-internal f outline-mode-map)))
|
||||
(push binding new-bindings)
|
||||
;; TODO use local-function-key-map
|
||||
(dolist (rep '(("<tab>" . "TAB")
|
||||
("<return>" . "RET")
|
||||
("<escape>" . "ESC")
|
||||
("<delete>" . "DEL")))
|
||||
(setq binding (read-kbd-macro
|
||||
(let ((case-fold-search))
|
||||
(replace-regexp-in-string
|
||||
(regexp-quote (cdr rep))
|
||||
(car rep)
|
||||
(key-description binding)))))
|
||||
(pushnew binding new-bindings :test 'equal)))
|
||||
(dolist (binding new-bindings)
|
||||
(let ((key (lookup-key orgstruct-mode-map binding)))
|
||||
(when (or (not key) (numberp key))
|
||||
(condition-case nil
|
||||
(org-defkey orgstruct-mode-map
|
||||
binding
|
||||
(orgstruct-make-binding f binding disable-when-heading-prefix))
|
||||
(error nil)))))))))
|
||||
(run-hooks 'orgstruct-setup-hook))
|
||||
|
||||
(defun orgstruct-make-binding (fun key disable-when-heading-prefix)
|
||||
|
Loading…
Reference in New Issue
Block a user