Re: [O] Tangling flow control

2016-11-09 Thread Charles C. Berry

On Wed, 9 Nov 2016, Philip Hudson wrote:


On 9 November 2016 at 21:41, Charles C. Berry  wrote:

The org src block is just a container. Its body is a src block template that
gets copied into the variable `tmpl', which if filled and placed in file can
be tangled.


That makes sense, but it seems to conflict with what you illustrate:

#+RESULTS:
#+BEGIN_src org
,#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
,#+END_SRC
#+END_src

I'd expect/want:

#+RESULTS:
#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
#+END_SRC

Wouldn't I?



For sure. But when developing stuff like this `:wrap src org' will capture 
it and protect against messing up the rest of your *.org file.


Once you get it filling the template as you want it, remove the :wrap 
header and add a `:file script.org' header


But it is indeed optional.

Chuck



Re: [O] DEADLINE: position in entry

2016-11-09 Thread Alan Tyree
On 10 November 2016 at 10:47, Samuel Wales  wrote:

> iirc we've discussed whether planning lines (i.e. scheduled, deadline,
> closed at this time) should be flexible.  we concluded to make them
> strict.
>
> check archives for the discussion.  :) everything goes through this
> mailing list.
>
> OK, I'll accept that and have a look at the rationale. However, since
DEADLINE: is so terribly important, I think that there should be a
prominent warning in the manual that they are simply ignored if not
positioned correctly. Warnings should appear, at the very least, in 8.1 and
8.3.

Suggested wording:

In 8.1:


timestamp can appear anywhere in the headline or body of an Org tree
entr UNLESS is is preceded by a keyword in which case it must be properly
positioned or it will be ignored: see 8.3 for details.

In 8.3:

A timestamp may be preceded by special keywords to facilitate planning.
WARNING: both the timestamp and the keyword are ignored if not positioned
immediately following the headline. No space or other text is allowed.

Regards,
Alan


> --
> The Kafka Pandemic: http://thekafkapandemic.blogspot.com
>
> The disease DOES progress.  MANY people have died from it.  And
> ANYBODY can get it.
>
> Denmark: free Karina Hansen NOW.
>   UPDATE 2016-10: home, but not fully free
>



-- 
Alan L Tyreehttp://austlii.edu.au/~alan

Tel:  04 2748 6206sip:typh...@iptel.org


Re: [O] DEADLINE: position in entry

2016-11-09 Thread Samuel Wales
iirc we've discussed whether planning lines (i.e. scheduled, deadline,
closed at this time) should be flexible.  we concluded to make them
strict.

check archives for the discussion.  :) everything goes through this
mailing list.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] DEADLINE: position in entry

2016-11-09 Thread Alan Tyree
On 10 November 2016 at 10:36, Nicolas Goaziou 
wrote:

> Hello,
>
> Alan L Tyree  writes:
>
> > On 10/11/16 05:51, Philip Hudson wrote:
>
> > Also, if this really is the case, then the manual needs to be
> > modified. Under 8.1, it says
> >
> > " A timestamp can appear anywhere in the headline or body of an Org tree
> > entry."
>
> Section 8.1 is about regular time-stamps, which are not necessarily tied
> to DEADLINE and SCHEDULED keyword. Therefore, the sentence above is
> true.
>
> > and under 8.3:
> >
> > "A timestamp may be preceded by special keywords to facilitate planning:"
> >
> > I can't see anywhere that requires the DEADLINE: keyword to be flush
> > against a heading.
>
> This is in 8.3.1, first footnote.
>
> So it is. Not exactly prominent :-). I still think the manual is
misleading, and is there some reason that "planning" items are treated
different from plain old appointment timestamps? I just seems (to a
non-programmer) to be an unnecessary restriction.

Cheers,
Alan


> Regards,
>
> --
> Nicolas Goaziou
>



-- 
Alan L Tyreehttp://austlii.edu.au/~alan

Tel:  04 2748 6206sip:typh...@iptel.org


Re: [O] [bug] timed repeater shows up in wrong place

2016-11-09 Thread Samuel Wales
On 11/9/16, cesar mena  wrote:
>   17:00.. Sched. 3x:  TODO test

you got this running the testcase?  there is no xyzzy there.

> did you check the value of org-agenda-repeating-timestamp-show-all as
> nicolas suggested?

it is emacs -Q, and it is not changed in the testcase code.

thus, it is t, which is the default value.

why would you get a different result?  is it the emacs version?

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] DEADLINE: position in entry

2016-11-09 Thread Nicolas Goaziou
Hello,

Alan L Tyree  writes:

> On 10/11/16 05:51, Philip Hudson wrote:

> Also, if this really is the case, then the manual needs to be
> modified. Under 8.1, it says
>
> " A timestamp can appear anywhere in the headline or body of an Org tree
> entry."

Section 8.1 is about regular time-stamps, which are not necessarily tied
to DEADLINE and SCHEDULED keyword. Therefore, the sentence above is
true.

> and under 8.3:
>
> "A timestamp may be preceded by special keywords to facilitate planning:"
>
> I can't see anywhere that requires the DEADLINE: keyword to be flush
> against a heading.

This is in 8.3.1, first footnote.

Regards,

-- 
Nicolas Goaziou



Re: [O] DEADLINE: position in entry

2016-11-09 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> On 9 November 2016 at 14:20, Marco Wahl  wrote:
>> In particular, no blank line is allowed between PLANNING and HEADLINE.
>
> I just checked, and was surprised to find that M-x org-lint RET does
> *not* catch this. Is this a bug in org-lint, or does org-lint not
> intend to catch this sort of thing?

It was a bug in the parser, which was more tolerant than necessary. This
is fixed.

Regards,

-- 
Nicolas Goaziou



Re: [O] Blank lines after headline and before :PROPERTIES: etc

2016-11-09 Thread Nicolas Goaziou
Hello,

Charles Millar  writes:

> Is it stated anywhere in the Org manual that blank lines are not
> allowed after headlines or certain other elements.

Quoting (info "(org) Property syntax"),

  Properties are key-value pairs. When they are associated with a single
  entry or with a tree they need to be inserted into a special drawer
  (@pxref{Drawers}) with the name @code{PROPERTIES}, which has to be
  located right below a headline, and its planning line
  (@pxref{Deadlines and scheduling}) when applicable.

Improvements are welcome.

Also, see

  http://orgmode.org/worg/dev/org-syntax.html

Eventually,

  M-x org-lint

should report such issue. Actually, it doesn't, but I fixed it so it
will eventually report it.

Regards,

-- 
Nicolas Goaziou



Re: [O] Tangling flow control

2016-11-09 Thread Philip Hudson
On 9 November 2016 at 21:41, Charles C. Berry  wrote:
> The org src block is just a container. Its body is a src block template that
> gets copied into the variable `tmpl', which if filled and placed in file can
> be tangled.

