Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Kyle Meyer
Kyle Meyer  writes:

> Nicolas Goaziou  writes:
>
>> The we may not need `call-interactively' at all. 
>>
>> WDYT?
>
> Yeah, I agree that there's no need for call-interactively here because
> the interactive forms of org-table-sort-lines, org-sort-list,
> org-sort-entries are covered by org-sort's.
>
> Switched call-interactively to funcall in c1addc825.

Ehh, I should have looked more closely at org-table-sort-lines.  Unlike
org-sort-entries and org-sort-list, it uses called-interactively-p to
determine whether it should prompt the user.  I've put the
org-call-with-arg back, at least for now.

-- 
Kyle



[O] A small patch for org.el to fix error in clojure babel src block code ref

2017-05-08 Thread numbch...@gmail.com
Here is the original discussion we disscusses.
https://github.com/jkitchin/org-ref/issues/433

And Here is the patch:

#+BEGIN_SRC diff
modified   lisp/org.el
@@ -9730,7 +9730,7 @@ active region."
  (setq sfuns
(delq
 nil (mapcar (lambda (f)
-  (let (fs) (if (funcall f) (push f fs
+  (let (fs) (if (and (stringp f) (funcall f)) (push f fs
  (org-store-link-functions)))
sfunsn (mapcar (lambda (fu) (symbol-name (car fu))) sfuns))
  (or (and (cdr sfuns)
#+END_SRC

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


Re: [O] Function to return content of item

2017-05-08 Thread Richard Parsons
That is very kind of you - many thanks indeed for your assistance.


On Mon, May 8, 2017 at 4:05 PM, John Kitchin 
wrote:

> I think this is basically what you are looking for.
>
> (defun org-heading-content ()
>   (interactive)
>   (let (bp ep)
> (setq bp (save-excursion
>(or (and (outline-previous-heading)
> (progn (org-end-of-meta-data)
>(point)))
>(point-min)))
>   ep (save-excursion
>(or (and (outline-next-heading) (point))
>(point-max
> (buffer-substring-no-properties bp ep)))
>
> Richard Parsons writes:
>
> > John, many thanks for your reply.
> >
> > Regarding subheadings, I would only want the content of the current
> > sub-item, so if it is a subheading I only want the text from after the
> > subheading (and after its property drawer) up to the next heading (or the
> > end of the file).
> >
> > Also, when I run your code on a paragraph, I just get the contents from
> > that paragraph (rather than all paragraphs in that item). Maybe "item" is
> > the wrong work, is "node" better?
> >
> > Maybe I need to write some code using the org motion commands in order to
> > manually identify the region that I'm looking for.
> >
> > Many thanks
> > Richard
> >
> >
> > On Mon, May 8, 2017 at 1:45 AM, John Kitchin 
> > wrote:
> >
> >> I don't know of a function. Something like this may be what you want.
> >> not all elements have :contents-begin though
> >>
> >> (let ((el (org-element-context)))
> >>  (buffer-substring-no-properties
> >>  (org-element-property :contents-begin el)
> >>  (org-element-property :contents-end el)))
> >>
> >>
> >> It also a little tricky to figure out what to do about subheadings. Do
> >> they count as content or not?
> >>
> >> Richard Parsons writes:
> >>
> >> > Hi there
> >> >
> >> > Is there a function that will give me the content of the current
> item? I
> >> > mean simply the text of the whole item without its heading or
> properties
> >> > drawer.
> >> >
> >> > It seems to me likely that such a function would exist, but I haven't
> >> been
> >> > able to find it in the documentation.
> >> >
> >> > Many thanks
> >> > Richard
> >>
> >>
> >> --
> >> 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
> >>
>
>
> --
> 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
>



-- 
Richard Parsons

Email:  richard.lee.pars...@googlemail.com


Re: [O] [RFC] The "c" Org macro

2017-05-08 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> On Monday,  8 May 2017 at 15:32, Dushyant Juneja wrote:
>> A very useful macro indeed!
>>
>> One suggestion: can this also be made to support nested headings. For 
>> instance:
>> * Part {{{c}}}
>> ** Part {{{c}}}.{{{c}}}
>> * Part {{{c}}}
>
> I think this is what separate counters will enable but also motivates
> need to be able to reset a counter (e.g. the sub-heading one in above
> example if it were to be used in the second part).

Good idea.

Here is an updated patch, in which one can write

  {{{c(sub,reset)}}}
  {{{c(sub, 5)}}}

or even, for the default macro

 {{{c(,reset)}}}
 {{{c(, 99)}}}

I find the manual entry a bit awkward. Suggestions welcome.

Regards,

-- 
Nicolas Goaziou
>From 31397ffa1b0bf9795e2bc11568598af13db6c609 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Mon, 8 May 2017 12:38:38 +0200
Subject: [PATCH] org-macro: Implement the "c" macro

* lisp/org-macro.el (org-macro--counter-table): New variable.
(org-macro--counter-initialize):
(org-macro--counter-increment): New functions.
(org-macro-initialize-templates): Use new functions.

* doc/org.texi (Macro replacement): Document new macro.
---
 doc/org.texi  | 10 ++
 lisp/org-macro.el | 38 +++---
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 312870f91..6072fcb78 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10852,6 +10852,16 @@ This macro refers to the filename of the exported file, if any.
 This macro returns the value of property @var{PROPERTY-NAME} in current
 entry.  If @var{SEARCH-OPTION} (@pxref{Search options}) refers to a remote
 entry, it will be used instead.
+
+@item @{@{@{c@}@}@}
+@itemx @{@{@{c(@var{NAME})@}@}@}
+@itemx @{@{@{c(@var{NAME},@var{RESET})@}@}@}
+@cindex c, macro
+@cindex counter, macro
+This macro returns the number of occurrences of this macro expanded so far.
+You can use more than one counter using different @var{NAME} values.  If
+@var{RESET} is non-empty, the specified counter is reset to the value
+specified if it is a number, or 1 otherwise.
 @end table
 
 The surrounding brackets can be made invisible by setting
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 71e917b71..afd302932 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -36,8 +36,11 @@
 
 ;; Along with macros defined through #+MACRO: keyword, default
 ;; templates include the following hard-coded macros:
-;; {{{time(format-string)}}}, {{{property(node-property)}}},
-;; {{{input-file}}} and {{{modification-time(format-string)}}}.
+;;   {{{time(format-string)}}},
+;;   {{{property(node-property)}}},
+;;   {{{input-file}}},
+;;   {{{modification-time(format-string)}}},
+;;   {{{c(counter,reset}}}.
 
 ;; Upon exporting, "ox.el" will also provide {{{author}}}, {{{date}}},
 ;; {{{email}}} and {{{title}}} macros.
@@ -129,7 +132,7 @@ function installs the following ones: \"property\",
 	(let ((old-template (assoc (car cell) templates)))
 	  (if old-template (setcdr old-template (cdr cell))
 		(push cell templates))
-;; Install hard-coded macros.
+;; Install "property", "time" macros.
 (mapc update-templates
 	  (list (cons "property"
 		  "(eval (save-excursion
@@ -143,6 +146,7 @@ function installs the following ones: \"property\",
   l)
 (org-entry-get nil \"$1\" 'selective)))")
 		(cons "time" "(eval (format-time-string \"$1\"))")))
+;; Install "input-file", "modification-time" macros.
 (let ((visited-file (buffer-file-name (buffer-base-buffer
   (when (and visited-file (file-exists-p visited-file))
 	(mapc update-templates
@@ -152,6 +156,10 @@ function installs the following ones: \"property\",
   (prin1-to-string visited-file)
   (prin1-to-string
    (nth 5 (file-attributes visited-file)
+;; Initialize and install "c" macro.
+(org-macro--counter-initialize)
+(funcall update-templates
+	 (cons "c" "(eval (org-macro--counter-increment \"$1\" \"$2\"))"))
 (setq org-macro-templates templates)))
 
 (defun org-macro-expand (macro templates)
@@ -280,6 +288,9 @@ Return a list of arguments, as strings.  This is the opposite of
 s nil t)
"\000"))
 
+
+;;; Helper functions and variables for internal macros
+
 (defun org-macro--vc-modified-time (file)
   (save-window-excursion
 (when (vc-backend file)
@@ -304,6 +315,27 @@ Return a list of arguments, as strings.  This is the opposite of
 	  (kill-buffer buf))
 	date
 
+(defvar org-macro--counter-table nil
+  "Hash table containing counter value per name.")
+
+(defun org-macro--counter-initialize ()
+  "Initialize `org-macro--counter-table'."
+  (setq org-macro--counter-table (make-hash-table :test #'equal)))
+
+(defun org-macro--counter-increment (name  reset)
+  "Increment counter NAME.
+NAME is a string identifying the counter.  If optional argument
+RESET is a non-empty string, 

Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Nicolas Goaziou
Kyle Meyer  writes:

> Nicolas Goaziou  writes:
>
>> I think the patch can also go into maint branch, since this is a fix.
>
> It's more of a cosmetic change, no?  (The one "fix" would be that
> org-sort documents WITH-CASE as optional even though it was actually a
> required argument.)

You're right. It doesn't really matter then.

Regards,



Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Kyle Meyer
Nicolas Goaziou  writes:

> I think the patch can also go into maint branch, since this is a fix.

It's more of a cosmetic change, no?  (The one "fix" would be that
org-sort documents WITH-CASE as optional even though it was actually a
required argument.)

Anyway, I'll cherry pick it over the next time I touch maint.

> Now, we still need to find interactive use of `org-sort-list', which
> should ask appropriate questions for getkey-func and compare-func.

Sure, I'll send a patch proposing changes (though it may be a day or two
before I get around to it).

-- 
Kyle



Re: [O] [RFC] The "c" Org macro

2017-05-08 Thread Robert Horn

Eric S Fraga writes:

> On Monday,  8 May 2017 at 11:26, Nicolas Goaziou wrote:
>> Hello,
>>
>> I would like to scratch a long-standing itch and introduce the "c"
>> macro, which is basically a way to handle multiple counters in an Org
>> document. So, the following document
>
> This sounds like a very useful macro to have.  Some suggestions:
>
> 1. I would prefer the argument to be called "COUNTER" instead of "SEED"
> as the latter is more commonly associated with random number
> generators.  This would make the documentation clearer potentially.
Yes.  I was confused by this initially.
>
> 2. I wonder if a second argument could be optionally available to allow
> the counter to start at an arbitrary number and/or be reset?
>
'm frequently preparing documents that update something with lists.
Being able to start at a specific value makes that much more useful.

R Horn



Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Nicolas Goaziou
Hello,

Kyle Meyer  writes:

> Yeah, I agree that there's no need for call-interactively here because
> the interactive forms of org-table-sort-lines, org-sort-list,
> org-sort-entries are covered by org-sort's.
>
> Switched call-interactively to funcall in c1addc825.

Thank you. 

I think the patch can also go into maint branch, since this is a fix.

Now, we still need to find interactive use of `org-sort-list', which
should ask appropriate questions for getkey-func and compare-func.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] [RFC] The "c" Org macro

