emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Included global properties not inherited: bug or feature?
@ 2019-12-06 10:55 Jarmo Hurri
  2019-12-06 20:41 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Jarmo Hurri @ 2019-12-06 10:55 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

It seems that when a file with global properties is included, the global
properties are not inherited. Is this a bug or a feature?

Consider the two files inlined below:

# ---------------------------------- file 'included.org' -------------------
#+property: MY_INCLUDED_PROPERTY some included value
# --------------------------------------------------------------------------

# -------------- file which includes ---------------------------------------

#+include: included.org :only-contents nil
#+property: MY_INLINE_PROPERTY some inline value

src_elisp[:exports results :results raw]{(org-entry-get nil "MY_INCLUDED_PROPERTY" t)} nil

src_elisp[:exports results :results raw]{(org-entry-get nil "MY_INLINE_PROPERTY" t)} some inline value
# --------------------------------------------------------------------------

As you can see from the results of evaluation of elisp blocks, the
included global property is not available in the including file. Note
that the documentation for #include states that there is a special
property :only-contents for including only contents, not properties. To
play it safe, I have set this property to 'nil' above.

https://orgmode.org/manual/Include-files.html

Based on this documentation, I was expecting global properties to be
available by default in including files.

I find current behaviour inconvenient, because I want to set common
global properties for a large number of files, and I can not currently
do this via an included file.

What is the verdict?

I am running
Org mode version 9.3 (release_9.3-34-g2eee3c)
GNU Emacs 26.2

Jarmo

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

* Re: Included global properties not inherited: bug or feature?
  2019-12-06 10:55 Included global properties not inherited: bug or feature? Jarmo Hurri
@ 2019-12-06 20:41 ` Nicolas Goaziou
  2019-12-07  6:28   ` Jarmo Hurri
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2019-12-06 20:41 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

Hello,

Jarmo Hurri <jarmo.hurri@iki.fi> writes:

> I find current behaviour inconvenient, because I want to set common
> global properties for a large number of files, and I can not currently
> do this via an included file.

What happens if you use SETUPFILE instead?

Regards,

-- 
Nicolas Goaziou

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

* Re: Included global properties not inherited: bug or feature?
  2019-12-06 20:41 ` Nicolas Goaziou
@ 2019-12-07  6:28   ` Jarmo Hurri
  0 siblings, 0 replies; 3+ messages in thread
From: Jarmo Hurri @ 2019-12-07  6:28 UTC (permalink / raw)
  To: emacs-orgmode

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


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> I find current behaviour inconvenient, because I want to set common
>> global properties for a large number of files, and I can not currently
>> do this via an included file.
>
> What happens if you use SETUPFILE instead?

It works perfectly.

Please find attached a patch that mentions this behaviour in the
include-part of Org manual. Ok?

Jarmo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: include doc patch --]
[-- Type: text/x-patch, Size: 1254 bytes --]

From 00701e1732fcf71180dc02f72117b44bccf5eb2d Mon Sep 17 00:00:00 2001
From: Jarmo Hurri <jarmo.hurri@iki.fi>
Date: Sat, 7 Dec 2019 08:19:05 +0200
Subject: [PATCH] org-manual.org: Document global properties not being
 inherited when including files

* doc/org-manual.org: Note that when an org-file is included, even
  with `:only-contents` set to `nil`, global properties set with lines
  beginning `#+PROPERTY:` will not be inherited in the file that
  includes. Point the user to use `#+SETUPFILE:` for this purpose.
---
 doc/org-manual.org | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 35f6013ce..a0aedf825 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11770,6 +11770,11 @@ with the custom ID =theory=, you can use
 
 : #+INCLUDE: "./paper.org::#theory" :only-contents t
 
+Note that even when =:only-contents= has value ~nil~, properties set
+in the included file by lines beginning with =#+PROPERTY:= will not be
+inherited in the file that includes. To achieve such inheritance, use
+=#+SETUPFILE:= instead (see [[Summary of In-Buffer Settings]]).
+
 The following command allows navigating to the included document:
 
 - {{{kbd(C-c ')}}} (~org-edit~special~) ::
-- 
2.21.0


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

end of thread, other threads:[~2019-12-07  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-06 10:55 Included global properties not inherited: bug or feature? Jarmo Hurri
2019-12-06 20:41 ` Nicolas Goaziou
2019-12-07  6:28   ` Jarmo Hurri

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).