all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Properties drawer at buffer/file level
@ 2024-07-29 16:02 Sébastien Gendre
  2024-07-29 17:03 ` Martin Edström
  2024-07-29 17:09 ` Martin Edström
  0 siblings, 2 replies; 6+ messages in thread
From: Sébastien Gendre @ 2024-07-29 16:02 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,


If I set a property with `(org-set-property)' when the point is at the
top of a buffer, before any heading, I got a property drawer inserted at
in the first line of the buffer.

But if I already have buffer settings, like "#+TITLE:", the property
drawer is put before these settings.

Is it possible to tell Org-mode to put the buffer properties drawer after
the buffer settings ?


More context:

I try to use Org-roam to take notes about books I read. With this, I got
1 file per book, with the title of the book set as buffer setting
"#+TITLE:".

But when I add other information (like author, editor, etc)
into a property drawer of my note, these additional info are inserted
before the title.

On a new note, I got this:

     :PROPERTIES:
     :ID:       A-unique-ID
     :Author:   Author Name
     :Editor:   Editor Name
     :END:
     #+Title: Book title


Instead of this:

     #+Title: Book title
     :PROPERTIES:
     :ID:       A-unique-ID
     :Author:   Author Name
     :Editor:   Editor Name
     :END:

Which is visually very different from what I got when the property
drawer is set for a heading. And the actual result feel less intuitive
than what I got with heading.


Best regards

-------
Gendre Sébastien

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

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

* Re: Properties drawer at buffer/file level
  2024-07-29 16:02 Properties drawer at buffer/file level Sébastien Gendre
@ 2024-07-29 17:03 ` Martin Edström
  2024-07-29 17:15   ` Sébastien Gendre
  2024-07-29 17:09 ` Martin Edström
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Edström @ 2024-07-29 17:03 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: emacs-orgmode

The property drawer has to come first for technical reasons.  Just try manually moving the property drawer beneath the title, then do

    M-: (org-entry-get nil "ID")

and what do you get? Nil.

Martin

On Mon, 29 Jul 2024 18:02:35 +0200, Sébastien Gendre <seb@k-7.ch> wrote:

> Hello,
> 
> 
> If I set a property with `(org-set-property)' when the point is at the
> top of a buffer, before any heading, I got a property drawer inserted at
> in the first line of the buffer.
> 
> But if I already have buffer settings, like "#+TITLE:", the property
> drawer is put before these settings.
> 
> Is it possible to tell Org-mode to put the buffer properties drawer after
> the buffer settings ?
> 
> 
> More context:
> 
> I try to use Org-roam to take notes about books I read. With this, I got
> 1 file per book, with the title of the book set as buffer setting
> "#+TITLE:".
> 
> But when I add other information (like author, editor, etc)
> into a property drawer of my note, these additional info are inserted
> before the title.
> 
> On a new note, I got this:
> 
>      :PROPERTIES:
>      :ID:       A-unique-ID
>      :Author:   Author Name
>      :Editor:   Editor Name
>      :END:
>      #+Title: Book title
> 
> 
> Instead of this:
> 
>      #+Title: Book title
>      :PROPERTIES:
>      :ID:       A-unique-ID
>      :Author:   Author Name
>      :Editor:   Editor Name
>      :END:
> 
> Which is visually very different from what I got when the property
> drawer is set for a heading. And the actual result feel less intuitive
> than what I got with heading.
> 
> 
> Best regards
> 
> -------
> Gendre Sébastien




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

* Re: Properties drawer at buffer/file level
  2024-07-29 16:02 Properties drawer at buffer/file level Sébastien Gendre
  2024-07-29 17:03 ` Martin Edström
