org-capture-template: table lines including newline of sorts

2021-03-12 Thread Uwe Brauer


Hi 

Currently I have the following setting for one org-capture-template:


("mu" "Stat+Num:Exercises English"
table-line (file+headline "~/Somefile.org" "Exercise Group-E")
"| %:fromname|%:fromaddress | 
%(my-extract-cc)|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  %a|%:date | "  
:prepend t
)

That line is too long, I'd like something like this 
("mu" "Stat+Num:Exercises English"
table-line (file+headline "~/Somefile.org" "Exercise Group-E")
"| %:fromname|%:fromaddress\n 
%(my-extract-cc)|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  %a|%:date | "  
:prepend t
)

Or 

("mu" "Stat+Num:Exercises English"
table-line (file+headline "~/Somefile.org" "Exercise Group-E")
"| %:fromname|%:fromaddress\n 
%(my-extract-cc)|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  %a|%:date | "  
:prepend t
"|   | %(my-extract-cc) |   |   |   |   |   |   ||  |   |   ||| 
"  :prepend t 
)


But nothing worked, any ideas?

Thanks and regards

Uwe Brauer 




Re: org-capture gnus also extract from the cc field.

2021-03-12 Thread Uwe Brauer
>>> "KM" == Kyle Meyer  writes:

> Uwe Brauer writes:
>> Hi
>> 
>> This would be very useful for my workflow, actually I have 
>> 
>> ("mu" "Stat+Num: English"
>> table-line (file+headline "/somefile.org" "Exercise Group-E")
>> "| %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  
>> %a|%:date "  :prepend t)
>> 
>> So a %:ccname %:ccaddress would be very very useful
>> 
>> Any idea how to achieve that?

> At the minimum, it looks like you'd have to adjust two places:

>   * org-gnus-store-link to extract the cc field and call
> org-link-store-props with it

>   * org-link-store-props to process it

Thanks, I found a simpler solution 

(defun my-extract-cc ()
  (interactive)
  (gnus-fetch-original-field "cc"))


("mu" "Stat+Num:Exercises English"
 table-line (file+headline "~/somefile.org" "Exercise Group-E")
 "| %:fromname|%:fromaddress | 
%(my-extract-cc)|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  %a|%:date | "  
:prepend t)


No ideal but will do for the moment.


smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH] Re: Bug: Plain https links with brackets are not recognised [9.4.4 (release_9.4.4-625-g763c7a @ /home/yantar92/.emacs.d/straight/build/org/)]

2021-03-12 Thread Ihor Radchenko
Sorry, attached wrong version of the patch.

Here is the right one

>From 0acb961d916d4bfde505c9f5eb16d1e8851b6c8f Mon Sep 17 00:00:00 2001
From: Ihor Radchenko 
Date: Sat, 13 Mar 2021 13:16:06 +0800
Subject: [PATCH] Improve org-link-plain-re

* lisp/ol.el (org-link-make-regexps): Allow URLs with up to two levels
of nested brackets.  Now, URLs like [1] can be matched.  The new
regexp is taken from [2].

