Re: [O] ob-clojure with tangling current broken

2019-01-21 Thread stardiviner


Frederick Giasson  writes:

> Hi,
>
> I updated org-mode to latest dev version recently and I was wondering why I 
> was
> seeing namespaces appended to each [clojure] code block I was tangling (which
> generates unusable tangled Clojure source files)


That's why I added a patch recently. Now Nicolas already applied my
patch. You should already seen it now.

>
> It turns out that the culprit is the following line:
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-clojure.el#L108
>
> I am wondering why is there such code injection in
> "org-babel-expand-body:clojure". It looks like to be related to the Clojure 
> code
> block execution, but it also appears to be called from the tangling function.
> Clearly those two different use cases needs to be properly handled at the 
> level
> of "ob-clojure.el"
>

Expanding clojure code is necessary to tangling, because when user have
noweb reference etc in source block, expanding here is necessary.

> I didn't follow all the changes to the "ob-clojure" mode in the last year or 
> so,
> so please pardon my ignorance if the module is taking a different direction 
> than
> I am used to. Is there a rational behind this behaviour or is there a new 
> feature
> that I am not aware of which properly handle those two use cases?
>

Which part you don't understand, I might can answer your question,
because I did most of those changes in last year.

> Thanks,
>
> Take care,
>
> Fred


--
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] [PATCH] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-21 Thread stardiviner


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> From 8a64ccf659afcbd510e69eaa4ac175946f1ae311 Mon Sep 17 00:00:00 2001
>> From: stardiviner 
>> Date: Thu, 10 Jan 2019 09:34:39 +0800
>> Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
>>  statement
>
> Applied, with tiny changes. Thank you.

Thanks as always, Nicolas.

>
> Regards,


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] Date macro and file permission

2019-01-21 Thread Michael Brand
Hi Nicolas

On Mon, Jan 21, 2019 at 9:47 PM Nicolas Goaziou  wrote:

> Michael Brand  writes:
>
> > Visiting a read-only file that uses the ~#+date:~ macro results in the
> > message "File mode specification error: (buffer-read-only # > buffer>)" and a not properly initialized Org buffer. For example Org
> > indent does not indent and some faces show a wrong color. I tried
> > today's master branch and found the regression here
> >
> > commit 5f5d82ed516b7b385a9258271becbfa247e94af3
> > Author: Nicolas Goaziou 
> > Date:   Tue Nov 21 22:25:17 2017 +0100
> >
> > Remove second pass for macro expansion
>
> Fixed. Thank you.

Thank you for looking into it. Now it asks "Buffer  *temp* modified;
kill anyway?".

Michael



Re: [O] Date macro and file permission

2019-01-21 Thread Nicolas Goaziou
Hello,

Michael Brand  writes:

> Visiting a read-only file that uses the ~#+date:~ macro results in the
> message "File mode specification error: (buffer-read-only # buffer>)" and a not properly initialized Org buffer. For example Org
> indent does not indent and some faces show a wrong color. I tried
> today's master branch and found the regression here
>
> commit 5f5d82ed516b7b385a9258271becbfa247e94af3
> Author: Nicolas Goaziou 
> Date:   Tue Nov 21 22:25:17 2017 +0100
>
> Remove second pass for macro expansion

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] ob-clojure should not tangle with inserting (ns ..) line when no :ns specified.

2019-01-21 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> From 8a64ccf659afcbd510e69eaa4ac175946f1ae311 Mon Sep 17 00:00:00 2001
> From: stardiviner 
> Date: Thu, 10 Jan 2019 09:34:39 +0800
> Subject: [PATCH] lisp/ob-clojure.el: Don't tangle with auto prepend ns
>  statement

Applied, with tiny changes. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] ob-clojure with tangling current broken

2019-01-21 Thread Frederick Giasson
Hi,

I updated org-mode to latest dev version recently and I was wondering why I
was seeing namespaces appended to each [clojure] code block I was tangling
(which generates unusable tangled Clojure source files)

It turns out that the culprit is the following line:
https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-clojure.el#L108

