all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Let `org-element-at-point` or `org-element-context` return element type "tags" when point on tags.
@ 2024-04-07  8:01 Christopher M. Miles
  2024-04-07 12:02 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher M. Miles @ 2024-04-07  8:01 UTC (permalink / raw)
  To: Org mode

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]


When I move point on the headline tags position. I evaluate
`(org-element-at-point)` or `(org-element-context)`, both return element
type is `(headline ....)`. I hope those two functions can return more
explicit element type like "tags".

I tried to find this type API function in existing functions. But I have
not found. If someone knows, please let me know. I use this function to
detect whether current point is on tags element. I try to write a simple
extension to display tag explanation info through eldoc.

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Let `org-element-at-point` or `org-element-context` return element type "tags" when point on tags.
  2024-04-07  8:01 Let `org-element-at-point` or `org-element-context` return element type "tags" when point on tags Christopher M. Miles
@ 2024-04-07 12:02 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2024-04-07 12:02 UTC (permalink / raw)
  To: Christopher M. Miles; +Cc: Org mode

"Christopher M. Miles" <numbchild@gmail.com> writes:

> When I move point on the headline tags position. I evaluate
> `(org-element-at-point)` or `(org-element-context)`, both return element
> type is `(headline ....)`. I hope those two functions can return more
> explicit element type like "tags".

> I tried to find this type API function in existing functions. But I have
> not found. If someone knows, please let me know. I use this function to
> detect whether current point is on tags element. I try to write a simple
> extension to display tag explanation info through eldoc.

There is currently no such function.
We do not parse headline tags as a separate syntax node - they are
considered an integral part of the headline node.

In future, there is a possibility that more fine-grained information can
be obtained using WIP library org-element-match:
https://git.sr.ht/~yantar92/org-mode/tree/feature/org-font-lock-element/item/lisp/org-element-match.el#L715

For now, you may have to use regular expression for fine-grained information.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-07 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-07  8:01 Let `org-element-at-point` or `org-element-context` return element type "tags" when point on tags Christopher M. Miles
2024-04-07 12:02 ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.