Re: [O] Multiple underscores crash org latex export; other exporters survive

2016-12-03 Thread Scott Randby
On 12/03/2016 05:31 PM, Charles C. Berry wrote:
> On Sat, 3 Dec 2016, Scott Randby wrote:
> 
>> On 12/03/2016 02:40 PM, Scott Otterson wrote:
>>> When an org file contains a string with more than one underscore, the
>>> orgmode export result will crash latex (example attached).   On the
>>> other hand, the org html export does finish successfully, and while
>>> result is odd, it's odd in a way that makes the problem visible and easy
>>> to identify.
>>
>> I exported your file using LaTeX export without trouble. The result does
>> look odd, but that is because the string you gave is missing the braces
>> needed to make it export properly. The output messages warn that the
>> string contains a double subscript, so the problem is with the string
>> and not Org's LaTeX export.
>>
>> Your string: a_variable_deleteThisAndItWorks
>>
>> Properly formed string: a_{variable_{deleteThisAndItWorks}}
> 
> I don't think the OP wanted double subscripts.  If the OP really wanted
> "heavily underscored code snippets", something like:
> 
> Code snippet:  ~a_variable_deleteThisAndItWorks~
> 
> seems like the way to go.

It seems I misunderstood the original question.

There is an interesting issue here. I sometimes want to use ~ in a code
snippet, so I can't use ~code snippet~. Yet,

Org code: \verb@a_variable_deleteThisAndItWorks@

Exported LaTeX: \verb@a\(_{\text{variable}}_{\text{deleteThisAndItWorks}}\)@

The exported LaTeX is not what we want. Instead,

Org code: #+latex:\verb@a_variable_deleteThisAndItWorks@

Alternative: @@latex:\verb@a_variable_deleteThisAndItWorks@@@

Exported LaTeX: \verb@a_variable_deleteThisAndItWorks@

I've wondered why \verb isn't exported correctly without specifying it
as literal LaTeX, but I don't have the expertise to be able to determine
why.

Scott



Re: [O] [bug] timed repeater shows up in wrong place

2016-12-03 Thread cesar mena
hello,

Nicolas Goaziou  writes:

> Hello,
>
> Samuel Wales  writes:
>
>> thanks for the explanation.  the idea is that org 9 is using the
>> previously scheduled section as a complete list and that it did not
>> trigger on the first day and did on the second, and show-all nil in
>> org 9 does not refer to the scheduled section but only to the repeater
>> instances?
>
> I'm not sure to understand.
>
> Anyway, I pushed a change to maint that should solve the "72x vs. 2x"
> issue.

just making sure i'm getting this.

in maint, if org-agenda-repeating-timestamp-show-all is nil we get
72x. if it is non nil we get 2x. i'm in the 72x camp, so i don't need to
do anything.

when master comes around org-agenda-repeating-timestamp-show-all will go
away. to get 72x make sure that org-agenda-prefer-last-repeat is nil (?)

close?

thanks.

-cm


