[O] Tangling src blocks to files as part of export
Is it possible to have certain blocks tangled as part of export so that they are available as input files to later source blocks? E.g., #+BEGIN_SRC python :tangle hello.py print "Hello World" #+END_SRC #+BEGIN_SRC sh python hello.py #+END_SRC If I tangle before running, then the second code block will work; else, it fails because 'hello.py' is not found. [1] I can run tangle and export in a row (and I have my own function to do just that) but is there a native org way to do so? Michael [1] My actual case involves a JAGS model file and the R code to run it, so executing the first source block directly isn't an option.
Re: [O] Tangling src blocks to files as part of export
> On Nov 13, 2014, at 10:54 AM, Michael Weylandt > wrote: > > Is it possible to have certain blocks tangled as part of export so that they > are available as input files to later source blocks? > > E.g., > > #+BEGIN_SRC python :tangle hello.py > print "Hello World" > #+END_SRC > > #+BEGIN_SRC sh > python hello.py > #+END_SRC > > If I tangle before running, then the second code block will work; else, it > fails because 'hello.py' is not found. [1] > > I can run tangle and export in a row (and I have my own function to do just > that) but is there a native org way to do so? Adding org-babel-tangle to the org-export-before-processing-hook does the job, but I'd still be interested in knowing if there's a more official method.
Re: [O] Converting to a useful table in org-mode?
On Mar 18, 2014, at 20:39, Sharon Kimble wrote: > I have this list of books that I've read on my kindle which I now want > to store for posterity in org-mode. (OT thus sounds more like tasks/checklists to me) > > 24-11-13 - Andrew Lane - young sherlock Holmes, fire storm > 3-12-13 - Richmal Compton - just Williams New years day > 9-12-13 - richmal compton - still william > 11-1-14 - Pc wren - beau geste > 18-1-14 - Andrew Lane - young sherlock Holmes, the red leech > 26-1-14 - Ian Fleming - casino royale > 24-02-14 - Cory doctorow - little brother > > How can I create a table of them please? > > I've tried highlighting them and then converting the region, but with a bit > of elbow-grease and > deletions I get this - > > | 24-11-13 | Andrew Lane | young sherlock Holmes, fire storm > | > | 3-12-13 | Richmal Compton | justWilliams New years day > | > | 9-12-13 | richmal compton | still william > | > | 11-1-14 | Pc wren | beaugeste > | > | 18-1-14 | Andrew Lane | young sherlock Holmes, thered > leech | > | 26-1-14 | Ian Fleming | casino royale > | > | 24-02-14 | Cory doctorow | little brother > | That looks like a table -- assuming the leftmost pipe is the first character in each row, org should recognize it as a table. For me, the most obvious sign involves turning it purple but I'm not sure if that's set by my color theme or not. If it's a table, just put point anywhere inside it and hit TAB and it should auto align (left justified by default) If that's not working, please send a copy of the file in question and details of your setup, including but not limited to the output of `M-x org-version` and everything in your .emacs with an "org" in it. Hope that helps, Michael > > which looks stilted and unnatural! How can I close the gaps in the > cells please and get it all left-aligned? I've tried tabbing in the > cell and that didn't work, and neither did 'C-c C-c'. > > Thanks > Sharon. > -- > A taste of linux = http://www.sharons.org.uk > my git repo = https://bitbucket.org/boudiccas/dots > Debian testing, Fluxbox 1.3.5, emacs 24.3.1 > Registered Linux user 561944
[O] Out of Order Evaluation
Hi, I want to put a summary of my analysis at the beginning of a document using results calculated at the end of the document. Is this possible? #= #+TITLE: Test #+AUTHOR: Michael Weylandt #+PROPERTY: header-args:R :session *__R__* :exports both * Summary The mean result was src_R[:exports results]{mean(x)} * Analysis, We do some complicated calculations: #+BEGIN_SRC R x <- rnorm(5) #+END_SRC #= Is this possible in a single pass? I've played with #+NAME and <> but haven't gotten the out-of-order evaluation quite right. Michael (Bonus question, is there a way to not have to put ":exports results" in inline blocks?)
Re: [O] Out of Order Evaluation
On Mar 20, 2014, at 21:34, Charles Berry wrote: > Andreas Leha med.uni-goettingen.de> writes: > >> >> Hi Michael, >> >> Michael Weylandt gmail.com> writes: >> >>> Hi, >>> >>> I want to put a summary of my analysis at the beginning of a document >>> using results calculated at the end of the document. Is this possible? > > [snip] > >>> >>> Is this possible in a single pass? > > > Not quite. The method suggested by Andreas computes the result twice. If > there is any randomness in the results (as in the example) you will get a > different answer in the summary than when the block is later evaluated. > >>> I've played with #+NAME and >>> <> but haven't gotten the out-of-order evaluation quite >>> right. > > You can use > > #+results: the-mean > > before > > #+NAME: the-mean > #+begin_src R > mean(x) > #+end_src > > which is after 'theanalysis' block. > > And if the format is not pleasing add a filter that reformats the results Great. The named result block is just what I needed. > > IMO, needing ':exports results' for inline src blocks is a bug not a > feature. > Agreed, particularly in light of Eric's comments at http://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg00285.html There's the variable org-babel-inline-header-args, but it seems using #+PROPERTY: header-args :exports both overrules/breaks it Would org want something like #+PROPERTY: inline-header-args :exports results Or just 'hard-code' :exports results for all inline blocks?
Re: [O] verbatim/code text and line breaks with auto fill mode
On Mar 18, 2014, at 18:35, "Michael Weylandt" wrote: > > On Mar 8, 2014, at 7:12, Alan Schmitt wrote: >> >> I've continued looking into this, and it seems that what I want is use >> `fill-nobreak-predicate'. This is what I ended up doing: >> >> #+begin_src emacs-lisp >> (add-hook 'org-mode-hook >> (lambda () >> (add-hook 'fill-nobreak-predicate 'org-in-verbatim-emphasis))) >> #+end_src > > Is there an analogue like org-in-inline-src-p? I find the auto-fill breaks > inline (src_python{...}) There doesn't appear to be a native org version, but I've used (defun org-in-inline-src-p () (org-in-regexp org-babel-inline-src-block-regexp)) (add-hook 'org-mode-hook (lambda () (add-hook 'fill-nobreak-predicate 'org-in-inline-src-p))) And it seems to give a better auto-fill experience. Michael
Re: [O] Prepare release 8.2.6
On Apr 3, 2014, at 2:37, Bastien wrote: > Hi all, > > I'll try to fix a few remaining bugs in maint this afternoon > then release 8.2.6 so that we can merge it into Emacs emacs-24 > branch, the pretest is scheduled to happen as soon as possible. > > If you have important bugs you want us to look at, now is the > time to point at them. Hi Bastien, Two small usability issues you may want to take a look at: 1) Tell Emacs not to break inline source blocks when filling paragraphs: http://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg01310.html 2) Allow =, +, and ; to be entered into org-insert-link. The list of character is org-link-escape-chars seems to be unnecessarily defensive and results in bad links being entered into documents (and then exported). http://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg00990.html Michael > > Thanks, > > -- > Bastien > >
Re: [O] Prepare release 8.2.6
On Apr 3, 2014, at 2:37, Bastien wrote: > Hi all, > > I'll try to fix a few remaining bugs in maint this afternoon > then release 8.2.6 so that we can merge it into Emacs emacs-24 > branch, the pretest is scheduled to happen as soon as possible. > > If you have important bugs you want us to look at, now is the > time to point at them. A few more minor things from my .emacs: 1) In ox-latex.el, add a `downcase` around the definition of mint-lang in org-latex-inline-src-block and the sexp `(or (cadr (assq (intern lang) org-latex-minted-langs)) lang)` in org-latex-src-block to respect minted's convention of putting all language names in lowercase. 2) Add a key binding C-c C-v k for org-babel-remove result in ob-keys.el. (Discussed on list but I can't find the reference) I actually wrap it so C-u C-c C-v k calls (org-babel-map-src-blocks nil (org-babel-remove-result)) > > Thanks, > > -- > Bastien > >
[O] PATCH -- allow user to set minted style
Here's a small patch which allows the user to set the Minted highlighting style for latex export. This requires a different mechanism than org-latex-minted-options since it's a global/preamble option. Apologies for the badly formatted patch. I'm not at my own computer and wanted to give Bastien a chance to include it in 8.2.6. I do not have FSF papers signed but I believe this falls under the TINYCHANGE rule. Patch applies against a6485af3. Michael --- ox-latex.el.orij2014-04-04 10:45:17.530492000 -0400 +++ ox-latex.el2014-04-04 10:51:42.447567000 -0400 @@ -751,6 +751,18 @@ (string :tag "Minted option name ") (string :tag "Minted option value" +(defcustom org-latex-minted-default-style "default" + "The default minted style used; will be inserted in a + \\usemintedstyle{} block if org-latex-listings is set to + 'minted. A list of available styles can be obtained with: + + pygmentize -L styles" + :group 'org-export-latex + :type '(repeat + (list + (symbol :tag "Minted style name") + (symbol :tag "Minted style value" + (defvar org-latex-custom-lang-environments nil "Alist mapping languages to language-specific LaTeX environments. @@ -1126,6 +1138,9 @@ (or (plist-get info :description) "") (if (not (plist-get info :with-creator)) "" (plist-get info :creator + ;; Using minted formatting style + (when (eq org-latex-listings 'minted) + (format "\\usemintedstyle{%s}")) ;; Document start. "\\begin{document}\n\n" ;; Title command.
Re: [O] PATCH -- allow user to set minted style
On Apr 4, 2014, at 14:46, Nicolas Goaziou wrote: > Hello, > > Michael Weylandt writes: > >> This requires a different mechanism than org-latex-minted-options >> since it's a global/preamble option. > > Since it's a global/preamble option, you can include it in your header, > buffer wise, or with `org-latex-classes', or with > `org-latex-packages-alist'... Taking the choices in reverse: - The minted style isn't passed as a package option so I'm not sure how org-latex-packages-alist helps. - Yes, I have been putting it in the headers of my custom classes, but it has to follow \usepackage{minted} or I get a LaTeX error, so I wind up loading minted even when not using it. Having it as a variable also makes it easier to change the style. -I'm not sure what you mean by bufferwise -Yes, #+LATEX_HEADER_EXTRA works but there's still the problem of failing if you don't use minted for that particular export. I think the right analogy if with hyperref/hypersetup, which does have support of this style in Org. Michael
Re: [O] PATCH -- allow user to set minted style
On Apr 4, 2014, at 16:24, Nicolas Goaziou wrote: > Michael Weylandt writes: > >> - The minted style isn't passed as a package option so I'm not sure >> how org-latex-packages-alist helps. > > You can add a string at the end of `org-latex-packages-alist' that will > be inserted in the header. > Didn't know that -- thanks! Perhaps the docstring could include that. > Anyway, since there is no reliable way to detect if a package will be > required at Org level, this patch cannot work properly. Not sure I follow: I'm piggy-backing on the same condition Org uses to determine whether to insert \minted blocks for source code. > > Note that you can also write a filter that will insert > "\usemintedstyle..." when "\usepackage{minted}" is detected in the > output. > Indeed; I've done that just now. For anyone who wants it: (defun org-latex-minted-style-filter (contents backend info) (if (string-match "\\usepackage{minted}" contents) (replace-regexp-in-string "usepackage{minted}" (format "usepackage{minted}usemintedstyle{%s}" org-latex-minted-default-style) contents))) (add-to-list 'org-export-filter-final-output-functions 'org-latex-minted-style-filter) Anyways, even if the idea is rejected thanks for taking a look and for all your work on Org Mode. > > Regards, > > -- > Nicolas Goaziou
[O] :mkdirp without path specifier
If it intended that setting :mkdirp yes should break tangling with 'directory-free' file names? I.e., should # #+TITLE: test #+BEGIN_SRC python :mkdirp yes :tangle test.py print 1+2 #+END_SRC ### tangle without error? It currently doesn't because (file-name-directory "test.py"), which is nil, gets passed to make-directory, which throws an error. The manual is ambiguous, stating only that the arg to :tangle is interpreted as a path. A strict reading says this shouldn't work, regardless of :mkdirp, since we're not giving a path, but I think the "understood ./" of :mkdirp no is reasonable. I'm not in a position to do so now, but can send a one-line patch to fix tonight if wanted. Michael
Re: [O] [PATCH] Empty inline tasks in latex export
On May 16, 2014, at 4:39, Nicolas Goaziou wrote: > Hello, > > "R. Michael Weylandt" writes: > >> If the body if the inline task is empty, org-latex-inlinetask writes >> nil in the exported document. This patch skips including contents (and >> the bar above it) if it's nil. > > Thank you for reporting it and providing this patch. I applied > a slightly different version. Great, Thanks for this Michael
Re: [O] org-grep, and problems
On Oct 10, 2013, at 11:50, François Pinard wrote: > > P.S. What is proper English: "nobody remember" or "nobody remembers"? > Remembers. 'Nobody' counts as singular, as does 'no one'. English isn't totally consistent on this matter, however, as 'none' takes a plural verb. No one is brave enough to skip the meeting, even though none of the bosses are going to attend. M
[O] Ox-HTML hover for certain languages
Around line 270 of Ox-html.el, there's CSS which gives certain code blocks in the resulting HTML a hover-over window saying what language they encode. Not all Babel-supported languages appear however: is there any reason for this? (E.g. perl is hard-coded but no python) I suppose one could pull all the sources from the #+BEGIN_SRC XYZ blocks and generate this on demand, using a lookup table for known languages and a basic capitalization scheme for unknown languages. I'm not much of an elisp user, but would be happy to try my hand at a patch if this would be of interest. Michael
[O] Accessing #+EMAIL in LaTeX Export
HI, I'm writing a latex export class which has an \email macro. Is it possible to autofill this macro using the #+EMAIL: property? Looking at ox-latex.el, it seems that email is hardcoded to be placed in \thanks{} but there might be a hook I'm missing. I thought that using a {{{ email }}} macro might work, but I keep winding up with \email{ {{{email}}} } in the produced LaTeX. Thanks for any help, Michael
Re: [O] Accessing #+EMAIL in LaTeX Export
On Tue, Feb 4, 2014 at 12:54 AM, Nick Dokos wrote: > "R. Michael Weylandt" writes: > >> HI, >> >> I'm writing a latex export class which has an \email macro. >> >> Is it possible to autofill this macro using the #+EMAIL: property? >> Looking at ox-latex.el, it seems that email is hardcoded to be placed >> in \thanks{} but there might be a hook I'm missing. >> >> I thought that using a {{{ email }}} macro might work, but I keep >> winding up with >> \email{ {{{email}}} } in the produced LaTeX. >> > > Not sure what your \email macro is supposed to look like or what > it is supposed to do, but the {{{email}}} works for me, e.g. the > following produces my italicized email in the output: > > --8<---cut here---start->8--- > #+EMAIL: ndo...@gmail.com > > * foo > > This is my email: \emph{ {{{email}}} }. > --8<---cut here---end--->8--- > Hi Nick, Thanks for taking a look at this. Let me say a bit more about what I'm trying to do: I want org-mode to export to the "amsart" class by default. In addition to the regular \title, \author, \date macros, amsart also allows for "email". --8<---cut here-start--->8--- (add-to-list 'org-latex-classes '("amsart" "\\documentclass{amsart} [DEFAULT-PACKAGES] [PACKAGES] [EXTRA] \\email{ {{{email}}} }" ("\\section{%s}" . "\\section{%s}") ("\\subsection{%s}" . "\\subsection{%s}") ("\\subsubsection{%s}" . "\\subsubsection{%s}"))) --8<---cut here---end--->8--- Running this on a document like: --8<---cut here-start--->8--- #+TITLE: Test 1 #+AUTHOR: Michael Weylandt #+EMAIL: michael.weyla...@gmail.com #+LATEX_CLASS: amsart * Header 1 Hello World --8<---cut here---end--->8--- leaves me with "\email{email}" in the resulting LaTeX instead of "\email{michael.weyla...@mail.com}". Since this is used as part of \maketitle, doing something in the body (like your example) is too late. The #+EMAIL: value is handled by ox-latex.el, but it's only placed inside the \author{} macro instead of in a stand alone \email{}. That's the behavior I'm hoping to tweak. Is that clearer? Thanks again, Michael
Re: [O] Accessing #+EMAIL in LaTeX Export
On Feb 4, 2014, at 12:31, Nick Dokos wrote: > Nick Dokos writes: > >> "R. Michael Weylandt" writes: >> >>> I want org-mode to export to the "amsart" class by default. In >>> addition to the regular \title, \author, \date macros, amsart also >>> allows for "email". >>> >>> (add-to-list 'org-latex-classes >>> '("amsart" >>> "\\documentclass{amsart} >>> [DEFAULT-PACKAGES] >>> [PACKAGES] >>> [EXTRA] >>> \\email{ {{{email}}} }" >>> ("\\section{%s}" . "\\section{%s}") >>> ("\\subsection{%s}" . "\\subsection{%s}") >>> ("\\subsubsection{%s}" . "\\subsubsection{%s}"))) >>> >>> Running this on a document like: >>> >>> #+TITLE: Test 1 >>> #+AUTHOR: Michael Weylandt >>> #+EMAIL: michael.weyla...@gmail.com >>> #+LATEX_CLASS: amsart >>> * Header 1 >>> Hello World >>> >>> leaves me with "\email{email}" in the resulting LaTeX instead of >>> "\email{michael.weyla...@mail.com}". Since this is used as part of >>> \maketitle, doing something in the body (like your example) is too >>> late. >>> >>> The #+EMAIL: value is handled by ox-latex.el, but it's only placed >>> inside the \author{} macro instead of in a stand alone \email{}. >>> That's the behavior I'm hoping to tweak. >>> >>> Is that clearer? >> >> Much - thanks. I haven't thought much about it but my knee-jerk reaction >> is to use a marker (something like \email{@EMAIL@}) when defining the >> class and use a filter to replace it at the end. But there are might be >> more elegant solutions around. > > So here's a brute-force solution along the above lines: > > --8<---cut here---start->8--- > #+EMAIL: ndo...@gmail.com > #+LATEX_CLASS: amsart > > * foo > bar > > * code :noexport: > This should probably go in some initialization file - for testing, I just > executed > the code blocks by hand: > > #+name: email-filter > #+BEGIN_SRC elisp :results none > (defun nd-email-filter (contents backend info) >(let ((email (plist-get info :email))) > (replace-regexp-in-string "@EMAIL@" email contents t))) > > (add-to-list 'org-export-filter-final-output-functions (function > nd-email-filter)) > #+END_SRC > > #+name: amsart > #+BEGIN_SRC elisp :results none > (setq amsart-class >'("amsart" > "\\documentclass{amsart} >[DEFAULT-PACKAGES] >[PACKAGES] >[EXTRA] >\\email{@EMAIL@ }" >("\\section{%s}" . "\\section{%s}") > ("\\subsection{%s}" . "\\subsection{%s}") > ("\\subsubsection{%s}" . "\\subsubsection{%s}"))) > > (add-to-list 'org-latex-classes amsart-class) > #+END_SRC > > This deletes the amsart from the org-latex-classes list: > > #+BEGIN_SRC elisp > (setq org-latex-classes (cdr org-latex-classes)) > #+END_SRC > --8<---cut here---end--->8--- > > Nick Hi Nick, Thanks for the example; the filter seems to work well. Two possible issues: 1. I only want to use it for some latex classes 2. When using \email{} I want to get rid of the \thanks{} in \author{}. I came up with the following: <--> (require 'cl-lib) (defun any (x) (cl-reduce (lambda (x y) (if x x y)) x)) ;; For certain latex classes, the org-mode default of \author{NAME\thanks{EMAIL}} ;; isn't what the class wants (defvar org-latex-classes-with-email '("amsart" "amsbook")) ;; After completing latex export, check if we are in one of the classes listed in 'org-latex-classes-with-email; ;; if we are, we need to ;; 1) Remove the \thanks{} macro inside \author{} ;; 2) Add an \email{} macro ;; This can be done with a single regex replace using captures. (defun org-latex-classes-with-email-filter (contents backend info) (if (any (mapcar (lambda (x) (string-match x contents)) org-latex-classes-with-email)) (replace-regexp-in-string "author{\\(.*\\)thanks{\\(.*\\)}}" "author{\\1}\nemail{\\2}" contents))) ;; Thanks to Nick Dokos for the filter setup help --http://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00130.html (add-to-list 'org-export-filter-final-output-functions (function org-latex-classes-with-email-filter)) <---> It's regex based so there may be some false positives, but it seems to work well enough for me. Michael
[O] Incorrect hexification in URLs in LaTeX Export
I've tried this with Org 7.9.3 and 8.2.5h to the same result: <--> #+TITLE: Test * One Here is a [[http://google.com/search?q=orgmode][link]] <--> Exporting to HTML doesn't transform the link but exporting to LaTeX results in the (non-working) http://google.com/search?%3Dorgmode Is there a reason for this behavior and, if so, a way to work around it? RFC 3986 2.2 explicitly says URLs may include `=` and =url-encode-url= doesn't change the link in question. I've played with org-url-hexify-p and read past ML discussions, but they seem primarily concerned with characters which should not appear in URIs. Thanks, Michael
[O] Org-link-escape-chars (was Incorrect hexification in URLs in LaTeX Export)
On Feb 28, 2014, at 15:26, Andreas Leha wrote: > "R. Michael Weylandt " > writes: > >> I've tried this with Org 7.9.3 and 8.2.5h to the same result: >> >> <--> >> #+TITLE: Test >> * One >> Here is a [[http://google.com/search?q=orgmode][link]] >> <--> >> >> Exporting to HTML doesn't transform the link but exporting to LaTeX results >> in the (non-working) http://google.com/search?%3Dorgmode >> >> Is there a reason for this behavior and, if so, a way to work around it? >> >> RFC 3986 2.2 explicitly says URLs may include `=` and =url-encode-url= >> doesn't change the link in question. >> >> I've played with org-url-hexify-p and read past ML discussions, but >> they seem primarily concerned with characters which should not appear >> in URIs. >> >> Thanks, >> Michael > > > > Hi Michael, > > I have recently been bitten by this as well. Based on a block > post [fn:1], I now have this in my .emacs as a work-around: > > --8<---cut here---start->8--- > (defun al-link-filter (contents backend info) > (let ((contents (replace-regexp-in-string "#\\+name:.*$" "" > contents)));; old and unrelated > (replace-regexp-in-string "%3D" "=" contents))) > (add-to-list 'org-export-filter-final-output-functions 'al-link-filter) > --8<---cut here---end--- Hi Andreas, Thanks for this. I had time to dig further and it seems that the 'problem' is the default value of org-link-escape-chars, which explicitly escapes = as well as other valid URL characters. Perhaps someone more familiar with this code could explain the choice these escapes. Michael [Subject updated because the problem isn't LaTeX specific in 8.2.5h, only in 7.9.3]
Re: [O] Org-link-escape-chars (was Incorrect hexification in URLs in LaTeX Export)
On Tue, Mar 4, 2014 at 3:45 PM, Simon Thum wrote: > This seems to be a question of objective. Do you want to encode, i.e. > maintain some reversible original in an url no matter what, or do you want > to fix url's which wouldn't otherwise be legal? In the latter case, the > question mark should probably be retained. > I believe the former. If the user types in a working link, the exporter shouldn't break it. This could be fixed by sprinkling org-url-decode through various backends, but that suggests to me that the problem may be "upstream." Michael
[O] Odd interaction with Python sessions and Org 8.2.5
Hi, I'm having trouble getting clean output from org 8.2.5 when I combine session based evaluation and capturing results from standard out. (See first example below) This is on Emacs 24.3 with the default python mode settings and nothing relevant in my init.el except for activating python support. Is this expected behavior or is there someway I can fix the first example? Michael <-8---8> #+TITLE: Hello World * Standard Out + Session (Problem) #+BEGIN_SRC python :results output :session *Python* def test(): print "Hello World" test() #+END_SRC #+RESULTS: : : ... >>> Hello World * Standard Out + No Session (Fine) #+BEGIN_SRC python :results output def test(): print "Hello World" test() #+END_SRC #+RESULTS: : Hello World * Value + Session #+BEGIN_SRC python :session *Python* def test(): print "Hello World" test() #+END_SRC #+RESULTS: * Value + No Session #+BEGIN_SRC python def test(): print "Hello World" test() #+END_SRC #+RESULTS: : None
Re: [O] Incorrect hexification in URLs in LaTeX Export
On Mar 18, 2014, at 11:41, Bastien wrote: > Hi Andreas, > > Andreas Leha writes: > >> The second link is not clickable in the resulting pdf. > > This should be fixed now, thanks. > Hi Bastien, I just tried with 35f27a1fe and my issue is fixed. (The one about the hexifying of a valid character. I.e., if (fundamental-mode) shows a valid link, the resulting export is also valid) Can't comment on Andreas's issue about unescaping text when it's given to org already escaped. Thanks, Michael
Re: [O] verbatim/code text and line breaks with auto fill mode
On Mar 8, 2014, at 7:12, Alan Schmitt wrote: > Nick Dokos writes: > >> Alan Schmitt writes: >> >>> Hello, >>> >>> Is there a way to disable line breaks inside verbatim or code text when >>> using auto fill? For instance, if I type the following: >>> >>> This is an example of a long line when some stuff is code: ~1 + 2 + 3 = >>> 6~. >> >> Untested, but you might be able to do something with >> auto-fill-inhibit-regexp. > > I've continued looking into this, and it seems that what I want is use > `fill-nobreak-predicate'. This is what I ended up doing: > > #+begin_src emacs-lisp > (add-hook 'org-mode-hook > (lambda () >(add-hook 'fill-nobreak-predicate 'org-in-verbatim-emphasis))) > #+end_src > Is there an analogue like org-in-inline-src-p? I find the auto-fill breaks inline (src_python{...}) blocks. E.g., src_python{ 1 + 2 + 3 } works (is recognized as evaluate-able code) while src_python{1 + 2 +3} doesn't. Michael
Re: [O] Incorrect hexification in URLs in LaTeX Export
On Mar 18, 2014, at 17:24, "R. Michael Weylandt" wrote: > Can't comment on Andreas's issue about unescaping text when it's given to org > already escaped. Hi Bastien, TLDR: remove ?\= from org-link-escape-chars. I looked at this again and I think I've stumbled on another small issue relating to hex escaping. If I type a link with an equals sign (=) into the link prompt of org-insert-link, the link inserted into my buffer has a %3D instead of the valid =. Tracing this, it goes through org-make-link-string, which hands off to org-link-escape which uses the defconst org-link-escape-chars as the table of values to escape. Org-link-escape-chars appears to only be used within org-link-escape at this time. I think = is escaped because it may have conflicted with the verbatim syntax at some point, but that doesn't appear to be an issue any more. Is there a reason not to remove it?
[O] Org-set-repeat
I see that Org provides a `org-cancel-repeater` and `org-get-repeat` but I don't see a `org-set-repeat` (or function which can be made to do so). Is there something like that that I've missed or should I write a wrapper around `org-deadline`? Michael
Re: [O] Prepare release 8.2.6
On Fri, Apr 4, 2014 at 7:51 AM, Michael Weylandt wrote: > > > On Apr 3, 2014, at 2:37, Bastien wrote: > > Hi all, > > I'll try to fix a few remaining bugs in maint this afternoon > then release 8.2.6 so that we can merge it into Emacs emacs-24 > branch, the pretest is scheduled to happen as soon as possible. > > If you have important bugs you want us to look at, now is the > time to point at them. > > > Hi Bastien, > > Two small usability issues you may want to take a look at: > > 1) Tell Emacs not to break inline source blocks when filling paragraphs: > > http://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg01310.html Small patch in support: diff --git a/lisp/org-src.el b/lisp/org-src.el index f870b2c..32de2a1 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -40,6 +40,7 @@ (declare-function org-do-remove-indentation "org" (&optional n)) (declare-function org-at-table.el-p "org" ()) (declare-function org-in-src-block-p "org" (&optional inside)) +(declare-function org-in-inline-src-block-p "org" ()) (declare-function org-in-block-p "org" (names)) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) diff --git a/lisp/org.el b/lisp/org.el index 318d95a..2778160 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -21536,6 +21536,9 @@ when point is at #+BEGIN_SRC or #+END_SRC." (beginning-of-line) (looking-at ".*#\\+\\(begin\\|end\\)_src"))) +(defun org-in-inline-src-block-p () + "Test if within an inline src block." + (org-in-regexp org-babel-inline-src-block-regexp)) (defun org-context () "Return a list of contexts of the current cursor position. If several contexts apply, all are returned. @@ -22246,7 +22249,8 @@ hierarchy of headlines by UP levels before marking the subtree." (org-uniquify (append fill-nobreak-predicate '(org-fill-line-break-nobreak-p - org-fill-paragraph-with-timestamp-nobreak-p) + org-fill-paragraph-with-timestamp-nobreak-p + org-in-inline-src-block-p) (let ((paragraph-ending (substring org-element-paragraph-separate 1))) (org-set-local 'paragraph-start paragraph-ending) (org-set-local 'paragraph-separate paragraph-ending)) > > 2) Allow =, +, and ; to be entered into org-insert-link. The list of > character is org-link-escape-chars seems to be unnecessarily defensive and > results in bad links being entered into documents (and then exported). > > http://lists.gnu.org/archive/html/emacs-orgmode/2014-03/msg00990.html > > Michael > > > Thanks, > > -- > Bastien > >
Re: [O] Prepare release 8.2.6
On Fri, Apr 4, 2014 at 10:32 AM, Michael Weylandt wrote: > > > On Apr 3, 2014, at 2:37, Bastien wrote: > >> Hi all, >> >> I'll try to fix a few remaining bugs in maint this afternoon >> then release 8.2.6 so that we can merge it into Emacs emacs-24 >> branch, the pretest is scheduled to happen as soon as possible. >> >> If you have important bugs you want us to look at, now is the >> time to point at them. > > A few more minor things from my .emacs: > > 1) In ox-latex.el, add a `downcase` around the definition of mint-lang in > org-latex-inline-src-block and the sexp `(or (cadr (assq (intern lang) > org-latex-minted-langs)) lang)` in org-latex-src-block to respect minted's > convention of putting all language names in lowercase. > Patches: diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 59e6e83..013c731 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1474,9 +1474,9 @@ contextual information." ;; Use minted package. ((eq org-latex-listings 'minted) (let* ((org-lang (org-element-property :language inline-src-block)) -(mint-lang (or (cadr (assq (intern org-lang) +(mint-lang (downcase (or (cadr (assq (intern org-lang) org-latex-minted-langs)) - org-lang)) + org-lang))) (options (org-latex--make-option-string org-latex-minted-options))) (concat (format "\\mint%s{%s}" @@ -2116,7 +2116,7 @@ contextual information." ("firstnumber" ,(number-to-string (1+ num-start org-latex-minted-options))) ;; Language. -(or (cadr (assq (intern lang) org-latex-minted-langs)) lang) +(downcase (or (cadr (assq (intern lang) org-latex-minted-langs)) lang)) ;; Source code. (let* ((code-info (org-export-unravel-code src-block)) (max-width > 2) Add a key binding C-c C-v k for org-babel-remove result in ob-keys.el. > (Discussed on list but I can't find the reference) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index e8943c6..c73c42b 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2166,6 +2166,15 @@ code the results are extracted in the syntax of the source (goto-char location) (forward-line 1) (delete-region start (org-babel-result-end)) +(defun org-babel-remove-result-one-or-many (x) + "Remove the result of the current source block. +If called with a prefix argument, remove all result blocks +in the buffer." + (interactive "P") + (if x + (org-babel-map-src-blocks nil (org-babel-remove-result)) +(org-babel-remove-result))) + (defun org-babel-result-end () "Return the point at the end of the current set of results." (save-excursion diff --git a/lisp/ob-keys.el b/lisp/ob-keys.el index 90b5196..dc1f437 100644 --- a/lisp/ob-keys.el +++ b/lisp/ob-keys.el @@ -89,6 +89,7 @@ functions which are assigned key bindings, and see ("h" . org-babel-describe-bindings) ("\C-x" . org-babel-do-key-sequence-in-edit-buffer) ("x" . org-babel-do-key-sequence-in-edit-buffer) +("k" . org-babel-remove-result-one-or-many) ("\C-\M-h" . org-babel-mark-block)) "Alist of key bindings and interactive Babel functions. This list associates interactive Babel functions > > I actually wrap it so C-u C-c C-v k calls > > (org-babel-map-src-blocks nil (org-babel-remove-result)) > >> >> Thanks, >> >> -- >> Bastien >> >>
Re: [O] Prepare release 8.2.6
On Sat, Apr 5, 2014 at 3:27 PM, Nicolas Goaziou wrote: > Hello, > > Would you mind adding a commit message, TINYCHANGE at its end, and send > it again with "git format-patch"? Hi Nicolas, Thanks for taking the time to review my patches (2 attached): hopefully these are formatted to org standards. > >>> 2) Add a key binding C-c C-v k for org-babel-remove result in ob-keys.el. >>> (Discussed on list but I can't find the reference) > > [...] > > > Regards, > > -- > Nicolas Goaziou 0001-ox-latex.el-downcase-language-name-in-minted-blocks.patch Description: Binary data 0002-ob-core.el-ob-keys.el-Add-a-keybinding-to-remove-res.patch Description: Binary data
Re: [O] Prepare release 8.2.6
On Sat, Apr 5, 2014 at 3:18 PM, Nicolas Goaziou wrote: > Hello, > > "R. Michael Weylandt" writes: > >>> 1) Tell Emacs not to break inline source blocks when filling paragraphs: > > I suggest not to use `org-in-regexp' here but `org-element-context'. I'm not as familiar with org-element-context, but I think the attached is what you had in mind. > Besides inline source blocks, ISTR there was other places where filling > was inappropriate (verbatim, code, export snippet, macro...). A single > `org-element-context' will find them all. Verbatim seems to work over multiple lines so I've left them out. Macros and inline source blocks don't so I've included them. Not sure what other elements to look at: > > Another option for the problem at hand is to simply remove newline > characters in inline source blocks before executing them. > That might be better but would require a bit more work: at present, inline source blocks can't extend over multiple lines so org wouldn't recognize a construct like src_python[:exports results]{1 + 2 + 3 + 4} as an inline source block in the first place. Looking at org-inline-src-block-regexp I'm not sure why though. Patch also attached to improve link handling Michael 0001-org.el-Don-t-fill-on-inline-source-blocks-or-macros.patch Description: Binary data 0002-org.el-Remove-and-from-org-link-escape-chars.patch Description: Binary data
Re: [O] Prepare release 8.2.6
On Thu, Apr 10, 2014 at 10:43 PM, Eric Schulte wrote: > > I just tried to apply the second patch, but it no longer applies (with > "git am") to the Org-mode repo. Would you mind sending along an updated > version? > Hi Eric, The attached should apply cleanly against master. Michael 0001-Keybinding-to-remove-result-blocks.patch Description: Binary data
Re: [O] :mkdirp without path specifier
On Thu, May 1, 2014 at 3:47 PM, Michael Weylandt wrote: > If it intended that setting :mkdirp yes should break tangling with > 'directory-free' file names? > > I.e., should > # > #+TITLE: test > #+BEGIN_SRC python :mkdirp yes :tangle test.py > print 1+2 > #+END_SRC > ### > > tangle without error? > > It currently doesn't because (file-name-directory "test.py"), which is nil, > gets passed to make-directory, which throws an error. > > The manual is ambiguous, stating only that the arg to :tangle is interpreted > as a path. A strict reading says this shouldn't work, regardless of :mkdirp, > since we're not giving a path, but I think the "understood ./" of :mkdirp no > is reasonable. > Patch attached. Should apply cleanly against master and maint. Michael 0001-Fix-tangle-with-mkdirp-yes-tangle-FILE.patch Description: Binary data
Re: [O] :mkdirp without path specifier
On Fri, May 2, 2014 at 11:43 PM, R. Michael Weylandt wrote: > Patch attached. Should apply cleanly against master and maint. Bah, botched the formatting. Attached should be fixed. 0001-Fix-tangle-with-mkdirp-yes-tangle-FILE.patch Description: Binary data
Re: [O] :mkdirp without path specifier
On Sat, May 3, 2014 at 4:19 AM, Achim Gratz wrote: > R. Michael Weylandt writes: >> ;; Possibly create the parent directories for file. >> (when (let ((m (funcall get-spec :mkdirp))) >>(and m (not (string= m "no" >> - (make-directory (file-name-directory file-name) >> 'parents)) >> + (if (file-name-directory file-name) >> + (make-directory (file-name-directory file-name) >> 'parents))) > > If the else clause is intentionally missing, some folks prefer to use > "when" instead of "if" to advertise that fact (see some surrounding code > for example). In this case the additional "if" should be rolled into > the condition check of the former "when" anyway (and let-bind the result > to avoid the duplicate "file-name-directory" call). The conditional is > actually superfluous since we can short-circuit from the "and". > > A patch to that effect has been installed in 063c8b03b7. > Thanks for the feedback and applying a fix.
[O] [PATCH] Empty inline tasks in latex export
If the body if the inline task is empty, org-latex-inlinetask writes nil in the exported document. This patch skips including contents (and the bar above it) if it's nil. Michael 0001-Handle-empty-tasks-without-printing-nil-in-org-latex.patch Description: Binary data