Re: [O] how to speed up an org-mode file?

2016-07-11 Thread Grant Rettke
Try approaching this the same way that you would prepare an ECM:

http://orgmode.org/worg/org-faq.html

Start Emacs with a stable version of Org-Mode, without any additional
configuration.

Is the performance what you expect?

FWIW: two things that sped up my rather small in comparison Org-Mode files
were:
- Switching from linum to nlinum
- #+STARTUP: showeverything


Sincerely,

Grant Rettke

On Sun, Jul 10, 2016 at 9:37 AM, Sharon Kimble 
wrote:

>
> I'm working on an org-mode file about cancer which is 945.1kb, is
> converted to a tex file of 1.0mb and a pdf of 2.0mb with 505 pages. The
> conversion is done through this code snippet '(global-set-key (kbd
> "s-#") 'org-latex-export-to-latex)'. There is no problem with the
> conversion to tex or conversion to pdf.
>
> However, the org-mode file is increasingly slowing down and becoming
> difficult to move about within the file, and also enter new information
> within it.
>
> How then can I speed it up within the org file please?
>
> Thanks
> Sharon.
> --
> A taste of linux = http://www.sharons.org.uk
> TGmeds = http://www.tgmeds.org.uk
> Debian 8.4, fluxbox 1.3.7, emacs 25.0.95
>


Re: [O] org-mode habit consistency graph not displaying

2016-07-11 Thread Brenda J. Butler

On Thu, Jul 07, 2016 at 08:29:44PM -0700, Josiah Schwab wrote:
> Hello Brenda,
> 
> > When I started using org-mode from elpa, the habit consistency graph
> > stopped showing. I was using a version of org-mode that comes with
> > debian before, with emacs 23 and the graph showed.
> 
> When I upgraded to org 8.3, my org-habits did not display correctly,
> because the PROPERTY drawer where the habit style was indicated came
> after the LOGBOOK in my org files.
> 
> After using org-repair-property-drawers 
> 
>   http://orgmode.org/Changes.html
> 
> my habits returned to their previous appearance.

It was a combination of this, and also I had earlier changed my
"SCHEDULED:" lines to ":SCHEDULED:" in an effort to see the upcoming
quarterly habits in the schedule as the day approached.  Ie, on day
"DUE - some time", I wanted to visit DUE day in the agenda schedule
and see the habit/scheduled item.

So after fixing up my properties to match the new scheme, and editing
my :SCHEDULED: items back to SCHEDULED: then I saw the habit
consistency graphs again.  Now I can't see the upcoming quarterly
scheduled habits, but that's a different problem.

Thanks for helping me out.

bjb



[O] ob-sed-test failure introduced by f38f83b4

2016-07-11 Thread Achim Gratz

Two of the three ob-sed tests are failing after commit f38f83b4, but
only in batch mode.  It seems the final newline gets eaten somewhere,
leading to the string= howling in protest.  When I run the code in
question interactively, it works as expected (result shown in minibuffer
is a string _with_ the final newline).  I can't figure out why the
particular commit is having that effect, but it seems to have changed
some accidental setting that the sed tests were relying on.

--8<---cut here---start->8---
Test ob-sed-test/in-file-header-argument condition:
(ert-test-failed
 ((should
   (string= "A tested file.
"
(org-babel-execute-src-block)))
  :form
  (string= "A tested file.
" "A tested file.")
  :value nil))
   FAILED  2/3  ob-sed-test/in-file-header-argument
--8<---cut here---end--->8---

--8<---cut here---start->8---
Test ob-sed-test/simple-execution-of-script condition:
(ert-test-failed
 ((should
   (string= "A processed sentence.
"
(org-babel-execute-src-block)))
  :form
  (string= "A processed sentence.
" "A processed sentence.")
  :value nil))
   FAILED  3/3  ob-sed-test/simple-execution-of-script
--8<---cut here---end--->8---


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




[O] Customizing todo state for habits

2016-07-11 Thread Clarissa Littler
Hi y'all,

So maybe I've missed the obvious, but the default behavior of habits seems
to be to, when completed, to revert the state to the first todo keyword in
your listing but I want to have different todo states for different habits
depending on the /kind/ of task it is.

How would I do that?

Cheers!


Re: [O] workflow, matlab+latex in org file

2016-07-11 Thread Eric S Fraga
On Monday, 11 Jul 2016 at 12:32, Uwe Brauer wrote:
> Hello
>
> I want in a org file, to include matlab code and run it (that I know how
> to do)
>
> Then I want certain results, which are symbolic variables, expressed in
> latex, we I achieve  using matlab's latex command.
>
> Like
>
> #+begin_src matlab :results output
> clear all
> syms e p R g w K K2
> phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)]
>
> jac=jacobian(phi,[e,p])
> ltxjac=latex(jac)
> #+end_src

