Re: [O] Is there way to put the inactive date into a table?

2017-01-21 Thread Nicolas Goaziou
Hello,

Young-whan  writes:

>   | [2017-01-20 Fri] | <2017-01-30 Mon> |
>
>   #+TBLFM: @2$1=@1$1+10
>
> I put a inactive date at @1$1 and I want @2$1 would have +10 days from the
> date, and want it to be inactive date, but it always shows active calendar
> date form.
>
> Is there a way to make it inactive date?

All time stamps in tables are going to be inactive in next Org release,
i.e., Org 9.1.

Regards,

-- 
Nicolas Goaziou



[O] [ANN] Parser cache is disabled by default

2017-01-21 Thread Nicolas Goaziou
Hello,

Considering the bug reports about random freezes, I decided to disable
cache by default for the time being. IOW, `org-element-use-cache' is
nil.

Please consider turning it on if you want to help debugging the issue.

Regards,

-- 
Nicolas Goaziou0x80A93738



[O] org-entry-delete vs org-entry-put

2017-01-21 Thread Michael Welle
Hello,

I'm hacking a function to deactivate and activate recurring tasks
without losing the time stamp associated with the scheduled property. I
observed two things so far:

1. Property names like DISABLED-SCHEDULED seem to be problematic. I
   guess the regexp matching the scheduled property is too greedy.

2. (org-entry-put pom "SCHEDULED" nil) removes the property, but
   (org-entry-delete pom "SCHEDULED")  doesn't. On the other hand,   
   (org-entry-put pom "foo" nil) doesn't remove the property, but
   (org-entry-delete pom "foo")  does. It's no real problem, but that
   seems a bit inconsistent to me. Is that intended behaviour?

Regards
hmw



Re: [O] Latex Preview Fragment is not working on org 9.0.3 from elpa

2017-01-21 Thread Nicolas Goaziou
Hello,

Young-whan  writes:

> Looks like it is a bug? Why it is not loaded automatically while 8.2 has no
> issue?

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Parser cache is disabled by default

2017-01-21 Thread Gregor Zattler
Hi Nicolas,
* Nicolas Goaziou  [21. Jan. 2017]:
> I decided to disable cache by default for the time being. IOW,
> `org-element-use-cache' is nil.
> 
> Please consider turning it on if you want to help debugging the issue.

Is there an easy to follow receipt what to do in order to help
you debugging?  When Emacs hangs I do pkill -USR2 emacs but then
there is no debug info!?


Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-




Re: [O] [PATCH] org-info: Fix html export of info link

2017-01-21 Thread Nicolas Goaziou
Hello,

Chunyang Xu  writes:


