Re: org-edit-src-exit randomizes / mixes up code in source-buffer on exit

2021-06-22 Thread mcg

Hello,

thank you very much! Update to 27 solved the problem.

All the best,

Michael


Am 22.06.2021 um 15:33 schrieb Sébastien Miquel:

Hi,

This has been reported before.

There's a patch that fixes this here : 
https://lists.gnu.org/archive/html/emacs-orgmode/2021-06/msg7.html


To fix this bug, you can can either apply this patch, downgrade org, 
or update emacs to 27.


Could anyone with commit access have a look and apply this patch to 
master ?


Regards,





org-edit-src-exit randomizes / mixes up code in source-buffer on exit

2021-06-22 Thread mcg

Hello,

org-edit-src-exit suddenly completely destroys my code after coming back 
from vacation. No known recent changes in configuration. Very strange 
error!


EXAMPLE: here a simple code before editing

#+BEGIN_SRC R

mtcars

sum(mtcars$mpg, na.rm = TRUE)

mean(mtcars$disp)

#+END_SRC

I enter to edit (org-edit-special), change the order of two lines and 
add a number:


Result I should get in source buffer after exiting:

#+BEGIN_SRC R

mtcars

mean(mtcars$disp)

123456789

sum(mtcars$mpg, na.rm = TRUE)

#+END_SRC

What I get in source buffer on org-edit-src-exit: (no joke!)

#+BEGIN_SRC R
rmtcars
s
ean(m
sums$di(p)mt123456789

cars$mpg, na.rm = TRUE)

mean

#+END_SRC


Came back from vacation and suddenly this happens. Only updates to 
server, elpa / melpa has not been updated the last three weeks. Emacs 
reinstallation did not help, launching without


Emacs 26.1 build 2 (2021-01-31) modified by debian

org version 9.4.6




[O] tangling files on export not working properly

2016-11-27 Thread mcg

Hello,

When exporting my document to latex I want org-mode to tangle a few code 
blocks.


#+NAME: tangle_files
#+BEGIN_SRC emacs-lisp :exports results :eval query-export

(org-babel-tangle-file "~/thesis/chapter/NH.org")

#+END_SRC

When I run the code block manually it works fine
*Messages*: "Tangled 2 code blocks from NH.org"

However, even though the is run on export, nothing gets tangled:
"Tangled 0 code blocks from 04.NH.org"

Is there any explanation for this? Anything I'm overlooking?




[O] org-mode latex export - Links in multi-document files

2016-11-26 Thread mcg

Hello,

I have my PhD thesis divided into several documents (Intro, M&M, 
Results, Discussion...).

The document setup and the #+INCLUDE: commands are in my master file.

I sometimes make references to other sections which are in another 
section and document.
In order to not compile all the document (3 minutes +) every time I just 
comment out all the documents I do not need to.
If table and figure links are missing it exports fine (getting question 
marks in the pdf). However, the section links cause the compilation to 
stop entirely. Is there any workaround for that? Can I tell the exporter 
to ignore such minor missing crossreferences?






[O] Org-mode 9.0 : set tangle file in document PROPERTY

2016-11-25 Thread mcg

Hello,

I noticed that in sections it is necessary to set
:header-args: :tangle ~/filepath.R
in the new org-mode version

What is the syntax to set tangling for the whole file?
#+PROPERTY: tangle ~/filepath.R does not work anymore...

Thanks in advance for any help




[O] org-mode - export as folder structure possible?

2016-11-16 Thread mcg

Hello,

I need to create a rather complex folder structure.
It is OK to create that in dired but I think even nicer and faster it 
would be to create an org-mode outline which then exports this folder 
structure to the org document's directory.


This could even be extended to create blank files with file extension 
within the directory - maybe communicated to the exporter with list items.
Can the org-mode exporter be used or easily programmed for this kind of 
application?


* Folder
- Registry.xls
- document.doc

** Subfolder

*** Subsubfolder
- some_document.txt

** Subfolder 2

* Another folder

** another one
- document.file_extension
- ListB.xlsx


With that functionality I could really thoroughly create a decent folder 
structure. With many people working on the windows server it becomes 
quite chaotic.

