Re: [O] can't get org-mode noweb tangle to work

2017-11-24 Thread Martin Alsinet
Hello Charlie:

I have found that I like better to use a combination of tangle and import
instead of noweb syntax.

#+BEGIN_SRC python :tangle board.py
def init_board(args)
return [[-1 for x in range(3)] for y in range(3)]
#+END_SRC

#+BEGIN_SRC python
import sys
import os
from board import init_board

def main(args):
init_board(args)

if __name__ == "__main__":
main(sys.argv)
#+END_SRC

Then, you do a *M-x org-babel-tangle* and org will write the first block
into board.py. Then you go into the second block and run it with *C-c C-c* and
it will load the init_board function from the tangled file.

Writing it this way forces you to modularize your code blocks to be able to
call them from other blocks and you can even build your whole application
tangling the source blocks into files.

The :noweb syntax seems to me to be a templating solution used for a code
module problem.

I hope it helps you


Martin

On Fri, Nov 24, 2017 at 7:52 PM Charles R (Charlie) Martin <
chasrmar...@gmail.com> wrote:

> Grumble. Okay, this is sorted/ There are amazing numbers of
> not-quite-right examples on the web.
>
> Thanks, Tom, I now have the below, which works.
>
> #+TITLE: Console Tic Tac Toe
> #+SUBTITLE: A Literate Program in EMACS Org-Mode
> #+AUTHOR: Charlie Martin
> #+STARTUP: showall
>
> #+BEGIN_SRC python :tangle yes :noweb yes
>   import sys
>   import os
>
>   def main(args):
>   <>
>
>   if __name__ == "__main__":
>   main(sys.argv)
> #+END_SRC
>
> #+NAME: initialize-the-game-board
> #+BEGIN_SRC python
>   board = [[-1 for x in range(3)] for y in range(3)]
> #+END_SRC
>
>
>
>
> On Fri, Nov 24, 2017 at 5:26 PM, Thomas S. Dye  wrote:
>
>> Aloha Charlie,
>>
>> Charles R (Charlie) Martin writes:
>>
>> > I'm trying to get literate programming with `:noweb` syntax working in
>> > org-mode. I think I'm down to about the minimum case:
>> >
>> > #+TITLE: Console Tic Tac Toe
>> > #+SUBTITLE: A Literate Program in EMACS Org-Mode
>> > #+AUTHOR: Charlie Martin
>> > #+STARTUP: showall
>> >
>> > #+BEGIN_SRC python :tangle yes :noweb
>> >   import sys
>> >   import os
>> >
>> >   def main(args):
>> >   <>
>> >
>> >   if __name__ == "__main__":
>> >   main(sys.argv)
>> > #+END_SRC
>> >
>> > #+NAME: initialize-the-game-board
>> > #+BEGIN_SRC python :tangle yes :noweb
>> >   board = [[-1 for x in range(3)] for y in range(3)]
>> > #+END_SRC
>> >
>> > but when I tangle it I get:
>> >
>> > import sys
>> > import os
>> >
>> > def main(args):
>> > <>
>> >
>> > if __name__ == "__main__":
>> > main(sys.argv)
>> >
>> > board = [[-1 for x in range(3)] for y in range(3)]
>> >
>> > I've tried permuting the argument, flags, and so on to no avail.
>> >
>> > EMACS version is 25.3.1 MacOS, org-mode 9.1.3
>>
>> I think it should be :noweb yes
>>
>> hth,
>> Tom
>>
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>>
>
>


[O] fr: next-error for agenda

2017-11-24 Thread Samuel Wales
i'd like next-error to operate on agenda matches.  if any are marked,
then those.

then you can edit the outline without returning to the agenda.

good idea?  bad idea?



Re: [O] can't get org-mode noweb tangle to work

2017-11-24 Thread Charles R (Charlie) Martin
Grumble. Okay, this is sorted/ There are amazing numbers of not-quite-right
examples on the web.

Thanks, Tom, I now have the below, which works.

