Re: [O] Executing org shell blocks on remote machine over ssh

2014-11-18 Thread David Bjergaard
Ista Zahn  writes:

> On Tue, Nov 18, 2014 at 10:43 AM, Brett Viren  wrote:
>> David Bjergaard  writes:
>>
>>> I use org mode as a lab notebook.  I write org-src blocks to keep track
>>> of tasks I do at the command line, and then I copy paste them into the
>>> terminal.  I would really like to hit "C-c C-c" on the source block and
>>> have it executed on the remote machine.  I know that you can specify
>>> the remote machine according to [1], however the software I use requires
>>> a fairly complicated setup to get going.
>>
>> Is it just complicated, or is it also prohibitively long-running?
>>
>> If just the former, you could maybe bundle the setup into some shell
>> script and source it in each of your sh source blocks.  Eg:
>>
>> #+BEGIN_SRC sh :results output :dir /ssh:lycastus:/home/bviren
>>   /bin/pwd
>>   echo $HOSTNAME
>>   ls -l foo.sh
>>   echo "---"
>>   cat foo.sh
>>   echo "---"
>>   source ./foo.sh
>>   echo $FOO
>> #+END_SRC
>>
>> #+RESULTS:
>> : /home/bviren
>> : lycastus
>> : -rw-rw-r-- 1 bviren bviren 16 Nov 18 10:27 foo.sh
>> : ---
>> : export FOO=bar
>> :
>> : ---
>> : bar
>>
>>
>>
>> If the setup is purely environmental, and it takes a long time to
>> perform, maybe you could do the set up once and then cache the resulting
>> environment using the output of "env".
>
> I guess I'm missing something (like why the OP want's to run a shell
> in a separate window), but why not just
>
> #+BEGIN_SRC sh :results output :dir /ssh:lycastus:/home/bviren :session 
> *shell*
>   /bin/pwd
>   echo $HOSTNAME
>   ls -l foo.sh
>   echo "---"
>   cat foo.sh
>   echo "---"
>   source ./foo.sh
>   echo $FOO
> #+END_SRC
>
> ?
>
> Best,
> Ista
>>
>>
>> -Brett.
Hi Ista, Brett,

Thanks for the hints, I'll try these. 
Some clarification:
>> If the setup is purely environmental, and it takes a long time to
>> perform, maybe you could do the set up once and then cache the resulting
>> environment using the output of "env".
Unfortunately it takes a long time to set up, and its complicated (I
have to initialize different versions of the software depending on
which project I'm working on.) It can take up to 10 seconds to restore a
saved environment, and it takes some setting up bootstrap the
restoration command.
> I guess I'm missing something (like why the OP want's to run a shell
> in a separate window), but why not just
I want the separate window because once the environment is set up, I
also jump around a lot.  I record the pieces of shell script that are
important for reproducing results in the notebook.  The snippets are
then recycled across many sessions, and different pieces are used at
different times (some are even used with different pieces of software).

What I would like is to log into the remote machine, set up the
software, and then have a way to tell emacs to send the org-src block to
the set up environment so that I can build up the parts I need at that
moment.  

I know this is working "against the grain" of the literate programming
paradigm where the document and the source code are coupled, and
tangling the document produces a program that can be executed.  I'm just
wondering if its possible.  If not that's fine.  Really I'm just trying
to save myself a copy-paste (and the associated issues with it getting
recorded in my .bash_history).

Cheers,

Dave



[O] Executing org shell blocks on remote machine over ssh

2014-11-17 Thread David Bjergaard
Hi All,

I'm sorry if this has been covered before, I've been searching for a
while and haven't found anything.

I use org mode as a lab notebook.  I write org-src blocks to keep track
of tasks I do at the command line, and then I copy paste them into the
terminal.  I would really like to hit "C-c C-c" on the source block and
have it executed on the remote machine.  I know that you can specify
the remote machine according to [1], however the software I use requires
a fairly complicated setup to get going.  

Ideally what I would have is my org-src blocks and another window with
the ssh terminal open.  Then hitting "C-c C-c" would execute the block
over a shared ssh connection and I could see the results in the other
window (quasi-interactively).  Is that possible?

Thanks for your time!

Dave

Footnotes: 
[1]  http://home.fnal.gov/~neilsen/notebook/orgExamples/org-examples.html#sec-16




Re: [O] [ANN] Merge of new export framework on Wednesday

2013-02-04 Thread David Bjergaard

Detlef Steuer  writes:

