[O] Org Mode Documentation Patch

2018-06-22 Thread Siraphob (Ben) Phipathananunth
This patch was originally submitted to Emacs devel, but Eli Zaretskii
redirected me here.

I've begun reading the Org Mode manual, and noticed that the wording
in some places could be improved (so far I've read up to Section 4.8).
I've attached my patch.  Some of the more drastic changes:

- Changed all occurrences of "the cursor" to "point", I thought the
  inconsistency was confusing, especially since the Emacs manual
  maintains usage of "point" throughout, so too should the Org Mode
  manual.

I have a couple of questions regarding the Org Mode manual and
submitting patches:

Section 4.6 "Link abbreviations" in the Org Mode manual link to
websites that have and/or promote non-free software.  The URLs are
used to illustrate link abbreviations in Org Mode, but I suppose this
was purely coincidental because long URLs to websites such as
gnu.org/some/long/path could be used instead.  Would it be appropriate
to change the examples in a later patch?

When the PDF version of the Org Mode manual is generated with "make
docs", the footnotes (3 and 4) around Section 4.3 are incorrectly
indented, can anyone reproduce this?  What is causing it?

Should I submit my patches as smaller ones as I read sections of the
manual or bulk them together into a larger patch, or is it just a
matter of preference?

Please let me know if you have any comments about the patch.  It's my
first one, I hope I have followed the CONTRIBUTING guide properly.

Thanks!

--

Siraphob (Ben) Phipathananunth


0001-Fix-various-grammatical-errors-and-fix-terminology.patch
Description: Binary data


Re: [O] Speeding up agenda custom command with org-agenda-earlier & org-agenda-later

2018-06-22 Thread Zongheng Yang
Cool, looking forward to see the rewrite!

On Fri, Jun 22, 2018 at 1:49 PM Nicolas Goaziou 
wrote:

> Hello,
>
> Zongheng Yang  writes:
>
> > Here's an agenda custom command that acts as the main interface I
> interact
> > with org (in fact, emacs :)).
> >
> >   (setq org-agenda-custom-commands
> > '(("c" "Simple agenda view"
> >((agenda "")
> > (tags "PRIORITY=\"A\""
> >   ((org-agenda-files '("~/org/work.org" "~/org/ideas.org
> "))
> >(org-agenda-skip-function '(org-agenda-skip-entry-if
> > 'todo 'done))
> >(org-agenda-overriding-header "High-priority tasks:")
> >))
> > (tags-todo "PRIORITY=\"C\""
> >((org-agenda-files '("~/org/work.org" "~/org/
> > ideas.org"))
> > (org-agenda-overriding-header "Long-term:")))
> > (alltodo ""
> >  ((org-agenda-skip-function
> >'(or (zongheng-org-skip-subtree-if-priority ?A)
> > (zongheng-org-skip-subtree-if-priority ?C)
> > (org-agenda-skip-if nil '(scheduled
> deadline
> >   (org-agenda-overriding-header "Other tasks:")))
> > 
> >
> > After I get into this view, I frequently issue many "org-agenda-earlier"
> &
> > "org-agenda-later" commands, often in a back-and-forth fashion, to
> inspect
> > what I've done around certain periods.
> >
> > In such a use case, it seems there's *no reason to not cache results*.
> > Without such caching currently *the latency of switching is really high*;
> > with such a caching, I'm happy to pay an one-time latency/CPU cost for
> the
> > first command, as long as successive commands can be sped up.
> >
> > Is a feature like this planned?
>
> I don't think is it planned. Feel free to implement it, if you want to.
>
> I consider Org agenda in dire need of rewriting, though. for better
> scalability and easier maintenance.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] Speeding up agenda custom command with org-agenda-earlier & org-agenda-later

2018-06-22 Thread Nicolas Goaziou
Hello,

Zongheng Yang  writes:

> Here's an agenda custom command that acts as the main interface I interact
> with org (in fact, emacs :)).
>
>   (setq org-agenda-custom-commands
> '(("c" "Simple agenda view"
>((agenda "")
> (tags "PRIORITY=\"A\""
>   ((org-agenda-files '("~/org/work.org" "~/org/ideas.org"))
>(org-agenda-skip-function '(org-agenda-skip-entry-if
> 'todo 'done))
>(org-agenda-overriding-header "High-priority tasks:")
>))
> (tags-todo "PRIORITY=\"C\""
>((org-agenda-files '("~/org/work.org" "~/org/
> ideas.org"))
> (org-agenda-overriding-header "Long-term:")))
> (alltodo ""
>  ((org-agenda-skip-function
>'(or (zongheng-org-skip-subtree-if-priority ?A)
> (zongheng-org-skip-subtree-if-priority ?C)
> (org-agenda-skip-if nil '(scheduled deadline
>   (org-agenda-overriding-header "Other tasks:")))
> 
>
> After I get into this view, I frequently issue many "org-agenda-earlier" &
> "org-agenda-later" commands, often in a back-and-forth fashion, to inspect
> what I've done around certain periods.
>
> In such a use case, it seems there's *no reason to not cache results*.
> Without such caching currently *the latency of switching is really high*;
> with such a caching, I'm happy to pay an one-time latency/CPU cost for the
> first command, as long as successive commands can be sped up.
>
> Is a feature like this planned?

I don't think is it planned. Feel free to implement it, if you want to.

I consider Org agenda in dire need of rewriting, though. for better
scalability and easier maintenance.

Regards,

-- 
Nicolas Goaziou



Re: [O] very long table calc expressions ?

2018-06-22 Thread Uwe Brauer

   > On 22/06/2018 18:48, Nick Dokos wrote:
   > A utility lisp function can enhance readability:

   > #+begin_src elisp
   >   (defun test-to-interval (x)
   >     (let ((n (string-to-number x)))
   >   (cond
   >    ((equal x "")  "NP")
   >    ((and (<= 0 n) (<= n 4.9)) "SS")
   >    ((and (<= 5 n) (<= n 6.9)) "AP")
   >    ((and (<= 7 n) (<= n 8.9)) "NT")
   >    ((and (<= 9 n) (<= n 10 )) "SB")
   >    (t "other"
   > #+end_src

This is extremely helpful! Thanks a lot. I hope France will make it to
the final of the World Cup (more I cannot wish you :-D )

@Nick, I think this example should make it into the documentation, for
example in  https://orgmode.org/worg/org-tutorials/org-lookups.html.

What do you think?

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] very long table calc expressions ?

2018-06-22 Thread Thierry Banel
On 22/06/2018 18:48, Nick Dokos wrote:
> Uwe Brauer  writes:
>
>> Hi Jonathan
>>
>>> Hi Uwe,
>>> On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer  wrote:
>>
>>> (::)
>>> not just a single.  Brent's example has it with double while yours only
>>> shows
>>> it with a single one.
>>
>> Right, thanks for clarifying that. My original example had various :: and
>> indeed there Bernt's advice helped. 
>>
>> Meanwhile Thierry posted a more sophisticated example containing only
>> simple :
>> (which   does not work with ::) and that example cannot be dealt with via 
>> C-c '.
>>
>> @Thierry: that is correct?
>>
> The double colons separate different formulas. The single colons in Thierry's
> formula are  part of the syntax of a conditional expression, i.e. they are 
> part
> of a *single* (long) formula. So yes, that cannot be dealt with via C-c '.
>
A utility lisp function can enhance readability:

#+begin_src elisp
  (defun test-to-interval (x)
    (let ((n (string-to-number x)))
  (cond
   ((equal x "")  "NP")
   ((and (<= 0 n) (<= n 4.9)) "SS")
   ((and (<= 5 n) (<= n 6.9)) "AP")
   ((and (<= 7 n) (<= n 8.9)) "NT")
   ((and (<= 9 n) (<= n 10 )) "SB")
   (t "other"
#+end_src

#+TBLNAME: raw-data
| Test | Interval |
|--+--|
|    0 | SS   |
|    1 | SS   |
|    2 | SS   |
|    3 | SS   |
|    4 | SS   |
|    5 | AP   |
|    6 | AP   |
|    7 | NT   |
|    8 | NT   |
|    9 | SB   |
|  | NP   |
|  | NP   |
|  | NP   |
#+TBLFM: $2='(test-to-interval $1)







Re: [O] Bug: org-toggle-tag always marks buffer modified [9.1.13 (9.1.13-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180618/)]

2018-06-22 Thread Nicolas Goaziou
Hello,

Bernt Hansen  writes:

> This problem still exists when the capture template includes TAGS
>
> In the below capture-templates definition the "t" (todo) template works
> fine but the "m" Meeting template does not allow SPC to enter a space
> between words when entering the headling for the meeting task.
>
> (setq org-capture-templates
>   (quote (("t" "Todo" entry (file "C:/D-Drive/org/refile.org")
>  "* TODO %?\n%U\n\n%x\n" :clock-in t :clock-resume t)
>("m" "Meeting" entry (file
>   "C:/D-Drive/org/refile.org")
>  "* TODO %? :MEETING:\n%U\n\n" :clock-in t :clock-resume
>   t

I re-introduced the problem recently. This is now fixed, with
a regression test for good measure.

Thank you.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] very long table calc expressions ?

2018-06-22 Thread Nick Dokos
Uwe Brauer  writes:

> Hi Jonathan
>
>> Hi Uwe,
>> On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer  wrote:
>
>> (::)
>> not just a single.  Brent's example has it with double while yours only
>> shows
>> it with a single one.
>
> Right, thanks for clarifying that. My original example had various :: and
> indeed there Bernt's advice helped. 
>
> Meanwhile Thierry posted a more sophisticated example containing only
> simple :
> (which   does not work with ::) and that example cannot be dealt with via 
> C-c '.
>
> @Thierry: that is correct?
>

The double colons separate different formulas. The single colons in Thierry's
formula are  part of the syntax of a conditional expression, i.e. they are part
of a *single* (long) formula. So yes, that cannot be dealt with via C-c '.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [O] very long table calc expressions ?

2018-06-22 Thread Uwe Brauer
Hi Jonathan

   > Hi Uwe,
   > On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer  wrote:

   > (::)
   > not just a single.  Brent's example has it with double while yours only
   > shows
   > it with a single one.

Right, thanks for clarifying that. My original example had various :: and
indeed there Bernt's advice helped. 

Meanwhile Thierry posted a more sophisticated example containing only
simple :
(which   does not work with ::) and that example cannot be dealt with via 
C-c '.

@Thierry: that is correct?

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] very long table calc expressions ?

2018-06-22 Thread Jonathan Leech-Pepin
Hi Uwe,

On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer  wrote:

>
>> Uwe Brauer  writes:
>
>> When I hit C-c ' in this table
>
>> #+TBLNAME: stat-final2
>> || Frequency |
>
>> |+---|
>> | SS |   |
>> | AP | 5 |
>> | NT | 3 |
>> | SB |#ERROR |
>> | MH | 2 |
>> | NP | 3 |
>
>
>> I get a new window with this in it:
>
>> # Field and Range Formulas
>> @>$2 = '(length (org-lookup-all "NP" '(remote(data,@2$2..@>I$2))
> nil))
>> nil))
>> nil))
>> nil))
>
>> and I can edit individual lines and then C-c C-c or C-c ' again to
> exit
>> and rebuild the formula line on the table.
>
>
> Not for me, that is strange. Here is the screenshot I obtain (running
> git master emacs from May and org git master form last July, so maybe
> this feature is missing?)
>
> Pretty sure the spacer between formulas is supposed to be a double colon
(::)
not just a single.  Brent's example has it with double while yours only
shows
it with a single one.

Regards,
Jon


Re: [O] very long table calc expressions ?

2018-06-22 Thread Uwe Brauer

   > Uwe Brauer  writes:

   > When I hit C-c ' in this table

   > #+TBLNAME: stat-final2
   > || Frequency |

   > |+---|
   > | SS |   |
   > | AP | 5 |
   > | NT | 3 |
   > | SB |#ERROR |
   > | MH | 2 |
   > | NP | 3 |


   > I get a new window with this in it:

   > # Field and Range Formulas
   > @>$2 = '(length (org-lookup-all "NP" '(remote(data,@2$2..@>I$2)) nil))
   > nil))
   > nil))
   > nil))

   > and I can edit individual lines and then C-c C-c or C-c ' again to exit
   > and rebuild the formula line on the table.


Not for me, that is strange. Here is the screenshot I obtain (running
git master emacs from May and org git master form last July, so maybe
this feature is missing?)



smime.p7s
Description: S/MIME cryptographic signature


Re: [O] very long table calc expressions ?

2018-06-22 Thread Bernt Hansen
Uwe Brauer  writes:

>> Uwe Brauer  writes:
>
> Hello Bernt,
>> Hi Uwe,
>
>> You can edit or view the table formulas with C-c ' in case that helps.
>> This splits the formulas one per line for editing.
>
> Thanks for pointing this out to me, but I seem unable to do it. 
>
> When I use C-c ' I obtain that very long formula in a special buffer,
> but it is again a long line. Breaking this line and then using C-c C-c
> cuts the second line. So this is not what I was looking for, but maybe I
> misunderstood something fundamental.

When I hit C-c ' in this table

#+TBLNAME: stat-final2
|| Frequency |
|+---|
| SS |   |
| AP | 5 |
| NT | 3 |
| SB |#ERROR |
| MH | 2 |
| NP | 3 |
#+TBLFM: @>$2='(length (org-lookup-all "NP" '(remote(data,@2$2..@>I$2)) 
nil))::@>>$2='(length (org-lookup-all "MH" '(remote(data,@2$2..@>I$2)) 
nil))::@>>>$2='(length (org-lookup-all "SB" '\(remote(data,@2$2..@>I$2)) 
nil))::@$2='(length (org-lookup-all "NT" '(remote(data,@2$2..@>I$2)) 
nil))::@>$2='(length (org-lookup-all "AP" '(remote(data,@2$2..@>I$2)) nil))

