Bug: org-preview-latex-process-alist's :latex-header should not fall back to org-format-latex-header [9.3.4 (9.3.4-5-ga0f3bb-elpaplus @ /home/lockywolf/.emacs.d/elpa/org-plus-contrib-20200210/)]

2020-04-28 Thread Vladimir Nikishkin



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


So, the problem is the following:

There are two almost unrelated latex-using processes in org. One is
export, the other one is generating previews.

The latter one is far less demanding than the former. Previews only care
about certain math, whereas exports may very well be super tricky.

Therefore, preparing org documents for export often includes setting a
separate latex compiler (in 99% of the cases lualatex or xelatex), and a
custom #+LATEX_HEADER. the latex compiler controlled with
(setq org-latex-compiler "lualatex")
(setq org-latex-bib-compiler "biber")
is completely ignored by the preview process. This is fine, since
previews only care about small things. However, #+LATEX_HEADER is _not_
ignored, which means that previews will fail to compile, since
LATEX_HEADER is prepared for a different compiler.

This can be worked around with various means, but I think that the
problem here is more general. The two processes should be either
completely amalgamated (that is the previews should not have a separate
org-preview-latex-default-process, and just take the settings from the
ones used for the export), or should be completely independent, but not
entangled by a single variable.

Thanks.


Emacs  : GNU Emacs 26.3 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 
3.24.12)
 of 2019-11-26
Package: Org mode version 9.3.4 (9.3.4-5-ga0f3bb-elpaplus @ 
/home/lockywolf/.emacs.d/elpa/org-plus-contrib-20200210/)

current state:
==
(setq
 org-src-mode-hook '((lambda nil (modify-syntax-entry 60 ".") 
(modify-syntax-entry 62 ".")
  (setq geiser-autodoc--inhibit t))
 org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-after-execute-hook '((lambda nil
 (if org-inline-image-overlays
  (progn (org-redisplay-inline-images)))
 )
)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-with-sub-superscripts '{}
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-pretty-entities t
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-files '("~/Personal_Planner/lockywolf_net.org"
"~/Personal_Planner/cyberpunk_smarthome.org"
"~/Personal_Planner/notes.org"
"~/Personal_Planner/2020-04-28-hotkeys-to-remember.txt.org"
"~/DevLinux/chibi-sicp/index.org" 
"~/Personal_Planner/Planner.org")
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-modules '(org-habits ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info 
ol-irc ol-mhe
   ol-rmail ol-eww)
 org-plantuml-jar-path "/usr/local/bin/plantuml.jar"
 org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function 