> I notice the html export (actually, the HTML URL anchor part) of info
> link is incorrect in some cases, for example
> in (info "(org) Built-in table editor"), the corresponding org link is
>
>   [[info:org#Built-in%20table%20editor][info:org#Built-in table editor]]
>
> org exports it to
>
>   
> https://www.gnu.org/software/emacs/manual/html_mono/org.html#Built-in-table-editor
>
> but the correct one is
>
>   
> https://www.gnu.org/software/emacs/manual/html_mono/org.html#Built_002din-table-editor
>
> I have submitted a patch to fix this.

Thank you. I applied your patch with some minor refactoring.

I also added TINYCHANGE at the end of the commit message. Please
consider signing FSF papers if you want to further contribute to Org
mode.

Regards,

-- 
Nicolas Goaziou



[O] extra paragraph in image export?

2017-01-21 Thread Matt Price
with org-html-html5-fancy is non-nil, images are exported with something
like this code:


https://imgs.xkcd.com/comics/proof_2x.png"; alt="proof_2x.png"
class="fragment (appear) visible current-fragment"
data-fragment-index="0">



At least in ox-reveal, this makes it quite difficult to address images
separately from text (e.g., to set the text-align property appropriately.
You can try this if you have ox-reveal installed with any simple image:
--
* Test
[[https://imgs.xkcd.com/comics/proof_2x.png]]


At least on my machine, the image won't be centered in the resultant slide,
and it will be hard to construct CSS to fix the issue.

Is there a strong reason to include the  tag? I've removed it from
org-html--wrap-image and haven't noticed any ill effects so far, but
haven't done much testing.


[O] How to set the scheduled property programmatically?

2017-01-21 Thread Michael Welle
Hello,

what is the correct way to set the property? I tried

(org-entry-put pom "SCHEDULED" "<2017-01-01 Sun ++1w>")

which results in

SCHEDULED: <2017-01-01 Sun>

As you can see, the 'repeater' is missing.

Regards
hmw



[O] Recurring tasks and arbitrary properties

2017-01-21 Thread Michael Welle
Hello,

a task like this behaves like a recurring task, i.e. if I set the task
state to DONE it is automatically switched back to TODO. Is that the
intended behaviour?

* TODO task1
  :PROPERTIES:
  :FOO: <2017-03-12 Sun ++1w>
  :END:


Regards
hmw



[O] [PATCH] import org2tc scripts from John Wiegly into org-mode

2017-01-21 Thread Antoine Beaupré
this was taken from this Github repo with the author's approval:

https://github.com/jwiegley/org2tc

this is very useful to convert org-mode clock entries into the more
easily parseable timeclock.el format, a fundamental step in automating
billing with org-mode.
---
 contrib/scripts/org2tc | 150 +
 1 file changed, 150 insertions(+)
 create mode 100755 contrib/scripts/org2tc

diff --git a/contrib/scripts/org2tc b/contrib/scripts/org2tc
new file mode 100755
index 0..9ff6422d7
--- /dev/null
+++ b/contrib/scripts/org2tc
@@ -0,0 +1,150 @@
+#!/usr/bin/python
+
+'''Take an org-mode file as input and print a timeclock file as
+output. This can then be read directly by Ledger for fancy time
+reporting and querying. Fields :BILLCODE: and :TASKCODE: are parsed to
+generate lines compatible with the format expected by ledger
+("billcode taskcode").
+
+See also 
http://ledger-cli.org/2.6/ledger.html#Using-timeclock-to-record-billable-time
+
+© 2011-2016 John Wiegly 
+© 2016-2017 Antoine Beaupré
+'''
+
+
+from __future__ import print_function
+
+import argparse
+import locale
+locale.setlocale(locale.LC_ALL, '')
+import sys
+import re
+import time
+
+iso_date_fmt = "%Y-%m-%d %H:%M:%S"
+
+def parse_org_time(s):
+return time.strptime(s, "%Y-%m-%d %a %H:%M")
+
+def parse_timestamp(s):
+return time.strptime(s, iso_date_fmt)
+
+events   = []
+last_heading = None
+clocks   = []
+
+parser = argparse.ArgumentParser(description='convert org clocks into 
timeclock',
+ epilog=__doc__ +
+ '''Note that TIME is provided in the 
following format: %s'''
+ % iso_date_fmt)
+parser.add_argument('orgfile', help='Org file to process')
+parser.add_argument('-s', '--start', metavar='TIME', help='process only 
entries from this date')
+parser.add_argument('-e', '--end', metavar='TIME', help='process only entries 
to this date')
+parser.add_argument('-r', '--regex', help='process only entries matching this 
regex')
+parser.add_argument('-o', '--output', help='output file (default: stdout)',
+type=argparse.FileType('w'), default=sys.stdout)
+args = parser.parse_args()
+
+data = args.orgfile
+range_start  = parse_timestamp(args.start) if args.start else None
+range_end= parse_timestamp(args.end) if args.end else None
+regex= args.regex
+fd   = open(data, "r")
+headings = [None] * 9
+acct = ""
+
+(billcode, taskcode) = ("", None)
+
+def add_events():
+# XXX: those globals should really be cleaned up, maybe through a clock 
object or named tuple
+global acct, clocks, billcode, taskcode, events, todo_keyword, last_heading
+if clocks:
+for (clock_in, clock_out, billcode, taskcode) in clocks:
+if billcode and ":" not in billcode and taskcode:
+acct = "%s:%s" % (billcode, taskcode)
+events.append((clock_in, clock_out, todo_keyword,
+   ("%s  %s" % (acct, last_heading))
+   if acct else last_heading))
+clocks = []
+
+for line in fd:
+match = re.search("^(\*+)\s*(.+)", line)
+if match:
+depth = len(match.group(1))
+headings[depth] = match.group(2)
+
+depth = 0
+match = re.search("^(\*+)\s+(TODO|DONE)?(\s+\[#[ABC]\])?\s*(.+)", line)
+if match:
+add_events()
+
+depth = len(match.group(1))
+todo_keyword = match.group(2)
+last_heading = match.group(4)
+match = re.search("(.+?)\s+:\S+:$", last_heading)
+if match:
+last_heading = match.group(1)
+match = re.search("\[\[.*\]\]\s+(.+?)$", last_heading)
+if match:
+last_heading = match.group(1)
+
+headings[depth] = last_heading
+
+i = 0
+prefix = ""
+while i < depth:
+if prefix:
+prefix += ":" + headings[i]
+else:
+prefix = headings[i]
+i += 1
+
+if prefix:
+#last_heading = prefix + "  " + last_heading
+last_heading = prefix + ":" + last_heading
+
+if regex and not (prefix and re.search(regex, prefix)):
+last_heading = None
+
+if last_heading:
+match = re.search("CLOCK:\s+\[(.+?)\](--\[(.+?)\])?", line)
+if match:
+clock_in  = parse_org_time(match.group(1))
+clock_out = match.group(3) # optional
+if clock_out:
+clock_out = parse_org_time(clock_out)
+else:
+#clock_out = time.localtime()
+clock_out = None
+if (not range_start or clock_in >= range_start) and \
+   (not range_end or clock_in < range_end):
+   clocks.append((clock_in, clock_out, billcode, taskcode))
+elif clock_in < range_start and clock_out > range_start:
+   clocks.app

[O] Bug: org-cycle-agenda-files is broken in org-mode version 8.2.10 (which ships with Emacs 25.1) [8.2.10 (release_8.2.10 @ /usr/local/Cellar/emacs/25.1/share/emacs/25.1/lisp/org/)]

2017-01-21 Thread Gaurav Abbi
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.


The function org-cycle-agenda-files is broken in org-mode version 8.2.10
(which ships with Emacs 25.1). Please refer to the SO link
http://emacs.stackexchange.com/questions/30110/cycle-through-agenda-files-list-not-working

Emacs  : GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0, NS appkit-1404.47
Version 10.11.6 (Build 15G1004))
 of 2016-09-22
Package: Org-mode version 8.2.10 (release_8.2.10 @
/usr/local/Cellar/emacs/25.1/share/emacs/25.1/lisp/org/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
 org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-default-notes-file "~/org~/notes/QuickNotes.org"
 org-startup-indented t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-from-is-user-regexp "\\"
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook org-babel-show-result-all append
local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
 org-cycle-hide-inline-tasks org-cycle-show-empty-lines
 org-optimize-window-after-visibility-change)
 org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-html-format-headline-function 'ignore
 org-html-format-inlinetask-function 'ignore
 org-agenda-files '("~/work/pubsub/onCall/File4OnCall.org"
"~/work/training/devXchange/Sessions.org"
"~/work/pubsub/documents/notes/onCall/OncallOps.org"
"~/work/pubsub/tasks/zkHA/MeetingNotes.org"
"~/work/pubsub/documents/onboardingCommandRuns/PendingLefts.org" )
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )

Best Regards,
Gaurav Abbi


Re: [O] Bug: org-cycle-agenda-files is broken in org-mode version 8.2.10 (which ships with Emacs 25.1) [8.2.10 (release_8.2.10 @ /usr/local/Cellar/emacs/25.1/share/emacs/25.1/lisp/org/)]

2017-01-21 Thread Kyle Meyer
Gaurav Abbi  writes:

> The function org-cycle-agenda-files is broken in org-mode version 8.2.10
> (which ships with Emacs 25.1). Please refer to the SO link
> http://emacs.stackexchange.com/questions/30110/cycle-through-agenda-files-list-not-working

This is caused by Emacs's commit 3a5f75193e (* org.el: Fix up some
lexical scoping warnings, and use dolist, 2015-08-08).

I suggest using Org 9.0.3.  Org files in the Emacs repo need to be
updated, but I don't know what the status of that is.

-- 
Kyle



Re: [O] extra paragraph in image export?

2017-01-21 Thread Matt Price
On Sat, Jan 21, 2017 at 11:26 AM, Matt Price  wrote:

> with org-html-html5-fancy is non-nil, images are exported with something
> like this code:
>
> 
> https://imgs.xkcd.com/comics/proof_2x.png";
> alt="proof_2x.png" class="fragment (appear) visible current-fragment"
> data-fragment-index="0">
> 
>
> There is some cruft in here -- I hastily copied from `inspect element`
instead of from the code itself, and also included some ox-reveal-specific
markup.  This is a more representative output:

https://imgs.xkcd.com/comics/proof_2x.png";
alt="proof_2x.png">


The following's still true:

>
> At least in ox-reveal, this makes it quite difficult to address images
> separately from text (e.g., to set the text-align property appropriately).
> You can try this if you have ox-reveal installed with any simple image:
> --
> * Test
> [[https://imgs.xkcd.com/comics/proof_2x.png]]
>
> 
> At least on my machine, the image won't be centered in the resultant
> slide, and it will be hard to construct CSS to fix the issue.
>
> Is there a strong reason to include the  tag? I've removed it from
> org-html--wrap-image and haven't noticed any ill effects so far, but
> haven't done much testing.
>
>


Re: [O] Parser cache is disabled by default

2017-01-21 Thread Nicolas Goaziou
Hello,

Gregor Zattler  writes:

> Is there an easy to follow receipt what to do in order to help
> you debugging?  When Emacs hangs I do pkill -USR2 emacs but then
> there is no debug info!?

The freezes itself is easy to understand. The cache (an AVL tree) is
corrupted, and inserting a new cached object infloops, roughly.
Debugging data obtained at the time of the freeze is probably not
useful.

The difficult part is to find an ECM to reproduce the bug. AFAIU,
headlines are involved, probably in conjunction with property drawers.
Unfortunately, you may only realize the cache is corrupted quite some
time after it happened. 

Typically, you are close to getting a recipe when you experience
a freeze, reset the cache (`org-element-cache-reset'), resume working
and quickly experience another freeze. The ingredients are between the
reset and the new freeze.

Regards,

-- 
Nicolas Goaziou