[O] Bug of org-export radio targets with utf-8 characters

2015-04-11 Thread kuangdash

中文字符 and 片仮名 can’t be exported correctly whether in latex or html. 

It seems to be the problem of function “org-export-solidify-link-text”……


So, I change the function “org-export-solidify-link-text”  in ox.el with the 
codes below


(defun org-export-solidify-link-text (s)
  Take link text S and make a safe target out of it.
  (save-match-data
(mapconcat 'identity (org-split-string (prin1-to-string 
(encode-coding-string s 'utf-8)) [^a-zA-Z0-9_.-:]+) -)))


May it be help.

Re: [O] org-agenda-insert-diary-make-new-entry adds entry as first child?

2015-04-11 Thread Nicolas Goaziou
Hello,

Nikolai Weibull n...@disu.se writes:

 Should I write a patch that adds another
 org-agenda-insert-diary-strategy called 'date-entry-last or something
 like that?

I think it would be nice. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Cannot insert footnote here

2015-04-11 Thread Thomas S. Dye
Aloha all,

The function org-footnote--allow-reference-p seems to be restrictive.
Does it need to be so restrictive?

 1) Why not allow a footnote at the beginning of a line?
  (unless (bolp) ...

 2) Why not allow a footnote at the end of a headline?
  ((memq type org-element-all-elements) nil)

All the best,
Tom

-- 
T.S. Dye  Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com



Re: [O] accessing source block header arguments from exporters

2015-04-11 Thread John Kitchin
I agree with Not exactly. In this post
http://kitchingroup.cheme.cmu.edu/blog/2014/09/22/Showing-what-data-went-into-a-code-block-on-export/
I did  something where I wanted to get information about the variables
passed into a block and show that on export. You might get some
inspiration from that. The result is at
http://kitchingroup.cheme.cmu.edu/media/2014-09-22-Showing-what-data-went-into-a-code-block-on-export/custom-src-table-export-3.html



Charles Berry writes:

 Robert Klein roklein at roklein.de writes:


 Hi,

 is there a way, to read header arguments to source blocks in the
 exporters org-exporter-src-block funktions?

 Not directly. org-babel-exp-code has no provision for headers.
 They get dropped.


 E.g. is there a way to access :firstline in the example below?


 Not exactly, but ...

 If you precede the code block with

 #+attr_firstline: 23

 then with point in the src block

 (org-element-property :attr_firstline (org-element-context))

 will return (23). And org-*-src-block functions can use it.

 If you really want to use the :firstline idiom, you can add a hook in
 `org-export-before-processing-hook' to find :firstline headers and
 insert #+attr_firstline lines in the buffer copy that the exporter is using.

 #+begin_src c++ -n :firstline 23
static struct
   {
   char*entity;
   unsigned char   equiv;
   } entities[] =
 {
   { lt,   '' } ,
   { gt,   '' } ,
   { amp,  '' } ,
   { quot, '' } ,
   { trade,153 } , /* trade mark */
 #+end_src

 I didn't find it in the `element' structure.

 However, if I use

 #+begin_src c++ firstline=23
   // random C++
 #+end_src

 I could access :parameters from `element' and parse the string.
 However I'm not sure if I'd break some babel stuff or not.


 C-c C-v C-i on that src block shows that 'firstline=23' is treated as
 a switch by babel. So if there is any language that tries to use that
 as a switch (or has a regexp that matches it), there could be trouble.

 But in C it looks innocuous.

 If I'm trying to implement a firstline feature -- source blocks with
 new line numbering (-n) beginning at a given line number -- I'd prefer
 to use :firstline, but I didn't find anything to suggest `:XXX ZZ'
 header arguments to source blocks are available to the exporters.


 HTH,

 Chuck

--
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] Incorrect HTML hyperlink text when `/` used in bibtex key with ox-bibtex.el

2015-04-11 Thread Rob Stewart
Hi,

When the bibtex key contains a `/` character, the export with
ox-bibtex.el emits an incorrect string (I think) for citing the
reference at the point it is referenced. For example:

\cite{StewartTL11}

Which in the HTML becomes:

[a href=#StewartTL114/a]

However,

\cite{DBLP:conf/appt/StewartTL11}

Becomes:

[a href=#DBLP:conf/appt/StewartTL11DBLP:conf/appt/StewartTL11/a]

So rather than a link displayed as [4] in the HTML, I see
[DBLP:conf/appt/StewartTL11].

Having experimented with omitting both `:` and `/`, it looks like it's
the `/` charactes in the bibtex key that makes the difference. Is that
a bug in ox-bibtex.el or bibtex2html?



Re: [O] Bug: clockreport in org-agenda-list - table misaligned if org-descriptive-links is nil

2015-04-11 Thread Nicolas Goaziou
Hello,

Alain Schneble (Realize IT GmbH) alain.schne...@realize.ch writes:

 Steps to reproduce:
 - if org-descriptive-links is non-nil, invoke M-x org-toggle-link-display
 - org-descriptive-links is now expected to be nil
 - M-x org-agenda-list
 - M-x org-agenda-clockreport-mode (or short: v R)

 Observation (given that there is at least some data being shown in the 
 clockreport):
 1) clockreport table is misaligned
 2) clockreport table contains descriptive links even though 
 org-descriptive-links is nil

 Cause:
 a) *org-agenda-list* /calls/ *org-agenda-prepare* which in turn /calls/ 
 *org-agenda-mode*
 b) *org-agenda-mode* /calls/ (add-to-invisibility-spec '(org-link))
In contrast, *org-mode* /calls/ (if org-descriptive-links 
 (add-to-invisibility-spec '(org-link))), hence makes adding org-link to the 
 invisibility spec dependent on org-descriptive-links.
 c) the clockreport in the agenda list is constructed in
 *org-clock-get-clocktable* using a with-temp-buffer in whose context
 (org-mode) is called. The clockreport table will therefore be aligned
 based on the invisibility spec of org-mode which is different if
 org-descriptive-links was set to nil at the time *org-agenda-list* was
 called.

Thanks for the report and the analysis.

 Suggestions:
 1.1) Inherit org-link invisibility spec in *org-clock-get-clocktable* from 
 the outer mode (i.e. org-agenda-mode):
  ...
  (let ((descriptive-links (org-in-invisibility-spec-p '(org-link
(with-temp-buffer
  (org-mode)
  (if descriptive-links
  (add-to-invisibility-spec '(org-link))
(remove-from-invisibility-spec '(org-link)))
  ...
  )
 1.2) ... or make the call to *add-to-invisibility-spec* in *org-agenda-mode* 
 dependent on org-descriptive-links as already done by *org-mode*

The latter sounds good. Do you want to prepare a patch for that?

 Btw, is there a reason why org-descriptive-links is global and not
 made buffer-local using make-variable-buffer-local after its defcustom
 definition? I had expected it to be buffer-local. If it isn't buffer
 local, the displayed links in different org buffers can get
 inconsistent with the flag hold in the org-descriptive-links variable.

If it is buffer local, we need a way to toggle it globally in all Org
buffers, possibly by adding an optional argument to
`org-toggle-link-display'.

WDYT?


Regards,

-- 
Nicolas Goaziou



[O] Putting biblography table at bottom of HTML export with ox-bibtex.el

2015-04-11 Thread Rob Stewart
Hi,

Hi folks, I'm using ox-bibtex to export to HTML. After bibtex2html has
been used, the HTML file I get puts the references at the top, and I'd
like it to be at the bottom of the HTML page. Is this possible? I'm
using the current ox-bibtex.el, i.e.

http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=contrib/lisp/ox-bibtex.el;hb=master

Thanks,

--
Rob



[O] Org-Journal Weekly View?

2015-04-11 Thread Robert Love
I’ve been using org-journal to record daily activities at work.  When it comes 
time to write the weekly progress report, is there a way to view a weeks worth 
of org-journal entries?   It’s fairly easy to go day by day but I would like a 
weekly overview if there is such a thing.

— 
Bob Love
The inherent vice of capitalism is the unequal sharing of the blessings.
The inherent blessing of socialism is the equal sharing of misery.” --Winston 
Churchill  



Re: [O] Colon in block name?

2015-04-11 Thread Nicolas Goaziou
Hello,

Loris Bennett loris.benn...@fu-berlin.de writes:

 BTW, I'm still more interested in the colon thing ...

Babel apparently supports (undocumented) filename:reference syntax for
foreign references. In your case, tab:my_data is mistakenly seen as
a reference to my_data in the file tab.

As a safety measure, I suggest not using colons in reference names.


Regards,

-- 
Nicolas Goaziou



Re: [O] Cannot insert footnote here

2015-04-11 Thread Thomas S. Dye
Aloha Vikas,

Vikas Rawal vikasli...@agrarianresearch.org writes:

 But a footnote at the end of a headline breaks LaTeX export. LaTeX
 needs an optional title as follows, to be able to include footnote in
 headline.

 http://tex.stackexchange.com/questions/47380/how-can-i-have-a-footnote-with-an-url-in-a-section-title
 http://tex.stackexchange.com/questions/47380/how-can-i-have-a-footnote-with-an-url-in-a-section-title

 How does one get that in Org?

I don't know how to get \section[short]{long} with Org mode.

However, the footnote at the end of a headline is only a problem for
LaTeX export to LaTeX classes that use section titles in page headers or
a table of contents.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



[O] [PATCH] Tiny correction on documentation (org-capture template expansion)

2015-04-11 Thread François Allisson
Hi all,

I couldn't make use of one of the template expansion, and I found that
a backslash was missing in the documentation, and now everything works
as expected. This:

 %\n Insert the text entered at the nth %^{prompt}, where n is
 a number, starting from 1.

should read like this

 %\\nInsert the text entered at the nth %^{prompt}, where n is
 a number, starting from 1.

I attached a patch,

Many thanks to all who contribute to this best software in the world,

Best,
François
From 01dd431a07f1e236163696924acb93996e23fa2b Mon Sep 17 00:00:00 2001
From: François Allisson franc...@allisson.co
Date: Sat, 11 Apr 2015 12:05:33 +0200
Subject: [PATCH] Fix documentation for org-capture template expansion

* doc/org.texi

TINYCHANGE
---
 doc/org.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/org.texi b/doc/org.texi
index dfc25dc..c400f77 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -7282,7 +7282,7 @@ dynamic insertion of content.  The templates are expanded in the order given her
 @r{You may specify a default value and a completion table with}
 @r{%^@{prompt|default|completion2|completion3...@}.}
 @r{The arrow keys access a prompt-specific history.}
-%\n @r{Insert the text entered at the nth %^@{@var{prompt}@}, where @code{n} is}
+%\\n@r{Insert the text entered at the nth %^@{@var{prompt}@}, where @code{n} is}
 @r{a number, starting from 1.}
 %?  @r{After completing the template, position cursor here.}
 @end smallexample
-- 
2.1.4



Re: [O] [PATCH] Tiny correction on documentation (org-capture template expansion)

2015-04-11 Thread Nicolas Goaziou
Hello,

François Allisson francois.allis...@unil.ch writes:

 I couldn't make use of one of the template expansion, and I found that
 a backslash was missing in the documentation, and now everything works
 as expected. This:

  %\n Insert the text entered at the nth %^{prompt}, where n is
  a number, starting from 1.

 should read like this

  %\\nInsert the text entered at the nth %^{prompt}, where n is
  a number, starting from 1.

 I attached a patch,

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou



[O] LaTeX preamble in a custom exporter

2015-04-11 Thread Marcin Borkowski
Hi list,

I'm writing an exporter derived from the LaTeX one.  I need to include
a special package in the preamble.  Do I have to override
org-latex-template (which I wouldn't like to do)?  I know about
org-latex-default-packages-alist and org-latex-packages-alist – AFAIU,
I could temporarily (let) them to a value including my package, but this
seems not very elegant.  Any other suggestions?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



Re: [O] Cannot insert footnote here

2015-04-11 Thread Vikas Rawal

 
 The function org-footnote--allow-reference-p seems to be restrictive.
 Does it need to be so restrictive?
 
 1) Why not allow a footnote at the beginning of a line?
  (unless (bolp) ...
 
 It would be a footnote definition, not a footnote reference
 
 2) Why not allow a footnote at the end of a headline?
  ((memq type org-element-all-elements) nil)
 
 It was a bug, fixed in 7584200bb88b7995b87f065320886b0813de22dd. Thank
 you.
 

But a footnote at the end of a headline breaks LaTeX export. LaTeX needs an 
optional title as follows, to be able to include footnote in headline. 

http://tex.stackexchange.com/questions/47380/how-can-i-have-a-footnote-with-an-url-in-a-section-title
 
http://tex.stackexchange.com/questions/47380/how-can-i-have-a-footnote-with-an-url-in-a-section-title

How does one get that in Org?

Vikas



Re: [O] Cannot insert footnote here

2015-04-11 Thread Nicolas Goaziou
Hello,

t...@tsdye.com (Thomas S. Dye) writes:

 The function org-footnote--allow-reference-p seems to be restrictive.
 Does it need to be so restrictive?

  1) Why not allow a footnote at the beginning of a line?
   (unless (bolp) ...

It would be a footnote definition, not a footnote reference

  2) Why not allow a footnote at the end of a headline?
   ((memq type org-element-all-elements) nil)

It was a bug, fixed in 7584200bb88b7995b87f065320886b0813de22dd. Thank
you.


Regards,

-- 
Nicolas Goaziou



[O] Help with alternative ipython session workflow

2015-04-11 Thread Giacomo M
I have never been able to make org sessions getting along properly with 
ipython, so at the moment I'm using a sort of handmade hybrid between 
org and an ipython notebook, doing the following:

1. Enter the first source block in a .org file
2. Start an ipython instance with C-c C-c
3. Keep the org/src buffer and *Python* buffer side by side
4. Copy paragraph of code around cursor (keeping cursor in position) (I 
usually split sections of code I want to run individually with spaces)

5. Select *Python* buffer
6. Go to last position
7. Type %paste
8. Go back to other buffer (src/org)

I probably sound like a caveman doing this over and over, but this is 
the most stable setup I could find. Plus I keep experimenting w/ code, 
and this gives me a very interactive environment. Macros helped me to 
automatize steps 4-8, but still it's not very flexible, e.g. I need the 
side-by-side buffers, with ipython already running.


I was wondering whether anybody has any suggestions to improve this (and 
make me save some minutes of life every day), or any good reference to 
make ipython work smoothly with org src blocks


Thanks,

Giacomo



Re: [O] Best practices to get reminders?

2015-04-11 Thread Manish
On Wed, Apr 8, 2015 at 1:11 PM, Marcin Borkowski wrote:

 On 2015-04-08, at 11:55, Eric Abrahamsen wrote:

  Don't be ashamed, I'm sure we all use some software we're not proud
  of :)

 It's not that I'm ashamed, it's that apparently it is forbidden to
 talk about certain categories of software on this list, at least if
 you don't talk about them in a derogatory manner.

I assume you meant non-free software. I am not sure what gave you that
impression but I haven't noticed such a bias so far. :) We have
discussed Emacs and Org integration with Outlook, Growl, Google Calendar,
Windows and iOS among others over past several years.

Cheers!


Re: [O] Cannot insert footnote here

2015-04-11 Thread Thomas S. Dye
Nicolas Goaziou m...@nicolasgoaziou.fr writes:

 Hello,

 t...@tsdye.com (Thomas S. Dye) writes:

 The function org-footnote--allow-reference-p seems to be restrictive.
 Does it need to be so restrictive?

  1) Why not allow a footnote at the beginning of a line?
   (unless (bolp) ...

 It would be a footnote definition, not a footnote reference

OK


  2) Why not allow a footnote at the end of a headline?
   ((memq type org-element-all-elements) nil)

 It was a bug, fixed in 7584200bb88b7995b87f065320886b0813de22dd. Thank
 you.

Fix confirmed.  Thanks!

All the best,
Tom

-- 
T.S. Dye  Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com



[O] org-latex question

2015-04-11 Thread Vikas Rawal
How do I get a headline to be exported like this?


\section[Effect on staff turnover]{An analysis of the
effect of the revised recruitment policies on staff
turnover at divisional headquarters}


That is, with an extra short-title to be used in Table of Contents and other 
running heads?

Vikas

Re: [O] Best practices to get reminders?

2015-04-11 Thread Eric Abrahamsen
Manish mailtomanish.sha...@gmail.com writes:

 On Wed, Apr 8, 2015 at 1:11 PM, Marcin Borkowski wrote:

 On 2015-04-08, at 11:55, Eric Abrahamsen wrote:

  Don't be ashamed, I'm sure we all use some software we're not
 proud
  of :)

 It's not that I'm ashamed, it's that apparently it is forbidden to
 talk about certain categories of software on this list, at least if
 you don't talk about them in a derogatory manner.

 I assume you meant non-free software. I am not sure what gave you that
 impression but I haven't noticed such a bias so far. :) We have
 discussed Emacs and Org integration with Outlook, Growl, Google
 Calendar, Windows and iOS among others over past several years.

There was definitely some shouting on this list not too long ago!




Re: [O] Help with alternative ipython session workflow

2015-04-11 Thread Ista Zahn
The settings described at
http://lists.gnu.org/archive/html/emacs-orgmode/2014-05/msg00793.html
seem to work for me. (I replaced --pylab=osx with --pylab since
I'm on Linux.)

Best
Ista

On Sat, Apr 11, 2015 at 7:09 PM, Giacomo M jackja...@gmail.com wrote:
 I have never been able to make org sessions getting along properly with
 ipython, so at the moment I'm using a sort of handmade hybrid between org
 and an ipython notebook, doing the following:
 1. Enter the first source block in a .org file
 2. Start an ipython instance with C-c C-c
 3. Keep the org/src buffer and *Python* buffer side by side
 4. Copy paragraph of code around cursor (keeping cursor in position) (I
 usually split sections of code I want to run individually with spaces)
 5. Select *Python* buffer
 6. Go to last position
 7. Type %paste
 8. Go back to other buffer (src/org)

 I probably sound like a caveman doing this over and over, but this is the
 most stable setup I could find. Plus I keep experimenting w/ code, and this
 gives me a very interactive environment. Macros helped me to automatize
 steps 4-8, but still it's not very flexible, e.g. I need the side-by-side
 buffers, with ipython already running.

 I was wondering whether anybody has any suggestions to improve this (and
 make me save some minutes of life every day), or any good reference to make
 ipython work smoothly with org src blocks

 Thanks,

 Giacomo




Re: [O] Help with alternative ipython session workflow

2015-04-11 Thread Ken Mankoff

Yes, as the author of the linked post, those worked for me. I've made some 
minor changes/improvements, so I'll reply to the OP in full here.

My current setup follows.

This works 100% for me, but does not match what the Org manual says the 
behavior should be. For example, :results value doesn't work unless I use 
:session. Inline code doesn't work unless I have :session like this: 
src_python[:session]{}

Not really a problem... The advantage of using sessions more is that you can 
keep some of your existing behavior: Split the buffer and have the session 
visible along with the code block in Org, or the code block in its special edit 
buffer via C-'.

One feature I need to implement... Currently I have emacs prompt me for custom 
python session names (last code chunk below). When Org generates a Python 
buffer (via C-', or org-edit-special), and that block has a :session 
property, the new buffer should have the session name variable that I create 
below pre-populated to the :session name, rather than prompting the user...

Hope the code below helps.

  -k.
  

* Org
** Babel 
*** IPython 
#+BEGIN_SRC emacs-lisp :results none
  (setq org-babel-python-command ipython --pylab=osx --pdb --nosep 
--classic --no-banner --no-confirm-exit)

  ;; https://github.com/jorgenschaefer/elpy/issues/191#issuecomment-42474850
  ;; make IPython work w/ Org
  (defadvice org-babel-python-evaluate
(around org-python-use-cpaste
(session body optional result-type result-params preamble) 
activate)
Add a %cpaste and '--' to the body, so that ipython does the right 
thing.
;;(setq body (concat %cpaste\n body \n--))
;;(setq body (concat %cpaste -q\n body \n--\n))
(setq body (concat %cpaste -q\n body \n--))
ad-do-it
(if (stringp ad-return-value)
(setq ad-return-value (replace-regexp-in-string \\(^Pasting code; 
enter '--' alone on the line to stop or use Ctrl-D\.[\r\n]:*\\) 
ad-return-value
#+END_SRC

*** Properly comment babel blocks with M-;
https://lists.gnu.org/archive/html/emacs-orgmode/2013-11/msg00318.html
#+BEGIN_SRC emacs-lisp :results none
;; allow comment region in the code edit buffer (according to language)
(defun my-org-comment-dwim (optional arg)
  (interactive P)
  (or (org-babel-do-key-sequence-in-edit-buffer (kbd M-;))
  (comment-dwim arg)))

;; make `C-c C-v C-x M-;' more convenient
(define-key org-mode-map
  (kbd M-;) 'my-org-comment-dwim)
#+END_SRC

* Programming
** Python
https://github.com/jorgenschaefer/elpy/
*** Elpy
#+BEGIN_SRC emacs-lisp :results none
(setenv PYTHONPATH
;;  ~/local/anaconda/bin:/Users/mankoff/local/python)
~/Library/Enthought/Canopy_64bit/User/bin:/Users/mankoff/local/python)


(elpy-enable)
(elpy-use-ipython) ;; but now un-set some features
;;(elpy-clean-modeline)
;;;(makunbound 'ipython)
(setq python-shell-interpreter ipython
  python-shell-interpreter-args --pylab=osx --pdb --nosep --classic
  python-shell-prompt-regexp  
  python-shell-prompt-output-regexp )

;(setq elpy-rpc-backend rope)
(setq elpy-rpc-backend jedi) ;;; faster than the default Rope
   ;;; backend. Not as many features though...
;(setq elpy-rpc-python-command 
/Users/mankoff/Library/Enthought/Canopy_64bit/User/bin/python)
(setq py-shell-switch-buffers-on-execute-p t)
(setq py-switch-buffers-on-execute-p t)

(require 'comint)
(define-key comint-mode-map [(control n)]
  'comint-next-input)
(define-key comint-mode-map [(control p)]
  'comint-previous-input)

#+END_SRC

*** Misc
#+BEGIN_SRC emacs-lisp :results none
;; Other
(add-hook 'python-mode-hook (lambda () (setq mode-name )))
;;(add-hook 'python-mode-hook 'turn-on-orgstruct)

#+END_SRC

*** Don't send cursor to buffer after execution
https://github.com/jorgenschaefer/elpy/issues/134
#+BEGIN_SRC emacs-lisp :results none
(defun elpy-shell-send-region-or-buffer (optional arg)
  (interactive P)
  (elpy-shell-get-or-create-process)
  (if (region-active-p)
  (python-shell-send-region (region-beginning)
(region-end))
(python-shell-send-buffer arg)))

#+END_SRC

*** Change size of REPL buffer
https://github.com/jorgenschaefer/elpy/issues/109

#+BEGIN_SRC emacs-lisp :results none
(add-to-list 'display-buffer-alist
 '(^\\*.*\\*$
   (display-buffer-reuse-window
display-buffer-pop-up-window)
   (window-height . 13)))
;;  (set-window-text-height (get-buffer-window buf) (/(frame-height) 3
#+END_SRC

*** Custom Python Session Names

https://github.com/jorgenschaefer/elpy/issues/383

I want each python session to optionally have a unique name, so that I
can run multiple sessions in multiple windows/buffers/directories and
not have them interact/interfere.

Here I've copied =elpy-shell-get-or-create-process= from =elpy.el= and