I get a new window with this in it:

# Field and Range Formulas
@>$2 = '(length (org-lookup-all "NP" '(remote(data,@2$2..@>I$2)) nil))
@>>$2 = '(length (org-lookup-all "MH" '(remote(data,@2$2..@>I$2)) nil))
@>>>$2 = '(length (org-lookup-all "SB" '\(remote(data,@2$2..@>I$2))
nil))
@$2 = '(length (org-lookup-all "NT" '(remote(data,@2$2..@>I$2))
nil))
@>$2 = '(length (org-lookup-all "AP" '(remote(data,@2$2..@>I$2))
nil))

and I can edit individual lines and then C-c C-c or C-c ' again to exit
and rebuild the formula line on the table.

It seems to reverse the lines every other time I do it which is strange
but it works for me.

Regards,
Bernt



Re: [O] very long table calc expressions ?

2018-06-22 Thread Uwe Brauer

   > Uwe Brauer  writes:

Hello Bernt,
   > Hi Uwe,

   > You can edit or view the table formulas with C-c ' in case that helps.
   > This splits the formulas one per line for editing.

Thanks for pointing this out to me, but I seem unable to do it. 

When I use C-c ' I obtain that very long formula in a special buffer,
but it is again a long line. Breaking this line and then using C-c C-c
cuts the second line. So this is not what I was looking for, but maybe I
misunderstood something fundamental.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: [O] bug in org-capture for table lines