A bit of a kludge but, if you don't want to modify the ob-matlab code,
you can explicitly generate LaTeX into a file and use it directly:

--8<---cut here---start->8---
#+begin_src octave :exports none :results output
  clear all
  pkg load symbolic
  syms e p R g w K K2;
  phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)];

  jac=jacobian(phi,[e,p]);
  ltxjac = latex(jac);
  fid = fopen("jacobian.tex","w");
  fprintf(fid, "%s\n", ltxjac);
  fclose(fid);
  ltxjac
#+end_src

\begin{equation}
\input{jacobian}
\end{equation}
--8<---cut here---end--->8---

I don't have MATLAB so have tested with octave instead...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.94.1, Org release_8.3.4-869-gf2c421



Re: [O] workflow, matlab+latex in org file

2016-07-11 Thread Uwe Brauer
>>> "John" == John Kitchin  writes:

   > You might consider the alternative, no-frills approach below. I defined
   > a new execute function that strips the header and >> out of the output.
   > It won't support any kind of session or header variables, but if you
   > don't use those it might work for you.

Great, I had to modify your call of the matlab bin, but then it works
like charm, thanks very much.

Maybe to add it to the org-addons somewhere?

Uwe 




Re: [O] make specific orgmode code blocks read only?

2016-07-11 Thread John Kitchin
I did something like this for sections once.

http://kitchingroup.cheme.cmu.edu/blog/2014/09/13/Make-some-org-sections-read-only/

You could probably put a :read-only in some src headers and map over src
blocks instead of sections using org-element-map.

Xebar Saram writes:

> Hi!
> I was wondering if possible at all and anyone knew of a way to make
> specific orgmode code blocks read only? the rest of the org buffer would be
> normal just specific code blocks
>
> best
>
> Z


-- 
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] workflow, matlab+latex in org file

2016-07-11 Thread John Kitchin
You might consider the alternative, no-frills approach below. I defined
a new execute function that strips the header and >> out of the output.
It won't support any kind of session or header variables, but if you
don't use those it might work for you.