[1] https://doi.org/10.1016/0160-791x(79)90023-x
[2] https://daringfireball.net/2010/07/improved_regex_for_matching_urls
---
 lisp/ol.el | 55 +++---
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 8b9755b51..7ce7a4798 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -829,26 +829,43 @@ This should be called after the variable `org-link-parameters' has changed."
 	  (format "<%s:\\([^>\n]*\\(?:\n[ \t]*[^> \t\n][^>\n]*\\)*\\)>"
 		  types-re)
 	  org-link-plain-re
-	  (concat
-	   "\\<" types-re ":"
-	   "\\([^][ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")
-	  ;;	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
-	  org-link-bracket-re
-	  (rx (seq "[["
-		   ;; URI part: match group 1.
-		   (group
-		(one-or-more
+	  (let ((non-space-bracket "[^][ \t\n()<>]+"))
+;; Heiristics for an URL link.  Source:
+;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls
+(rx-to-string
+ `(seq (regexp "\\<")
+   (regexp ,types-re)
+   ":"
+   (1+ (or (regex ,non-space-bracket)
+   (seq "("
+(* (or (regex ,non-space-bracket)
+   (seq "("
+(regex ,non-space-bracket)
+")")))
+")")))
+   (or (seq "("
+(* (or (regex ,non-space-bracket)
+   (seq "("
+(regex ,non-space-bracket)
+")")))
+")")
+   (regexp "\\([^[:punct:] \t\n]\\|/\\)")
+  org-link-bracket-re
+  (rx (seq "[["
+	   ;; URI part: match group 1.
+	   (group
+	(one-or-more
  (or (not (any "[]\\"))
-			 (and "\\" (zero-or-more "") (any "[]"))
-			 (and (one-or-more "\\") (not (any "[]"))
-		   "]"
-		   ;; Description (optional): match group 2.
-		   (opt "[" (group (+? anything)) "]")
-		   "]"))
-	  org-link-any-re
-	  (concat "\\(" org-link-bracket-re "\\)\\|\\("
-		  org-link-angle-re "\\)\\|\\("
-		  org-link-plain-re "\\)"
+		 (and "\\" (zero-or-more "") (any "[]"))
+		 (and (one-or-more "\\") (not (any "[]"))
+	   "]"
+	   ;; Description (optional): match group 2.
+	   (opt "[" (group (+? anything)) "]")
+	   "]"))
+  org-link-any-re
+  (concat "\\(" org-link-bracket-re "\\)\\|\\("
+	  org-link-angle-re "\\)\\|\\("
+	  org-link-plain-re "\\)"
 
 (defun org-link-complete-file (&optional arg)
   "Create a file link using completion."
-- 
2.26.2



[PATCH] Re: Bug: Plain https links with brackets are not recognised [9.4.4 (release_9.4.4-625-g763c7a @ /home/yantar92/.emacs.d/straight/build/org/)]

2021-03-12 Thread Ihor Radchenko
Kyle Meyer  writes:

> This case was discussed at
> .
> There's mention of an improved regexp that might be worth trying.

The improved regexp appears to work for me. I tried my best to transform
the regexp provided in the link to rx notation. The patch is attached.

Best,
Ihor

>From 79eaa3b5b71f2aba02d4f17b860f67a6a77255fc Mon Sep 17 00:00:00 2001
From: Ihor Radchenko 
Date: Sat, 13 Mar 2021 13:16:06 +0800
Subject: [PATCH] Improve org-link-plain-re

* lisp/ol.el (org-link-make-regexps): Allow URLs with up to two levels
of nested brackets.  Now, URLs like [1] can be matched.  The new
regexp is taken from [2].

[1] https://doi.org/10.1016/0160-791x(79)90023-x
[2] https://daringfireball.net/2010/07/improved_regex_for_matching_urls
---
 lisp/ol.el | 30 +-
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 8b9755b51..0e166de38 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -829,15 +829,27 @@ This should be called after the variable `org-link-parameters' has changed."
 	  (format "<%s:\\([^>\n]*\\(?:\n[ \t]*[^> \t\n][^>\n]*\\)*\\)>"
 		  types-re)
 	  org-link-plain-re
-	  (concat
-	   "\\<" types-re ":"
-	   "\\([^][ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")
-	  ;;	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
-	  org-link-bracket-re
-	  (rx (seq "[["
-		   ;; URI part: match group 1.
-		   (group
-		(one-or-more
+	  (let ((non-space-bracket "[^][ \t\n()<>]+"))
+;; Heiristics for an URL link.  Source:
+;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls
+(rx-to-string
+ `(seq (regexp "\\<")
+   (regexp ,types-re)
+   ":"
+   (1+ (or (regex ,non-space-bracket)
+   (seq "("
+(* (or (regex ,non-space-bracket)
+   (seq "("
+(regex ,non-space-bracket)
+")")))
+")")))
+   (or (seq "("
+(* (or (regex ,non-space-bracket)
+   (seq "("
+(regex ,non-space-bracket)
+")")))
+")")
+   (regexp "\\([^[:punct:] \t\n]\\|/\\)")
  (or (not (any "[]\\"))
 			 (and "\\" (zero-or-more "") (any "[]"))
 			 (and (one-or-more "\\") (not (any "[]"))
-- 
2.26.2



Re: org-capture gnus also extract from the cc field.

2021-03-12 Thread Kyle Meyer
Uwe Brauer writes:

> Hi
>
> This would be very useful for my workflow, actually I have 
>
> ("mu" "Stat+Num: English"
>  table-line (file+headline "/somefile.org" "Exercise Group-E")
>  "| %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  
> %a|%:date "  :prepend t)
>
> So a %:ccname %:ccaddress would be very very useful
>
> Any idea how to achieve that?

At the minimum, it looks like you'd have to adjust two places:

  * org-gnus-store-link to extract the cc field and call
org-link-store-props with it

  * org-link-store-props to process it



Re: Bug: Plain https links with brackets are not recognised [9.4.4 (release_9.4.4-625-g763c7a @ /home/yantar92/.emacs.d/straight/build/org/)]

2021-03-12 Thread Kyle Meyer
Ihor Radchenko writes:

> I have a https link like "https://doi.org/10.1016/0160-791x(79)90023-x".
> If I put this link into an org file (using emacs -Q or Org mode master),
> only "https://doi.org/10.1016/0160-791x(79)" part of the link is treated
> as a link. I guess, it should not happen.

This case was discussed at
.
There's mention of an improved regexp that might be worth trying.



Bug: Plain https links with brackets are not recognised [9.4.4 (release_9.4.4-625-g763c7a @ /home/yantar92/.emacs.d/straight/build/org/)]

2021-03-12 Thread Ihor Radchenko


I have a https link like "https://doi.org/10.1016/0160-791x(79)90023-x".
If I put this link into an org file (using emacs -Q or Org mode master),
only "https://doi.org/10.1016/0160-791x(79)" part of the link is treated
as a link. I guess, it should not happen.

Best,
Ihor




org-capture gnus also extract from the cc field.

2021-03-12 Thread Uwe Brauer

Hi



actually I have 

("mu" "Stat+Num: English"
 table-line (file+headline "/somefile.org" "Exercise Group-E")
 "| %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  
%a|%:date "  :prepend t)


For  my workflow,  it would be very useful to have 
a %:ccname %:ccaddress 

Any idea how to achieve that?

Thanks 


Uwe Brauer 


smime.p7s
Description: S/MIME cryptographic signature


org-capture gnus also extract from the cc field.

2021-03-12 Thread Uwe Brauer



Hi

This would be very useful for my workflow, actually I have 

("mu" "Stat+Num: English"
 table-line (file+headline "/somefile.org" "Exercise Group-E")
 "| %:fromname|%:fromaddress|%^{Sheet|1|2|3|4|5|6}|%^{Exercise|1|} |  
%a|%:date "  :prepend t)

So a %:ccname %:ccaddress would be very very useful

Any idea how to achieve that?

Thanks 


Uwe Brauer 




Re: org-capture-templates: %date is too long

2021-03-12 Thread Robert Pluim
> On Fri, 12 Mar 2021 16:58:27 +0100, Uwe Brauer  said:


Uwe> Well, in order to run it I added an interactive call, but then 
Uwe> %:date reminded unimpressed by this setting


Uwe> the result was 

Uwe> | user | u...@ucm.es | 3 |3 | [] | Fri, 12 Mar 2021 
16:14:35 +0100 |

My mistake, itʼs a defconst, not a defvar, so it may well have been
inserted verbatim into the org code.

Robert
-- 



Bug: Clock date range with the enclosing markup <> are not fully supported [9.4.4 (9.4.4-27-gb712b9-elpaplus)]

2021-03-12 Thread Firmin Martin


I have manually changed a clock date range in a task's logbook using the
shortcut =C-c .= (org-time-stamp). It modified the Org timestamp to the
date I wanted, but changed the enclosing markup from [] to <>. I didn't
pay much attention on it as C-c C-c (org-ctrl-c-ctrl-c) updated
correctly the total time.

But it happens that the change from [] to <> markup is enough to let

- clock table
- org-agenda-columns' CLOCKSUM_T property

completely ignore the clock entry I modified. I tested that after
changing the enclosing markup from <> to [], everything works as
expected. BTW, org-lint reports nothing on this.

Below is a minimal not working example.

1. In ~/test.org, put the following content.

* TODO Task
  SCHEDULED:<2021-03-13 sam. ++1d>
  :PROPERTIES:
  :Effort:   1:00
  :LAST_REPEAT: [2021-03-12 ven. 12:39]
  :END:
  :LOGBOOK:
  - State "DONE"   from "TODO"   [2021-03-12 ven. 12:39]
  CLOCK: <2021-03-12 ven. 09:15>--<2021-03-12 ven. 12:15> =>  3:00
  :END:

2. Insert the dynamic clock table and press C-c C-c on it

#+BEGIN: clocktable :scope ("~/test.org") :maxlevel 8 :block 2021-03-12
#+END:

the task does not show up. 

3. Put this file in your agenda files and set agenda columns 

(add-to-list org-agenda-files "~/test.org")
(setq org-columns-default-format-for-agenda "%50ITEM(Task) %2PRIORITY 
%10Effort(Effort){:} %10CLOCKSUM_T")

4. Now open org agenda in "columns mode"

(org-agenda-list)
(org-agenda-columns)

The task's CLOCKSUM_T field is empty.

5. Finally, replace the CLOCK property timestamp enclosing markup from <> to [] 
in
test.org. Try again 2. and 4.



Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
cairo version 1.16.0)
 of 2021-01-20
Package: Org mode version 9.4.4 (9.4.4-27-gb712b9-elpaplus)



Re: org-capture-templates: %date is too long

2021-03-12 Thread Uwe Brauer
>>> "RP" == Robert Pluim  writes:

>> On Thu, 04 Mar 2021 21:24:03 +0100, Uwe Brauer  said:
Uwe> I am not acquainted with let-bound (only with let)

> 'let-bound' is a shorthand for saying 'binding a value using let'

Uwe> So are you saying I should may use defadvice to modify org-capture?

> Well, you have control over how org-capture is invoked, so you could
> do:

> (defun my-org-capture ()
>(let ((org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a>")))
> (org-capture)))

> although you could do it with advice if you wanted. Untested, of course :-)


Well, in order to run it I added an interactive call, but then 
%:date reminded unimpressed by this setting


the result was 

| user | u...@ucm.es | 3 |3 | [] | Fri, 12 Mar 2021 16:14:35 +0100 |

Uwe 


smime.p7s
Description: S/MIME cryptographic signature