Re: [O] open file link in dired?

2014-12-10 Thread Marcin Borkowski
Hi,

please note that I did not read the original message, but does this help?

http://mbork.pl/2013-10-06_Links_to_directories_in_Org-mode_files

Best,
mb


On 2014-12-10, at 08:48, Alan Schmitt wrote:

> (I replied to Steve directly but forgot to copy the list. Here it is.)
>
> On 2014-12-09 19:05, Steven Arntson  writes:
>
>> I've been searching many moons for this exact functionality! I'm very
>> glad to run across this, but as a fairly new emacser, I'm not sure what
>> to do with this code. I copied it into my init.el, marked it and ran
>> 'eval-region', but what do I call to use the functions? If I can get this
>> working, I will be using it every day.
>
> - open a directory in dired mode
> - put the cursor on the file you want to link to
> - call `org-store-link' (which may be bound to `C-c l')
>
> The link is now stored. You can insert in an org file it with
> `org-insert-link' (often bound to `C-c C-l').
>
> Alternatively, you can use an org-capture template that captures a link
> to the current context, and use it in dired mode.
>
> Best,
>
> Alan


-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] open file link in dired?

2014-12-10 Thread Alan Schmitt
On 2014-12-10 10:51, Marcin Borkowski  writes:

> Hi,
>
> please note that I did not read the original message, but does this help?
>
> http://mbork.pl/2013-10-06_Links_to_directories_in_Org-mode_files

I think it's different: the goal here is too reveal the file in its
enclosing directory.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


[O] Is it possible for the clock table to display only clocked activities between two timestamps?

2014-12-10 Thread Marcin Borkowski
More precisely, I'd like to have a clock report, say, from today 6:00
until now?  I tried with :tstart/:tend, but didn't succeed.

(This is what I naively tried:

#+BEGIN: clocktable :maxlevel 2 :scope subtree :tstart <2014-12-10 wed 06:00> 
:tend <2014-12-10 wed 23:59>

)

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Nicolas Goaziou
Rasmus  writes:

> Nicolas Goaziou  writes:

>> I think required definitions should be extracted from the included file
>> and inserted at the end of the source file, without any footnote
>> section. 
>
> The "hard" solution.  I will look into it.

It may not be that hard, but it will require tests.

You also need to check that the footnote definition doesn't appear
within included area, in which case it needs not be moved.

>> However, it would be nice to store associations between files
>> and footnote labels in, e.g., a hash table, in order to avoid inserting
>> multiple times the same footnote.
>
> What is your reasoning for this statement?  Aesthetics, performance or
> something else?

Mainly performance, and to prevent some bugs that might be introduced
with duplicate footnote definitions.

The can is open, the worms wiggling. Have fun.

Regards,



Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Rasmus
Nicolas Goaziou  writes:

> Rasmus  writes:
>
>> Nicolas Goaziou  writes:
>
>>> I think required definitions should be extracted from the included file
>>> and inserted at the end of the source file, without any footnote
>>> section. 
>>
>> The "hard" solution.  I will look into it.
>
> It may not be that hard, but it will require tests.
>
> You also need to check that the footnote definition doesn't appear
> within included area, in which case it needs not be moved.

I have the collection of footnotes in the (beg end) area sorted out in the
patch I wrote last night.  Storing the triplet
  (document-path label footnote-text)
should be enough to pin down one of them footnotes.

I'm curious about the hash table.  (info "(elisp) Hash Tables") says "For
smaller tables (a few tens of elements) alists may still be faster [than
hash tables]".