Thanks in advance for any answer.




[O] Bug: code block export [9.0 (9.0-elpaplus @ /home/mcg/.emacs.d/elpa/org-plus-contrib-20161102/)]

2016-11-08 Thread mcg

Hello,

I recently (max 3 weeks) noticed that latex code blocks are not exported
correctly anymore:

#+BEGIN_LaTeX

#+END_LaTeX

Export is:

\begin{LaTeX}

\end{LaTeX}

I do not recall having changed any setup.



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

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

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





Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Package: Org mode version 9.0 (9.0-elpaplus @ 
/home/mcg/.emacs.d/elpa/org-plus-contrib-20161102/)


current state:
==
(setq
 org-export-with-todo-keywords nil
 org-export-backends '(ascii html icalendar latex freemind koma-letter)
 org-latex-tables-booktabs t
 org-latex-default-figure-position "!htbp"
 org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename
 org-footnote-auto-adjust t
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)

 org-adapt-indentation nil
 org-latex-classes '(("article"
"\\documentclass[11pt,twoside,pointlessnumbers,headsepline]{scrartcl}\n[DEFAULT-PACKAGES]\n[PACKAGES]\n\n\\hypersetup{%\ncolorlinks 
= false, %Colours links instead of ugly boxes\nlinkbordercolor=blue, 
%hyperlink borders will be blue\nurlcolor = blue, %Colour for 
external hyperlinks\nlinkcolor= red, %Colour of internal 
links\ncitecolor   = brown, %Colour of citations\ncitebordercolor = 
brown, %Colour of citations\npdfborderstyle={/S/U/W 0.5} %border style 
will be underline of width 0.5pt\n}\n\n\n[EXTRA]   \n"
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 
("\\paragraph{%s}" . "\\paragraph*{%s}")

  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("default-koma-letter" "\\documentclass[11pt]{scrlttr2}")
 ("letter"
  "\\documentclass{scrlttr2}\n [DEFAULT-PACKAGES]\n
[NO-PACKAGES]")
 ("minimalRnw" 
"\\documentclass{scrartcl}\n[NO-DEFAULT-PACKAGES]\n\\usepackage{hyperref}"
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 
("\\paragraph{%s}" . "\\paragraph*{%s}")

  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("beamer" "\\documentclass[presentation]{beamer}" 
("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("report" "\\documentclass[11pt]{scrreprt}" ("\\part{%s}" 
. "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . 
"\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{scrbook}" ("\\part{%s}" . 
"\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . 
"\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))

 )
 org-footnote-section nil
 org-calc-default-modes '(calc-internal-prec 12 calc-float-format 
(float 5) calc-angle-mode deg calc-prefer-frac
  nil calc-symbolic-mode nil calc-date-format ( "-" MM 
"-" DD " " Www (" " hh ":" mm))

  calc-display-working-message t)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)

 org-export-with-timestamps nil
 org-agenda-diary-file "~/org/diary.org"
 org-ref-pdf-directory "~/library/link/"
 org-occur-hook '(org-first-headline-recenter)
 org-src-tab-acts-natively t
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-agenda-start-on-weekday nil
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME 
CONTENTS)"]
 org-format-latex-options '(:foreground default :background "White" 
:scale 1.2 :html-foreground "Black"

:html-ba

[O] Bug: Figure caption highlighting [8.3.6 (8.3.6-7-g4d7d52-elpaplus @ /home/mcg/.emacs.d/elpa/org-plus-contrib-20161017/)]

2016-10-22 Thread mcg


I am not sure if this qualifies as a bug:
When I use figure captions in org-mode I get:

#+CAPTION: Caption text is highlighted
#+CAPTION[Figure with short caption for LaTeX TOC export]: Caption text 
is not highlighted


I know that the short-caption brackets are probably only intended for
LaTeX export. Is there an easy fix to get code highlighting for figures 
with short captions?.


Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Package: Org-mode version 8.3.6 (8.3.6-7-g4d7d52-elpaplus @ 
/home/mcg/.emacs.d/elpa/org-plus-contrib-20161017/)


current state:
==
(setq
 org-export-with-todo-keywords nil
 org-export-backends '(ascii html icalendar latex freemind koma-letter)
 org-latex-tables-booktabs t
 org-latex-default-figure-position "!htbp"
 org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename
 org-tab-first-hook '(org-hide-block-toggle-maybe 
org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)

 org-adapt-indentation nil
 org-latex-classes '(("article"
"\\documentclass[11pt,twoside,pointlessnumbers,headsepline]{scrartcl}\n[DEFAULT-PACKAGES]\n[PACKAGES]\n\n\\hypersetup{%\ncolorlinks 
= false, %Colours links instead of ugly boxes\nlinkbordercolor=blue, 
%hyperlink borders will be blue\nurlcolor = blue, %Colour for 
external hyperlinks\nlinkcolor= red, %Colour of internal 
links\ncitecolor   = brown, %Colour of citations\ncitebordercolor = 
brown, %Colour of citations\npdfborderstyle={/S/U/W 0.5} %border style 
will be underline of width 0.5pt\n}\n\n\n[EXTRA]   \n"
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 
("\\paragraph{%s}" . "\\paragraph*{%s}")

  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("default-koma-letter" "\\documentclass[11pt]{scrlttr2}")
 ("letter" "\\documentclass{scrlttr2}\n 
[DEFAULT-PACKAGES]\n[NO-PACKAGES]")
 ("minimalRnw" 
"\\documentclass{scrartcl}\n[NO-DEFAULT-PACKAGES]\n\\usepackage{hyperref}"
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 
("\\paragraph{%s}" . "\\paragraph*{%s}")

  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("beamer" "\\documentclass[presentation]{beamer}" 
("\\section{%s}" . "\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("report" "\\documentclass[11pt]{scrreprt}" ("\\part{%s}" 
. "\\part*{%s}")
  ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . 
"\\section*{%s}")
  ("\\subsection{%s}" . "\\subsection*{%s}") 
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("book" "\\documentclass[11pt]{scrbook}" ("\\part{%s}" . 
"\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
  ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" 
. "\\subsection*{%s}")

  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 )
 org-calc-default-modes '(calc-internal-prec 12 calc-float-format 
(float 5) calc-angle-mode deg calc-prefer-frac nil
  calc-symbolic-mode nil calc-date-format ( "-" MM "-" 
DD " " Www (" " hh ":" mm))

  calc-display-working-message t)
 org-speed-command-hook '(org-speed-command-default-hook 
org-babel-speed-command-hook)

 org-export-with-timestamps nil
 org-agenda-diary-file "~/org/diary.org"
 org-ref-pdf-directory "~/library/link/"
 org-occur-hook '(org-first-headline-recenter)
 org-src-tab-acts-natively t
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-agenda-start-on-weekday nil
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-format-latex-options '(:foreground default :background "White" 
:scale 1.2 :html-foreground "Black" :html-background
"Transparent" :html-scale 1.0 :matchers ("begin" "$1" 
"$" "$$" "\\(" "\\["))

 org-src-window-setup 'current-window
 org-latex-format-inli