2018-06-22 Thread Holst Thomas (PS-EC/ESE4)
Hi Nicolas,

Nicolas Goaziou  writes:

>"Holst Thomas (PS-EC/ESE4)"  writes:
>
>> there is a bug in org-capture. When capturing table lines table formula is 
>> not updated.
>>
>> Here is an ECM:
>>
>> [...snip ...]
>
> Fixed. Thank you.

I can confirm that it works perfectly.
Thank you!

--
Thomas



Re: [O] TBLFM and a remote table lookup on two columns

2018-06-22 Thread Thierry Banel

  
  
On 22/06/2018 07:40, Brad Knotwell
  wrote:


  

  
Good day all--


I've been using TBLFM and orgmode-lookup-first to
  conditionally update a table.  It works great but I've run
  into something that has stumped me.  Imagine I have a
  table like the following:


#+name: lookup_geo

+-+---|
| T      | L   | Y |
|+-+---|
| WEII  | SEA | 3 |
| WEIII | SEA | 4 |
| WEIII | SJC | 3 |
|+-+---|


|+-+---+-|
| T      | L   | Count | Cost (Count * matching Y
  above) |
|+-+---+-|
| WEIII | SJC |     3 | #ERROR                     
      |
| WEIII | SEA |     5 | #ERROR                     
      |
