Re: [O] Bash script to update - only make when update there?

2013-12-13 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



On 12/13/13, 01:26 , Suvayu Ali wrote:
 On Thu, Dec 12, 2013 at 10:00:22AM +0100, Rainer M Krug wrote:
 
 On 12/10/13, 21:50 , Samuel Wales wrote:
 gitpullv () { #echo \=== maybe need to grab tags head=`git 
 rev-parse --verify HEAD` echo git pull --stat --log | cat echo
  newhead=`git rev-parse --verify HEAD` if [ $newhead !=
 $head ] then git log --pretty=tformat:%s ORIG_HEAD.. | cat #
 git log --pretty=tformat:%s --graph ORIG_HEAD.. echo echo '=
 you can now do git diff ORIG_HEAD -- files pipe tee' return 0
 else return 1 fi #git gc --auto git status }
 
 Wow - and I expected a return code from git which I could simply 
 compare evaluate if there has something updated...
 
 A `git pull' without new updates, is still a successful pull.  It
 is a failure only if the remote is unreachable for some reason, or
 the pull is interrupted midway.
 

True.

Rainer

- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :   +33 - (0)9 53 10 27 44
Cell:   +33 - (0)6 85 62 59 98
Fax :   +33 - (0)9 58 10 27 44

Fax (D):+49 - (0)3 21 21 25 22 44

email:  rai...@krugs.de

Skype:  RMkrug
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSqsfnAAoJENvXNx4PUvmCZnYIAMUZWqs3tf9N8dzQ14klAnJQ
1Qq/FCqeU2ZA1n+o+QR4jjqwoo1T3uLQJkIju5Z0jJq8LLKNcI+7ENDIZ2JkjeuA
8iy/bEM27xuf1MhGQCakPsUJUPczo9gx649Za/Jqb9mghRbml3Gn2D770qdv+Pxw
pTTVe7FfXtUbwpR2M5ohlu/3wABsAAOztMxb6uf0Mr3dWrqLzbYfaENK95L13/hJ
85p99ZLXpyqCeAtC8zNnfTcC4/m+GkDI8F4AaD07w6TfdVYFzeqxZgBdn4NZJTn2
RWdZEb0XbZCvIlXzefLsHCAd+/f/GAp03krFkbWGZYNQP5e64THLZ0OBRQL7nM0=
=NhSB
-END PGP SIGNATURE-



[O] Unable to push to org-mobile

2013-12-13 Thread Dror Atariah
Today I realized that I cannot execute successfully 'org-mobile-push'. In 
particular here is the output from '*Messages*':

Creating agendas...
Agenda written to Org file /Users/drorata/Dropbox/MobileOrg/agendas.org
Creating agendas...done
Saving all Org-mode buffers...
(No files need saving)
Saving all Org-mode buffers... done
Copying files...
Writing index file...
org-mobile-create-index-file: Wrong type argument: sequencep, :grouptags

I first step I took was to update the package; now 'org-version' yields 
Org-mode version 8.2.4 (8.2.4-3-g7fe99a-elpa @ 
/Users/user/.emacs.d/elpa/org-plus-contrib-20131209/). However, problem is 
still here.

Next I don't really know what to do... I have all my emacs' settings in 
https://github.com/drorata/emacs_setup

How can I debug this problem and solve it?

Re: [O] Old style backquotes in ox-texinfo.el

2013-12-13 Thread Achim Gratz
James Harkins writes:
 $  git status
 # On branch hjh8.2

You are on your own branch, with unknown modifications.

 In toplevel form:
 ox-texinfo.el:1683:1:Warning: !! The file uses old-style backquotes !!
 This functionality has been obsolete for more than 10 years already
 and will be removed soon.  See (elisp)Backquote in the manual.

The current ox-texinfo doesn't have any backquotes, let alone old-style
ones anywhere near those lines.  How about you'd compare your branch to
the release tag and see what changes you've made:

git diff release_8.2.4


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

DIY Stuff:
http://Synth.Stromeko.net/DIY.html




[O] [babel] Bug when updating the hash: meta-lines get deleted

2013-12-13 Thread Sebastien Vauban
Hello,

When results caching is enabled, and when the hash must be updated, the
meta-lines in front of the results block are _deleted_.

Such meta-lines include:
- ATTR_LaTeX lines
- BEGIN/END_CENTER environments

ECM:

--8---cut here---start-8---
#+PROPERTY: cache yes

#+begin_src R
print(Hello)
#+end_src

#+ATTR_LaTeX: {\tiny
#+results[824ca019826a9f384bd35371065bb2418a1afedf]:
: Hello
#+ATTR_LaTeX: }
--8---cut here---end---8---

If you change the source code block (such a setting the string to
Hello2), you get the following Org buffer:

--8---cut here---start-8---
#+PROPERTY: cache yes

#+begin_src R
print(Hello2)
#+end_src

#+results[663ebd0c20f3ed9105d254971336679e44354a3e]:
: Hello2

#+ATTR_LaTeX: }
--8---cut here---end---8---

Best regards,
  Seb

-- 
Sebastien Vauban




[O] Splitting up inline LaTeX

2013-12-13 Thread Laurens Van Houtven
Hi!

I'm using org-mode with the LaTeX export to write a book. I'm having issues
with inline LaTeX citations (\cite{some label}) and glossary references
(\gls{some label}). When the label (the thing in between the curly braces)
is split across lines, the org-mode LaTeX exporter escapes the curly
braces, so I get something like:

the beginning of the line \cite\{the first part of the label
the latter part of the label\} the rest of the line

The extra escaping of the curlies makes LaTeX very unhappy. I would like to
teach org-mode that stuff like that needs to be kept together, much like
$math mode stuff$. I tried reading the manual for advice, but those are
neither inline math (so not $$ delimited) nor an environment (\begin{} and
\end{} delimited), which are the two cases that the manual covers.

thanks in advance
lvh


Re: [O] Splitting up inline LaTeX

2013-12-13 Thread John Kitchin
I would use links for this purpose, which org-mode would get right across
lines. For instance, here is a cite link:
https://github.com/jkitchin/jmax/blob/prelude/jorg-bib.el#L332

so you use cite:bibkey1,bibkey2 or [[cite:bibkey1, bibkey2]] instead of
\cite{bibkey1,bibkey2}. At export time, the link is converted to the latex
they way you need it.

The code at the link above does a lot more than that and may not be
directly suitable for what you are doing, e.g. when I click on the link, it
opens my bibtex file at the entry I clicked on, etc... See this page:
http://orgmode.org/manual/Adding-hyperlink-types.html for another example
of making your own links.

John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Fri, Dec 13, 2013 at 8:01 AM, Laurens Van Houtven _...@lvh.io wrote:

 Hi!

 I'm using org-mode with the LaTeX export to write a book. I'm having
 issues with inline LaTeX citations (\cite{some label}) and glossary
 references (\gls{some label}). When the label (the thing in between the
 curly braces) is split across lines, the org-mode LaTeX exporter escapes
 the curly braces, so I get something like:

 the beginning of the line \cite\{the first part of the label
 the latter part of the label\} the rest of the line

 The extra escaping of the curlies makes LaTeX very unhappy. I would like
 to teach org-mode that stuff like that needs to be kept together, much like
 $math mode stuff$. I tried reading the manual for advice, but those are
 neither inline math (so not $$ delimited) nor an environment (\begin{} and
 \end{} delimited), which are the two cases that the manual covers.

 thanks in advance
 lvh



Re: [O] Unable to push to org-mobile

2013-12-13 Thread Nick Dokos
Dror Atariah dror...@gmail.com writes:

 Today I realized that I cannot execute successfully 'org-mobile-push'. In 
 particular here is the output from '*Messages*':

 Creating agendas...
 Agenda written to Org file /Users/drorata/Dropbox/MobileOrg/agendas.org
 Creating agendas...done
 Saving all Org-mode buffers...
 (No files need saving)
 Saving all Org-mode buffers... done
 Copying files...
 Writing index file...
 org-mobile-create-index-file: Wrong type argument: sequencep, :grouptags

 I first step I took was to update the package; now 'org-version' yields 
 Org-mode version 8.2.4 (8.2.4-3-g7fe99a-elpa @ 
 /Users/user/.emacs.d/elpa/org-plus-contrib-20131209/). However, problem is 
 still
 here.

 Next I don't really know what to do... I have all my emacs' settings in 
 https://github.com/drorata/emacs_setup

 How can I debug this problem and solve it?

In the same way that you debug all such problems: toggle debug-on-error,
try to do org-mobile-push again and look at the resulting backtrace (or
post it so others can look at it).

A shot in the dark: what's the value of org-tag-alist?

Nick




Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Greg Troxel

Eric Schulte schulte.e...@gmail.com writes:

 Just an fyi: I had to set org-babel-sh-command to bash for this to
 work. Why is sh the default value of this variable?


 I think sh is more portable, but I guess almost any system should have
 bash as well, I've just changed this default to bash.

(Assuming you mean that you changed the default in the org sources, not
in your config files.)

Please don't, at least without discussion of the consequences of adding
a dependency that is beyond POSIX..  sh is specified by posix, and bash
is a) sometimes not present and b) behaves differently than as specified
by POSIX, leading people to write nonportable code.