That makes sense, but it seems to conflict with what you illustrate:

#+RESULTS:
#+BEGIN_src org
,#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
,#+END_SRC
#+END_src

I'd expect/want:

#+RESULTS:
#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
#+END_SRC

Wouldn't I?


> Alternatively, you can eval (setq tmpl "") somewhere (maybe
> in a local variables block), where the  part is the
> template.
>
> But it seems easier to edit the template as an org src block - C-c ' puts
> your template in an OrgSrc buffer, then moving point to a src block and
> typing M-x org-edit-src-code puts its body in another OrgSrc buffer where
> you can edit it in the shell-mode or whatever mode.
>
> Also, I suppose that template should have been an ssh-config src block to
> conform with your earlier posting. But I think you get the idea.

Yes, that's no problem, I adapt it mutatis mutandum.

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x887DCA63



Re: [O] [bug] timed repeater shows up in wrong place

2016-11-09 Thread Samuel Wales
On 11/9/16, cm...@pobox.com  wrote:
>> SCHEDULED: <2016-11-07 Mon 17:00>

> this example does not have a repeater though. without a repeater, you
> are right, it does not show in the time grid.

oops.

please put .+1d on that
now try it
for me it only shows a 3x.  it does not show in time grid.
  this is the bug
in my version of org 8 -- it only shows in the time grid
  this is the behavior i expect, am used to, and need

>> interestingly, if i run org-agenda a, which shows a whole week
>>   then the same, single task shows in TWO places
>> time grid
>> scheduled section
>
> i rather like this behaviour. if a timed non-repeating task was not
> marked done, i just want to see that is is late; unless i dig deeper.

i think i agree.  but that's not the bug i am reporting.

>
> best!

:)

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] Tangling flow control

2016-11-09 Thread Charles C. Berry

On Wed, 9 Nov 2016, Philip Hudson wrote:


On 9 November 2016 at 17:54, Charles C. Berry  wrote:

On Tue, 8 Nov 2016, Philip Hudson wrote:

[snip]


How do you do "looping" flow control?

For context, what I'm trying to write is a single Org file from which
I can tangle out a number of =~/.ssh/config= files, one for each of
several hosts on a LAN. Within this file I need to repeatedly place a
template =BEGIN_SRC ssh-config= block, each time with a few words and
numbers changed. Do you do this anywhere? If so, how have you
implemented it?


It sounds like what you want is a template for the src block and another src
block that does substitutions in that template using a table of values
inside a loop.

Just to get you started, with this template:

#+NAME: template
#+BEGIN_SRC org
  ,#+BEGIN_SRC shell :tangle %to-file
  ls -lt %filename
  ,#+END_SRC
#+END_SRC

and this helper src-block

#+NAME: get-body
#+BEGIN_SRC emacs-lisp :var src-block-name="c-code"
  (save-excursion
(org-babel-goto-named-src-block
 src-block-name)
(cadr (org-babel-get-src-block-info)))