>>> I think we need a new variable, or to change this one, to have both
>>> behaviours possible. Suggestions (and docstrings) are welcome, we can
>>> implement them in master branch.
>>
>> the issues seem to be:
>>
>>   1] 72x vs. 2x
>>   2] duplicate in previously scheduled vs. not
>>
>> 1 is critical as it affects sorting.  perhaps
>> org-agenda-repeater-previously-scheduled-counts?  values could include
>> 'from-timestamp and 'from-previous-instance.
>> the latter is org 8.
>>
>> 2 is not critical.  i might be able to get used to having a complete
>> scheduled section.
>>
>> [dunno if previously-scheduled is a clear name.  i call it "nokori"
>> from the japanese for "remaining" merely to be unambiguous [i don't
>> care if it's in sumerian as long as it's unambiguous] but i don't
>> suppose that would work for most people.]
>
> I implemented the following variables in master:
>
> - `org-agenda-show-future-repeats'
> - `org-agenda-prefer-last-repeat'
>
> and removed `org-agenda-repeating-timestamp-show-all', which was
> ambiguous.
>
> Basically, IIUC, setting `org-agenda-show-future-repeats' to nil and
> `org-agenda-prefer-last-repeat' to t should reproduce exactly the
> behaviour of Org 8.
>
> Also, the combination of the two variables above gives more flexibility.
>
> Feedback welcome.
>
>
> Regards,
>
> -- 
> Nicolas Goaziou



Re: [O] org.texi edits, patch attached

2016-12-03 Thread Nicolas Goaziou
Hello,

Lambda Coder  writes:

> See the attached patch file diff'd against maint.

Applied. Thank you for all that work.

Regards,

-- 
Nicolas Goaziou



Re: [O] buffer local org-src-preserve-indentation not respected

2016-12-03 Thread Nicolas Goaziou
Hello,

David Dynerman  writes:

> I'd like to report a bug. It seems that setting
> org-src-preserve-indentation to true doesn't work if it's set buffer
> local.
>
> To reproduce, save the following as an org file:
>
> #+BEGIN_SRC python :tangle preserve-indent.py
> class Foo:
> bar = 5
> #+END_SRC
>
>
> Here is some interstitial text!
>
> #+BEGIN_SRC python :tangle preserve-indent.py
> def __init__(self):
> self.bar = 7
> #+END_SRC
>
> Then:
>
> 1) (setq org-src-preserve-indentation nil) and tangle the file. Open
> preserve-indent.py and note that def __init__ has no leading whitespace,
> which means python will not recognize it as a member of Foo
>
> 2) (setq org-src-preserve-indentation t) and tangle the file. Open
> preserve-indent.py and note that now def __init__ is properly
> indented. This is the expected behavior.
>
> 3) (setq org-src-perserve-indentation nil), then M-x
> make-variable-buffer-local and set org-src-preserve-indentation to
> t. Tangle the file and open preserve-indent.py. Note that def __init__
> is back to being not-indented. The expected behavior is that the
> indentation would be respected, as in #2.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [bug] timed repeater shows up in wrong place

2016-12-03 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> thanks for the explanation.  the idea is that org 9 is using the
> previously scheduled section as a complete list and that it did not
> trigger on the first day and did on the second, and show-all nil in
> org 9 does not refer to the scheduled section but only to the repeater
> instances?

I'm not sure to understand.

Anyway, I pushed a change to maint that should solve the "72x vs. 2x"
issue.

>> I think we need a new variable, or to change this one, to have both
>> behaviours possible. Suggestions (and docstrings) are welcome, we can
>> implement them in master branch.
>
> the issues seem to be:
>
>   1] 72x vs. 2x
>   2] duplicate in previously scheduled vs. not
>
> 1 is critical as it affects sorting.  perhaps
> org-agenda-repeater-previously-scheduled-counts?  values could include
> 'from-timestamp and 'from-previous-instance.
> the latter is org 8.
>
> 2 is not critical.  i might be able to get used to having a complete
> scheduled section.
>
> [dunno if previously-scheduled is a clear name.  i call it "nokori"
> from the japanese for "remaining" merely to be unambiguous [i don't
> care if it's in sumerian as long as it's unambiguous] but i don't
> suppose that would work for most people.]

I implemented the following variables in master:

- `org-agenda-show-future-repeats'
- `org-agenda-prefer-last-repeat'

and removed `org-agenda-repeating-timestamp-show-all', which was
ambiguous.

Basically, IIUC, setting `org-agenda-show-future-repeats' to nil and
`org-agenda-prefer-last-repeat' to t should reproduce exactly the
behaviour of Org 8.

Also, the combination of the two variables above gives more flexibility.

Feedback welcome.


Regards,

-- 
Nicolas Goaziou



Re: [O] Multiple underscores crash org latex export; other exporters survive

2016-12-03 Thread Charles C. Berry

On Sat, 3 Dec 2016, Scott Randby wrote:


On 12/03/2016 02:40 PM, Scott Otterson wrote:

When an org file contains a string with more than one underscore, the
orgmode export result will crash latex (example attached).   On the
other hand, the org html export does finish successfully, and while
result is odd, it's odd in a way that makes the problem visible and easy
to identify.


I exported your file using LaTeX export without trouble. The result does
look odd, but that is because the string you gave is missing the braces
needed to make it export properly. The output messages warn that the
string contains a double subscript, so the problem is with the string
and not Org's LaTeX export.

Your string: a_variable_deleteThisAndItWorks

Properly formed string: a_{variable_{deleteThisAndItWorks}}


I don't think the OP wanted double subscripts.  If the OP really wanted 
"heavily underscored code snippets", something like:


Code snippet:  ~a_variable_deleteThisAndItWorks~

seems like the way to go.

See (info "(org) Emphasis and monospace")

That way the latex is

: \texttt{a\_variable\_deleteThisAndItWorks}

and that idiom would properly render html as

: a_variable_deleteThisAndItWorks

rather than

: avariabledeleteThisAndItWorks

as in OPs case. The latter is valid html, but doesn't seem quite like the 
right thing to do for code snippets.


HTH,

Chuck



Scott Randby



Many people have orgfiles with heavily underscored code snippets buried
deep inside.  To them, the latex crashes are probably as mysterious as
they were to me.  So I'd like to suggest that the org latex exporter
adopt something like the org html exporter behavior.









Re: [O] [Patch v2] Add support for sqsh sql src blocks

2016-12-03 Thread MaDhAt2r

Absolutely. 

Thanks,

Micah

