org.el: Rebind structure-related variables within org-run-like-in-org-mode
* org.el (orgstruct-make-binding): Rebind structure-related variables within org-run-like-in-org-mode.
This commit is contained in:
parent
f20ae92e88
commit
ff92e688dd
65
lisp/org.el
65
lisp/org.el
|
@ -8761,36 +8761,41 @@ should be checked in for a command to execute outside of tables."
|
||||||
(setq nname (format "%s-%d" name (setq i (1+ i)))))
|
(setq nname (format "%s-%d" name (setq i (1+ i)))))
|
||||||
(setq name (intern nname)))
|
(setq name (intern nname)))
|
||||||
(eval
|
(eval
|
||||||
`(defun ,name (arg)
|
(let ((bindings '((org-heading-regexp
|
||||||
,(concat "In Structure, run `" (symbol-name fun) "'.\n"
|
(concat "^"
|
||||||
"Outside of structure, run the binding of `"
|
orgstruct-heading-prefix-regexp
|
||||||
(key-description key) "'.")
|
"\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ ]*$"))
|
||||||
(interactive "p")
|
(org-outline-regexp
|
||||||
(unless
|
(concat orgstruct-heading-prefix-regexp "\\*+ "))
|
||||||
(let* ((org-heading-regexp
|
(org-outline-regexp-bol
|
||||||
(concat "^"
|
(concat "^" org-outline-regexp))
|
||||||
orgstruct-heading-prefix-regexp
|
(outline-regexp org-outline-regexp)
|
||||||
"\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ ]*$"))
|
(outline-heading-end-regexp "\n")
|
||||||
(org-outline-regexp
|
(outline-level 'outline-level)
|
||||||
(concat orgstruct-heading-prefix-regexp "\\*+ "))
|
(outline-heading-alist))))
|
||||||
(org-outline-regexp-bol
|
`(defun ,name (arg)
|
||||||
(concat "^" org-outline-regexp))
|
,(concat "In Structure, run `" (symbol-name fun) "'.\n"
|
||||||
(outline-regexp org-outline-regexp)
|
"Outside of structure, run the binding of `"
|
||||||
(outline-heading-end-regexp "\n")
|
(key-description key) "'.")
|
||||||
(outline-level 'outline-level)
|
(interactive "p")
|
||||||
(outline-heading-alist))
|
(unless
|
||||||
(when (org-context-p 'headline 'item
|
(let* ,bindings
|
||||||
,(when (memq fun '(org-insert-heading))
|
(when (org-context-p 'headline 'item
|
||||||
'(when orgstruct-is-++
|
,(when (memq fun '(org-insert-heading))
|
||||||
'item-body)))
|
'(when orgstruct-is-++
|
||||||
(org-run-like-in-org-mode ',fun)
|
'item-body)))
|
||||||
t))
|
(org-run-like-in-org-mode
|
||||||
(let* ((orgstruct-mode)
|
(lambda ()
|
||||||
(binding (key-binding ,key)))
|
(interactive)
|
||||||
(if (keymapp binding)
|
(let* ,bindings
|
||||||
(set-temporary-overlay-map binding)
|
(call-interactively ',fun))))
|
||||||
(call-interactively
|
t))
|
||||||
(or binding 'orgstruct-error)))))))
|
(let* ((orgstruct-mode)
|
||||||
|
(binding (key-binding ,key)))
|
||||||
|
(if (keymapp binding)
|
||||||
|
(set-temporary-overlay-map binding)
|
||||||
|
(call-interactively
|
||||||
|
(or binding 'orgstruct-error))))))))
|
||||||
name))
|
name))
|
||||||
|
|
||||||
(defun org-contextualize-keys (alist contexts)
|
(defun org-contextualize-keys (alist contexts)
|
||||||
|
|
Loading…
Reference in New Issue