2017-05-08 Thread Eric S Fraga
On Monday,  8 May 2017 at 15:32, Dushyant Juneja wrote:
> A very useful macro indeed!
>
> One suggestion: can this also be made to support nested headings. For 
> instance:
> * Part {{{c}}}
> ** Part {{{c}}}.{{{c}}}
> * Part {{{c}}}

I think this is what separate counters will enable but also motivates
need to be able to reset a counter (e.g. the sub-heading one in above
example if it were to be used in the second part).

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-425-gf4fca1


signature.asc
Description: PGP signature


Re: [O] [RFC] The "c" Org macro

2017-05-08 Thread Dushyant Juneja
A very useful macro indeed!

One suggestion: can this also be made to support nested headings. For
instance:
* Part {{{c}}}
** Part {{{c}}}.{{{c}}}
* Part {{{c}}}

should export to:

* Part 1
** Part 1.1
* Part 2

I reckon this will be very useful when a paragraphs need to be broken into
several subheadings for clarity/context management.

Dushyant


On Mon, May 8, 2017 at 10:01 AM Eric S Fraga  wrote:

> On Monday,  8 May 2017 at 11:26, Nicolas Goaziou wrote:
> > Hello,
> >
> > I would like to scratch a long-standing itch and introduce the "c"
> > macro, which is basically a way to handle multiple counters in an Org
> > document. So, the following document
>
> This sounds like a very useful macro to have.  Some suggestions:
>
> 1. I would prefer the argument to be called "COUNTER" instead of "SEED"
> as the latter is more commonly associated with random number
> generators.  This would make the documentation clearer potentially.
>
> 2. I wonder if a second argument could be optionally available to allow
> the counter to start at an arbitrary number and/or be reset?
>
> I would definitely be using the macro for, as an example, in preparing
> exams and courseworks where I often have to manually put the numbers in.
>
> thanks,
> eric
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3
>


Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Kyle Meyer
Nicolas Goaziou  writes:

