[O] org-latex-image-default-width ignored

2018-03-24 Thread Julien Cubizolles
I'd like all inline images resized during beamer and latex export. I
tried setting org-latex-image-default-width to ".3\\linewidth" but after
export the latex file still uses the default .9\linewidth default. See
the following examples.

Julien.

orgmode file:
--8<---cut here---start->8---
#+begin_src emacs-lisp :exports none
  (setq org-latex-image-default-width ".3\\linewidth")
#+end_src

#+RESULTS:
: .3\linewidth

* hello
[[file:file:/home/wilk/enseignement/schemas/plickers/mvmt-circ-F-faux.png]]
--8<---cut here---end--->8---

gets exported to:
--8<---cut here---start->8---
% Created 2018-03-24 sam. 16:06
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Julien Cubizolles}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Julien Cubizolles},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.0.50 (Org mode 9.1.7)}, 
 pdflang={English}}
\begin{document}

\tableofcontents

\section{hello}
\label{sec:org55b}
\begin{center}
\includegraphics[width=.9\linewidth]{file:/home/wilk/enseignement/schemas/plickers/mvmt-circ-F-faux.png}
\end{center}
\end{document}--8<---cut here---end--->8---




Re: [O] Is it possible to add a :results type for ob-shell to interpret it's some special characters?

2018-03-24 Thread stardiviner

I found new possible solution:

comint-based modes like shell-mode use functions in hook.

Like

- ansi-color-process-output

And I found similar project "xterm-color":

https://github.com/atomontage/xterm-color

I can't implement it on Org-moderesult processing.

But someone might be interested this and can take a try. Thanks.


On 03/24/2018 09:14 AM, stardiviner wrote:


When I have following src block

#+begin_src shell :dir /sudo::
sudo pacman -S --noconfirm lilypond
#+end_src

It will display result literately. include "^M".

I wish org-mode (or ob-shell) can add a result type like `:results 
term` (maybe other name) to replace those "^M" etc special characters 
and might convert some shell color highlight special sequences like 
[[45 similar things.






[O] LaTeX export filter

2018-03-24 Thread Vikas Rawal
Let me start by confessing my limited knowledge of lisp.

I am trying to write a LaTeX export filter that should replace all table rows 
with cells having entries such as <3cid4> by \cmidrule{lr}{3-4}

The idea is to have a table row of this kind

| <2cid3> |   <4cid5> |<6cid7> |   
|   |   |   
|

Which should be exported to 

\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}

This is as far as I have gone.

--

(defun org-export-cmidrule-filter-latex (row backend info)
  (while (string-match
  "\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
(let ((start (string-to-number (match-string 2 row)))
  (end (or (match-string 3 row) "l")))
  (setq row (replace-match
 (format "cmidrule(lr){%s-%s}" start end)
 nil nil row 1))
  (while (string-match "& \\| " row 0)
(setq row (replace-match "" nil nil row))
(decf start))
  )
)
  row)

--

The above filter works if I have only one or two <[0-9]cid[0-9]> strings in a 
row. It does not pick up the third <[0-9]cid[0-9]> string.

I would greatly appreciate if anyone could help improve this filter.

Vikas




Re: [O] cautionary tale: avoid creating/using a macro called "title"

2018-03-24 Thread Eric S Fraga
On Friday, 23 Mar 2018 at 23:42, Nicolas Goaziou wrote:
> A bit late, yet fixed. Thank you.

Thank you!  Works fine now.  And I have increased confidence in my
sanity. ;-)

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3


signature.asc
Description: PGP signature


Re: [O] org-latex-image-default-width ignored

2018-03-24 Thread Eric S Fraga
On Saturday, 24 Mar 2018 at 16:20, Julien Cubizolles wrote:
> I'd like all inline images resized during beamer and latex export. I
> tried setting org-latex-image-default-width to ".3\\linewidth" but after
> export the latex file still uses the default .9\linewidth default. See
> the following examples.

Your example works for me with up to date org from git.  What version
are you using?

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3


signature.asc
Description: PGP signature


Re: [O] About the assignment of FSF papers

2018-03-24 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> Hi, @Nicolas I finished my FSF paper assignment. Check out the
> attachment.

Great. I added you to the Hall of Fame.

> Finally can merge my patch now. So I can use it and delete the branch.

OK. It doesn't seem to apply on master. Could you include my latest
comments and send it again so I can apply it?

Thank you.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] LaTeX export filter

