[O] Bug: Clipboard history is empty when using %^C in capture template [9.0.5 (9.0.5-elpaplus @ /home/mir/.emacs.d/elpa/org-plus-contrib-20170210/)]

2017-04-05 Thread Allen Li

Using the %^C expansion in a capture template brings up a minibuffer
prompt to read/select a clipboard value, but there are no values to
select from.

The relevant code is in the function org-capture-fill-template.

 ("C"
  (cond
   ((= (length clipboards) 1) (insert (car clipboards)))
   ((> (length clipboards) 1)
(insert (read-string "Clipboard/kill value: "
 (car clipboards)
 '(clipboards . 1)
 (car clipboards))

It looks like the intention is to put the list of possible clipboard
values into the minibuffer history for read-string, but in practice I
get an error saying the history is empty.

I suspect that the problem is that clipboard is lexically bound, and
since read-string takes a symbol for the history, it cannot get the
lexical value for clipboards from the symbol argument.

Emacs  : GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.7)
 of 2017-02-07
Package: Org mode version 9.0.5 (9.0.5-elpaplus @ 
/home/mir/.emacs.d/elpa/org-plus-contrib-20170210/)



[O] Bug in org-mobile-get-outline-path-link

2017-04-05 Thread Ian Dunn

I recently tried turning off 'org-mobile-force-id-on-agenda-items', only
to find that there were problems updating agenda tasks.  I poked around
in the code and found that 'org-mobile-locate-entry' looks for an OLP in
the form olp:file:/path/to/heading, and
'org-mobile-get-outline-path-link' stores it as
olp:file/path/to/heading.

I've attached a patch to fix the latter function.

--
Ian Dunn

diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index f6ef18f10..12e6c84b3 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -648,7 +648,7 @@ The table of checksums is written to the file 
mobile-checksums."
   (org-with-point-at pom
 (concat "olp:"
(org-mobile-escape-olp (file-name-nondirectory buffer-file-name))
-   "/"
+   ":"
(mapconcat 'org-mobile-escape-olp
   (org-get-outline-path)
   "/")




Re: [O] Insert datetree entry

2017-04-05 Thread Daniele Nicolodi
On 4/5/17 3:40 PM, Bruce V Chiarelli wrote:
> 
> Daniele Nicolodi writes:
> 
>> On 4/4/17 1:25 PM, Bruce V Chiarelli wrote:
>>>
>>> Daniele Nicolodi  writes:
>> Hi Bruce,
>>
>> I modified your code as follow to be able to insert a datetree entry
>> correctly being anywhere in an existing datetree. I also added the
>> possibility of having a prefix argument to prompt for the date. It works
>> for me, but I don't know if this is the most elegant way to obtain what
>> I want. Comments are welcome.
>>
>>
>> ;; look for datetree root
>> (defun dnn-org-datetree-root ()
>>   (let ((re
>> "^\\([12][0-9]\\{3\\}\\)\\(-\\([01][0-9]\\)\\(-\\([0123][0-9]\\)\\)?\\)?
>> \\w+$"))
>> (while (string-match re (org-get-heading))
>>   (org-up-heading-safe))
>> (org-up-heading-safe)))
>>
>> ;; add a datetree entry
>> (defun dnn-org-datetree-find-create (arg)
>>   (interactive "P")
>>   (let ((d (calendar-gregorian-from-absolute
>>  (if arg (time-to-days (org-read-date nil t)) (org-today)
>> (dnn-org-datetree-root)
>> (org-datetree-find-date-create d 'subtree-at-point)))
> 
> Nice! I'm afraid I'm unqualified to give any comments/criticism on your
> code, since I'm fairly new to elisp myself. Looks better than what I had
> though, at least to work around the missing 'subtree-at-point
> feature. Maybe someone else can chime in.

If that code works around the missiong 'subtree-at-point feature on
older org-mode releases, it is absolutely by chance, I "back-ported" the
feature into my system from current org-mode master branch :-)

Cheers,
Daniele




Re: [O] Insert datetree entry

2017-04-05 Thread Bruce V Chiarelli

Daniele Nicolodi writes:

> On 4/4/17 1:25 PM, Bruce V Chiarelli wrote:
>>
>> Daniele Nicolodi  writes:
> Hi Bruce,
>
> I modified your code as follow to be able to insert a datetree entry
> correctly being anywhere in an existing datetree. I also added the
> possibility of having a prefix argument to prompt for the date. It works
> for me, but I don't know if this is the most elegant way to obtain what
> I want. Comments are welcome.
>
>
> ;; look for datetree root
> (defun dnn-org-datetree-root ()
>   (let ((re
> "^\\([12][0-9]\\{3\\}\\)\\(-\\([01][0-9]\\)\\(-\\([0123][0-9]\\)\\)?\\)?
> \\w+$"))
> (while (string-match re (org-get-heading))
>   (org-up-heading-safe))
> (org-up-heading-safe)))
>
> ;; add a datetree entry
> (defun dnn-org-datetree-find-create (arg)
>   (interactive "P")
>   (let ((d (calendar-gregorian-from-absolute
>   (if arg (time-to-days (org-read-date nil t)) (org-today)
> (dnn-org-datetree-root)
> (org-datetree-find-date-create d 'subtree-at-point)))

Nice! I'm afraid I'm unqualified to give any comments/criticism on your
code, since I'm fairly new to elisp myself. Looks better than what I had
though, at least to work around the missing 'subtree-at-point
feature. Maybe someone else can chime in.

I did notice that with my function, org-up-heading-safe didn't always
behave the way I wanted it to (like if it was already *on* the root
headline). But I only needed the function a few times, so I didn't
bother with improving it.

> Cheers,
> Daniele
Best,
Bruce



Re: [O] problem with org-ref after upgrading org-mode from 8.3 to 9.0.5

2017-04-05 Thread Johannes Brauer
The problem was a corrupted let-plist package in my elpa folder. After 
reinstalling the package all works fine.

Johannes
Am 03.04.2017 um 20:05 schrieb John Kitchin 
>:

That looks like an issue with helm-Bibtex. You might try updating it and/or 
raise an issue with that package.


On Mon, Apr 3, 2017 at 11:03 AM Johannes Brauer 
> wrote:
that’s what I get executing (require 'org-ref):

Debugger entered--Lisp error: (error "Required feature ‘let-alist’ was not 
provided")
  require(let-alist)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\207"
 [require bibtex browse-url hl-line ido json url-queue dash let-alist seq] 2)
  require(biblio-core)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\311\312!\207"
 [require biblio-core biblio-doi biblio-arxiv biblio-crossref biblio-dblp 
biblio-hal biblio-dissemin biblio-download provide biblio] 2)
  require(biblio)
  eval-buffer(# nil 
"/Users/johannes/Library/Preferences/Aquamacs 
Emacs/Packages/elpa/helm-bibtex-20170321.1306/bibtex-completion.el" nil t)  ; 
Reading at buffer position 1340
  load-with-code-conversion("/Users/johannes/Library/Preferences/Aquamacs 
Emacs/Packages/elpa/helm-bibtex-20170321.1306/bibtex-completion.el" 
"/Users/johannes/Library/Preferences/Aquamacs 
Emacs/Packages/elpa/helm-bibtex-20170321.1306/bibtex-completion.el" nil t)
  require(bibtex-completion)
  byte-code("\306\307!\210\306\310!\210\306\311!\210\306\312!\210\313 \314\211  
\314  :\203f
--
John

---
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] Scatter-gather idea

2017-04-05 Thread Nick Dokos
Yasushi SHOJI  writes:

> Hi Bob,
>
> On Mon, Apr 3, 2017 at 1:34 PM, Bob Newell  wrote:
>>
>> A simple use case: you're brainstorming, making org-mode headline
>> entries as fast as you can think or type. After a while you notice that
>> a number of entries seem to be related and might actually be better
>> considered as a spin-off. So you want to gather up all of those entries
>> and send them off in bulk to a different org file.
>
> mark them with tags, and do org-tags-view.  Or, you can use regex or other
> criteria if you like.
>

That was my first thought too: I didn't think any extra functionality is needed.

> If you want to refile them to a org file, mark entries you want to refile with
> org-agenda-bulk-mark and do org-agenda-bulk-action and 'r' to select
> a file.
>
> http://orgmode.org/manual/Agenda-commands.html#Agenda-commands
> --
>            yashi
>

-- 
Nick




Re: [O] Viewing pdf images

2017-04-05 Thread Kaushal Modi
On Wed, Apr 5, 2017 at 7:52 AM Kaushal Modi  wrote:

> When I get to a computer, I'll confirm if the #+CAPTION: and/or #+NAME: is
> needed for the inline images to show. Above works fine for exports, so I
> assumed that the inline images should show fine too.
>

Following up on that, the inline images work just fine with.

# ()convertfrompdf:t
[[./foo.png]]

One can add

#+STARTUP: inlineimages

if the inline images are not always set to be shown by default.
-- 

Kaushal Modi


Re: [O] Numbering specific headings only

2017-04-05 Thread Mehul Sanghvi
Hi,

   Thanks for pointers.  Using the UNNUMBERED property did not work.  I
applied the property to the top level heading and the second level heading.
  I believe it cascades down to the other headings, so everything was
unnumbered.

The latex_header option worked though.  It numbered the 3rd level
heading and anything below it as well.  For the
most part I will not have any headings below that anyway so it should be
fine.


cheers,

mehul



On Wed, Apr 5, 2017 at 9:35 AM, Rasmus  wrote:

> Hi,
>
> > When I export the document to PDF, all the headings get numbered.  I only
> > want to
> > have the 3rd level heading numbered (DEFINITIONS, FOOBAR, etc.).  I have
> > got about 50 3rd level headings so far.  There may be more, might get
> > less.  I don't want to manually number the headings.
>
> Does this solve your problem:
>
> #+latex_header: \renewcommand{\thesection}{}
> #+latex_header: \renewcommand{\thesubsection}{}
> #+latex_header: \renewcommand{\thesubsubsection}{\arabic{subsubsection}}
>
> Depending on your usage, you might have to disable counter reset between
> sections/subsections.  You might be able to use the chngcntr package for
> that.
>
> You might be able to use the Org UNNUMBERED property, though I doubt it.
>
> Rasmus
>
> --
> To err is human. To screw up 10⁶ times per second, you need a computer
>
>
>


-- 
Mehul N. Sanghvi
email: mehul.sang...@gmail.com


Re: [O] Numbering specific headings only

2017-04-05 Thread Rasmus
Hi,

> When I export the document to PDF, all the headings get numbered.  I only
> want to
> have the 3rd level heading numbered (DEFINITIONS, FOOBAR, etc.).  I have
> got about 50 3rd level headings so far.  There may be more, might get
> less.  I don't want to manually number the headings.

Does this solve your problem:

#+latex_header: \renewcommand{\thesection}{}
#+latex_header: \renewcommand{\thesubsection}{}
#+latex_header: \renewcommand{\thesubsubsection}{\arabic{subsubsection}}

Depending on your usage, you might have to disable counter reset between
sections/subsections.  You might be able to use the chngcntr package for
that.

You might be able to use the Org UNNUMBERED property, though I doubt it.

Rasmus

-- 
To err is human. To screw up 10⁶ times per second, you need a computer




Re: [O] Viewing pdf images

2017-04-05 Thread Kaushal Modi
On Wed, Apr 5, 2017, 5:21 AM Julian M. Burgos 
wrote:

> Can you clarify the purpose of this function?  I understand that
> produces an image of each pdf linked to the file.


That's correct, but the user can control when that happens by adding that
function to the appropriate hook.

 But

the question in
> emacs.stackexchange was about displaying pdf's as inline images.


Yes, I forgot to change the hook when I updated the whole answer; I have
fixed that now. Now the answer shows how to add this function to the
before-save-hook.

 Your

function only converts the pdfs into images (and you have to do an
> export to achieve that).


Well, the function org-include-img-from-pdf is the workhorse here, and it
doesn't depend on when you want the PDF to PNG conversion to happen. The
"when" depends on the hook you add the function to.

  You would still would have to add a link to
> the image file in order to see it as an inline image.
> add a link in order to see it, correct?
>

I didn't follow that. The user is already adding that. Example:

# ()convertfrompdf:t
# User needs to have a ./foo.pdf. That will be converted to the below
referenced foo.png.
[[./foo.png]]

When I get to a computer, I'll confirm if the #+CAPTION: and/or #+NAME: is
needed for the inline images to show. Above works fine for exports, so I
assumed that the inline images should show fine too.



-- 

Kaushal Modi


Re: [O] Bug: Can't execute C code block from remote directory [9.0.5 (release_9.0.5-401-g86ff11 @ /Users/xcy/src/org-mode/lisp/)]

2017-04-05 Thread Chunyang Xu

Nicolas Goaziou writes:

> Hello,
>
> Chunyang Xu  writes:
>
>> Here is a patch which can fix the issue.
>
> Thank you.
>
>> From e42b22f74c2f04a4d8e7eec0a6bdacbd08bebf12 Mon Sep 17 00:00:00 2001
>> From: Chunyang Xu 
>> Date: Mon, 3 Apr 2017 14:46:51 +0800
>> Subject: [PATCH] ob-C: Fix remote executing
>>
>> * lisp/ob-C.el (org-babel-C-execute): Process remote bin file.
>>
>> TINYCHANGE
>> ---
>>  lisp/ob-C.el | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
>> index 795bcb2b7..e54e17492 100644
>> --- a/lisp/ob-C.el
>> +++ b/lisp/ob-C.el
>> @@ -161,7 +161,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
>> (org-babel-eval
>>  (pcase org-babel-c-variant
>>((or `c `cpp)
>> -   (concat tmp-bin-file cmdline))
>> +   (concat (org-babel-process-file-name tmp-bin-file) cmdline))
>
> I see that `tmp-bin-file' is used a couple other times in the body.
> Would it make sense to wrap the initial binding within
> `org-babel-process-file-name' instead of doing it only for this
> occurrence?

Both ways look OK to me. `tmp-bin-file' is used only twice and invoking
`org-babel-process-file-name' is cheap. And converting `tmp-bin-file'
from remote to local name only when 100% necessary (i.e. within
`org-babel-eval') looks more logical to me. On the other hand,
`tmp-bin-file' as a remote file name is useless, thus the way you
suggested is reasonable as well.

> Regards,





Re: [O] Viewing pdf images

2017-04-05 Thread Julian M. Burgos
Can you clarify the purpose of this function?  I understand that
produces an image of each pdf linked to the file.  But the question in
emacs.stackexchange was about displaying pdf's as inline images.  Your
function only converts the pdfs into images (and you have to do an
export to achieve that).  You would still would have to add a link to
the image file in order to see it as an inline image.
add a link in order to see it, correct?


Kaushal Modi writes:

> In case you are interested, I have now updated the solution on
> emacs.stackexchange to not use #+HEADER for this purpose:
> http://emacs.stackexchange.com/a/401/115
>
> Earlier discussion on that:
> http://lists.gnu.org/archive/html/emacs-orgmode/2017-01/msg00260.html
>
> The solution still does the exact same thing as before.
>
> On Tue, Mar 21, 2017 at 8:37 PM Doyley, Marvin M. 
> wrote:
>
>> Thanks,
>>
>> Much appreciated.
>>
>> Cheers,
>> M
>> > On Mar 21, 2017, at 6:34 AM, Julian M. Burgos <
>> julian.bur...@hafogvatn.is> wrote:
>> >
>> > I have the following in my .emacs file.  For this to work you need to
>> > have your emacs compiled with imagemagick support (and have imagemagick
>> > installed, of course).  It works well, although the images do not appear
>> > immediately the first time you toggle them because the conversion takes
>> > a little bit.
>> >
>> > #+BEGIN_SRC emacs-lisp
>> >
>> > (setq image-file-name-extensions
>> >   (quote
>> >("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm"
>> "pnm" "svg" "pdf" "bmp" "eps")))
>> > (add-to-list 'image-type-file-name-regexps '("\\.eps\\'" . imagemagick))
>> > (add-to-list 'image-file-name-extensions "eps")
>> > (add-to-list 'image-type-file-name-regexps '("\\.pdf\\'" . imagemagick))
>> > (add-to-list 'image-file-name-extensions "pdf")
>> > (setq imagemagick-types-inhibit (remove 'PDF imagemagick-types-inhibit))
>> >
>> > #+END_SRC
>> >
>> >
>> >
>> >
>> > Doyley, Marvin M. writes:
>> >
>> >> Doesn’t work. Emacs just Hangs :(
>> >>> On Mar 17, 2017, at 8:43 AM, Norwid Behrnd  wrote:
>> >>>
>> >>>
>> >>> To include and display pdf files, perhaps the setup outlined here is
>> >>> still working (dates back 2014...)
>> >>>
>> >>>
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__emacs.stackexchange.com_questions_390_display-2Dpdf-2Dimages-2Din-2Dorg-2Dmode=DwIC-g=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=s3_3riAscdqtNAzgOuwYB9g0dZVGcp8BNCy_RylYdxU=cQ2XAFEKpHWcRH33Hvyanl-V2rE3v-7glys69pwm8CY=rmvwv-l1KvLkkUN0iG1d7bT6-MNbzQOFpz5U4-fLPt0=
>> >>>
>> >>> Cheers.
>> >>>
>> >>>
>> >>>
>> >>> On 03/17/2017 01:27 PM, Doyley, Marvin M. wrote:
>>  Hi there,
>> 
>>  For manuscripts, my research group and I typically save images in pdf
>>  format, much better resolution. It would be nice to view pdf  images
>>  when working in org-mode. Does anybody know how to view pdf images in
>>  org-mode.
>> 
>>  Thanks, M
>> 
>>  PS We also work with svg images too, that would also love to view in
>>  org-mode
>> 
>> >
>> >
>> > --
>> > Julian Mariano Burgos, PhD
>> > Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/
>> > Marine and Freshwater Research Institute
>> > Skúlagata 4, 121 Reykjavík, Iceland
>> > Sími/Telephone : +354-5752037 <+354%20575%202037>
>> > Bréfsími/Telefax:  +354-5752001 <+354%20575%202001>
>> > Netfang/Email: julian.bur...@hafogvatn.is
>>
>> --
>
> Kaushal Modi


--
Julian Mariano Burgos, PhD
Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/
Marine and Freshwater Research Institute
Skúlagata 4, 121 Reykjavík, Iceland
Sími/Telephone : +354-5752037
Bréfsími/Telefax:  +354-5752001
Netfang/Email: julian.bur...@hafogvatn.is



Re: [O] Bug: Empty result when Emacs Lisp code block evals to nil [9.0.5 (release_9.0.5-401-g86ff11 @ /Users/xcy/src/org-mode/lisp/)]

2017-04-05 Thread Nicolas Goaziou
Chunyang Xu  writes:

> I notice that if the result is nil during executing emacs-lisp code
> block, org simply displays a empty #+RESULT block. For example,
>
> #+BEGIN_SRC emacs-lisp
> t
> #+END_SRC
>
>
> #+RESULTS: : t
>
> #+BEGIN_SRC emacs-lisp
> nil
> #+END_SRC
>
> #+RESULTS:
>
>
> I don't see why 'nil' is special than other values like 't'.

It is special because it is also how code evaluation specifies that
there is no produced output.

You may want to use :results scalar, e.g.,

  #+BEGIN_SRC emacs-lisp :results scalar
  nil
  #+END_SRC

  #+RESULTS:
  : nil

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Can't execute C code block from remote directory [9.0.5 (release_9.0.5-401-g86ff11 @ /Users/xcy/src/org-mode/lisp/)]

2017-04-05 Thread Nicolas Goaziou
Hello,

Chunyang Xu  writes:

> Here is a patch which can fix the issue.

Thank you.

> From e42b22f74c2f04a4d8e7eec0a6bdacbd08bebf12 Mon Sep 17 00:00:00 2001
> From: Chunyang Xu 
> Date: Mon, 3 Apr 2017 14:46:51 +0800
> Subject: [PATCH] ob-C: Fix remote executing
>
> * lisp/ob-C.el (org-babel-C-execute): Process remote bin file.
>
> TINYCHANGE
> ---
>  lisp/ob-C.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/ob-C.el b/lisp/ob-C.el
> index 795bcb2b7..e54e17492 100644
> --- a/lisp/ob-C.el
> +++ b/lisp/ob-C.el
> @@ -161,7 +161,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
>  (org-babel-eval
>   (pcase org-babel-c-variant
> ((or `c `cpp)
> -(concat tmp-bin-file cmdline))
> +(concat (org-babel-process-file-name tmp-bin-file) cmdline))

I see that `tmp-bin-file' is used a couple other times in the body.
Would it make sense to wrap the initial binding within
`org-babel-process-file-name' instead of doing it only for this
occurrence?

Regards,

-- 
Nicolas Goaziou