#+TITLE: Console Tic Tac Toe
#+SUBTITLE: A Literate Program in EMACS Org-Mode
#+AUTHOR: Charlie Martin
#+STARTUP: showall

#+BEGIN_SRC python :tangle yes :noweb yes
  import sys
  import os

  def main(args):
  <>

  if __name__ == "__main__":
  main(sys.argv)
#+END_SRC

#+NAME: initialize-the-game-board
#+BEGIN_SRC python
  board = [[-1 for x in range(3)] for y in range(3)]
#+END_SRC




On Fri, Nov 24, 2017 at 5:26 PM, Thomas S. Dye  wrote:

> Aloha Charlie,
>
> Charles R (Charlie) Martin writes:
>
> > I'm trying to get literate programming with `:noweb` syntax working in
> > org-mode. I think I'm down to about the minimum case:
> >
> > #+TITLE: Console Tic Tac Toe
> > #+SUBTITLE: A Literate Program in EMACS Org-Mode
> > #+AUTHOR: Charlie Martin
> > #+STARTUP: showall
> >
> > #+BEGIN_SRC python :tangle yes :noweb
> >   import sys
> >   import os
> >
> >   def main(args):
> >   <>
> >
> >   if __name__ == "__main__":
> >   main(sys.argv)
> > #+END_SRC
> >
> > #+NAME: initialize-the-game-board
> > #+BEGIN_SRC python :tangle yes :noweb
> >   board = [[-1 for x in range(3)] for y in range(3)]
> > #+END_SRC
> >
> > but when I tangle it I get:
> >
> > import sys
> > import os
> >
> > def main(args):
> > <>
> >
> > if __name__ == "__main__":
> > main(sys.argv)
> >
> > board = [[-1 for x in range(3)] for y in range(3)]
> >
> > I've tried permuting the argument, flags, and so on to no avail.
> >
> > EMACS version is 25.3.1 MacOS, org-mode 9.1.3
>
> I think it should be :noweb yes
>
> hth,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>


Re: [O] can't get org-mode noweb tangle to work

2017-11-24 Thread Thomas S. Dye
Aloha Charlie,

Charles R (Charlie) Martin writes:

> I'm trying to get literate programming with `:noweb` syntax working in
> org-mode. I think I'm down to about the minimum case:
>
> #+TITLE: Console Tic Tac Toe
> #+SUBTITLE: A Literate Program in EMACS Org-Mode
> #+AUTHOR: Charlie Martin
> #+STARTUP: showall
>
> #+BEGIN_SRC python :tangle yes :noweb
>   import sys
>   import os
>
>   def main(args):
>   <>
>
>   if __name__ == "__main__":
>   main(sys.argv)
> #+END_SRC
>
> #+NAME: initialize-the-game-board
> #+BEGIN_SRC python :tangle yes :noweb
>   board = [[-1 for x in range(3)] for y in range(3)]
> #+END_SRC
>
> but when I tangle it I get:
>
> import sys
> import os
>
> def main(args):
> <>
>
> if __name__ == "__main__":
> main(sys.argv)
>
> board = [[-1 for x in range(3)] for y in range(3)]
>
> I've tried permuting the argument, flags, and so on to no avail.
>
> EMACS version is 25.3.1 MacOS, org-mode 9.1.3

I think it should be :noweb yes

hth,
Tom

--
Thomas S. Dye
http://www.tsdye.com



[O] can't get org-mode noweb tangle to work

2017-11-24 Thread Charles R (Charlie) Martin
I'm trying to get literate programming with `:noweb` syntax working in
org-mode. I think I'm down to about the minimum case:

#+TITLE: Console Tic Tac Toe
#+SUBTITLE: A Literate Program in EMACS Org-Mode
#+AUTHOR: Charlie Martin
#+STARTUP: showall

#+BEGIN_SRC python :tangle yes :noweb
  import sys
  import os

  def main(args):
  <>

  if __name__ == "__main__":
  main(sys.argv)
#+END_SRC