I am wondering why is there such code injection in
"org-babel-expand-body:clojure". It looks like to be related to the Clojure
code block execution, but it also appears to be called from the tangling
function. Clearly those two different use cases needs to be properly
handled at the level of "ob-clojure.el"

I didn't follow all the changes to the "ob-clojure" mode in the last year
or so, so please pardon my ignorance if the module is taking a different
direction than I am used to. Is there a rational behind this behaviour or
is there a new feature that I am not aware of which properly handle those
two use cases?

Thanks,

Take care,

Fred


Re: [O] Interaction between org-special-ctrl-a/e and visual-line-mode in Org 9.2?

2019-01-21 Thread Nicolas Goaziou
Hello,

John Hutchinson  writes:

> Under org 9.1 (which works as expected), C-e is bound to "org-end-of-line".
>
> In org 9.2 (which does not work as expected) it's bound to
> "end-of-visual-line".

In Org 9.1, `org-end-of-line' is mapped to `C-e' whereas in Org 9.2, it
remaps [move-end-of-line], whatever its binding is. The issue is that
`visual-line-mode' does the same, hence the conflict.

Remapping [move-end-of-line] doesn't force `C-e' on the user, so the
current way has its advantages.

> Restarting org-mode,  via "org-reload" or via "C-c C-c" in the initial
> lines, does not change this behavior.

I think `M-x org-mode' should be sufficient to bind `C-e' back to
`org-end-of-line'. It is also possible to use `visual-line-mode-hook'
to always set

I'm not sure how to fix this from Org, tho.

Thoughts?

Regards,

-- 
Nicolas Goaziou



Re: [O] Clone tree backwards in time

2019-01-21 Thread Scott Randby
On 1/21/19 12:49 PM, Nicolas Goaziou wrote:
> Hello,
> 
> Yasushi SHOJI  writes:
> 
>> Done.
> 
> Thank you. Applied now.

Yasushi: Thank you for your patch.

Scott



Re: [O] Clone tree backwards in time

2019-01-21 Thread Nicolas Goaziou
Hello,

Yasushi SHOJI  writes:

> Done.

Thank you. Applied now.

> If you don't mind reviewing my patches via email, I'm just OK without
> it.

