[O] Show presence of zero width spaces using overlay

2015-09-18 Thread Kaushal Modi
Hi all,

The suggestion to use zero width spaces to sort of "escape" stuff in org
mode has come up many times. I have started using it a lot and suggest that
to other people now.

Here is one such recent QnA on emacs.SE:
http://emacs.stackexchange.com/a/16702/115

The OP of that question made a valid point that while using zero width
spaces is convenient, it is not apparent where it has been used in the
document.

To resolve that, I am requesting a feature.

Can the zero width spaces be optionally represented with something like a
single space overlay with a colored background (like purple)?

Making this officially part of org-mode will probably make more people make
use of it.

.. Or should people use zero width spaces?


[O] [PATCH] fix SETUPFILE pathname expansion with subdirectories

2015-09-18 Thread Richard Hansen
* lisp/org.el (org--setup-collect-keywords): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

* lisp/ox.el (org-export--get-inbuffer-options): cd to the directory
containing the SETUPFILE before recursing so that relative pathnames
in the SETUPFILE are expanded properly.

If /path/to/foo.org contains:

#+SETUPFILE: settings/beamer.org

and /path/to/settings/beamer.org contains:

#+SETUPFILE: common.org

then we want to read /path/to/settings/common.org, not
/path/to/common.org.

TINYCHANGE
---
 lisp/org.el | 1 +
 lisp/ox.el  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 74fe4ae..ded3e13 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5194,6 +5194,7 @@ Return value contains the following keys: `archive', 
`category',
(org-remove-double-quotes value)
   (when (and f (file-readable-p f) (not (member f files)))
 (with-temp-buffer
+  (cd (file-name-directory f))
   (insert-file-contents f)
   (setq alist
 ;; Fake Org mode to benefit from cache
diff --git a/lisp/ox.el b/lisp/ox.el
index bfdfeba..07e5ef3 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1455,6 +1455,7 @@ Assume buffer is in Org mode.  Narrowing, if any, is 
ignored."
 ;; Avoid circular dependencies.
 (unless (member file files)
   (with-temp-buffer
+(cd (file-name-directory file))
 (insert (org-file-contents file 'noerror))
 (let ((org-inhibit-startup t)) (org-mode))
 (setq plist (funcall get-options
-- 
2.5.3




Re: [O] remote plot with local output?

2015-09-18 Thread Benda Xu
Hi,

Benda Xu  writes:

> "Charles C. Berry"  writes:
>
>> Untested, but try this :
>>
>> #+name: localize
>> #+BEGIN_SRC emacs-lisp :var file="" srcinfo=(org-babel-get-src-block-info)
>>(let* ((dir (cdr (assoc :dir (nth 2 srcinfo
>>   (rfile (concat (file-name-as-directory dir) file))
>>   (lfile (car (last (split-string rfile ":")
>>  (copy-file rfile lfile 1)
>>  lfile)
>> #+END_SRC
>>
>> then use
>>
>> #+HEADER: :post localize(*this*)
>>
>> in your python src block.
>
> It successfully extracts the :dir field.  Thanks!

Python works this way.  But babel R has a completely different *this*
value.  Consider the following example:

  #+BEGIN_SRC R :results output graphics :file line.png :dir /ipmuap02:/tmp
  plot(c(1,2,3))
  #+END_SRC

  #+RESULTS:
  [[file:/scp:ipmuap02:/tmp/line.png]]

*this* equals "[[file:/scp:ipmuap02:/tmp/line.png]]", but in babel
python *this* equals "line.png".

So I come up with

  #+name: localize
  #+BEGIN_SRC emacs-lisp :var file="" srcinfo=(org-babel-get-src-block-info)
(let ((lang (car srcinfo)))
  (cond ((string= lang "python")
 (let* ((dir (cdr (assoc :dir (nth 2 srcinfo
(rfile (concat (file-name-as-directory dir) file))
(lfile (car (last (split-string rfile ":")
   (copy-file rfile lfile 1)
   lfile))
((string= lang "R")
 (let* ((rfile (substring file 7 -2))
(lfile (car (last (split-string rfile ":")
   (copy-file rfile lfile 1)
   (concat "[[file:" lfile "]]")
  #+END_SRC

But the result is a string rather than a file link:

  #+HEADER: :post localize(*this*)
  #+BEGIN_SRC R :results output graphics :file line.png :dir /ipmuap02:/tmp
  plot(c(1,2,3))
  #+END_SRC

  #+RESULTS:
  : [[file:/tmp/line.png]]

Any hints?

Yours,
Benda



Re: [O] two sets of default header arguments for one language

2015-09-18 Thread Rainer M Krug
Nicolas Goaziou  writes:

> Rainer M Krug  writes:
>
>> That's a pity.
>>
>> It would be really great if one could define different sets of
>> hearer-args and then, at thr beginning of a code block, simply use:
>>
>> #+MACRO: forTangle  :tangle ./test.R :export none
>> #+MACRO: forExecution  :tangle no :export both :session Test14
>> #+MACRO: forNoSession  :tangle no :export both
>
> It might be great. Probably hackish too.
>
> Anyway simplicity of macros is one of its features, IMO. They are
> limited, yet useful for simple things.
>
> Fortunately, there are other ways to achieve what you want without them.
>
>> Would it be difficult to include this feature?
>
> Probably not. The most permissive model for macros is even simpler to
> implement than the current one, i.e., something like
>
>   (replace-regexp-in-string macro-regexp macro-template buffer)
>
> However macros actually follow a different paradigm, in which they are
> required to be parsed. As a consequence they cannot really break the
> structure of their container, which turns them into "safe" tools. For
> example, you can compare the model above and the current one in the
> following document
>
>   A paragraph Paragraph{{{this(arg
>   #+name: table
>   | cell | )}}}  |
>
> Your proposal in to allow them where the parser doesn't look, e.g.,
> Babel header arguments, but probably also other places (node properties,
> keywords...). It is difficult to draw a line. In any case, I'm not sure
> macros would benefit from it. Babel can already do a lot of
> destructuring in a document, not every tool needs to be as versatile as
> Babel.

Thanks for your explanations - I am not using macros regularly (not
yet...) so I was not aware of these aspects.

I was just using macros as an example - I am not advocating to change
macros if this would change something. A simpler option would be
possibly to use properties. Assuming I have the following properties defined:

,
| #+PROPERTY: headerArgsForTangline :tangle ./testfile.R
| #+PROPERTY: headerArgsForSession :tangle no :session *MyRSession*
| #+PROPERTY: headerArgsForNoSession :tangle no
`

then I could do

,
| :header-args*: headerArgsForSession 
`

and the header arguments would be set to the value of
headerArgsForSession and be ":tangle no :session *MyRSession*".

This would make it possible to define sets of header arguments for
certain aspects (one example I would use it for: creating graphs and
define the width and height properties. Depending if I want portrait or
landscape graphs, I would use the one or the other property and they
could be ca=hanged easily for the whole document.)

Cheers,

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

PGP: 0x0F52F982


signature.asc
Description: PGP signature


[O] Bug: cached code blocks should return the same value [8.3.1]

2015-09-18 Thread Benda Xu
Hi All,

Passing values across code blocks makes Org babel a powerful meta
programming language:

   #+name: input
   #+BEGIN_SRC sh :results output
   echo "3"
   #+END_SRC

   #+BEGIN_SRC R :var a=input()
   a
   #+END_SRC

   #+RESULTS:
   | 3 |
   |   |

However, this feature does not work with cache.  In case that "input"
code block takes a long time to evaluate, it is a good idea to cache the
result.  But that returns "nil" in subsequent function calls:

   #+name: input
   #+BEGIN_SRC sh :results output :cache yes
   echo "3"
   #+END_SRC

   #+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input
   : 3

   #+BEGIN_SRC R :var a=input()
   a
   #+END_SRC

   #+RESULTS:
   : nil

Recalling the cached function should return exactly the same result by
definition of "cache".

Or is there a way to circumvent this by referring to the "RESULT" field
directly?

Cheers,
Benda


Emacs  : GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-08 on binet, modified by Debian
Package: Org-mode version 8.3.1 (8.3.1-dist @ 
/usr/share/emacs24/site-lisp/org-mode/)

current state:
==
(setq
 org-export-babel-evaluate nil
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point 
org-babel-execute-safely-maybe)
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-archive-location "~/art/gtd/archive.org::From %s"
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo 
org-irc org-mew org-mhe org-rmail org-special-blocks org-vm
   org-wl org-w3m)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-confirm-babel-evaluate nil
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}" 
("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("article" "\\documentclass[11pt]{article}" 
("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
  ("\\paragraph{%s}" . "\\paragraph*{%s}") 
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . 
"\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . 
"\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 )
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-format-latex-options '(:foreground default :background default :scale 1.7 
:html-foreground "Black" :html-background "Transparent"
:html-scale 1.0 :matchers ("begin" "$1" "$" "$$" 
"\\(" "\\["))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-publish-project-alist '(("example" :base-directory "~/art/example" 
:publishing-directory "~/art/web/projects" :email nil :footnotes
  nil :section-numbers nil :table-of-contents nil 
:preserve-breaks t :sub-superscript nil :style
  "")
 ("MoGURA" :base-directory "~/art/MoGURA" 
:publishing-directory "~/art/web/projects" :email nil :footnotes nil
  :section-numbers nil :headline-levels 3 
:table-of-contents nil :preserve-breaks t :sub-superscript nil
  :style "")
 )
 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 

Re: [O] Using the file as 1st level headline

2015-09-18 Thread Eric S Fraga
On Thursday, 17 Sep 2015 at 19:55, Sven Bretfeld wrote:

[...]

> I should have been more clear. The problem is the project definition. It
> will become clear below.

Thanks for the clarification.  I understand what you are trying to
achieve.  I may not be able to help much, unfortunately.  Except:

[...]

> What would work is:
>
> * TODO Write book on XY
> ** Introduction
>Text.
> * NEXT Something 1
> * END

Have you looked at exporting the sub-tree?  If you define the
appropriate EXPORT_xxx properties in the sub-tree, it should be
equivalent to having that sub-tree as a file alone.  Check the export
options at the top of the help window when you type "C-c C-e ?"

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.1-203-g4ca3d3



Re: [O] remote plot with local output?

2015-09-18 Thread Charles C. Berry

On Fri, 18 Sep 2015, Benda Xu wrote:


Hi,

Benda Xu  writes:


"Charles C. Berry"  writes:


Untested, but try this :

#+name: localize
#+BEGIN_SRC emacs-lisp :var file="" srcinfo=(org-babel-get-src-block-info)
   (let* ((dir (cdr (assoc :dir (nth 2 srcinfo
  (rfile (concat (file-name-as-directory dir) file))
  (lfile (car (last (split-string rfile ":")
 (copy-file rfile lfile 1)
 lfile)
#+END_SRC

then use

#+HEADER: :post localize(*this*)

in your python src block.


It successfully extracts the :dir field.  Thanks!


Python works this way.  But babel R has a completely different *this*
value.  Consider the following example:

 #+BEGIN_SRC R :results output graphics :file line.png :dir /ipmuap02:/tmp
 plot(c(1,2,3))
 #+END_SRC

 #+RESULTS:
 [[file:/scp:ipmuap02:/tmp/line.png]]

*this* equals "[[file:/scp:ipmuap02:/tmp/line.png]]", but in babel
python *this* equals "line.png".

So I come up with

 #+name: localize
 #+BEGIN_SRC emacs-lisp :var file="" srcinfo=(org-babel-get-src-block-info)
   (let ((lang (car srcinfo)))
 (cond ((string= lang "python")
(let* ((dir (cdr (assoc :dir (nth 2 srcinfo
   (rfile (concat (file-name-as-directory dir) file))
   (lfile (car (last (split-string rfile ":")
  (copy-file rfile lfile 1)
  lfile))
   ((string= lang "R")
(let* ((rfile (substring file 7 -2))
   (lfile (car (last (split-string rfile ":")
  (copy-file rfile lfile 1)
  (concat "[[file:" lfile "]]")
 #+END_SRC

But the result is a string rather than a file link:

 #+HEADER: :post localize(*this*)
 #+BEGIN_SRC R :results output graphics :file line.png :dir /ipmuap02:/tmp
 plot(c(1,2,3))
 #+END_SRC

 #+RESULTS:
 : [[file:/tmp/line.png]]

Any hints?



Forget *this* and use the

(cdr (assoc :file (nth 2 srcinfo))

to get the file name.  That should work the same way regardless of 
language.


Chuck



Re: [O] Show presence of zero width spaces using overlay

2015-09-18 Thread Eric Abrahamsen
Kaushal Modi  writes:

> My most common uses are escaping double quotes (") and equals (=)
> within org verbatim blocks (=VERBATIM=)
>
> Examples:
>
> 1. =var=[ZWS]val=
> 2. =[ZWS]"something"[ZWS]=
>
> Here [ZWS] is the 0x200b zero width space unicode char.
>
> I found [ZWS] useful as a generic escape char for org mode. There are
> few other cases where this has been useful, but I can't recall right
> now.
>
> In any case, what would be the recommended way to escape " and = in
> the above 2 examples?

Check out the variable `org-entities' for all the replaceable escape
codes. It's got quotes and equal!

E




[O] [PATCH] Fix org-agenda-with-point-at-orig-entry

2015-09-18 Thread Eric Abrahamsen
A comma is missing from this macro's backquote template. Here's a patch
to add it!

Eric

>From 628b8ec90851710bb168164e2d4145acf4360d77 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen 
Date: Sat, 19 Sep 2015 13:41:25 +0800
Subject: [PATCH] org-agenda.el: Fix org-agenda-with-point-at-orig-entry

* lisp/org-agenda.el (org-agenda-with-point-at-orig-entry): Add missing
  comma in the backquote template.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9f85cfa..95fb046 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2006,7 +2006,7 @@ If STRING is non-nil, the text property will be fetched from position 0
 in that string.  If STRING is nil, it will be fetched from the beginning
 of the current line."
   (org-with-gensyms (marker)
-`(let ((,marker (get-text-property (if string 0 (point-at-bol))
+`(let ((,marker (get-text-property (if ,string 0 (point-at-bol))
    'org-hd-marker ,string)))
(with-current-buffer (marker-buffer ,marker)
 	 (save-excursion
-- 
2.5.2



Re: [O] Show presence of zero width spaces using overlay

2015-09-18 Thread Kaushal Modi
Here's the MWE once again with proper indication ([ZWS]) of where you need
to insert the zero width space char.

=

* Escaping =equal= sign in verbatim formatting.
=a\equal{}b+c=
** Here's the same but using zero width spaces instead of /org entities/.
=a=[ZWS]b+c=

* Here I am trying to have double quotes in verbatim formatting.
=\quot{}This is inbetween double quotes\quot{}=.
** Here's the same but using zero width spaces instead of /org entities/.
=[ZWS]"This is inbetween double quotes"[ZWS]=.

* And here's to escapes asterisks
This is *bold*. But this is \ast{}not bold\ast{}.
This works!

=



On Sat, Sep 19, 2015 at 12:07 AM Kaushal Modi 
wrote:

> Thanks for letting me know about org-entities. That is awesome. I now know
> how to escape various characters in general, but unfortunately this does
> not work within verbatim formatting (which makes sense).
>
> Here's a minimum working example:
>
> =
>
> * Escaping =equal= sign in verbatim formatting.
> =a\equal{}b+c=
> ** Here's the same but using zero width spaces instead of /org entities/.
> =a=b+c=
>
> * Here I am trying to have double quotes in verbatim formatting.
> =\quot{}This is inbetween double quotes\quot{}=.
> ** Here's the same but using zero width spaces instead of /org entities/.
> =​"This is inbetween double quotes"​=.
>
> * And here's to escapes asterisks
> This is *bold*. But this is \ast{}not bold\ast{}.
> This works!
>
> =
>
> Here's what it looks like when exported:
> https://dl.dropboxusercontent.com/u/10985/escape-chars.pdf
>
> On Fri, Sep 18, 2015 at 9:48 PM Eric Abrahamsen 
> wrote:
>
>> Kaushal Modi  writes:
>>
>> > My most common uses are escaping double quotes (") and equals (=)
>> > within org verbatim blocks (=VERBATIM=)
>> >
>> > Examples:
>> >
>> > 1. =var=[ZWS]val=
>> > 2. =[ZWS]"something"[ZWS]=
>> >
>> > Here [ZWS] is the 0x200b zero width space unicode char.
>> >
>> > I found [ZWS] useful as a generic escape char for org mode. There are
>> > few other cases where this has been useful, but I can't recall right
>> > now.
>> >
>> > In any case, what would be the recommended way to escape " and = in
>> > the above 2 examples?
>>
>> Check out the variable `org-entities' for all the replaceable escape
>> codes. It's got quotes and equal!
>>
>> E
>>
>>
>>


Re: [O] Show presence of zero width spaces using overlay

2015-09-18 Thread Kaushal Modi
Thanks for letting me know about org-entities. That is awesome. I now know
how to escape various characters in general, but unfortunately this does
not work within verbatim formatting (which makes sense).

Here's a minimum working example:

=

* Escaping =equal= sign in verbatim formatting.
=a\equal{}b+c=
** Here's the same but using zero width spaces instead of /org entities/.
=a=b+c=

* Here I am trying to have double quotes in verbatim formatting.
=\quot{}This is inbetween double quotes\quot{}=.
** Here's the same but using zero width spaces instead of /org entities/.
=​"This is inbetween double quotes"​=.

* And here's to escapes asterisks
This is *bold*. But this is \ast{}not bold\ast{}.
This works!

=

Here's what it looks like when exported:
https://dl.dropboxusercontent.com/u/10985/escape-chars.pdf

On Fri, Sep 18, 2015 at 9:48 PM Eric Abrahamsen 
wrote:

> Kaushal Modi  writes:
>
> > My most common uses are escaping double quotes (") and equals (=)
> > within org verbatim blocks (=VERBATIM=)
> >
> > Examples:
> >
> > 1. =var=[ZWS]val=
> > 2. =[ZWS]"something"[ZWS]=
> >
> > Here [ZWS] is the 0x200b zero width space unicode char.
> >
> > I found [ZWS] useful as a generic escape char for org mode. There are
> > few other cases where this has been useful, but I can't recall right
> > now.
> >
> > In any case, what would be the recommended way to escape " and = in
> > the above 2 examples?
>
> Check out the variable `org-entities' for all the replaceable escape
> codes. It's got quotes and equal!
>
> E
>
>
>


Re: [O] Show presence of zero width spaces using overlay

2015-09-18 Thread Nicolas Goaziou
Hello,

Kaushal Modi  writes:

> The suggestion to use zero width spaces to sort of "escape" stuff in org
> mode has come up many times. I have started using it a lot and suggest that
> to other people now.
>
> Here is one such recent QnA on emacs.SE:
> http://emacs.stackexchange.com/a/16702/115
>
> The OP of that question made a valid point that while using zero width
> spaces is convenient, it is not apparent where it has been used in the
> document.
>
> To resolve that, I am requesting a feature.
>
> Can the zero width spaces be optionally represented with something like a
> single space overlay with a colored background (like purple)?
>
> Making this officially part of org-mode will probably make more people make
> use of it.
>
> .. Or should people use zero width spaces?

Entities can be used to escape most Org syntax, e.g. 

  \ast{}shrug\ast

I see no compelling reason to treat zero width spaces specially.


Regards,

-- 
Nicolas Goaziou



Re: [O] "Capture"-like browser plugin?

2015-09-18 Thread Samuel Wales
hi daniele,

On 9/18/15, Daniele Pizzolli  wrote:
> And pressing C-a (Select All) for the selection.

all of the bugs occur with mouse.  i never use keyboard and
org-capture together.

>> and sometimes it will capture the link but not the
>> selection.
>
> Do you have an example page for this?  Once we have a really simple
> example page with the error we can report a bug!

i will try to notice reproducible cases.  please note that i do not
know whether it is an interaction with other extensions.

>> it will also sometimes capture something else you copied,
>> which does not appear on the page whose link gets capture.
>
> Yes, I saw a note in the code, the /problem/ is that firefox does not
> clean the selection when you change tab.  So you select something in

would it be possible to put the selection and a tab dentifier in a
variable every time you switch tabs?  then org-capture would compare?
maybe that makes no sense.

thanks for your reply.


samuel



Re: [O] Bug: Internal links broken when exporting from org mode to markdown and odt [8.3.1 (8.3.1-103-g366dc4-elpa @ /home/bitouze/.emacs.d/elpa/org-20150907/)]

2015-09-18 Thread Nicolas Goaziou


Denis Bitouzé  writes:

> Via ELPA, it will be okay?

It should. There is a new ELPA release every week.

> I should have been more explicit, sorry: AFAICS, when clicking on the
> "another" link, we jump *not* at the second section but at its
> corresponding entry in the TOC.

This should be fixed too. Thank you.

Regards,




Re: [O] Show presence of zero width spaces using overlay

2015-09-18 Thread Kaushal Modi
My most common uses are escaping double quotes (") and equals (=) within
org verbatim blocks (=VERBATIM=)

Examples:

1. =var=[ZWS]val=
2. =[ZWS]"something"[ZWS]=

Here [ZWS] is the 0x200b zero width space unicode char.

I found [ZWS] useful as a generic escape char for org mode. There are few
other cases where this has been useful, but I can't recall right now.

In any case, what would be the recommended way to escape " and = in the
above 2 examples?

On Fri, Sep 18, 2015 at 5:09 PM Nicolas Goaziou 
wrote:

> Hello,
>
> Kaushal Modi  writes:
>
> > The suggestion to use zero width spaces to sort of "escape" stuff in org
> > mode has come up many times. I have started using it a lot and suggest
> that
> > to other people now.
> >
> > Here is one such recent QnA on emacs.SE:
> > http://emacs.stackexchange.com/a/16702/115
> >
> > The OP of that question made a valid point that while using zero width
> > spaces is convenient, it is not apparent where it has been used in the
> > document.
> >
> > To resolve that, I am requesting a feature.
> >
> > Can the zero width spaces be optionally represented with something like a
> > single space overlay with a colored background (like purple)?
> >
> > Making this officially part of org-mode will probably make more people
> make
> > use of it.
> >
> > .. Or should people use zero width spaces?
>
> Entities can be used to escape most Org syntax, e.g.
>
>   \ast{}shrug\ast
>
> I see no compelling reason to treat zero width spaces specially.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] Bug: org-babel-tangle-publish fails in copy-file step [8.3.1 (release_8.3.1-241-gea7ac0 @ /home/arunisaac/.emacs.d/org-mode/lisp/)]

2015-09-18 Thread Arun I
Just in case, I have also attached a tarball with org files and emacs
source code to reproduce the error.

Just extract the tarball, and run

emacs -Q -l minimal-org.el

in the extracted folder. If the load file paths and org file paths are
set correctly as mentioned in minimal-org.el, the org-babel-tangle-publish
bug should show up.


org-tangle-bug.tar.gz
Description: Binary data


signature.asc
Description: PGP signature


Re: [O] "Capture"-like browser plugin?

2015-09-18 Thread Samuel Wales
fwiw my x logs contain some lines like these:

Waiting for Emacs...
Waiting for Emacs...*ERROR*: Capture abort: (end-of-file)



Re: [O] babel: fancy prompt messes up results of shell block

2015-09-18 Thread Loris Bennett
Grant Rettke  writes:

> On Fri, Sep 11, 2015 at 3:29 AM, Loris Bennett
>  wrote:
>> Hi,
>>
>> I have a bit of a fancy bash prompt and so the output of evaluating a
>> block of shell script ends up a little messy:
>>
>> #+BEGIN_SRC sh :session install :results output
>> echo blah
>> #+END_SRC
>>
>> #+RESULTS:
>> : blah
>> : ]2;loris@soroban [35m[10:21:45] [31mloris@soroban [36m(1058) 
>> [33m/home/loris/tmp[34m[0m
>>
>> Is there any way to avoid this short of resetting PS1 within the babel
>> session?
>
> It looks like `org-babel-sh-strip-weird-long-prompt' removed the
> prompt from the output. Your prompt doesn't match that regex? Maybe
> redefine it there.

So this is what you are talking about:

(defun org-babel-sh-strip-weird-long-prompt (string)
  "Remove prompt cruft from a string of shell output."
  (while (string-match "^% +[\r\n$]+ *" string)
(setq string (substring string (match-end 0
  string)

Bearing in mind that my pattern-matching experience is mainly from Perl,
I don't get the regex above.  Isn't it just going to match a prompt
starting with a '%' followed by a bunch of spaces, carriage returns /
newlines, and more spaces?  That may be both weird and potentially long,
but isn't it quite a specific subset of weird, long prompts?

Cheers,

Loris

-- 
This signature is currently under construction.



Re: [O] [org-plot/gnuplot] Plotting candlestick plots

2015-09-18 Thread Suvayu Ali
On Thu, Sep 17, 2015 at 08:05:16PM +0300, Foivos S. Zakkak wrote:
> Hello list,
> 
> I am trying to plot some candlesticks through org-plot/gnuplot,  but I
> fail.
> 
> It seems that org-plot/gnuplot supports a list of numbers in deps, i.e.,
> deps:(2 3 4) and then creates a string of the form:
> 'test.dat' using X with lines
> where X is first 2 then 3 and finally 4 for deps:(2 3 4)
> 
> To plot candlesticks though, gnuplot expects a line of the form:
> 'test'.dat' using 1:3:2:6:5:xticlabels(7) with candlesticks whiskerbars

Org plot is there for quick and easy plotting.  I would recommend using
babel with gnuplot source blocks.  You can easily pass tables as data,
and configure your plot as you wish.  Unfortunately I have not done this
recently, so I don't have any simple examples handy, but I'm sure there
are plenty on Worg.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] "Capture"-like browser plugin?

2015-09-18 Thread Daniele Pizzolli
On Thu, Sep 17 2015, Samuel Wales wrote:

> On 7/23/15, Daniele Pizzolli wrote:
>> https://addons.mozilla.org/it/firefox/addon/org-mode-capture/
>>
>> The latest version convert html links to org-links (disclaimer: it is my
>> little contribution).
>
> this extension is wonderful.  all you have to do is install it and
> then do what you want with it in elisp.  i use it with iceweasel
> 40.0.3 (rebranded firefox).

Hello Samuel,

Nice to hear.

> however, it (or org-protocol) is very flaky.  it works half of the
> time, but sometimes it will do nothing and say "No server buffers
> remain to edit"

So, not so wonderful..  I just found out how to reproduce this problem.

Open a page with two frames, for example:

http://www.quackit.com/html/templates/download/preview.cfm?template=../frames/css_frames/frames_2_column_left_menu.cfm

And pressing C-a (Select All) for the selection.

And then capture the page.

Please note that you can not select the text in both frames using the
mouse.

> and sometimes it will capture the link but not the
> selection.

Do you have an example page for this?  Once we have a really simple
example page with the error we can report a bug!

> it will also sometimes capture something else you copied,
> which does not appear on the page whose link gets capture.

Yes, I saw a note in the code, the /problem/ is that firefox does not
clean the selection when you change tab.  So you select something in tab
1, switch to tab 2 and you get the link and page title of page 2 and the
selection of tab 1.  Maybe there are workaround, like force the cleaning
of the selection after a tab change, but this can impact the user
experience.  I guess that usually you expect the selection to persist
until you paste it, even if you have changed tab, or not?  Coping from
tab 1 and paste in tab 2 is not an exotic use case.

I think that the selection is global and not per tab.  Maybe is possible
to add a selection per tab, by listening to some events.

Another limitation of the selection in firefox is that can not span over
frames and over 3rd party injection of content (not sure on how they do
this those days) but in a page with content and disqus.com you can not
select and capture both with the mouse. And if you use C-a you will bump
into the previous problem.

Hope you find this information useful,
Daniele



[O] Bug: org-babel-tangle-publish fails in copy-file step [8.3.1 (release_8.3.1-241-gea7ac0 @ /home/arunisaac/.emacs.d/org-mode/lisp/)]

2015-09-18 Thread Arun I
When publishing files using org-babel-tangle-publish, if the :tangle
header argument is given to a source block, and if org-babel-tangle-publish
is called from a directory other than the directory in which the source
file (that is, the file being tangled) exists, then org-babel-tangle-publish
fails in the copy-file step.

This happens because org-babel-tangle returns the file name (that is,
the basename only) mentioned in the :tangle header argument, and
org-babel-tangle-publish tries to copy that unqualified basename
instead of the absolute path to the file.

My emacs configuration follows. I used the minimal configuration given in
the Feedback section of the org mode manual. The backtrace for the error is
also attached.

Thanks,
Arun Isaac.

Emacs  : GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.2)
 of 2015-04-20 on bitzer.hoetzel.info
Package: Org-mode version 8.3.1 (release_8.3.1-241-gea7ac0 @ 
/home/arunisaac/.emacs.d/org-mode/lisp/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-latex-format-inlinetask-function 
'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 '(lambda (name contents) contents)
 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-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point 
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
org-cycle-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-html-format-headline-function 'org-html-format-headline-default-function
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-publish-project-alist '(("basic" :base-directory 
"~/.emacs.d/org-tangle-bug/base" :base-extension "org" :publishing-directory
  "~/.emacs.d/org-tangle-bug/pub" 
:publishing-function org-babel-tangle-publish)
 )
 )
Debugger entered--Lisp error: (file-error "Opening input file" "no such file or 
directory" "/home/arunisaac/.emacs.d/org-tangle-bug/source.c")
  copy-file("source.c" "/home/arunisaac/.emacs.d/org-tangle-bug/pub/" t)
  #[(el) "\302 \303#\207" [el pub-dir copy-file t] 4]("source.c")
  mapc(#[(el) "\302\303#\207" [el pub-dir copy-file t] 4] ("source.c"))
  org-babel-tangle-publish((:base-directory "~/.emacs.d/org-tangle-bug/base" 
:base-extension "org" :publishing-directory "~/.emacs.d/org-tangle-bug/pub" 
:publishing-function org-babel-tangle-publish) 
"/home/arunisaac/.emacs.d/org-tangle-bug/base/source.org" 
"/home/arunisaac/.emacs.d/org-tangle-bug/pub/")
  org-publish-file("/home/arunisaac/.emacs.d/org-tangle-bug/base/source.org" 
("basic" :base-directory "~/.emacs.d/org-tangle-bug/base" :base-extension "org" 
:publishing-directory "~/.emacs.d/org-tangle-bug/pub" :publishing-function 
org-babel-tangle-publish) t)
  #[(project) "\306@!\210A\307   \310\"\307 \311\"\307 
\312\"\206\313\307   \314\"\206#\315\307   \316\"\206-\307
\317\"\2068  \307\320\"\307\321\"\322\n\"!\323\324\307 
\325\"\"\"\203^\326\327!\210\203g
\f\"\210!\330#\211$\203\216$@\211#\"\232\204\205\331#\332#\210$A\211$\204r*\307
   \333\"\203\245\334\307
\325\"\"\210\331\"\332#\210\203\256\326\335!\210\336 .\207" [project 
project-plist exclude-regexp sitemap-p sitemap-filename sitemap-function 
org-publish-initialize-cache plist-get :exclude :auto-sitemap :sitemap-filename 
"sitemap.org" :sitemap-function org-publish-org-sitemap :sitemap-date-format 
:sitemap-file-entry-format :preparation-function :completion-function 

Re: [O] Emacs-orgmode Digest, Vol 115, Issue 21

2015-09-18 Thread Foivos S. Zakkak


On Fri, Sep 18, 2015 at 12:47:07 +0200, Suvayu Ali wrote:
> On Thu, Sep 17, 2015 at 08:05:16PM +0300, Foivos S. Zakkak wrote:
>> Hello list,
>>
>> I am trying to plot some candlesticks through org-plot/gnuplot,  but I
>> fail.
>>
>> It seems that org-plot/gnuplot supports a list of numbers in deps, i.e.,
>> deps:(2 3 4) and then creates a string of the form:
>> 'test.dat' using X with lines
>> where X is first 2 then 3 and finally 4 for deps:(2 3 4)
>>
>> To plot candlesticks though, gnuplot expects a line of the form:
>> 'test'.dat' using 1:3:2:6:5:xticlabels(7) with candlesticks whiskerbars
>
> Org plot is there for quick and easy plotting.

I see what you mean, but I believe something like
--8<---cut here---start->8---
#+PLOT: ind:1 deps:("1:4:3:7:6") with:candlesticks
|+---+--+--++--+--|
| # Variable |  mean |  min |   q1 | median |   q3 |  max |
|+---+--+--++--+--|
|  1 |  2166 | 2166 | 2166 |   2166 | 2166 | 2166 |
| 15 | 2166. | 2166 | 2166 |   2167 | 2167 | 2168 |
|255 | 2167.1803 | 2166 | 2167 |   2167 | 2168 | 2169 |
|271 | 2247.3874 | 2242 | 2246 |   2247 | 2249 | 2252 |
|+---+--+--++--+--|
--8<---cut here---end--->8---
is still pretty simple and yet so powerful.

> I would recommend using babel with gnuplot source blocks.  You can
> easily pass tables as data, and configure your plot as you wish.
> Unfortunately I have not done this recently, so I don't have any
> simple examples handy, but I'm sure there are plenty on Worg.
>
> Hope this helps,
>

It sure does! I'll have a look into it, thanks.

Foivos
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
--
WWW: foivos.zakkak.net
PGP: 7B40 69D9 29BA AE91 C0B3  220A 0846 BFD1 03F0 4EA1