#+NAME: initialize-the-game-board
#+BEGIN_SRC python :tangle yes :noweb
  board = [[-1 for x in range(3)] for y in range(3)]
#+END_SRC

but when I tangle it I get:

import sys
import os

def main(args):
<>

if __name__ == "__main__":
main(sys.argv)

board = [[-1 for x in range(3)] for y in range(3)]

I've tried permuting the argument, flags, and so on to no avail.

EMACS version is 25.3.1 MacOS, org-mode 9.1.3


[O] Org alerts on osx

2017-11-24 Thread Cody Goodman
I tried using org alerts on osx but kept running into dbus errors. So I'm
curious, does anyone have org alerts working on osx? Preferably something
free I can install on work and home computers.


Re: [O] org-mode alarms

2017-11-24 Thread Samuel Wales
appt in emacs can do a bunch and is integrated.  i use it.

there are various notify programs that i have not gotten to work.

i use crontab updated in a single babel block to run ddccontrol and
redshift.  this is useful for executive function.  you make the screen
unusable until you have taken medicine or whatever.  then you turn off
the monitor with ddccontrol so that its backlight doesn't further
disrupt your melatonin.  [no amount of dimming achieves that with
today's panel tech at my monitor size.]

-- 
The Kafka Pandemic: 

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

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



[O] Bug: Dead links from clocking tables to other org files in HTML export [9.1.3 (9.1.3-2-g322612-elpa @ /home/mrhn/.emacs.d/elpa/org-20171120/)]

2017-11-24 Thread Martin Hans
When exporting my project with org-publish, the exporter generates
anchors with names such as "orga79e495" and refers to them when linking
to the headers from other files. However, the generated anchor names
don't match between files, resulting in all links being dead.

Furthermore, the publishing directory is not respected, so all links
still point to the directory that the org file was in, even though the
html files are located elsewhere.

Example:

I have put the files needed to reproduce this at
https://gist.github.com/martinhansdk/f81a5fdf340eab591e6df55645cfd22d
They can be viewed there or fetched with git:

git clone https://gist.github.com/martinhansdk/
f81a5fdf340eab591e6df55645cfd22d

Run emacs -Q -l minimal-org.el

Then export with M-x org-publish org

I get files in the exported/ subdirectory.

The last link in the clocking table in exported/time.html is

Worked on supporting ä, ö, and ü

But that should have been

Worked on supporting ä, ö, and ü

Note that both the path is absolute where it should have been relative
and the anchor is wrong.

As far as I can tell, both problems stem from the fact that the links in
the clocking table are absolute file system links. This is, however how
the clock table code (org-dblock-update) formats the table. If I
manually transform the links in time.org to manual links, then the HTML
links are no longer dead.


As an aside, is there any way to prevent the following line from
appearing in the exported HTML?

#+BEGIN: clocktable :scope agenda :link t :maxlevel 5


Thanks,
  Martin


Emacs  : GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-12 on hullmann, modified by Debian
Package: Org mode version 9.1.3 (9.1.3-2-g322612-elpa @
/home/mrhn/.emacs.d/elpa/org-20171120/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-link-file-path-type 'relative
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-
default-function
 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-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn ## CONTENTS)"]
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 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 '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-block-all append
local] 5
   "\n\n(fn)"]
 #[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)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-
default-function
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-html-format-headline-function 'org-html-format-headline-
default-function
 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")
   ("doi" :follow org--open-doi-link)
   ("elisp" :follow org--open-elisp-link)

[O] org-mode alarms

2017-11-24 Thread ma3434tt
What are good ways of setting up alarms for Deadlines and Scheduling in 
org-mode to integrate with Windows or GNU/Linux environments?

Thanks,

Matt

[O] schedule third last day of every month

2017-11-24 Thread ma3434tt
Hi,

Can it be possible to schedule third last day of every month?

Thanks,

Matt

[O] next business day

2017-11-24 Thread ma3434tt
Hi,