>From f7c71428981a5f7c0ff5ee44fcecf7003c340813 Mon Sep 17 00:00:00 2001
From: madhat2r 
Date: Sat, 3 Dec 2016 09:33:13 -0600
Subject: [PATCH] add sqsh engine and ORG-NEWS entry

---
 etc/ORG-NEWS   | 17 
 lisp/ob-sql.el | 85 +-
 2 files changed, 77 insertions(+), 25 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9be2443..37832a8 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -64,6 +64,23 @@ is specified then all the output from the window will appears in the
 results section.  If =value= is specified, then only the last returned
 value of the code will be displayed in the results section.
 
+ SQL: new engine added ~sqsh~ 
+
+A new engine was added to support ~sqsh~ command line utility for use
+against Microsoft SQL Server or Sybase SQL server.
+
+More information on ~sqsh~ can be found here: [[https://sourceforge.net/projects/sqsh/][sourceforge/sqsh]] 
+
+To use ~sqsh~ in an *sql* =SRC_BLK= set the =:engine= like this:
+
+#+begin_example
+,#+BEGIN_SRC sql :engine sqsh :dbhost my_host :dbuser master :dbpassword pass :database support
+Select * From Users
+Where clue > 0
+,#+END_SRC
+#+end_example
+
+
 *** Horizontal rules are no longer ignored in LaTeX table math mode
 
 * Version 9.0
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index ec94c35..9293329 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -48,10 +48,19 @@
 ;; - rownames
 ;; - rowname-names
 ;;
+;;
+;; Engines supported:
+;; - mysql
+;; - dbi
+;; - mssql
+;; - sqsh
+;; - postgresql
+;; - oracle
+;;
 ;; TODO:
 ;;
 ;; - support for sessions
-;; - support for more engines (currently only supports mysql)
+;; - support for more engines
 ;; - what's a reasonable way to drop table data into SQL?
 ;;
 
@@ -66,13 +75,13 @@
 (defvar org-babel-default-header-args:sql '())
 
 (defconst org-babel-header-args:sql
-  '((engine	   . :any)
-(out-file	   . :any)
-(dbhost	   . :any)
-(dbport	   . :any)
-(dbuser	   . :any)
-(dbpassword	   . :any)
-(database	   . :any))
+  '((engine	.	:any)
+(out-file	.	:any)
+(dbhost	.	:any)
+(dbport	.	:any)
+(dbuser	.	:any)
+(dbpassword	.	:any)
+(database	.	:any))
   "SQL-specific header arguments.")
 
 (defun org-babel-expand-body:sql (body params)
@@ -95,9 +104,9 @@
 Pass nil to omit that arg."
   (combine-and-quote-strings
(delq nil
-	 (list (when host (concat "-h" host))
-	   (when port (format "-p%d" port))
-	   (when user (concat "-U" user))
+	 (list (when host (concat "-h" host))
+	   (when port (format "-p%d" port))
+	   (when user (concat "-U" user))
 	   (when database (concat "-d" database))
 
 (defun org-babel-sql-dbstring-oracle (host port user password database)
@@ -110,12 +119,23 @@ Pass nil to omit that arg."
 SQL Server on Windows and Linux platform."
   (mapconcat #'identity
 	 (delq nil
-		   (list (when host (format "-S \"%s\"" host))
-			 (when user (format "-U \"%s\"" user))
+		   (list (when host (format "-S \"%s\"" host))
+			 (when user (format "-U \"%s\"" user))
 			 (when password (format "-P \"%s\"" password))
 			 (when database (format "-d \"%s\"" database
 	 " "))
 
+(defun org-babel-sql-dbstring-sqsh (host user password database)
+  "Make sqsh commmand line args for database connection.
+\"sqsh\" is one method to access Sybase or MS SQL via Linux platform"
+  (mapconcat #'identity
+ (delq nil
+   (list  (when host (format "-S \"%s\"" host))
+  (when user (format "-U \"%s\"" user))
+  (when password (format "-P \"%s\"" password))
+  (when database (format "-D \"%s\"" database
+ " "))
+
 (defun org-babel-sql-convert-standard-filename (file)
   "Convert the file name to OS standard.
 If in Cygwin environment, uses Cygwin specific function to
@@ -141,14 +161,14 @@ This function is called by `org-babel-execute-src-block'."
  (in-file (org-babel-temp-file "sql-in-"))
  (out-file (or (cdr (assq :out-file params))
(org-babel-temp-file "sql-out-")))
-	 (header-delim "")
+ (header-delim "")
  (command (pcase (intern engine)
-(`dbi (format "dbish --batch %s < %s | sed '%s' > %s"
+		(`dbi (format "dbish --batch %s < %s | sed '%s' > %s"
   (or cmdline "")
   (org-babel-process-file-name in-file)
   "/^+/d;s/^|//;s/(NULL)/ /g;$d"
   (org-babel-process-file-name out-file)))
-(`monetdb (format "mclient -f tab %s < %s > %s"
+		(`monetdb (format "mclient -f tab %s < %s > %s"
   (or cmdline "")
   (org-babel-process-file-name in-file)
   (org-babel-process-file-name out-file)))
@@ -160,7 +180,15 @@ This function is called by `org-babel-execute-src-block'."
  

Re: [O] Multiple underscores crash org latex export; other exporters survive

2016-12-03 Thread Scott Randby
On 12/03/2016 02:40 PM, Scott Otterson wrote:
> When an org file contains a string with more than one underscore, the
> orgmode export result will crash latex (example attached).   On the
> other hand, the org html export does finish successfully, and while
> result is odd, it's odd in a way that makes the problem visible and easy
> to identify.

I exported your file using LaTeX export without trouble. The result does
look odd, but that is because the string you gave is missing the braces
needed to make it export properly. The output messages warn that the
string contains a double subscript, so the problem is with the string
and not Org's LaTeX export.

Your string: a_variable_deleteThisAndItWorks

Properly formed string: a_{variable_{deleteThisAndItWorks}}

Scott Randby

> 
> Many people have orgfiles with heavily underscored code snippets buried
> deep inside.  To them, the latex crashes are probably as mysterious as
> they were to me.  So I'd like to suggest that the org latex exporter
> adopt something like the org html exporter behavior.
> 
> 



Re: [O] Latex export fails for plain lists deeper than four, works for html

2016-12-03 Thread Nicolas Goaziou
Hello,

Scott Otterson  writes:

> If a plain list has more than four levels, org-mode will produce latex that
> crashes.  See attached.  On the other hand, html export works fine, even
> for much deeper lists.
>
> In a large org file, this export error is pretty time consuming for a naive
> user (me) to isolate, so I'd like to suggest that, before crashing latexmk,
> org-mode should at least print a human-readable warning -- especially since
> deep list export works for other export types.
>
> Better yet, would be deeper latex lists.  There are ways:
>
> http://tex.stackexchange.com/questions/41408/a-five-level-deep-list
> 1. level 1.1
>1. level 2.1
>   1. level 3.1
>  1. level 4.1
> 1. level 5.1 (works if this level is deleted)
> 2. level 5.2 (works if this level is deleted)
>  2. level 4.2
>   2. level 3.2
>2. level 2.2
> 2. level 1.2

Again, this doesn't crash here. 

Also, the manual already gives hint about how to support more than four
levels of nesting for lists.

Regards,

-- 
Nicolas Goaziou



Re: [O] [Patch v2] Add support for sqsh sql src blocks

2016-12-03 Thread Nicolas Goaziou
Hello,

MaDhAt2r  writes:

> I went ahead and set up a public branch for these changes.
>
> I added ORG-NEWS entry, and some other minor changes in the commentary
> of ob-sql.el.

Great.

> https://github.com/madhat2r/org-mode/tree/feature/babel-sqsh-engine

Would you mind sending me the patch through this ML?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Latex export fails with link in headline

2016-12-03 Thread Nicolas Goaziou
Hello,

Scott Otterson  writes:

> Could you please check the .tex output you got when exported my .org file
> example (attached again)?  In the .tex I get (also attached), it's clear
> that org-mode has forgotten to escape the '#' in the URL.  In headlink.tex,
> if I replace '#' with ''\#', then latexmk can successfully make a pdf.
>
> Do you see something different?

I do. While I get the same .tex output, compiling the file to a pdf
doesn't crash. I also use Texlive, but on GNU/Linux.

Besides, Org mode doesn't escape anything. It calles `url-encode-url' on
the link instead.

Regards,

-- 
Nicolas Goaziou



Re: [O] capitalization of titles in org-ref

2016-12-03 Thread John Kitchin
you could try commenting out orcb-key too. it should be using the
bibtex-autokey settings though.

Georg W. Otto writes:

> John Kitchin  writes:
>
>> That happens because of the function org-ref-title-case-article in the
>> variable org-ref-clean-bibtex-entry-hook.
>>
>> Just set org-ref-clean-bibtex-entry-hook to have what you want in it
>> in your init files to prevent the title casing from occurring.
>>
>
> Thanks a lot for your answer. Unfortunately I am not very elisp-savy, so
> excuse me if I did something silly. I set
> org-ref-clean-bibtex-entry-hook in my init file and commented out
> org-ref-title-case-article like this:
>
> (setq bibtex-dialect 'biblatex)
>
> (setq org-ref-clean-bibtex-entry-hook
>   '(orcb-key-comma
> org-ref-replace-nonascii
> orcb-&
> orcb-%
> ;; org-ref-title-case-article
> orcb-clean-year
> orcb-key
> orcb-clean-doi
> orcb-clean-pages
> org-ref-sort-bibtex-entry))
>
> (setq bibtex-align-at-equal-sign t
>   bibtex-autokey-name-year-separator ""
>   bibtex-autokey-year-title-separator ""
>   bibtex-autokey-titleword-separator ""
>   bibtex-autokey-titleword-first-ignore '("the" "a" "if" "and" "an")
>   bibtex-autokey-titleword-length 30
>   bibtex-autokey-titlewords 3
>   bibtex-autokey-titleword-case-convert-function (quote identity)
>   bibtex-autokey-name-case-convert-function (quote capitalize)
>   bibtex-autokey-year-length 4
>   )
>
> As intended, the title words do not get capitalized, but now the bibtex
> key only contains . Instead I need the
> first three title words, in order to stay compatible with my existing
> bibtex library. Any idea?
>
> Cheers,
>
> Georg


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



Re: [O] latex src block file output

2016-12-03 Thread Anthony Cowley

Nicolas Goaziou writes:

> Hello,
>
> Anthony Cowley  writes:
>
>> When I hit C-c C-c on a latex src block with a :file header,
>> I ultimately get an error from org-compile-file that the expected
>> output file in a temp directory was not produced. However, the file is
>> produced in the current directory.
>>
>> For instance, evaluating the src block in the following Org document,
>>
>> * A Little Diagram
>>
>> #+BEGIN_SRC latex :file diagram.pdf :packages '(("" "tikz")) :border 1em
>> \usetikzlibrary{shapes,arrows}
>> \begin{tikzpicture}[->, auto, node distance=3cm]
>>   \node [draw] (A) {A};
>>   \node [ellipse, draw, right of=A] (B) {B};
>>   \path (A) edge node {message} (B);
>> \end{tikzpicture}
>> #+END_SRC
>>
>>
>> Gives me the error,
>>
>> Debugger entered--Lisp error: (error "File 
>> \"/var/folders/n6/0j2z684n2pq_0d5kphzzvjs8gn/T/babel-7327204x/latex-73272sec.pdf\"
>>  wasn’t produced.  See \"*Org PDF LaTeX Output*\" for details")
>
> I cannot reproduce it. What Org version are you using? What is the value
> of `org-latex-pdf-process'?

Hi Nicolas, the org version I included in that original email was:
Org mode version 9.0.1 (9.0.1-elpaplus @ 
/Users/acowley/.emacs.d/elpa/org-plus-contrib-20161118/)

However I have since fixed the issue I was having. The problem was three-fold:

- My `org-latex-pdf-process` was a call to latexmk that did /not/ set 
`-outdir`. This was fine for exporting a document as LaTeX as all the work 
happened in the one directory, but evaluating a LaTeX src block involves a 
temporary directory.

- The value substituted for the `%o` placeholder in `org-latex-pdf-process` 
included a trailing slash which prevented it from working due to a double slash 
appearing in constructed paths (looking at my notes, I seem to have removed 
this parameter because of this problem). I now set `-outdir` to the output of a 
sub-shell that pipes `%o` through sed to remove the trailing slash.

- I still encountered an error when evaluating the src block even though the 
PDF was being produced. The error was during cleanup of temporary files, 
specifically a .log file. The failure to delete a nonexistent file was stopping 
the Org machinery that would next insert the result in my document. I addressed 
this by changing the second parameter of the call to `directory-files` in the 
`org-latex-compile` function from `nil` to `t` so that it would return absolute 
paths.

Since making those three changes, I am able to evaluate LaTeX src blocks and 
have the resulting figures appear in my Org document.

Thanks for all the hard work, and sorry I didn't follow up on my own report 
more promptly.

Anthony



[O] Multiple underscores crash org latex export; other exporters survive

2016-12-03 Thread Scott Otterson
When an org file contains a string with more than one underscore, the
orgmode export result will crash latex (example attached).   On the other
hand, the org html export does finish successfully, and while result is
odd, it's odd in a way that makes the problem visible and easy to identify.

Many people have orgfiles with heavily underscored code snippets buried
deep inside.  To them, the latex crashes are probably as mysterious as they
were to me.  So I'd like to suggest that the org latex exporter adopt
something like the org html exporter behavior.


multiple_underscores.org
Description: Binary data


[O] Disable consistency graphs for some habits

2016-12-03 Thread Jorge Peixoto de Morais Neto
When I am trying to learn a new habit, I often write it in Org Mode.  So I
have many entries like:

*** TODO Relax: talk, read book, shower or pray
SCHEDULED: <2016-11-28 Mon 21:30 ++1d>
:PROPERTIES:
:ID:   2ff41cfe-156f-4870-a4ef-991cc2cc986c
:CREATED:  [2016-06-16 Thu 13:23]
    :STYLE:habit
:END:

That one is to remember me to quit the computer at 21:30.

I set them up as org-habit habits for the following desirable features:
- Only show on the agenda for today, not for other days.
- Appear at the end of the agenda for today.
- Hide when I type K.

However, I do not want consistency graphs for most of them, because I don't
want to waste space by enabling logging for them all (they are many).  org-
habit lacks the feature to cleanly disable consistency graphs.  I have
globally disabled them by force through the following customizations:
     '(org-habit-following-days 0)
     '(org-habit-graph-column 90)
     '(org-habit-preceding-days 0)

But this affects all habits.  Could you implement a feature to disable
consistency graphs for a subset of the habits?  Some possibilities:
1. Allow a new value for the STYLE property: "graphless_habit"
2. Automatically disable consistency graphs for entries where logging is
   disabled, or for those which currently lack logs.

Regards
-- 
• I am Brazilian.  I hope my English is correct and I welcome corrections.
• Please adopt free formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
• Free (as in free speech) software for Android: https://f-droid.org/






Re: [O] capitalization of titles in org-ref

2016-12-03 Thread Georg W. Otto
John Kitchin  writes:

> That happens because of the function org-ref-title-case-article in the
> variable org-ref-clean-bibtex-entry-hook.
>
> Just set org-ref-clean-bibtex-entry-hook to have what you want in it
> in your init files to prevent the title casing from occurring.
>

Thanks a lot for your answer. Unfortunately I am not very elisp-savy, so
excuse me if I did something silly. I set
org-ref-clean-bibtex-entry-hook in my init file and commented out
org-ref-title-case-article like this:

(setq bibtex-dialect 'biblatex)

(setq org-ref-clean-bibtex-entry-hook
  '(orcb-key-comma
org-ref-replace-nonascii
orcb-&
orcb-%
;; org-ref-title-case-article
orcb-clean-year
orcb-key
orcb-clean-doi
orcb-clean-pages
org-ref-sort-bibtex-entry))

(setq bibtex-align-at-equal-sign t
  bibtex-autokey-name-year-separator ""
  bibtex-autokey-year-title-separator ""
  bibtex-autokey-titleword-separator ""
  bibtex-autokey-titleword-first-ignore '("the" "a" "if" "and" "an")
  bibtex-autokey-titleword-length 30
  bibtex-autokey-titlewords 3
  bibtex-autokey-titleword-case-convert-function (quote identity)
  bibtex-autokey-name-case-convert-function (quote capitalize)
  bibtex-autokey-year-length 4
  )

As intended, the title words do not get capitalized, but now the bibtex
key only contains . Instead I need the
first three title words, in order to stay compatible with my existing
bibtex library. Any idea?

Cheers,

Georg

-- 
Georg Otto
The UCL Institute of Child Health





Re: [O] Include sections of org document in tangled files

2016-12-03 Thread Charles C. Berry

On Fri, 2 Dec 2016, David Dynerman wrote:


Dear list,

Is it possible to include sections of an org document while tangling.

I have in mind something like the following:

* Some section


[David's version deleted]

#+NAME: doc
#+BEGIN_SRC org :exports results :results replace
  This is an introduction. We're going to write some code that
  implements (a finite version of) the formula

  \[
  f(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \ldots +
  \frac{x^n}{n!} + \ldots
  \]

  Here's some background about the exponential function.

#+END_SRC

#+header: :noweb (unless org-export-current-backend "yes")
#+BEGIN_SRC python :tangle myfunction.py
  from math import factorial

  def f(x,n):
  """
  <>
  """

  y = 0
  for i in range(n+1):
  y = y + x**i/factorial(i)

  return y
#+END_SRC



The idea would be that when I export this to HTML, I get a nice literate
programming math jax'd section introduction that explains what the
function is doing.


Right. The above does that.

You need `org' as a babel language. Eval'ing `(require 'ob-org)' is good 
enough for just trying to export this, but customizing 
`org-babel-load-languages' to include `org' is better if you use this 
regularly.




Then, when I tangle to generate the python file, the
org section introduction would be included as the python docstring of
the function.



And it does that.

---

There is an issue you might want to address if you use this approach. 
First, the first triple quotes must not be on the same line as the 
included src block reference. That is because """>""" will 
prepend the quotes to every line in `src-blk-ref'.


If you do not want the newlines between the quotes and the docstring, I 
think there is a post-tangle hook you can use to clean the tangled version 
by removing those newlines.


Also, you can use an export filter to remove the quotes and the noweb 
reference for a cleaner looking exported doc.


Note that you need to use a unique name for each src-block.

HTH,

Chuck



[O] Allow #+SETUPFILE to point to an URL for the org file

2016-12-03 Thread Kaushal Modi
Hello,

I would like to put my common org config in github so that I can access it
from anywhere/any machine.

Currently I have

#+SETUPFILE: ~/org/common/config.org

I would like to do something like

#+SETUPFILE: https://cdn.rawgit.com/path/to/config.org

I can probably add an async shell execution to wget that link, save it to
/tmp/config.org and then replace

#+SETUPFILE: https://cdn.rawgit.com/path/to/config.org

with

#+SETUPFILE: /tmp/config.org

in, may be, org-export-before-processing-hook?

But has someone already implemented something like this?

Thanks.
-- 

Kaushal Modi


Re: [O] fuzzy matching of parameters

2016-12-03 Thread Matt Price
THanks, John, I'm sure you're right actually. So I've just written my
matching function like this:

(lambda (f) (string-match (concat "\\\(" fname "\\\)\\\([^[:alnum:]]\\\)*"
lname) f))

and if that has a nil result:

(lambda (f) (string-match (concat "\\\(" nname "\\\)\\\([^[:alnum:]]\\\)*"
lname) f))

That seems to work pretty well so far.  And as you suggest, I've written a
simple function that calls read-file-name for org-attach-attach in the
appropriate directory -- though it' s extremely simple, it makes manual
attachment much quicker when my brain starts to get foggy from grading
papers.

On Fri, Dec 2, 2016 at 8:55 AM, John Kitchin 
wrote:

> I would not do that if I were you. The fuzzy match might inadvertently
> send feed back to the wrong student. I would fall back to some manual
> attachment if you do not find an exact match, e.g. using helm or ivy to
> select the files for attachment, perhaps sorted and matched using their
> fuzzy algorithms.
>
>
>
> Matt Price writes:
>
> > I have just done something I'm very excited about.  Given a directory
> name
> > (the variable ~assignment~ in this case) and a list of student info,
> search
> > through the directory for files whose names contain the student names,
> and
> > attach those to newly created subtrees.
> >
> > Before now, manually attaching those files has been a real pain, so it's
> > great to have this automated! However, sometimes the name I have on file
> > doesn't quite match the submitted name. In particular, my Chinese
> students
> > usually have an English first name that we use in class, and a
> > transliterated Chinese personal name that is used in official documents
> > (like my class list).  I would like to first try to match the whole name,
> > and if that fails, attempt some kind of "fuzzy" match of the name. I'm
> not
> > sure the best way to go about it.
> >
> > Any suggestions? Here is, I think, the relevant section of code (I can
> post
> > the wider context if that would be helpful). Thanks!
> >
> > Matt
> >
> > (mapcar (lambda (stu)
> >   (let ((name (car stu))
> > (email (cdr stu))
> > )
> > (insert (format "\n** %s" name))
> > (org-todo 'todo)
> > (org-set-property "MAIL_TO" email)
> > (org-set-property "MAIL_SUBJECT"
> >   (format "Comments on %s
> > Assignment (%s)"
> >
> > (mwp-org-get-parent-headline) name ))
> > ;; try to attach files, if possible
> > (condition-case nil
> > (let* (( afiles (directory-files
> > assignment  nil name)))
> >   (if afiles
> >   (dolist (f afiles)
> > (org-attach-attach (concat
> > (file-name-directory (buffer-file-name)) assignment "/" f) ))
> > (message "No files match name of %s"
> > name)))
> >   (error (message "Unable to attach file
> > belonging to student")))
> > (save-excursion
> >   (org-mark-subtree)
> >   (org-cycle nil))
> > )) students)
>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>


[O] Latex export fails for plain lists deeper than four, works for html

2016-12-03 Thread Scott Otterson
If a plain list has more than four levels, org-mode will produce latex that
crashes.  See attached.  On the other hand, html export works fine, even
for much deeper lists.

In a large org file, this export error is pretty time consuming for a naive
user (me) to isolate, so I'd like to suggest that, before crashing latexmk,
org-mode should at least print a human-readable warning -- especially since
deep list export works for other export types.

Better yet, would be deeper latex lists.  There are ways:

http://tex.stackexchange.com/questions/41408/a-five-level-deep-list


only4plainListLevels.org
Description: Binary data


Re: [O] [Patch v2] Add support for sqsh sql src blocks

2016-12-03 Thread MaDhAt2r

Thanks Nicolas.

I went ahead and set up a public branch for these changes.

I added ORG-NEWS entry, and some other minor changes in the commentary
of ob-sql.el.

https://github.com/madhat2r/org-mode/tree/feature/babel-sqsh-engine

-Micah

On Dec 03 at 09:08 AM, Nicolas Goaziou said thus:
> Hello,
>
> MaDhAt2r  writes:
>
>> Thanks for your comments Nicolas! I hope this is better.
>
> Thank you. This looks good.
>
> However, I'm not able to apply it on master branch. Could you rebase
> your branch against master and send that patch again?
>
> Also, could you provide an ORG-NEWS entry about the new feature?
>
>> +(defun org-babel-sql-dbstring-sqsh (host user password database)
>> +  "Make sqlcmd commmand line args for database connection.
>> +`sqsh' is one method to access Sybase or MS SQL via Linux platform"
>
> `sqsh' -> "sqsh"
>
>> +  (cond
>> + ((equal (intern engine) 'sqsh)
>> +(org-table-import out-file '(4))
>> +)
>
> The lonesome parenthesis should go to the line above it.
>
>
> Regards,
>
> -- 
> Nicolas Goaziou



Re: [O] Bug: Latex export fails with link in headline

2016-12-03 Thread Scott Otterson
Hi Nicolas,

Could you please check the .tex output you got when exported my .org file
example (attached again)?  In the .tex I get (also attached), it's clear
that org-mode has forgotten to escape the '#' in the URL.  In headlink.tex,
if I replace '#' with ''\#', then latexmk can successfully make a pdf.

Do you see something different?

Thanks,

Scott

On Tue, Nov 29, 2016 at 1:57 PM, Scott Otterson 
wrote:

> Very strange.  I moved to a different Windows machine, totally reinstalled
> elpa/melpa, and the tmp.org file that emailed the list still failed.  I
> even copied tmp.org out of my email to be sure we're looking at the same
> thing.
>
> Could it be something like you're running Linux and I'm running Windows,
> or like I'm running TexLive and you're running MikTex?  I've attached the
> output of M-x report-emacs-bug so you can see my whole setup.
>
> I've also attached a different oddly crashing org file, and the latex
> error buffer I get after typing C-c C-e l o
>
> Scott
>
> On Mon, Nov 28, 2016 at 12:26 PM, Nicolas Goaziou 
> wrote:
>
>> Hello,
>>
>> Scott Otterson  writes:
>>
>> > Latex export sometimes fails when I put a link in a headline  Usually,
>> > links in headlines work fine but below is an example that doesn't (error
>> > message in emacs buffer attached); If I remove the link, the export is
>> > successful.
>> >
>> > -- tmp.org 
>> -
>> >
>> > * Some section  [[
>> > http://orgmode.org/manual/Column-groups.html#Column-groups][A random
>> link]]
>> >
>> >   - Item A
>> >   - Item B
>> >   - Item C
>>
>> FWIW I cannot reproduce it.
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>
>


headlink.org
Description: Binary data


headlink.tex
Description: TeX document


Re: [O] [Patch v2] Add support for sqsh sql src blocks

2016-12-03 Thread Nicolas Goaziou
Hello,

MaDhAt2r  writes:

> Thanks for your comments Nicolas! I hope this is better.

Thank you. This looks good.

However, I'm not able to apply it on master branch. Could you rebase
your branch against master and send that patch again?

Also, could you provide an ORG-NEWS entry about the new feature?

> +(defun org-babel-sql-dbstring-sqsh (host user password database)
> +  "Make sqlcmd commmand line args for database connection.
> +`sqsh' is one method to access Sybase or MS SQL via Linux platform"

`sqsh' -> "sqsh"

> +  (cond
> +  ((equal (intern engine) 'sqsh)
> +(org-table-import out-file '(4))
> +)

The lonesome parenthesis should go to the line above it.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] org-bibtex.el: Make headline format costomizable

2016-12-03 Thread Nicolas Goaziou
Hello,

Eric Danan  writes:

> When adding an org-bibtex entry with `org-bibtex-write' (or any
> command relying on it), the headline is the title. The patch below
> simply makes the headline customizable through a new variable.

Thank you.

> If you find it worth to incorporate this into org-bibtex I should
> probably add a dosctring for the new variable

Yes, please. Also, an entry in ORG-NEWS is welcome.

> `org-bibtex-headline-format' and I would also have a few questions:
> 1. Should I name this variable differently?

Indeed. It should indicate it represents a function:
`org-bibltex-headline-format-function' is better, IMO, since a "format"
could be a format string.

> 2. Should I use `defcustom' instead of `defvar'?

Correct. Mind the :version and :package-version keywords.

> 3. Should I move the `defvar' / `defcustom' at the beginning of the file?

Yes.

> 4. In the default value of the variable should I make use of the `val'
> function that is let-bound inside `org-bibtex-write'?

I think the default value is fine. Another option is to create a new
`org-bibtex-headline-default' function and bound the variable to that.

> +(defvar org-bibtex-headline-format
> +  (lambda (entry)
> +(cdr (assoc :title entry

Nitpick

  `assoc' -> `assq'

Regards,

-- 
Nicolas Goaziou