For an Org document, might it not make more sense to use an alist for
this?  Or will the speed be regained when doing many includes from the
same document (since I'd check if a footnote is already in the table)?

Also, since INCLUDE is expanded before info, should I just create a new
defvar holding the table during export?  I guess that's the only way to
hold it in memory across several INCLUDE words.

> The can is open, the worms wiggling. Have fun.

My favorite kind.

—Rasmus

-- 
Evidence suggests Snowden used a powerful tool called monospaced fonts



Re: [O] Is it possible for the clock table to display only clocked activities between two timestamps?

2014-12-10 Thread Sebastien Vauban
Marcin Borkowski wrote:
> More precisely, I'd like to have a clock report, say, from today 6:00
> until now?  I tried with :tstart/:tend, but didn't succeed.
>
> This is what I naively tried:
> #+BEGIN: clocktable :maxlevel 2 :scope subtree :tstart <2014-12-10 wed 06:00> 
> :tend <2014-12-10 wed 23:59>

:tstart "2014-12-10" :tend "2014-12-11" will work.

Not tested with hours, though...

Best regards,
  Seb

-- 
Sebastien Vauban




[O] "org-plus-contrib" yes, "org" no!

2014-12-10 Thread Sharon Kimble
I have this as part of my "init.org" -

--8<---cut here---start->8---
(unless package-archive-contents;; Refresh the packages descriptions
  (package-refresh-contents))
(setq package-load-list '(all)) ;; List of packages to load
(unless (package-installed-p 'org-plus-contrib)  ;; Make sure the Org package is
  (package-install 'org-plus-contrib))   ;; installed, install it if not
(package-initialize t);; Initialize & Install Package
(setq package-enable-at-startup nil)
--8<---cut here---end--->8---

And yet almost every time that I update my packages it installs
"org", which I've already got with "org-plus-contrib". So I then
delete the fresh "org". How can I stop it installing "org" and just
be content with "org-plus-contrib" please? After all,
"org-plus-contrib" already includes "org" doesn't it?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0


signature.asc
Description: PGP signature


[O] [org-babel R] Difference between output in RStudio and in Org Babel

2014-12-10 Thread Sebastien Vauban
Hello,

I have yet another [1] code chunk that produces very different results
whether it's executed in RStudio or in an Org document.

Here is the code:

#+begin_src R :results value replace :rownames yes :colnames yes
  df.str <- '"liste","nb"
  "item31\nitem80","2"
  "item52","1"'
  df <- read.csv(text=df.str, header = TRUE)
  row.names(df) <- c("abc", "def")
  df
#+end_src

See http://screencast.com/t/qlUVYCoLUZWA for a diff between Org Babel
and RStudio.

Of course, the problem comes from \n being interpreted as a newline, but
who's right here?

Best regards,
  Seb

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-10/msg00707.html

-- 
Sebastien Vauban




[O] Entering Repeating Scheduled Tasks in the Minibuffer

2014-12-10 Thread Kenneth Jacker
Good day!

Is there a way that I can specify a scheduled task's repeat period
within a single "time specification" in the minibuffer?  I thought
something like this would work:

Dec 25 +1y

but it neither inserts the "repeater" nor gives any error message.

I've tried various things and checked the manual, but can't seem to find
the right combination of keystrokes.


Thanks for your comments!


PS  What is the meaning of "(=>F)" that appears at the end of the minibuffer?

-- 
Prof Kenneth H Jacker (ret)   k...@cs.appstate.edu
Computer Science Dept www.cs.appstate.edu/~khj
Appalachian State Univ
Boone, NC  28608  USA




[O] How do I stop org-info.js showing all children recursively?

2014-12-10 Thread Daniele Parisi
When org-info.js is in (org-like) folding mode and you click on a heading,
it expands showing all of its childrend headings recursively.

Is there a way so that it shows only the first children headings?


Instead of this:

* A
Expanding into

* A
 ** B1
  *** C1
  *** C2
 ** B2

I want it to expand to just this:

* A
 ** B1
 ** B2

and this should happen at every level.


Re: [O] [bug, patch, ox] INCLUDE and footnotes

2014-12-10 Thread Nicolas Goaziou
Rasmus  writes:

> I'm curious about the hash table.  (info "(elisp) Hash Tables") says "For
> smaller tables (a few tens of elements) alists may still be faster [than
> hash tables]".

True, but then, both a small table and a small alist are very fast.
OTOH, hash tables scale better.

> For an Org document, might it not make more sense to use an alist for
> this?

It doesn't matter much. I'd still favor a hash-table since it's hard to
predict an upper bound for include keywords in a document, but it's your
call, really. 

I doubt the alist or hash table will be the bottleneck.

> Or will the speed be regained when doing many includes from the
> same document (since I'd check if a footnote is already in the table)?

You would need to access the alist/hash table for each include keyword,
not necessarily from the same document.

> Also, since INCLUDE is expanded before info, should I just create a new
> defvar holding the table during export?  I guess that's the only way to
> hold it in memory across several INCLUDE words.

It should be in the scope of `org-export-expand-include-keyword', much
like `file-prefix'. No need for a global variable.

Regards,



Re: [O] Is it possible for the clock table to display only clocked activities between two timestamps?

2014-12-10 Thread Marcin Borkowski

On 2014-12-10, at 14:00, Sebastien Vauban wrote:

> Marcin Borkowski wrote:
>> More precisely, I'd like to have a clock report, say, from today 6:00
>> until now?  I tried with :tstart/:tend, but didn't succeed.
>>
>> This is what I naively tried:
>> #+BEGIN: clocktable :maxlevel 2 :scope subtree :tstart <2014-12-10 wed 
>> 06:00> :tend <2014-12-10 wed 23:59>
>
> :tstart "2014-12-10" :tend "2014-12-11" will work.
>
> Not tested with hours, though...

It is exactly hours I need.

I often work past midnight, and I really would like the day to start at,
say 3:00.  If this is not possible (AFAIK, it's not), I'd like at least
to exclude 0:00-3:00 from the clock report.

>
> Best regards,
>   Seb

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] Is it possible for the clock table to display only clocked activities between two timestamps?

2014-12-10 Thread Marcin Borkowski

On 2014-12-10, at 17:48, Marcin Borkowski wrote:

>> :tstart "2014-12-10" :tend "2014-12-11" will work.
>>
>> Not tested with hours, though...
>
> It is exactly hours I need.
>
> I often work past midnight, and I really would like the day to start at,
> say 3:00.  If this is not possible (AFAIK, it's not), I'd like at least
> to exclude 0:00-3:00 from the clock report.

Wow.  :tstart "2014-12-10 06:00" :tend "2014-12-10 23:59" works!

The only problem is that s-left / s-right won't work without a :block
option - but this I can live with.

>> Best regards,
>>   Seb

Thanks!

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] open file link in dired?

2014-12-10 Thread Steven Arntson
Alan Schmitt  writes:

> On 2014-12-10 10:51, Marcin Borkowski  writes:
>
>> Hi,
>>
>> please note that I did not read the original message, but does this help?
>>
>> http://mbork.pl/2013-10-06_Links_to_directories_in_Org-mode_files
>
> I think it's different: the goal here is too reveal the file in its
> enclosing directory.
>
> Alan

Yes, that's exactly right.

Alan, I hadn't realized your code would work using the normal
keybindings. I tried it out this morning, and it works perfectly! I
really have been searching around for this kind of thing for a long
time. It seems like many people could find it useful.

For me, I'll construct a list of project files in an org-mode buffer.
Then I'll be able to easily visit those files in a dired directory and
do whatever I need to (usually copying the files to a stick drive or
other portable media to transfer to collaborators).

Thanks again!
Steven




[O] Several org-entities to be fixed.

2014-12-10 Thread Konstantin Kliakhandler
Hello,

On all the computers I've used so far, including: Windows[8, 8.1] ,
OSX[Mavericks,Yosemite], debian[wheezy], ubuntu[14.04.1], I've seen the
same problem: the org-entities symbols for phi and varphi were inverted,
and the symbol for setminus was displayed as a W with a strike-through.

Attached is a patch that exchanges between the inverted symbols, and
replaces the W symbol by the unicode 'SET MINUS' symbol.

Thanks,
Kosta

-- 
Konstantin Kliakhandler
http://slumpy.org
  )°) )°( (°(


0001-Corrected-several-symbols-in-org-entities.patch
Description: Binary data


[O] [PATCH] Adding org-babel support for rust (ob-rust.el)

2014-12-10 Thread Philip Munksgaard
Dear org-mode developers

I've been working on adding support for rust in org-babel, and this is
what I've come up with so far. It's basically just a modification of
ob-C.el. The branch is viewable at [0], but so far the only commit is
[1]. I've also attached an example of how it works. Note that you will
need rustc to run the examples, and that I've only tested them with
rust 0.12 and the latest from git.

I'm very interested in getting this merged into org-mode, as I imagine
other rust developers are, so please let me know what I can do to
help, for example if you require tests or other forms of
documentation.

Kind regards
Philip Munksgaard

0: https://github.com/Munksgaard/org-mode/tree/ob-rust
1: 
https://github.com/Munksgaard/org-mode/commit/a6ffbb0120a2313464c621f80db93e2475ac25ac


ob-rust.org
Description: Lotus Organizer


Re: [O] problems with INCLUDE, noweb and tangle

2014-12-10 Thread ablepharus
Sebastien Vauban  writes:

> Daniele Pizzolli wrote:

> Or use the Library of Babel, if the code you wanna tangle gets
> eventually used in many different files?
>

I tried that yesterday and ran into some trouble, I've set ":noweb yes"
for all C++ blocks in the files and it seems that lob does not pickup on
this and will not resolve noweb references. When referencing a lob src
block, the references in that block will not be resolved. I tried
setting ":noweb yes" in `org-babel-default-header-args´ and in
`org-babel-lob-header-args´ with no success.


Best regards,

max



[O] org-babel for prolog

2014-12-10 Thread Bjarte Johansen
Hi,

I have started to implement org-babel support for (swi-)prolog. I have gotten 
to the point where I can execute a goal in an external process and have the 
result show up in the org file. I am now working on getting the session to work 
correctly. It runs and prints, but it doesn’t do the correct thing in the 
inferior-mode-buffer and the output is garbled. I still have some work ahead of 
me.

I just thought I would let you know in case someone was interested in following 
the progress or maybe also in helping me. I have the mode hosted in its current 
state here https://gist.github.com/ljos/2e346333e1b7bfd56d05 
 . 

And before you ask, yes, if I get this into a working order, I would eventually 
be interested in getting this into either contrib or core.

Regards,
Bjarte

[O] Patch to implement sorting Org tables by IP address

2014-12-10 Thread Jon Snader
There is currently no easy way to sort an Org table by IP address. The only 
method I could find involves selecting the IP addresses in a rectangle and 
piping them to sort with a complicated sort recipe. Even though I am not a 
system administrator, I sometimes need to maintain tables that I’d like to keep 
sorted by IP address.

The attached patch implements sorting Org tables natively.

I’ve just completed the FSF Copyright assignment process—let me know if you 
need details.

jcs




0001-org.el-Implement-sorting-Org-tables-by-IP-address.patch
Description: Binary data


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [O] table formula help...

2014-12-10 Thread Michael Brand
Hi Thierry

On Tue, Dec 9, 2014 at 11:35 PM, Thierry Banel  wrote:
> A clean design has been implemented for handling empty cells.

Very good.

> On output, empty cells are generated when the aggregation function does
> not have enough input. For instance, =mean= needs at least one value,
> otherwise a division by zero happens.

The above "not enough input" contradicts with "no input" from the
docstring of orgtbl-aggregate-apply-calc-1arg-function:

Empty value is returned when all input values are empty.

If this function would follow its docstring by having "(if (cdr vec)"
also for sum, min, max and prod then the user could benefit from
adding "E" and/or "N" or not in the mode string of the TBLFM:

#+TBLNAME: test
| Item | Value_1 | Value_2 |
|--+-+-|
| a|   2 | |
| a|   2 |   2 |
| b|   2 |   2 |
| b| |   2 |
| c| |   2 |
| c| |   2 |
| d| |   1 |
| d| |  -1 |

#+BEGIN: aggregate :table test :cols ("Item" "sum(Value_1)" "sum(Value_2)")
| Item | sum(Value_1) | sum(Value_2) |   |   ||
|--+--+--+---+---+|
| a|4 |2 | 3 | 3 | >  |
| b|2 |4 | 3 | 3 | <  |
| c|  |4 | 4 | 2 | NA |
| d|  |0 | 0 | 0 | NA |
#+TBLFM: $4 = vmean($2..$3) :: $5 = vmean($2..$3); EN :: $6 = if("$2"
== "nan" || "$3" == "nan", string("NA"), if($2 > $3, string(">"),
if($2 < $3, string("<"), string("eq"; E
#+END

The current orgaggregate for comparison:

| Item | sum(Value_1) | sum(Value_2) |   |   ||
|--+--+--+---+---+|
| a|4 |2 | 3 | 3 | >  |
| b|2 |4 | 3 | 3 | <  |
| c|0 |4 | 2 | 2 | <  |
| d|0 |0 | 0 | 0 | eq |

One could still get the current behavior by adding the column formula
~$2 = if("$2" == "nan", 0, $0); E~ etc. for the aggregated columns.

What do you think?

Michael



Re: [O] table formula help...

2014-12-10 Thread Michael Brand
Hi Thierry

On Mon, Dec 8, 2014 at 11:32 PM, Thierry Banel  wrote:
> Le 08/12/2014 22:12, Thierry Banel a écrit :
>> Le 07/12/2014 17:48, Michael Brand a écrit :
>>> Cool, thank you. As a hint for the user you could add something like
>>> "@<$4 = string("header") etc. to the TBLFMs in the unittests.org.
>>
>> Good suggestion.
>> What stops me now is that the @<$4 formula (or @1$4) does not work,
>> probably because of a bug.
>> More investigation is needed...
>
> I found this thread in The List started by Dima Kogan which is closely
> related to the @1$4 issue:
> http://comments.gmane.org/gmane.emacs.orgmode/91268
> He submitted a patch.

An additional, more convenient and more natural way to add headers for
a TBLFM column formula could be to add support for this (matches the
TBLFM of the example of my other post from today):

:cols ("Item" "sum(Value_1)" "sum(Value_2)" "Mean of non-empty"
"Mean of all" "Compare sums")

Michael



Re: [O] [dev] New version of org-index.el --- a personal index for org and beyond

2014-12-10 Thread Marc Ihm

Hi Alan,

I see the same error, when starting with a vanilla emacs;
so these errors were easy to fix (version 3.0.1):

http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob_plain;f=contrib/lisp/org-index.el;hb=HEAD

Thanx for reporting !


best regards
Marc


On 12/09/2014 09:02 PM, Alan Schmitt wrote:

On 2014-12-09 19:58, Alan Schmitt  writes:


I've given it a try, and upon creation there is a backtrace (when I'm
done with the setup):

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
   org-index--goto-list("columns-and-flags")
   org-index--create-index()
   org-index--create-missing-index("Variable org-index-id is not set,
so probably no index table has been created yet.")
   org-index--verify-id()
   org-index(nil)
   call-interactively(org-index record-it)

The table seems to be created, so I guess it's just a single occurrence
of a setup error.


As a followup, org-index could not find the id after restarting emacs,
so I guess the backtrace happened before it was saved. I manually added
the `org-index-id' to my .emacs and it now works.

I tried adding a node, and although I changed the category and keyword
that were proposed to me, the node was inserted with the default ones.

Is this the place to report such bugs?

Thanks,

Alan







Re: [O] [org-babel R] Difference between output in RStudio and in Org Babel

2014-12-10 Thread Aaron Ecay
Hi Seb,

[re-adding the list to cc]

2014ko abenudak 10an, Sebastien Vauban-ek idatzi zuen:
>
> FYI, the link is a screen capture image, in this case, not a video!

OK, now I feel sheepish.  I assumed from the screencast.com URL that
there was intended to be some video, for which the image displayed was
just the (first/last/etc.) frame.  Now I understand better.


> With my example, what I expect is:
> 
>  | | liste  | nb |
>  |-++|
>  | abc | item31\nitem80 |  2 |
>  | def | item52 |  1 |

There’s no convention in org tables that “\n” (i.e. two characters,
backslash + n) means newline (i.e. one character).

> In this case, I'd expect the same as in RStudio; that is, no multi-line
> cell, but simply a cell with a string in it -- which, yes, does contain
> the \n character:

What R’s console shows you (either RStudio or vanilla R) is a “human
readable” representation of the data frame, which includes doing
things like changing the newline character into a \n escape sequence
(and other stuff, like padding the columns with spaces so they all
line up vertically).  But when Org communicates with R, it asks for a
machine-readable version, which doesn’t include such niceties.  When
that machine-readable version includes a newline character in a data
field (as your example table does), org doesn’t know what to do and
messes up.

-- 
Aaron Ecay



Re: [O] [PATCH] Second proposal for ":session" doc

2014-12-10 Thread Aaron Ecay
Hi Thierry,

2014ko abenudak 7an, Thierry Pellé-ek idatzi zuen:
> 
> Hi, here is a proposal for some change on the ":session" header doc.
> 
> Comments are welcome!
> Thierry
> 
> 
> diff --git a/doc/org.texi b/doc/org.texi
> index c1e84d4..45e177e 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -15566,7 +15566,9 @@ execution.
>  @cindex @code{:session}, src header argument
>  
>  The @code{:session} header argument starts a session for an interpreted
> -language where state is preserved.  By default, a session is not started.
> +language.  All code block of this langage is executed into the same
^^^  
sare by
> +interpreter process, the state of the session being preserved as long as 
> Emacs
  ^  ^
  Start a new sentence here, and change to is
> +runs.  By default, a session is not started.

On a substantive note, “as long as Emacs runs” is not quite accurate –
it’s until the interpreter process exits, which could happen because the
user kills it, it crashes, a piece of code which is executed tells it to
exit, ...

>  
>  @itemize @bullet
>  @item @code{none}
> @@ -15574,9 +15576,9 @@ The default.  Each block is evaluated in its own 
> session.  The session is
>  not preserved after the evaluation.
>  @item @code{other}
>  Any other string passed to the @code{:session} header argument will give the
> -session a name.  All blocks with the same session name share the same
> -session.  Using different session name enables concurrent sessions (even for
> -the same interpreted language).  E.g., @code{:session mysession}.
> +session a name (possibly empty).  All blocks with the same session name share

I think something should be said like “If the session name is empty, a
default name based on the block’s language will be used.”  The session
name also becomes the interpreter process’s buffer name, and leaving
:session empty does not generate a buffer named “” (the empty string).

(It’s also a perverse but true fact that if you specify the same session
name for two blocks of different languages, they will both send their
code to the same interpreter process.  But for two blocks in different
languages with an empty :session, they will each use their language’s
default name.)

> +the same session.  Using different session name enables concurrent sessions
> +(for the same interpreted language).  E.g., @code{:session mysession} or 
> @code{:session}.
>  @end itemize
>  
>  @node noweb

Thanks,

-- 
Aaron Ecay
PhD candidate, Linguistics
University of Pennsylvania



Re: [O] Entering Repeating Scheduled Tasks in the Minibuffer

2014-12-10 Thread Pete Ley
>PS  What is the meaning of "(=>F)" that appears at the end of the
>minibuffer?

I believe this means org has chosen the future option of an ambiguous
input. e.g., it is December 10th. I use C-c . to create a timestamp and
simply put in "9". The closest date that matches is December 9th, but
there is a setting (I think org-read-date-prefer-future) that makes it
prefer to choose a date in the future, so it is letting you know that it
is opting for the future date instead of the closest date.

I could be wrong, but that is my understanding.



Re: [O] table formula help...

2014-12-10 Thread Thierry Banel
Le 10/12/2014 22:06, Michael Brand a écrit :
> Hi Thierry
>
> On Tue, Dec 9, 2014 at 11:35 PM, Thierry Banel  wrote:
>
>> On output, empty cells are generated when the aggregation function does
>> not have enough input. For instance, =mean= needs at least one value,
>> otherwise a division by zero happens.
> The above "not enough input" contradicts with "no input" from the
> docstring of orgtbl-aggregate-apply-calc-1arg-function:
>
> Empty value is returned when all input values are empty.

My mistake.Fixed to:
  "Empty value is returned when not enough non-empty input is available"

Thanks

> If this function would follow its docstring by having "(if (cdr vec)"
> also for sum, min, max and prod then the user could benefit from
> adding "E" and/or "N" or not in the mode string of the TBLFM:

To further process the aggregations?

> #+TBLNAME: test
> | Item | Value_1 | Value_2 |
> |--+-+-|
> | a|   2 | |
> | a|   2 |   2 |
> | b|   2 |   2 |
> | b| |   2 |
> | c| |   2 |
> | c| |   2 |
> | d| |   1 |
> | d| |  -1 |
>
> #+BEGIN: aggregate :table test :cols ("Item" "sum(Value_1)" "sum(Value_2)")
> | Item | sum(Value_1) | sum(Value_2) |   |   ||
> |--+--+--+---+---+|
> | a|4 |2 | 3 | 3 | >  |
> | b|2 |4 | 3 | 3 | <  |
> | c|  |4 | 4 | 2 | NA |
> | d|  |0 | 0 | 0 | NA |
> #+TBLFM: $4 = vmean($2..$3) :: $5 = vmean($2..$3); EN :: $6 = if("$2"
> == "nan" || "$3" == "nan", string("NA"), if($2 > $3, string(">"),
> if($2 < $3, string("<"), string("eq"; E
> #+END
>
> The current orgaggregate for comparison:
>
> | Item | sum(Value_1) | sum(Value_2) |   |   ||
> |--+--+--+---+---+|
> | a|4 |2 | 3 | 3 | >  |
> | b|2 |4 | 3 | 3 | <  |
> | c|0 |4 | 2 | 2 | <  |
> | d|0 |0 | 0 | 0 | eq |
>
> One could still get the current behavior by adding the column formula
> ~$2 = if("$2" == "nan", 0, $0); E~ etc. for the aggregated columns.
>
> What do you think?
>
> Michael
>

Well... Many different topics here.First of all, empty input & empty
output are unrelated. So let us take them one at a time.

* Input
In the spreadsheet formulas, we have those modifiers:
- E = keep empty fields when counting input vector size.
- N = replace non-numbers (including empties) by zero.

The first version of orgaggregate behaved as thought it had the EN
modifiers.The latest version behaves as thought it had no modifiers at all.

For the shake of consistency, it would be nice to have specifiers in
orgaggregate. E & N, of course, but also p7 (precision 7 digits), %.3
(three decimal places after dot), F (fraction), and so on.

* Output
If a function is able to compute a result, then it should give it. If
for any reason it is not able to compute a result, it should tell it in
some way. Right now, orgaggregate signals problems by leaving a blank
output. But it could be anything else: nan, NA, #ERROR, vmean([]), 1/0,
whatever.

The =sum= aggregation is always able to return a value, even for a zero
length input vector, in which case the sum is zero. On zero length
vectors, =prod= gives one. The =mean= aggregation has a hard time
telling what is the mean of a zero length input vector.

Here is how the spreadsheet handles those cases (without modifiers):
  |   |   |   | sum |  mean | prod |
  |---+---+---+-+---+--|
  | 1 | 2 | 3 |   6 | 2 |6 |
  |   | 2 | 3 |   5 | 1.667 |6 |
  |   |   | 3 |   3 | 1 |3 |
  |   |   |   |   0 | 0 |1 | <--- see
  #+TBLFM: $4=vsum($1..$3)::$5=vmean($1..$3)::$6=vprod($1..$3)

This is correct. Orgaggregate should behave in a similar way.
Fortunately in its latest version it does.

* Summary
Modifiers are lacking in orgaggregate for it to be fully consistent with
the spreadsheet. If someone knowns how to add them easily...

Regards
Thierry





Re: [O] unlinking links

2014-12-10 Thread Adam Spiers
On Thu, Dec 04, 2014 at 06:07:53PM +0100, Nicolas Goaziou wrote:
> Adam Spiers  writes:
> > On Thu, Nov 06, 2014 at 08:30:08PM -0500, John Kitchin wrote:
> >> Adam Spiers  writes:
> >> > Is it just me or is there no quick way to remove the link from some
> >> > hyperlinked text? If so, please consider this a feature request ;-)
> >> 
> >> Try this:
> >> 
> >> (defun unlinkify ()
> >>   "replace an org-link with the path, or description."
> >>   (interactive)
> >>   (let ((eop (org-element-context)))
> >> (when (eq 'link (car eop))
> 
> (when (eq (org-element-type eop) 'link)
> 
> >> (message "%s" eop)
> >>   (let* ((start (org-element-property :begin eop))
> >> (end (org-element-property :end eop))
> >> (contents-begin (org-element-property :contents-begin eop))
> >> (contents-end (org-element-property :contents-end eop))
> >> (path (org-element-property :path eop))
> >> (desc (and contents-begin
> >>contents-end
> >>(buffer-substring contents-begin contents-end
> >>(setf (buffer-substring start end) (or desc path))
> >
> > Thanks, that worked great!  Can I suggest you submit this for
> > inclusion in org itself? :-)  I guess it would need to be called
> > `org-unlinkify'.
> 
> FWIW, I don't think it is useful enough for inclusion in core.

Why not?  Or perhaps I should ask: how is it determined whether
something's useful enough for core? :-)



Re: [O] FR: refile-and-link

2014-12-10 Thread Adam Spiers
On Thu, Dec 04, 2014 at 07:21:30PM -0500, Kyle Meyer wrote:
> Adam Spiers  wrote:
> > Forgive me if this has already been implemented, but I couldn't see
> > it...
> 
> I don't know of a command that does this.
> 
> > I'm looking for something similar to the "extract method" operation
> > which refactoring IDEs can perform on code.  You would select a
> > headline (or maybe even region), hit `refile-and-link', and then after
> > the normal refiling, a link to the refiled section would be inserted
> > in the place where the refiled section previously lived.
> >
> > Thoughts?
> 
> The last refile location is stored in org-bookmark-names-plist. The
> (lightly tested) function below uses that information to create a link
> to the refiled heading.
> 
> #+begin_src emacs-lisp
>   (defun org-refile-and-link ()
> "Refile heading, adding a link to the new location.
>   Prefix arguments are interpreted by `org-refile'."
> (interactive)
> (when (member current-prefix-arg '(3 (4) (16)))
>   (user-error "Linking is incompatible with that prefix argument"))
> (let ((heading  (org-get-heading t t))
>   (orig-file (buffer-file-name)))
>   (call-interactively #'org-refile)
>   (let* ((refile-file
>   (bookmark-get-filename
>(assoc (plist-get org-bookmark-names-plist :last-refile)
>   bookmark-alist)))
>  (same-file (string= orig-file refile-file))
>  (link (if same-file
>(concat "*" heading)
>  (concat refile-file "::*" heading)))
>  (desc heading))
> (open-line 1)
> (insert (org-make-link-string link desc)
> #+end_src

Thanks a lot!  I've noticed a couple of minor issues - hopefully I'll
fix them when I get time and then maybe submit a patch.



[O] Bug: org-babel-script-escape misses a lonely double quote [8.2.10 (8.2.10-23-g1ec416-elpaplus @ c:/Users/jowik/.emacs.d/elpa/org-plus-contrib-20141208/)]

2014-12-10 Thread Johan W . Klüwer
I encountered a problem with unmatched double quotes in an org-babel
table of results. Seems like the issue lies with escaped double quotes:

  (org-babel-script-escape "[[\"a\", \"b\\\"\"]]")

  returns error >  Invalid read syntax: "] in a list".

Adding the following after line 41 of org-babel-script-escape appears to
fix the problem.

  (92 (if in-single ; \
 (append (list 92 34 out))
  (setq in-double (not in-double)) (cons 92 out)))

We now get

  (org-babel-script-escape "[[\"a\", \"b\\\"\"]]")
  (("a" "b\""))


Johan


Re: [O] "org-plus-contrib" yes, "org" no!

2014-12-10 Thread Grant Rettke
My system is Emacs `24.4.1' and Org `8.2.10' using Package package
to install org-plus-contrib and it does not install org in addition to
org-plus-contrib.

On Wed, Dec 10, 2014 at 8:16 AM, Sharon Kimble 
wrote:

> I have this as part of my "init.org" -
>
> --8<---cut here---start->8---
> (unless package-archive-contents;; Refresh the packages descriptions
>   (package-refresh-contents))
> (setq package-load-list '(all)) ;; List of packages to load
> (unless (package-installed-p 'org-plus-contrib)  ;; Make sure the Org
> package is
>   (package-install 'org-plus-contrib))   ;; installed, install it
> if not
> (package-initialize t);; Initialize & Install Package
> (setq package-enable-at-startup nil)
> --8<---cut here---end--->8---
>
> And yet almost every time that I update my packages it installs
> "org", which I've already got with "org-plus-contrib". So I then
> delete the fresh "org". How can I stop it installing "org" and just
> be content with "org-plus-contrib" please? After all,
> "org-plus-contrib" already includes "org" doesn't it?
>
> Thanks
> Sharon.
> --
> A taste of linux = http://www.sharons.org.uk
> my git repo = https://bitbucket.org/boudiccas/dots
> TGmeds = http://www.tgmeds.org.uk
> Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
>



-- 
Grant Rettke
g...@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson


Re: [O] "org-plus-contrib" yes, "org" no!

2014-12-10 Thread Sharon Kimble
Grant Rettke  writes:

> My system is Emacs `24.4.1' and Org `8.2.10' using Package package
> to install org-plus-contrib and it does not install org in addition to
> org-plus-contrib. 
>
Thanks Grant.

My emacs version is in the sig, and my org-version is "Org-mode
version 8.2.10 (8.2.10-23-g1ec416-elpaplus @
/home/boudiccas/.emacs.d/elpa/org-plus-contrib-20141208/)" so we're
in agreement, but still it happens. I've checked everywhere in my
"init.org" and I don't have a spare "(require 'org)" floating
around, its not in there at all!

I'm puzzled!

Sharon.

> On Wed, Dec 10, 2014 at 8:16 AM, Sharon Kimble  
> wrote:
>
> I have this as part of my "init.org" -
>
> --8<---cut here---start->8---
> (unless package-archive-contents    ;; Refresh the packages descriptions
>   (package-refresh-contents))
> (setq package-load-list '(all))     ;; List of packages to load
> (unless (package-installed-p 'org-plus-contrib)  ;; Make sure the Org 
> package is
>   (package-install 'org-plus-contrib))           ;; installed, install it 
> if not
> (package-initialize t)                ;; Initialize & Install Package
> (setq package-enable-at-startup nil)
> --8<---cut here---end--->8---
>
> And yet almost every time that I update my packages it installs
> "org", which I've already got with "org-plus-contrib". So I then
> delete the fresh "org". How can I stop it installing "org" and just
> be content with "org-plus-contrib" please? After all,
> "org-plus-contrib" already includes "org" doesn't it?
>
> Thanks
> Sharon.
> --
> A taste of linux = http://www.sharons.org.uk
> my git repo = https://bitbucket.org/boudiccas/dots
> TGmeds = http://www.tgmeds.org.uk
> Debian testing, fluxbox 1.3.5, emacs 24.4.1.0
>
> --
> Grant Rettke
> g...@wisdomandwonder.com | http://www.wisdomandwonder.com/
> “Wisdom begins in wonder.” --Socrates
> ((λ (x) (x x)) (λ (x) (x x)))
> “Life has become immeasurably better since I have been forced to stop taking 
> it seriously.” --Thompson
>

-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, fluxbox 1.3.5, emacs 24.4.1.0


signature.asc
Description: PGP signature


Re: [O] "org-plus-contrib" yes, "org" no!

2014-12-10 Thread Alexis

Sharon Kimble writes:

> My emacs version is in the sig, and my org-version is "Org-mode
> version 8.2.10 (8.2.10-23-g1ec416-elpaplus @
> /home/boudiccas/.emacs.d/elpa/org-plus-contrib-20141208/)" so we're
> in agreement, but still it happens. I've checked everywhere in my
> "init.org" and I don't have a spare "(require 'org)" floating
> around, its not in there at all!
>
> I'm puzzled!

My guess is that the version of Org that comes bundled with Emacs is
being loaded. If so, you could try renaming the `org` directory in your
Emacs installation's `lisp` directory to e.g. `.org` so that it's not
found by default, then restart Emacs.


Alexis.



Re: [O] [dev] New version of org-index.el --- a personal index for org and beyond

2014-12-10 Thread Alan Schmitt
On 2014-12-10 22:26, Marc Ihm  writes:

> Hi Alan,
>
> I see the same error, when starting with a vanilla emacs;
> so these errors were easy to fix (version 3.0.1):
>
> http://orgmode.org/w/org-mode.git?p=org-mode.git;a=blob_plain;f=contrib/lisp/org-index.el;hb=HEAD

It works great now, thanks.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


Re: [O] open file link in dired?

2014-12-10 Thread Alan Schmitt
On 2014-12-10 11:07, Steven Arntson  writes:

> For me, I'll construct a list of project files in an org-mode buffer.
> Then I'll be able to easily visit those files in a dired directory and
> do whatever I need to (usually copying the files to a stick drive or
> other portable media to transfer to collaborators).

I'm very glad it helps, but Bastien should get all the credit here (I
only tweaked the solution he sent me).

My main motivation for using this is that I have some code to preview a
file using Quicklook (I'm on OS X), and code to open a file in an
external app when in dired, so it's quite useful for files that emacs
cannot display:

#+begin_src emacs-lisp
(defun do-ql-dwim()
  (interactive)
  (save-window-excursion
(let* ((proc (get-buffer-process "*Async Shell Command*")))
  (if proc
  (kill-process proc)
(dired-do-async-shell-command
 "qlmanage -p 2>/dev/null" ""
 (dired-get-marked-files)))
  (bury-buffer proc

(defun open-in-external-app ()
  "Open the current file or dired marked files in external app.
Works in Microsoft Windows, Mac OS X, Linux."
  (interactive)
  (let (doIt
(myFileList
 (cond
  ((string-equal major-mode "dired-mode") (dired-get-marked-files))
  (t (list (buffer-file-name))
(setq doIt (if (<= (length myFileList) 5)
   t
 (y-or-n-p "Open more than 5 files?") ) )
(when doIt
  (cond
   ((string-equal system-type "windows-nt")
(mapc (lambda (fPath) (w32-shell-execute "open" 
(replace-regexp-in-string "/" "\\" fPath t t)) ) myFileList)
)
   ((string-equal system-type "darwin")
(mapc (lambda (fPath) (let ((process-connection-type nil)) 
(start-process "" nil "open" fPath)) )  myFileList) )
   ((string-equal system-type "gnu/linux")
(mapc (lambda (fPath) (let ((process-connection-type nil)) 
(start-process "" nil "xdg-open" fPath)) ) myFileList))

(add-hook 'dired-mode-hook 
  (lambda ()
(define-key dired-mode-map " " 'do-ql-dwim)
(define-key dired-mode-map (kbd "C-") 
'open-in-external-app)))
#+end_src

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7


signature.asc
Description: PGP signature


Re: [O] [PATCH] Second proposal for ":session" doc

2014-12-10 Thread abonnements

Hello thanks for this.

>   ^   ^^  ^^^
Sorry, but my English needs to be improved, but my French is not even 
better :-D


>  "...it’s until the interpreter process exit..."
I will use your reformulation; I know just a little about the background 
or the internals.


> “If the session name is empty, a default name based on the block’s 
language will be used.”

Same as previous, I din't know that.

Thanks.


Le 10/12/2014 22:58, Aaron Ecay a écrit :

Hi Thierry,

2014ko abenudak 7an, Thierry Pellé-ek idatzi zuen:

Hi, here is a proposal for some change on the ":session" header doc.

Comments are welcome!
Thierry


diff --git a/doc/org.texi b/doc/org.texi
index c1e84d4..45e177e 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -15566,7 +15566,9 @@ execution.
  @cindex @code{:session}, src header argument
  
  The @code{:session} header argument starts a session for an interpreted

-language where state is preserved.  By default, a session is not started.
+language.  All code block of this langage is executed into the same

 ^^^  
 sare by

+interpreter process, the state of the session being preserved as long as Emacs

   ^  ^
   Start a new sentence here, and change to is

+runs.  By default, a session is not started.

On a substantive note, “as long as Emacs runs” is not quite accurate –
it’s until the interpreter process exits, which could happen because the
user kills it, it crashes, a piece of code which is executed tells it to
exit, ...

  
  @itemize @bullet

  @item @code{none}
@@ -15574,9 +15576,9 @@ The default.  Each block is evaluated in its own 
session.  The session is
  not preserved after the evaluation.
  @item @code{other}
  Any other string passed to the @code{:session} header argument will give the
-session a name.  All blocks with the same session name share the same
-session.  Using different session name enables concurrent sessions (even for
-the same interpreted language).  E.g., @code{:session mysession}.
+session a name (possibly empty).  All blocks with the same session name share

I think something should be said like “If the session name is empty, a
default name based on the block’s language will be used.”  The session
name also becomes the interpreter process’s buffer name, and leaving
:session empty does not generate a buffer named “” (the empty string).

(It’s also a perverse but true fact that if you specify the same session
name for two blocks of different languages, they will both send their
code to the same interpreter process.  But for two blocks in different
languages with an empty :session, they will each use their language’s
default name.)


+the same session.  Using different session name enables concurrent sessions
+(for the same interpreted language).  E.g., @code{:session mysession} or 
@code{:session}.
  @end itemize
  
  @node noweb

Thanks,