Re: [O] Help with fixing an org-mode multicolumn implementation - LaTeX special characters

2016-02-25 Thread mcg

Hello Aaron,
[I noticed I did not answer to the list; just writing again to add it to 
the list]


this fix works perfect!  Thank you very much.
Never mind about multirow...

Michael


On 22/02/16 16:48, Aaron Ecay wrote:

Hi mcg,

2016ko otsailak 21an, mcg-ek idatzi zuen:

I found a very nice implementation of LaTeX multicolumn functionality in
this thread:
https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00736.html

[...]


However, using any of the characters of the left column of my example
table in the merged <2colc> column, I get:
"setq: Invalid use of `\' in replacement text"

I think the function should be written (untested):

(defun my-latex-multicolumn-filter (row backend info)
   (when (org-export-derived-backend-p backend 'latex)
 (while (string-match 
"\\(<\\([0-9]+\\)col\\([lrc]\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
   (let ((columns (string-to-number (match-string 2 row)))
 (start (match-end 0))
 (contents (replace-regexp-in-string "[[:blank:]]*$" "" 
(match-string 4 row)))
 (algn (or (match-string 3 row) "l")))
 (setq row (replace-match
(format "\\multicolumn{%d}{%s}{%s}" columns algn contents)
nil t row 1))
 (while (and (> columns 1) (string-match "&" row start))
   (setq row (replace-match "" nil nil row))
   (decf columns
 row))

The change is setting the third argument (‘literal’) to ‘replace-match’
to t, and deleting an extra backslash in the "\\multicolumn..." string.



Questions:
- How to escape the special characters in the left column properly to be
able to use them? (tried everything I could think of)
or
- How to modify the code above so that it allows for such characters.

- If anyone likes the implementation and is more capable than I am, then
the same for multirow would be really nice...

Unfortunately I think that’s more complicated, since it would necessitate
examining/modifying the whole table in one go, rather than operating one
row at a time.






[O] Help with fixing an org-mode multicolumn implementation - LaTeX special characters

2016-02-21 Thread mcg
I found a very nice implementation of LaTeX multicolumn functionality in 
this thread:

https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00736.html
("using export filters to emulate multi-column table cells?")

#+begin_src emacs-lisp :exports none
(defun my-latex-multicolumn-filter (row backend info)
  (when (org-export-derived-backend-p backend 'latex)
(while (string-match
"\\(<\\([0-9]+\\)col\\([lrc]\\)?>[[:blank:]]*\\([^&]+\\)\\)" row)
  (let ((columns (string-to-number (match-string 2 row)))
(start (match-end 0))
(contents (replace-regexp-in-string "[[:blank:]]*$" ""
(match-string 4 row)))
(algn (or (match-string 3 row) "l")))
(setq row (replace-match
   (format "multicolumn{%d}{%s}{%s}" columns algn 
contents)

nil nil row 1))
(while (and (> columns 1) (string-match "&" row start))
  (setq row (replace-match "" nil nil row))
  (decf columns
row))
(add-to-list 'org-export-filter-table-row-functions
'my-latex-multicolumn-filter)
#+end_src

#+LATEX_HEADER: \usepackage{multirow}

You have to put the number of columns to span and a r / l / c option for 
column alignment (<2colc>) and the column contents afterwards. Nice!


#+CAPTION: Example table
| Characters not working| <2colc> Characters working: ! " § . , 
* + ? % |  |

|---+---+--|
| ^ % _ { } $   | The header above is 
merged| over two columns |
| /italics/ *bold* _underline_ 
|   |  |
| any, \LaTeX special character 
|   |  |
| or expression requiring \ 
|   |  |


However, using any of the characters of the left column of my example 
table in the merged <2colc> column, I get:

"setq: Invalid use of `\' in replacement text"


Questions:
- How to escape the special characters in the left column properly to be 
able to use them? (tried everything I could think of)

or
- How to modify the code above so that it allows for such characters.

- If anyone likes the implementation and is more capable than I am, then 
the same for multirow would be really nice...


Comment: whoever read some of my questions recently will notice that I 
excessively use org-mode as a LaTeX frontend.  I am aware that this is 
not what it is supposed to be in the first place - but it works so 
perfect 99 % of the time, so I cannot keep from asking...





[O] Inline code :results replace not working

2014-11-07 Thread mcg

Hello,

I use inline code for simple calculations to insert numeric results into
text apart from "normal" code blocks for more complex calculations and
graphics (all in R).


The :results replace option is not working for inline code, even if I
explicitly set it in the code block. So I get

#+PROPERTY: session *R*

  #+begin_src R :results replace value
2+3
  #+end_src

  #+RESULTS:
  : 5

src_R[:results replace value]{2+3} =5= =5= =5= =5= =5= =5=

I would really like to have numeric outcome in the buffer (not only
minibuffer upon evaluation) but also evaluate the whole buffer when
exporting to have everything updated.

What is the problem here? For now I would have to
- evaluate only on export and keep :results silent
- evaluate all manually - meaning I get repeated results if I call
org-evaluate buffer

Cheers,

Michael


System:
LMDE Update Pack 8 (jessie)
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4) of 2013-09-27
on trouble, modified by Debian
Org version 8.2.10 (release_8.2.10-5-g20dcd0).