org-imenu-get-tree] 2]
 turn-on-org-cdlatex org-tempo-setup
 (lambda nil
  (add-to-list (quote org-structure-template-alist)
   (quote ("p" . "src plantuml :noweb no :exports both :file 
")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("SO" . "src scheme :exports both :results output")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("SV" . "src scheme :exports both :results value")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("SE" . "src scheme :exports code")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("EL" . "src elisp :exports both :results output")))
  (add-to-list (quote org-structure-template-alist)
   (quote ("F" . "src f90 :exports both :results output")))
  )
 (lambda nil (modify-syntax-entry 60 ".") (modify-syntax-entry 
62 "."))
 (lambda nil (imenu-add-to-menubar "Imenu"))
 #[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 
org-eldoc-load)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 

Re: Section about latex export is broken in the html manual?

2020-04-28 Thread Nick Dokos
Niclas Borlin  writes:

> Hi,
>
> As far as I can tell, several links of section 10.13 LaTeX Export
> (https://orgmode.org/manual/LaTeX-Export.html) are broken (last
> checked 2020-04-28 19:15 UTC).
>
> The first four links on the page point to useful pages, i.e., clicking
> on "Quoting LaTeX code:" will get you to 
> https://orgmode.org/manual/Quoting-LaTeX-code.html#Quoting-LaTeX-code,
> that contains section 13.10.4 Quoting LaTeX code.
>
> However, from the link "Tables in LaTeX export" downwards, you are
> linked back to the same page. For instance, clicking on "Tables in
> LaTeX export" will get you to 
> https://orgmode.org/manual/LaTeX-Export.html#Tables-in-LaTeX-export. (I
> suspect the content of the page should be an updated version of 
> https://www.gnu.org/software/emacs/manual/html_node/org/Tables-in-LaTeX-export.html.)
>
> I suspect this is a link naming issue in the .org version of the
> manual. Can anyone fix this?
>
I can confirm your findings, but I don't see anything wrong in the
.org version of the manual: I exported it to .html locally and that
works fine. But I'm not sure what happens on the way from one's local
system to the site.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Section about latex export is broken in the html manual?

2020-04-28 Thread Niclas Borlin

Hi,

As far as I can tell, several links of section 10.13 LaTeX Export 
(https://orgmode.org/manual/LaTeX-Export.html) are broken (last checked 
2020-04-28 19:15 UTC).


The first four links on the page point to useful pages, i.e., clicking 
on "Quoting LaTeX code:" will get you to 
https://orgmode.org/manual/Quoting-LaTeX-code.html#Quoting-LaTeX-code, 
that contains section 13.10.4 Quoting LaTeX code.


However, from the link "Tables in LaTeX export" downwards, you are 
linked back to the same page. For instance, clicking on "Tables in LaTeX 
export" will get you to 
https://orgmode.org/manual/LaTeX-Export.html#Tables-in-LaTeX-export. (I 
suspect the content of the page should be an updated version of 
https://www.gnu.org/software/emacs/manual/html_node/org/Tables-in-LaTeX-export.html.)


I suspect this is a link naming issue in the .org version of the manual. 
Can anyone fix this?


Thanks,
/Niclas



Re: Debugging at least 2 regressions in org-mode master breaking ox-hugo

2020-04-28 Thread Bastien
Hi Kyle and everyone,

thanks for taking care of this issue.

I have taken two days off on thursday and friday to be able to
contribute to fixing remaining issues before 9.4.

Best,

-- 
 Bastien



Babel Haskell. Print all results when header has :results output

2020-04-28 Thread Roland Coeurjoly
Right now, when executing the following source block

#+begin_src haskell :results output
[1..10]
"hello" == "hello"
   #+end_src

I get the following output:

#+RESULTS:
   : True

Whereas (for me) the desired result would be

#+RESULTS:
   : [1,2,3,4,5,6,7,8,9,10]
   : True

I created the attached patch that achieves the desired result.

Please notice that the default behaviour (without :results output) remains
unchanged.
From 0e7d2ac22a028507eaf5ecc85623b62572ee3de8 Mon Sep 17 00:00:00 2001
From: Roland Coeurjoly 
Date: Tue, 28 Apr 2020 18:06:50 +0200
Subject: [PATCH] Print all results

---
 lisp/org/ob-haskell.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index d32a2f7bc0..e5ef0999e0 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -145,7 +145,7 @@ org-babel-interpret-Haskell
 (org-babel-reassemble-table
  (let ((result
 (pcase result-type
-  (`output (mapconcat #'identity (reverse (cdr results)) "\n"))
+  (`output (mapconcat #'identity (reverse results) "\n"))
   (`value (car results)
(org-babel-result-cond (cdr (assq :result-params params))
 	 result (org-babel-script-escape result)))
-- 
2.20.1



Fwd: Support compilation of Haskell in org mode babel blocks.

2020-04-28 Thread Roland Coeurjoly
-- Forwarded message -
From: Roland Coeurjoly 
Date: Sat, Apr 25, 2020 at 9:04 PM
Subject: Support compilation of Haskell in org mode babel blocks.
To: 


Haskell code can be both compiled (for example with ghc), or interpreted
(with ghci).

Until now, org babel had only support for interpretation.

Haskell is weird in that some code for the interpreter cannot be compiled
and viceversa.
For example, in ghci (the interpreter) you are required to use let to
declare functions

.

In this patch I add support for compilation with the header argument
:compile yes.
The function to compile haskell is almost a copy paste of the C funcion in
ob-C.el.

By default I retain the original behavior, i.e. interpreting the block.

I have tested this patch in emacs-27.0.91.


It is my first patch to GNU Emacs and I am a newbie with both elisp and
haskell.
From 091f470a278561a60fac1ee3ee658f6823bc2503 Mon Sep 17 00:00:00 2001
From: Roland Coeurjoly 
Date: Sat, 25 Apr 2020 20:35:22 +0200
Subject: [PATCH] Add Haskell specific header argument compile, to compile
 instead of interpret the body of source block

---
 lisp/org/ob-haskell.el | 76 +++---
 1 file changed, 71 insertions(+), 5 deletions(-)

diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index e004a3405e..d32a2f7bc0 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -23,12 +23,13 @@
 
 ;;; Commentary:
 
-;; Org-Babel support for evaluating haskell source code.  This one will
-;; be sort of tricky because haskell programs must be compiled before
+;; Org-Babel support for evaluating Haskell source code.
+;; Haskell programs must be compiled before
 ;; they can be run, but haskell code can also be run through an
 ;; interactive interpreter.
 ;;
-;; For now lets only allow evaluation using the haskell interpreter.
+;; By default we evaluate using the Haskell interpreter.
+;; To use the compiler, specify :compile yes in the header.
 
 ;;; Requirements:
 
@@ -47,6 +48,7 @@
 (declare-function run-haskell "ext:inf-haskell" ( arg))
 (declare-function inferior-haskell-load-file
 		  "ext:inf-haskell" ( reload))
+(declare-function org-entry-get "org" (pom property  inherit literal-nil))
 
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs"))
@@ -60,8 +62,64 @@ org-babel-haskell-eoe
 
 (defvar haskell-prompt-regexp)
 
-(defun org-babel-execute:haskell (body params)
-  "Execute a block of Haskell code."
+(defcustom org-babel-Haskell-compiler "ghc"
+  "Command used to compile a Haskell source code file into an executable.
+May be either a command in the path, like ghc
+or an absolute path name, like /usr/local/bin/ghc
+parameter may be used, like ghc -v"
+  :group 'org-babel
+  :version "27.0"
+  :type 'string)
+
+(defconst org-babel-header-args:haskell '((compile . :any))
+  "Haskell-specific header arguments.")
+
+(defun org-babel-Haskell-execute (body params)
+  "This function should only be called by `org-babel-execute:haskell'"
+  (let* ((tmp-src-file (org-babel-temp-file
+			"Haskell-src-"
+".hs"))
+ (tmp-bin-file
+  (org-babel-process-file-name
+   (org-babel-temp-file "Haskell-bin-" org-babel-exeext)))
+ (cmdline (cdr (assq :cmdline params)))
+ (cmdline (if cmdline (concat " " cmdline) ""))
+ (flags (cdr (assq :flags params)))
+ (flags (mapconcat 'identity
+		   (if (listp flags) flags (list flags)) " "))
+ (libs (org-babel-read
+	(or (cdr (assq :libs params))
+	(org-entry-get nil "libs" t))
+	nil))
+ (libs (mapconcat #'identity
+		  (if (listp libs) libs (list libs))
+		  " ")))
+(with-temp-file tmp-src-file (insert body))
+(org-babel-eval
+ (format "%s -o %s %s %s %s"
+ org-babel-Haskell-compiler
+	 tmp-bin-file
+	 flags
+	 (org-babel-process-file-name tmp-src-file)
+	 libs) "")
+(let ((results
+	   (org-babel-eval
+	(concat tmp-bin-file cmdline) "")))
+  (when results
+(setq results (org-trim (org-remove-indentation results)))
+(org-babel-reassemble-table
+ (org-babel-result-cond (cdr (assq :result-params params))
+	   (org-babel-read results t)
+	   (let ((tmp-file (org-babel-temp-file "Haskell-")))
+	 (with-temp-file tmp-file (insert results))
+	 (org-babel-import-elisp-from-file tmp-file)))
+ (org-babel-pick-name
+	  (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
+ (org-babel-pick-name
+	  (cdr (assq :rowname-names params)) (cdr (assq :rownames params)
+  )))
+
+(defun org-babel-interpret-Haskell (body params)
   (require 'inf-haskell)
   (add-hook 'inferior-haskell-hook
 (lambda ()
@@ -96,6 +154,14 @@ org-babel-execute:haskell
  (org-babel-pick-name 

[BUG] ob-clojure.el new backend 'inf-clojure not compatible with latest version inf-clojure

2020-04-28 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256


Bastien  writes:

> Hi Tim,
>
> thanks for your email.
>
> Tim Cross  writes:
>
>> I wonder if it would make sense to use shadow-cljs rather than cider as
>> a back end for evaluating clojurescript?
>
> I am inclined to question the usefulness of evaluating ClojureScript
> code *at all*.
>
>> More generally, I wonder if there would be any benefit in considering a
>> Clojure CLI Tools back end integration and bypassing CIDER altogether?
>
> Yes, I agree this would be better.
>
> I implemented (in master now) the support of inf-clojure.el to
> evaluate Clojure blocks.

I try to use 'inf-clojure babel eval backend. But I got error:

#+begin_example
Debugger entered--Lisp error: (void-function inf-clojure-cmd)
  (inf-clojure-cmd (inf-clojure-project-type))
  (let* ((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd 
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure" 
(format "clojure -A%s" alias) cmd0) cmd0))) (setq comint-prompt-regexp 
inf-clojure-comint-prompt-regexp) (funcall-interactively #'inf-clojure cmd) 
(goto-char (point-max)))
  (progn (let* ((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd 
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure" 
(format "clojure -A%s" alias) cmd0) cmd0))) (setq comint-prompt-regexp 
inf-clojure-comint-prompt-regexp) (funcall-interactively #'inf-clojure cmd) 
(goto-char (point-max
  (unwind-protect (progn (let* ((alias (cdr (assq :alias params))) (cmd0 
(inf-clojure-cmd (inf-clojure-project-type))) (cmd (if alias 
(replace-regexp-in-string "clojure" (format "clojure -A%s" alias) cmd0) cmd0))) 
(setq comint-prompt-regexp inf-clojure-comint-prompt-regexp) 
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max 
(set-window-configuration wconfig))
  (let ((wconfig (current-window-configuration))) (unwind-protect (progn (let* 
((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd 
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure" 
... cmd0) cmd0))) (setq comint-prompt-regexp inf-clojure-comint-prompt-regexp) 
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max 
(set-window-configuration wconfig)))
  (if (and inf-clojure-buffer (buffer-live-p (get-buffer inf-clojure-buffer))) 
nil (let ((wconfig (current-window-configuration))) (unwind-protect (progn 
(let* ((alias (cdr ...)) (cmd0 (inf-clojure-cmd ...)) (cmd (if alias ... 
cmd0))) (setq comint-prompt-regexp inf-clojure-comint-prompt-regexp) 
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max 
(set-window-configuration wconfig))) (sit-for 1))
  ob-clojure-eval-with-inf-clojure("(print \"hello, world\")" ((:colname-names) 
(:rowname-names) (:result-params "replace") (:result-type . value) (:results . 
"replace") (:exports . "") (:session . "none") (:hlines . "no") (:tangle . 
"no") (:cache . "yes") (:mkdirp . "yes") (:show-process . "no") (:noweb . 
"yes") (:eval . "yes")))
  (cond ((eq org-babel-clojure-backend 'inf-clojure) 
(ob-clojure-eval-with-inf-clojure expanded params)) ((eq 
org-babel-clojure-backend 'cider) (ob-clojure-eval-with-cider expanded params)) 
((eq org-babel-clojure-backend 'slime) (ob-clojure-eval-with-slime expanded 
params)))
  (setq result (cond ((eq org-babel-clojure-backend 'inf-clojure) 
(ob-clojure-eval-with-inf-clojure expanded params)) ((eq 
org-babel-clojure-backend 'cider) (ob-clojure-eval-with-cider expanded params)) 
((eq org-babel-clojure-backend 'slime) (ob-clojure-eval-with-slime expanded 
params
  (let* ((expanded (org-babel-expand-body:clojure body params)) (result-params 
(cdr (assq :result-params params))) result) (setq result (cond ((eq 
org-babel-clojure-backend 'inf-clojure) (ob-clojure-eval-with-inf-clojure 
expanded params)) ((eq org-babel-clojure-backend 'cider) 
(ob-clojure-eval-with-cider expanded params)) ((eq org-babel-clojure-backend 
'slime) (ob-clojure-eval-with-slime expanded params (let ((--params 
result-params)) (if (member "none" --params) nil (if (or (member "scalar" 
--params) (member "verbatim" --params) (member "html" --params) (member "code" 
--params) (member "pp" --params) (member "file" --params) (and (or (member 
"output" --params) (member "raw" --params) (member "org" --params) (member 
"drawer" --params)) (not (member "table" --params result (condition-case 
nil (org-babel-script-escape result) (error result))
  org-babel-execute:clojure("(print \"hello, world\")" ((:colname-names) 
(:rowname-names) (:result-params "replace") (:result-type . value) (:results . 
"replace") (:exports . "") (:session . "none") (:hlines . "no") (:tangle . 
"no") (:cache . "yes") (:mkdirp . "yes") (:show-process . "no") (:noweb . 
"yes") (:eval . "yes")))
  funcall(org-babel-execute:clojure "(print \"hello, world\")" 
((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . 
value) (:results . "replace") (:exports . "") (:session .