Fair enough.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Export to Texinfo Broken [9.2 (9.2-elpaplus @ /Users/lolh/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-21 Thread Nicolas Goaziou
hello,

wlharv...@mac.com writes:

> The following Org document exports to Texinfo '.texi’ in Orgmode
> 9.1.14 but fails under Orgmode 9.2 with the following error message:
>
> 'Cannot generate node name for type: src-block'
>
> The source of the problem arises from commit `04f35fc473`.  When the
> changes are undone in that one commit, the document will export
> to a ‘.texi' file.  There's no documented motivation for the change, so it’s
> Hard to figure out what a proper fix would be.

The commit is strange indeed. Lack of inspiration, perhaps. It should be
fixed now.

Regards,

-- 
Nicolas Goaziou



[O] Bug: Export to Texinfo Broken [9.2 (9.2-elpaplus @ /Users/lolh/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-21 Thread wlharvey4
The following Org document exports to Texinfo '.texi’ in Orgmode
9.1.14 but fails under Orgmode 9.2 with the following error message:

'Cannot generate node name for type: src-block'

The source of the problem arises from commit `04f35fc473`.  When the
changes are undone in that one commit, the document will export
to a ‘.texi' file.  There's no documented motivation for the change, so it’s
Hard to figure out what a proper fix would be.

If the Org document does not use #+CAPTION and #+NAME, (and therefore
no links nor listings), then the document will export in 9.2.  For some reason,
when adding a #+CAPTION or #+NAME, the code cannot return a node name.

Wesley Harvey


# -*- mode:org; -*-
#+TITLE:Hello World in the World
#+SUBTITLE:A Listing of All the Ways to Say /Hello World/
#+AUTHOR:HW
#+DATE:\today
* Introduction
 :PROPERTIES:
 :UNNUMBERED:
 :END:
 This is an introduction to /Hello World/.
* Hello World in Python
 :PROPERTIES:
 :DESCRIPTION: Source code for Hello World
 :ALT_TITLE: HelloWorld Python
 :END:
 #+CAPTION[Hello Python]:Hello World in Python
 #+NAME:src:hello-world-python
 #+BEGIN_SRC python -n :results output
 print("Hello World from Python.")
 #+END_SRC

 #+RESULTS: src:hello-world-python
 : Hello World from Python.

** Reference To Python HelloWorld
  See [[src:hello-world-python][Hello World Python]].
* Hello World in JavaScript
 :PROPERTIES:
 :DESCRIPTION: How to say HelloWorld in JavaScript
 :ALT_TITLE: HelloWorld JS
 :END:
 #+CAPTION[Hello JS]:Hello World in JavaScript
 #+NAME:src:hello-world-js
 #+BEGIN_SRC js -n :results: output
 console.log("Hello World from JavaScript.")
 #+END_SRC

 #+RESULTS: src:hello-world-js
 : Hello World from JavaScript.
 : undefined

** Reference to JS HelloWorld
  JavaScript.  ([[src:hello-world-js][HW JS]])
* Listings
 :PROPERTIES:
 :APPENDIX:
 :END:
 #+TEXINFO: @listoffloats Listing

* EXPORT SETTINGS  :noexport:
#+TEXINFO_CLASS: info
#+TEXINFO_DIR_CATEGORY:Texinfo
#+TEXINFO_DIR_TITLE:HelloWorld
#+TEXINFO_DIR_DESC:How to say HelloWorld in Different Languages
#+TEXINFO_PRINTED_TITLE:Hello World Around the World
-

Emacs  : GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 
AppKit 1561.6)
of 2018-11-17
Package: Org mode version 9.2 (9.2-elpaplus @ 
/Users/lolh/.emacs.d/elpa/org-plus-contrib-20181230/)

current state:
==
(setq
org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-texinfo-format-headline-function 
'org-texinfo-format-headline-default-function
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
org-odt-format-headline-function 'org-odt-format-headline-default-function
org-latex-pdf-process '("%latex -interaction nonstopmode -output-directory %o 
%f" "makeindex %b" "makeglossaries %b"
"%latex -interaction nonstopmode -output-directory %o 
%f")
org-agenda-files '("/usr/local/work/workorg/wlcases.org " 
"~/.org/notes.org ")
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe 
org-rmail org-w3m)
org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
#[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook 
change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes 
auto-fill-mode org-eldoc-load)
org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
org-archive-hook '(org-attach-archive-delete-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
org-babel-pre-tangle-hook '(save-buffer)
org-latex-compiler "xelatex"
org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
org-babel-load-languages '((emacs-lisp . t) (perl . t) (python . t) (ruby . t) 
(C . t) (clojure . t) (java . t) (latex . t) (js . t) (ocaml . t))
org-log-done 'time
org-export-backends '(ascii html icalendar latex md odt org texinfo)
org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS 
WIDTH)"]
org-src-lang-modes '(("arduino" . arduino) ("redis" . redis) ("php" . php) ("C" 
.

Re: [O] Interaction between org-special-ctrl-a/e and visual-line-mode in Org 9.2?

2019-01-21 Thread John Hutchinson

Hi, Nicolas:

Under org 9.1 (which works as expected), C-e is bound to "org-end-of-line".

In org 9.2 (which does not work as expected) it's bound to 
"end-of-visual-line".


Restarting org-mode,  via "org-reload" or via "C-c C-c" in the initial 
lines, does not change this behavior.



Hope this helps, and many thanks for all your efforts for the org community.

Regards,
=John

On 1/18/2019 16:31, Nicolas Goaziou wrote:

Hello,

John Hutchinson  writes:


Under Org 9.1.14 (Emacs 26.1) with org-special-ctrl-a/e set to t, and
visual-line-mode enabled, C-a and C-e worked as expected, switching
between the actual begin / end and the "meaningful" begin / end of
heading lines on repetitive key strokes.

