emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Is it generally better practice to specify local variables at the first line for Org files?
@ 2016-10-04 20:36 Jorge Morais Neto
  2016-10-05  6:40 ` Marco Wahl
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Morais Neto @ 2016-10-04 20:36 UTC (permalink / raw)
  To: org mode

Hi.  In most of my Emacs files, I set any file local variables using a local
variables list near the end of the file.  However I just realized a pitfall.
Emacs, according to its manual, only recognizes this local variables list if
its location fulfills two criteria:
1. It starts no more than 3000 characters from the end of the file.
2. It is on the last page if the file is divided into pages.

This means that if I refile some Org subtree to another Org file, and the
refile target is below the local variables list (e. g. if I refile to the top
level, so that Org chooses the end of the file) then the local variables list
may start failing one of the criteria and thus silently stop working.  There
may be other problematic scenarios.

Therefore it seems that, for Org files, it is good practice to avoid this
pitfall by specifying any file local variables via the other method, i.e. on
the first line.  I ask for confirmation that this is a general Org Mode good
practice before I adopt it for all my existing Org files and any future ones.

And if this is in fact a general Org Mode good practice, I propose documenting
it in both manuals: the Emacs manual at [[info:emacs#Specifying File Variables]]
and the Org manual somewhere.

Regards

-- 
• I am Brazilian.  I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/

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

* Re: Is it generally better practice to specify local variables at the first line for Org files?
  2016-10-04 20:36 Is it generally better practice to specify local variables at the first line for Org files? Jorge Morais Neto
@ 2016-10-05  6:40 ` Marco Wahl
  2016-10-05  9:33   ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Wahl @ 2016-10-05  6:40 UTC (permalink / raw)
  To: emacs-orgmode

Hi Jorge!

> Hi.  In most of my Emacs files, I set any file local variables using a local
> variables list near the end of the file.  However I just realized a pitfall.
> Emacs, according to its manual, only recognizes this local variables list if
> its location fulfills two criteria:
> 1. It starts no more than 3000 characters from the end of the file.
> 2. It is on the last page if the file is divided into pages.

Yes.

> This means that if I refile some Org subtree to another Org file, and the
> refile target is below the local variables list (e. g. if I refile to the top
> level, so that Org chooses the end of the file) then the local variables list
> may start failing one of the criteria and thus silently stop working.  There
> may be other problematic scenarios.

Yes.

> Therefore it seems that, for Org files, it is good practice to avoid this
> pitfall by specifying any file local variables via the other method, i.e. on
> the first line.  I ask for confirmation that this is a general Org Mode good
> practice before I adopt it for all my existing Org files and any future ones.

I have the same issue.  Currently I try to have an extra eye on the
bottommost org tree.  I also use an extra tag to mark the org tree which
should be bottommost.  I also use the idea stated in
http://www.mail-archive.com/emacs-orgmode@gnu.org/msg106940.html which sorts
the wanted org tree to the bottom when sorting.

For me this works reasonably well.

When you put the local variables to the top of the file you are on the
save side AFAICT.

I try to avoid too much information in the first line.  I prefer to have
the variables at the bottom.


Best regards,
-- 
Marco

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

* Re: Is it generally better practice to specify local variables at the first line for Org files?
  2016-10-05  6:40 ` Marco Wahl
@ 2016-10-05  9:33   ` Nicolas Goaziou
  2016-10-05 11:35     ` John Kitchin
  2016-10-05 13:50     ` Marco Wahl
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2016-10-05  9:33 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

Hello,

Marco Wahl <marcowahlsoft@gmail.com> writes:

> I have the same issue.  Currently I try to have an extra eye on the
> bottommost org tree.  I also use an extra tag to mark the org tree which
> should be bottommost.  I also use the idea stated in
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg106940.html which sorts
> the wanted org tree to the bottom when sorting.
>
> For me this works reasonably well.
>
> When you put the local variables to the top of the file you are on the
> save side AFAICT.
>
> I try to avoid too much information in the first line.  I prefer to have
> the variables at the bottom.

