[O] [BUG] Error running timer ‘org-element--cache-sync’: (wrong-type-argument hash-table-p nil)

2016-07-06 Thread tumashu
1. GNU Emacs 25.0.95.1 (i686-w64-mingw32) of 2016-06-13
2. org-20160704


#+BEGIN_COMMENT
(let ((buffer-name "*Test*"))
  (with-output-to-temp-buffer buffer-name
(set-buffer buffer-name)
(when (featurep 'org)
  (org-mode))
(setq truncate-lines 1)
(setq cursor-type nil)
(insert "This is a test")))
#+END_COMMENT

The debug info:

#+BEGIN_COMMENT
Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  clrhash(nil)
  org-element--cache-sync(#)
  apply(org-element--cache-sync #)
  timer-event-handler([t 0 0 59 nil org-element--cache-sync (#) idle 99])
Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  clrhash(nil)
  org-element--cache-sync(#)
  apply(org-element--cache-sync #)
  timer-event-handler([t 0 0 59 nil org-element--cache-sync (#) idle 99])

#+END_COMMENT



Re: [O] Export: Numbered subtree whose parent has unnumbered: t

2016-07-06 Thread Nicolas Goaziou
Hello,

Spencer Hill  writes:

> C.f. this emacs.stackexchange question: 
> http://emacs.stackexchange.com/q/24313/8818
>
> As of version 8.3 of org, numbering of subtrees in export can be
> toggled via the :UNNUMBERED property. This applies to subheadings
> regardless of their own :UNNUMBERED property value. MWE:
> * Heading
> :PROPERTIES:
> :UNNUMBERED: t
> :END:
> ** Subheading
> :PROPERTIES:
> :UNNUMBERED: nil
> :END:
> This generates for LaTeX export
>
> ...
> \section*{Heading}
> \label{sec:orgheadline2}
> \subsection*{Subheading}
> \label{sec:orgheadline1}
> Is there some other way to toggle this at the subheading level? I need
> a heading to be un-numbered when exported to LaTeX, but its child
> subheading to be numbered. I.e. \section*{Heading} and
> \subsection{Subheading}.

That is not possible out of the box. 

Depending on your needs you can define a new class so that every
\section is starred.

Regards,

-- 
Nicolas Goaziou



Re: [O] canonical way to go beginning of a link

2016-07-06 Thread Haustedt, Jens
> but in things like font-lock it seems slow compared to a
> regexp. I have not found a reliable regexp approach though. say
> I want to search back for "cite:" with point at the ^ position
> below:

> some text cite:a-key
> ^

> If I run (re-search-backward "cite:") at the point above, it does not go to 
> the point 2 characters back.

> Any ideas?

Given this setting:

some more text cite:a-key some text cite:a-key
  ^
When you run (re-search-backward "cite:") at the point above, the result is as 
follows:

some more text cite:a-key some text cite:a-key
   ^

This is exactly what I expected it to act.  In your example
above, the whole search pattern could not be found in ist entirety from
the indicated point on, so it could not be found at all and point
is not moved.

Maybe it is a good idea to move point forward for at least count
of chars in search pattern before the search executes?

Greets, Jens Haustedt





Re: [O] [ox-publish, patch] More flexible sitemaps

2016-07-06 Thread Rasmus
Robert Klein  writes:

> are those Patches still being worked on?

Yes, but they haven't been pushed yet.

Rasmus

-- 
May the Force be with you




Re: [O] BUG: swapped utf-8 symbols in org-entities

2016-07-06 Thread Rasmus
Nicolas Goaziou  writes:

>> I'm not sure what were the conclusions of the side discussion, but
>> I do want to point out that my change is in accordance with unicode
>> symbol names and with the symbols that pdflatex prints on paper.
>
> I think Rasmus (Cc'ed) discovered a bug in TeX input method. Rasmus,
> would you feel like reporting it upstream?

Sure, I can do that.

Rasmus

-- 
Slowly unravels in a ball of yarn and the devil collects it




Re: [O] patch for custom colored links in org-mode

2016-07-06 Thread Rasmus
Nicolas Goaziou  writes:

> Hello,
>
> Rasmus  writes:
>
>> Maybe a defcustom consisting of an alist of anonymous faces:
>>
>> '((R ((:background "red")))
>>   (emacs-lisp ((:background "blue"
>
> Sounds good, even if a string as the key might be better (languages are
> stored as strings in the parse tree). Also why limit ourselves to
> anonymous faces?

I've changed it to take an anonymous face, a face or a color string which
then becomes the background.  I’ll just have to get the darn customize
interface working properly.

Rasmus

-- 
Vote for proprietary math!




Re: [O] canonical way to go beginning of a link

2016-07-06 Thread John Kitchin

Haustedt, Jens writes:

> Given this setting:
>
> some more text cite:a-key some text cite:a-key
>   ^
> When you run (re-search-backward "cite:") at the point above, the result is 
> as follows:
>
> some more text cite:a-key some text cite:a-key
>^
>
> This is exactly what I expected it to act.  In your example
> above, the whole search pattern could not be found in ist entirety from
> the indicated point on, so it could not be found at all and point
> is not moved.

That is what I expect too, just not what I want ;)
>
> Maybe it is a good idea to move point forward for at least count
> of chars in search pattern before the search executes?

This is a great idea, thanks! 

>
> Greets, Jens Haustedt


-- 
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] BUG: swapped utf-8 symbols in org-entities

2016-07-06 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Sure, I can do that.

Thanks !

Regards,

-- 
Nicolas Goaziou



[O] Adding [fragile] to a LaTeX Beamer slide

2016-07-06 Thread Florian Lindner
Hello,

I try to put some source code, using the listings package in my slides:

** Source Code
#+BEGIN_LATEX
\begin{lstlisting}
for (int i = 1; i != 10; ++i) 
std::cout << i << ": hello, world!"
  << std::endl;
\end{lstlisting}
#+END_LATEX

Problem is, this, in contrast to

#+BEGIN_SRC c
foobar
#+END_SRC

does not add the fragile option the frame and therefore it does not compile.

I would prefer the latter option, but it renders to a verbatim environment, not 
a lstlisting.

How can I add a fragile option to the frame or make the BEGIN_src block use the 
lstlisting environment?

Thanks,
Florian




[O] links-9.0 v3

2016-07-06 Thread John Kitchin
I found some difficulties with the org-link-set-parameters you suggested
Nick. Your version doesn't let you add properties to links with no
existing properties, e.g. ("http") and it also didn't work as expected
to set properties to nil. The current function is one you didn't like
earlier with setf and cl-getf, but it does exactly what it should as far
as I can tell.

I also modified the org-open-at-point function so the http type of
links with no :follow function work with it. These diffs pass all the
tests for me except the two that don't pass on master either.

I think I have squashed everything together that makes sense. Let me
know if you have further thoughts.


commit 92db211ca9f95d5624b83615c83c62d8c703ca00
Author: John Kitchin 
Date:   Tue Jul 5 10:38:42 2016 -0400

Update the contrib manual

diff --git a/contrib/orgmanual.org b/contrib/orgmanual.org
index e48ae97..4346083 100644
--- a/contrib/orgmanual.org
+++ b/contrib/orgmanual.org
@@ -3300,12 +3300,16 @@ can define them in the file with
   ,#+LINK: googlehttp://www.google.com/search?q=%s
 #+end_src
 
-{{{noindent}}} In-buffer completion (see [[Completion]]) can be used after
-{{{samp([)}}} to complete link abbreviations.  You may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+{{{noindent}}} In-buffer completion (see [[Completion]]) can be used
+after {{{samp([)}}} to complete link abbreviations.  You may also
+define a function that implements special (e.g., completion) support
+for inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function
+should not accept any arguments, and return the full link with
+prefix. You can set the link completion function like this:
+
+#+BEGIN_SRC emacs-lisp
+(org-link-set-parameter "type" :complete 'some-completion-function)
+#+END_SRC
 
 ** Search options
:PROPERTIES:
@@ -16998,10 +17002,9 @@ description when the link is later inserted into an 
Org buffer with
 {{{kbd(C-c C-l)}}}.
 
 When it makes sense for your new link type, you may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+function that implements special (e.g., completion) support for
+inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function should
+not accept any arguments, and return the full link with prefix.
 
 ** Context-sensitive commands
:PROPERTIES:
@@ -19181,8 +19184,8 @@ from the list of stored links.  To keep it in the list 
later use, use a
 triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
 configure the option ~org-keep-stored-link-after-insertion~.
 
-[fn:37] This works by calling a special function
-~org-PREFIX-complete-link~.
+[fn:37] This works if a function has been defined in the :complete
+property of a link in org-link-parameters.
 
 [fn:38] See the variable ~org-display-internal-link-with-indirect-buffer~.
 

commit 895d48e4d11abdd5994c0ac2d0074e0e7efd7533
Author: John Kitchin 
Date:   Tue Jul 5 10:31:30 2016 -0400

Update NEWS with link announcement

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9909910..6ff7442 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -353,6 +353,8 @@ first footnote.
 *** The ~org-block~ face is inherited by ~src-blocks~
 This works also when =org-src-fontify-natively= is non-nil.  It is also
 possible to specify per-languages faces.  See the manual for details.
+*** Links are now customizable
+Links can now have custom colors, tooltips, keymaps, display behavior, etc... 
Links are now centralized in ~org-link-parameters~.
 ** New functions
 *** ~org-next-line-empty-p~
 It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~.

commit c9f14fa9541139c5700ef0e7a522c837411fafc7
Author: John Kitchin 
Date:   Tue Jul 5 10:29:07 2016 -0400

Update the texinfo for link parameters documentation

diff --git a/doc/org.texi b/doc/org.texi
index e92788f..aa552fc 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3711,11 +3711,11 @@ them with @key{up} and @key{down} (or @kbd{M-p/n}).
 valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
 defined through link abbreviations (@pxref{Link abbreviations}).  If you
 press @key{RET} after inserting only the @var{prefix}, Org will offer
-specific completion support for some link types@footnote{This works by
-calling a special function @code{org-PREFIX-complete-link}.}  For
-example, if you type @kbd{file @key{RET}}, file name completion (alternative
-access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
-@key{RET}} you can complete contact names.
+specific completion support for some link types@footnote{This works if a
+completion function is defined in the :complete property of a

[O] Bug: Mobile Org startgroup [8.3.4 (8.3.4-93-g0d72c3-elpaplus @ c:/USR/FJM/APP/.emacs.d/elpa/org-plus-contrib-20160627/)]

2016-07-06 Thread Francis J. Monari, Esquire
All,

I added group tags to org-tag-alist.
(:startgrouptag . nil)
  ("▸_NEW_SKILL" . ?\3)
  ("✔_OFF_CASE_PLAN" . ?\4)
  ("✘_LEFT_FIELD" . ?\5)
(:endgrouptag . nil)

When I used mobile org, about when it was generating indices, it
displayed the following message:
  org-mobile-create-index-file: Wrong type argument: sequencep,
  :startgrouptag

I expected Mobile Org to finish properly.  (It had before adding the
group tags.  I believe that group tags should be supported.)

Research on the web returned this thread:
  From: John Hutchinson
  Subject:  Re: [O] Bug and possible fix / work-around using
  org-mobile with group tags
  Date: Fri, 26 Feb 2016 00:35:01 + (UTC)

This thread recommended the following patch:
HoldingPen $ cat patch
*** org-mobile.el.GOOD  2016-02-25 17:19:52.489685000 -0500
---
/home/hutchinson/.emacs.d/elpa/org-plus-contrib-20160222/org-mobile.el
   2016-02-25 19:18:38.746283600 -0500
***
*** 454,467 
(insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
(mapconcat 'identity done-kwds " ") "\n"))
(setq def-tags (mapcar
! (lambda (x)
!   (cond ((null x) nil)
! ((stringp x) x)
! ((eq (car x) :startgroup) "{")
! ((eq (car x) :endgroup) "}")
! ((eq (car x) :grouptags) nil)
! ((eq (car x) :newline) nil)
! ((listp x) (car x
  def-tags))
(setq def-tags (delq nil def-tags))
(setq tags (org-delete-all def-tags tags))
--- 454,469 
(insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
(mapconcat 'identity done-kwds " ") "\n"))
(setq def-tags (mapcar
!   (lambda (tag)
! (cl-case (car tag)
!   ((nil) nil)
!   (:startgroup "{")
!   (:endgroup "}")
!   (:startgrouptag "{")
!   (:endgrouptag "}")
!   (:grouptags ":")
!   (:newline nil)
!   (t (car tag
  def-tags))
(setq def-tags (delq nil def-tags))
(setq tags (org-delete-all def-tags tags))
HoldingPen $

I manually applied the patch.  It resolved my issue.

Two Questions:
= Is there any down-side to this patch?  (My knowledge of LiSP and Org
is very limited.)
= If appropriate, can the source code be patched?

Thank you.

Frank.


Emacs  : GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Package: Org-mode version 8.3.4 (8.3.4-93-g0d72c3-elpaplus @
c:/USR/FJM/APP/.emacs.d/elpa/org-plus-contrib-20160627/



Re: [O] Using property values in source code blocks

2016-07-06 Thread Charles C. Berry

On Tue, 5 Jul 2016, Joon Ro wrote:


Hi,


I'm aware of passing variables through header arguments, and also 
inserting another source code block using the noweb syntax.


I was wondering, however, would it be possible to directly input values 
of properties inside source code blocks? For example,


Yes. `org-property-values' does the trick


* Subtree
:PROPERTIES:
:DUMMY: Value
:END:

#+BEGIN_SRC shell :var dumdum=(car (org-property-values "DUMMY"))
echo $dumdum
#+END_SRC

#+RESULTS:
: Value

#+NAME: get-property
#+BEGIN_SRC emacs-lisp :var prop="prop"
(org-property-values prop)
#+END_SRC

#+BEGIN_SRC emacs-lisp :noweb yes
(quote
<>
)
#+END_SRC

#+RESULTS:
| Value |

HTH,

Chuck



[O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)]

2016-07-06 Thread Rares Vernica
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

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

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


In the following table:

| [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | d   |
| [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2 d |
#+TBLFM: $3=$2

The second column is computed by pressing C-u C-c C-y. This sequence
calculates the time difference between the time-stamps in the previous
column and inserts the difference in the current column. This is fine.

Now, for the third column, I insert the formula listed at the bottom of
the table. Once applied, the result of the formula for the fist row is
just "d" instead of "1d". So, it seems that the value is not copied
correctly.

This seems to work fine if the time-stamp range is greater than one
day. Also, for the second row, the value is copied correctly but there
is an extra " " inserted between the number and the "d" letter. This
might not be desirable.

Appending "D" at the end of the formula, yields the same result:

| [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | d   |
| [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2 d |
#+TBLFM: $3=$2;D

I also tried appending "T" at the end of the formula:

| [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | 00:00:01 |
| [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 00:00:02 |
#+TBLFM: $3=$2;T

The numeric value is copied correctly but the days are now changed to
seconds.

I attached a dribble file which allows you to reproduce the first row in
the first table.

Emacs  : GNU Emacs 25.0.94.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.20.4)
 of 2016-05-18
Package: Org-mode version 8.2.10 (release_8.2.10 @
/usr/share/emacs/25.0.94/lisp/org/)

current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
  org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook org-show-block-all
append local]
   5]
 #[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
   5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
  org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )


org-copy-bug.dribble
Description: Binary data


[O] bug#23890: 25.0.94; Org-mode Table does not copy time interval correctly

2016-07-06 Thread Rares Vernica
Nicolas Goaziou  writes:

> It isn't a bug actually.
>
> Spreadsheet formulas are sent to Calc (unless it starts with "'(" in
> which case it is treated as Elisp). Doing symbolic computations, Calc
> parses "1d" as one time the symbolic variable "d". So "1d" is the same
> as "d".
>
> Basically, the OP could use instead:
>
> #+TBLFM: $3='(identity $2)

That did the trick, thanks!

Just to clarify, how would you fix this:

| [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | vsum(d) |
| [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | 2 d |
#+TBLFM: $3=vsum(@1$-1..@0$-1)

Notice the "vsum(d)" instead of the expected "1 d". How would you add
"identity" here?

Thanks!
Rares





Re: [O] Using property values in source code blocks

2016-07-06 Thread Joon Ro

> Yes. `org-property-values' does the trick
> 
> 
> * Subtree
> :PROPERTIES:
> :DUMMY: Value
> :END:
> 
> #+BEGIN_SRC shell :var dumdum=(car (org-property-values "DUMMY"))
> echo $dumdum
> #+END_SRC
> 
> #+RESULTS:
> : Value
> 
> #+NAME: get-property
> #+BEGIN_SRC emacs-lisp :var prop="prop"
> (org-property-values prop)
> #+END_SRC
> 
> #+BEGIN_SRC emacs-lisp :noweb yes
> (quote
> <>
> )
> #+END_SRC
> 
> #+RESULTS:
> | Value |
> 
> HTH,
> 
> Chuck
> 

Thank you so much for the reply - this would be very useful. Would there be, 
however, a way to directly replace some place holder inside a source code 
block? The reason is I have to put those values inside a comment, so I cannot 
pass them as variables.
Best,Joon 

[O] bug#23890: 25.0.94; Org-mode Table does not copy time interval correctly

2016-07-06 Thread Nicolas Goaziou
Hello,

Rares Vernica  writes:

> Just to clarify, how would you fix this:
>
> | [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | vsum(d) |
> | [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | 2 d |
> #+TBLFM: $3=vsum(@1$-1..@0$-1)
>
> Notice the "vsum(d)" instead of the expected "1 d". How would you add
> "identity" here?

You probably need to use Lisp formulas instead of Calc, i.e, wrap the
formula within '(...).

I'm no specialist about table formulas; I suggest to ask on Org mailing
list.

Regards,

-- 
Nicolas Goaziou





Re: [O] Problem with eldoc and Python

2016-07-06 Thread Nicolas Goaziou
Hello,

Fabrice Popineau  writes:

> Am I alone to see this recently:
>
> insert an src python block with  moving inside the src block
> and then some timer function breaking with:
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp #[128 "\300\301
> \"\206 ... [eldoc-documentation-function apply default-value] 4 "
> (fn &rest ARGS)"] nil] 4 nil])
>   fboundp(#[128 "\300\301...[apply python-eldoc-function #[128
> "\301\302\300!^B\"\207" [eldoc-documentation-function apply default-value]
> 4 "\n\n(fn &rest ARGS)"] nil] 4 nil])
>   org-eldoc-documentation-function()
>   eldoc-print-current-symbol-info()
> ...
> timer-event-handler([t 0 0 50 nil #[0 "... [eldoc-mode
> global-eldoc-mode eldoc-documentation-function (nil ignore)
> eldoc-print-current-symbol-info] 2] nil idle 0])
>
> This is with the latest emacs-25 "soon to be released" and the latest Org
> mode.
>
> Any help appreciated.

Could you send a backtrace with non byte-compiled code?

Regards,

-- 
Nicolas Goaziou



Re: [O] Adding [fragile] to a LaTeX Beamer slide

2016-07-06 Thread Nicolas Goaziou
Hello,

Florian Lindner  writes:

> How can I add a fragile option to the frame

You can set :BEAMER_OPT property accordingly.

> or make the BEGIN_src block use the lstlisting environment?

See `org-latex-listings'.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Mobile Org startgroup [8.3.4 (8.3.4-93-g0d72c3-elpaplus @ c:/USR/FJM/APP/.emacs.d/elpa/org-plus-contrib-20160627/)]

2016-07-06 Thread Nicolas Goaziou
Hello,

"Francis J. Monari, Esquire"  writes:

> = Is there any down-side to this patch?  (My knowledge of LiSP and Org
> is very limited.)
> = If appropriate, can the source code be patched?

First, could you try Org development version and see if this bug is
fixed?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Problem with eldoc and Python

2016-07-06 Thread Fabrice Popineau
2016-07-06 22:41 GMT+02:00 Nicolas Goaziou :

> Hello,
>
> Fabrice Popineau  writes:
>
> > Am I alone to see this recently:
> >
> > insert an src python block with  > moving inside the src block
> > and then some timer function breaking with:
> >
> > Debugger entered--Lisp error: (wrong-type-argument symbolp #[128
> "\300\301
> > \"\206 ... [eldoc-documentation-function apply default-value] 4 "
> > (fn &rest ARGS)"] nil] 4 nil])
> >   fboundp(#[128 "\300\301...[apply python-eldoc-function #[128
> > "\301\302\300!^B\"\207" [eldoc-documentation-function apply
> default-value]
> > 4 "\n\n(fn &rest ARGS)"] nil] 4 nil])
> >   org-eldoc-documentation-function()
> >   eldoc-print-current-symbol-info()
> > ...
> > timer-event-handler([t 0 0 50 nil #[0 "... [eldoc-mode
> > global-eldoc-mode eldoc-documentation-function (nil ignore)
> > eldoc-print-current-symbol-info] 2] nil idle 0])
> >
> > This is with the latest emacs-25 "soon to be released" and the latest Org
> > mode.
> >
> > Any help appreciated.
>
> Could you send a backtrace with non byte-compiled code?
>
>
Hi Nicolas,

The problem is that the byte code comes from Python mode.
I solved the problem with this:

$ diff -uw contrib/lisp/org-eldoc.el contrib/lisp/org-eldoc.el
--- contrib/lisp/org-eldoc.el   2016-02-29 11:13:22.330099500 +0100
+++ contrib/lisp/org-eldoc.el   2016-07-04 07:11:10.466144400 +0200
@@ -155,7 +155,8 @@
  (string= lang "golang")) (when (require 'go-eldoc nil t)

 (go-eldoc--documentation-function)))
(t (let ((doc-fun
(org-eldoc-get-mode-local-documentation-function lang)))
-(when (fboundp doc-fun) (funcall doc-fun
+(when (or (and (symbolp doc-fun) (fboundp doc-fun))
+ (functionp doc-fun)) (funcall doc-fun

 ;;;###autoload
 (defun org-eldoc-load ()



In python.el, one can find this around line 5129:

  (if (null eldoc-documentation-function)
  ;; Emacs<25
  (set (make-local-variable 'eldoc-documentation-function)
   #'python-eldoc-function)
(add-function :before-until (local 'eldoc-documentation-function)
  #'python-eldoc-function))

which stores byte code in eldoc-documentation-function, which makes
fboundp fail because the object is not a symbol. However it is a function.

Regards,

Fabrice


Re: [O] Problem with eldoc and Python

2016-07-06 Thread Nicolas Goaziou
Fabrice Popineau  writes:

> The problem is that the byte code comes from Python mode.
> I solved the problem with this:
>
> $ diff -uw contrib/lisp/org-eldoc.el contrib/lisp/org-eldoc.el
> --- contrib/lisp/org-eldoc.el   2016-02-29 11:13:22.330099500 +0100
> +++ contrib/lisp/org-eldoc.el   2016-07-04 07:11:10.466144400 +0200
> @@ -155,7 +155,8 @@
>   (string= lang "golang")) (when (require 'go-eldoc nil t)
>
>  (go-eldoc--documentation-function)))
> (t (let ((doc-fun
> (org-eldoc-get-mode-local-documentation-function lang)))
> -(when (fboundp doc-fun) (funcall doc-fun
> +(when (or (and (symbolp doc-fun) (fboundp doc-fun))
> + (functionp doc-fun)) (funcall doc-fun

Wouldn't

  (when (functionp doc-fun) (funcall doc-fun))

be enough?

Also, would you provide a patch for this?

Thank you.

Regards,



Re: [O] links-9.0 v3

2016-07-06 Thread Nicolas Goaziou
Hello,

John Kitchin  writes:

> Your version doesn't let you add properties to links with no
> existing properties, e.g. ("http")

There was a typo (spurious `cdr'), the correct version is

  (defun org-link-set-parameters (type &rest parameters)
"Set link TYPE properties to PARAMETERS.
  PARAMETERS should be :key val pairs."
(let ((data (assoc type org-link-parameters)))
  (if data (setcdr data (org-combine-plists (cdr data) parameters))
(push (cons type parameters) org-link-parameters)
(org-make-link-regexps)
(org-element-update-syntax

> and it also didn't work as expected to set properties to nil.

Not sure to understand what you mean here. Could you give an example?

> I think I have squashed everything together that makes sense. Let me
> know if you have further thoughts.

OK. Some comments follow.

> +{{{noindent}}} In-buffer completion (see [[Completion]]) can be used
> +after {{{samp([)}}} to complete link abbreviations.  You may also
> +define a function that implements special (e.g., completion) support
> +for inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function
> +should not accept any arguments, and return the full link with
> +prefix. You can set the link completion function like this:

Mind the spaces after sentences.

In any case, updating contrib manual is not top priority, since many
section needs to be updated anyway.

> +[fn:37] This works if a function has been defined in the :complete
> +property of a link in org-link-parameters.

~org-link-parameters~

> -(org-add-link-type "id" 'org-id-open)
> +(org-link-set-parameters "id" :follow 'org-id-open)

Nitpick: #'org-id-open

> -(add-hook 'org-store-link-functions 'org-w3m-store-link)
> +(org-link-set-parameters "w3m" :store 'org-w3m-store-link)

#'org-w3m-store-link

You get the idea, I will not comment the other occurrences.

> +(type (save-match-data
> +(if (string-match org-plain-link-re hl)
> +(match-string-no-properties 1 hl)
> +  nil)))

Nitpick

  (save-match-data
(and (string-match org-plain-link-re hl)
 (match-string-no-properties 1 hl)))

> +(path (save-match-data
> +(if (string-match org-plain-link-re hl)
> +(match-string-no-properties 2 hl)
> +  nil)))

Ditto.

> -((assoc type org-link-parameters)
> +((and (assoc type org-link-parameters)
> +  (functionp (org-link-get-parameter type :follow)))

I think (functionp ...) is sufficient, no need for the `and' and 
(assoc type org-link-parameters), which `org-link-get-parameters'
already takes case of.  So

  ((functionp (org-link-get-parameters type :follow)
   ...)

> * lisp/org.el: Replace the variable `org-store-link-functions' with a
>   function by the same name.

You need to add the name of the function being modified.

> Update org-add-link-type
> 
> * lisp/org.el org-add-link-type: deprecated and now calls
>   `org-link-add'.
> 
> Create a new `org-link-add' function for making links.

You probably mean `org-link-set-parameters', since `org-link-add' would
be but a lesser version of the former.

> +  (org-link-add type :follow follow :export export)

See above.

> +(defun org-store-link-functions ()
> +  "Returns a list of functions that are called to create and store a link.
> +The functions in the variable `org-store-link-functions' come
> +first. These may be user-defined for different contexts. Then
> +comes the functions defined in the :store property of
> +org-link-parameters.
> +
> +Each function will be called in turn until one returns a non-nil
> +value. Each function should check if it is responsible for
> +creating this link (for example by looking at the major mode). If
> +not, it must exit and return nil. If yes, it should return a
> +non-nil value after a calling `org-store-link-props' with a list
> +of properties and values. Special properties are:

Mind the spaces between sentences.

I don't understand why we need to both preserve
`org-store-link-functions' and use :store property. Wouldn't one
location be enough?

> +:type The link prefix, like \"http\".  This must be given.
> +:link The link, like \"http://www.astro.uva.nl/~dominik\";.
> +  This is obligatory as well.
> +:description  Optional default description for the second pair
> +  of brackets in an Org-mode link.  The user can still change
> +  this when inserting this link into an Org-mode buffer.

Org-mode -> Org mode

> +In addition to these, any additional properties can be specified
> +and then used in capture templates."
> +  (append
> +   org-store-link-functions
> +   (cl-loop for link in org-link-parameters
> + with store-func
> + do (setq store-func (org-link-get-parameter (car link) :store))
> + if store-func
> + collect store-func)))

The above looks du

Re: [O] links-9.0 v3

2016-07-06 Thread John Kitchin
Thanks. I responded to some below. I didn't respond to all of them. I
will revise the commits accordingly and send a new version.

Nicolas Goaziou writes:

> Hello,
>
> John Kitchin  writes:
>
>> Your version doesn't let you add properties to links with no
>> existing properties, e.g. ("http")
>
> There was a typo (spurious `cdr'), the correct version is
>
>   (defun org-link-set-parameters (type &rest parameters)
> "Set link TYPE properties to PARAMETERS.
>   PARAMETERS should be :key val pairs."
> (let ((data (assoc type org-link-parameters)))
>   (if data (setcdr data (org-combine-plists (cdr data) parameters))
> (push (cons type parameters) org-link-parameters)
> (org-make-link-regexps)
> (org-element-update-syntax
>
>> and it also didn't work as expected to set properties to nil.

I will give this a try.
>
> Not sure to understand what you mean here. Could you give an example?

If I ran the previous function a few times like this

(org-link-set-parameters "http" :follow nil)

I would get
("http" :follow :follow nil nil nil...)

probably because of the bug. I will let you know if it works.

>> I think I have squashed everything together that makes sense. Let me
>> know if you have further thoughts.
>
> OK. Some comments follow.
>
>> +{{{noindent}}} In-buffer completion (see [[Completion]]) can be used
>> +after {{{samp([)}}} to complete link abbreviations.  You may also
>> +define a function that implements special (e.g., completion) support
>> +for inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function
>> +should not accept any arguments, and return the full link with
>> +prefix. You can set the link completion function like this:
>
> Mind the spaces after sentences.
I will fix these.

>
> In any case, updating contrib manual is not top priority, since many
> section needs to be updated anyway.
>
>> +[fn:37] This works if a function has been defined in the :complete
>> +property of a link in org-link-parameters.
>
> ~org-link-parameters~
>
>> -(org-add-link-type "id" 'org-id-open)
>> +(org-link-set-parameters "id" :follow 'org-id-open)
>
> Nitpick: #'org-id-open
>
>> -(add-hook 'org-store-link-functions 'org-w3m-store-link)
>> +(org-link-set-parameters "w3m" :store 'org-w3m-store-link)
>
> #'org-w3m-store-link
>
> You get the idea, I will not comment the other occurrences.

Just to make sure I get it, all functions should be sharp quoted like this?

>
>> +   (type (save-match-data
>> +   (if (string-match org-plain-link-re hl)
>> +   (match-string-no-properties 1 hl)
>> + nil)))
>
> Nitpick
>
>   (save-match-data
> (and (string-match org-plain-link-re hl)
>  (match-string-no-properties 1 hl)))
>
>> +   (path (save-match-data
>> +   (if (string-match org-plain-link-re hl)
>> +   (match-string-no-properties 2 hl)
>> + nil)))
>
> Ditto.

ok

>
>> -   ((assoc type org-link-parameters)
>> +   ((and (assoc type org-link-parameters)
>> + (functionp (org-link-get-parameter type :follow)))
>
> I think (functionp ...) is sufficient, no need for the `and' and 
> (assoc type org-link-parameters), which `org-link-get-parameters'
> already takes case of.  So
>
>   ((functionp (org-link-get-parameters type :follow)
>...)
>
>> * lisp/org.el: Replace the variable `org-store-link-functions' with a
>>   function by the same name.
>
> You need to add the name of the function being modified.
>
>> Update org-add-link-type
>> 
>> * lisp/org.el org-add-link-type: deprecated and now calls
>>   `org-link-add'.
>> 
>> Create a new `org-link-add' function for making links.
>
> You probably mean `org-link-set-parameters', since `org-link-add' would
> be but a lesser version of the former.
>
>> +  (org-link-add type :follow follow :export export)
>
> See above.
>
>> +(defun org-store-link-functions ()
>> +  "Returns a list of functions that are called to create and store a link.
>> +The functions in the variable `org-store-link-functions' come
>> +first. These may be user-defined for different contexts. Then
>> +comes the functions defined in the :store property of
>> +org-link-parameters.
>> +
>> +Each function will be called in turn until one returns a non-nil
>> +value. Each function should check if it is responsible for
>> +creating this link (for example by looking at the major mode). If
>> +not, it must exit and return nil. If yes, it should return a
>> +non-nil value after a calling `org-store-link-props' with a list
>> +of properties and values. Special properties are:
>
> Mind the spaces between sentences.
>
> I don't understand why we need to both preserve
> `org-store-link-functions' and use :store property. Wouldn't one
> location be enough?
>

It probably isn't necessary. I will take it out.

>> +:type The link prefix, like \"http\".  This must be given.
>> +:link The link, like \"

Re: [O] Using property values in source code blocks

2016-07-06 Thread Charles C. Berry

On Wed, 6 Jul 2016, Joon Ro wrote:




Yes. `org-property-values' does the trick


* Subtree
:PROPERTIES:
:DUMMY: Value
:END:

#+BEGIN_SRC shell :var dumdum=(car (org-property-values "DUMMY"))
echo $dumdum
#+END_SRC


[deleted]



Thank you so much for the reply - this would be very useful. Would there 
be, however, a way to directly replace some place holder inside a source 
code block?


I have no idea what you are asking.

The reason is I have to put those values inside a comment, 
so I cannot pass them as variables.


So your original query about accessing property values from src blocks was 
not what you wanted?


Examples of what one is trying to do - even if they do not work exactly as 
intended - are often more helpful than verbal explanations of what one 
would like to do.


Chuck



[O] ob-sql: setting :dbhost from a variable

2016-07-06 Thread Stig Brautaset
Hello!

I have an Org document that does several SQL queries against two different
PostgreSQL databases. Currently I set the =:dbhost= header argument for each
source block, like this:
  
#+BEGIN_SRC sql :dbhost db1.example.com
  SELECT 1;
#+END_SRC

#+header: 
#+BEGIN_SRC sql :dbhost db2.example.com
  SELECT 2;
#+END_SRC

... many other queries against both dbs omitted ...

Having the hosts all over my org document is a bit annoying. I would like to
specify them in a property section at header/buffer level, but haven't figured
out how to do this. I would *love* to be able to do something like this:

#+property: header-args :var db1="db1.example.com" db2="db2.example.com"

#+BEGIN_SRC sql :dbhost $db1
  SELECT 1;
#+END_SRC

#+BEGIN_SRC sql :dbhost $db2
  SELECT 2;
#+END_SRC

However, that does not appear to work. I also tried using macros, but this did
not work either:

#+macro: db1 db1.example.com
#+macro: db2 db2.example.com

#+BEGIN_SRC sql :dbhost {{{db1}}}
  SELECT 1;
#+END_SRC

#+BEGIN_SRC sql :dbhost {{{db2}}}
  SELECT 2;
#+END_SRC


I got this error:

: psql: could not translate host name "{{{db1}}}" to address: Name or service 
not known

Finally I tried to do this by using :session, setting the :dbhost only
on the first instance, but did not work either.

Does anyone have any tips for how I can consolidate all my explicit (and
duplicated) :dbhost stanzas?

Stig




Re: [O] links-9.0 v3

2016-07-06 Thread John Kitchin
I think I have addressed these. Revised commits appended and at 
https://github.com/jkitchin/org-mode/tree/link-9.0-v3.

The new org-link-set-parameters function you suggested works fine as far
as I can tell. WDYT?

commit f8bb180150514b92535506601c747001da305610
Author: John Kitchin 
Date:   Tue Jul 5 10:38:42 2016 -0400

Update the contrib manual

diff --git a/contrib/orgmanual.org b/contrib/orgmanual.org
index e48ae97..07d9e8d 100644
--- a/contrib/orgmanual.org
+++ b/contrib/orgmanual.org
@@ -3300,12 +3300,16 @@ can define them in the file with
   ,#+LINK: googlehttp://www.google.com/search?q=%s
 #+end_src
 
-{{{noindent}}} In-buffer completion (see [[Completion]]) can be used after
-{{{samp([)}}} to complete link abbreviations.  You may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+{{{noindent}}} In-buffer completion (see [[Completion]]) can be used
+after {{{samp([)}}} to complete link abbreviations.  You may also
+define a function that implements special (e.g., completion) support
+for inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function
+should not accept any arguments, and return the full link with
+prefix.  You can set the link completion function like this:
+
+#+BEGIN_SRC emacs-lisp
+(org-link-set-parameter "type" :complete #'some-completion-function)
+#+END_SRC
 
 ** Search options
:PROPERTIES:
@@ -16998,10 +17002,9 @@ description when the link is later inserted into an 
Org buffer with
 {{{kbd(C-c C-l)}}}.
 
 When it makes sense for your new link type, you may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+function that implements special (e.g., completion) support for
+inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function should
+not accept any arguments, and return the full link with prefix.
 
 ** Context-sensitive commands
:PROPERTIES:
@@ -19181,8 +19184,8 @@ from the list of stored links.  To keep it in the list 
later use, use a
 triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
 configure the option ~org-keep-stored-link-after-insertion~.
 
-[fn:37] This works by calling a special function
-~org-PREFIX-complete-link~.
+[fn:37] This works if a function has been defined in the :complete
+property of a link in ~org-link-parameters~.
 
 [fn:38] See the variable ~org-display-internal-link-with-indirect-buffer~.
 

commit d5db3a80b3e6eab98935a329d8633a85f398ee3a
Author: John Kitchin 
Date:   Tue Jul 5 10:31:30 2016 -0400

Update NEWS with link announcement

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9909910..6ff7442 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -353,6 +353,8 @@ first footnote.
 *** The ~org-block~ face is inherited by ~src-blocks~
 This works also when =org-src-fontify-natively= is non-nil.  It is also
 possible to specify per-languages faces.  See the manual for details.
+*** Links are now customizable
+Links can now have custom colors, tooltips, keymaps, display behavior, etc... 
Links are now centralized in ~org-link-parameters~.
 ** New functions
 *** ~org-next-line-empty-p~
 It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~.

commit 74d6817ea942b9b20b9a15f47d259ef71ddb83a3
Author: John Kitchin 
Date:   Tue Jul 5 10:29:07 2016 -0400

Update the texinfo for link parameters documentation

diff --git a/doc/org.texi b/doc/org.texi
index e92788f..f962a58 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3711,11 +3711,11 @@ them with @key{up} and @key{down} (or @kbd{M-p/n}).
 valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
 defined through link abbreviations (@pxref{Link abbreviations}).  If you
 press @key{RET} after inserting only the @var{prefix}, Org will offer
-specific completion support for some link types@footnote{This works by
-calling a special function @code{org-PREFIX-complete-link}.}  For
-example, if you type @kbd{file @key{RET}}, file name completion (alternative
-access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
-@key{RET}} you can complete contact names.
+specific completion support for some link types@footnote{This works if a
+completion function is defined in the :complete property of a link in
+@var{org-link-parameters}.}  For example, if you type @kbd{file @key{RET}},
+file name completion (alternative access: @kbd{C-u C-c C-l}, see below) will
+be offered, and after @kbd{bbdb @key{RET}} you can complete contact names.
 @orgkey C-u C-c C-l
 @cindex file name completion
 @cindex completion, of file names
@@ -3887,10 +3887,13 @@ can define them in the file with
 
 @noindent
 In-buffer completion (@pxref{Completion}) can be used after

Re: [O] Using property values in source code blocks

2016-07-06 Thread Joon Ro



> I have no idea what you are asking.
> 
> > The reason is I have to put those values inside a comment, 
> > so I cannot pass them as variables.
> 
> So your original query about accessing property values from src blocks was 
> not what you wanted?
> 
> Examples of what one is trying to do - even if they do not work exactly as 
> intended - are often more helpful than verbal explanations of what one 
> would like to do.
> 
> Chuck
> 

I'm sorry if my explanation was not clear, but the original example I provided 
shows exactly what I wanted to do:
* Subtree:PROPERTIES::DUMMY: VALUE:END:#+BEGIN_SRC{{DUMMY}} <- something like 
this?#+END_SRC
Basically, I want to replace {{DUMMY}} with VALUE, without passing it as a 
variable. So just like <> replacement, but with a property value instead 
of a code block. I get the feeling that this is not possible, but I wanted to 
ask just in case. 
Best,Joon


  

Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)]

2016-07-06 Thread Michael Brand
Hi Rares

On Mon, Jul 4, 2016 at 6:28 PM, Rares Vernica  wrote:

> | [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | d   |
> | [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2 d |
> #+TBLFM: $3=$2

A Calc formula interprets field values as a symbolic expressions to
calculate with. To copy literally one needs a Lisp formula:

| [2016-07-03 Sun]--[2016-07-04 Mon] | 1d | 1d |
| [2016-07-03 Sun]--[2016-07-05 Tue] | 2d | 2d |
#+TBLFM: $3 = '(identity $2)

Michael