> Hi Nicolas!
>
> Great news and I'm really looking forward using the new exporter, but:
>
>
>> 
>>   3. Export section from Org manual is now obsolete.  It is being
>>  rewritten, but until this task is completed, your best source of
>>  information will still be the ML or the source files.
>> 
>> 
>
> I rely on orgmode for my homepage at work. If that stops just working
> without helping documentation that's "no good", at least for me ... 
>
> Is there already a draft of docs available? 
>
> One point to pull me over from vim to emacs was the fantastic documentation of
> orgmode. Now I'm sitting here a bit fearful of losing the great tool
> for an undetermined period of time. 
>
> If there are no docs at all I, as a simple user, would suggest to
> postpone the release till after some usage notes are available. 
>
> Alternatively keep the old exporter alive , please, till the new one
> has documentation. (or the migration path has documentation) 
>
> Anyway thanks for all your work!
>
> Just 2c
> Detlef

Hi Detlef,

If you rely on org-mode for some production-level things, wouldn't it be
most prudent to wait until the new exporter was shipped and fully tested
before migrating your work setup?  You'll still have all the
documentation for the older version in the mean time, and once the new
documentation is written, you'll be able to migrate with fewer
problems. 

This is the whole principle that drives Debian, Debian-testing, and
Debian-unstable.

Dave



[O] Bug: HTML export using (org-narrow-to-subtree) [7.9.2+ (7.9.2+-GNU-Emacs-24-3 (commit 488eea) @ /home/dave/.emacs-lisp/packages/org-20130128/)]

2013-01-30 Thread David Bjergaard

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.

When exporting to html with (org-narrow-to-subtree) headlines deeper
than 2 levels won't get exported.  