@ 2024-07-29 17:09 ` Martin Edström
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Edström @ 2024-07-29 17:09 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: emacs-orgmode

The property drawer has to come first for technical reasons. Just try manually moving the property drawer beneath the title, then do

M-: (org-entry-get nil "ID")

and what do you get? Nil.

Martin

On Mon, 29 Jul 2024 18:02:35 +0200, Sébastien Gendre <seb@k-7.ch> wrote:

> Hello,
> 
> 
> If I set a property with `(org-set-property)' when the point is at the
> top of a buffer, before any heading, I got a property drawer inserted at
> in the first line of the buffer.
> 
> But if I already have buffer settings, like "#+TITLE:", the property
> drawer is put before these settings.
> 
> Is it possible to tell Org-mode to put the buffer properties drawer after
> the buffer settings ?
> 
> 
> More context:
> 
> I try to use Org-roam to take notes about books I read. With this, I got
> 1 file per book, with the title of the book set as buffer setting
> "#+TITLE:".
> 
> But when I add other information (like author, editor, etc)
> into a property drawer of my note, these additional info are inserted
> before the title.
> 
> On a new note, I got this:
> 
>      :PROPERTIES:
>      :ID:       A-unique-ID
>      :Author:   Author Name
>      :Editor:   Editor Name
>      :END:
>      #+Title: Book title
> 
> 
> Instead of this:
> 
>      #+Title: Book title
>      :PROPERTIES:
>      :ID:       A-unique-ID
>      :Author:   Author Name
>      :Editor:   Editor Name
>      :END:
> 
> Which is visually very different from what I got when the property
> drawer is set for a heading. And the actual result feel less intuitive
> than what I got with heading.
> 
> 
> Best regards
> 
> -------
> Gendre Sébastien




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

* Re: Properties drawer at buffer/file level
  2024-07-29 17:03 ` Martin Edström
@ 2024-07-29 17:15   ` Sébastien Gendre
  2024-07-29 17:57     ` Martin Edström
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Gendre @ 2024-07-29 17:15 UTC (permalink / raw)
  To: Martin Edström; +Cc: emacs-orgmode

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


I get nil.



"Martin Edström" <meedstrom@runbox.com> writes:

> The property drawer has to come first for technical reasons.  Just try manually moving the property drawer beneath the title, then do
>
>     M-: (org-entry-get nil "ID")
>
> and what do you get? Nil.
>
> Martin
>
> On Mon, 29 Jul 2024 18:02:35 +0200, Sébastien Gendre <seb@k-7.ch> wrote:
>
>> Hello,
>> 
>> 
>> If I set a property with `(org-set-property)' when the point is at the
>> top of a buffer, before any heading, I got a property drawer inserted at
>> in the first line of the buffer.
>> 
>> But if I already have buffer settings, like "#+TITLE:", the property
>> drawer is put before these settings.
>> 
>> Is it possible to tell Org-mode to put the buffer properties drawer after
>> the buffer settings ?
>> 
>> 
>> More context:
>> 
>> I try to use Org-roam to take notes about books I read. With this, I got
>> 1 file per book, with the title of the book set as buffer setting
>> "#+TITLE:".
>> 
>> But when I add other information (like author, editor, etc)
>> into a property drawer of my note, these additional info are inserted
>> before the title.
>> 
>> On a new note, I got this:
>> 
>>      :PROPERTIES:
>>      :ID:       A-unique-ID
>>      :Author:   Author Name
>>      :Editor:   Editor Name
>>      :END:
>>      #+Title: Book title
>> 
>> 
>> Instead of this:
>> 
>>      #+Title: Book title
>>      :PROPERTIES:
>>      :ID:       A-unique-ID
>>      :Author:   Author Name
>>      :Editor:   Editor Name
>>      :END:
>> 
>> Which is visually very different from what I got when the property
>> drawer is set for a heading. And the actual result feel less intuitive
>> than what I got with heading.
>> 
>> 
>> Best regards
>> 
>> -------
>> Gendre Sébastien

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

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