If someone wants to run bash explicitly, it makes sense to have a bash
language block that they can use.  But the sh language block should be
sh.   The real point is that bash is a different language.


pgpNfOhfurkMl.pgp
Description: PGP signature


Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Eric Schulte
Greg Troxel g...@ir.bbn.com writes:

 Eric Schulte schulte.e...@gmail.com writes:

 Just an fyi: I had to set org-babel-sh-command to bash for this to
 work. Why is sh the default value of this variable?


 I think sh is more portable, but I guess almost any system should have
 bash as well, I've just changed this default to bash.

 (Assuming you mean that you changed the default in the org sources, not
 in your config files.)

 Please don't, at least without discussion of the consequences of adding
 a dependency that is beyond POSIX..  sh is specified by posix, and bash
 is a) sometimes not present and b) behaves differently than as specified
 by POSIX, leading people to write nonportable code.

 If someone wants to run bash explicitly, it makes sense to have a bash
 language block that they can use.  But the sh language block should be
 sh.   The real point is that bash is a different language.

I understand your point, but in reality I doubt there are many systems
on which people use Org-mode with code blocks and on which sh is
available but no bash is installed.

Bash is the new normal shell and I would argue is what most users expect
from a shell code block.  E.g., the default value of `shell-file-name'
used by M-x shell is /bin/bash.

It is possible to explicitly set shell code blocks to use sh.

Best,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Greg Troxel

Eric Schulte schulte.e...@gmail.com writes:

 Greg Troxel g...@ir.bbn.com writes:

 Eric Schulte schulte.e...@gmail.com writes:

 Just an fyi: I had to set org-babel-sh-command to bash for this to
 work. Why is sh the default value of this variable?

 I think sh is more portable, but I guess almost any system should have
 bash as well, I've just changed this default to bash.

 (Assuming you mean that you changed the default in the org sources, not
 in your config files.)

 Please don't, at least without discussion of the consequences of adding
 a dependency that is beyond POSIX..  sh is specified by posix, and bash
 is a) sometimes not present and b) behaves differently than as specified
 by POSIX, leading people to write nonportable code.

 If someone wants to run bash explicitly, it makes sense to have a bash
 language block that they can use.  But the sh language block should be
 sh.   The real point is that bash is a different language.

 I understand your point, but in reality I doubt there are many systems
 on which people use Org-mode with code blocks and on which sh is
 available but no bash is installed.

That may be true on some flavors of Linux, but on BSDs:

  bash is not the normal shell (and is not part of the base system, at
  least on NetBSD, and I think that's still true on the others).  When
  it does exist it's not in /bin.
  
  It's not so odd to have a system without bash.

I am also under the impression that Debian does not use bash as the
/bin/sh.

org, like anything else, should be OS-agnostic, and follow open
standards whenever that's at all reasonable.

 Bash is the new normal shell and I would argue is what most users expect
 from a shell code block.

I find that pretty astounding.  In a block labeled sh it is obvious that
a shell conforming to the POSIX sh standard is expected, and it's not so
different from a file with #!/bin/sh.  Users who expect bash in a
block labeled sh are wrong, although I agree that many people have been
misled this way by the culture of using test == in a file that starts
#!/bin/sh.

The real issue is that org files that actually expect bash (test ==,
etc.)  become nonportable to other environments.  If someone is writing
a script and not intending to use beyond-posix features, it's harmful to
let them work (in cases where they are published).

  E.g., the default value of `shell-file-name' used by M-x shell is
 /bin/bash.

I just checked on my system (NetBSD 6 i386, emacs 23.4.1), and
shell-file-name is documented to inherit from SHELL if present, which it
does.  It's /bin/sh if SHELL is unset, which complies with the
documentation:

  *File name to load inferior shells from.
  Initialized from the SHELL environment variable, or to a system-dependent
  default if SHELL is not set.

which doesn't promise bash (or even a Bourne-style shell!).  (The emacs
package doesn't depend on the bash package.)  But shell-file-name is
about giving the user of emacs their shell, not using a particular
programming language, so this fuzz is fine.

 It is possible to explicitly set shell code blocks to use sh.

Sure, but that wasn't my point; it's the encouragement of nonportability
that is problematic.

I should point out that I'm not a bash hater --- I actually use it as my
interactive shell, and have done so since around 1990.  But I don't
write scripts in it.

Greg