#+END_SRC


running

#+header: :wrap src org :var tmpl=get-body("template")
#+BEGIN_SRC emacs-lisp
  (org-fill-template tmpl
'(("to-file" . "abc.sh")("filename" . "my-dir")))
#+END_SRC

yields

#+RESULTS:
#+BEGIN_src org
,#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
,#+END_SRC
#+END_src


To revise this for your application, you need to provide a table of the
associated values for the "to-file" and "filename" keys in the alist, read
that table using a :var header, loop thru the table reconstructing the alist
each time creating src blocks, and send the output to an org tempfile.  Then
you tangle the tempfile.

Alternatively, you simply write the script files directly without bothering
to write to an org tempfile.


Thanks Chuck. I think I've got that straight. I hadn't come across
`org-fill-template' before. I think I know how to loop thru a table,
though I haven't done it myself before; I've seen how to "get" a table
as a list.

What I'm not clear about is why the template nests a shell-script
block inside an Org block. Should the outer Org block not have a
%-escaped placeholder for a :tangle target, an intermediate Org file?


No.

The org src block is just a container. Its body is a src block template 
that gets copied into the variable `tmpl', which if filled and placed in 
file can be tangled.


Alternatively, you can eval (setq tmpl "") somewhere 
(maybe in a local variables block), where the  part is 
the template.


But it seems easier to edit the template as an org src block - C-c ' puts 
your template in an OrgSrc buffer, then moving point to a src block and 
typing M-x org-edit-src-code puts its body in another OrgSrc buffer where 
you can edit it in the shell-mode or whatever mode.


Also, I suppose that template should have been an ssh-config src block to 
conform with your earlier posting. But I think you get the idea.


Chuck



Re: [O] DEADLINE: position in entry

2016-11-09 Thread Alan L Tyree

On 10/11/16 05:51, Philip Hudson wrote:

On 9 November 2016 at 14:20, Marco Wahl  wrote:

 In particular, no blank line is allowed between PLANNING and HEADLINE.

I just checked, and was surprised to find that M-x org-lint RET does
*not* catch this. Is this a bug in org-lint, or does org-lint not
intend to catch this sort of thing?


Also, if this really is the case, then the manual needs to be modified. 
Under 8.1, it says


" A timestamp can appear anywhere in the headline or body of an Org tree
entry."

and under 8.3:

"A timestamp may be preceded by special keywords to facilitate planning:"

I can't see anywhere that requires the DEADLINE: keyword to be flush 
against a heading.


There may be some reason for requiring this, but if there is no good 
reason, I would like to see it changed to be more flexible.


Alan


--
Alan L Tyreehttp://www2.austlii.edu.au/~alan
Tel:  04 2748 6206  sip:typh...@iptel.org




Re: [O] Tangling flow control

2016-11-09 Thread Philip Hudson
On 9 November 2016 at 17:54, Charles C. Berry  wrote:
> On Tue, 8 Nov 2016, Philip Hudson wrote:
>
> [snip]
>>
>> How do you do "looping" flow control?
>>
>> For context, what I'm trying to write is a single Org file from which
>> I can tangle out a number of =~/.ssh/config= files, one for each of
>> several hosts on a LAN. Within this file I need to repeatedly place a
>> template =BEGIN_SRC ssh-config= block, each time with a few words and
>> numbers changed. Do you do this anywhere? If so, how have you
>> implemented it?
>
> It sounds like what you want is a template for the src block and another src
> block that does substitutions in that template using a table of values
> inside a loop.
>
> Just to get you started, with this template:
>
> #+NAME: template
> #+BEGIN_SRC org
>   ,#+BEGIN_SRC shell :tangle %to-file
>   ls -lt %filename
>   ,#+END_SRC
> #+END_SRC
>
> and this helper src-block
>
> #+NAME: get-body
> #+BEGIN_SRC emacs-lisp :var src-block-name="c-code"
>   (save-excursion
> (org-babel-goto-named-src-block
>  src-block-name)
> (cadr (org-babel-get-src-block-info)))
>
> #+END_SRC
>
>
> running
>
> #+header: :wrap src org :var tmpl=get-body("template")
> #+BEGIN_SRC emacs-lisp
>   (org-fill-template tmpl
> '(("to-file" . "abc.sh")("filename" . "my-dir")))
> #+END_SRC
>
> yields
>
> #+RESULTS:
> #+BEGIN_src org
> ,#+BEGIN_SRC shell :tangle abc.sh
> ls -lt my-dir
> ,#+END_SRC
> #+END_src
>
>
> To revise this for your application, you need to provide a table of the
> associated values for the "to-file" and "filename" keys in the alist, read
> that table using a :var header, loop thru the table reconstructing the alist
> each time creating src blocks, and send the output to an org tempfile.  Then
> you tangle the tempfile.
>
> Alternatively, you simply write the script files directly without bothering
> to write to an org tempfile.

Thanks Chuck. I think I've got that straight. I hadn't come across
`org-fill-template' before. I think I know how to loop thru a table,
though I haven't done it myself before; I've seen how to "get" a table
as a list.

What I'm not clear about is why the template nests a shell-script
block inside an Org block. Should the outer Org block not have a
%-escaped placeholder for a :tangle target, an intermediate Org file?

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x887DCA63



Re: [O] Adapting to orgmode 9.0: deprecated usage of (org-pdfview-open link) - howto ?

2016-11-09 Thread AW
Am Mittwoch, 9. November 2016, 18:00:50 CET schrieb Pablo S.  Casas:
> From: AW 
> Subject: [O] Adapting to orgmode 9.0: deprecated usage of (org-pdfview-open
> link) - howto ? Date: Wed, 09 Nov 2016 11:01:13 +0100
> 
> > OK, I don't speak lisp, but I tried this in my .emacs:
> > 
> > ,
> > 
> > | (add-to-list 'org-file-apps '("\\.pdf\\'" . (lambda (link)   (
> > | org-pdfview-
> > 
> > open
> > 
> > | (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (lambda (link)
> > | (org-> 
> > pdfview-open
> > `
> 
>For me it works replacing the former:
> (add-to-list 'org-file-apps '("\\.pdf\\'" . (org-pdfview-open link)))
> (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (org-pdfview-open
> link)))
> 
> by simply:
> 
> (add-to-list 'org-file-apps
> '("\\.pdf\\'" . (lambda (file link) (org-pdfview-open link
> 
>Hope it helps.
> 
>Pablo

Yes! Thank you! 




Re: [O] [bug] timed repeater shows up in wrong place

2016-11-09 Thread Samuel Wales
On 11/8/16, cesar mena  wrote:
> i just tried this on maint, and it does show up in the time grid as
> well.

are you running it with today only in the agenda?  i.e. not weekly.

i am still getting the bug in org maint, with debian jessie emacs 24.4.1.

here is the mce.

i did:

put this in $dorg/computer--a.org (loaded in my testcase)

*** NEXT xyzzy test (make this be a date that is before today;
it should show up in agenda time grid)
SCHEDULED: <2016-11-07 Mon 17:00>

cd to $delorgsrc
put head on maint
confirm status is clean
make cleanall
make oldorg
run my testcase (attached)
  -Q
  shows today only in agenda

result:

what it shows is the task with 3x (i.e. scheduled section, not time grid)
  this is the bug

interestingly, if i run org-agenda a, which shows a whole week
  then the same, single task shows in TWO places
time grid
scheduled section

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free
;;;
;;; alpha-org-testcase.el
;;;
;;; minimal testcase for org
;;;
;;; to run as you, do this:
;;;
;;;   dorg=your-org-data-dir \
;;;   delorgsrc=your-org-src-dir \
;;;   emacs -Q -l alpha-org-testcase.el
;;;
;;; for my use i do something like this for accessibility:
;;;
"
account eot

which is basically:

mep=t eq -l $del/tests-and-publish/alpha-org-testcase.el $dorg/tests--org--xyzzy-big/export-and-id.org

mep=t emacs -Q --geometry 60x30+0+0 -l $del/tests-and-publish/alpha-org-testcase.el $dorg/tests--org--xyzzy-big/export-and-id.org
"
;;;

;;; nyi
;;;   delorgcontrib=your-org-src-contrib-dir \

(require 'cl)

;;my org files use these
(setq org-odd-levels-only t)
;; (setf org-export-initial-scope 'subtree)

;;fix abominations
(blink-cursor-mode 0)
(setf visible-bell 'top-bottom)

;;basics
(defun alpha-add-path (p) (setq load-path (cons p load-path)))
(alpha-add-path (concat (getenv "delorgsrc") "/lisp"))
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(require 'org-install)


;;;
;;;stuff make things easier
;;;

(ido-mode t)
(setf org-outline-path-complete-in-steps nil)

;;;
;;;accessibility fixes
;;;

(defun p ()
  (interactive)
  (message "fixing pop-up-windows")
  ;;i have /pop-up-windows/ set to nil, which works for most of
  ;;emacs.  for org, i do the following.  i need all of this just
  ;;as i need the large font above for accessibility reasons.
  ;;
  ;;(setf (cdr (assoc* 'file org-link-frame-setup)) 'find-file)
  (pushnew '(file . find-file) org-link-frame-setup :test #'equal)
  ;;it might be nice to have a 'dedicated-buffer option
  (setf org-indirect-buffer-display 'current-window)
  ;;could make pop kill the buffer
;;;(setf org-display-internal-link-with-indirect-buffer t)
  (setf org-src-window-setup 'current-window)
  (add-hook 'org-capture-mode-hook 'delete-other-windows)
  (defadvice org-agenda-set-tags (around fix-windows activate compile)
"Restore windows."
(save-window-excursion
  ad-do-it))
  (defadvice org-export (after fix-windows activate compile)
"Delete other windows after every export."
(delete-other-windows))

  (setf pop-up-windows nil)

  ;;for emacs i do this
  
  (add-to-list 'same-window-regexps "\\*Customize.*") ;notwork?
  (setf Man-notify-method 'pushy)
  (add-to-list 'same-window-regexps "\\*Man .*") ;notwork
  (add-to-list 'same-window-regexps "\\*.*\\*")
  (add-to-list 'same-window-buffer-names "*Remember*")
  (add-to-list 'same-window-buffer-names "*Help*")
  (add-to-list 'same-window-buffer-names "*Apropos*")
  (add-to-list 'same-window-buffer-names "*Summary*")
  (add-to-list 'same-window-buffer-names "*Compile-Log*")
  (add-to-list 'same-window-buffer-names "*Ibuffer*")
  (add-to-list 'same-window-buffer-names " *Ibuffer*")
  (message "done fixing pop-up-windows"))
(when (getenv "mep")
  ;;it is i
  (defconst alpha-alpha-p t)
  (require 'org)
  (p)
  ;;necessary for large fonts
  (scroll-bar-mode -1))

;;;
;;;basic org features likely to affect many bug reports
;;;

(setq org-todo-keywords
  '((type  "NAKA(i)" "TODO(T)" "MAYBE(y)" "DOUBTFUL(l)"
 "|"
 "MOOT(m)")))

(setq org-agenda-files
  (mapcar #'file-truename
  ;;this is like a file-expand-regexp
  (directory-files (getenv "dorg")
   ;;full pathname
   t
   ;;cloned indirect buffers create dot
   ;;files
   "^[^.#]+--a\\.org$")))

(setq org-agenda-window-setup 'current-window)

;;;
;;; do the actual thing being tested
;;;

(org-agenda-list nil nil 1)
;; (search-forward "xyzzy test")
(occur "xyzzy test")


Re: [O] DEADLINE: position in entry

2016-11-09 Thread Philip Hudson
On 9 November 2016 at 14:20, Marco Wahl  wrote:
> In particular, no blank line is allowed between PLANNING and HEADLINE.

I just checked, and was surprised to find that M-x org-lint RET does
*not* catch this. Is this a bug in org-lint, or does org-lint not
intend to catch this sort of thing?


-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x887DCA63



Re: [O] Bug: Repeated tasks not shown from org-timeline [9.0 (9.0-dist @ c:/wlin/.emacs-lisp/org/lisp/)]

2016-11-09 Thread Nick Dokos
Nick Dokos  writes:

> Samuel Wales  writes:
>
>> i recommend searching for carsten's history of the timeline.  it was
>> detailed and possibly includes ideas for emulating it in agenda.  part
>> of the issue was that the timeline was invented before some new
>> features, possibly including repeaters, but did not get updated for
>> them.  there are also efficiency issues with looping.
>>
>>
>
> I found a reference to it here:
>
>http://lists.gnu.org/archive/html/emacs-orgmode/2012-01/msg00015.html
>
> pointing to
>
>http://thread.gmane.org/gmane.emacs.orgmode/39368/focus=40038
>
> but when I visit the latter, the thread seems incomplete: probably
> a casualty of the gmane problems.

Found it:

https://www.mail-archive.com/emacs-orgmode@gnu.org/msg39801.html

-- 
Nick




Re: [O] Tangling flow control

2016-11-09 Thread Charles C. Berry

On Tue, 8 Nov 2016, Philip Hudson wrote:

[snip]


How do you do "looping" flow control?

For context, what I'm trying to write is a single Org file from which
I can tangle out a number of =~/.ssh/config= files, one for each of
several hosts on a LAN. Within this file I need to repeatedly place a
template =BEGIN_SRC ssh-config= block, each time with a few words and
numbers changed. Do you do this anywhere? If so, how have you
implemented it?




It sounds like what you want is a template for the src block and another 
src block that does substitutions in that template using a table of 
values inside a loop.


Just to get you started, with this template:

#+NAME: template
#+BEGIN_SRC org
  ,#+BEGIN_SRC shell :tangle %to-file
  ls -lt %filename
  ,#+END_SRC
#+END_SRC

and this helper src-block

#+NAME: get-body
#+BEGIN_SRC emacs-lisp :var src-block-name="c-code"
  (save-excursion
(org-babel-goto-named-src-block
 src-block-name)
(cadr (org-babel-get-src-block-info)))

#+END_SRC


running

#+header: :wrap src org :var tmpl=get-body("template")
#+BEGIN_SRC emacs-lisp
  (org-fill-template tmpl
'(("to-file" . "abc.sh")("filename" . "my-dir")))
#+END_SRC

yields

#+RESULTS:
#+BEGIN_src org
,#+BEGIN_SRC shell :tangle abc.sh
ls -lt my-dir
,#+END_SRC
#+END_src


To revise this for your application, you need to provide a table of the 
associated values for the "to-file" and "filename" keys in the alist, read 
that table using a :var header, loop thru the table reconstructing the 
alist each time creating src blocks, and send the output to an org 
tempfile.  Then you tangle the tempfile.


Alternatively, you simply write the script files directly without 
bothering to write to an org tempfile.


HTH,

Chuck



Re: [O] Bug: Repeated tasks not shown from org-timeline [9.0 (9.0-dist @ c:/wlin/.emacs-lisp/org/lisp/)]

2016-11-09 Thread Nick Dokos
Samuel Wales  writes:

> i recommend searching for carsten's history of the timeline.  it was
> detailed and possibly includes ideas for emulating it in agenda.  part
> of the issue was that the timeline was invented before some new
> features, possibly including repeaters, but did not get updated for
> them.  there are also efficiency issues with looping.
>
>

I found a reference to it here:

   http://lists.gnu.org/archive/html/emacs-orgmode/2012-01/msg00015.html

pointing to

   http://thread.gmane.org/gmane.emacs.orgmode/39368/focus=40038

but when I visit the latter, the thread seems incomplete: probably
a casualty of the gmane problems.

-- 
Nick




Re: [O] Adapting to orgmode 9.0: deprecated usage of (org-pdfview-open link) - howto ?

2016-11-09 Thread Pablo S . Casas
From: AW 
Subject: [O] Adapting to orgmode 9.0: deprecated usage of (org-pdfview-open 
link) - howto ?
Date: Wed, 09 Nov 2016 11:01:13 +0100

> OK, I don't speak lisp, but I tried this in my .emacs:
> 
> ,
> | (add-to-list 'org-file-apps '("\\.pdf\\'" . (lambda (link)   ( org-pdfview-
> open
> | (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (lambda (link) (org-
> pdfview-open
> `

   For me it works replacing the former:
(add-to-list 'org-file-apps '("\\.pdf\\'" . (org-pdfview-open link)))
(add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (org-pdfview-open 
link)))

by simply:

(add-to-list 'org-file-apps 
'("\\.pdf\\'" . (lambda (file link) (org-pdfview-open link

   Hope it helps.

   Pablo



Re: [O] outline-up-heading ignoring hidden levels of headings

2016-11-09 Thread Marco Wahl
Hi!

> Since I recently upgraded my Org-mode maint branch to 8.3.4
> (release_8.3.4-1384-gc61ee8)[1], one behavior changed to a worse one.
>
> Before:
>
> Given an Org-mode buffer whose headings are all collapsed. When I
> open a task (heading) from my agenda, the corresponding heading *and
> all of its "upstream" headings* are shown as well. This way, I could
> easily use C-c C-u (outline-up-heading) to go to the corresponding
> father heading.

> Current behavior:
>
> Jumping to a collapsed sub-tree results in the target heading shown
> but *not the "upstream headings"*. When I use C-c C-u to go to the
> upper heading, I end up corresponding top heading, ignoring all the
> level of headings in between. To get to a direct father heading, I
> have to make Org-mode show all headings of the buffer and then, C-c
> C-u is able to jump one level up.
>
> Question:
>
> How can I get back to the previous behavior?

Possibly you can configure variable

org-show-context-detail

to meet your needs.

Also consider command `org-reveal' (C-c C-r by default, I guess) to reveal
more context at a location in an orgmode buffer.


Ciao,
-- 
Marco




Re: [O] DEADLINE: position in entry

2016-11-09 Thread Marco Wahl
Hi!

Alan Tyree  writes:

> Is this the way it should be? The first DEADLINE: shows up both as a
> warning and on the due date in the agenda, but the second one does not. It
> only works for me if the DEADLINE: is the first line after the heading.
> Version 9, emacs 24
>
> *** test 1
> DEADLINE: <2016-11-19 Sat>
>
> *** test 2
>
> DEADLINE: <2016-11-19 Sat>
>
>
> Thanks,
> Alan

Currently

http://orgmode.org/worg/dev/org-syntax.html

says:

 A planning is an element with the following pattern:

HEADLINE
PLANNING

(and DEADLINE is e.g. a PLANNING)

...

In particular, no blank line is allowed between PLANNING and HEADLINE. 

So your example 'test 2' does not have a DEADLINE according to the
org-syntax document.


Ciao,
-- 
Marco




[O] Blank lines after headline and before :PROPERTIES: etc

2016-11-09 Thread Charles Millar

Hi,

I am not  a programmer, coder, whatever, and realize that many of you 
are used to inferring certain conditions by examples given in manuals, etc.


Is it stated anywhere in the Org manual that blank lines are not allowed 
after headlines or certain other elements. If not, could such 
"enlightenment" be added to the manual? As an example,


* This is a headline
:PROPERTIES:
:EXPORT_FILE_NAME: /path/to/exported/file
:END:

works as expected whereas

* This is a headline

:PROPERTIES:
:EXPORT_FILE_NAME: /path/to/exported/file
:END:

exports to a file with the buffer name.

(The above sometimes occur when I kill and yank the properties block.

Another example would be the necessity that a table immediately follow 
all elements that are used to format and generate a table.


Charlie Millar




[O] org-contacts bug when completing tags in gnus

2016-11-09 Thread Alan Schmitt
Hello,

I'm giving org-contacts a try, and I'm having an error when I'm trying
to complete a tag (something should be a sequence but it's a number).
Digging a little into it, it seems that the problem is during
hilighting, where a fontified string is returned by all-completions
instead of a list (in `completion-pcm--all-completions' in minibuffer.el),
which then make `completion-hilit-commonality' fail because it expects a
list. I'm only seeing this problem with org-contacts, so I'm wondering
if it might be the reason for this problem in emacs code.

My contacts file looks like this:

* Test  :test:
:PROPERTIES:
:EMAIL: alan.schm...@polytechnique.org
:END:

To reproduce, save this in some path/contacts.org file, do the following

  (require 'org-contacts)
  (org-contacts-gnus-insinuate)
  (setq org-contacts-files (list "path/contacts.org"))
  
then start an email in gnus, in the To field write +, then hit TAB.

I'm using org-mode 9 and emacs 25.1.1. Is this a known problem with
them?

Thanks,

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-09: 401.03, 2015-09: 397.63


signature.asc
Description: PGP signature


[O] PSA :) for org-reveal users..easy colors everywhere thx to John Kitchen :D

2016-11-09 Thread Xebar Saram
Hi all!

i just wanted to share this:

http://kitchingroup.cheme.cmu.edu/blog/2016/11/08/New-color-link-in-org-9-0-using-font-lock-to-color-the-text/

in short using the new org 9.0 features one can easily add colors to
headers, lines ,words etc with the new color: link types (the code is at
the site to add the color: link type)

it works fantastically when exporting files and provides a great and easy
way to add colors to you org-reveal slides!


thx so much to John for his awesome blog (and work :))!

Z


[O] Bug: Wrong effort sums in hierarchy when org-time-clocksum-use-effort-durations is set

2016-11-09 Thread Björn Döring
When columns view is opened with an "%Effort{:}" column, the sum is only
correct for the first parent element. Whereas "hours" are propagated up
the hierarchy, "days" are reset to zero when going up more than one
hierarchy.

Example:

* Level 1
** Level 2
*** Level 3
 Level 4
:PROPERTIES:
:Effort:   2d
:END:

In columns view (with `# -*- org-time-clocksum-use-effort-durations: t;
org-time-clocksum-format: (:days "%dd " :require-days t :hours "%d"
:require-hours t :minutes ":%02d" :require-minutes t) -*-`) this only
reports correct effort values for Level 4 and Level 3. Level 1 and Level
2 show "0d 0:00", but "2d 0:00" is expected.




Emacs  : GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Package: Org mode version 9.0 (9.0-elpa @ z:/.emacs.d/elpa/org-20161102/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
   ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys")
   ("file+emacs")
   ("ipynb" :follow ein:org-open :export nil)
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow
(lambda (path) (browse-url (concat "ftp:" path
   ("help" :follow org--open-help-link)
   ("http" :follow
(lambda (path) (browse-url (concat "http:" path
   ("https" :follow
(lambda (path) (browse-url (concat "https:" path
   ("mailto" :follow
(lambda (path) (browse-url (concat "mailto:; path
   ("message" :follow
(lambda (path) (browse-url (concat "message:" path
   ("news" :follow
(lambda (path) (browse-url (concat "news:; path
   ("shell" :follow org--open-shell-link))
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-confirm-babel-evaluate nil
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-log-done 'note
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local]
   5 "\n\n(fn)"]
 org-mode-reftex-setup
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local]
   5 "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes
 turn-on-flyspell turn-on-auto-fill)
 org-src-preserve-indentation t
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-startup-indented t
 org-agenda-files '("~/org/tasks.org")
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 )



signature.asc
Description: OpenPGP digital signature


[O] Adapting to orgmode 9.0: deprecated usage of (org-pdfview-open link) - howto ?

2016-11-09 Thread AW
Hi!

To display a PDF from orgmode, I'm using pdf-tools and a package called org-
pdfview. 

Code from .emacs to this end:

,
|  (eval-after-load 'org '(require 'org-pdfview))
|  (delete '("\\.pdf\\'" . default) org-file-apps)
| (add-to-list 'org-file-apps '("\\.pdf\\'" . (org-pdfview-open link)))
| (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (org-pdfview-open 
link)))
`

Error message, when trying to open a link using C-c C-o: 

,
| user-error: Please see Org News for version 9.0 about `org-file-apps'--
Error:
| Deprecated usage of (org-pdfview-open link)
`

Unfortunately I'm lacking the elisp skills to understand the hint in the Org 
News:

,
| *** ~org-file-apps~ no longer accepts S-expressions as commands
| 
| The variable now accepts functions of two arguments instead of plain
| S-expressions.  Replacing a S-expresion with an appropriate function
| is straightforward.  For example
| 
| : ("pdf" . (foo))
| 
| becomes
| 
| : ("pdf" . (lambda (file link) (foo)))
`

OK, I don't speak lisp, but I tried this in my .emacs:

,
| (add-to-list 'org-file-apps '("\\.pdf\\'" . (lambda (link)   ( org-pdfview-
open
| (add-to-list 'org-file-apps '("\\.pdf::\\(\\d+\\)\\'" . (lambda (link) (org-
pdfview-open
`

Well, error message when trying to open a link to a PDF: 

,
| user-error: Please see Org News for version 9.0 about `org-file-apps'--Lisp 
error: (lambda (link) (org-pdfview-open))
`

Maybe someone can help me to adapt the code; would appreciate much!

Regards,

Alexander



[O] DEADLINE: position in entry

2016-11-09 Thread Alan Tyree
Is this the way it should be? The first DEADLINE: shows up both as a
warning and on the due date in the agenda, but the second one does not. It
only works for me if the DEADLINE: is the first line after the heading.
Version 9, emacs 24

*** test 1
DEADLINE: <2016-11-19 Sat>

*** test 2

DEADLINE: <2016-11-19 Sat>


Thanks,
Alan


-- 
Alan L Tyreehttp://austlii.edu.au/~alan

Tel:  04 2748 6206sip:typh...@iptel.org


[O] outline-up-heading ignoring hidden levels of headings

2016-11-09 Thread Karl Voit
Hi!

Since I recently upgraded my Org-mode maint branch to 8.3.4
(release_8.3.4-1384-gc61ee8)[1], one behavior changed to a worse one.

Before:

Given an Org-mode buffer whose headings are all collapsed. When I
open a task (heading) from my agenda, the corresponding heading *and
all of its "upstream" headings* are shown as well. This way, I could
easily use C-c C-u (outline-up-heading) to go to the corresponding
father heading.

Current behavior:

Jumping to a collapsed sub-tree results in the target heading shown
but *not the "upstream headings"*. When I use C-c C-u to go to the
upper heading, I end up corresponding top heading, ignoring all the
level of headings in between. To get to a direct father heading, I
have to make Org-mode show all headings of the buffer and then, C-c
C-u is able to jump one level up.

Question:

How can I get back to the previous behavior?

Thanks!


[1] Why isn't the major version changed to 9?

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github




[O] Bug: Wrong effort sums in hierarchy when org-time-clocksum-use-effort-durations is set

2016-11-09 Thread Björn Döring
Hi,

when columns view is opened with an "%Effort{:}" column, the sum is only
correct for the first parent element. Whereas "hours" are propagated up
the hierarchy, "days" are reset to zero when going up more than one
level in the hierarchy.

Example:

* Level 1
** Level 2
*** Level 3
 Level 4
:PROPERTIES:
:Effort:   2d
:END:

In columns view (with `# -*- org-time-clocksum-use-effort-durations: t;
org-time-clocksum-format: (:days "%dd " :require-days t :hours "%d"
:require-hours t :minutes ":%02d" :require-minutes t) -*-`) this only
reports correct effort values for Level 4 and Level 3. Level 1 and Level
2 show "0d 0:00", but "2d 0:00" is expected.

Details below...

Thanks,
Björn






Emacs  : GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Package: Org mode version 9.0 (9.0-elpa @ z:/.emacs.d/elpa/org-20161102/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-link-parameters '(("id" :follow org-id-open)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link)
   ("info" :follow org-info-open :export org-info-export
:store org-info-store-link)
   ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys")
   ("file+emacs")
   ("ipynb" :follow ein:org-open :export nil)
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)
   ("file" :complete org-file-complete-link)
   ("ftp" :follow
(lambda (path) (browse-url (concat "ftp:" path
   ("help" :follow org--open-help-link)
   ("http" :follow
(lambda (path) (browse-url (concat "http:" path
   ("https" :follow
(lambda (path) (browse-url (concat "https:" path
   ("mailto" :follow
(lambda (path) (browse-url (concat "mailto:; path
   ("message" :follow
(lambda (path) (browse-url (concat "message:" path
   ("news" :follow
(lambda (path) (browse-url (concat "news:; path
   ("shell" :follow org--open-shell-link))
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-confirm-babel-evaluate nil
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-log-done 'note
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local]
   5 "\n\n(fn)"]
 org-mode-reftex-setup
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all
append local]
   5 "\n\n(fn)"]
 org-babel-result-hide-spec org-babel-hide-all-hashes
 turn-on-flyspell turn-on-auto-fill)
 org-src-preserve-indentation t
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-startup-indented t
 org-agenda-files '("~/org/tasks.org")
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 )