This seems broken in 9.2, moving only to the actual begin / end.

Disabling visual-line-mode restores the prior, correct behavior.

I did not see anything that seemed related to this in the 9.2 release
notes, but I may have overlooked something, or it may be a bug.

Is anyone else noticing this?

What is C-e bound to?

You probably need to restart org-mode after visual-line-mode has been
launched.

Regards,


--
John Hutchinson
johnrhutchin...@att.net




Re: [O] Inlining TikZ blocks as SVG in HTML export

2019-01-21 Thread Alan Schmitt
On 2019-01-09 22:46, Christophe Garion  
writes:



Hello,

I would like to be able to export Org files containing TikZ 
pictures to
HTML files with SVG pictures corresponding to TikZ pictures 
inlined
directly in the HTML files. My use case is to produce quizz 
questions
with graph drawings for the Moodle LMS (https://moodle.org/) 
used at our
university. It is really painful to upload picture files to 
Moodle and link
them to text and Moodle accepts plain HTML5 for text 
description, so it

seems to be a rather food solution.


Here is an example of how I do it. The by-backend is defined as 
follows:


;; to export to both latex and html
(defmacro by-backend (&rest body)
 `(cl-case org-export-current-backend ,@body))

  #+header: :file (by-backend (latex "sigma3.tikz") (t 
  "sigma3.png"))
  #+header: :imagemagick yes :iminoptions -density 600 
  :imoutoptions -geometry 800

  #+header: :results raw graphics
  #+header: :fit yes
  #+header: :packages '(("" "tikz"))
  #+begin_src latex
  \usetikzlibrary{matrix,arrows}
  \begin{tikzpicture}
 \matrix (m) [matrix of nodes, row sep=1em, column sep=4em]
 { iterate & map & reduce \\
   & & $acci$  \\
   $a_{0} = a$   & $f(a_{0})$ & \\ & &  $acc_{0} = fc\; 
   (f\; a_{0})\; acci$ \\
   $a_1 = a_0+i$  & $f(a_{1})$  &\\ & & $acc_{1} = fc\; 
   (f\; a_{1})\; acc_{0}$ \\

   $\ldots$ & $\ldots$   &\\ & & ~ \\
   $a_{n-1} = a_{n-2} + i$ & $f(a_{n-1})$ &\\ & & $acc_{n-1} = 
   fc\; (f \; a_{n-1})\; acc_{n-2}$  \\

   $a_n = a_{n-1} + i$ & $f(a_{n})$ &\\
   $a_{n+1} = a_n + i > b$& & $res = fc\; (f\; a_{n})\; 
   acc_{n-1}$  \\

 };
  \draw (m-3-1) edge[->,thick] node[auto]{\scriptsize $f$} 
  (m-3-2);
  \draw (m-5-1) edge[->,thick] node[auto]{\scriptsize $f$} 
  (m-5-2);
  \draw (m-9-1) edge[->,thick] node[auto]{\scriptsize $f$} 
  (m-9-2);
  \draw (m-11-1) edge[->,thick] node[auto]{\scriptsize $f$} 
  (m-11-2);


  \draw (m-6-3) edge[dotted] (m-8-3);

  \draw[in=90,out=0] (m-3-2) edge[thick] (m-4-3.north);
  \draw (m-2-3) edge[->,thick] node[right]{\scriptsize $fc$} 
  (m-4-3);


  \draw[in=90,out=0] (m-5-2) edge[thick] (m-6-3.north);
  \draw (m-4-3) edge[->,thick] node[right]{\scriptsize $fc$} 
  (m-6-3);


  \draw[in=90,out=0] (m-9-2) edge[thick] (m-10-3.north);
  \draw (m-8-3) edge[->,thick] node[right]{\scriptsize $fc$} 
  (m-10-3);


  \draw[in=90,out=0] (m-11-2) edge[thick] (m-12-3.north);
  \draw (m-10-3) edge[->,thick] node[right]{\scriptsize $fc$} 
  (m-12-3);

  \end{tikzpicture}
  #+end_src

Best,

Alan


signature.asc
Description: PGP signature


[O] Date macro and file permission

2019-01-21 Thread Michael Brand
Hi all

Visiting a read-only file that uses the ~#+date:~ macro results in the
message "File mode specification error: (buffer-read-only #)" and a not properly initialized Org buffer. For example Org
indent does not indent and some faces show a wrong color. I tried
today's master branch and found the regression here

commit 5f5d82ed516b7b385a9258271becbfa247e94af3
Author: Nicolas Goaziou 
Date:   Tue Nov 21 22:25:17 2017 +0100

Remove second pass for macro expansion

Michael



Re: [O] Clone tree backwards in time

2019-01-21 Thread Yasushi SHOJI
Hi Nicolas,

On Sat, Jan 19, 2019 at 2:56 AM Nicolas Goaziou  wrote:
> Yasushi SHOJI  writes:
>
> > Unfortunately, I don't have write permission to the repo.  So we need
> > to ask one of the maintainers to merge it.
>
> Sure. Could you also add an entry in ORG NEWS on that feature?

Done.

> Note you can also ask for write permission to Bastien, if you're
> interested.

If you don't mind reviewing my patches via email, I'm just OK without it.
-- 
  yashi
From 852385892a293e2a3479846a3f96e98678ba93d3 Mon Sep 17 00:00:00 2001
From: Yasushi SHOJI 
Date: Mon, 14 Jan 2019 10:19:50 +0900
Subject: [PATCH] org-clone: Allow time shift in backward

Make `org-clone-subtree-with-time-shift` accept a negative value to
shift the timestamp in backward.

Reported-by: Scott Randby 


Signed-off-by: Yasushi SHOJI 
---
 etc/ORG-NEWS |  5 +
 lisp/org.el  |  2 +-
 testing/lisp/test-org.el | 12 
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e06d0c09b..4821cfa85 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -104,6 +104,11 @@ A 'native option was added to org-highlight-latex-and-related. It
 matches the same structures than 'latex but it calls
 org-src-font-lock-fontify-block instead, thus bringing about full
 LaTeX font locking.
+*** ~org-clone-subtree-with-time-shift~ learnt to shift backward in time
+== (~org-clone-subtree-with-time-shift~) now takes a
+negative value as a valid repeater to shift time stamps in backward
+in cloned subtrees.  You can give, for example, ‘-3d’ to shift three
+days in the past.
 
 ** New functions
 *** ~org-dynamic-block-insert-dblock~
diff --git a/lisp/org.el b/lisp/org.el
index 5c11de7b6..e71ba73e6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8452,7 +8452,7 @@ with the original repeater."
 		"")))			;No time shift
 	 (doshift
 	  (and (org-string-nw-p shift)
-	   (or (string-match "\\`[ \t]*\\+?\\([0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
+	   (or (string-match "\\`[ \t]*\\([\\+\\-]?[0-9]+\\)\\([dwmy]\\)[ \t]*\\'"
  shift)
 		   (user-error "Invalid shift specification %s" shift)
 (goto-char end-of-tree)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 976b7d8d6..db34a03c2 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1496,6 +1496,18 @@
 	(replace-regexp-in-string
 	 "\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
 	 nil nil 1
+  ;; Clone repeating once in backward.
+  (should
+   (equal "\
+* H1\n<2015-06-21>
+* H1\n<2015-06-19>
+* H1\n<2015-06-17 +1w>
+"
+	  (org-test-with-temp-text "* H1\n<2015-06-21 Sun +1w>"
+	(org-clone-subtree-with-time-shift 1 "-2d")
+	(replace-regexp-in-string
+	 "\\( [.A-Za-z]+\\)\\( \\+[0-9][hdmwy]\\)?>" "" (buffer-string)
+	 nil nil 1
   ;; Clone non-repeating zero times.
   (should
(equal "\
-- 
2.20.1