Expected behavior: All subheadings should be exported to a level set by
headline-levels in my org init, or `H:' in the #+OPTIONS: line. 

Steps to reproduce: 
Suppose the buffer contains:
#+BEGIN_EXAMPLE
* Daily Entries
** <2013-01-14 Mon> Dated Entry 1:export:
This is exported
*** Lorem ipsom:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 

Subheadings and further nesting isn't...
 Not Exported
Still not exported...
** <2013-01-15 Tue> Another Dated entry  :export:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 
*** Not Exported
#+END_EXAMPLE

Placing the cursor at line 2 and calling (org-narrow-to-subtree) results
in:
#+BEGIN_EXAMPLE
** <2013-01-14 Mon> Dated Entry 1:export:
This is exported
*** Lorem ipsom:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 

Subheadings and further nesting isn't...
 Not Exported
Still not exported...
#+END_EXAMPLE
Then calling any of (org-export-as-html-*) results in only the "This is
exported" text, the remaining text is missing.

Cheers, 

Dave



Emacs  : GNU Emacs 24.2.91.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll 
bars)
 of 2012-12-17 on calypso
Package: Org-mode version 7.9.2+ (7.9.2+-GNU-Emacs-24-3 (commit 488eea) @ 
/home/dave/.emacs-lisp/packages/org-20130128/)

current state:
==
(setq
 org-export-preprocess-before-selecting-backend-code-hook 
'(org-beamer-select-beamer-code)
 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-export-html-after-blockquotes-hook 
'(org-special-blocks-convert-html-special-cookies)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-export-preprocess-before-normalizing-links-hook 
'(org-remove-file-link-modifiers)
 org-confirm-shell-link-function 'yes-or-no-p
 org-finalize-agenda-hook '(org-agenda-to-appt)
 org-export-latex-after-blockquotes-hook 
'(org-special-blocks-convert-latex-special-cookies)
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
   org-beamer-auto-fragile-frames
   org-beamer-place-default-actions-for-lists)
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-agenda-include-diary t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 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-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-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-export-blocks '((src org-babel-exp-src-block nil)
 (export-comment org-export-blocks-format-comment t)
 (ditaa org-export-blocks-format-ditaa nil)
 (dot org-export-blocks-format-dot nil))
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-finalize-hook '(org-agenda-to-appt)
 org-export-interblocks '((src org-babel-exp-non-block-elements))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-ditaa-jar-path 
"/usr/local/share/emacs/24.2.91/lisp/contrib/scripts/ditaa.jar"
 org-alphabetical-lists t
 org-agenda-mode-hook '((lambda nil
 (define-key org-agenda-mode-map "" (quote next-line))
   

[O] Bug when exporting as html with (org-narrow-to-subtree)

2013-01-26 Thread David Bjergaard
Hi,

I'm not sure how to file bug reports but:

When exporting to html with (org-narrow-to-subtree) headlines deeper
than 2 levels won't get exported.  

Expected behavior: All subheadings should be exported to a level set by
headline-levels in my org init, or H: in the #+OPTIONS: line. 

Steps to reproduce: 
Suppose the buffer contains:
#+BEGIN_EXAMPLE
* Daily Entries
** <2013-01-14 Mon> Dated Entry 1:export:
This is exported
*** Lorem ipsom:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 

Subheadings and further nesting isn't...
 Not Exported
Still not exported...
** <2013-01-15 Tue> Another Dated entry  :export:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 
*** Not Exported
#+END_EXAMPLE

Placing the cursor at line 2 and calling (org-narrow-to-subtree) results
in:
#+BEGIN_EXAMPLE
** <2013-01-14 Mon> Dated Entry 1:export:
This is exported
*** Lorem ipsom:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. 

Subheadings and further nesting isn't...
 Not Exported
Still not exported...
#+END_EXAMPLE
Then calling any of (org-export-as-html-*) results in only the "This is
exported" text, the remaining text is missing.

Cheers, 

Dave




Re: [O] Using Org/babel for Emacs config files

2013-01-23 Thread David Bjergaard
Hi,

> Naive question: Are there any performance issues with not being able
> to compile my config.org to config.elc as it is possible with
> config.el files?
I used an init.org file in my initialization, and as long as you haven't
recently modified your init.org, emacs won't re-tangle the org file (ie
its as if you have a config.el file that's getting loaded)  Of course,
you can set emacs up to automatically recompile the config.el file when
its generated so, there are literally no performance issues because you
can still compile elisp code to load with the exception of when you edit
your configuration.

Dave


Karl Voit  writes:

> Hi!
>
> * Jonathan Arkell  wrote:
>> I am a huge advocate of using org files and literate programming in your
>> config files.
>
> Great.
>
> I am not completely convinced to convert my config to org/babel but
> I am not oppose either. Not sure, if there are that many advantages,
> that it is worth my effort, that's all.
>
>> A few reasons why:
>>   - Makes it easy to logically group sections of your init and
>> configuration
>
> Well, this is also possible with pure elisp and comments. Folding is
> a different topic tough.
>
>>   - Agenda tags search on your initialization file?  Yes please!
>> Extremely useful for those "cross-cutting" bits.  I have tags like
>> "keybinding", "osx" and "linux", and working on others as appropriate.
>
> Hm. Interesting but I guess this is not my use-case (except for
> :keybinding:). I do use "(when (system-is-linux) ... )" and similar
> all over my configuration.
>
> Although I am a huge fan of tagging, I don't see the use when
> editing my emacs config (yet).
>
>>   - Add TODOs to your init file.
>
> I am using ~/org/mainfile.org -> "* shorts" -> "** TODO do this
> :hostname:" all the time. Also for my config tasks. No worries: I do
> see your point but I like to have all my sysadmin-tasks combined in
> "mainfile.org/shorts". So maybe this is just me.
>
>> Here is my example, but I stand on the shoulders of giants:
>>
>> https://github.com/jonnay/emagicians-starter-kit
>
> Thanks for sharing!
>
> One thing which I would appreciate would be that it is more easy to
> write documentation (including URLs; outside of elisp sections) in
> org.
>
>
> Naive question: Are there any performance issues with not being able
> to compile my config.org to config.elc as it is possible with
> config.el files?



[O] Exporting headlines as blog-posts for Jekyll

2013-01-16 Thread David Bjergaard
Hi,

I'm trying to organize my "lab" notebook with org-mode.  Its working
great for personal use, but since my research is collaborative I need to
be able to share my progress with others.  I want to be able to take a
project file that has headlines in the form:
> * <2013-01-14 Mon> Dated Entry 1   :export:
and export their contents as html to:
/path/to/jekyll/site/_posts/2013-01-14-Dated-Entry-1.html

Then Jekyll will handle the rest for parsing and building up the final
product.  My inspiration is coming from:
http://orgmode.org/worg/org-tutorials/org-jekyll.html#sec-11

I've tried this code on my file and for some reason the timestamp always
comes out as nil, but when I manually run the code, the timestamp is
properly formatted. My specific implementation is here:
https://gist.github.com/4547520

I've checked all the usual places before posting, and I can't seem to
figure out what's going wrong, any insights would be most appreciated.

Cheers,

Dave