* Re: Properties drawer at buffer/file level
  2024-07-29 17:15   ` Sébastien Gendre
@ 2024-07-29 17:57     ` Martin Edström
  2024-07-29 18:41       ` Sébastien Gendre
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Edström @ 2024-07-29 17:57 UTC (permalink / raw)
  To: Sébastien Gendre; +Cc: emacs-orgmode

That's why the command puts them at the top.  That's where it'll work.

As for changing it so they can be below the title, a question is how far below? Realize that #+keywords can actually be anywhere in the document, interspersed with body text.   We'd at least need something like an `org-end-of-metadata` function to jump to the first non-keyword text. But that is complicated too, because people do comment-out keywords and leave blank lines, e.g.:


    #+title: New title
    # #+title: Old title
    
    #+date: 2024-07-24


which could easily result in putting the drawer amidst these lines, resulting in this mess:


    #+title: New title
    :PROPERTIES:
    ...
    :END:
    # #+title: Old title
    
    #+date: 2024-07-24



Maybe the discussion from 2019 can shed more light on the matter: https://lists.gnu.org/archive/html/emacs-orgmode/2019-10/msg00027.html.  

Bit off-topic, but I have still not understood what functionality the file-level drawers actually enable.  I suppose dropping support is out of the question?  It seems every other function I write has to have special-purpose code to handle the case of outline level 0... it's a maintenance burden.  I got the impression it was only added due to org-roam, but it does not actually need them. It works fine with a traditional top-level heading instead of a #+title.

Martin Edström

On Mon, 29 Jul 2024 19:15:05 +0200, Sébastien Gendre <seb@k-7.ch> wrote:

> 
> I get nil.
> 
> 
> 
> "Martin Edström" <meedstrom@runbox.com> writes:
> 
> > The property drawer has to come first for technical reasons.  Just try manually moving the property drawer beneath the title, then do
> >
> >     M-: (org-entry-get nil "ID")
> >
> > and what do you get? Nil.
> >
> > Martin
> >
> > On Mon, 29 Jul 2024 18:02:35 +0200, Sébastien Gendre <seb@k-7.ch> wrote:
> >
> >> Hello,
> >> 
> >> 
> >> If I set a property with `(org-set-property)' when the point is at the
> >> top of a buffer, before any heading, I got a property drawer inserted at
> >> in the first line of the buffer.
> >> 
> >> But if I already have buffer settings, like "#+TITLE:", the property
> >> drawer is put before these settings.
> >> 
> >> Is it possible to tell Org-mode to put the buffer properties drawer after
> >> the buffer settings ?
> >> 
> >> 
> >> More context:
> >> 
> >> I try to use Org-roam to take notes about books I read. With this, I got
> >> 1 file per book, with the title of the book set as buffer setting
> >> "#+TITLE:".
> >> 
> >> But when I add other information (like author, editor, etc)
> >> into a property drawer of my note, these additional info are inserted
> >> before the title.
> >> 
> >> On a new note, I got this:
> >> 
> >>      :PROPERTIES:
> >>      :ID:       A-unique-ID
> >>      :Author:   Author Name
> >>      :Editor:   Editor Name
> >>      :END:
> >>      #+Title: Book title
> >> 
> >> 
> >> Instead of this:
> >> 
> >>      #+Title: Book title
> >>      :PROPERTIES:
> >>      :ID:       A-unique-ID
> >>      :Author:   Author Name
> >>      :Editor:   Editor Name
> >>      :END:
> >> 
> >> Which is visually very different from what I got when the property
> >> drawer is set for a heading. And the actual result feel less intuitive
> >> than what I got with heading.
> >> 
> >> 
> >> Best regards
> >> 
> >> -------
> >> Gendre Sébastien




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

* Re: Properties drawer at buffer/file level
  2024-07-29 17:57     ` Martin Edström
@ 2024-07-29 18:41       ` Sébastien Gendre
  0 siblings, 0 replies; 6+ messages in thread
From: Sébastien Gendre @ 2024-07-29 18:41 UTC (permalink / raw)
  To: Martin Edström; +Cc: emacs-orgmode

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

"Martin Edström" <meedstrom@runbox.eu> writes:

> Bit off-topic, but I have still not understood what functionality the
> file-level drawers actually enable. I suppose dropping support is out
> of the question? It seems every other function I write has to have
> special-purpose code to handle the case of outline level 0... it's a
> maintenance burden. I got the impression it was only added due to
> org-roam, but it does not actually need them. It works fine with a
> traditional top-level heading instead of a #+title.

I only use a buffer level properties drawer with Org-roam.

But I have difficulties to understand why Org-roam use it and not use a
heading at lever 1 with an ID.

Maybe for the export ?

I had never understand if, with org-mode, using the top-level heading
for the document title is a good idea. Doesn't it cause problem with
export ?

I got the same kind of questioning with Org-ql. For example, if I made a
blog with Org-mode, org-publish and Org-ql.

I write 1 blog post per org-mode file and I want to automatically build
the home page of the blog with Org-ql. For Org-ql, in each post file, I
need to have a top level heading representing the blog post. But if I do
that, it will break the HTML export ?

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

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 16:02 Properties drawer at buffer/file level Sébastien Gendre
2024-07-29 17:03 ` Martin Edström
2024-07-29 17:15   ` Sébastien Gendre
2024-07-29 17:57     ` Martin Edström
2024-07-29 18:41       ` Sébastien Gendre
2024-07-29 17:09 ` Martin Edström

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.