> The we may not need `call-interactively' at all. 
>
> WDYT?

Yeah, I agree that there's no need for call-interactively here because
the interactive forms of org-table-sort-lines, org-sort-list,
org-sort-entries are covered by org-sort's.

Switched call-interactively to funcall in c1addc825.

-- 
Kyle



Re: [O] Function to return content of item

2017-05-08 Thread John Kitchin
I think this is basically what you are looking for.

(defun org-heading-content ()
  (interactive)
  (let (bp ep)
(setq bp (save-excursion
   (or (and (outline-previous-heading)
(progn (org-end-of-meta-data)
   (point)))
   (point-min)))
  ep (save-excursion
   (or (and (outline-next-heading) (point))
   (point-max
(buffer-substring-no-properties bp ep)))

Richard Parsons writes:

> John, many thanks for your reply.
>
> Regarding subheadings, I would only want the content of the current
> sub-item, so if it is a subheading I only want the text from after the
> subheading (and after its property drawer) up to the next heading (or the
> end of the file).
>
> Also, when I run your code on a paragraph, I just get the contents from
> that paragraph (rather than all paragraphs in that item). Maybe "item" is
> the wrong work, is "node" better?
>
> Maybe I need to write some code using the org motion commands in order to
> manually identify the region that I'm looking for.
>
> Many thanks
> Richard
>
>
> On Mon, May 8, 2017 at 1:45 AM, John Kitchin 
> wrote:
>
>> I don't know of a function. Something like this may be what you want.
>> not all elements have :contents-begin though
>>
>> (let ((el (org-element-context)))
>>  (buffer-substring-no-properties
>>  (org-element-property :contents-begin el)
>>  (org-element-property :contents-end el)))
>>
>>
>> It also a little tricky to figure out what to do about subheadings. Do
>> they count as content or not?
>>
>> Richard Parsons writes:
>>
>> > Hi there
>> >
>> > Is there a function that will give me the content of the current item? I
>> > mean simply the text of the whole item without its heading or properties
>> > drawer.
>> >
>> > It seems to me likely that such a function would exist, but I haven't
>> been
>> > able to find it in the documentation.
>> >
>> > Many thanks
>> > Richard
>>
>>
>> --
>> 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
>>


--
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] [RFC] The "c" Org macro

2017-05-08 Thread Eric S Fraga
On Monday,  8 May 2017 at 11:26, Nicolas Goaziou wrote:
> Hello,
>
> I would like to scratch a long-standing itch and introduce the "c"
> macro, which is basically a way to handle multiple counters in an Org
> document. So, the following document

This sounds like a very useful macro to have.  Some suggestions:

1. I would prefer the argument to be called "COUNTER" instead of "SEED"
as the latter is more commonly associated with random number
generators.  This would make the documentation clearer potentially.

2. I wonder if a second argument could be optionally available to allow
the counter to start at an arbitrary number and/or be reset?

I would definitely be using the macro for, as an example, in preparing
exams and courseworks where I often have to manually put the numbers in.

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3


signature.asc
Description: PGP signature


[O] [RFC] The "c" Org macro

2017-05-08 Thread Nicolas Goaziou
Hello,

I would like to scratch a long-standing itch and introduce the "c"
macro, which is basically a way to handle multiple counters in an Org
document. So, the following document

  * Part {{{c}}}
  * Part {{{c}}}
  * Part {{{c(other)}}}
  * Part {{{c}}}
  * Part {{{c(other)}}}

is expanded as

  * Part 1
  * Part 2
  * Part 1
  * Part 3
  * Part 2

Initially, I wanted to name it "#", but macro names must start with
[a-zA-Z]. I also wanted something short, hence the "c". It could also be
"n". Feel free to suggest something better.

Anyway, I attach an implementation for the feature along with
a documentation update. If the feature is to be included in Org, I'll
also write tests and an ORG-NEWS entry.

Feedback welcome.

Regards,

-- 
Nicolas Goaziou0x80A93738
>From 581a66bbf3c808e906d275c3411f640428552c39 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Mon, 8 May 2017 12:38:38 +0200
Subject: [PATCH] org-macro: Implement the "c" macro

* lisp/org-macro.el (org-macro--counter-table): New variable.
(org-macro--counter-initialize):
(org-macro--counter-increment): New functions.
(org-macro-initialize-templates): Use new functions.

* doc/org.texi (Macro replacement): Document new macro.
---
 doc/org.texi  |  7 +++
 lisp/org-macro.el | 31 ---
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 312870f91..20a9e0948 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10852,6 +10852,13 @@ This macro refers to the filename of the exported file, if any.
 This macro returns the value of property @var{PROPERTY-NAME} in current
 entry.  If @var{SEARCH-OPTION} (@pxref{Search options}) refers to a remote
 entry, it will be used instead.
+
+@item @{@{@{c@}@}@}
+@itemx @{@{@{c(@var{SEED})@}@}@}
+@cindex c, macro
+@cindex counter, macro
+This macro returns the number of occurrences of this macro expanded so far.
+Each @var{SEED} is associated to a dedicated counter.
 @end table
 
 The surrounding brackets can be made invisible by setting
diff --git a/lisp/org-macro.el b/lisp/org-macro.el
index 71e917b71..d11b0dbe5 100644
--- a/lisp/org-macro.el
+++ b/lisp/org-macro.el
@@ -36,8 +36,11 @@
 
 ;; Along with macros defined through #+MACRO: keyword, default
 ;; templates include the following hard-coded macros:
-;; {{{time(format-string)}}}, {{{property(node-property)}}},
-;; {{{input-file}}} and {{{modification-time(format-string)}}}.
+;;   {{{time(format-string)}}},
+;;   {{{property(node-property)}}},
+;;   {{{input-file}}},
+;;   {{{modification-time(format-string)}}},
+;;   {{{c(seed}}}.
 
 ;; Upon exporting, "ox.el" will also provide {{{author}}}, {{{date}}},
 ;; {{{email}}} and {{{title}}} macros.
@@ -129,7 +132,7 @@ function installs the following ones: \"property\",
 	(let ((old-template (assoc (car cell) templates)))
 	  (if old-template (setcdr old-template (cdr cell))
 		(push cell templates))
-;; Install hard-coded macros.
+;; Install "property", "time" macros.
 (mapc update-templates
 	  (list (cons "property"
 		  "(eval (save-excursion
@@ -143,6 +146,7 @@ function installs the following ones: \"property\",
   l)
 (org-entry-get nil \"$1\" 'selective)))")
 		(cons "time" "(eval (format-time-string \"$1\"))")))
+;; Install "input-file", "modification-time" macros.
 (let ((visited-file (buffer-file-name (buffer-base-buffer
   (when (and visited-file (file-exists-p visited-file))
 	(mapc update-templates
@@ -152,6 +156,10 @@ function installs the following ones: \"property\",
   (prin1-to-string visited-file)
   (prin1-to-string
    (nth 5 (file-attributes visited-file)
+;; Initialize and install "c" macro.
+(org-macro--counter-initialize)
+(funcall update-templates
+	 (cons "c" "(eval (org-macro--counter-increment \"$1\"))"))
 (setq org-macro-templates templates)))
 
 (defun org-macro-expand (macro templates)
@@ -280,6 +288,9 @@ Return a list of arguments, as strings.  This is the opposite of
 s nil t)
"\000"))
 
+
+;;; Helper functions and variables for internal macros
+
 (defun org-macro--vc-modified-time (file)
   (save-window-excursion
 (when (vc-backend file)
@@ -304,6 +315,20 @@ Return a list of arguments, as strings.  This is the opposite of
 	  (kill-buffer buf))
 	date
 
+(defvar org-macro--counter-table nil
+  "Hash table containing counter value per seed.")
+
+(defun org-macro--counter-initialize ()
+  "Initialize `org-macro--counter-table'."
+  (setq org-macro--counter-table (make-hash-table :test #'equal)))
+
+(defun org-macro--counter-increment (seed)
+  "Increment counter with SEED."
+  (let ((value (gethash seed org-macro--counter-table)))
+(puthash seed
+	 (if (null value) 1 (1+ value))
+	 org-macro--counter-table)))
+
 
 (provide 'org-macro)
 ;;; org-macro.el ends here
-- 
2.12.2



Re: [O] change in babel argument processing?

2017-05-08 Thread Eric S Fraga
On Monday,  8 May 2017 at 09:27, Nicolas Goaziou wrote:
> It is an unexpected consequence of
> 500abcd7fbe24abc887300faec2058905a13fa33 in which I lazily use `read' to
> parse string values.
>
> I fixed it in maint, could you confirm it?

Yes, works fine now (in master which I assume includes updates to
maint).  Many thanks.

Interestingly, keeping \\n also works so at least I don't have to
immediately undo all the changes I made to my tax files... :-)

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3


signature.asc
Description: PGP signature


Re: [O] Invalid read syntax: "?" when switching org-dates or when tying to org-submit-bug-report

2017-05-08 Thread michael . ziems
Hello Nicolas, 

that worked perfectly. 

I had a strange character in that file and now it works good. 

Thanks, 

Michael

Am 2017-05-08 11:52, schrieb Nicolas Goaziou:

> michael.zi...@xiron.de writes:
> 
>> When i byte-compile the file i get the following error: 
>> 
>> Compiling file
>> c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el at
>> Mon May  8 11:27:30 2017
>> org-clock.el:1949:1:Error: Invalid read syntax: "?"
> 
> It looks odd. Could you double-check the modification you made? It
> should be made of the following characters: 
> 
> ? \ ·
> 
> without space between them.
> 
> Regards,

Re: [O] 9.0.6 and clock tables

2017-05-08 Thread Roland Everaert
I just see this.

Since this morning my clocktable doesn't fill a column related to a
property, any known issue and workaround/fix for this?


Regards,

On Mon, May 8, 2017 at 10:37 AM, Eric S Fraga  wrote:

> On Sunday,  7 May 2017 at 10:16, Nicolas Goaziou wrote:
> > Would you happen to have any news on it?
>
> Had no time but ...
>
> > BTW, you may need to remove any TBLFM: entry related to % since this is
> > no longer necessary when using :formula %.
>
> ... removing the existing TBLFM line fixes the problem!  Many thanks!
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3
>


Re: [O] Bug: org-babel-expand-src-block expands sh blocks independent of shell defined by src block [9.0.5 (9.0.5-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20170210/)]

2017-05-08 Thread Nicolas Goaziou
Hello,

Derek Feichtinger  writes:

> When using =org-babel-expand-src-block= with a shell src block one 
> always gets the same code expansion (in my case bash) independent of the 
> shell that is used while the execution of the shell block uses the 
> correct expansion.
>
>
> I define the following table to illustrate the problem:
>
> #+NAME: tbltest
> | col1 | col2 | col3 |
>
> |   11 |   12 |   13 |
> |   21 |   22 |   23 |
> |   31 |   32 |   33 |
>
> Now for the example source block where I read in the table
>
> #+BEGIN_SRC sh :results value  :exports both :var tbl=tbltest :colnames yes
>echo $tbl
> #+END_SRC
>
>
> When expanding the sh source block above with 
> =org-babel-expand-src-block= it is wrongly expanded to the
> bash expansion and not to the sh expansion that is used when the block 
> is executed. So, instead of the
> sh expansion,
>
>   tbl='111213
>   212223
>   313233'
>
>
> I see the following bash related expansion in the opened buffer:
>
> #+BEGIN_EXAMPLE
> unset tbl
> declare -A tbl
> tbl['11']='12
> 13'
> tbl['21']='22
> 23'
> tbl['31']='32
> 33'
> echo $tbl
> #+END_EXAMPLE
>
>
> Reason:
>
> The case distinction in =org-babel-variable-assignments:shell= is
> made based on the shell-file-name which is a standard emacs
> variable set by emacs in C code. This is pointing to "/bin/bash"
> for my installation.
>
> #+BEGIN_SRC elisp :exports source
> (defun org-babel-variable-assignments:shell (params)
>  "Return list of shell statements assigning the block's variables."
>  (let ((sep (cdr (assq :separator params)))
>(hline (when (string= "yes" (cdr (assq :hlines params)))
> (or (cdr (assq :hline-string params))
> "hline"
>(mapcar
> (lambda (pair)
>   (if (string-suffix-p "bash" shell-file-name)
>   (org-babel--variable-assignments:bash
>(car pair) (cdr pair) sep hline)
> (org-babel--variable-assignments:sh-generic
>  (car pair) (cdr pair) sep hline)))
> (org-babel--get-vars params
> #+END_SRC
>
>
> Looking at the calls stack for the case where we execute the source 
> block and where we just expand it, we see
> the following call stack for execution
>
> #+BEGIN_EXAMPLE
>  org-babel-variable-assignments:shell
>  org-babel-execute:shell
>  org-babel-execute:sh
>  org-babel-execute-src-block
> #+END_EXAMPLE
>
>
> while in the case of just expanding the source block we have
>
> #+BEGIN_EXAMPLE
> org-babel-variable-assignments:sh
> org-babel-expand-src-block
> #+END_EXAMPLE
>
>
> Note that =org-babel-variable-assignments:sh= is an alias for
> =org-babel-variable-assignments:shell=.
>
> A bit of investigation shows that for all shell languages there
> are aliases defined that finally call
> =org-babel-execute:shell=. This is set up in the
> =org-babel-shell-initialize= function. And it is set up in a way
> that =shell-file-name= is overridden by the name of the
> particular shell, and this then leads to the correct case
> distinction using =shell-file-name= in
> =org-babel-variable-assignments:shell=.
>
> #+BEGIN_SRC elisp :exports source
> (defun org-babel-shell-initialize ()
>  "Define execution functions associated to shell names.
> This function has to be called whenever `org-babel-shell-names'
> is modified outside the Customize interface."
>  (interactive)
>  (dolist (name org-babel-shell-names)
>(eval `(defun ,(intern (concat "org-babel-execute:" name))
>   (body params)
> ,(format "Execute a block of %s commands with Babel." name)
> (let ((shell-file-name ,name))
>   (org-babel-execute:shell body params
>(eval `(defalias ',(intern (concat 
> "org-babel-variable-assignments:" name))
> 'org-babel-variable-assignments:shell
> ,(format "Return list of %s statements assigning to the block's \
> variables."
>  name)
> #+END_SRC
>
> The same kind of overriding would have to be in place when
> =org-babel-expand-src-block= calls
> =org-babel-variable-assignments:shell= in the simple code expansion 
> case. But that
> would be a bit hacky since the generic =org-babel-expand-src-block= 
> function should
> not override variables needed in just one subclass of backends. It would be
> cleaner to have different functions =org-babel-variable-assignments:XXX= 
> for the
> different shells.

Thank you for the report.

Since you went pretty far already into the analysis, would you want to
provide a patch implementing your suggestion, i.e., have different
functions =org-babel-variable-assignments:XXX= for the different shells?

Regards,

-- 
Nicolas Goaziou



Re: [O] Invalid read syntax: "?" when switching org-dates or when tying to org-submit-bug-report

2017-05-08 Thread Nicolas Goaziou
michael.zi...@xiron.de writes:

> When i byte-compile the file i get the following error: 
>
> Compiling file
> c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el at
> Mon May  8 11:27:30 2017
> org-clock.el:1949:1:Error: Invalid read syntax: "?"

It looks odd. Could you double-check the modification you made? It
should be made of the following characters: 

  ? \ ·

without space between them.

Regards,



Re: [O] About org-sort -> org-sort-list with custom sort function

2017-05-08 Thread Nicolas Goaziou
Hello,

Kyle Meyer  writes:

>   * the byte-compiler doesn't warn about WITH-CASE being unused. (I
> think marking it with an underscore would be confusing because it is
> "used".)

WITH-CASE should be optional. It conforms to (interactive "P")
expectations.

>   * WITH-CASE isn't ignored when passed by a Lisp caller.

The we may not need `call-interactively' at all. 

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] small bug in Babel GnuPlot on % character

2017-05-08 Thread Nicolas Goaziou
Hello,

Thierry Banel  writes:

> Here is a patch for a small bug in Babel GnuPlot. When GnuPlot outputs a
> message containing a % character, Emacs mis-interprets it. This happens
> when using commands such as print or fit. Example showing the bug:
>
> #+BEGIN_SRC gnuplot :file x.svg :session none
> print "hello %s\n"
> plot x
> #+END_SRC

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Invalid read syntax: "?" when switching org-dates or when tying to org-submit-bug-report

2017-05-08 Thread michael . ziems
Hello Nicolas, 

thanks for the answer. 

I'm not a big expert on lisp. As i did not find any information how a
.patch file works so fast, i just changed it manually in the
org-clock.el like this: 

(defun org-clock-put-overlay (time)
  "Put an overlays on the current line, displaying TIME.
This creates a new overlay and stores it in `org-clock-overlays', so
that it
will be easy to remove."
  (let (ov tx)
(beginning-of-line)
(let ((case-fold-search nil))
  (when (looking-at org-complex-heading-regexp)
(goto-char (match-beginning 4
(setq ov (make-overlay (point) (point-at-eol))
  tx (concat (buffer-substring-no-properties (point) (match-end 4))
 (org-add-props
 (make-string
  (max 0 (- (- 60 (current-column))
(- (match-end 4) (match-beginning 4))
(length (org-get-at-bol 'line-prefix
  ?·)
 '(face shadow))
 (org-add-props
 (format " %9s " (org-minutes-to-clocksum-string time))
 '(face org-clock-overlay))
 ""))
(overlay-put ov 'display tx)
(push ov org-clock-overlays))) 

When i byte-compile the file i get the following error: 

Compiling file
c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el at
Mon May  8 11:27:30 2017
org-clock.el:1949:1:Error: Invalid read syntax: "?"

Thanks for your patience. 

Michael 

Am 2017-05-08 11:09, schrieb Nicolas Goaziou:

> Hello,
> 
> michael.zi...@xiron.de writes:
> 
>> when i try to swicht an active timestamp via org-shitright or when i
>> fire M-x org-submit-bug-report i get the following error: 
>> 
>> Debugger entered--Lisp error: (invalid-read-syntax "?")
>> eval-buffer(# nil
>> "c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
>> nil t)  ; Reading at buffer position 72111
>> 
>> load-with-code-conversion("c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
>> "c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
>> nil t)
>> require(org-clock)
>> mapc(require (org-agenda org-archive org-attach org-clock org-colview
>> org-id org-table org-timer))
>> org-require-autoloaded-modules()
>> org-submit-bug-report()
>> call-interactively(org-submit-bug-report record nil)
>> command-execute(org-submit-bug-report record)
>> execute-extended-command(nil "org-submit-bug-report")
>> call-interactively(execute-extended-command nil nil) 
>> 
>> I tried to do the same with Edebug on, but somehow it looks fine
>> there.
> 
> Would the attached patch fix your issue?
> 
> Regards,

Re: [O] change in babel argument processing?

2017-05-08 Thread Nicolas Goaziou
Hello,

Eric S Fraga  writes:

> Some of my ledger babel calls have stopped working.  I have tracked it
> down to a change in how backslashes are treated.  Formerly, I had
> "...\n..." which was interpreted correctly but now require to escape the
> backslash "...\\n...", as in the attached example.
>
> I'm posting this as much as a heads up for others as anything else.  I
> did not see any mention of this in the list or the change log but could
> have obviously missed it easily (apologies if so).

It is an unexpected consequence of
500abcd7fbe24abc887300faec2058905a13fa33 in which I lazily use `read' to
parse string values.

I fixed it in maint, could you confirm it?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Invalid read syntax: "?" when switching org-dates or when tying to org-submit-bug-report

2017-05-08 Thread Nicolas Goaziou
Hello,

michael.zi...@xiron.de writes:

> when i try to swicht an active timestamp via org-shitright or when i
> fire M-x org-submit-bug-report i get the following error: 
>
> Debugger entered--Lisp error: (invalid-read-syntax "?")
>   eval-buffer(# nil
> "c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
> nil t)  ; Reading at buffer position 72111
>  
> load-with-code-conversion("c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
> "c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
> nil t)
>   require(org-clock)
>   mapc(require (org-agenda org-archive org-attach org-clock org-colview
> org-id org-table org-timer))
>   org-require-autoloaded-modules()
>   org-submit-bug-report()
>   call-interactively(org-submit-bug-report record nil)
>   command-execute(org-submit-bug-report record)
>   execute-extended-command(nil "org-submit-bug-report")
>   call-interactively(execute-extended-command nil nil) 
>
> I tried to do the same with Edebug on, but somehow it looks fine
> there.

Would the attached patch fix your issue?

Regards,

-- 
Nicolas Goaziou
>From 144c4ba61ba325f682088ba8501dccb3e20dbc8a Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou 
Date: Mon, 8 May 2017 11:08:10 +0200
Subject: [PATCH] org-clock: Disambiguate character syntax

* lisp/org-clock.el (org-clock-put-overlay): Escape character in
  character syntax.
---
 lisp/org-clock.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 462eda682..ea1ead47d 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1967,7 +1967,8 @@ will be easy to remove."
 			 (make-string
 			  (max 0 (- (- 60 (current-column))
 (- (match-end 4) (match-beginning 4))
-(length (org-get-at-bol 'line-prefix ?·)
+(length (org-get-at-bol 'line-prefix
+			  ?\·)
 			 '(face shadow))
 		 (org-add-props
 			 (format " %9s " (org-duration-from-minutes time))
-- 
2.12.2



[O] change in babel argument processing?

2017-05-08 Thread Eric S Fraga
Hello all,

Some of my ledger babel calls have stopped working.  I have tracked it
down to a change in how backslashes are treated.  Formerly, I had
"...\n..." which was interpreted correctly but now require to escape the
backslash "...\\n...", as in the attached example.

I'm posting this as much as a heads up for others as anything else.  I
did not see any mention of this in the list or the change log but could
have obviously missed it easily (apologies if so).

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3
* test
This does not work:
#+call: year2016[:cmdline --format "%-20A %12T\n" bal --flat pay tax]()

#+results:

This one does:
#+call: year2016[:cmdline --format "%-20A %12T\\n" bal --flat pay tax]()

#+results:
: pay  -35.00 £
: tax   10.00 £
:  -25.00 £

#+name: year2016
#+begin_src ledger :cmdline bal assets
  2016/05/03 * pay
  bank   25.00 £
  tax   10 £
  pay
#+end_src 


signature.asc
Description: PGP signature


Re: [O] 9.0.6 and clock tables

2017-05-08 Thread Eric S Fraga
On Sunday,  7 May 2017 at 10:16, Nicolas Goaziou wrote:
> Would you happen to have any news on it?

Had no time but ...

> BTW, you may need to remove any TBLFM: entry related to % since this is
> no longer necessary when using :formula %.

... removing the existing TBLFM line fixes the problem!  Many thanks!

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.6-407-gc28ec3


signature.asc
Description: PGP signature


[O] keep an eye of interesting emacs-configs from github git/magit/diff?

2017-05-08 Thread Hans Maulwurf
hey guys,

does somebody has a good workflow for discovering new features/changes of
foreigner's emacsconfigs from github without manually browsing the github
pages? mabe there is a smart combination of magit/orgmode/diff like:
* clone all repos
* make orgmode/magit give an overview of changes or commit messages after
pull
* look through this overview and dive deeper into the src of an interesting
change/commit by following a link/url

maybe you can help me or give me a hint :)

best regards,
Hans


[O] Invalid read syntax: "?" when switching org-dates or when tying to org-submit-bug-report

2017-05-08 Thread michael . ziems
Hello, 

when i try to swicht an active timestamp via org-shitright or when i
fire M-x org-submit-bug-report i get the following error: 

Debugger entered--Lisp error: (invalid-read-syntax "?")
  eval-buffer(# nil
"c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
nil t)  ; Reading at buffer position 72111
 
load-with-code-conversion("c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
"c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/org-clock.el"
nil t)
  require(org-clock)
  mapc(require (org-agenda org-archive org-attach org-clock org-colview
org-id org-table org-timer))
  org-require-autoloaded-modules()
  org-submit-bug-report()
  call-interactively(org-submit-bug-report record nil)
  command-execute(org-submit-bug-report record)
  execute-extended-command(nil "org-submit-bug-report")
  call-interactively(execute-extended-command nil nil) 

I tried to do the same with Edebug on, but somehow it looks fine there. 

Emacs-Version: GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200) of 2013-03-17 on
MARVIN 

Org-Version: Org mode version 9.0.6 (9.0.6-elpa @
c:/Users/sane/AppData/Roaming/.emacs.d/elpa/org-20170502/) 

Im doing this on windows. 

Any help is appreciated. 

Thanks, 

Michael