Re: [O] Bug: org-copy-visible includes emphasis markerse hidden by org-hide-emphasis-markers [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)]

2017-08-25 Thread Nicolas Goaziou
Hello,

Gary Cheng  writes:

> With evil-mode enabled (bug still applies without using evil, see:
> https://github.com/emacs-evil/evil/issues/907), start Emacs, evaluate (setq
> org-hide-emphasis-markers t).
>
> Open a org file containing the following line:
>
> ~$ firejail --get= ~
>
> which is shown in the visible buffer as:
>
> $ firejail --get= 
>
> Then, visually select via v from the first character "$" to the last
> character ">" of the line. What's copied into the clipboard is (note the
> "~" in the beginning):
>
> ~$ firejail --get= 
>
> instead of:
>
> $ firejail --get= 
>
> Also, copying the entire line with V via org-copy-visible will yield ~$
> firejail --get= ~.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Org protocol, Windows 10

2017-08-25 Thread Fabrice Popineau
Hi,

I am using a recent build of Windows 10 (16251) and  org protocol wasn't
working for me for quite a long time now.
So I decided to look at what went wrong.
I found several annoyances.

The first one is that Windows seems to rewrite itself the url which is sent
to emacsclientw.
Some url sent by Chrome as:

org-protocol://capture?template=c=http%3A%2F%
2Fkitchingroup.cheme.cmu.edu
%2Fblog%2F2014%2F07%2F17%2FPandoc-does-org-mode-now%2F=Pandoc%20does%20org-mode%20now=foobar

is received on emacsclientw command line as:

org-protocol://capture/?template=c=http%3A%2F%
2Fkitchingroup.cheme.cmu.edu
%2Fblog%2F2014%2F07%2F17%2FPandoc-does-org-mode-now%2F=Pandoc%20does%20org-mode%20now=foobar"

notice the capture? changed into capture/?

This is weird and I wonder if I am alone to see this ? I have no idea when
it started to behave this way.

I patched org-protocol.el with this:

diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index d37de1113..ccef9c301 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -649,7 +649,10 @@ to deal with new-style links.")
 (catch 'greedy
   (dolist (var flist)
;; `\' to `/' on windows.  FIXME: could this be done any better?
-(let ((fname  (expand-file-name (car var
+   (setcar var (replace-regexp-in-string
"^\\(org-protocol://[^/\\?]*\\)/\\?" "\\1?" (car var)))
+(let (;; (fname  (expand-file-name (car var)))
+ (fname (car var))
+ )
   (setq fname (org-protocol-check-filename-for-protocol
   fname (member var flist)  client))
   (if (eq fname t) ;; greedy? We need the t return value.


There are 2 other problems related to absolute pathnames under Windows.

You don't want to pass an url to expand-file-name because the current
directory will be prepended to the url, reason why I removed the
expand-file-name call in the patch above.

Finally, there is another place in lisp/server.el where you may not want to
call expand-file-name:

diff --git a/lisp/server.el b/lisp/server.el
index 1ebefe2866..8ce85646e9 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1175,7 +1175,8 @@ server-execute-continuation
(when (and (fboundp
'cygwin-convert-file-name-from-windows)
   (string-match "\\`[A-Za-z]:" file))
  (setq file (cygwin-convert-file-name-from-windows
file)))
-   (setq file (expand-file-name file dir))
+   (unless (string-match "^[^/]+:/" file)
+ (setq file (expand-file-name file dir)))
(push (cons file filepos) files)
(server-log (format "New file: %s %s"
file (or filepos ""))

With these small changes, org-protocol behaves as expected at least with my
configuration.

Curious to hear what you guys think about this ?

Regards,

Fabrice


Re: [O] Date ranges displayed in the agenda

2017-08-25 Thread Nicolas Goaziou
Hello,

Manuel Wiesinger  writes:

> when a headline starts with a date range, in the agenda it is displayed
> as part of the headline . When a headline starts with an normal date,
> the date is not displayed. For is example the following
>
> * <2017-08-23 Wed>--<2017-08-24 Thu> Test range
> * <2017-08-23 Wed> Test date
>
> is displayed like this:
>
> Wednesday  23 August 2017
>   testing:(1/2):  <2017-08-23 Wed>--<2017-08-24 Thu> Test range
>   testing: Test date
> Thursday   24 August 2017
>   testing:(2/2):  <2017-08-23 Wed>--<2017-08-24 Thu> Test range
>
> Personally, to me as rather new user, this feels inconsistent. Is it
> expected behaviour or a bug?

This is the expected default behaviour, although it also surprises me.
See `org-agenda-remove-timeranges-from-blocks'.

Regards,

-- 
Nicolas Goaziou



Re: [O] LaTeX > PDF blocked by extender chars in filename

2017-08-25 Thread Nicolas Goaziou
Hello,

Eduardo Mercovich  writes:

> The file > img/ProcesoDeDiseñoDeInteraccion.pdf
>
> was translated/inserted on the org buffer as > 
> img/ProcesoDeDise%C3%B1oDeInteraccion.pdf

What command did you use to "translate/insert" the filename?
>
> + Org-mode: Org-mode version 8.3.4 (8.3.4-88-g792bb9-elpaplus)

This release is old. Could you update to a more recent one?

Regards,

-- 
Nicolas Goaziou



Re: [O] problem evaluating src block on file opening

2017-08-25 Thread Nicolas Goaziou
Hello,

"Berry, Charles"  writes:

>> On Aug 25, 2017, at 6:01 AM, Eric S Fraga  wrote:
>> 
>> Hello,
>> 
>> Long story short: org-babel-goto-named-src-block does not seem to work,
>> at least since b862c24b9f or thereabouts?  
>> 
>
>
> Confirmed on my setup. 
>
> Here is an ECM. Always goes to the first block.
>
>   
>
>
> #+BEGIN_SRC emacs-lisp
> "gotcha"
> #+END_SRC
>
> #+NAME: startup
> #+BEGIN_SRC emacs-lisp :results value
> 1
> #+END_SRC
>
> #+begin_src emacs-lisp
>   (defun esf/execute-startup-block ()
> (interactive)
> (org-babel-goto-named-src-block "startup")
> (org-babel-execute-src-block))
> #+end_src

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Conditional summing in column-mode?

2017-08-25 Thread Nicolas Goaziou
Stig Brautaset  writes:

> However, I would like to add an advice around =org-columns-compute-all=
> to run the =sb/org-map-confirmed-days= function, and this I have not
> been successful at. I've tried doing this:
>
> : (add-function :before org-columns-compute-all #'sb/org-map-confirmed-days)
>
> However, I keep getting the following error:
>
> : Use of gv-ref probably requires lexical-binding
> : advice--add-function: Symbol’s value as variable is void: 
> org-columns-compute-all
>
> I would appreciate if anyone has any insight into solving this.

Not really your question but since you can define your own summary
function (see `org-columns-summary-types'), just make sure the summary
function first refreshes the new property in headlines below the node
you're currently summarizing.

Regards,



Re: [O] org-protocol: deal with broken links on windows

2017-08-25 Thread Nikolay Kudryavtsev

Hello Ingo.

Sorry my bad, I've ran into exactly the same bug before, just I 
originally didn't notice that "/" before the query is exactly the thing, 
that brings everything down, but I still suspected it to be the same bug.


Your problem is that your bookmarklets have "//" before the protocol 
name. Change it to a single slash and that should work.


--
Best Regards,
Nikolay Kudryavtsev




Re: [O] Conditional summing in column-mode?

2017-08-25 Thread Stig Brautaset

Nicolas Goaziou  writes:

> Hello,
>
> Stig Brautaset  writes:
>
>> I have the following column-mode defined in =~/org/Holidays.org=:
>>
>> #+BEGIN_SRC org
>>   ,#+COLUMNS: %TIMESTAMP(When) %ITEM(What) %CONFIRMED(Confirmed?){X/} 
>> %DAYS(Days){+}
>>   ,#+Confirmed_ALL: "[ ]" "[X]"
>>   ,#+TODO: TODO | DONE CANCELLED
>> #+END_SRC
>>
>> Is it possible to have the =%DAYS(Days){+}= part only sum up rows that
>> have an =[X]= in their =Confirmed?= property?
>
> Not out of the box. But you could write a function creating and updating
> another property, e.g., CHECKED_DAYS and have columns view display this
> instead.

Thank you! That's a great idea. I've managed to come up with the
following, which works interactively:

#+BEGIN_SRC emacs-lisp
  (defun sb/org-calc-confirmed-days ()
"For an entry with both a `CONFIRMED' and `DAYS' property, calculate 
`CONFIRMED_DAYS'"
(let ((days (org-entry-get nil "DAYS"))
  (confirmed (org-entry-get nil "CONFIRMED")))
  (when (and days
 (string= "[X]" confirmed))
(org-entry-put nil "CONFIRMED_DAYS" days

  (defun sb/org-map-confirmed-days ()
"Map over entries and calculate confirmed days"
(interactive)
(org-map-entries #'sb/org-calc-confirmed-days))
#+END_SRC

However, I would like to add an advice around =org-columns-compute-all=
to run the =sb/org-map-confirmed-days= function, and this I have not
been successful at. I've tried doing this:

: (add-function :before org-columns-compute-all #'sb/org-map-confirmed-days)

However, I keep getting the following error:

: Use of gv-ref probably requires lexical-binding
: advice--add-function: Symbol’s value as variable is void: 
org-columns-compute-all

I would appreciate if anyone has any insight into solving this.

Stig

PS: I'm using Emacs and Org both installed from Git, on macOS.



[O] How to call nested bash and gnuplot with babel?

2017-08-25 Thread edgar

Hello, I am trying to run a "nested" babel code with bash and gnuplot.

* Configuration
I did the test like this
#+BEGIN_SRC bash
  emacs -Q
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (require 'package)
  (package-initialize)

  (require 'org)
  ;; Org mode version 9.0.9

  (org-babel-do-load-languages ; babel, for executing
 'org-babel-load-languages   ; code in org-mode.
 '((shell . t)
   (python . t)
   (emacs-lisp . t)
   (org . t)
   (gnuplot . t)))
#+END_SRC

* Original code
#+NAME: bash-tjp-displ-stress
#+HEADER: :var file1="file1.csv"
#+HEADER: :var col1="3"
#+HEADER: :var file2="file2.csv"
#+HEADER: :var col2="7"
#+HEADER: :dir "Data"
#+BEGIN_SRC bash :results value :exports code
  paste "$file1" "$file2" | awk -F',' '/^[^#]/{print $'$col1' $'$col2'}'
#+END_SRC

#+NAME: gplt-tjp-febio-results
#+CAPTION: Gnuplot to plot
#+HEADER: :var data=bash-tjp-displ-stress
#+BEGIN_SRC gnuplot :results graphics :file /tmp/orig-out.png
  set xlabel 'var1'
  set ylabel 'var2'
  plot data u ($1 + 1):2 with lp notitle
#+END_SRC

** Alternative 1: ~:file~ after the function
 The result of this gives me the original output file
 #+CALL: gplt-tjp-febio-results() :file /tmp/test.png

 #+RESULTS:
 [[file:/tmp/orig-out.png]]

** Alternative 2: ~:file~ as a prefix to the function
 The result of this gives me the original output file
 #+CALL: gplt-tjp-febio-results[:file /tmp/test.png]()

 #+RESULTS:
 [[file:/tmp/orig-out.png]]

* Modified code
If I do this, I get the desired output file (add variable ~outfile~
and ~:results none~)

#+NAME: gplt-tjp-febio-results-new
#+CAPTION: Gnuplot to plot
#+HEADER: :var data=bash-tjp-displ-stress
#+HEADER: :var outfile="/tmp/test.png"
#+BEGIN_SRC gnuplot :results graphics
  set output outfile
  set xlabel 'var1'
  set ylabel 'var2'
  plot data u ($1 + 1):2 with lp notitle
#+END_SRC

#+CALL: gplt-tjp-febio-results-new[:results 
none](outfile="/tmp/new_out.png")


I type this manually:
[[/tmp/new_out.png]]

* What I expected
To call
#+BEGIN_EXAMPLE
  ,#+CALL: gplt-tjp-febio-results() :file /tmp/new_out.png
#+END_EXAMPLE

and get
#+BEGIN_EXAMPLE
  ,#+RESULTS:
  [[file:/tmp/orig-out.png]]
#+END_EXAMPLE

How do I achieve this?

* Thanks
Thank you! :D

-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Re: [O] problem evaluating src block on file opening

2017-08-25 Thread Berry, Charles

> On Aug 25, 2017, at 6:01 AM, Eric S Fraga  wrote:
> 
> Hello,
> 
> Long story short: org-babel-goto-named-src-block does not seem to work,
> at least since b862c24b9f or thereabouts?  
> 


Confirmed on my setup. 

Here is an ECM. Always goes to the first block.


--8<---cut here---start->8---

#+BEGIN_SRC emacs-lisp
"gotcha"
#+END_SRC

#+NAME: startup
#+BEGIN_SRC emacs-lisp :results value
1
#+END_SRC

#+begin_src emacs-lisp
  (defun esf/execute-startup-block ()
(interactive)
(org-babel-goto-named-src-block "startup")
(org-babel-execute-src-block))
#+end_src 
--8<---cut here---end--->8---


Chuck





Re: [O] Org-lint complains about valid footnote?

2017-08-25 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> In tracking down another problem with the latest version of org (more to
> follow probably), I thought using org-lint might help.  With the
> attached simple example, I get:
>
>  5 high  Missing definition for footnote [1]
>
> from org-lint.
>
> The footnote definition is there as it's inline...

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Org-lint complains about valid footnote?

2017-08-25 Thread Eric S Fraga
In tracking down another problem with the latest version of org (more to
follow probably), I thought using org-lint might help.  With the
attached simple example, I get:

 5 high  Missing definition for footnote [1]

from org-lint.

The footnote definition is there as it's inline...

-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-796-gbae41a
#+TITLE: examplebug.org
#+AUTHOR:Eric S Fraga

* Link to maxima
We can use Maxima to solve our equations.[fn:1: http://maxima.sourceforge.net/]
#+index: modelling!tools


signature.asc
Description: PGP signature


[O] problem evaluating src block on file opening

2017-08-25 Thread Eric S Fraga
Hello,

Long story short: org-babel-goto-named-src-block does not seem to work,
at least since b862c24b9f or thereabouts?  

If I evaluate this command interactively, it sends me to a #+begin_quote
line in my file!

Org up to date.  I haven't tried a minimal example yet but will do so if
this doesn't ring any bells!  I noticed the failure because I upgraded
org which I had not done in a while and my startup babel blocks no
longer work; these are blocks that are evaluated when I visit an org
file via the following code:

#+begin_src emacs-lisp
  (defun esf/execute-startup-block ()
(interactive)
(org-babel-goto-named-src-block "startup")
(org-babel-execute-src-block))
#+end_src 

The evaluation of org-babel-execute-src-block fails because the previous
line did not place point at a src block!  The error returned by the last
line is very strange as well:

,
| Debugger entered--Lisp error: (wrong-type-argument consp nil)
|   org-babel-execute-src-block()
|   esf/execute-startup-block()
|   eval((esf/execute-startup-block))
|   hack-one-local-variable(eval (esf/execute-startup-block))
|   hack-local-variables-apply()
|   hack-local-variables(no-mode)
|   run-mode-hooks(org-mode-hook)
|   org-mode()
`

Thanks,
eric

-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-796-gbae41a


signature.asc
Description: PGP signature


Re: [O] migrating to the snapshot api

2017-08-25 Thread Nicolas Goaziou
Hello,

Sam Halliday  writes:

> Apologies for bumping this, I was wondering if anybody had any more
> thoughts on migrating this backend to the latest version of org-mode?
> Seems to be something changed that isn't in the migration notes...

Line 78, you reversed the order of the arguments passed to
`org-export-collect-footnote-definitions'.

Simply remove (plist-get info :parse-tree), since it is the default
value anyway.

Regards,

-- 
Nicolas Goaziou



Re: [O] migrating to the snapshot api

2017-08-25 Thread Sam Halliday
Apologies for bumping this, I was wondering if anybody had any more
thoughts on migrating this backend to the latest version of org-mode?
Seems to be something changed that isn't in the migration notes...

On 21 August 2017 at 19:21, Sam Halliday  wrote:
> Hi all,
>
> I maintain a fork of an org-mode backend for a markdown based
> publishing format
> https://github.com/fommil/dotfiles/blob/master/.emacs.d/lisp/ox-leanpub.el
>
> Which works great for the org-mode that ships with emacs 25.2.
>
> However, when I use the latest org-mode from the snapshots on even the
> most simple of files, e.g. the one line
>
> ==
> Wibble wibble I'm a fish
> ==
>
> I get a stacktrace like this (huge amount of data elided)
>
> ==
> Debugger entered--Lisp error: (wrong-type-argument sequencep :back-end)
>   mapc(#[
>   mapc(#[
>   org-element-map(
>   org-export--footnote-reference-map(
>   org-export-collect-footnote-definitions(
>   org-leanpub-inner-template(
>   org-export-as(leanpub nil nil nil nil)
>   org-export-to-buffer(leanpub "*Org LEANPUB Export*" nil nil nil nil
> nil (lambda nil (text-mode)))
>   org-leanpub-export-as-markdown()
>   funcall-interactively(org-leanpub-export-as-markdown)
>   call-interactively(org-leanpub-export-as-markdown record nil)
>   command-execute(org-leanpub-export-as-markdown record)
>   execute-extended-command(nil "org-leanpub-export-as-markdown" nil)
>   funcall-interactively(execute-extended-command nil
> "org-leanpub-export-as-markdown" nil)
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
> ==
>
> From reading http://orgmode.org/Changes.html#org1e55804 I can see that
> I am supposed to remove the :export-block, which I have done locally.
>
> Can anybody see what else I need to change to be compatible with the
> latest version?
>
> Best regards,
> Sam



Re: [O] Conditional summing in column-mode?

2017-08-25 Thread Nicolas Goaziou
Hello,

Stig Brautaset  writes:

> I have the following column-mode defined in =~/org/Holidays.org=:
>
> #+BEGIN_SRC org
>   ,#+COLUMNS: %TIMESTAMP(When) %ITEM(What) %CONFIRMED(Confirmed?){X/} 
> %DAYS(Days){+}
>   ,#+Confirmed_ALL: "[ ]" "[X]"
>   ,#+TODO: TODO | DONE CANCELLED
> #+END_SRC
>
> Is it possible to have the =%DAYS(Days){+}= part only sum up rows that
> have an =[X]= in their =Confirmed?= property?

Not out of the box. But you could write a function creating and updating
another property, e.g., CHECKED_DAYS and have columns view display this
instead.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug in the sorting of clocktables with ":sort (4 . ?T)" for clock sums over "100:00" hours

2017-08-25 Thread Rainer Stengele

Am 25.08.2017 um 00:07 schrieb Nicolas Goaziou:

Hello,

Rainer Stengele  writes:


I may have found a bug in the sorting of clocktables.
I am summing up clocked time over time periods.


[...]


As soon as the sum grows higher than 100:00 sorting is corrupted:

#+BEGIN: clocktable :maxlevel 1 :properties ("CATEGORY") :fileskip0 t :scope 
agenda-with-archives :tstart "<2017-01-01 So 00:00>" :tend
"<2017-01-23 Mo 00:00>" :sort (4 . ?T)

#+CAPTION: Clock summary at [2017-08-24 Do 16:14]
| File  | CATEGORY| Headline | Time |

|---+-+--+--|
|   | ALL | *Total time* | *104:45* |
|---+-+--+--|
|   | annonymised | annonymised  |28:00 |
|   | annonymised | annonymised  |18:45 |
|   | annonymised | annonymised  |10:45 |
|   | annonymised | annonymised  | 8:00 |
|   | annonymised | annonymised  | 8:00 |
|   | annonymised | annonymised  | 7:15 |
| Projectmanagement.org | | *File time*  | *104:00* |
|   | annonymised | annonymised  | 4:00 |
|   | annonymised | annonymised  | 3:45 |
|   | annonymised | annonymised  | 2:00 |
|   | annonymised | annonymised  | 2:00 |
|   | annonymised | annonymised  | 1:45 |
|   | annonymised | annonymised  | 1:45 |
|   | annonymised | annonymised  | 1:15 |
|   | annonymised | annonymised  | 0:45 |
|   | annonymised | annonymised  | 0:45 |
|   | annonymised | annonymised  | 0:30 |
|   | annonymised | annonymised  | 0:30 |
|   | annonymised | annonymised  | 0:30 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|   | annonymised | annonymised  | 0:15 |
|---+-+--+--|
| FILE2.org | | *File time*  |   *0:45* |
|   | annonymised | annonymised  | 0:45 |
#+END:


Fixed. Thank you.

Regards,



Works, thanks very much!

Regards,
Rainer