pgpur7V6RXauX.pgp
Description: PGP signature


Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Eric Schulte

 I understand your point, but in reality I doubt there are many systems
 on which people use Org-mode with code blocks and on which sh is
 available but no bash is installed.

 That may be true on some flavors of Linux, but on BSDs:

   bash is not the normal shell (and is not part of the base system, at
   least on NetBSD, and I think that's still true on the others).  When
   it does exist it's not in /bin.
   
   It's not so odd to have a system without bash.

 I am also under the impression that Debian does not use bash as the
 /bin/sh.

 org, like anything else, should be OS-agnostic, and follow open
 standards whenever that's at all reasonable.

 Bash is the new normal shell and I would argue is what most users expect
 from a shell code block.

 I find that pretty astounding.  In a block labeled sh it is obvious that
 a shell conforming to the POSIX sh standard is expected, and it's not so
 different from a file with #!/bin/sh.  Users who expect bash in a
 block labeled sh are wrong, although I agree that many people have been
 misled this way by the culture of using test == in a file that starts
 #!/bin/sh.

 The real issue is that org files that actually expect bash (test ==,
 etc.)  become nonportable to other environments.  If someone is writing
 a script and not intending to use beyond-posix features, it's harmful to
 let them work (in cases where they are published).


Points well made, I was not aware of the BSD default.

Although purely semantically, in my opinion the sh in #+begin_src sh
indicates generic shell-script, not the POSIX sh.  E.g., there is no
ob-bash.el or ob-csh.el.

See the first line in ob-sh.el,

,
| ;;; ob-sh.el --- org-babel functions for shell evaluation
`


  E.g., the default value of `shell-file-name' used by M-x shell is
 /bin/bash.

 I just checked on my system (NetBSD 6 i386, emacs 23.4.1), and
 shell-file-name is documented to inherit from SHELL if present, which it
 does.  It's /bin/sh if SHELL is unset, which complies with the
 documentation:

   *File name to load inferior shells from.
   Initialized from the SHELL environment variable, or to a system-dependent
   default if SHELL is not set.

 which doesn't promise bash (or even a Bourne-style shell!).  (The emacs
 package doesn't depend on the bash package.)  But shell-file-name is
 about giving the user of emacs their shell, not using a particular
 programming language, so this fuzz is fine.


And this is where we disagree.  Sh code blocks don't currently promise
POSIX sh, they promise a shell.  This is certainly a much more dangerous
generalization than say Perl code blocks possibly using Perl 5 or 6.

How about the following resolution?  We rename ob-sh.el to ob-shell.el.
New shell code blocks could use the value of the
`org-babel-sh-command' environment variable.  Then sh, bash, zsh, csh,
ash, dash (am I missing any other common ones) use the specific shell
specified.

What do you think?

In the mean time, I don't believe the change in default value for
`org-babel-sh-command' has been included in any maintenance releases, so
I've just reverted this to minimize any further confusion.


 It is possible to explicitly set shell code blocks to use sh.

 Sure, but that wasn't my point; it's the encouragement of nonportability
 that is problematic.

 I should point out that I'm not a bash hater --- I actually use it as my
 interactive shell, and have done so since around 1990.  But I don't
 write scripts in it.


And I should say that I've argued the same point your making myself in
the past (on a project making the much more serious error of using bash
notation  in a shell script starting with #!/bin/sh).  I think we
only disagree on the current meaning of sh in code blocks, which
hopefully the suggestion above will rectify.

Best,


 Greg

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Achim Gratz
Eric Schulte writes:
 I understand your point, but in reality I doubt there are many systems
 on which people use Org-mode with code blocks and on which sh is
 available but no bash is installed.

You might want to widen your horizon on the many systems front a bit.
The typical BSD system has no Bash at all and Debian specifically avoids
the use of any bashisms in any system related scripts in order to be
able to use something else but Bash as /bin/sh… and this is just talking
about the UN*Xoid part of the world.

 Bash is the new normal shell and I would argue is what most users expect
 from a shell code block.

Or mksh or fish or whatever is the shiny new shell thing of today.
While we are inventing statistics, I would argue that most users have no
idea what a shell is and that there are different kinds of those.


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




[O] [PATCH] make vanilla: run Emacs -Q with this Org loaded

2013-12-13 Thread schulte.eric
I think this change could make it easier to reproduce problems with
Org-mode loaded and without the user's personal config loaded.

Thoughts?

---
 Makefile  |  1 +
 mk/default.mk | 13 +
 2 files changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index f95bcb2..ce06116 100644
--- a/Makefile
+++ b/Makefile
@@ -30,6 +30,7 @@ help helpall::
$(info make single - build Org ELisp files, single Emacs per 
source)
$(info make autoloads  - create org-loaddefs.el to load Org 
in-place)
$(info make test   - build Org ELisp files and run test suite)
+   $(info make vanilla- run Emacs with this Org-mode and no 
personal config)
 helpall::
$(info make test-dirty - check without building first)
$(info make compile-dirty  - build only stale Org ELisp files)
diff --git a/mk/default.mk b/mk/default.mk
index 886efc6..54148be 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -72,6 +72,19 @@ BTEST= $(BATCH) \
  $(foreach req,$(BTEST_EXTRA),$(req-extra)) \
  --eval '(org-test-run-batch-tests org-test-select-re)'
 
+# Running a plain emacs with no config and this Org-mode loaded.  This
+# should be useful for testing and for manually verrifying problems.
+MINI = $(EMACS) -Q \
+ --eval '(add-to-list '''load-path (concat default-directory 
lisp))' \
+ --eval '(setq org-babel-load-languages \
+ (quote ($(foreach ob-lang,$(BTEST_OB_LANGUAGES) emacs-lisp sh 
org,$(lst-ob-lang \
+ )' \
+ -l org-loaddefs.el -l cl -l org -l ox -f org-version
+
+.PHONY: minimal
+vanilla:
+   $(MINI) 
+
 # Using emacs in batch mode.
 # BATCH = $(EMACS) -batch -vanilla # XEmacs
 BATCH  = $(EMACS) -batch -Q \
-- 
1.8.5.1




[O] first step of newbe: *TODO

2013-12-13 Thread Renato

Hi,
as I already told, I'm a really newbe (to org-mode, as well as emacs)
I'm starting from the very beginning:
following the Doc (here: 
http://orgmode.org/worg/org-tutorials/orgtutorial_dto.html)

I wrote my firs TODO list.
But when I press C-c C-t over a TODO element, it appear DONE, write near 
the task, but not the CLOSED [time...] on the line after that.


What I have to do?

TIA

Renato

ps
sorry, for the stupid question, but it is really my very firs experimet :-(



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Eric Schulte

 How about the following resolution?  We rename ob-sh.el to ob-shell.el.
 New shell code blocks could use the value of the
 `org-babel-sh-command' environment variable.  Then sh, bash, zsh, csh,
 ash, dash (am I missing any other common ones) use the specific shell
 specified.


The attached patches make this change and continue to pass the entire
test suite.  The problem being that with ob-sh, no longer present many
users may have to change their configuration and possible the value of
their local.mk file.  One solution there is to add a dummy ob-sh.el with
a deprecation message for some transition time.  Thoughts?

From 7a6c0e35415c4a173d101336029262f3a09abb91 Mon Sep 17 00:00:00 2001
From: Eric Schulte schulte.e...@gmail.com
Date: Fri, 13 Dec 2013 09:52:05 -0700
Subject: [PATCH 1/4] multiple code block types for multiple shells

* lisp/ob-sh.el (org-babel-sh-command): Now set from
  `shell-file-name'.
  (org-babel-shell-names): List of specific shells known to Org mode
  shell code blocks.
  (org-babel-execute:shell): New generic shell execution function.
---
 lisp/ob-sh.el | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el
index 4984ff9..a115f38 100644
--- a/lisp/ob-sh.el
+++ b/lisp/ob-sh.el
@@ -38,9 +38,12 @@
 
 (defvar org-babel-default-header-args:sh '())
 
-(defvar org-babel-sh-command sh
+(defcustom org-babel-sh-command shell-file-name
   Command used to invoke a shell.
-This will be passed to  `shell-command-on-region')
+Set by default to the value of `shell-file-name'.  This will be
+passed to `shell-command-on-region'
+  :group 'org-babel
+  :type 'string)
 
 (defcustom org-babel-sh-var-quote-fmt
   $(cat 'BABEL_TABLE'\n%s\nBABEL_TABLE\n)
@@ -48,7 +51,22 @@ This will be passed to  `shell-command-on-region')
   :group 'org-babel
   :type 'string)
 
-(defun org-babel-execute:sh (body params)
+(defcustom org-babel-shell-names '(sh bash csh ash dash)
+  List of names of shell supported by babel shell code blocks.
+  :group 'org-babel
+  :type 'string
+  :initialize
+  (lambda (symbol value)
+(set-default symbol (second value))
+(mapc
+ (lambda (name)
+   (eval `(defun ,(intern (concat org-babel-execute: name)) (body params)
+		,(format Execute a block of %s commands with Babel. name)
+		(let ((org-babel-sh-command ,name))
+		  (org-babel-execute:shell body params)
+ (second value
+
+(defun org-babel-execute:shell (body params)
   Execute a block of Shell commands with Babel.
 This function is called by `org-babel-execute-src-block'.
   (let* ((session (org-babel-sh-initiate-session
-- 
1.8.5.1

From 583e7ab1757f54a656acb52ef60c6069d060cbe1 Mon Sep 17 00:00:00 2001
From: Eric Schulte schulte.e...@gmail.com
Date: Fri, 13 Dec 2013 09:54:28 -0700
Subject: [PATCH 2/4] rename ob-sh to ob-shell

---
 lisp/ob-sh.el  | 230 -
 lisp/ob-shell.el   | 230 +
 testing/lisp/test-ob-sh.el |   2 +-
 3 files changed, 231 insertions(+), 231 deletions(-)
 delete mode 100644 lisp/ob-sh.el
 create mode 100644 lisp/ob-shell.el

diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el
deleted file mode 100644
index a115f38..000
--- a/lisp/ob-sh.el
+++ /dev/null
@@ -1,230 +0,0 @@
-;;; ob-sh.el --- org-babel functions for shell evaluation
-
-;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
-
-;; Author: Eric Schulte
-;; Keywords: literate programming, reproducible research
-;; Homepage: http://orgmode.org
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see http://www.gnu.org/licenses/.
-
-;;; Commentary:
-
-;; Org-Babel support for evaluating shell source code.
-
-;;; Code:
-(require 'ob)
-(require 'shell)
-(eval-when-compile (require 'cl))
-
-(declare-function org-babel-comint-in-buffer ob-comint (buffer rest body))
-(declare-function org-babel-comint-wait-for-output ob-comint (buffer))
-(declare-function org-babel-comint-buffer-livep ob-comint (buffer))
-(declare-function org-babel-comint-with-output ob-comint (meta rest body))
-(declare-function orgtbl-to-generic org-table (table params))
-
-(defvar org-babel-default-header-args:sh '())
-
-(defcustom org-babel-sh-command shell-file-name
-  Command used to invoke a shell.
-Set by default to the value of `shell-file-name'.  This will be
-passed to `shell-command-on-region'
-  

Re: [O] Org mode and shunt exporters?

2013-12-13 Thread Brett Viren
Hi,

Nicolas Goaziou n.goaz...@gmail.com writes:

 You can walk the tree, e.g. with `org-element-map', and remove
 all :parent references if you don't need them.

I figured out how to follow this advice.  I can even make valid JSON
From the filtered parse tree by handing it to Edward O'Conner's
json.el (link in example below).

However this method only works for a very simple org document.  I'm
successfully filtering out the :parent properties of (most of) the
elements but as soon as my document produces a plain text element like:

  #(Text 0 4 (:parent #1))

then two problems occcur:

First, I'm simply failing to see how to set this :parent property to nil
like I do with the others.  

Second, json.el throws a Bad JSON Object error.  I tried assuming that
the problem was it doesn't know what to do with this substring form.
Naively, I tried to follow some other recent advice in another thread
about using substring-no-properties to strip out the meta data from the
plain text elements.  But this apparently is a net no-op as I suspect
that the org-element-set-contents then puts them right back.

I feel like I'm pretty close.  Any more advice?

Thanks,
-Brett.


#+TITLE: The Title.

Blah blah blah.

* A heading.

This uses http://edward.oconnor.cx/2006/03/json.el

 - foo
 - bar
 - baz

#+BEGIN_SRC elisp
  (require 'json)
  (let* ((tree (org-element-parse-buffer 'object nil)))
(org-element-map tree org-element-all-elements 
  (lambda (x) 
(if (org-element-property :parent x)
(org-element-put-property x :parent nil))
;; (if (eq (org-element-type x) 'plain-text)
;; (org-element-set-contents x (substring-no-properties 
;;  (org-element-contents x
))
(write-region
 ;(json-encode tree) 
 (prin1-to-string tree)
  nil foo.txt))
#+END_SRC

#+RESULTS:



pgpD3LPnqETG3.pgp
Description: PGP signature


Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Greg Troxel

Eric Schulte schulte.e...@gmail.com writes:

 Although purely semantically, in my opinion the sh in #+begin_src sh
 indicates generic shell-script, not the POSIX sh.  E.g., there is no
 ob-bash.el or ob-csh.el.

I see your point.  But stepping back, I have always felt that
#+begin_src foo referred to a language, sometimes where that language
and a particular program are inseparable (e.g. gnuplot).  But sh is a
first-class language.

 See the first line in ob-sh.el,
 ,
 | ;;; ob-sh.el --- org-babel functions for shell evaluation
 `

Sure, but that's just repeated the ambiguity :-)

 And this is where we disagree.  Sh code blocks don't currently promise
 POSIX sh, they promise a shell.  This is certainly a much more dangerous
 generalization than say Perl code blocks possibly using Perl 5 or 6.

For shell, I see that there are two concepts to detangle:

  a shell is a particular command interpreter, particularly useful for
  humans

  there are multiple shell languages, but far fewer than the number of
  interpreters.


For languages, I see

   POSIX sh
   the bash flavor of POSIX sh
   csh

While bash and POSIX sh are close, csh isn't at all close, and is only
similar in that people also use it for a shell.


In an org document, I think it's better if the result depends less on
variables not set in the document.   So a code block in a document is
really written in some language.  And it therefore makes sense to
specify that in the begin_src wrapper.

I don't see that there is any call for csh, as the received wisdom is
that one shouldn't write scripts in it (at least in modern times).  (It
was originally a BSD thing, and BSD culture is very much POSIX sh now.)

So separately from how the lisp works, I would favor

  #+begin_src sh # posix sh
  #+begin_src bash   # bash (leaving version ambiguous??)
  #+begin_src csh # csh, but not sure there's a need


 How about the following resolution?  We rename ob-sh.el to ob-shell.el.
 New shell code blocks could use the value of the
 `org-babel-sh-command' environment variable.  Then sh, bash, zsh, csh,
 ash, dash (am I missing any other common ones) use the specific shell
 specified.

Are you aware of any significant use of zsh scripts?  I see that as
POSIX sh, with spiffy user-facing features.
 In the mean time, I don't believe the change in default value for
 `org-babel-sh-command' has been included in any maintenance releases, so
 I've just reverted this to minimize any further confusion.

Thanks.  It's good to be having the larger discussion first.

 And I should say that I've argued the same point your making myself in
 the past (on a project making the much more serious error of using bash
 notation  in a shell script starting with #!/bin/sh).  I think we
 only disagree on the current meaning of sh in code blocks, which
 hopefully the suggestion above will rectify.

I forgot about , even though I type it all the time interactively
but I'm pretty careful in scripts :-)

Thanks,
Greg


pgpaZhKKxsJwo.pgp
Description: PGP signature


Re: [O] Splitting up inline LaTeX

2013-12-13 Thread Nicolas Goaziou
Hello,

Laurens Van Houtven _...@lvh.io writes:

 I'm using org-mode with the LaTeX export to write a book. I'm having issues
 with inline LaTeX citations (\cite{some label}) and glossary references
 (\gls{some label}). When the label (the thing in between the curly braces)
 is split across lines, the org-mode LaTeX exporter escapes the curly
 braces, so I get something like:

 the beginning of the line \cite\{the first part of the label
 the latter part of the label\} the rest of the line

 The extra escaping of the curlies makes LaTeX very unhappy. I would like to
 teach org-mode that stuff like that needs to be kept together, much like
 $math mode stuff$. I tried reading the manual for advice, but those are
 neither inline math (so not $$ delimited) nor an environment (\begin{} and
 \end{} delimited), which are the two cases that the manual covers.

Org doesn't support arbitrary LaTeX code. You can use export snippets:

  @@latex:\gls{some label}@@


Regards,

-- 
Nicolas Goaziou



Re: [O] Org mode and shunt exporters?

2013-12-13 Thread Brett Viren
Matt Price mopto...@gmail.com writes:

 I am pretty ignorant and may have missed a referene o this in the
 thread, but this (very outdated) code is on the emacswiki:

 http://www.emacswiki.org/emacs/org-json.el

Thanks.  My searches didn't find this.  It looks like this is parsing
the org buffer directly and only to the level of headings.  Ultimately I
want to emit JSON to get at the full detailed document structure so this
probably isn't in the direction I want to go.

-Brett.




pgp1Mae8rSsOL.pgp
Description: PGP signature


Re: [O] Org mode and shunt exporters?

2013-12-13 Thread Nicolas Goaziou
Hello,

Brett Viren b...@bnl.gov writes:

 However this method only works for a very simple org document.  I'm
 successfully filtering out the :parent properties of (most of) the
 elements but as soon as my document produces a plain text element like:

   #(Text 0 4 (:parent #1))

 then two problems occcur:

 First, I'm simply failing to see how to set this :parent property to nil
 like I do with the others.  

Like any other construct, with `org-element-put-property'.

   (let* ((tree (org-element-parse-buffer 'object nil)))
 (org-element-map tree org-element-all-elements 

You're only mapping over elements. You need to add
`org-element-all-objects' and `plain-text'.


Regards,

-- 
Nicolas Goaziou



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Sebastien Vauban
Greg Troxel wrote:
 Eric Schulte schulte.e...@gmail.com writes:

 Although purely semantically, in my opinion the sh in #+begin_src sh
 indicates generic shell-script, not the POSIX sh.  E.g., there is no
 ob-bash.el or ob-csh.el.

 I see your point.  But stepping back, I have always felt that
 #+begin_src foo referred to a language

I'd say, personally, that `foo' would refer to a mode (`foo-mode') [1]
which supports one (or multiple) language(s).

And I guess that, in Emacs, `sh' is the mode for editing Shell scripts
(in sh, bash, zsh, etc.). Though, I'm not 100% sure of what I'm saying
here...

 sometimes where that language and a particular program are inseparable
 (e.g. gnuplot). But sh is a first-class language.

 See the first line in ob-sh.el,
 ,
 | ;;; ob-sh.el --- org-babel functions for shell evaluation
 `

Best regards,
  Seb

[1] Do C-c ' and see that Org (tries to) call(s) the mode foo-mode.

-- 
Sebastien Vauban




Re: [O] first step of newbe: *TODO

2013-12-13 Thread John Kitchin
you need to put this in your init.el (or other configuration file) I think:

(setq org-log-done 'time)

or add this to the top of the org-file
#+STARTUP: logdone



John

---
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Fri, Dec 13, 2013 at 12:11 PM, Renato renato.pontef...@gmail.com wrote:

 Hi,
 as I already told, I'm a really newbe (to org-mode, as well as emacs)
 I'm starting from the very beginning:
 following the Doc (here: http://orgmode.org/worg/org-
 tutorials/orgtutorial_dto.html)
 I wrote my firs TODO list.
 But when I press C-c C-t over a TODO element, it appear DONE, write near
 the task, but not the CLOSED [time...] on the line after that.

 What I have to do?

 TIA

 Renato

 ps
 sorry, for the stupid question, but it is really my very firs experimet :-(




Re: [O] Exporting to HTML, LaTeX header is not recovered in the Org buffer

2013-12-13 Thread Mosè Giordano
Hi Nicolas,

I'm sorry for the late reply.

2013/12/3 Nicolas Goaziou n.goaz...@gmail.com:
 This should be fixed. Thank you for the detailed report.

Yes, I confirm that it's fixed now, thanks a lot!  Though, I have
another problem: the `ltxpng/' directory isn't copied when publishing
the whole project.  Do I need to setup something special?  Now I'm
running Org v8.2.4 (package 20131209 from GNU Elpa).

Bye,
Mosè



Re: [O] Org mode and shunt exporters?

2013-12-13 Thread Eric Schulte
This should work in a recent Emacs.

(require 'json)
(defun org-as-json-to-file (optional path)
  Export the current Org-mode buffer as JSON to the supplied PATH.
  (interactive Fwrite to file: )
  (let ((tree (org-element-parse-buffer)))
(org-element-map tree
(append org-element-all-objects org-element-all-elements)
  (lambda (el) (org-element-put-property el :parent nil)))
(with-temp-file path
  (insert (json-encode tree)

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Nick Dokos
Eric Schulte schulte.e...@gmail.com writes:


 How about the following resolution?  We rename ob-sh.el to ob-shell.el.
 New shell code blocks could use the value of the
 `org-babel-sh-command' environment variable.  Then sh, bash, zsh, csh,
 ash, dash (am I missing any other common ones) use the specific shell
 specified.


 The attached patches make this change and continue to pass the entire
 test suite.  The problem being that with ob-sh, no longer present many
 users may have to change their configuration and possible the value of
 their local.mk file.  One solution there is to add a dummy ob-sh.el with
 a deprecation message for some transition time.  Thoughts?



Since I'm the de facto instigator of the original change in the default,
let me add my 2 cents. I'm fine with this change (or without it). I'd be
fine with changing the org-babel-sh-command setting in my config and
leaving the default alone.

And I sympathize with Greg's wish for portability in general, although
imo it's not particularly important in this case (ducking and donning
my asbestos underwear here).

I write short scripts in org files to document some process: I can't
remember anything any longer, so putting the details in a file is the
only way for me to figure out what I did six months (or even two days)
ago (finding the file again two days hence is another matter...) In most
cases, what I put in there is some sequence of commands, which will be
interpreted correctly no matter which shell is used.  If I have anything
more complicated (non-trivial control flow, non-trivial i/o redirection,
etc etc), I put it in a script in ~/bin and invoke that in the source
code block. I may not be typical here of course, but that's why I think
that portability is not particularly important in this case - so leave
the default at sh and be done with it.

But when I tried and failed to run Eric's script in the original email,
I had to do a little digging to figure out what went wrong and how to
fix it (I don't remember running across org-babel-sh-command before
this). So I asked the question about sh and the rest is history. I
probably should have made the observation that org-babel-sh-command had
to be modified to run the code block (which was plainly true) and left
the question (which could be interpreted in various ways) out. OTOH,
there is now this discussion and presumably the end result will be
better than what we started with.

Nick

PS. I haven't tried out the patch but I plan to do so over the weekend.






Re: [O] Unable to push to org-mobile

2013-12-13 Thread Dror Atariah

On Dec 13, 2013, at 16:08 PM, Nick Dokos wrote:

 Dror Atariah dror...@gmail.com writes:
 
 Today I realized that I cannot execute successfully 'org-mobile-push'. In 
 particular here is the output from '*Messages*':
 
 Creating agendas...
 Agenda written to Org file /Users/drorata/Dropbox/MobileOrg/agendas.org
 Creating agendas...done
 Saving all Org-mode buffers...
 (No files need saving)
 Saving all Org-mode buffers... done
 Copying files...
 Writing index file...
 org-mobile-create-index-file: Wrong type argument: sequencep, :grouptags
 
 I first step I took was to update the package; now 'org-version' yields 
 Org-mode version 8.2.4 (8.2.4-3-g7fe99a-elpa @ 
 /Users/user/.emacs.d/elpa/org-plus-contrib-20131209/). However, problem is 
 still
 here.
 
 Next I don't really know what to do... I have all my emacs' settings in 
 https://github.com/drorata/emacs_setup
 
 How can I debug this problem and solve it?
 
 In the same way that you debug all such problems: toggle debug-on-error,
 try to do org-mobile-push again and look at the resulting backtrace (or
 post it so others can look at it).
I evaluated (setq debug-on-error t), and then executed org-mobile-push again. 
There was no output in the *Backtrace* buffer 

 A shot in the dark: what's the value of org-tag-alist?
The value of org-tag-alist is:

((PRIVATE . 112)
 (:startgroup)
 (WORK . 119)
 (:grouptags)
 (WORK@mittagseminar . 109)
 (WORK@open_questions . 105)
 (WORK@diss . 100)
 (WORK@CV)
 (:endgroup \.nil)
 (:startgroup)
 (IT . 73)
 (:grouptags)
 (IT@emacs)
 (IT@git)
 (IT@TeX)
 (:endgroup)
 (:startgroup)
 (PROG . 112)
 (:grouptags)
 (PROG@mathematica)
 (PROG@cgal)
 (:endgroup)
 (:endgroup)
 (4freeTime . 52))

What should be the next step?

Thanks in advance!
Dror


Re: [O] [babel] Bug when updating the hash: meta-lines get deleted

2013-12-13 Thread Eric Schulte
You should use a named code block if you want to decorate the results.

Best,

Sebastien Vauban sva-n...@mygooglest.com writes:

 Hello,

 When results caching is enabled, and when the hash must be updated, the
 meta-lines in front of the results block are _deleted_.

 Such meta-lines include:
 - ATTR_LaTeX lines
 - BEGIN/END_CENTER environments

 ECM:

 --8---cut here---start-8---
 #+PROPERTY: cache yes

 #+begin_src R
 print(Hello)
 #+end_src

 #+ATTR_LaTeX: {\tiny
 #+results[824ca019826a9f384bd35371065bb2418a1afedf]:
 : Hello
 #+ATTR_LaTeX: }
 --8---cut here---end---8---

 If you change the source code block (such a setting the string to
 Hello2), you get the following Org buffer:

 --8---cut here---start-8---
 #+PROPERTY: cache yes

 #+begin_src R
 print(Hello2)
 #+end_src

 #+results[663ebd0c20f3ed9105d254971336679e44354a3e]:
 : Hello2

 #+ATTR_LaTeX: }
 --8---cut here---end---8---

 Best regards,
   Seb

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] first step of newbe: *TODO

2013-12-13 Thread Nick Dokos
Renato renato.pontef...@gmail.com writes:

 Hi,
 as I already told, I'm a really newbe (to org-mode, as well as emacs)
 I'm starting from the very beginning:
 following the Doc (here:
 http://orgmode.org/worg/org-tutorials/orgtutorial_dto.html)
 I wrote my firs TODO list.
 But when I press C-c C-t over a TODO element, it appear DONE, write
 near the task, but not the CLOSED [time...] on the line after that.

 What I have to do?


There are two ways to get the CLOSED line:

o You can add the following line to your file:

#+STARTUP: logdone

After you do that, you have to make sure that you reinitialize the
state of the file so that org will know about it. The simplest way is
to put the cursor on the #+STARTUP line and press C-c C-c. Another way is to
close the file and reopen it.

Note that this setting will affect this particular file *only*.

o If you want the CLOSED line universally, then add the following to
your .emacs:

(setq org-log-done 'time)

Then exit emacs and start it again.

Nick






Re: [O] Unable to push to org-mobile

2013-12-13 Thread Nick Dokos
Dror Atariah dror...@gmail.com writes:

 On Dec 13, 2013, at 16:08 PM, Nick Dokos wrote:

 Dror Atariah dror...@gmail.com writes:
 
 Today I realized that I cannot execute successfully 'org-mobile-push'. In 
 particular here is the output from '*Messages*':
 
 Creating agendas...
 Agenda written to Org file /Users/drorata/Dropbox/MobileOrg/agendas.org
 Creating agendas...done
 Saving all Org-mode buffers...
 (No files need saving)
 Saving all Org-mode buffers... done
 Copying files...
 Writing index file...
 org-mobile-create-index-file: Wrong type argument: sequencep, :grouptags
 
 I first step I took was to update the package; now 'org-version' yields 
 Org-mode version 8.2.4 (8.2.4-3-g7fe99a-elpa @
 /Users/user/.emacs.d/elpa/org-plus-contrib-20131209/). However,
 problem is still
 here.
 
 Next I don't really know what to do... I have all my emacs' settings in 
 https://github.com/drorata/emacs_setup
 
 How can I debug this problem and solve it?
 
 In the same way that you debug all such problems: toggle debug-on-error,
 try to do org-mobile-push again and look at the resulting backtrace (or
 post it so others can look at it).
 I evaluated (setq debug-on-error t), and then executed org-mobile-push again. 
 There was no output in the *Backtrace* buffer 


Try deleting the org-mobile.elc file and reloading org-mobile.el. Then
try evaluating

 (let ((debug-on-error t))
  (org-mobile-push))

and see if that gives you a backtrace.

 A shot in the dark: what's the value of org-tag-alist?
 The value of org-tag-alist is:

 ((PRIVATE . 112)
  (:startgroup)
  (WORK . 119)
  (:grouptags)
  (WORK@mittagseminar . 109)
  (WORK@open_questions . 105)
  (WORK@diss . 100)
  (WORK@CV)
  (:endgroup \.nil)
  ^
This looks strange to me, although it's not clear it would cause the
problem even if it is wrong (which it may or may not be).

Nick






Re: [O] [babel] Bug when updating the hash: meta-lines get deleted

2013-12-13 Thread Sebastien Vauban
Hello Eric,

Eric Schulte wrote:
 When results caching is enabled, and when the hash must be updated, the
 meta-lines in front of the results block are _deleted_.

 You should use a named code block if you want to decorate the results.

No, as long as the lines which I do insert between the code block and
the results are of the type #+..., you _don't_ need to name the block.

Disable the caching, and see by yourself that you can insert such lines
without problems.

This is something Nicolas did a couple of months ago, to avoid having to
name all the code blocks when they are semantically followed by their
results -- that is, such #+... lines are like ignored for the update.

Best regards,
  Seb

-- 
Sebastien Vauban



Re: [O] getting gnus contcats into org-contacts

2013-12-13 Thread Nick Dokos
Sebastien Vauban sva-n...@mygooglest.com
writes:

 Eric S Fraga wrote:
 Andreas Davour ko...@yahoo.com writes:

 I've just started using gnus again, and since it seems like bbdb is in a
 messy state someone suggested I try org-contacts as an address book
 solution. It looks quite usable, but I have a few questions.

 I can't help you directly but I can say that I am using bbdb v3 from

  git://git.savannah.nongnu.org/bbdb.git

 with gnus from 

  http://git.gnus.org/gnus.git

 very effectively.  No problems at all with bbdb once I converted over
 from v2, of course.

 So do I, even if I miss some things:

 - mainly, the auto-discovery of new emails: when you receive a mail from a new
   email address but from a known sender name, bbdb2 proposed to add the email
   address in the DB; not bbdb3


I have the following in my bbdb config file and it seems to DTRT:

--8---cut here---start-8---
; add addresses automatically
(bbdb-mua-auto-update-init 'gnus 'message)
(setq bbdb-update-records-p 'create)
(setq bbdb-mua-pop-up nil)
--8---cut here---end---8---


Nick




Re: [O] Unable to push to org-mobile

2013-12-13 Thread Dror Atariah

On Dec 13, 2013, at 20:51 PM, Nick Dokos wrote:

 Dror Atariah dror...@gmail.com writes:
 
 On Dec 13, 2013, at 16:08 PM, Nick Dokos wrote:
 
 Dror Atariah dror...@gmail.com writes:
 
 Today I realized that I cannot execute successfully 'org-mobile-push'. In 
 particular here is the output from '*Messages*':
 
 Creating agendas...
 Agenda written to Org file /Users/drorata/Dropbox/MobileOrg/agendas.org
 Creating agendas...done
 Saving all Org-mode buffers...
 (No files need saving)
 Saving all Org-mode buffers... done
 Copying files...
 Writing index file...
 org-mobile-create-index-file: Wrong type argument: sequencep, :grouptags
 
 I first step I took was to update the package; now 'org-version' yields 
 Org-mode version 8.2.4 (8.2.4-3-g7fe99a-elpa @
 /Users/user/.emacs.d/elpa/org-plus-contrib-20131209/). However,
 problem is still
 here.
 
 Next I don't really know what to do... I have all my emacs' settings in 
 https://github.com/drorata/emacs_setup
 
 How can I debug this problem and solve it?
 
 In the same way that you debug all such problems: toggle debug-on-error,
 try to do org-mobile-push again and look at the resulting backtrace (or
 post it so others can look at it).
 I evaluated (setq debug-on-error t), and then executed org-mobile-push 
 again. There was no output in the *Backtrace* buffer 
 
 
 Try deleting the org-mobile.elc file and reloading org-mobile.el. Then
 try evaluating
 
 (let ((debug-on-error t))
  (org-mobile-push))
 
 and see if that gives you a backtrace.

Managed to get output... 

You can find it here: https://gist.github.com/drorata/7950857

I could not find my way in this output... :(

 A shot in the dark: what's the value of org-tag-alist?
 The value of org-tag-alist is:
 
 ((PRIVATE . 112)
 (:startgroup)
 (WORK . 119)
 (:grouptags)
 (WORK@mittagseminar . 109)
 (WORK@open_questions . 105)
 (WORK@diss . 100)
 (WORK@CV)
 (:endgroup \.nil)
  ^
 This looks strange to me, although it's not clear it would cause the
 problem even if it is wrong (which it may or may not be).
Indeed strange, and probably a typo. There was a missing space. I corrected 
this before taking the measures you mentioned above.
 
 Nick
 

Best,
Dror

Re: [O] [BUG] inline source breaks paragraphs

2013-12-13 Thread Nicolas Goaziou
Hello,

Andreas Leha andreas.l...@med.uni-goettingen.de writes:

 inline source -- when on its own line -- breaks the paragraph, which is
 unexpected.

 Here is a test file:

 * Test

 This is a broken
 src_R[:exports results :results raw]{10}
 paragraph.


 Here is (the relevant part of) the output of the LaTeX export:

 ,
 | \section{Test}
 | \label{sec-1}
 | 
 | This is a broken
 | 10
 | 
 | paragraph.
 `

The attached patch solves the problem. It may be a bit intrusive,
though.

Eric, what do you think?


Regards,

-- 
Nicolas Goaziou
From 8ec02a2fa79b8601565ca7b226b8c1e4790f3439 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou n.goaz...@gmail.com
Date: Fri, 13 Dec 2013 21:40:33 +0100
Subject: [PATCH] ob-core: Preserve paragraph when evaluating inline blocks

* lisp/ob-core.el (org-babel-insert-result): Trim whitespaces around
  results from inline source blocks.
---
 lisp/ob-core.el | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 84caed7..a6945e4 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2048,12 +2048,14 @@ code  the results are extracted in the syntax of the source
    (or ( visible-beg existing-result)
    (= visible-end existing-result
 	 beg end)
-	(when (and (stringp result)  ; ensure results end in a newline
-		   (not inlinep)
-		   ( (length result) 0)
-		   (not (or (string-equal (substring result -1) \n)
-			(string-equal (substring result -1) \r
-	  (setq result (concat result \n)))
+	;; Ensure inline results never end with a newline, but regular
+	;; results always do.
+	(cond ((not (stringp result)))
+	  (inlinep (setq result (org-babel-trim result)))
+	  ((and ( (length result) 0)
+		(not (or (string-equal (substring result -1) \n)
+			 (string-equal (substring result -1) \r
+	   (setq result (concat result \n
 	(unwind-protect
 	(progn
 	  (when outside-scope-p (widen))
-- 
1.8.5.1



Re: [O] Unable to push to org-mobile

2013-12-13 Thread Nick Dokos
Dror Atariah dror...@gmail.com writes:

 Managed to get [backtrace] output... 

 You can find it here: https://gist.github.com/drorata/7950857

 I could not find my way in this output... :(


If you look at the top of the backtrace it shows this:

,
| Debugger entered--Lisp error: (wrong-type-argument sequencep :grouptags)
| mapconcat(identity (PRIVATE { WORK :grouptags WORK@mittagseminar 
WORK@open_questions WORK@diss WORK@CV } { IT :grouptags IT@emacs 
IT@git IT@TeX } { PROG :grouptags PROG@mathematica PROG@cgal } 
} 4freeTime bms_friday emacs interesting_questions mittagseminar 
Mittagsseminar NOTE private results work Yvinec Ziegler)  )
| (insert #+TAGS:  (mapconcat (quote identity) tags  ) \n)
| ...
| org-mobile-create-index-file()
`

The mapconcat line can be evaluated on its own - it does not depend on
anything else. If you cut and paste it into your *scratch* buffer and
modify it slightly like this:

--8---cut here---start-8---
(mapconcat 'identity '(PRIVATE { WORK :grouptags WORK@mittagseminar 
WORK@open_questions WORK@diss WORK@CV } { IT :grouptags IT@emacs 
IT@git IT@TeX } { PROG :grouptags PROG@mathematica PROG@cgal } 
} 4freeTime bms_friday emacs interesting_questions mittagseminar 
Mittagsseminar NOTE private results work Yvinec Ziegler)  )
--8---cut here---end---8---

and evaluate it with C-j, you get the exact error. Now look in
org-mobile-create-index-file for the call


  (insert #+TAGS:  (mapconcat 'identity tags  ) \n)

You'll find it on line 470 (at least in the version I'm using).
Before this line there is this code:

  ...
  (setq def-tags (mapcar
  (lambda (x)
(cond ((null x) nil)
  ((stringp x) x)
  ((eq (car x) :startgroup) {)
  ((eq (car x) :endgroup) })
  ((eq (car x) :newline) nil)
  ((listp x) (car x
  def-tags))
  (setq def-tags (delq nil def-tags))
  (setq tags (org-delete-all def-tags tags))
  (setq tags (sort tags (lambda (a b) (string (downcase a) (downcase b)
  (setq tags (append def-tags tags nil))
  (insert #+TAGS:  (mapconcat 'identity tags  ) \n)
  ...

You'll notice that :startgroup is replaced by { , :endgroup is
replaced by } and :newline is deleted - but there is no mention of
:grouptags which leads me to suspect that there should be an extra
line in there, perhaps

  ((eq (car x) :grouptags) nil)

Maybe you can try it - better yet, maybe somebody who has some idea of
how org-mobile works should take a look. I note that if I delete the
:grouptags instances in the mapconcat call above, it completes without
error.

Nick




Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Achim Gratz
Eric Schulte writes:
 How about the following resolution?  We rename ob-sh.el to ob-shell.el.
 New shell code blocks could use the value of the
 `org-babel-sh-command' environment variable.  Then sh, bash, zsh, csh,
 ash, dash (am I missing any other common ones) use the specific shell
 specified.

I've also seen ksh, mksh, posh (the latter specifically for POSIX
compatibility checks).  But trying to enumerate all possible shell names
is futile, especially when the same shell dialect can have different
names on different systems and you'll only find a handful of those on
each particular system installed.  Then there are those systems where at
least two different shells exist with the same name in different paths
and you'll get one or the other depending on which way your path is set
up.

 The attached patches make this change and continue to pass the entire
 test suite.  The problem being that with ob-sh, no longer present many
 users may have to change their configuration and possible the value of
 their local.mk file.  One solution there is to add a dummy ob-sh.el with
 a deprecation message for some transition time.  Thoughts?

I'm not sure this does the right thing (if that is even possible in this
case).  It looks overcomplicated to me, anyway.

There are two sides to a shell: the programming language / scripting
part and the interactive part.  Of those shells that are somewhat POSIX
compatible, the programming language part isn't all that much different
(at least no more than, say, different C dialects).  Even csh does the
right thing with a lot of POSIX stuff and you shouldn't really use it
for serious scripting anyway.  The interactive part shouldn't really
figure into Babel, even though the particular choice will introduce one
or the other quirk in certain areas of scripting if you're not careful.

Emacs' shell-mode recognizes that ambiguity: it looks up the bang line
to decide which dialect to chose and waits for a user decision if it
can't find one.  I'd have no problem if ob-sh did the same and simply
ran with whatever it can get away with (assuming close-enough-to-POSIX)
and only chose a specific shell when asked (via bang line or otherwise).


Regards,
Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] [PATCH] make vanilla: run Emacs -Q with this Org loaded

2013-12-13 Thread Achim Gratz
schulte.e...@gmail.com writes:
 I think this change could make it easier to reproduce problems with
 Org-mode loaded and without the user's personal config loaded.

So you want $(BATCH) with -batch filtered out?  You can do that
without the code duplication.

 +   --eval '(setq org-babel-load-languages \
 +   (quote ($(foreach ob-lang,$(BTEST_OB_LANGUAGES) emacs-lisp sh 
 org,$(lst-ob-lang \
 +   )' \
 +   -l org-loaddefs.el -l cl -l org -l ox -f org-version

These are specifically needed for batch testing.  I wouldn't want to
load all of these for a minimal Emacs.

 +.PHONY: minimal
 +vanilla:

Does not match (minimal=vanilla) and targets don't belong in
default.mk.


Achim.
-- 
+[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] Org mode and shunt exporters?

2013-12-13 Thread Brett Viren
Hi Eric,

Eric Schulte schulte.e...@gmail.com writes:

 This should work in a recent Emacs.

 (require 'json)
 (defun org-as-json-to-file (optional path)
   Export the current Org-mode buffer as JSON to the supplied PATH.
   (interactive Fwrite to file: )
   (let ((tree (org-element-parse-buffer)))
 (org-element-map tree
 (append org-element-all-objects org-element-all-elements)
   (lambda (el) (org-element-put-property el :parent nil)))
 (with-temp-file path
   (insert (json-encode tree)

Thanks.  With this, Nicolas's and all the other input I've got something
working now.  There was still one small issue I found with this last
round.  The :structure property also causes an error inside json.el
like:

  json-encode-key: Bad JSON object key: 105

But, for now, nulling :structure in the same way as :parent let's me
chain org-JSON-Python!  The first elisp code block in the test doc
below works.

Thanks for all the patient help from everyone.  I've learned a lot.

-Brett.


#+TITLE: The Title.
Blah blah blah.
* A heading.
This uses http://edward.oconnor.cx/2006/03/json.el
 - foo
 - bar
 - baz
#+BEGIN_SRC elisp
  (require 'json)
  (let* ((tree (org-element-parse-buffer 'object nil)))
(org-element-map tree (append org-element-all-elements
org-element-all-objects '(plain-text))
  (lambda (x) 
(if (org-element-property :parent x)
(org-element-put-property x :parent none))
(if (org-element-property :structure x)
(org-element-put-property x :structure none))
;; (if (eq (org-element-type x) 'plain-text)
;; (org-element-set-contents x (substring-no-properties 
;;  (org-element-contents x
))
(write-region
 (json-encode tree) 
 ;(prin1-to-string tree)
  nil foo.dat))
#+END_SRC

#+RESULTS:

* From Eric Schultz
#+BEGIN_SRC elisp
  (require 'json)
  (defun org-as-json-to-file (optional path)
Export the current Org-mode buffer as JSON to the supplied PATH.
(interactive Fwrite to file: )
(let ((tree (org-element-parse-buffer)))
  (org-element-map tree
  (append org-element-all-objects org-element-all-elements)
(lambda (el) (org-element-put-property el :parent none)))
  (with-temp-file path
(insert (json-encode tree)
  (org-as-json-to-file eric.txt)
#+END_SRC

* Try some hand written data
#+BEGIN_SRC elisp
  (require 'json)
  (with-current-buffer (find-file-noselect foo.dat)
(let ((tree (read (current-buffer
  (prin1-to-string (json-encode tree
#+END_SRC



 


pgpUoNT2XJl7p.pgp
Description: PGP signature


Re: [O] [babel] Bug when updating the hash: meta-lines get deleted

2013-12-13 Thread Eric Schulte
Sebastien Vauban sva-n...@mygooglest.com writes:

 Hello Eric,

 Eric Schulte wrote:
 When results caching is enabled, and when the hash must be updated, the
 meta-lines in front of the results block are _deleted_.

 You should use a named code block if you want to decorate the results.

 No, as long as the lines which I do insert between the code block and
 the results are of the type #+..., you _don't_ need to name the block.

 Disable the caching, and see by yourself that you can insert such lines
 without problems.

 This is something Nicolas did a couple of months ago, to avoid having to
 name all the code blocks when they are semantically followed by their
 results -- that is, such #+... lines are like ignored for the update.

 Best regards,
   Seb

Alright, I just pushed up a fix for this issue.  Please let me know if
it continues to cause problems for you.

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [PATCH] make vanilla: run Emacs -Q with this Org loaded

2013-12-13 Thread Eric Schulte
Achim Gratz strom...@nexgo.de writes:

 schulte.e...@gmail.com writes:
 I think this change could make it easier to reproduce problems with
 Org-mode loaded and without the user's personal config loaded.

 So you want $(BATCH) with -batch filtered out?  

Essentially.

 You can do that without the code duplication.


Ah, I had no idea.  I see now that the filter-out command does just
this.  I'm consistently surprised at the depth of the Makefile tooling.


 +  --eval '(setq org-babel-load-languages \
 +  (quote ($(foreach ob-lang,$(BTEST_OB_LANGUAGES) emacs-lisp sh 
 org,$(lst-ob-lang \
 +  )' \
 +  -l org-loaddefs.el -l cl -l org -l ox -f org-version

 These are specifically needed for batch testing.  I wouldn't want to
 load all of these for a minimal Emacs.

 +.PHONY: minimal
 +vanilla:

 Does not match (minimal=vanilla) and targets don't belong in
 default.mk.


Okay, this last point was just a bug, I changed the name part way
through.

I've cleaned up this patch per your suggestions and just pushed a better
version up.

Thanks for the feedback,



 Achim.

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [babel] how to pass data to gnuplot from another block

2013-12-13 Thread Eric Schulte
It sounds as though most people don't particularly care which shell is
used.  However, I believe Greg is correct and the *right* thing to do is
to have specific names (bash, sh, etc...) denote specific shells.  I'd
also like #+begin_src shell to specify the don't care option.  That
is what these patches do, with relatively little churn in the code (the
one huge commit just renames a file).

I just applied these patches.  The worst case is that users may have to
change ob-sh to ob-shell in their config (although some initial
testing seems to indicate that even this change won't be required), and
possibly replace sh with shell in their local.mk file (if they have
one) to run tests at the command line.  In my mind this short-term
hassle is worth the long-term correctness.

I've just applied these patches.  At this point I'll borrow Nick's
asbestos underwear and place it on my head.

Best Regards,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



Re: [O] [BUG] inline source breaks paragraphs

2013-12-13 Thread Eric Schulte
Nicolas Goaziou n.goaz...@gmail.com writes:

 Hello,

 Andreas Leha andreas.l...@med.uni-goettingen.de writes:

 inline source -- when on its own line -- breaks the paragraph, which is
 unexpected.

 Here is a test file:

 * Test

 This is a broken
 src_R[:exports results :results raw]{10}
 paragraph.


 Here is (the relevant part of) the output of the LaTeX export:

 ,
 | \section{Test}
 | \label{sec-1}
 | 
 | This is a broken
 | 10
 | 
 | paragraph.
 `

 The attached patch solves the problem. It may be a bit intrusive,
 though.

 Eric, what do you think?


Invariably someone would then ask why the newline is being stripped from
their inline code block.

I think this is only necessary because the R code block is returning
10\n instead of 10.  Ideally this should be fixed in ob-R.el.

Best,



 Regards,

 -- 
 Nicolas Goaziou

 From 8ec02a2fa79b8601565ca7b226b8c1e4790f3439 Mon Sep 17 00:00:00 2001
 From: Nicolas Goaziou n.goaz...@gmail.com
 Date: Fri, 13 Dec 2013 21:40:33 +0100
 Subject: [PATCH] ob-core: Preserve paragraph when evaluating inline blocks

 * lisp/ob-core.el (org-babel-insert-result): Trim whitespaces around
   results from inline source blocks.
 ---
  lisp/ob-core.el | 14 --
  1 file changed, 8 insertions(+), 6 deletions(-)

 diff --git a/lisp/ob-core.el b/lisp/ob-core.el
 index 84caed7..a6945e4 100644
 --- a/lisp/ob-core.el
 +++ b/lisp/ob-core.el
 @@ -2048,12 +2048,14 @@ code  the results are extracted in the syntax of 
 the source
  (or ( visible-beg existing-result)
  (= visible-end existing-result
beg end)
 - (when (and (stringp result)  ; ensure results end in a newline
 -(not inlinep)
 -( (length result) 0)
 -(not (or (string-equal (substring result -1) \n)
 - (string-equal (substring result -1) \r
 -   (setq result (concat result \n)))
 + ;; Ensure inline results never end with a newline, but regular
 + ;; results always do.
 + (cond ((not (stringp result)))
 +   (inlinep (setq result (org-babel-trim result)))
 +   ((and ( (length result) 0)
 + (not (or (string-equal (substring result -1) \n)
 +  (string-equal (substring result -1) \r
 +(setq result (concat result \n
   (unwind-protect
   (progn
 (when outside-scope-p (widen))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



[O] (Cannot open load file org-fstree) vs (babel, windows, shell)

2013-12-13 Thread Brady Trainor
* (Cannot open load file org-fstree) vs (babel, windows, shell)



long story short, fstree strategy leads to cannot open load path, babel 
route is only explained for I believe Linux version. Ad-hoc solution with 
Windows command prompt, cut and paste directory structure. 



** org tree issues



was trying to have a view of some folder structures from within org-mode

found this: 

http://thread.gmane.org/gmane.emacs.orgmode/17527/

Saw two strategies based on two replies, will detail my attempts

*** Matt Lundin's

http://thread.gmane.org/gmane.emacs.orgmode/17527/focus=17538

Not sure what it will look like, found this image, but not sure if 
additional function will be available in fstree

http://digit.lk/old/beta5/sites/default/files/Gaveen-fstree.png

here are my attempts: 

 debugging fstree install

* first attempt

** steps taken: 

- followed directions at

  - http://thread.gmane.org/gmane.emacs.orgmode/17527/focus=17768

  - http://burtzlaff.de/org-fstree/ and

  - http://burtzlaff.de/org-fstree/README.org

that is, I used list-packages to find package and install it, 

then found location, added it to .emacs file, as displayed in following 
section

** code added to .emacs file: 

(setq load-path (cons ~\.emacs.d\elpa\org-fstree-20090723.819\org-
fstree.el load-path)) 

(require 'org-fstree)

** error report

Debugger entered--Lisp error: (file-error Cannot open load file org-
fstree)

  require(org-fstree)

  eval-buffer(#buffer  *load* nil c:/Users/user-
name/AppData/Roaming/.emacs nil t)  ; Reading at buffer position 1833

  load-with-code-conversion(c:/Users/user-
name/AppData/Roaming/.emacs c:/Users/user-name/AppData/Roaming/.emacs t 
t)

  load(~/.emacs t t)

  #[0 \205\262

* second attempt:

** download manually into:

.emacs.d

** modify load path in .emacs file

** see if there is an error on initialization

indeed, get: 



Debugger entered--Lisp error: (file-error Cannot open load file org-
fstree)

  require(org-fstree)

  eval-buffer(#buffer  *load* nil c:/Users/user-
name/AppData/Roaming/.emacs nil t)  ; Reading at buffer position 1837

  load-with-code-conversion(c:/Users/user-
name/AppData/Roaming/.emacs c:/Users/user-name/AppData/Roaming/.emacs t 
t)

  load(~/.emacs t t)

  #[0 \205\262



*** Sebastian Rose's

http://thread.gmane.org/gmane.emacs.orgmode/17527/focus=17768

 babel cmd-type attempt

problem seems to be that windows does not have same shell, so i try it 
manually next

#+begin_src sh :results output :exports results

  echo Directory structure:

  tree ~/.emacs.d/

#+end_src

 cmd line: tree /A  tree.txt

which results in (copying and pasting into environment): 

#+BEGIN_EXAMPLE

Folder PATH listing for volume something

Volume serial number is something

C:.

+---something

|   +---something

|   |   +---something

|   |   |   \---something

|   |   \---something

|   \---something

|   +---something

|   |   \---something

|   \---something

+---something



#+END_EXAMPLE

 is there any way to get this going in windows? perhaps with python or 
another language that can get to windows folder structure





** P.S. 



Why would I want to do this? As I attempt to fit my entire universe into 
this org-mode contraption I recently found, I've decided for now to leave a 
few things just outside the fort, and have a visual map of the outside file 
structure handy within org.