Re: [O] [PATCH] Fix and optimize publishing cache check

2014-08-14 Thread Nicolas Goaziou
Hello,

Matt Lundin m...@imapmail.org writes:

 Here is an improved version of the previous patch (please apply it
 rather than the previous).

Thank you for the patch.

 This version further optimizes cache checking by only calling
 find-buffer-visiting if necessary. (It also fixes some long lines.) On
 a test project containing 5000 files, running org-publish on the
 project with the cache enabled now takes seconds rather than minutes.

Great.

 +  (ctime (org-publish-cache-ctime-of-src filename))
 +  (needsp (or (null pstamp) ( pstamp ctime)))
 +  includes)
 +;; if the file needs publishing, refresh the included-files cache 
 property

Comments need to start with a capital and end with a period.

 +(when (and needsp
 +(equal (file-name-extension filename) org))
 +  (let ((visiting (find-buffer-visiting filename))
 + (buf (find-file-noselect (expand-file-name filename
 + (with-current-buffer buf
 +   (save-excursion
 + (goto-char (point-min))
 + (while (re-search-forward ^[ \t]*#\\+INCLUDE: nil t)
 +   (let* ((element (org-element-at-point))
 +  (included-file
 +   (and (eq (org-element-type element) 'keyword)
 +(let ((value (org-element-property :value element)))
 +  (and value
 +   (string-match ^\\(\.+?\\\|\\S-+\\) value)
 +   (org-remove-double-quotes
 +(match-string 1 value)))
 + (when included-file
 +   (add-to-list 'includes (expand-file-name included-file)))
 + (unless visiting (kill-buffer buf))

Do not kill buffer yet, since you may re-open it later.

 + (when includes
 +   (org-publish-cache-set-file-property filename :includes includes
 +;; return t if needsp or if included files have changed

Ditto.

 +(or needsp
 + (when (delq nil
 + (mapcar (lambda (file)
 +   (let ((ct (org-publish-cache-ctime-of-src file)))
 + (and (file-exists-p file)
 +  ( ctime ct
 + (org-publish-cache-get-file-property filename 
 :includes)))

  (when (delq nil (mapcar PREDICATE LIST)))

= 

  (org-some PREDICATE LIST)

 +   ;; update the timestamp of the published file if buffer is not 
 modified

Ditto.

 +   (let ((visiting (find-buffer-visiting filename))
 + (buf (find-file-noselect (expand-file-name filename
 + (with-current-buffer buf

Not needed if you didn't kill buffer yet.

 +   (when (not (buffer-modified-p))

  (unless ...)

 + (set-buffer-modified-p t) (save-buffer)))

Hmm.  Would `set-file-times' do the job?

 + (unless visiting (kill-buffer buf)))
 +   t

You can now kill-buffer, but for all cases.


Regards,

-- 
Nicolas Goaziou



Re: [O] Custom environment for LaTeX export

2014-08-14 Thread Sebastien Vauban


Julien Cubizolles wrote:
 Sebastien Vauban writes:

 Throwing an idea here: make the `consequence' environment be a no-op
 in Beamer?

 How would I do that, is there a variable excluding some environments?

No variable, no.

You would have to redefine the environment (with LaTeX code) so that it
doesn't do anything.

Best regards,
  Seb

-- 
Sebastien Vauban




[O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Joseph Vidal-Rosset
Hello the list,

I am sorry to ask a so elementary question but I would be happy to get a
mean to have, like with CDlatex or like in LaTeX a shortcut to get

#+BEGIN_my_choice_of_environment


#+END_my_choice_of_environment

I know that there is  s  TAB for source , l TAB for latex and so on, but
it would maybe be useful to choice the environment, like with C-e in LateX
+ auctex, or like with C {  with CD latex.

Help and suggestions are welcome.

Best wishes

Jo.


Re: [O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Joseph Vidal-Rosset
2014-08-14 12:00 GMT+02:00 Joseph Vidal-Rosset 
joseph.vidal.ros...@gmail.com:

 like with C-e in LateX + auctex, or like with C {  with CD latex.



sorry: Cc-Ce   and Cc {   ...


Re: [O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Rasmus
Hi Joseph,

Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes:

 Hello the list,

 I am sorry to ask a so elementary question but I would be happy to get a
 mean to have, like with CDlatex or like in LaTeX a shortcut to get

 #+BEGIN_my_choice_of_environment


 #+END_my_choice_of_environment

 I know that there is  s  TAB for source , l TAB for latex and so on, but
 it would maybe be useful to choice the environment, like with C-e in LateX
 + auctex, or like with C {  with CD latex.

 Help and suggestions are welcome.

Not quite what you are asking for, but have you seen the variable
`org-structure-template-alist'?  It still requires you to add each
completion.  That being said, it probably wouldn't be too hard to
write something like the prompt of cdlatex.

—Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .




Re: [O] Some thoughts on MobileOrg and its development ....

2014-08-14 Thread Jacek Generowicz

Sean Escriva sean.escr...@gmail.com writes:

 https://cordova.apache.org/

http://kivy.org

 From the little experience I have with them, cross platform frameworks
 do suffer from a loss of fidelity compared to native applications but
 as mentioned that may be an acceptable trade off.

We are talking about interfacing to org-mode, an Emacs mode: I don't
think that the target audience is one which excessively values
platform-specific look-and-feel and has an insurmountable aversion to
idiosyncratic interfaces :-)

 There's tons of options for possible paths here 

Do you have a decent resource for seeking them out? I found good ones
surprisingly difficult to find.

 (even https://wukix.com/mocl for fellow LISPers) but the key in my
 mind is to support a community of contributors.

Yes, I almost mentioned Mocl along with Kivy, but two things stopped me:

  + Mocl is not free, which will not help increase the number of
contributors,

  + I get the feeling that the average org-mode user is even less Lispy
than your average Emacs user, Elisp notwithstanding.

 Unfortunately, due to other existing commitments, i wouldn't be able
 to take point on such a reboot.

 The dreamer in me thinks this might be the itch-to-scratch that finally
 motivates me to getting to grips with Kivy; the realist in me is pretty
 certain that I fall into the same category as you.

 Realistically this is the issue in most cases, plenty of well meaning
 help but not a lot of time to do anything. Life gets in the way.

For me, after life getting in the way, by far the biggest barrier to
contribution is the platform-specificity of the projects: I simply can't
be bothered to even think about contributing to something which only be
useful to half the potential users.



Re: [O] [PATCH] ox-latex.el: add out-of-the-box fontification for makefile source block

2014-08-14 Thread Rainer M Krug
Thanks a lot Bastien - this got lost in some data chaos my side (small safe 
with backup drive inside was stolen.)


Cheers, 




Rainer
—
Sent from Mailbox on iPhone

On Mon, Jul 28, 2014 at 7:24 PM, Bastien b...@gnu.org wrote:

 Hi Rainer,
 Rainer M Krug rai...@krugs.de writes:
 Will do so but only next week.
 I applied the patch with the slight enhancement suggested by Nicolas.
 I hope you don't mind me applying instead of you, it's just that I'm
 in the flow now.
 Thanks!
 -- 
  Bastien

Re: [O] How to represent this in Org-mode

2014-08-14 Thread Nicolas Richard
Marcin Borkowski mb...@wmi.amu.edu.pl writes:

 Hello,

 now that I learned how to use a hammer, everything looks like a nail.
 So I want to use Org-mode for this; my question is, did anyone do
 anything similar and has some suggestions how to structure this
 material?

I did not do it, but still have one suggestion.

Each module could come with a name (e.g. CUSTOM_ID) and you could add a
:PREREQ: property listing all the other modules that are
prerequisite of that one.

It might then take some lisp to convert the data into an actual
dependency graph. graphviz might also come in handy for this task : it
allows to draw directed graphs easily. see below, I ended up writing
some of that lisp.

Imagine an org file like this:
#+BEGIN_SRC org
  ,* Module A
  :PROPERTIES:
  :CUSTOM_ID: A
  :END:
  ,* Module B
  :PROPERTIES:
  :CUSTOM_ID: B
  :PREREQ:   A
  :END:
  ,* Module C
  :PROPERTIES:
  :CUSTOM_ID: C
  :PREREQ:   A
  :END:
  ,* Module D
  :PROPERTIES:
  :CUSTOM_ID: D
  :PREREQ:   A B
  :END:
#+END_SRC

It could be translated to an graphviz code like this one very easily :

#+BEGIN_SRC dot :file dot-example3.png
   digraph test123 {
   {A} - B;
   {A} - C;
   {A B} - D;
   }
#+END_SRC
which then compiles into a dependency graph. (note that {A}- B could
also be written as A - B, but an automated translation mechanism
doesn't need to do that)

Here's some more graphviz code (taken from the manpage IIRC, the
comments in french are mine) to see what it can do if you want more:

#+begin_src dot :file dot-example.png
  digraph test123 {
  // on peut faire un digraphe sans tête de flèches!
  edge [arrowhead=none];
  // créer des flèches
  a - b - c;
  // créer des flèches d'un noeud vers plusieurs
  a - {x y} [weight=10];
  // donner la forme d'un noeud
  b [shape=box];
  // donner un nom, une couleur, etc. à un noeud
  c [label=hello\nworld,color=blue,fontsize=24,
   fontname=Palatino-Italic,fontcolor=red,style=filled];
  // créer une flèche avec un label et un poids.
  // si on diminue le poids (4, 3, 2, 1, 0), la flèche se courbe.
  a - z [label=hi, weight=60];
  // label multiligne.
  x - z [label=multi-line\nlabel];
  // 
  edge [style=dashed,color=red,arrowhead=normal];
  {rank=same; b-x};
  }
#+end_src

Because I was curious, I wrote a few lines of elisp to do the
conversion:

;; call this one via M-x ...
(defun yf/org-dependencies ()
  (interactive)
  (with-output-to-temp-buffer (get-buffer-create *OrgFormatDeps*)
(princ digraph OrgDeps {\n)
(org-map-entries 'yf/org-format-dependency)
(princ })
(terpri)
(pop-to-buffer (current-buffer

;; this is a helper function
(defun yf/org-format-dependency ()
  (let ((id (org-entry-get (point) CUSTOM_ID))
(prereqs (org-entry-get-multivalued-property (point) PREREQ)))
(when (and id prereqs)
  (princ
   (concat  {
   (mapconcat 'identity prereqs  )
   } - 
   id
   ;))
  (terpri


-- 
Nico.



Re: [O] Some thoughts on MobileOrg and its development ....

2014-08-14 Thread Henning Weiss
Hi,

My name is Henning and I am the co-maintainer of MobileOrg Android.

The reason I stopped working on the project is partially the lack of time,
but also because I didn't believe in the design of org-mobile-push/pull and
edit nodes. Almost half of the bugs on our issue tracker are with regards
to synchronization. Our mailing list is also full with questions about how
to set synchronization up. This is the reason I tried to come up with a
better design based on git synchronization. And I did ;)

I have been working over the last couple of months on a private prototype.
I'm currently using it in my daily life and it works for me. It uses Git
(and only Git) for synchronization and doesn't use org-mobile at all. The
idea is that you keep all org files under git version control.
Synchronization of all clients (apps or Emacs) is done against that
repository. It is also possible to configure whether to use ours or
theirs merge strategy when conflicts occur. I have focused on designing
an app I can trust.

It already has an outline view like MobileOrg, an agenda view, you can add
and edit nodes, synchronize changes with a remote repository and
synchronize scheduled entries to the calendar. I ported some of my code
from MobileOrg, but a lot of it is written from scratch.

I don't feel comfortable publishing it for general consumption yet. There
are still some rough edges for the end user, but the core functionality is
done and it works reliably. If you want to help development and testing,
feel free to contact me :)

Henning


On Thu, Aug 14, 2014 at 12:17 PM, Jacek Generowicz jacek.generow...@cern.ch
 wrote:


 Sean Escriva sean.escr...@gmail.com writes:

  https://cordova.apache.org/

 http://kivy.org

  From the little experience I have with them, cross platform frameworks
  do suffer from a loss of fidelity compared to native applications but
  as mentioned that may be an acceptable trade off.

 We are talking about interfacing to org-mode, an Emacs mode: I don't
 think that the target audience is one which excessively values
 platform-specific look-and-feel and has an insurmountable aversion to
 idiosyncratic interfaces :-)

  There's tons of options for possible paths here

 Do you have a decent resource for seeking them out? I found good ones
 surprisingly difficult to find.

  (even https://wukix.com/mocl for fellow LISPers) but the key in my
  mind is to support a community of contributors.

 Yes, I almost mentioned Mocl along with Kivy, but two things stopped me:

   + Mocl is not free, which will not help increase the number of
 contributors,

   + I get the feeling that the average org-mode user is even less Lispy
 than your average Emacs user, Elisp notwithstanding.

  Unfortunately, due to other existing commitments, i wouldn't be able
  to take point on such a reboot.
 
  The dreamer in me thinks this might be the itch-to-scratch that finally
  motivates me to getting to grips with Kivy; the realist in me is pretty
  certain that I fall into the same category as you.
 
  Realistically this is the issue in most cases, plenty of well meaning
  help but not a lot of time to do anything. Life gets in the way.

 For me, after life getting in the way, by far the biggest barrier to
 contribution is the platform-specificity of the projects: I simply can't
 be bothered to even think about contributing to something which only be
 useful to half the potential users.




Re: [O] Some thoughts on MobileOrg and its development ....

2014-08-14 Thread Eric Abrahamsen
Henning Weiss hdwe...@gmail.com writes:

 Hi,

 My name is Henning and I am the co-maintainer of MobileOrg Android.

 The reason I stopped working on the project is partially the lack of
 time, but also because I didn't believe in the design of
 org-mobile-push/pull and edit nodes. Almost half of the bugs on our
 issue tracker are with regards to synchronization. Our mailing list
 is also full with questions about how to set synchronization up. This
 is the reason I tried to come up with a better design based on git
 synchronization. And I did ;)

Sounds great! I think a lot of us already keep our ~/org directories
under git version-control, and probably many more mean to, but just need
a good push to start doing it. This would be a good push.

 I have been working over the last couple of months on a private
 prototype. I'm currently using it in my daily life and it works for
 me. It uses Git (and only Git) for synchronization and doesn't use
 org-mobile at all. The idea is that you keep all org files under git
 version control. Synchronization of all clients (apps or Emacs) is
 done against that repository. It is also possible to configure
 whether to use ours or theirs merge strategy when conflicts
 occur. I have focused on designing an app I can trust.

 It already has an outline view like MobileOrg, an agenda view, you
 can add and edit nodes, synchronize changes with a remote repository
 and synchronize scheduled entries to the calendar. I ported some of
 my code from MobileOrg, but a lot of it is written from scratch.

 I don't feel comfortable publishing it for general consumption yet.
 There are still some rough edges for the end user, but the core
 functionality is done and it works reliably. If you want to help
 development and testing, feel free to contact me :)

Maybe you could publish a very basic how-to here, and then we could
annoy you privately with problems?

Thanks!
Eric

 Henning


 On Thu, Aug 14, 2014 at 12:17 PM, Jacek Generowicz 
 jacek.generow...@cern.ch wrote:


 Sean Escriva sean.escr...@gmail.com writes:

  https://cordova.apache.org/

     http://kivy.org

  From the little experience I have with them, cross platform
 frameworks
  do suffer from a loss of fidelity compared to native
 applications but
  as mentioned that may be an acceptable trade off.

 We are talking about interfacing to org-mode, an Emacs mode: I
 don't
 think that the target audience is one which excessively values
 platform-specific look-and-feel and has an insurmountable
 aversion to
 idiosyncratic interfaces :-)

  There's tons of options for possible paths here

 Do you have a decent resource for seeking them out? I found good
 ones
 surprisingly difficult to find.

  (even https://wukix.com/mocl for fellow LISPers) but the key in
 my
  mind is to support a community of contributors.

 Yes, I almost mentioned Mocl along with Kivy, but two things
 stopped me:

   + Mocl is not free, which will not help increase the number of
     contributors,

   + I get the feeling that the average org-mode user is even less
 Lispy
     than your average Emacs user, Elisp notwithstanding.

  Unfortunately, due to other existing commitments, i wouldn't
 be able
  to take point on such a reboot.
 
  The dreamer in me thinks this might be the itch-to-scratch
 that finally
  motivates me to getting to grips with Kivy; the realist in me
 is pretty
  certain that I fall into the same category as you.
 
  Realistically this is the issue in most cases, plenty of well
 meaning
  help but not a lot of time to do anything. Life gets in the
 way.

 For me, after life getting in the way, by far the biggest barrier
 to
 contribution is the platform-specificity of the projects: I
 simply can't
 be bothered to even think about contributing to something which
 only be
 useful to half the potential users.





Re: [O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Nicolas Richard
Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes:
 I know that there is s TAB for source , l TAB for latex and so on,
 but it would maybe be useful to choice the environment, like with C-e
 in LateX + auctex, or like with C { with CD latex. 

See:
https://github.com/fniessen/org-auctex-key-bindings/blob/master/org-auctex-keys.el
The function org-auckeys-environment I think it does what you want.

you also have C-c C-v C-d for src blocks and selecting the language
with completion.

-- 
Nico.



Re: [O] Some thoughts on MobileOrg and its development ....

2014-08-14 Thread Jorge A. Alfaro-Murillo
Eric Abrahamsen writes: 

Henning Weiss hdwe...@gmail.com writes: 
I have been working over the last couple of months on a private 
prototype. I'm currently using it in my daily life and it works 
for me. It uses Git (and only Git) for synchronization and 
doesn't use org-mobile at all. The idea is that you keep all 
org files under git version control. Synchronization of all 
clients (apps or Emacs) is done against that repository. It 
is also possible to configure whether to use ours or theirs 
merge strategy when conflicts occur. I have focused on 
designing an app I can trust. 

It already has an outline view like MobileOrg, an agenda view, 
you can add and edit nodes, synchronize changes with a remote 
repository and synchronize scheduled entries to the calendar. I 
ported some of my code from MobileOrg, but a lot of it is 
written from scratch. 


Sounds great... can't wait!



Maybe you could publish a very basic how-to here, and then we 
could annoy you privately with problems? 


That's a good idea, 1+

--
Jorge.




Re: [O] shorcut for #+BEGIN_xxx ... #+END_xxx

2014-08-14 Thread Joseph Vidal-Rosset
Many thanks Nicolas. I like Fabrice Niessen's work and I'm using
leuven-theme, it is in my opinion very efficient to work with org-mode.
So I have tried immediately this org-acutex-keys-el.
But as I had a message error referring to the variable
org-structure-template-alist ,  I have succeeded to customize this variable
as I want, and in fact I do not need org-acutex-keys-el , all works
perfectly with key  TAB, and I keep Cc-Ce to export, as usual with
org-mode.
But again, thanks , to you and to Rasmus.

Jo.


2014-08-14 15:18 GMT+02:00 Nicolas Richard theonewiththeevill...@yahoo.fr:

 Joseph Vidal-Rosset joseph.vidal.ros...@gmail.com writes:
  I know that there is s TAB for source , l TAB for latex and so on,
  but it would maybe be useful to choice the environment, like with C-e
  in LateX + auctex, or like with C { with CD latex.

 See:

 https://github.com/fniessen/org-auctex-key-bindings/blob/master/org-auctex-keys.el
 The function org-auckeys-environment I think it does what you want.

 you also have C-c C-v C-d for src blocks and selecting the language
 with completion.

 --
 Nico.



Re: [O] org-table: missing vertical boundary when exported

2014-08-14 Thread Rick Frankel

On 2014-08-13 00:46, Shiyuan wrote:

Rick, 
   Do you mean that  table border=2 and table style=border:2px
don't mean the same thing? Their names suggest they do the same
things. That's a terrible naming. Changing the former to the latter
does fix the problem though. Why is that? 


Please read the HTML specifications for an explaination. By my reading
border=2 is in fact invalid in html5:

The border attribute may be specified on a table element to
explicitly indicate that the table element is not being used for
layout purposes. If specified, the attribute's value must either
be the empty string or the value 1. The attribute is used by
certain user agents as an indication that borders should be drawn
around cells of the table.

In html4 it does seem to do the same thing:

border = pixels [CN]
This attributes specifies the width (in pixels only) of the frame
around a table (see the Note below for more information about this
attribute).

     
Using the #+HTML_HEAD_EXTRA options as you suggest can also fix the
problem. But could you explain why using the HTML_HEAD_EXTRA is more
advisable than setting the table style=border:2px directly as
table attributes? What would you suggest if we want some tables have
orders and others don't have borders in the same html webpage? 


Use css selectors. If you want to set the style attribute directly on
the table element in a post-processor you may, but is is not
considered best practice.



Re: [O] Refile: refile to any open file.

2014-08-14 Thread Isaac
Kyle Meyer kyle at kyleam.com writes:



 

 Nick Dokos ndokos at gmail.com wrote:

  jorge.alfaro-murillo at yale.edu (Jorge A. Alfaro-Murillo) writes:

 [...]

  Perhaps you should return instead only the org mode files that are

  opened, something like this:

 

 

  Excellent idea: refiling to an arbitrary non-org-mode file will either

  skip the file (if you are lucky, in which case you just pay a

  performance penalty) or it will try to use it in which case you'll end

  up with an error. There is no point in including arbitrary files into

  the refile list.

 [...]

  It might be better to check the major mode of the buffer, rather than

  its filename: it is not necessarily true that foo.org is an org-mode

  file, or foo.txt is not.

 

 There's a built-in Org function that does this.

 

 #+begin_src elisp

   (org-buffer-list 'files)  

 #+end_src

 

 



Thanks Kyle, Jorge, Nick and everybody!



Below is the working piece, I take pieces here and there,

grateful to everyone's help:



(defun ixp/org-buffer-files ()

  Return list of opened orgmode buffer files

  (mapcar (function buffer-file-name)

  (org-buffer-list 'files)))



(setq org-refile-targets

  (quote ((nil :maxlevel . 3)

  (ixp/org-buffer-files :maxlevel . 1)

  (org-agenda-files :maxlevel . 3



It's posted on emacs wiki as well 
http://www.emacswiki.org/emacs/OrgMode#toc20








Re: [O] Custom environment for LaTeX export

2014-08-14 Thread Sebastien Vauban
Hello Suvayu,

Suvayu Ali wrote:
 I'm guessing Seb's idea could be implemented by redefining the
 consequence environment when in beamer, leave it alone otherwise.

Exactly.

 However, I would like to suggest something a bit different.  Why not
 instead of #+BEGIN_consequence, you use a macro.  Something like this:

   #+MACRO: cbeg @@latex:\begin{consequence}@@
   #+MACRO: cend @@latex:\end{consequence}@@

 Then you can do:

   {{{cbeg}}}
   stuff
   {{{cend}}}

 and only LaTeX export will have the environment.

That could be a good idea, but I'm pretty sure (99.999%) that LaTeX
export snippets are read in Beamer -- though the opposite is false, it's
useless for the problem at hand.

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] Some thoughts on MobileOrg and its development ....

2014-08-14 Thread Xebar Saram
would LOVE to try it as well

thx!

z


On Thu, Aug 14, 2014 at 4:36 PM, Jorge A. Alfaro-Murillo 
jorge.alfaro-muri...@yale.edu wrote:

 Eric Abrahamsen writes:

 Henning Weiss hdwe...@gmail.com writes:

 I have been working over the last couple of months on a private
 prototype. I'm currently using it in my daily life and it works for me. It
 uses Git (and only Git) for synchronization and doesn't use org-mobile at
 all. The idea is that you keep all org files under git version control.
 Synchronization of all clients (apps or Emacs) is done against that
 repository. It is also possible to configure whether to use ours or
 theirs merge strategy when conflicts occur. I have focused on designing
 an app I can trust.
 It already has an outline view like MobileOrg, an agenda view, you can
 add and edit nodes, synchronize changes with a remote repository and
 synchronize scheduled entries to the calendar. I ported some of my code
 from MobileOrg, but a lot of it is written from scratch.


 Sounds great... can't wait!



 Maybe you could publish a very basic how-to here, and then we could annoy
 you privately with problems?


 That's a good idea, 1+

 --
 Jorge.





[O] org-preview-latex-fragment, pstricks

2014-08-14 Thread Christian Straßer
Dear all,

I have a problem producing correct preview images when using pstricks.
Here's a minimal example to illustrate the problem.
I have an org-file test.org with the following content:

\begin{equation}
\varphi
\end{equation}
\begin{pspicture}
\psframebox{text in box}
test outside box
\rnode{a}{a} \rnode{b}{b}
\ncline{a}{b}
\end{pspicture}

Executing org-preview-latex-fragment is successful for both
environments (the equation and the pspicture). So no error message is
produced and no orgtex*.log files are in /tmp. The problem is though
that for the pspicture environment the psframebox is not produced.
Test in a box appears without a box.

In order to see whether the same problem appears for tex-files and
preview-latex I created a corresponding tex-file:

\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}
\psframebox{text in box}
test outside box
\end{pspicture}
\end{document}

Here everything is displayed as expected/desired.

Similar problems can be produced e.g. when drawing lines with the
\ncline command and using other pstricks-commands.

Here's the relevant settings from my .emacs:
(custom-set-variables
'(org-latex-create-formula-image-program (quote dvipng))
 '(org-latex-default-packages-alist (quote ((AUTO inputenc t)
(T1 fontenc t) ( fixltx2e nil) ( graphicx t) (
longtable nil) ( float nil) ( wrapfig nil) ( rotating
nil) (normalem ulem t) ( amsmath t) ( textcomp t) (
marvosym t) ( wasysym t) ( amssymb t) ( hyperref nil)
\\tolerance=1000 ( pstricks t) 

I also tried to set the org-latex-create-formula-image-program to
imagemagick: the problem remains the same.
I also tried to remove the pstricks-entry from
org-latex-default-packages-alist and manually add it via
#+LATEX_HEADER
which did not change the result.

Finally, here's my org-mode version: 8.2.7b.

Any help is highly appreciated.

Best wishes,

Christian



Re: [O] org-preview-latex-fragment, pstricks

2014-08-14 Thread Nick Dokos
Christian Straßer christian.stras...@ugent.be writes:

 Dear all,

 I have a problem producing correct preview images when using pstricks.
 Here's a minimal example to illustrate the problem.
 I have an org-file test.org with the following content:

 \begin{equation}
 \varphi
 \end{equation}
 \begin{pspicture}
 \psframebox{text in box}
 test outside box
 \rnode{a}{a} \rnode{b}{b}
 \ncline{a}{b}
 \end{pspicture}


I had to get rid of the \rnode and \ncline calls - apparently I don't
have the packages where they are defined.

But once I did that, the preview succeeded and I get a box around
text in box.

Org-mode version 8.3beta (release_8.3beta-177-gfe133a @
/home/nick/elisp/org-mode/lisp/)

 Executing org-preview-latex-fragment is successful for both
 environments (the equation and the pspicture). So no error message is
 produced and no orgtex*.log files are in /tmp. The problem is though
 that for the pspicture environment the psframebox is not produced.
 Test in a box appears without a box.

 In order to see whether the same problem appears for tex-files and
 preview-latex I created a corresponding tex-file:

 \documentclass{article}
 \usepackage{pstricks}
 \begin{document}
 \begin{pspicture}
 \psframebox{text in box}
 test outside box
 \end{pspicture}
 \end{document}

 Here everything is displayed as expected/desired.


Are there orgtex*.tex files in /tmp? If so, try processing one of those
from the command line and see what you get. If not, the trick I use is
to introduce a deliberate error (call undefined macro \foo) in the tex
code and then try the preview. That leaves a .tex file behind, which I
can edit to get rid of the error and then process by hand. It might be
interesting to compare that with what you have above.

 Similar problems can be produced e.g. when drawing lines with the
 \ncline command and using other pstricks-commands.

 Here's the relevant settings from my .emacs:
 (custom-set-variables
 '(org-latex-create-formula-image-program (quote dvipng))
  '(org-latex-default-packages-alist (quote ((AUTO inputenc t)
 (T1 fontenc t) ( fixltx2e nil) ( graphicx t) (
 longtable nil) ( float nil) ( wrapfig nil) ( rotating
 nil) (normalem ulem t) ( amsmath t) ( textcomp t) (
 marvosym t) ( wasysym t) ( amssymb t) ( hyperref nil)
 \\tolerance=1000 ( pstricks t) 


I don't know whether this causes your problems (probably not),
but as the doc for the variable says, it's not a good idea to change
org-latex-default-packages-alist unless there is a conflict. You should
add the pstricks entry to org-latex-packages-alist instead and leave
org-latex-default-packages-alist alone.

 I also tried to set the org-latex-create-formula-image-program to
 imagemagick: the problem remains the same.
 I also tried to remove the pstricks-entry from
 org-latex-default-packages-alist and manually add it via
 #+LATEX_HEADER
 which did not change the result.

 Finally, here's my org-mode version: 8.2.7b.

 Any help is highly appreciated.


--
Nick






Re: [O] babel: ob-C with Visual C++ and compilation-mode

2014-08-14 Thread Thierry Banel
Le 13/08/2014 22:58, Ernesto Durante a écrit :
 Thank you Thierry for your answer and all the details. I really want to be a 
 contributor
 and help ob-C to improve (as well as can do a modest lisper).

Any help is welcome !

 I tried to find a way to master Cx11 and babel is helping me a lot.
 I think babel can really accelerate learning and dissimation of C++.

 In this perspective, I have another very simple idea that I want to share
 with you. I find C++ too noisy. 

Yes, indeed.

 In the following piece of code
 I really find the presence of the main call and the return statement really 
 annoying and useless.

 #+begin_src C++ :includes '(iostream cassert) :results silent
 template typename T1, typename T2
 auto compose(T1 t1, T2 t2) - decltype(t1 + t2) { return t1+t2; }

 int main() {
  auto d=compose(std::string(ola),std::string(ciao)); //d's type is 
 std::string
  auto i=compose(4,2);
  assert(d== std::string(olaciao)  i==6);
 return 0
 }
 #+end_src

 We can remove it by letting ob-C do the work by modifying the function
 org-babel-C-ensure-main-wrap. Now the code looks (according to me) easier to 
 read

 #+begin_src C++ :includes '(iostream cassert) :results silent
 template typename T1, typename T2
 auto compose(T1 t1, T2 t2) - decltype(t1 + t2) { return t1+t2; }

 template 
 int compose(int t1,int t2) { return t1+t2; }

 main
 auto d=compose(std::string(ola),std::string(ciao)); //d's type is 
 std::string
 auto i=compose(4,2);
 assert(d== std::string(olaciao)  i==6);
 #+end_src

 What do you think ?


Well... In this example, we go down from 9 lines to 7 lines. Ok fair.
But the price is a new syntax to learn:
 main
Is it wise to add an org-mode specific syntax to C++ (which already has
a lot) ?

Being noisy is a weakness of C++.
I think it is not the responsibility of org-mode to fix that.

Now, org-mode is already able to process main()-less blocks in simple cases.

#+BEGIN_SRC C++
printf(hello\n);
#+END_SRC

If we can find a way to extend this feature to more cases,
without needing a long documentation,
then, sure, it would be a nice improvement.

Regards
Thierry




Re: [O] Manipulating Dates Automatically in a Headline

2014-08-14 Thread John Kitchin
Matt Price mopto...@gmail.com writes:


I think this is approximately what you want:

#+BEGIN_SRC emacs-lisp 
(defun insert-ts+1w ()
  Insert a timestamp at point that is one week later than the
last timestamp found in the buffer.
  (interactive)
  (let ((last-ts (car (last (org-element-map (org-element-parse-buffer) 
'timestamp
  (lambda (timestamp)
(org-element-property :raw-value 
timestamp)))
(insert last-ts)
(backward-char 2)
(org-timestamp-change +7 'day)
))
#+END_SRC

It is an interactive command you can run with M-x insert-ts+1w at the
point you want to insert the new headline.

 It's been a couple of days so I'll try restate this question more
 clearly.  I'm hoping it's possible to do something like this:

 * Week one (2014-09-09)
 * Week two (EVALUATE A LISP EXPRESSION THAT INSERTS A TIMESTAMP ONE
 WEEK LATER THAN LAST TIMESTAMP FOUND IN BUFFER)

 I don't have much experience with babel so I'm not sure how to do
 this, but if it's possible I would love some hints.  Thanks as always,

 Matt


 On Mon, Aug 11, 2014 at 2:20 PM, Matt Price mopto...@gmail.com wrote:
 Hi Everyone,

 I've asked this before, but that was a year or two ago and am hoping
 someone has an idea now, perhaps involving babel or something.

 every year at this time I rewrite a set of syllabi. I do a lot of
 moving htings around while i'm oding it, and at the end I have to
 enter a whole bunch of dates somewhat laboriously.  I have headlines
 that look about like either like this:

 -
 * Outline
 ** Week 1: Topic Title (2013-09-10)
 Longish Description
 *** Reading
 - Article 1
 - Article 2
 *** Lab
 *** Notes
 ---

 or like this:
 --
 * Outline
 ** Week 1: 2013-09-09
 *** Seminar: Technology and Society  (2013-09-10)
 *** Reading
 - Article 1
 - Article 2
 *** Plenary: Global Citizenship (2013-09-13)
 

 I would like to replace the timestamps with code that dynamically
 generates timestamps based on the value either in the last sibling
 headline, or the parent headline.  It seems to me this ought to be
 possible, but I'm not at all sure how to do it.  i would really
 appreciate any guidance.  thanks!

 Matt



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



[O] Markdown exporter deletes a line before a list

2014-08-14 Thread Rafael

I'm not sure if this is a feature or a bug. Consider this org file:

#+BEGIN_SRC org
  ,* A test
- one
- two

  ,* Another test

Consider this list:

- three
- four
#+END_SRC

Using the markdown exporter, this exports to (after the toc):

#+BEGIN_EXAMPLE
  # A testa id=sec-1/a

  -   one
  -   two

  # Another testa id=sec-2/a

  Consider this list:
  -   three
  -   four
#+END_EXAMPLE

That is, if the list follows a heading, a blank line is added, which is
OK. But if there is text between the heading and the list, the blank
line is deleted, which is definitely not OK to me.

If this is a feature, I would appreciate some guidance to have the
markdown exporter to preserve a blank line before lists. 

I tried the test with org just pulled from git, and emacs -Q -l, as
described in the manual.

Thanks for any advice, 
Rafael