|+-+---+-|


# the TBLFM syntax below doesn't work, it's just
  how I would've guessed it might.



#+TBLFM: $4=`(org-lookup-first '($1 $2)
  '((remote(lookup_geo,@2$1..@>$1))
  (remote(lookup_geo,@2$2..@>$2)))
  '(remote(lookup_geo,@2$3..@>$3


  
  

As far as I can tell, orgmode-lookup-first allows me to
  match the first(T) or second(L) column but it's entirely
  unclear how to match both.  While I could workaround this
  with multiple tables (e.g. a separate named table/location
  and then have code dynamically generate the appropriate
  table name), a separate source block or a single key
  composed of two parts (e.g "WEII - SEA"; this is my
  current favorite workaround), I wondered if there might be
  a better solution.


I also considered whether it would make sense for the
  predicate to be given access to the entire matched row so
  something like the following could work:


    'lambda (row) (and (= $1 (car row)) (= $2 (cadr
  row


Anyhow, is there a better way to do this beyond
  creating a single column that combines what was two
  columns?


Thx.


--Brad
  


  


  

  

You may want to take a look at the orgtbl-aggregate package
available on Melpa. Suppose you have several combinations of
first and second columns values, and you want to aggregate rows
based on those combined values. Then orgtbl-aggregate can do the
job. In this example it performs two aggregations: count and sum
of Y column values:
#+name: lookup_geo
  |---+-+|
  | T | L   |  Y |
  |---+-+|
  | WEII  | SEA | 11 |
  | WEII  | SEA | 22 |
  | WEII  | SJC | 33 |
  | WEIII | SEA |  4 |
  | WEIII | SJC |  3 |
  | WEIII | SJC | 50 |
  | WEII  | SEA | 44 |
  |---+-+|
  
  #+BEGIN: aggregate :table "lookup_geo" :cols "T L count()
sum(Y)"
  | T | L   | count() | sum(Y) |
  |---+-+-+|
  | WEII  | SEA |   3 | 77 |
  | WEII  | SJC |   1 | 33 |
  | WEIII | SEA |   1 |  4 |
  | WEIII | SJC |   2 | 53 |
  #+END:
  
  
Documentation here: https://github.com/tbanel/orgaggregate
  
  
  
  To gain access to the Melpa repository I have those
settings in my .emacs file:
  
  
  
  (require 'package)
  
  (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/")
t)
  
  (package-initialize)
  
  
  
  Have fun
  
  Thierry