2018-03-24 Thread Eric S Fraga
On Saturday, 24 Mar 2018 at 22:24, Vikas Rawal wrote:
> I am trying to write a LaTeX export filter that should replace all
> table rows with cells having entries such as <3cid4> by
> \cmidrule{lr}{3-4}

[...]

>   (while (string-match
>   "\\(<\\([0-9]+\\)cid\\([0-9]+\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)

Could it be that you need to change the last + to *?
Haven't tried it, mind you.
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3


signature.asc
Description: PGP signature


[O] How to escape # character in #+begin_src bash block for html export?

2018-03-24 Thread Abigaile Johannesburg
Dear community,

I have a minor question about how to escape '#' character in #+begin_src bash 
block. For example, when I export the source code block for bash, I can use

#+begin_src bash
$
#+end_src

But if I want to use # for indicating commands for root or privileged user, if 
I use 

#+begin_src bash
#
#+end_src 

then the commands after '#' will be in italics, i.e., they are treated as 
comments in html export.

How do I solve this problem?

Thanks in advance. 

Abi


[O] Table latex exporting ignores #+ATTR_LATEX:

2018-03-24 Thread Peter Mukhachev
Hello everyone,

I am making a table using org mode in order to export it to tex file
and insert resulting file to my document.
(org-latex-export-as-latex) does the thing, however, I do not need
header thing that it inserts by default.

(org-table-export) can probably do the thing I want. However,
dispatching it with latex backend ends up with #+ATTR_LATEX: line
ignored and exports bare table only in its tabular environment.
However, I would like to be able to control the alignment either at my
.org file with #+ATTR_LATEX (preferred) or at my top-level .tex file
using tabular environment.

Does anyone have an idea how to do that?

Best,
Petr.



[O] Bug: Inconsistent behavior of org agenda view filtering [9.1.5 (9.1.5-1-gb3ddb0-elpa @

2018-03-24 Thread johann.hoechtl
When I open org agenda C-a a, there are a variety of commands which can
alter the amount of information visible. However these commands are not
consistent in the sense that, once activated, an indication would be
shown WHAT is currently visible. For example:

l ... to the status bar `Log` gets apppended. If I press r, the log view
is retained

[ ... inactive timestamps are also displayed. If I press r, the log view
reloads but without displaying any inactive time stamps

^ ... the view is reduced to those elements of the subtree where the
highlighted Heading lies within. No indication in the status bar,
however upon pressing r, this filter is retained.


I call this inconsisten behavior

Emacs  : GNU Emacs 25.3.1 (x86_64-w64-mingw32)
of 2017-09-26
Package: Org mode version 9.1.5 (9.1.5-1-gb3ddb0-elpa @ 
c:/Users/HoechtlJ/AppData/Roaming/.emacs.d/elpa/org-20171225/)


[O] Bug: org-capture when :prepend t org-capture-kill removes one char too much from target buffer [9.1.7 (9.1.7-18-g2f587d-elpaplus @ /Users/devil/.emacs.d/elpa/org-plus-contrib-20180312/)]

2018-03-24 Thread Adam Faryna
When use org-capture which template that targets file with :prepend t,
org-capture-kill
removes one char too much from target buffer, in result next item in target
file looses one of asterisk.

Expected behaviour:
org-capture when used which template which targets file with :prepend t,
org-capture-kill revert buffer back to status before invocation of
org-capture without any data loss from the target buffer.

Emacs  : GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F1911))
 of 2017-09-12
Package: Org mode version 9.1.7 (9.1.7-18-g2f587d-elpaplus @
/Users/devil/.emacs.d/elpa/org-plus-contrib-20180312/)

current state:
==
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-shiftleft-final-hook '(windmove-left)
 org-icalendar-combined-agenda-file "/Users/devil/.emacs.d/tmp/org.ics"
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-reverse-note-order t
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-icalendar-include-todo t
 org-priority-start-cycle-with-default nil
 org-agenda-scheduled-leaders '("" "")
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-log-done 'time
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-columns-default-format "%25ITEM(Task) %TODO %3PRIORITY %7Effort
%8CLOCKSUM %TAGS"
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-icalendar-use-deadline '(event-if-todo)
 org-clock-idle-time 2
 org-track-ordered-property-with-tag t
 org-pretty-entities t
 org-agenda-custom-commands '(("co"
   "TODOs weekly sorted by state, priority, deadline, scheduled, alpha
and effort"
   ((agenda "*")
)
   ((org-agenda-overriding-header
"TODOs weekly sorted by state, priority, deadline, scheduled, alpha and
effort")
(org-agenda-sorting-strategy
(quote
  (todo-state-down priority-down deadline-down
   scheduled-down alpha-down effort-up)
  )
)
)
   )
  ("cn" "TODOs not sheduled"
   ((tags "-SCHEDULED={.+}/!+TODO|+BLOCKED|+IN-PROCESS|+WAITING")
)
   ((org-agenda-overriding-header "TODOs not scheduled")
(org-agenda-sorting-strategy
(quote (deadline-down priority-down alpha-down effort-up)))
)
   )
  ("cb" "TODOs blocked" ((tags "BLOCKED"))
   ((org-agenda-overriding-header "TODOs blocked")
(org-agenda-sorting-strategy
(quote (priority-down deadline-down alpha-down effort-up)))
)
   )
  ("cc" "TODOs canceled" ((todo "CANCELED"))
   ((org-agenda-overriding-header "TODOs canceled")
(org-agenda-sorting-strategy
(quote (priority-down alpha-down effort-up)))
)
   )
  ("cj" "Journal" ((search ""))
   ((org-agenda-files (list org-journal-dir))
(org-agenda-overriding-header "Journal")
(org-agenda-sorting-strategy (quote (timestamp-down
   )
  ("d" "Coprehensive agenda"
   ((tags
"PRIORITY=\"A\"+TODO=\"TODO\"|TODO=\"IN-PROCESS\"|TODO=\"BLOCKED\"|TODO=\"WAITING\""
((org-agenda-skip-function
   (quote
(or
 (org-agenda-skip-entry-if
  (quote todo)
  (quote done)
  )
 (org-agenda-skip-entry-if
  (quote todo)
  (quote
   ("SOMEDAY")
   )
  )
 (my/org-agenda-skip-if-scheduled-later)
 )
)
   )
  (org-agenda-overriding-header "High-priority unfinished tasks:")
  (org-agenda-sorting-strategy
   (quote
(time-up effort-down category-keep alpha-up)
)
   )
  )
)
(agenda "")
(alltodo ""
((org-agenda-skip-function
   (quote
(or (my/org-skip-subtree-if-priority 65)
 (my/org-skip-subtree-if-habit)
 (org-agenda-skip-if nil (quote (scheduled deadline)))
 (org-agenda-skip-entry-if (quote todo)
  (quote ("IN-PROCESS" "BLOCKED" "WAITING")))
 )
)
   )
  (org-agenda-sorting-strategy
   (quote (priority-down effort-down category-keep alpha-up))
   )
  )
)
)
   )
  )
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-default-notes-file "/Users/devil/.emacs.d/orgs/notes.org"
 org-clock-in-resume t
 org-capture-templates '(("t" "Todo" entry
  (file "/Users/devil/.emacs.d/agenda/tasks.org.gpg")
  "* TODO %?\n  :PROPERTIES:\n  :CREATED: [%<%Y-%m-%d>]\n  :END:"
  :prepend t)
("p" "Blog post" entry
  (file "/Users/devil/.emacs.d/orgs/blog.org.gpg")
  "* %?\n  :PROPERTIES:\n  :CREATED: [%<%Y-%m-%d>]\n  :END:"
  :prepend t)
("h" "Habit" entry
  (file "/Users/devil/.emacs.d/agenda/tasks.org.gpg")
  "* TODO %?\n  SCHEDULED: <%<%Y-%m-%d %a .+2d/4d>>\n  :PROPERTIES:\n
:CREATED: [%<%Y-%m-%d>]\n  :STYLE: habit\n  :END:" :prepend t)
("j" "Journal" entry
  (file "/Users/devil/.emacs.d/orgs/journal.org.gpg")
  "* [%<%Y-%m-%d>]\n%?" :prepend t :jump-to-captured t)
("n" "Add note to currently clocked entry" plain (clock)
  "- Note taken on %U  \n  %?")
("c" "Contact" entry (file my/org-contacts-file)
  "* %(org-contac

[O] [PATCH] contrib: ob-sclang: Fix compilation issue.

2018-03-24 Thread Maxim Cournoyer
Hello!

The attached patch fixes a byte compilation issue in ob-sclang.el.

Thank you!

Maxim

>From 0cbc7a1526cd5a87de776de86948bded399063c9 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer 
Date: Sat, 24 Mar 2018 19:13:42 -0400
Subject: [PATCH] contrib: ob-sclang: Fix compilation issue.

* contrib/lisp/ob-sclang.el: Require sclang instead of sclang-interp.
---
 contrib/lisp/ob-sclang.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ob-sclang.el b/contrib/lisp/ob-sclang.el
index ac47b9834..dcd4b6f74 100644
--- a/contrib/lisp/ob-sclang.el
+++ b/contrib/lisp/ob-sclang.el
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; `ob-sclang' requires `sclang-interp' from SuperCollider.
+;; `ob-sclang' requires `sclang' from SuperCollider.
 ;; Usually SuperCollider dependencies for Emacs are at /usr/share/emacs/site-lisp/SuperCollider/
 ;; You can install SuperCollider following this article:
 ;; https://github.com/supercollider/supercollider#building-the-source-code
@@ -60,7 +60,7 @@
 (require 'org)
 (require 'ob)
 
-(require 'sclang-interp)
+(require 'sclang)
 
 (defgroup ob-sclang nil
   "org-mode blocks for SuperCollider SCLang."
-- 
2.16.1



Re: [O] what settings would make original export to pdf as good as pandoc conversion?

2018-03-24 Thread Samuel Wales
i find that the following does not take effect the first time, but
works the second time.  not sure why that would be.

it looks much better now.  i think the main thing i would want is to
color links differently from the default red box, like maybe color the
text "#8968cd" and underline it so it looks kind of like a web page.

also, the pronoun "I" is boldface, which is disconcerting.  Acronyms
are also, but that is less disconcerting.

(add-to-list 'org-latex-classes
 '("article"
   "
\\documentclass{scrartcl}
% alpha is the single \ for these three correct?
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]
\\setlength{\\parindent}{0pt}
\\setlength{\\parskip}{6pt}
"
   ("\\section{%s}" . "\\section*{%s}")
   ("\\subsection{%s}" . "\\subsection*{%s}")
   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
   ("\\paragraph{%s}" . "\\paragraph*{%s}")
   ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

> 1. Start your document with a top level heading, i.e. single * heading.

subtree.

> 2. Remove any whitespace before the \[...] entries in your
>org-latex-classes setting.

this seemed to work [when i run it twice at least].  thank you!

aren't the single \ removed by emacs lisp's string object parsing?



Re: [O] does this pandoc error look familiar to anybody?

2018-03-24 Thread Samuel Wales
i reduced levels in org.  the exported html has no h1.  it has nothing
deeper than h4.

it sounds like it's producing latex someplace but can't produce pdf.

still i get this:

pandoc -o sickly--pdf-from-pandoc.pdf alpha-org-export-output.html
! LaTeX Error: Too deeply nested.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H   for immediate help.
 ...

l.590   \begin{itemize}

pandoc: Error producing PDF from TeX source
(43)

which is funny because it used to work.  maybe it is not an error in
my use of org?

i then tried .latex and went to line 590 and did not find anything
unusual, nor that line.
but it was a list.  must lists not be nested?



Re: [O] [PATCH] contrib: ob-sclang: Fix compilation issue.

2018-03-24 Thread stardiviner

Hi, @MaximI'm the author of `ob-sclang.el`.

Whyneed to require `sclang` instead of `sclang-interp`? ob-sclangused 
functions are all in `sclang-interp.el` file. No need to require 
`sclang`. And I checked out `scel` source code, have not found update.


Might because `sclang-interp`?


On 03/25/2018 07:27 AM, Maxim Cournoyer wrote:

Hello!

The attached patch fixes a byte compilation issue in ob-sclang.el.

Thank you!

Maxim





Re: [O] [PATCH] add :session support for ob-js.el

2018-03-24 Thread stardiviner

I attached my new generated patches.


On 03/17/2018 07:14 PM, Nicolas Goaziou wrote:

Some comments follow.

+  (result (if (not (string= (cdr (assq :session params)) "none"))

You can integrate the test above in the `cond':

(cond
  ((string= "none" (cdr (assq :session params))) nil)
  ((string= "*JS REPL*" session) ...)
  ...)

This is modified in new patch.

+ (sit-for .5) (goto-char (point-max))

(sit-for .5)
(goto-char (point-max))
This is in original code, might because ob-js initialize REPL backend 
need some time so original author added `site-for`. After test, this 
seems does not matter. So remote the sit-for now.



+ (mapc (lambda (var)
+   (insert var) (comint-send-input nil t)
+   (org-babel-comint-wait-for-output session)
+   (sit-for .1) (goto-char (point-max))) var-lines)))
  session))

   (dolist (var ...)
...)

modified in new patch.

I don't know how to apply master branch new update on my local 
`ob-js-session` branch so to get ob-js related commits on top to 
generate new patches. (Do you have any idea on this?) The new patches 
are behind latest `master` branch. But should be compatible still. If 
generating patches based on latest `master` branch commit is must, I can 
do that.


>From 140ef4c23fb3e13a772ca01b92b14bccc47043fb Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 8 Mar 2018 17:15:58 +0800
Subject: [PATCH 1/4] * ob-js.el: support :session for skewer-mode REPL.

---
 etc/ORG-NEWS  |  4 +++
 lisp/ob-js.el | 81 ---
 2 files changed, 54 insertions(+), 31 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index bd9d2a8f7..11ecaa5d3 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -113,6 +113,10 @@ now sort according to the locale’s collation rules instead of by
 code-point.
 
 ** New features
+*** Add ~:session~ support of ob-js for skewer-mode
+#+begin_src js :session "*skewer-repl*"
+console.log("stardiviner")
+#+end_src
 *** Add support for links to LaTeX equations in HTML export
 Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
 add a label to the rendered equation.
diff --git a/lisp/ob-js.el b/lisp/ob-js.el
index 38c8c39ac..920d104f8 100644
--- a/lisp/ob-js.el
+++ b/lisp/ob-js.el
@@ -41,6 +41,8 @@
 (require 'ob)
 
 (declare-function run-mozilla "ext:moz" (arg))
+(declare-function httpd-start "simple-httpd" ())
+(declare-function run-skewer "skewer-mode" ())
 
 (defvar org-babel-default-header-args:js '()
   "Default header arguments for js code blocks.")
@@ -52,7 +54,10 @@
   "Name of command used to evaluate js blocks."
   :group 'org-babel
   :version "24.1"
-  :type 'string)
+  :type '(choice (const "node")
+		 (const "mozrepl")
+		 (const "skewer-mode"))
+  :safe #'stringp)
 
 (defvar org-babel-js-function-wrapper
   "require('sys').print(require('sys').inspect(function(){\n%s\n}()));"
@@ -62,22 +67,13 @@
   "Execute a block of Javascript code with org-babel.
 This function is called by `org-babel-execute-src-block'"
   (let* ((org-babel-js-cmd (or (cdr (assq :cmd params)) org-babel-js-cmd))
+	 (session (cdr (assq :session params)))
  (result-type (cdr (assq :result-type params)))
  (full-body (org-babel-expand-body:generic
 		 body params (org-babel-variable-assignments:js params)))
-	 (result (if (not (string= (cdr (assq :session params)) "none"))
-		 ;; session evaluation
-		 (let ((session (org-babel-prep-session:js
- (cdr (assq :session params)) params)))
-		   (nth 1
-			(org-babel-comint-with-output
-(session (format "%S" org-babel-js-eoe) t body)
-			  (mapc
-			   (lambda (line)
- (insert (org-babel-chomp line))
- (comint-send-input nil t))
-			   (list body (format "%S" org-babel-js-eoe))
-		   ;; external evaluation
+	 (result (cond
+		  ;; no session specified, external evaluation
+		  ((string= session "none")
 		   (let ((script-file (org-babel-temp-file "js-script-")))
 		 (with-temp-file script-file
 		   (insert
@@ -87,7 +83,19 @@ This function is called by `org-babel-execute-src-block'"
 			  full-body)))
 		 (org-babel-eval
 		  (format "%s %s" org-babel-js-cmd
-			  (org-babel-process-file-name script-file)) "")
+			  (org-babel-process-file-name script-file)) "")))
+		  ;; session evaluation
+		  (t
+		   (let ((session (org-babel-prep-session:js
+   (cdr (assq :session params)) params)))
+		 (nth 1
+			  (org-babel-comint-with-output
+			  (session (format "%S" org-babel-js-eoe) t body)
+			(dolist (code (list body (format "%S" org-babel-js-eoe)))
+			  (lambda (code)
+(insert (org-babel-chomp code))
+(comint-send-input nil t)))
+		  )))
 (org-babel-result-cond (cdr (assq :result-params params))
   result (org-babel-js-read result
 
@@ -140,22 +148,33 @@ specifying a variable of the same value."
 (defun o