When an event falls on a non-business day like a weekend day or bank holiday, 
can there be a way to set the event on the next business day

Thanks,

Matt

Re: [O] mirror text in same/other org buffer

2017-11-24 Thread Kaushal Modi
On Fri, Nov 24, 2017, 1:30 AM Xebar Saram  wrote:

> Ok found the answer "hidden" away in a org manual page.. :)
>
> The solution it so to use ':noweb-ref NAME' as an argument in the drawer
>

Yes. I actually prefer to use that method. You need the #+NAME style block
naming only when you want to call a Noweb block with an argument.

sorry for the noise
>

No worries.

> --

Kaushal Modi


Re: [O] Status of org-babel lua / ob-lua.el

2017-11-24 Thread Jakob Simeth
Aaah, that is an embarrassingly simple solution. It seems that this option is
default in most of the other org-babel languages and I didn't know about
it.

Works now. Many thanks!

Jakob


Neil Jerram  writes:

> I'm completely guessing - but does it help to add :results output ?
>
> On 24 November 2017 10:06:12 GMT+00:00, Jakob Simeth  
> wrote:
>>Hi,
>>
>>I seem to have problems with lua source blocks (others are working
>>fine): When evaluating a simple block like
>>
>>#+BEGIN_SRC lua
>>print("Hello world!")
>>#+END_SRC
>>
>>I get an empty RESULT block, and the message "evaluation complete".
>>I am running org-9.1.3 (within the spacemacs org layer).
>>
>>Is lua still officially supported? ob-lua.el seems to be part of
>>org-plus-contrib and lua is listed on
>>http://orgmode.org/org.html#Languages
>>
>>However, not on
>>http://orgmode.org/worg/org-contrib/babel/languages.html
>>
>>Is there a way to "debug" this?
>>
>>Thank you,
>>Jakob
>>
>>
>>-- 
>>Jakob Simeth
>>===
>>GPG:   AD0B55F959F83D14C6CA28153BE2F106425CBE4E


-- 
Jakob Simeth
===
GPG:   AD0B55F959F83D14C6CA28153BE2F106425CBE4E


signature.asc
Description: PGP signature


Re: [O] Status of org-babel lua / ob-lua.el

2017-11-24 Thread Neil Jerram
I'm completely guessing - but does it help to add :results output ?

On 24 November 2017 10:06:12 GMT+00:00, Jakob Simeth  
wrote:
>Hi,
>
>I seem to have problems with lua source blocks (others are working
>fine): When evaluating a simple block like
>
>#+BEGIN_SRC lua
>print("Hello world!")
>#+END_SRC
>
>I get an empty RESULT block, and the message "evaluation complete".
>I am running org-9.1.3 (within the spacemacs org layer).
>
>Is lua still officially supported? ob-lua.el seems to be part of
>org-plus-contrib and lua is listed on
>http://orgmode.org/org.html#Languages
>
>However, not on
>http://orgmode.org/worg/org-contrib/babel/languages.html
>
>Is there a way to "debug" this?
>
>Thank you,
>Jakob
>
>
>-- 
>Jakob Simeth
>===
>GPG:   AD0B55F959F83D14C6CA28153BE2F106425CBE4E


[O] Status of org-babel lua / ob-lua.el

2017-11-24 Thread Jakob Simeth
Hi,

I seem to have problems with lua source blocks (others are working
fine): When evaluating a simple block like

#+BEGIN_SRC lua
print("Hello world!")
#+END_SRC

I get an empty RESULT block, and the message "evaluation complete".
I am running org-9.1.3 (within the spacemacs org layer).

Is lua still officially supported? ob-lua.el seems to be part of
org-plus-contrib and lua is listed on
http://orgmode.org/org.html#Languages

However, not on
http://orgmode.org/worg/org-contrib/babel/languages.html

Is there a way to "debug" this?

Thank you,
Jakob


-- 
Jakob Simeth
===
GPG:   AD0B55F959F83D14C6CA28153BE2F106425CBE4E


signature.asc
Description: PGP signature