all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Question] Learning to use Org Element API setters and how to ignore properties
@ 2024-03-10 14:21 Antonio Romano
  2024-03-11 10:24 ` Bruno Barbier
  2024-03-13 13:41 ` Ihor Radchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Antonio Romano @ 2024-03-10 14:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi all, I start with the premise that I'm a novice in Elisp development
so I don't really have that much experience. Lately I've been toying
with the idea of applying Lindholm's "A three way merge for XML
documents" paper to Org mode in order to achieve a context aware
merging mechanism between two documents given their syntax tree. 

There's nothing concrete on my side, but I'd like to try and see if
org-element's AST can fit this kind of merging. However, I've had close
to no progress in trying to make the setter functions work despite all
the indications on worg and I think I would really benefit to see some
concrete usage examples somewhere.

Another concerns is about properties - given a simple Org document with
just one headline marked as TODO, this is its parse tree:

   (with-current-buffer "testorg1.org"
     (org-element-contents
      (pp (org-element-parse-buffer))))
   
   (org-data
    (:begin 1 :contents-begin 1 :contents-end 35 :end 35 :robust-begin
   3 :robust-end 33 :post-blank 0 :post-affiliated 1 :path
   "/home/antonio/testorg1.org" :mode org-data :CATEGORY "testorg1"
   :granularity nil)
    (headline
     (:raw-value "Hello" :begin 1 :end 35 :pre-blank 0 :contents-begin
   14 :contents-end 35 :robust-begin 16 :robust-end 33 :level 1
   :priority nil :tags nil :todo-keyword
   	      #("TODO" 0 4
   		(face
   		 (org-todo org-level-1)
   		 fontified t))
   	      :todo-type todo :post-blank 0 :footnote-section-p nil
   :archivedp nil :commentedp nil :post-affiliated 1 :title
   	      (#("Hello" 0 5
   		 (:parent #1)))
   	      :mode first-section :granularity nil :parent #0)
     (section
      (:begin 14 :end 35 :contents-begin 14 :contents-end 35 :robust-
   begin 14 :robust-end 33 :post-blank 0 :post-affiliated 14 :mode
   section :granularity nil :parent #1)
      (paragraph
       (:begin 14 :end 35 :contents-begin 14 :contents-end 35 :post-
   blank 0 :post-affiliated 14 :mode planning :granularity nil :parent
   #2)
       #("This is a paragraph.\n" 0 21
         (:parent #3))))))
   nil


The :todo-keyword contains data about face and properties which are
only relevant for viewing the document in the buffer and not for the
.org file content itself. How can I read its text without any property
info attached to it?


Sorry for the naive questions and thanks in advance for your
availability.



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

* Re: [Question] Learning to use Org Element API setters and how to ignore properties
  2024-03-10 14:21 [Question] Learning to use Org Element API setters and how to ignore properties Antonio Romano
@ 2024-03-11 10:24 ` Bruno Barbier
  2024-03-13 13:41 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Bruno Barbier @ 2024-03-11 10:24 UTC (permalink / raw)
  To: Antonio Romano, emacs-orgmode


Hi Antonio,

Antonio Romano <n58r@pm.me> writes:

[...]
> The :todo-keyword contains data about face and properties which are
> only relevant for viewing the document in the buffer and not for the
> .org file content itself. How can I read its text without any property
> info attached to it?

You could remove them using the function `substring-no-properties'.

Bruno


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

* Re: [Question] Learning to use Org Element API setters and how to ignore properties
  2024-03-10 14:21 [Question] Learning to use Org Element API setters and how to ignore properties Antonio Romano
  2024-03-11 10:24 ` Bruno Barbier
@ 2024-03-13 13:41 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2024-03-13 13:41 UTC (permalink / raw)
  To: Antonio Romano; +Cc: emacs-orgmode

Antonio Romano <n58r@pm.me> writes:

> There's nothing concrete on my side, but I'd like to try and see if
> org-element's AST can fit this kind of merging. However, I've had close
> to no progress in trying to make the setter functions work despite all
> the indications on worg and I think I would really benefit to see some
> concrete usage examples somewhere.

You may study `org-export--install-footnote-definitions',
`org-export--remove-uninterpreted-data',
`org-export-insert-image-links', `org-latex--wrap-latex-math-block', or
`org-extra--merge-sections' from ox-extra (part of org-contrib package).

-- 
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] 3+ messages in thread

end of thread, other threads:[~2024-03-13 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-10 14:21 [Question] Learning to use Org Element API setters and how to ignore properties Antonio Romano
2024-03-11 10:24 ` Bruno Barbier
2024-03-13 13:41 ` 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.