Function: smart-org
smart-org is a byte-compiled function defined in hui-mouse.el.
Signature
(smart-org)
Documentation
Follow Org mode references, cycle outline visibility and execute code blocks.
Active when hsys-org-enable-smart-keys is non-nil,
When the Action Key is pressed and hsys-org-enable-smart-keys is t:
1. On an Org tag, call hsys-org-agenda-tags-p and an
appropriate view tags function based on current directory or
buffer name, matching to the tag. If on a colon between
tags, match to all tags on the line.
2. On an Org todo keyword, cycle through the keywords in that
set or if final done keyword, remove it.
3. On an Org agenda view item, jump to the item for editing.
When the Action Key is pressed and hsys-org-enable-smart-keys is
either t or :buttons:
4. Within a radio or internal target or a link to it, jump between
the target and the first link to it, allowing two-way navigation.
5. On another internal link in an Org mode file, jump to its referent.
6. On an Org mode external link, jump to its referent.
7. On a Hyperbole button, activate the button.
8. With point on the :dir path of a code block definition, display the
directory given by the path.
9. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
or #+end_example header, execute the code block via the Org mode
standard binding of {\C-c \C-c}, (org-ctrl-c-ctrl-c).
10. With point on an Org mode heading, cycle the view of the subtree at
point.
11. In any other context besides the end of a line, invoke the Org mode
standard binding of {M-RET}, (org-meta-return).
When the Assist Key is pressed, it behaves just like the Action Key except in these contexts:
1. On an Org tag, call hsys-consult-org-grep-tags-p and an
appropriate consult grep function based on current directory
or buffer name, prompting with and matching to the tag. If on a
colon between tags, prompt and match to all tags on the line.
2. On an Org todo keyword, move to the first todo keyword in the next
set, if any.
3. On an Org mode link or agenda view item, display Hyperbole
context-sensitive help.
4. On a Hyperbole button, perform the Assist Key function, generally
showing help for the button.
5. With point on the :dir value of a code block definition, display
a help summary of this implicit directory button.
6. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
or #+end_example header, remove source block results.
7. Not on a Hyperbole button but on an Org mode heading, cycle
through views of the whole buffer outline.
To disable ALL Hyperbole support within Org major and minor modes, set the
custom option hsys-org-enable-smart-keys to nil. Then in Org modes, this
will invoke org-meta-return.
Org links may be used outside of Org mode buffers. Such links are
handled by the separate implicit button type, org-link-outside-org-mode.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui-mouse.el
(defun smart-org ()
"Follow Org mode references, cycle outline visibility and execute code blocks.
Active when `hsys-org-enable-smart-keys' is non-nil,
When the Action Key is pressed and `hsys-org-enable-smart-keys' is t:
1. On an Org tag, call `hsys-org-agenda-tags-p' and an
appropriate view tags function based on current directory or
buffer name, matching to the tag. If on a colon between
tags, match to all tags on the line.
2. On an Org todo keyword, cycle through the keywords in that
set or if final done keyword, remove it.
3. On an Org agenda view item, jump to the item for editing.
When the Action Key is pressed and `hsys-org-enable-smart-keys' is
either t or `:buttons':
4. Within a radio or internal target or a link to it, jump between
the target and the first link to it, allowing two-way navigation.
5. On another internal link in an Org mode file, jump to its referent.
6. On an Org mode external link, jump to its referent.
7. On a Hyperbole button, activate the button.
8. With point on the :dir path of a code block definition, display the
directory given by the path.
9. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
or #+end_example header, execute the code block via the Org mode
standard binding of {\\`C-c' \\`C-c'}, (`org-ctrl-c-ctrl-c').
10. With point on an Org mode heading, cycle the view of the subtree at
point.
11. In any other context besides the end of a line, invoke the Org mode
standard binding of {M-RET}, (`org-meta-return').
When the Assist Key is pressed, it behaves just like the Action Key except
in these contexts:
1. On an Org tag, call `hsys-consult-org-grep-tags-p' and an
appropriate consult grep function based on current directory
or buffer name, prompting with and matching to the tag. If on a
colon between tags, prompt and match to all tags on the line.
2. On an Org todo keyword, move to the first todo keyword in the next
set, if any.
3. On an Org mode link or agenda view item, display Hyperbole
context-sensitive help.
4. On a Hyperbole button, perform the Assist Key function, generally
showing help for the button.
5. With point on the :dir value of a code block definition, display
a help summary of this implicit directory button.
6. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
or #+end_example header, remove source block results.
7. Not on a Hyperbole button but on an Org mode heading, cycle
through views of the whole buffer outline.
To disable ALL Hyperbole support within Org major and minor modes, set the
custom option `hsys-org-enable-smart-keys' to nil. Then in Org modes, this
will invoke `org-meta-return'.
Org links may be used outside of Org mode buffers. Such links are
handled by the separate implicit button type, `org-link-outside-org-mode'."
(when (funcall hsys-org-mode-function)
(let (start-end)
(cond ((not hsys-org-enable-smart-keys)
(when (hsys-org-meta-return-shared-p)
(hact 'hsys-org-meta-return))
;; Ignore any further Smart Key non-Org contexts
t)
((eq hsys-org-enable-smart-keys t)
(cond ((setq hkey-value
(if (not assist-flag)
(hsys-org-agenda-tags-p)
(hsys-consult-org-grep-tags-p)))
(hact hkey-value))
((or (hsys-org-todo-at-p)
(eq last-command #'org-todo))
(if (not assist-flag)
(hact 'hsys-org-todo-cycle)
(hact 'hsys-org-todo-set-cycle)))
((hsys-org-agenda-item-at-p)
(smart-org-agenda-item-action)
;; Ignore any further Smart Key non-Org contexts
t)
((hsys-org-radio-target-def-at-p)
(hact 'org-radio-target-link)
t)
((setq start-end (hsys-org-internal-target-def-at-p))
(hsys-org-set-ibut-label start-end)
(hact 'org-internal-target-link)
t)
((setq start-end (hsys-org-link-at-p))
(if (not assist-flag)
(progn (hsys-org-set-ibut-label start-end)
(hact 'org-link))
(hact 'hkey-help))
t)
((hbut:at-p)
;; Fall through until Hyperbole button context and
;; activate normally.
nil)
((or (hsys-org-src-block-start-at-p)
(save-excursion (forward-line 0)
(or (looking-at org-babel-result-regexp)
(looking-at "^[ ]*#\\+\\(end_src\\|begin_example\\|end_example\\)"))))
(hact (lambda ()
(save-excursion
(unless (hsys-org-src-block-start-at-p)
(re-search-backward org-babel-src-block-regexp nil t))
(cond ((not assist-flag)
(org-ctrl-c-ctrl-c))
((org-babel-where-is-src-block-result)
(org-babel-remove-result)
(message "Code block results removed."))
(t (message "No results to remove for this code block."))))))
t)
((hsys-org-heading-at-p)
(if (not assist-flag)
(hact 'hsys-org-cycle)
(hact 'hsys-org-global-cycle))
t)
((equal (hsys-org-get-value :language) "python")
(setq hkey-value (smart-python-at-tag-p))
(hact 'smart-python hkey-value))
(t
;; Continue with any further Smart Key non-Org contexts
nil)))
((memq hsys-org-enable-smart-keys '(:buttons buttons))
(cond ((hsys-org-radio-target-def-at-p)
(hact 'org-radio-target-link)
t)
((setq start-end (hsys-org-link-at-p))
(if (not assist-flag)
(progn (hsys-org-set-ibut-label start-end)
(hact 'org-link))
(hact 'hkey-help))
t)
((hbut:at-p)
;; Fall through until Hyperbole button context and
;; activate normally.
nil)
((and (apply #'derived-mode-p '(org-mode))
(equal (hsys-org-get-value :language) "python"))
(setq hkey-value (smart-python-at-tag-p))
(hact 'smart-python hkey-value ''next-tag))
((apply #'derived-mode-p '(org-mode))
(when (hsys-org-meta-return-shared-p)
(hact 'hsys-org-meta-return))
;; Ignore any further Smart Key non-Org contexts
t)
((hsys-org-agenda-item-at-p)
(smart-org-agenda-item-action)
;; Ignore any further Smart Key non-Org contexts
t)
;; Ignore any further Smart Key non-Org contexts
(t)))
(t
;; hsys-org-enable-smart-keys is set to t, so try other Smart
;; contexts
nil)))))