#+BEGIN_SRC emacs-lisp
(defun org-babel-execute:matlab (body params) 
  (interactive "P")
  (let* ((current-file (buffer-file-name)) 
 (code (org-element-property :value (org-element-context)))
 (result-params (cdr (assoc :result-params params)))
 m-file
 md5-hash)


(with-temp-buffer 
  (insert code)
  (setq md5-hash (md5 (buffer-string))
mbuffer (format "*m-%s*" md5-hash)
m-file (format "m-%s.m" md5-hash)))

;; create the file to run
(with-temp-file m-file 
  (insert code))

(let ((results (shell-command-to-string
(concat
 "/Applications/MATLAB_R2013a.app/bin/matlab "
 "-nodesktop -nojvm -nosplash -nodisplay <"
 m-file
  (delete-file m-file)
  (when results
;; strip out >>
(setq results (replace-regexp-in-string ">> " "" results))
;; remove first 10 lines that are the header.
(setq results (mapconcat 'identity
 (nthcdr 10 (split-string results "\n"))
 "\n")))
  (org-babel-result-cond result-params
results
#+END_SRC


#+begin_src matlab :results output latex
clear all;
syms e p R g w K K2;
phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)];

jac=jacobian(phi,[e,p]);
ltxjac=latex(jac);
disp(ltxjac)
#+end_src

#+RESULTS: 
#+BEGIN_LaTeX
\left(\begin{array}{cc} {\left(\left(e + p\right)\, R^2 + 
e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(R^2 + 1\right)\, 
\left(\frac{g}{2} - \frac{1}{2}\right) & R^2\, {\left(\left(e + p\right)\, R^2 
+ e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(\frac{g}{2} - 
\frac{1}{2}\right)\\ \frac{R\, \sqrt{R^2 + 1}}{\left(e + p\right)\, R^2 + e} - 
\frac{R\, {\left(R^2 + 1\right)}^{\frac{3}{2}}\, \left(e + 
p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} & \frac{R\, \sqrt{R^2 
+ 1}}{\left(e + p\right)\, R^2 + e} - \frac{R^3\, \sqrt{R^2 + 1}\, \left(e + 
p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} \end{array}\right)
#+END_LaTeX



Uwe Brauer writes:

 "John" == John Kitchin  writes:
>
>> Here is an example using sympy. I think you will have to wrap the matlab
>> output in $$ yourself if that is what you want.
>
> Right. Using your example I obtain:
> ,
> | 
> | 
> | < M A T L A B (R) >
> |   Copyright 1984-2010 The MathWorks, Inc.
> | Version 7.10.0.499 (R2010a) 32-bit (glnx86)
> |   February 5, 2010
> | 
> |  
> |   To get started, type one of these: helpwin, helpdesk, or demo.
> |   For product information, visit www.mathworks.com.
> |  
> | >> >> >> >> >> >> 
> | ltxjac =
> | 
> | \left(\begin{array}{cc} {\left(\left(e + p\right)\, R^2 + 
> e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(R^2 + 1\right)\, 
> \left(\frac{g}{2} - \frac{1}{2}\right) & R^2\, {\left(\left(e + p\right)\, 
> R^2 + e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(\frac{g}{2} - 
> \frac{1}{2}\right)\\ \frac{R\, \sqrt{R^2 + 1}}{\left(e + p\right)\, R^2 + e} 
> - \frac{R\, {\left(R^2 + 1\right)}^{\frac{3}{2}}\, \left(e + 
> p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} & \frac{R\, 
> \sqrt{R^2 + 1}}{\left(e + p\right)\, R^2 + e} - \frac{R^3\, \sqrt{R^2 + 1}\, 
> \left(e + p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} 
> \end{array}\right)
> | 
> | >>
> `
>
> That is not perfect but much better than the original solutions, thanks
>
> Uwe 


-- 
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] make specific orgmode code blocks read only?

2016-07-11 Thread Xebar Saram
Hi!
I was wondering if possible at all and anyone knew of a way to make
specific orgmode code blocks read only? the rest of the org buffer would be
normal just specific code blocks

best

Z


Re: [O] workflow, matlab+latex in org file

2016-07-11 Thread Uwe Brauer
>>> "John" == John Kitchin  writes:

   > Here is an example using sympy. I think you will have to wrap the matlab
   > output in $$ yourself if that is what you want.

Right. Using your example I obtain:
,
| 
| 
| < M A T L A B (R) >
|   Copyright 1984-2010 The MathWorks, Inc.
| Version 7.10.0.499 (R2010a) 32-bit (glnx86)
|   February 5, 2010
| 
|  
|   To get started, type one of these: helpwin, helpdesk, or demo.
|   For product information, visit www.mathworks.com.
|  
| >> >> >> >> >> >> 
| ltxjac =
| 
| \left(\begin{array}{cc} {\left(\left(e + p\right)\, R^2 + 
e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(R^2 + 1\right)\, 
\left(\frac{g}{2} - \frac{1}{2}\right) & R^2\, {\left(\left(e + p\right)\, R^2 
+ e\right)}^{\frac{g}{2} - \frac{3}{2}}\, \left(\frac{g}{2} - 
\frac{1}{2}\right)\\ \frac{R\, \sqrt{R^2 + 1}}{\left(e + p\right)\, R^2 + e} - 
\frac{R\, {\left(R^2 + 1\right)}^{\frac{3}{2}}\, \left(e + 
p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} & \frac{R\, \sqrt{R^2 
+ 1}}{\left(e + p\right)\, R^2 + e} - \frac{R^3\, \sqrt{R^2 + 1}\, \left(e + 
p\right)}{{\left(\left(e + p\right)\, R^2 + e\right)}^2} \end{array}\right)
| 
| >>
`

That is not perfect but much better than the original solutions, thanks

Uwe 




Re: [O] workflow, matlab+latex in org file

2016-07-11 Thread John Kitchin
Here is an example using sympy. I think you will have to wrap the matlab
output in $$ yourself if that is what you want. Otherwise, the :exports 
header below specifies to only export the results, and the :results
header wraps the output in a latex environment.

#+BEGIN_SRC python :results output latex :exports results
from sympy import Integral, sqrt, symbols, latex

x = symbols('x')
 
print(latex(Integral(sqrt(1/x), x), mode='equation'))
#+END_SRC

#+RESULTS:
#+BEGIN_LaTeX
\begin{equation}\int \sqrt{\frac{1}{x}}\, dx\end{equation}
#+END_LaTeX




Uwe Brauer writes:

> Hello
>
> I want in a org file, to include matlab code and run it (that I know how
> to do)
>
> Then I want certain results, which are symbolic variables, expressed in
> latex, we I achieve  using matlab's latex command.
>
> Like
> #+begin_src matlab :results output
> clear all
> syms e p R g w K K2
> phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)]
>
> jac=jacobian(phi,[e,p])
> ltxjac=latex(jac)
> #+end_src
>
>
> This result should of course also be included in the orgfile.
>
> But then I want to export the org file to latex, such that only the
> results, which have been converted to latex are exported and all the
> matlab command should be ignored, that is in that case:
> ltxjac but nicely surrounded by say $.
>
> Anybody has an idea how to do this efficiently?
>
> thanks
>
> regards
>
>
>
> Uwe Brauer 


-- 
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] workflow, matlab+latex in org file

2016-07-11 Thread Uwe Brauer
>>> "Ken" == Ken Mankoff  writes:

   > I can't execute your code,

Why not
   >  but what does ":results output latex" show?
   > And what if you add the ";" to each line so it is not printed, except
   > the last, which is perhaps explicitly printed?


You are right! Thanks.

So I tried

#+begin_src matlab :results output latex
clear all
syms e p R g w K K2;
phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)];
 
jac=jacobian(phi,[e,p]);
ltxjac=latex(jac)
#+end_src

Problem is when I export that to a latex file, the exporter always uses
the verbatim environment, but this is not what I want, I want directly
the result of ltxjac=latex(jac) interpreted as latex not as source code.



[O] workflow, matlab+latex in org file

2016-07-11 Thread Uwe Brauer
Hello

I want in a org file, to include matlab code and run it (that I know how
to do)

Then I want certain results, which are symbolic variables, expressed in
latex, we I achieve  using matlab's latex command.

Like
#+begin_src matlab :results output
clear all
syms e p R g w K K2
phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)]

jac=jacobian(phi,[e,p])
ltxjac=latex(jac)
#+end_src


This result should of course also be included in the orgfile.

But then I want to export the org file to latex, such that only the
results, which have been converted to latex are exported and all the
matlab command should be ignored, that is in that case:
ltxjac but nicely surrounded by say $.

Anybody has an idea how to do this efficiently?

thanks

regards



Uwe Brauer 




Re: [O] Dynamic links

2016-07-11 Thread Sriram Thaiyar
That is exactly what I want!! Thank you!
Added bonus: it seems I can use this with any other mode.

I've updated the code:
https://github.com/sri/dotfiles/commit/3b2e42f488393dfc0f7fa91887877af5b195a20c

And I'm invoking it like so:

(add-hook 'org-mode-hook
  (lambda ()
(my-org-create-dynamic-link
 "\\([[:alpha:]]\\{2,5\\}-[[:digit:]]+\\)"
 "https://www.some-ticket-system/%s";)))

-Sriram


On Sun, Jul 10, 2016 at 2:19 PM, John Kitchin 
wrote:

> It kind of sounds like you want the button-lock package. See
>
> http://kitchingroup.cheme.cmu.edu/blog/2015/03/18/Clickable-links-for-Twitter-handles-in-Emacs/
> for example (and search "clickable text" on my blog for other examples).
>
> Maybe something like:
>
> #+BEGIN_SRC emacs-lisp
> (require 'button-lock)
> (global-button-lock-mode)
>
> (defvar ticket-regexp "\\([[:alpha:]]\\{2,5\\}-[[:digit:]]+\\)")
>
> (button-lock-set-button
>  ticket-regexp
>  (lambda ()
>(interactive)
>(save-excursion
>  (goto-char (previous-single-property-change (point) 'button-lock))
>  (looking-at ticket-regexp)
>  (browse-url (format "http://www.some-ticket-system/%s"; (match-string
> 0)
>  :face 'org-link)
> #+END_SRC
>
> You get no export with this, but it has the functionality you want I
> think.
>
> Sriram Thaiyar writes:
>
> > Hi-
> >
> > I've implemented "dynamic links" which are like plain links but for
> > arbitrary regular expressions.
> >
> > I was wondering if there was a better way to do this?
> >
> > You can see the implementation here:
> >
> https://github.com/sri/dotfiles/commit/cd3429ce0c8e637c803835299c2ed4653d19a5fb
> >
> > (This works with Org-mode version: 8.3.4 - 8.3.4-88-g792bb9-elpa.)
> >
> > With this config:
> >
> > (add-to-list 'my-org-dynamic-links-matcher
> >  '("\\([[:alpha:]]\\{2,5\\}-[[:digit:]]+\\)"
> >"https://some-ticketing-system.org/%s";))
> >
> > a string like `TEST-122' is turned into a link, as you type it in.
> > And when you click on that link, it'll visit this URL:
> > https://some-ticketing-system.org/TEST-122
> >
> > There are some things that gave me problems:
> >
> > - I can't hit  and have it follow the link. For this, it seems
> >   like I would need to advice the `org-return' function.
> >
> > - Despite the fact that the `TEST-123' has a `htmlize-link' text
> property,
> >   it errors out with "No link found". To fix that, I needed to add a
> hook to
> >   `org-open-at-point-functions'.
> >
> > - I had to copy a bunch of code from `org-activate-plain-links' to get
> >   this to work.
> >
> > Thanks,
> > -Sriram
>
>
> --
> 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
>