Re: [O] Create a longtable in LaTeX from orgtbl

2014-10-11 Thread Tak Kunihiro
http://lists.gnu.org/archive/html/emacs-orgmode/2014-06/msg00634.html

Thank you for responses in regard to making a longtable using a radio
table.  I found a way and want to let you know.

\begin{footnotesize}
  \begin{center}
% BEGIN RECEIVE ORGTBL tbl:greate-results
% END RECEIVE ORGTBL tbl:greate-results
\iffalse
#+ORGTBL: SEND tbl:greate-results orgtbl-to-latex-long :no-escape t
|+-+-|
|   date | session | remarks |
|+-+-|
| 2014-10-11 | s141011 | foo |
|+-+-|
\fi
  \end{center}
\end{footnotesize}

(defun orgtbl-to-latex-long (table params)
  Convert the orgtbl-mode TABLE to long TABLE in LaTeX.
  (let* ((alignment (mapconcat (lambda (x) (if x r l))
   org-table-last-alignment ))
 (params-common (list
 :lstart:lend   :sep   
 :efmt %s\\,(%s) :hline   \\hline))
 (params0 (list
   :tstart (concat \\begin{longtable}{  alignment  }\n
 \\caption{ (orgtbl-util-last-latex 
caption) } % 1ST HEADER)
   :tend (concat\\endfirsthead\n
\\caption{Continued} % 2ND 
HEADER)))
 (params2 (list
   :tstart (concat   \\endhead\n
 % )
   :tend (concat% \n
\\label{ (orgtbl-util-last-latex 
label) }\n
  \\end{longtable})))
 (table-head (list (car table))) ; store 1st row
 (table-body (cdr table))
 head0 head1 body
 *table-head-rtn*)

;; look for hline as head-body separator
(when (memq 'hline table-body)
  (setq *table-head-rtn* (reverse table-head)) ; to use `push' instead of 
`append'
  (while (not (eq 'hline (car table-body))) ; check for 2nd+ row
(push (car table-body) *table-head-rtn*)
(pop table-body))
  (push 'hline *table-head-rtn*)
  (pop table-body)
  (setq table-head (reverse *table-head-rtn*)))

;; create text
(setq head0 (orgtbl-to-generic table-head (org-combine-plists params-common 
params0 params)))
(setq head1 (orgtbl-to-generic table-head (org-combine-plists params-common 
params)))
(setq body  (orgtbl-to-generic table-body (org-combine-plists params-common 
params2 params)))
(concat head0 \n head1 \n body)))

(defun orgtbl-util-last-latex (command)
  Go backward until `begin{longtable}' or beginning of current
buffer and obtain first content in curly bracket of COMMAND.
  (save-excursion
(let* ((end (point))
   (start (or (search-backward begin{longtable} nil t) (point-min)))
   (string-to-search (buffer-substring start end)))
  (string-match (concat \\ command {\\([^}]*\\)}) string-to-search)
  (match-string 1 string-to-search



Re: [O] exporting tables + equations to latex

2014-10-11 Thread Giuseppe Lipari
Thanks Nicolas and Jorge for your answers.

In my version (8.3beta-326-g6eb982.dirty taken from git):
- the :raw t flag does not work (same output as before)
- the :no-escape t works well.

After your answer, I understood this part is being reworked, so I decided
to update the org-mode git repository and now my version is
8.3beta-439-gfcce67.dirty. With this version

- with no special option, it produces the correct output
- with :raw t, the latex text is not traslated at all (empty cells)
- with :no-escape t, it produces the correct output

So, now I am all set, thanks a lot!!


Giuseppe Lipari




2014-10-09 17:38 GMT+02:00 Jorge A. Alfaro-Murillo 
jorge.alfaro-muri...@yale.edu:

 Hi Giuseppe.
 Giuseppe Lipari writes:

  The big problem I have is that I do not know how to put equations in
 cells. [...] the underlines are translated as underlines, and not as
 subscript command.


 Try adding :no-escape t to the #+ORGTBL line

 Best,
 --
 Jorge.





-- 
Giuseppe Lipari
LIFL
Université de Lille 1
blogs: http://scacciamennule.blogspot.com  (Italian)
http://scacciamennule.blogspot.com
  http://okpanico,wordpress.com  (Italian)
  http://algoland.wordpress.com   (English)


Re: [O] ditaa source gets disappeared by exporting html

2014-10-11 Thread Eric S Fraga
On Saturday, 11 Oct 2014 at 12:13, ishi soichi wrote:
 emacs 24.3
 org-mode 8.2.6

 When I run org-html-export-to-html the following code,


 #+begin_src ditaa :file ditaa-seqboxes.png
 +--+   +-+   +-+   +-+
 |{io}  |   |{d}  |   |{s}  |   |cBLU |
 | Foo  +---+ Bar +---+ Baz +---+ Moo |
 |  |   | |   | |   | |
 +--+   +-+   +--+--+   +-+
 |
/-\  |  +--+
| |  |  | c1AB |
| Goo +--+---=--+ Shoo |
\-/ |  |
+--+
 #+end_src


 it successfully produces an image, which is visible in the exported
 html.
 But the original source of the org file becomes,

 #+RESULTS:
 [[file:ditaa-seqboxes.png]]

 In other words, the source is gone(?).

Very strange.  I have never heard of this happening to anybody with any
version of org!

In any case, your example works just fine when I export to HTML.  In
fact, the export commands should not change the original org file at
all.  The RESULTS line should only appear if you actually execute babel
on the src block.  You must be doing something more than what you are
indicating in your email.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-431-g8e1359



[O] beamer and changing font size for example environment

2014-10-11 Thread Manfred Lotz
Maybe a stupid question. 

How could I change font size (in my case to smaller) for an example
environment in org-mode? Needed in export to Beamer pdf.

-- 
Thanks, 
Manfred





Re: [O] [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

2014-10-11 Thread Marco Wahl
Hi Aaron,

Aaron Ecay aarone...@gmail.com writes:
 2014ko urriak 10an, Marco Wahl-ek idatzi zuen:
 diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
 index da7993c..5fd9fbc 100644
 --- a/lisp/org-agenda.el
 +++ b/lisp/org-agenda.el
 @@ -5112,8 +5112,10 @@ of what a project is and how to check if it stuck, 
 customize the variable
Get the (Emacs Calendar) diary entries for DATE.
(require 'diary-lib)
(let* ((diary-fancy-buffer *temporary-fancy-diary-buffer*)
 - (diary-display-hook '(fancy-diary-display))
 - (diary-display-function 'fancy-diary-display)
 + (diary-display-function (if (version emacs-version 25)
 + 'fancy-diary-display
 +   'diary-fancy-display))

 The rule of thumb is that Org should support the current major version
 of emacs and one previous.

Just to be sure: Are 23.1 and 25.0 major versions of emacs?

 These functions have been aliased for a
 while, with fancy-diary-display marked as deprecated.  The commit that
 removed them from emacs
 http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/118057 says this
 is at least since v 23.1, so it’s safe to just use the new name
 unconditionally.

Thanks for pointing that out.

 + (diary-display-hook '(diary-display-function))

 This puts the symbol ‘diary-display-function’ in the list, which may
 or may not be correct (it’s different than the old behavior, which
 effectively put the value of that variable).  Maybe you want ‘(list
 diary-display-function)’ instead?

I would have wanted the latter.  Thanks again for the clarification.
But actually it does not matter since diary-display-hook has been marked
obsolete some versions ago.  See the emacs ChangeLog entry

2014-10-06  Glenn Morris  r...@gnu.org
Remove calendar code obsolete since at least version 23.1.
...diary-display-hook...fancy-diary-display...

The patch has shrunk considerably and hopefully is worth for the push
now.


Best regards,  Marco
From 3bc2837ebad7d6a6ffdceb53d4f95c260c1ee342 Mon Sep 17 00:00:00 2001
From: Marco Wahl marcowahls...@gmail.com
Date: Sat, 11 Oct 2014 11:39:02 +0200
Subject: [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

* lisp/org-agenda.el (org-get-entries-from-diary): Use the suitable
  display function.  Drop the usage of the obsolete diary-display-hook.

fancy-diary-display has been dropped in Emacs 25.  diary-fancy-display
is the long known replacement of fancy-diary-display.

diary-display-hook has been marked obsolete before Emacs 23.2.
---
 lisp/org-agenda.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index da7993c..fd99bc9 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5112,8 +5112,7 @@ of what a project is and how to check if it stuck, customize the variable
   Get the (Emacs Calendar) diary entries for DATE.
   (require 'diary-lib)
   (let* ((diary-fancy-buffer *temporary-fancy-diary-buffer*)
-	 (diary-display-hook '(fancy-diary-display))
-	 (diary-display-function 'fancy-diary-display)
+	 (diary-display-function 'diary-fancy-display)
 	 (pop-up-frames nil)
 	 (diary-list-entries-hook
 	  (cons 'org-diary-default-entry diary-list-entries-hook))
-- 
2.1.2

-- 
http://www.wahlzone.de
GPG: 0x0A3AE6F2


[O] How to refer to parsed element in export-filter?

2014-10-11 Thread Thorsten Jolitz

Hi List,

in an exporter I would like to have a filter function (for headlines)
that acts conditional on the back-end and on the headline's properties
(say its :todo-keyword). But is it possible to find the internal
representation of the filtered headline in the communication channel?

#+BEGIN_SRC emacs-lisp
  (defun org-xyz-headline-filter (headline back-end info)
Filter transcoded output for headlines.
(when (and (eq back-end 'xyz)
   (member
(org-element-property
 :todo-keyword
 (FIND-CURR-HEADLINE
  (plist-get info :parse-tree)))
(org-xyz-keywords)))...))
#+END_SRC

I cannot figure out how to implement 'FIND-CURR-HEADLINE' in the stub
above. Do I have to do the filtering directly in the transcoder function
instead, or is there a way to make references to the element's
parse-tree in a filter function?

-- 
cheers,
Thorsten




Re: [O] org-mode for knowledge management

2014-10-11 Thread Daniel Clemente
El Fri, 10 Oct 2014 16:48:39 -0500 John Hendy va escriure:
 
 On Fri, Oct 10, 2014 at 10:46 AM, Daniel Clemente n142...@gmail.com wrote:
  
   I've been using org-mode for a variety of purposes for a few years. I 
   find
   that it suffers from the same problem that other such tools do. The
   problem is me. I can't remember week to week how I may have classified
   some scrap of information. Did I drop it into notes/someproduct.org or 
   was
   it procedures/someprocess.org?
 
  1. Every information should have a single location, not two. Mix sections 
  fast
  if you detect repetitions. Use links extensively (C-c l) to connect one 
  header
  with another, specially after you get lost once. Don't bother too much about
  finding the right place at the first time, you'll eventually reorder or move
  headers to the correct place.
 
 I'm curious about this. Is this a well-known recommendation/best
 practice? 

  I find it it similar to the „Don't repeat yourself“ principle. But I was just 
explaining my experience.

 I actually struggle with this a great deal. Often a bit of
 research or testing for a specific project at work is very possibly
 relevant to any number of future projects. So, working in product
 development, I find it hard to decide what the best single location
 is, and would love for it to act as though it were in multiple
 locations.
 
 When the current project is done, I'd like to archive everything
 specifically related to it while keeping around the general knowledge
 I've accumulated for use with future efforts.

  I use no tags or categories, just a clear and manual separation of concepts. 
E.g. it's not the same activity „I'm learning about database X“ and „I'm 
considering database X for project Y“, because notes from the first one go to 
Databases.org and notes from the second one to ProjectY.org. Clocking is 
different (even if I'm learning about X, I clock in Y if I'm doing it as part 
of a project).
  Therefore I try to keep project notes at a minimum, because they are dated 
and ephimeral, whereas the general knowledge accumulates in other files (one 
file per topic, encyclopedia-style).

 
 Or is this what you mean by using links? Are you just saying that
 individuals should not be copying the same text around in multiple
 places?
 

  Of course copy+paste is a nightmare to maintain (see: DRY). I am still forced 
to do it with some org tables which do complex calculations. I think org offers 
dynamic tables to apply the same process to different data sources, but it gets 
complex. I think there's no such thing as „templates“ where you change the base 
one and all uses of it (in all files) are automatically updated.

  About links: in org-mode they all look the same, but semantically there are 
many types, like:
- *is-a*: „this is a concrete implementation of [[that generic knowledge]]“
- *related*: „related to this is: [[that]]“
- *same-as*: „this and [[that]] are exactly the same topic, so write only under 
that header, not here“ ← this is poor man's transclusion, or more like 
„symbolic links“ in ext4. With it, a header seems to be present in many places 
at the same time; in reality the content is only in one place and the rest are 
links. The good thing is, it doesn't really matter /where/ exactly is that 
tree, because you'll find it anyway by following maximum 1 link. X can link to 
Y, or Y can link the X; what's important is that reading both X or Y you'll 
find exactly the same thing (not copy+pasted contents).

  So, it's all about finding a manual algorithm to organize things.


Daniel



Re: [O] [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

2014-10-11 Thread Bastien
Hi Marco,

Marco Wahl marcowahls...@gmail.com writes:

 The patch has shrunk considerably and hopefully is worth for the push
 now.

The patch looks good, please go ahead.  Thanks!

-- 
 Bastien



Re: [O] export to odt: error in style.xml

2014-10-11 Thread Bastien
Achim Gratz strom...@nexgo.de writes:

 The script that generates the ChangeLog for the Emacs merge will list
 all of these separately and Bastien or who else is doing the merge will
 have to manually put them back together.

Yes.

 ¹ It pains me every time I use my private email for public mailing
 list, but I doubt you had my privacy in mind?

 I was asking no such thing, only that the author name and email you use
 for your commits are always one and the same.

Yes: it's important to use the same name and address so that we can
group changelogs under the same person when adding them to Emacs.

Thanks,

-- 
 Bastien



Re: [O] Clocktable language customization not working as expected

2014-10-11 Thread Bastien
Hi Axel,

Axel Kielhorn org-m...@axelkielhorn.de writes:

 It still does not work for:

 #+LANGUAGE: fr

Does it work for

#+LANGUAGE: fr

?

 and i discovered some untranslated english words in the caption when
 generating a clock table for a week/month/quater,

Please report missing translations and someone will fix it.

Thanks!

-- 
 Bastien



Re: [O] converting from markdown to org mode?

2014-10-11 Thread Bastien
Hi Alan,

Alan Schmitt alan.schm...@polytechnique.org writes:

 I guess using pandoc could work … Is it the
 best way to convert from markdown?

I tried it once and it worked well, so I guess yes.

-- 
 Bastien



Re: [O] ob-clojure.el (org-babel for Clojure)

2014-10-11 Thread Bastien
Hi Daniel,

Daniel Szmulewicz daniel.szmulew...@gmail.com writes:

 Just to confirm that it's a API change that broke ob-clojure.el for cider. 
 Also, the cider maintainer suggests to remove the nrepl back-end, 
 as it has merged into cider.

Just to confirm that this has been done in the meantime in master.

-- 
 Bastien



Re: [O] clock-in and clock-out columns for clock-table

2014-10-11 Thread Bastien


Hi Paul,

Paul Rudin paul-sqpymovxoov10xsdtd+...@public.gmane.org writes:

 Is there a way to coerce a clock table to include the clock in and clock
 out information?

Can you give a literal example of the desired table output?

Thanks,

-- 
 Bastien




Re: [O] [patch] org-sbe doc

2014-10-11 Thread Bastien
Hi Rasmus,

Rasmus ras...@gmx.us writes:

 Cf. Charles Berry's post to a similarly named post there's a bug in
 the documentation of org-sbe.  This patch corrects it.

Thanks!

I see it has been applied -- since the mailing list is really our bug
tracker*, let's take a habit of confirming on the list when a patch
has been applied.

* Let's discuss whether we should have a real bug tracker another time.

-- 
 Bastien



Re: [O] orgmode in drupal

2014-10-11 Thread Bastien
Hi David,

David Arroyo Menendez davi...@gnu.org writes:

 Perhaps in this mailing list there are some drupal admin who wants
 upload his files to drupal. I've a project to make it :)
 https://www.drupal.org/node/1977240.

Maybe you can document this somewhere on Worg?

Thanks,

-- 
 Bastien



Re: [O] Adding new table rows/cols in a formula update

2014-10-11 Thread Bastien
Hi Dima,

Dima Kogan d...@secretsauce.net writes:

 OK. New patch attached.

Thanks for your work on this, the patch looks good but it cannot be
accepted as a tiny change.  Would you be willing to sign the FSF
copyright assignment papers?

If yes, please fill in the form from here:
http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Best,

-- 
 Bastien



Re: [O] org-mode

2014-10-11 Thread Bastien
Hi Hans,

Hans Kalldin hans.kall...@gmail.com writes:

 What I expect would be:

I understand why you would expect that, but 1st level headlines are
never folded, it would be too confusing.

HTH,

-- 
 Bastien



Re: [O] PATCH: org-mac-link.el: Don't fail on machines without Growl installed

2014-10-11 Thread Bastien
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Please go ahead (applying the patch, not bugging somebody!).

Alan, from now on, you can use this as a general rule :)

Thanks!

-- 
 Bastien



Re: [O] [Feature Request] HEADLINE special property

2014-10-11 Thread Bastien
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 I think ITEM is expected return the headline without all the meta
 data. If no one objects, I'll change it so in master.

Yes, thanks for this,

-- 
 Bastien



Re: [O] emacs stackexchange beta site

2014-10-11 Thread Bastien
The Emacs Stackexchange site is now official:
http://emacs.stackexchange.com

This is good, but let's continue to aggregate as much knowledge
directly on the list.

Thanks!

-- 
 Bastien



Re: [O] ditaa source gets disappeared by exporting html

2014-10-11 Thread ishi soichi
 thanks for your reply.

It might have been my mistake.  I have redone all org-mode configuration
written in init.el, then now it seems to be working as I wanted it to.
Though, I wasn't able to find the cause of what was happing.

Thanks anyway.


2014-10-11 17:40 GMT+09:00 Eric S Fraga e.fr...@ucl.ac.uk:

 On Saturday, 11 Oct 2014 at 12:13, ishi soichi wrote:
  emacs 24.3
  org-mode 8.2.6
 
  When I run org-html-export-to-html the following code,
 
 
  #+begin_src ditaa :file ditaa-seqboxes.png
  +--+   +-+   +-+   +-+
  |{io}  |   |{d}  |   |{s}  |   |cBLU |
  | Foo  +---+ Bar +---+ Baz +---+ Moo |
  |  |   | |   | |   | |
  +--+   +-+   +--+--+   +-+
  |
 /-\  |  +--+
 | |  |  | c1AB |
 | Goo +--+---=--+ Shoo |
 \-/ |  |
 +--+
  #+end_src
 
 
  it successfully produces an image, which is visible in the exported
  html.
  But the original source of the org file becomes,
 
  #+RESULTS:
  [[file:ditaa-seqboxes.png]]
 
  In other words, the source is gone(?).

 Very strange.  I have never heard of this happening to anybody with any
 version of org!

 In any case, your example works just fine when I export to HTML.  In
 fact, the export commands should not change the original org file at
 all.  The RESULTS line should only appear if you actually execute babel
 on the src block.  You must be doing something more than what you are
 indicating in your email.
 --
 : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org
 release_8.3beta-431-g8e1359



Re: [O] exporting tables + equations to latex

2014-10-11 Thread Nicolas Goaziou
Hello,

Giuseppe Lipari giulip...@gmail.com writes:

 After your answer, I understood this part is being reworked, so I decided
 to update the org-mode git repository and now my version is
 8.3beta-439-gfcce67.dirty. With this version

 - with no special option, it produces the correct output
 - with :raw t, the latex text is not traslated at all (empty cells)

This was a bug, which is now fixed. Thank you for noticing it.

 - with :no-escape t, it produces the correct output

:no-escape doesn't exist in the new implementation and is ignored. So it
boils down to providing no special option.


Regards,

-- 
Nicolas Goaziou



Re: [O] Adding new table rows/cols in a formula update

2014-10-11 Thread Nicolas Goaziou
Hello,

Bastien b...@gnu.org writes:

 Thanks for your work on this, the patch looks good but it cannot be
 accepted as a tiny change.  Would you be willing to sign the FSF
 copyright assignment papers?

Actually, it's not a tiny change. He signed copyright assignment
already. See http://permalink.gmane.org/gmane.emacs.orgmode/91352


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATH] Speedups to org-table-recalculate

2014-10-11 Thread Michael Brand
Hi Nathaniel

On Fri, Oct 10, 2014 at 9:43 PM, Nathaniel Flath flat0...@gmail.com wrote:
 Mine is a pretty simple table (takes less than a second even in the original
 case):

Earlier I assumed that the issue is a very high number of messages
from the loops. Now your example table clarifies to me that the issue
is that already just one single message can take a significant time of
a message-less table recalculation (your 17 ms).

Only with this I understand now why you want to remove also the
beginning/end processing messages. Good point as it should be
noticeable at least for org-table-iterate-buffer-tables in a buffer
with many tables where each one takes a short time to recalculate.

I really wonder what the reason is that this

(progn
  (message %d (random))  ;; Prevent collapsing of message lines.
  (time (message nil)))

in a terminal (emacs -nw) shows most of the times only 0.05 to 0.10 ms
but in a window it shows most of the times 8 to 22 ms (here: GNU Emacs
24.3.1 on Mac OS X 10.9). Which Emacs version and OS are you using?

For your patch I suggest to remove only the first message and to add
the time check to all other messages. This should not make the patch
noticeably slower but would keep showing the progress for table
recalculations that last more than one second. To clean up the last
loop message from the mode line I suggest to check the end messages
against the very first log time in contrast to the next log time used
for the loop messages (variables log_first and log_next instead of
just log).

I suggest you split your patch: One for (when eqlist and one for the
messages. The change with the messages will then become human readable
also with a simple line diff.

 Original recalculation:  (0 0 396224 0)

 Version w/ time checks for per-field messages (still always printing at
 beginning/end of processing):(0 0 56929 0)

 Version w/ time checks and removing all beginning/end of processing
 messages: (0 0 22077 0)

 My patch:  (0 0 17405 0)

I could not reproduce a reliable difference between the last two. As
expected both did not log any message. Can you?

Michael



Re: [O] [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

2014-10-11 Thread Marco Wahl
Bastien b...@gnu.org writes:

 The patch has shrunk considerably and hopefully is worth for the push
 now.

 The patch looks good, please go ahead.  Thanks!

Patch pushed!


Thanks and regards,  Marco
-- 
http://www.wahlzone.de
GPG: 0x0A3AE6F2




Re: [O] Adding new table rows/cols in a formula update

2014-10-11 Thread Dima Kogan
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Thanks for your work on this, the patch looks good but it cannot be
 accepted as a tiny change.  Would you be willing to sign the FSF
 copyright assignment papers?

 Actually, it's not a tiny change. He signed copyright assignment
 already. See http://permalink.gmane.org/gmane.emacs.orgmode/91352

Here's the same patch without the TINYCHANGE marker, if that's helpful.

From 6a361837f1f7b71a02ab5b918509def84c9fa43e Mon Sep 17 00:00:00 2001
From: Dima Kogan d...@secretsauce.net
Date: Tue, 30 Sep 2014 22:36:21 -0700
Subject: [PATCH] org-table: Field formulas can now create columns as needed

* org-table.el (org-table-formula-create-columns): New variable.
(org-table-recalculate): Use the new org-table-formula-make-new-cols
customization to control whether org creates new columns when
a formula explicitly targets them.
---
 etc/ORG-NEWS   |  6 +
 lisp/org-table.el  | 35 +++---
 testing/lisp/test-org-table.el | 56 ++
 3 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 1af54ad..0a5af68 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -90,6 +90,12 @@ docstrings (including ~orgtbl-to-generic~) for details.
 *** Non-floating minted listings in Latex export
 It is not possible to specify =#+attr_latex: :float nil= in conjunction with
 source blocks exported by the minted package.
+*** Field formulas can now create columns as needed
+Previously, evaluating formulas that referenced out-of-bounds columns
+would throw an error. A new variable
+~org-table-formula-create-columns~ was added to adjust this
+behavior. It is now possible to silently add new columns, to do so
+with a warning or to explicitly ask the user each time.
 ** Miscellaneous
 *** File names in links accept are now compatible with URI syntax
 Absolute file names can now start with =///= in addition to =/=. E.g.,
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 7607ead..14c68d6 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -354,6 +354,18 @@ portability of tables.
 	  (const :tag Stick to hline nil)
 	  (const :tag Error on attempt to cross error)))
 
+(defcustom org-table-formula-create-columns nil
+  Non-nil means that evaluation of a field formula can add new
+columns if an out-of-bounds field is being set.
+  :group 'org-table-calculation
+  :version 24.5
+  :package-version '(Org . 8.3)
+  :type '(choice
+	  (const :tag Setting an out-of-bounds field generates an error (default) nil)
+	  (const :tag Setting an out-of-bounds field silently adds columns as needed t)
+	  (const :tag Setting an out-of-bounds field adds columns as needed, but issues a warning message warn)
+	  (const :tag When setting an out-of-bounds field, the user is prompted prompt)))
+
 (defgroup org-table-import-export nil
   Options concerning table import and export in Org-mode.
   :tag Org Table Import Export
@@ -3125,9 +3137,26 @@ known that the table will be realigned a little later anyway.
   (while (setq eq (pop eqlname1))
 	(message Re-applying formula to field: %s (car eq))
 	(org-goto-line (nth 1 eq))
-	(org-table-goto-column (nth 2 eq))
-	(org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst
-'nostore 'noanalysis))
+	(let ((column-target (nth 2 eq)))
+	  (when ( column-target 1000)
+	(user-error Formula column target too large))
+	  (let* ((column-count (progn (end-of-line)
+  (1- (org-table-current-column
+		 (create-new-column
+		  (and ( column-target column-count)
+		   (or (eq org-table-formula-create-columns t)
+			   (and
+			(eq org-table-formula-create-columns 'warn)
+			(progn
+			  (org-display-warning Out-of-bounds formula added columns)
+			  t))
+			   (and
+			(eq org-table-formula-create-columns 'prompt)
+			(yes-or-no-p Out-of-bounds formula. Add columns?))
+	(org-table-goto-column column-target nil create-new-column))
+
+	  (org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst
+  'nostore 'noanalysis)))
 
   (org-goto-line thisline)
   (org-table-goto-column thiscol)
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
index e083683..d99db27 100644
--- a/testing/lisp/test-org-table.el
+++ b/testing/lisp/test-org-table.el
@@ -1550,6 +1550,62 @@ See also `test-org-table/copy-field'.
 	 (progn (search-forward # END RECEIVE ORGTBL table)
 		(match-beginning 0)))
 
+(ert-deftest test-org-table/field-formula-outside-table ()
+  If `org-table-formula-create-columns' is nil, then a formula
+that references an out-of-bounds column should do nothing. If it
+is t, then new columns should be added as needed
+
+  (let ((org-table-formula-create-columns nil))
+
+;; need condition-case to trap the out-of-bounds user-error
+(condition-case
+	nil
+	(org-test-table-target-expect
+	 
+| 2 |
+| 4 |
+| 8 |
+
+	 
+| 2 |
+| 4 |
+| 8 |
+
+	 1
+	 #+TBLFM: 

Re: [O] [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

2014-10-11 Thread Achim Gratz
Marco Wahl writes:
 Bastien b...@gnu.org writes:

 The patch has shrunk considerably and hopefully is worth for the push
 now.

 The patch looks good, please go ahead.  Thanks!

 Patch pushed!

It looks like that patch should have gone to maint rather than master
and please use a properly formatted commit message in the future:

- The first line of the commit has been taken from the subject of your
  post rather than being in the form that Org uses.
- The commit description itself will be shortened to unintelligible
  gibberish in the Emacs Changelog since the text before the first blank
  line doesn't actually tell what the change has been about.


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada




Re: [O] [PATCH] key-binding for all plotting styles

2014-10-11 Thread Thierry Banel
Here is a patch which bindskeys:

  C-c  a   orgtbl-ascii-plot(creates an ascii plot for the column where
the cursor is)
  C-c  g   org-plot/gnuplot  (nicely launches Gnuplot for all columns)

It also adds a sub-menu named Plot in the Tbl menu with those two
entries.

Have fun
Thierry


Le 07/10/2014 16:15, Nicolas Goaziou a écrit :
 Hello,

 Thierry Banel tbanelweb...@free.fr writes:

 C-c (currently unused)
 C-c |(currently does weird things within a table)
 I'm fine with any of these, even though they may be shadowed by minor
 modes.


 Regards,


From 41b262ca69636938bc894bc4b24d8de968e67c68 Mon Sep 17 00:00:00 2001
From: Thierry Banel tbanelweb...@free.fr
Date: Sat, 11 Oct 2014 15:59:17 +0200
Subject: [PATCH] Ascii and Gnuplot key-bindings

* org.el (org-mode-map): change key-binding
from C-c p to C-c  a
add C-c  g key-binding for Gnuplot
(org-tbl-menu): add sub-menu for plotting
featuring Gnuplot and ascii plot
* org-table.el (orgtbl-setup): add sub-menu
for plotting featuring Gnuplot and ascii plot
---
 lisp/org-table.el | 10 ++
 lisp/org.el   | 14 ++
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 7607ead..0f2fda3 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4276,8 +4276,7 @@ to execute outside of tables.
 	 [Move Column Left org-metaleft :active (org-at-table-p) :keys M-left]
 	 [Move Column Right org-metaright :active (org-at-table-p) :keys M-right]
 	 [Delete Column org-shiftmetaleft :active (org-at-table-p) :keys M-S-left]
-	 [Insert Column org-shiftmetaright :active (org-at-table-p) :keys M-S-right]
-	 [Ascii plot orgtbl-ascii-plot :active (org-at-table-p) :keys C-c p])
+	 [Insert Column org-shiftmetaright :active (org-at-table-p) :keys M-S-right])
 	(Row
 	 [Move Row Up org-metaup :active (org-at-table-p) :keys M-up]
 	 [Move Row Down org-metadown :active (org-at-table-p) :keys M-down]
@@ -4315,7 +4314,10 @@ to execute outside of tables.
 	 org-table-toggle-coordinate-overlays :active (org-at-table-p)
 	 :keys C-c }
 	 :style toggle :selected org-table-overlay-coordinates]
-	))
+	--
+	(Plot
+	 [Ascii plot orgtbl-ascii-plot :active (org-at-table-p) :keys C-c \ a]
+	 [Gnuplot org-plot/gnuplot :active (org-at-table-p) :keys C-c \ g])))
 t))
 
 (defun orgtbl-ctrl-c-ctrl-c (arg)
@@ -5052,7 +5054,7 @@ supported.  It is also possible to use the following ones:
 
 ;; Put the cursor in a column containing numerical values
 ;; of an Org-Mode table,
-;; type C-c p
+;; type C-c  a
 ;; A new column is added with a bar plot.
 ;; When the table is refreshed (C-u C-c *),
 ;; the plot is updated to reflect the new values.
diff --git a/lisp/org.el b/lisp/org.el
index a6d8d1b..724fa62 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -163,6 +163,8 @@ Stars are put in group 1 and the trimmed body in group 2.)
 (declare-function org-table-paste-rectangle org-table ())
 (declare-function org-table-maybe-eval-formula org-table ())
 (declare-function org-table-maybe-recalculate-line org-table ())
+(declare-function orgtbl-ascii-plot org-table (optional ask))
+(declare-function org-plot/gnuplot org-plot (optional params))
 
 (declare-function org-element-at-point org-element ())
 (declare-function org-element-cache-reset org-element (optional all))
@@ -19478,7 +19480,8 @@ boundaries.
 (org-defkey org-mode-map \C-c='org-table-eval-formula)
 (org-defkey org-mode-map \C-c''org-edit-special)
 (org-defkey org-mode-map \C-c`'org-table-edit-field)
-(org-defkey org-mode-map \C-cp'orgtbl-ascii-plot)
+(org-defkey org-mode-map \C-c\a  'orgtbl-ascii-plot)
+(org-defkey org-mode-map \C-c\g  'org-plot/gnuplot)
 (org-defkey org-mode-map \C-c|'org-table-create-or-convert-from-region)
 (org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
 (org-defkey org-mode-map \C-c~'org-table-create-with-table.el)
@@ -21161,8 +21164,7 @@ on context.  See the individual commands for more information.
  [Move Column Left org-metaleft (org-at-table-p)]
  [Move Column Right org-metaright (org-at-table-p)]
  [Delete Column org-shiftmetaleft (org-at-table-p)]
- [Insert Column org-shiftmetaright (org-at-table-p)]
- [Ascii plot orgtbl-ascii-plot (org-at-table-p)])
+ [Insert Column org-shiftmetaright (org-at-table-p)])
 (Row
  [Move Row Up org-metaup (org-at-table-p)]
  [Move Row Down org-metadown (org-at-table-p)]
@@ -21205,7 +21207,11 @@ on context.  See the individual commands for more information.
 [Import from File org-table-import (not (org-at-table-p))]
 [Export to File org-table-export (org-at-table-p)]
 --
-[Create/Convert from/to table.el org-table-create-with-table.el t]))
+[Create/Convert from/to table.el org-table-create-with-table.el t]
+--
+(Plot
+ [Ascii plot orgtbl-ascii-plot :active (org-at-table-p) :keys C-c \ a]
+ [Gnuplot org-plot/gnuplot :active (org-at-table-p) :keys C-c \ g])))
 
 (easy-menu-define org-org-menu 

Re: [O] Clocktable language customization not working as expected

2014-10-11 Thread Axel Kielhorn

Am 11.10.2014 um 14:51 schrieb Bastien b...@gnu.org:

 Hi Axel,
 
 Axel Kielhorn org-m...@axelkielhorn.de writes:
 
 It still does not work for:
 
 #+LANGUAGE: fr
 
 Does it work for
 
 #+LANGUAGE: fr

No. That was my first try. It has no effect.

 and i discovered some untranslated english words in the caption when
 generating a clock table for a week/month/quater,
 
 Please report missing translations and someone will fix it.
 
 Thanks!

Here is what I'm using now in custom.el:

 '(org-clock-clocktable-language-setup
   (quote
((en File L Timestamp Headline Time ALL Total time File 
time Clock summary at)
 (es Archivo N Fecha y hora Tarea Tiempo TODO Tiempo total 
Tiempo archivo Clock summary at)
 (fr Fichier N Horodatage En-tête Durée TOUT Durée totale 
Durée fichier Horodatage sommaire à)
 (nl Bestand N Tijdstip Hoofding Duur ALLES Totale duur 
Bestandstijd Clock summary at)
 (de Datei L Timestamp Tätigkeit Zeit  Gesamtzeit Datei 
Zeit Erstellt am

I haven't encountered Timestamp so far and didn't translate it.
Getting these translations into org would be nice, but may require some 
discussion among the german users first.

There are some untranslated strings in
(defun org-clock-special-range (key optional time as-strings wstart mstart)
…
(cond
 ((memq key '(day today))
  (setq txt (format-time-string %A, %B %d, %Y ts)))
 ((memq key '(week thisweek))
  (setq txt (format-time-string week %G-W%V ts)))
 ((memq key '(month thismonth))
  (setq txt (format-time-string %B %Y ts)))
 ((memq key '(year thisyear))
  (setq txt (format-time-string the year %Y ts)))
 ((memq key '(quarter thisq))
  (setq txt (concat (org-count-quarter shiftedq)  quarter of  
(number-to-string shiftedy)
(if as-strings
(list (format-time-string fm ts) (format-time-string fm te) txt)
  (list ts te txt

and

(defun org-clocktable-write-default (ipos tables params)
…
 ;; Insert the text *before* the actual table
(insert-before-markers
 (or header
 ;; Format the standard header
 (concat
  #+CAPTION: 
  (nth 9 lwords)  [
  (substring
   (format-time-string (cdr org-time-stamp-formats))
   1 -1)
  ]
  (if block (concat , for  range-text .) )
  \n)))


Right now I'm doing weekly reports and adjust the caption.

Axel


Re: [O] org-mode for knowledge management

2014-10-11 Thread Brady Trainor
Daniel Clemente n142...@gmail.com writes:

   About links: in org-mode they all look the same, but semantically there are 
 many types, like:
 - *is-a*: „this is a concrete implementation of [[that generic knowledge]]“
 - *related*: „related to this is: [[that]]“
 - *same-as*: „this and [[that]] are exactly the same topic, so write
 only under that header, not here“ ← this is poor man's transclusion,
 or more like „symbolic links“ in ext4. With it, a header seems to be
 present in many places at the same time; in reality the content is
 only in one place and the rest are links. The good thing is, it
 doesn't really matter /where/ exactly is that tree, because you'll
 find it anyway by following maximum 1 link. X can link to Y, or Y can
 link the X; what's important is that reading both X or Y you'll find
 exactly the same thing (not copy+pasted contents).

 Daniel

I don't think I am aware of the *sameas* type of link in org-mode, can
you give an example please? 

--
Brady




Re: [O] [PATCH] Fix: Emacs 25 fancy diary inclusion in agenda

2014-10-11 Thread Aaron Ecay
2014ko urriak 11an, Achim Gratz-ek idatzi zuen:
 It looks like that patch should have gone to maint rather than master
 and please use a properly formatted commit message in the future:

For reference, this link describes what Achim means about commit messages:
http://orgmode.org/worg/org-contribute.html#unnumbered-10.

-- 
Aaron Ecay



Re: [O] org-mode for knowledge management

2014-10-11 Thread Daniel Clemente
El Sat, 11 Oct 2014 12:45:45 -0700 Brady Trainor va escriure:
 
About links: in org-mode they all look the same, but semantically there 
  are many types, like:
  […]
  - *same-as*: „this and [[that]] are exactly the same topic, so write
  only under that header, not here“ 
  […]
 I don't think I am aware of the *sameas* type of link in org-mode, can
 you give an example please? 
 

There's only 1 type of link between headers in org-mode; what's different is 
the way in which you use it.

* About web pages
** CSS
** HTML
*** Convert to other formats
 convert to JSON
Use html2json
 convert to PDF → see [[html_to_pdf]]
* About PDFs
** create them
*** from .odt
Click that icon.
*** from .html. id:html_to_pdf
There's this method…
*** from .tex


In this case, that „HTML→PDF“ section could live under the „web pages“ tree or 
under the „PDFs“ tree, and there's no difference because it's exactly the same 
information.
If you consider „link following“ as a trivial operation, you could say that 
that knowledge is accessible under both trees at the same time. It's not 
transclusion, but it works the same.

Note that in the example above, the „→ see …“ header must be empty of content. 
If you write inside, it's not a light link anymore, it's a header on its own.

Org-mode could offer this type of header built-in (a light header is a header 
which must link to another one and have no content), but you can do it with the 
current tools and a bit of care.




Re: [O] org-mode for knowledge management

2014-10-11 Thread John Hendy
On Fri, Oct 10, 2014 at 9:53 PM, Eric Abrahamsen
e...@ericabrahamsen.net wrote:
 John Hendy jw.he...@gmail.com writes:

 On Fri, Oct 10, 2014 at 10:46 AM, Daniel Clemente n142...@gmail.com wrote:
 
  I've been using org-mode for a variety of purposes for a few years. I 
  find
  that it suffers from the same problem that other such tools do. The
  problem is me. I can't remember week to week how I may have classified
  some scrap of information. Did I drop it into notes/someproduct.org or 
  was
  it procedures/someprocess.org?

 1. Every information should have a single location, not two. Mix sections 
 fast
 if you detect repetitions. Use links extensively (C-c l) to connect one 
 header
 with another, specially after you get lost once. Don't bother too much about
 finding the right place at the first time, you'll eventually reorder or move
 headers to the correct place.

 I'm curious about this. Is this a well-known recommendation/best
 practice? I actually struggle with this a great deal. Often a bit of
 research or testing for a specific project at work is very possibly
 relevant to any number of future projects. So, working in product
 development, I find it hard to decide what the best single location
 is, and would love for it to act as though it were in multiple
 locations.

 Isn't this what tags are good for, though? Sort of providing a secondary
 structure to your information, orthogonal to Org's subtree structure?

Agreed, and have tried that, though that has issues as well, unless
I'm missing something (see below).


 When the current project is done, I'd like to archive everything
 specifically related to it while keeping around the general knowledge
 I've accumulated for use with future efforts.

 You could organize a project by subtree, but put generally-useful
 research elsewhere, and tag that research by theme. Then give the
 project subtree its own tag, but also add tags to the relevant research
 themes. Open an Agenda with a projecttag|themetag tag search to see
 both general research and project-specific stuff.

 When the time comes, the project subtree gets archived, but the thematic
 stuff stays.

This is the bit I'm not sure about...

* project_a
** experiment about blah :proj_name:theme:
[2014-10-11]

Did x, y, and z today. Will analyze results tomorrow.

[2014-10-12]

Wow. Interesting finding. This will help a lot and may be relevant to
future projects!

So... when I archive project_a, don't I lose the thematic information
from my experiment? This is sort of the conundrum I often find myself
in. I work in product development, and many of the difficulties,
experimental findings, or even contacts/information for a given
project seem like they'd be really helpful to recall/go back to for
future projects. The learning is uncovered only because I'm working on
launching *this* product... but isn't inherently relevant *only* to
this project.

I've migrated from one file per project like I used to do to the big
'ol one-file method (except for a contacts.org file and miscellany).
Thus, I tend to like to archive, but for whatever reason have an
aversion to agenda-ing on archived stuff. I find I only look in
archives when someone asks something really specific about a past
project and I think I have notes on it.

Anyway, that was my thought.

I saw Daniel replied as well; you both understand my struggle -- you
tackle it with tags and he's suggesting lots of links (more on that in
a sec).


Thanks!
John


 Anyway, I'm sure you've considered all this, just curious what your
 thoughts on tags are...

 Or is this what you mean by using links? Are you just saying that
 individuals should not be copying the same text around in multiple
 places?


 Thanks,
 John

 [snip]





[O] Documentation of org-clone-subtree-with-timeshift does not match actual behaviour

2014-10-11 Thread Julian Kniephoff
Hello everyone,

I hope this is the right place to post things like this, and that I included 
enough information. If not, could somebody please tell me where I should go 
with this and what information you need?

A while ago I experimented with calling org-clone-subtree-with-timeshift from 
an elisp program. I just wanted to clone a subtree without ever touching any 
timestamps in it. I looked at the documentation and learnt that passing either 
nil or “” (the empty string) for the second parameter should do exactly that.
I tried passing nil first, since I found that semantically more correct than 
passing “” for “no time shift”, only to notice that this does not do what I 
want. If the entry to be cloned contains a timestamp, I still get prompted for 
a repeater, which is then used to change the timestamp in the clones. This does 
not happen if I pass the empty string, even if the subtree contains timestamps.

I don’t know what the intended behaviour of this function is, but in any case, 
it does not match its documentation.

I attached a minimal org file to test the behaviour of the function:
Entry A contains no timestamp, while entry B does.
In my opinion both calls

;; call 1
(org-clone-subtree-with-timeshift 1 nil)

and

;; call 2
(org-clone-subtree-with-timeshift 1 “”)

should do the same with both entries, namely create one copy of them, without 
changing the timestamp if applicable and without prompting for a shift.
Call 2 does exactly this for both examples. However, call 1 only does it for 
entry A. For entry B, it prompts for a repeater to use as a time shift and when 
entering anything but the empty string, it also uses it to shift the timestamp 
in entry B.

Here is the relevant information from org-submit-bug-report:
Emacs  : GNU Emacs 24.3.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2014-09-29 on Julians-MacBook-Pro.local
Package: Org-mode version 8.2.8 (8.2.8-elpaplus @ 
/Users/jules/.emacs.d/.cask/24.3.1/elpa/org-plus-contrib-20141006/)

Best wishes,
Julian



cloning.org
Description: Binary data


Re: [O] org-mode for knowledge management

2014-10-11 Thread John Hendy
On Sat, Oct 11, 2014 at 6:36 AM, Daniel Clemente n142...@gmail.com wrote:
 El Fri, 10 Oct 2014 16:48:39 -0500 John Hendy va escriure:

 On Fri, Oct 10, 2014 at 10:46 AM, Daniel Clemente n142...@gmail.com wrote:
  
   I've been using org-mode for a variety of purposes for a few years. I 
   find
   that it suffers from the same problem that other such tools do. The
   problem is me. I can't remember week to week how I may have classified
   some scrap of information. Did I drop it into notes/someproduct.org or 
   was
   it procedures/someprocess.org?
 
  1. Every information should have a single location, not two. Mix sections 
  fast
  if you detect repetitions. Use links extensively (C-c l) to connect one 
  header
  with another, specially after you get lost once. Don't bother too much 
  about
  finding the right place at the first time, you'll eventually reorder or 
  move
  headers to the correct place.

 I'm curious about this. Is this a well-known recommendation/best
 practice?

   I find it it similar to the „Don't repeat yourself“ principle. But I was 
 just explaining my experience.

Sure, and that makes sense. I just wanted to understand what you meant
by everything has one correct place. We're on the same page now: not
copying text, but that doesn't mean something shouldn't be
referenced/linked to.


 I actually struggle with this a great deal. Often a bit of
 research or testing for a specific project at work is very possibly
 relevant to any number of future projects. So, working in product
 development, I find it hard to decide what the best single location
 is, and would love for it to act as though it were in multiple
 locations.

 When the current project is done, I'd like to archive everything
 specifically related to it while keeping around the general knowledge
 I've accumulated for use with future efforts.

   I use no tags or categories, just a clear and manual separation of 
 concepts. E.g. it's not the same activity „I'm learning about database X“ and 
 „I'm considering database X for project Y“, because notes from the first one 
 go to Databases.org and notes from the second one to ProjectY.org. Clocking 
 is different (even if I'm learning about X, I clock in Y if I'm doing it as 
 part of a project).
   Therefore I try to keep project notes at a minimum, because they are dated 
 and ephimeral, whereas the general knowledge accumulates in other files (one 
 file per topic, encyclopedia-style).


 Or is this what you mean by using links? Are you just saying that
 individuals should not be copying the same text around in multiple
 places?


   Of course copy+paste is a nightmare to maintain (see: DRY). I am still 
 forced to do it with some org tables which do complex calculations. I think 
 org offers dynamic tables to apply the same process to different data 
 sources, but it gets complex. I think there's no such thing as „templates“ 
 where you change the base one and all uses of it (in all files) are 
 automatically updated.

   About links: in org-mode they all look the same, but semantically there are 
 many types, like:
 - *is-a*: „this is a concrete implementation of [[that generic knowledge]]“
 - *related*: „related to this is: [[that]]“
 - *same-as*: „this and [[that]] are exactly the same topic, so write only 
 under that header, not here“ ← this is poor man's transclusion, or more like 
 „symbolic links“ in ext4. With it, a header seems to be present in many 
 places at the same time; in reality the content is only in one place and the 
 rest are links. The good thing is, it doesn't really matter /where/ exactly 
 is that tree, because you'll find it anyway by following maximum 1 link. X 
 can link to Y, or Y can link the X; what's important is that reading both X 
 or Y you'll find exactly the same thing (not copy+pasted contents).

   So, it's all about finding a manual algorithm to organize things

This is generally what I've tried to do, though I find this is
cumbersome as I often use subtrees for more report-style/narrative
analyses of data and experiments. Thus I don't find it as simple as
your example to Brady with the PDF/HTML info, which is more basic. As
I write this, I'm thinking I could probably still do this...

For an example, let's say I'm making plastic widgets and we've been
running a series of injection mold trials with a manufacturer. Some
really novel understanding comes about with respect to part
uniformity, extruder/die temperature, cooling time, holding pressure,
etc. I think this is awesome general knowledge. But I'm documenting
our learning in an experimental report for export and upload to my
company's internal technical report repo.

My initial thought was that links this way would get in the way... but
I suppose now I could be writing along and create a link to the
nearest headline in the report, then go to some other tree and insert
a link to that headline with some note about the gist of the
understanding or keywords for the future me