Local variables at the end of the buffer are, indeed, a bit painful to
handle under Org. Org Footnote handles them reasonably well, I think,
but that's about it.

I would welcome a general solution to this, as long as it does not
impede speed of most basic Org commands.

Do you have an idea about it? Maybe a start would be to have a dedicated
Org version of `outline-next-heading' that moves before local variables
when it reaches the end of the buffer.

Regards,

-- 
Nicolas Goaziou

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

* Re: Is it generally better practice to specify local variables at the first line for Org files?
  2016-10-05  9:33   ` Nicolas Goaziou
@ 2016-10-05 11:35     ` John Kitchin
  2016-10-05 13:50     ` Marco Wahl
  1 sibling, 0 replies; 5+ messages in thread
From: John Kitchin @ 2016-10-05 11:35 UTC (permalink / raw)
  To: Marco Wahl, emacs-orgmode@gnu.org

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

I usually just put a headline at the end, titled "end" or "local
variables", etc.., and tagged noexport,


John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Wed, Oct 5, 2016 at 5:33 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Marco Wahl <marcowahlsoft@gmail.com> writes:
>
> > I have the same issue.  Currently I try to have an extra eye on the
> > bottommost org tree.  I also use an extra tag to mark the org tree which
> > should be bottommost.  I also use the idea stated in
> > http://www.mail-archive.com/emacs-orgmode@gnu.org/msg106940.html which
> sorts
> > the wanted org tree to the bottom when sorting.
> >
> > For me this works reasonably well.
> >
> > When you put the local variables to the top of the file you are on the
> > save side AFAICT.
> >
> > I try to avoid too much information in the first line.  I prefer to have
> > the variables at the bottom.
>
> Local variables at the end of the buffer are, indeed, a bit painful to
> handle under Org. Org Footnote handles them reasonably well, I think,
> but that's about it.
>
> I would welcome a general solution to this, as long as it does not
> impede speed of most basic Org commands.
>
> Do you have an idea about it? Maybe a start would be to have a dedicated
> Org version of `outline-next-heading' that moves before local variables
> when it reaches the end of the buffer.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>

[-- Attachment #2: Type: text/html, Size: 2602 bytes --]

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

* Re: Is it generally better practice to specify local variables at the first line for Org files?
  2016-10-05  9:33   ` Nicolas Goaziou
  2016-10-05 11:35     ` John Kitchin
@ 2016-10-05 13:50     ` Marco Wahl
  1 sibling, 0 replies; 5+ messages in thread
From: Marco Wahl @ 2016-10-05 13:50 UTC (permalink / raw)
  To: emacs-orgmode

> Local variables at the end of the buffer are, indeed, a bit painful to
> handle under Org. Org Footnote handles them reasonably well, I think,
> but that's about it.
>
> I would welcome a general solution to this, as long as it does not
> impede speed of most basic Org commands.
>
> Do you have an idea about it?

I think it's difficult to find a good way to keep something (e.g. the
local variables) at the bottom of an org file.  Up to now the bottommost
tree contains the rest of the file.  There is no bottom.  A certain
bottom would somehow disturb the tree structure as it is, AFAICS.

For the implementation you need to check for many operations if the
bottom is involved.

The header of an org file on the other side is a save place with regards
to operations in the tree.  Personally, if Emacs would allow to place
the local variables block at the beginning of a file, I'd do that.

> Maybe a start would be to have a dedicated
> Org version of `outline-next-heading' that moves before local variables
> when it reaches the end of the buffer.

This sounds like a good idea to me.  This step would keep the local
variables a bit saver, AFAICS.  I can imagine that the implementation of
this idea (and more ideas like this) could yield an almost pain free
local variable experience for org files.


Ciao,
-- 
Marco

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

end of thread, other threads:[~2016-10-05 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 20:36 Is it generally better practice to specify local variables at the first line for Org files? Jorge Morais Neto
2016-10-05  6:40 ` Marco Wahl
2016-10-05  9:33   ` Nicolas Goaziou
2016-10-05 11:35     ` John Kitchin
2016-10-05 13:50     ` Marco Wahl

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).