Re: Failing tests (was: Possible fix for :includes header argument in org-babel C source blocks)

2020-05-30 Thread Kyle Meyer
Kévin Le Gouguec writes:

> Kyle Meyer  writes:
>
>> The source for that page is in the worg repo:
>> https://code.orgmode.org/bzg/worg/src/master/org-contrib/babel/languages/ob-doc-C.org
>
> Thanks for the pointer, and for applying the patches!
>
   FAILED  ob-tangle/jump-to-org
   FAILED  test-org-attach/dir
>>
>> :(
>>
>> After your first patch, all tests now pass on my end.  Would you mind
>> posting the details of those failures in a new thread?
>
> Mmm, on further inspection, those tests fail on one of my setups but
> pass on another.
>
> I think I've narrowed this down to org-open-file running "less
> examples/att1/fileA" instead of visiting this file.
[...]
> Let-binding org-file-apps to '(("." . emacs)) makes the tests pass, but
> I don't know if that's the way we want to solve this.

Thanks for looking into the failures.  Let-binding org-file-apps sounds
like a good approach to me.  Rather than the catch-all regular
expression, I believe the value could be ((t . emacs)).



[Patch] Add support for geiser-scheme-implementation to lisp/ob-scheme.el

2020-05-30 Thread Vladimir Nikishkin
Hello, everyone

ob-scheme doesn't seem to be respecting geiser-scheme-implementation,
which is a buffer-local variable to specify which implementation in
particular to use in an org buffer by default.

This 2-line patch adds this support.

Please, consider adding it.

-- 
Yours sincerely, Vladimir Nikishkin
From f7b0277b1de47305dbfaeab614cd4530e07921c1 Mon Sep 17 00:00:00 2001
From: Lockywolf 
Date: Sun, 31 May 2020 12:34:53 +0800
Subject: [PATCH] Add support for geiser-scheme-implementation in ob-scheme.el

---
 lisp/ob-scheme.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 5ca7f871d..3eee8213d 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -43,6 +43,7 @@
 (require 'geiser-impl nil t)
 (defvar geiser-repl--repl) ; Defined in geiser-repl.el
 (defvar geiser-impl--implementation)   ; Defined in geiser-impl.el
+(defvar geiser-scheme-implementation)  ; Defined in geiser-impl.el
 (defvar geiser-default-implementation) ; Defined in geiser-impl.el
 (defvar geiser-active-implementations) ; Defined in geiser-impl.el
 (defvar geiser-debug-show-debug-p) ; Defined in geiser-debug.el
@@ -211,6 +212,7 @@ This function is called by `org-babel-execute-src-block'."
   (let* ((result-type (cdr (assq :result-type params)))
 	 (impl (or (when (cdr (assq :scheme params))
 			 (intern (cdr (assq :scheme params
+		   geiser-scheme-implementation
 		   geiser-default-implementation
 		   (car geiser-active-implementations)))
 	 (session (org-babel-scheme-make-session-name
-- 
2.26.2



[PATCH v2] Re: [BUG] recently commits on master branch breaks command 'org-babel-demarcate-block'

2020-05-30 Thread stardiviner

I updated the patch commit message.

From b0bdf52a305cb5f9663ee1dc2d08c5de6c7cb602 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 31 May 2020 10:59:41 +0800
Subject: [PATCH] fix 5f0a9cca3 missing space

* lisp/ob-core.el (org-babel-demarcate-block): replace wrong newline
with missing space.
---
 lisp/ob-core.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index e554e3934..79937e517 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1908,7 +1908,7 @@ (defun org-babel-demarcate-block ( arg)
 			(if (looking-at "^") "" "\n")
 			indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
 			(if arg stars indent) "\n"
-			indent (if upper-case-p "#+BEGIN_SRC\n" "#+begin_src\n")
+			indent (if upper-case-p "#+BEGIN_SRC\n" "#+begin_src ")
 			lang
 			(if (> (length headers) 1)
 			(concat " " headers) headers)
-- 
2.26.2


stardiviner  writes:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
>
> When I have a source block (The "|" represents the point):
>
> #+begin_src sh :eval no
> chrome --remote-debugging-port
> |
>
> #+end_src
>
> Then press =[C-c C-v d]=, it becomes like this:
>
> #+begin_src sh :eval no
> chrome --remote-debugging-port
> #+end_src
>
> #+begin_src
> sh :eval no
>
> #+end_src
>
> - -- 
> [ stardiviner ]
>I try to make every word tell the meaning that I want to express.
>
>Blog: https://stardiviner.github.io/
>IRC(freenode): stardiviner, Matrix: stardiviner
>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
> -BEGIN PGP SIGNATURE-
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7RvwkUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsPWigf+NOP4j0/9U3YvhHhdAmNbrLiNa+My
> NsN7msj1uSwwgtyKccaDOmB4mRMoKxhdK3TMn55LmKj+xsJY54EQ35Oq2G4HsJYX
> kbypfoj09NNjE4R7Qw7IyAbr7cLkITPbp+9UCDX+lupyNGsKDmkDtrl84JG/Lnxs
> jp5FuKBzeG2P7dR8Zs8TFPZOzzPP4jQKnUgfghRcgLNxxJXX2CPge5+cAKiDQFoh
> yQCXdd9cFbldnethRjQb6GrlylBcCaHe41AuKrXAdn2gmv1gPLNb1perJ/TCyw3x
> ZQy554ZI8dOL1jH4lL5JmGxwWcgMq4qahdhUlfSCEzZKgjKqTtVTdBJYwg==
> =qwc/
> -END PGP SIGNATURE-


-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


[PATCH] Re: [BUG] recently commits on master branch breaks command 'org-babel-demarcate-block'

2020-05-30 Thread stardiviner

Berry, Charles  writes:

>> On May 29, 2020, at 7:03 PM, stardiviner  wrote:
>> 
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>> 
>> 
>> When I have a source block (The "|" represents the point):
>> 
>> #+begin_src sh :eval no
>> chrome --remote-debugging-port
>> |
>> 
>> #+end_src
>> 
>> Then press =[C-c C-v d]=, it becomes like this:
>> 
>> #+begin_src sh :eval no
>> chrome --remote-debugging-port
>> #+end_src
>> 
>> #+begin_src
>> sh :eval no
>> 
>> #+end_src
>> 
>> - --
>
> Exactly. Commit 5f0a9cca3 adds a `\n' in line 1911 that should have been a 
> space. 
>

Thanks! I just did a small patch to fix this.

From af210eeb78d7611aeb7b6d1a99433cee10e53186 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 31 May 2020 10:59:41 +0800
Subject: [PATCH] fix 5f0a9cca3

---
 lisp/ob-core.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index e554e3934..79937e517 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1908,7 +1908,7 @@ (defun org-babel-demarcate-block ( arg)
 			(if (looking-at "^") "" "\n")
 			indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
 			(if arg stars indent) "\n"
-			indent (if upper-case-p "#+BEGIN_SRC\n" "#+begin_src\n")
+			indent (if upper-case-p "#+BEGIN_SRC\n" "#+begin_src ")
 			lang
 			(if (> (length headers) 1)
 			(concat " " headers) headers)
-- 
2.26.2


> Chuck
>
> [snip]


-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: [PATCH] Fix org-narrow-to-subtree smaller than subtree

2020-05-30 Thread Kevin Liu


> There is a good reason for this. If you insert text at (point-max), you
> break the following headline.
>
> OTOH `org-mark-element' should pay attention to buffer boundaries.

Good point.  `org-mark-element` uses (org-element-property); I wonder if
it makes sense to have the actual :end property of a subtree be the same
as its narrowed boundary?



Re: nondeterministic org-test-with-temp-text?

2020-05-30 Thread Kevin Liu
On 30 May 2020 09:09, Nicolas Goaziou  wrote:

> You cannot call `org-cycle' consecutively without care, because it
> checks `last-command' and `this-command'. You need to fake their values
> before calling `org-cycle' again.

Good to know, thanks.

Relatedly, would you be willing to take a look at the bug at hand with
(org-next-visible-headline)?  I think the recent rewrite has changed its
behavior in a way outlined by my test cases.  Specifically, not always
landing on a headline will break speed keys.



using org mode to help with a construction project

2020-05-30 Thread Ram Bhamidipaty
I am still a beginner at org mode - I am looking for ideas or
information about how I can use org mode to help me manage a
construction project.

I have a list of contractors (name, phone, email, etc) that I want to
contact - and eventually get bids. Right now I would like to keep track
of which ones have been sent an initial email, a time stamp for that
would also be good. Maybe even record any response.

If there were a nice way to select and export the contact info for
certain contractors that would be nice. I have a list of around 40 and I
want to contact them in batches of 5. Maybe I could pick 5, export the
addresses to Thunderbird and send initial requests.

Any suggestions?

Thank you.




Re: Splitting large org file into smaller ones

2020-05-30 Thread Marvin M. Doyley
Thanks Bill

> On May 30, 2020, at 11:36 AM, William Denton  wrote:
> 
> On 30 May 2020, Marvin M. Doyley wrote:
> 
>> How do I export the subtree to separate org files, say
>> 
>> - Candidate-a.org 
>> >  >
>> - Candidate-b.org 
>> >  >
> 
> I'll throw out an uninformed suggestion of a possible direction:  archiving 
> subtrees.  I guess you'd have to keep changing the name of the target archive 
> file, or rename it after you'd moved a tree to it, but at least it's getting 
> a whole tree out of the way at once.
> 
> Bill
> --
> William Denton :: Toronto, Canada   ---   Listening to Art: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__listeningtoart.org_=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=bIZSMkqv64C1tMXjpulbll5ho0_g78uEvbSGB385-YQ=3SYzbH-wXEZ1etjDC-J5keIPie3ll0ngiWihrTPputs=
>  
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.miskatonic.org_=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=bIZSMkqv64C1tMXjpulbll5ho0_g78uEvbSGB385-YQ=Eyy6EE7boaclNVgLZFy6YP4RM57VQQMr5pBFDOdY5Zo=
>   ---   GHG.EARTH: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__ghg.earth_=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=bIZSMkqv64C1tMXjpulbll5ho0_g78uEvbSGB385-YQ=WZpqujYA7GRmIP00WVRuyH4g-hRRFcrNhWV9O27p0F0=
>  Caveat lector.  ---   STAPLR: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__staplr.org_=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=bIZSMkqv64C1tMXjpulbll5ho0_g78uEvbSGB385-YQ=sKITlXUZ5Q6MQoPb4RFPynZVydyakhlNKabGQieVC7c=
>  




Re: Splitting large org file into smaller ones

2020-05-30 Thread Marvin M. Doyley
Cool! I will try this too

Thanks

Cheers,
M

> On May 30, 2020, at 6:23 PM, Diego Zamboni  wrote:
> 
> Hi Marvin,
> 
> I replied to a similar question some time ago, here's my answer (with
> updated links since the files have changed in the meantime):
> 
> I do something similar in my ox-leanpub-book module [1], which exports
> each top-level heading to a different file. The general idea is to use
> =org-map-entries= to loop over the entire buffer [2]. The function you
> call can then check whether the current entry is a header at the level
> you want [3] and then export it to the corresponding file. The title
> can be used to deduct the filename [4].
> 
> I found that I had to mark the entire subtree before calling the
> export function [5], otherwise the headline was not getting included
> in the export.
> 
> I based my code originally on this blog post, which might be a simpler
> starting point:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__medium.com_-40lakshminp_publishing-2Da-2Dbook-2Dusing-2Dorg-2Dmode-2D9e817a56d144=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=exfuDxb81D5anZ5KD-hCvUI4PRaQxsb812EaBW3b9p4=
>  
> - this code does not select the entire subtree before exporting, which
> means only the contents of the section is exported, but not the
> headline itself.
> 
> I wrote a simplified function which puts the above ideas together,
> feel free to use it:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.github.com_zzamboni_2e6ac3c4f577249d98efb224d9d34488=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=ARDFenWJJT9XTsBKAReDC6bDx9VwbP3ADCw3o-_hQbY=
>  
> 
> Hope this helps!
> --Diego
> 
> [1] 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_zzamboni_ox-2Dleanpub_tree_book-2Dand-2Dmarkua=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=peXBLnzs1ABFnCABzVUsley3-VMFDR0_2oLF3TgiBPM=
>  
> [2] 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_zzamboni_ox-2Dleanpub_blob_f7ae0f86f517a321a5150e1c712554b12acf144b_ox-2Dleanpub-2Dbook.el-23L216-2DL217=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=3K2q6g7FxxjjxKJZtqdsE5bpMFT6RTf3S4mmyldNdLw=
>  
> [3] 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_zzamboni_ox-2Dleanpub_blob_f7ae0f86f517a321a5150e1c712554b12acf144b_ox-2Dleanpub-2Dbook.el-23L145=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=QOtk1D413Gju7Agm6zgbAMlIwww6e-UV1SZsjomzuZA=
>  
> [4] 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_zzamboni_ox-2Dleanpub_blob_f7ae0f86f517a321a5150e1c712554b12acf144b_ox-2Dleanpub-2Dbook.el-23L154-2DL158=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=ynLKEu4CLjIJqR3y3zl2UMEkS_onMBSSb2TDwOaixt4=
>  
> [5] 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_zzamboni_ox-2Dleanpub_blob_f7ae0f86f517a321a5150e1c712554b12acf144b_ox-2Dleanpub-2Dbook.el-23L192=DwIBaQ=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=249GZv4Zgx7zyEm64J3m2eEYuchXSdodRltw_gmrqlg=quomDHaK1zPArr8wu5m8uwkgug6NZ6eDChE5VMZwrG4=
>  
> 
> On Sat, May 30, 2020 at 12:08 PM Marvin M. Doyley
>  wrote:
>> 
>> Hi there,
>> 
>> Is there an efficient way to split a large org file into smaller ones?
>> 
>> Lets say I have a master file with the following
>> 
>> 
>> * Notes
>> **  Candidate A
>> - Strong technical background
>> - High H-factor
>> - good funding
>> - More established investigator
>> - Huge startup need $$
>> 
>> **  Candidate B
>> - lower startup need
>> - signal processing
>> - young investigator
>> 
>> 
>> How do I export the subtree to separate org files, say
>> 
>> - Candidate-a.org
>> - Candidate-b.org
>> 
>> 
>> Thanks
>> 
>> M




Re: Splitting large org file into smaller ones

2020-05-30 Thread Marvin M. Doyley
Hi Marcin,

I appreciate this, I will give it a go.

Thanks,
M

> On May 30, 2020, at 9:13 AM, Marcin Borkowski  wrote:
> 
> 
> On 2020-05-30, at 11:51, Marvin M. Doyley  wrote:
> 
>> Hi there,
>> 
>> Is there an efficient way to split a large org file into smaller ones?
> 
> I do not know about "efficient", but you might find my org-one-to-many
> library useful: 
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_mbork_org-2Done-2Dto-2Dmany=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=iHWQZlKMtTtC96Iqx0ymA0VpA5m6A73UehcV_vuh1tM=6rsipfH8vh-XeWLb1NEWAcdpcTFAfyUOLHD5Pkmea2o=
>  
> (Note that I don't wven know if it works with newer versions of Org; if
> not, drop me a line, maybe I'll be able to fix it.)
> 
> Best,
> 
> -- 
> Marcin Borkowski
> https://urldefense.proofpoint.com/v2/url?u=http-3A__mbork.pl=DwIBAg=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU=iHWQZlKMtTtC96Iqx0ymA0VpA5m6A73UehcV_vuh1tM=VLUzcQS7YObsdTrrwTldDMYEUZJlqE3mMIxxY8tN9JQ=
>  




Re: `with` as a list.

2020-05-30 Thread Kyle Meyer
Mario Frasca writes:

> On 30/05/2020 15:25, Kyle Meyer wrote:
>> Could you update this header to match the style used by other tests
>> (see, e.g., test-org-num.el)?
>
> apparently, I managed to pick precisely the wrong example!
>
> ;;; test-org-clock.el --- Tests for org-clock.el

Ha, I poked around in a few and couldn't find the one that looked like
yours, even though I figured it was based off another one.  I think
either way is fine, though it probably makes sense to go with the fuller
header that seems to be more common.



Re: Splitting large org file into smaller ones

2020-05-30 Thread Diego Zamboni
Hi Marvin,

I replied to a similar question some time ago, here's my answer (with
updated links since the files have changed in the meantime):

I do something similar in my ox-leanpub-book module [1], which exports
each top-level heading to a different file. The general idea is to use
=org-map-entries= to loop over the entire buffer [2]. The function you
call can then check whether the current entry is a header at the level
you want [3] and then export it to the corresponding file. The title
can be used to deduct the filename [4].

I found that I had to mark the entire subtree before calling the
export function [5], otherwise the headline was not getting included
in the export.

I based my code originally on this blog post, which might be a simpler
starting point:
https://medium.com/@lakshminp/publishing-a-book-using-org-mode-9e817a56d144
- this code does not select the entire subtree before exporting, which
means only the contents of the section is exported, but not the
headline itself.

I wrote a simplified function which puts the above ideas together,
feel free to use it:
https://gist.github.com/zzamboni/2e6ac3c4f577249d98efb224d9d34488

Hope this helps!
--Diego

[1] https://github.com/zzamboni/ox-leanpub/tree/book-and-markua
[2] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L216-L217
[3] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L145
[4] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L154-L158
[5] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L192

On Sat, May 30, 2020 at 12:08 PM Marvin M. Doyley
 wrote:
>
> Hi there,
>
> Is there an efficient way to split a large org file into smaller ones?
>
> Lets say I have a master file with the following
>
>
> * Notes
> **  Candidate A
>  - Strong technical background
>  - High H-factor
>  - good funding
> - More established investigator
> - Huge startup need $$
>
> **  Candidate B
> - lower startup need
> - signal processing
> - young investigator
>
>
> How do I export the subtree to separate org files, say
>
> - Candidate-a.org
> - Candidate-b.org
>
>
> Thanks
>
> M



Re: `with` as a list.

2020-05-30 Thread Mario Frasca

On 30/05/2020 15:25, Kyle Meyer wrote:

Could you update this header to match the style used by other tests
(see, e.g., test-org-num.el)?


apparently, I managed to pick precisely the wrong example!

;;; test-org-clock.el --- Tests for org-clock.el





Re: `with` as a list.

2020-05-30 Thread Mario Frasca
oops .. you mentioned `cl-loop' and I found it interesting, in 
particular the de-structuring part.


so I rewrote the (dolist (col-with …) …) as (cl-loop for (col . with) in 
… do …).


so I could simplify `(car col-with)' and `(cdr col-with)', then I 
replaced the `do' with a `collect', so I could squash other `setq' into 
one, and finally removed the need to do a `reverse' on the result.  less 
parentheses, and 4 lines less.


I added one regression test which is still respected, as is the rest of 
the test suite.


so maybe all is fine.

putting order in the commits is now the challenge.  thank you for your 
hints on git commit amend etc.


I hope to be back soon with a single commit...

ciao, Mario




Re: [BUG] recently commits on master branch breaks command 'org-babel-demarcate-block'

2020-05-30 Thread Berry, Charles



> On May 29, 2020, at 7:03 PM, stardiviner  wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> 
> When I have a source block (The "|" represents the point):
> 
> #+begin_src sh :eval no
> chrome --remote-debugging-port
> |
> 
> #+end_src
> 
> Then press =[C-c C-v d]=, it becomes like this:
> 
> #+begin_src sh :eval no
> chrome --remote-debugging-port
> #+end_src
> 
> #+begin_src
> sh :eval no
> 
> #+end_src
> 
> - --

Exactly. Commit 5f0a9cca3 adds a `\n' in line 1911 that should have been a 
space. 

Chuck

[snip]



Re: `with` as a list.

2020-05-30 Thread Kyle Meyer
Mario Frasca writes:

> diff --git a/lisp/org-plot.el b/lisp/org-plot.el
> index a23195d2a..c44cca991 100644
> --- a/lisp/org-plot.el
> +++ b/lisp/org-plot.el
> @@ -156,7 +156,8 @@ and dependent variables."
> table)))
>  ;; write table to gnuplot grid datafile format
>  (with-temp-file data-file
> -  (let ((num-rows (length table)) (num-cols (length (nth 0 table)))
> +  (let ((num-rows (length table))
> + (num-cols (length (nth 0 table)))

I don't disagree with the style preference here, but it's easier on
reviewers if the patch doesn't contain unrelated changes.

>   (gnuplot-row (lambda (col row value)
>  (setf col (+ 1 col)) (setf row (+ 1 row))
>  (format "%f  %f  %f\n%f  %f  %f\n"
> @@ -179,6 +180,22 @@ and dependent variables."
> (setf back-edge "") (setf front-edge ""
>  row-vals))
>  
> +(defun org-plot/zip-deps-with (num-cols ind deps with)
> +  "Describe each column to be plotted as (col . with).
> +Loops over DEPS and WITH in order to cons their elements.
> +If the DEPS list of columns is not given, use all columns from 1
> +to NUM-COLS, excluding IND.
> +If WITH is given as a string, use the given value for all
> +columns.
> +If WITH is given as a list, and it's shorter than DEPS, expand it
> +with the global default value."

Thanks for updating the docstring.

> +  (unless deps
> +(setq deps (remove ind (number-sequence 1 num-cols
> +  (unless (listp with)
> +(setq with (make-list (length deps) with)))
> +  (setq with (append with (make-list (- (length deps) (length with)) 
> "lines")))

The caller can crash this with something like

make-list(-1 "lines")
(append with (make-list (- (length deps) (length with)) "lines"))
(setq with (append with (make-list (- (length deps) (length with)) 
"lines")))
org-plot/zip-deps-with(3 1 (2 3) (lines points lines))
[...]

if they accidentally give more `with` values than `deps`.

Also, if the `(unless (listp with) ...` condition is entered, I think
the second make-list call is unnecessary.

So, combining those two points, perhaps something like this:

(setq with (if (listp with)
   (append with
   (make-list (max 0 (- (length deps) (length with)))
  "lines"))
 (make-list (length deps) with)))

> +  (cl-mapcar 'cons deps with))

Nit-pick: s/'/#'/

The latter is short for `function' and, unlike the former, lets the
byte-compiler know that cons is a function (enabling a warning if, say,
you accidentally typed `conss`).

>  (defun org-plot/gnuplot-script (data-file num-cols params  preface)
>"Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
>  NUM-COLS controls the number of columns plotted in a 2-d plot.
> @@ -240,22 +257,24 @@ manner suitable for prepending to a user-specified 
> script."
>  "%Y-%m-%d-%H:%M:%S") "\"")))
>  (unless preface
>(pcase type; plot command
> - (`2d (dotimes (col num-cols)
> -(unless (and (eq type '2d)
> - (or (and ind (equal (1+ col) ind))
> - (and deps (not (member (1+ col) deps)
> -  (setf plot-lines
> -(cons
> - (format plot-str data-file
> - (or (and ind (> ind 0)
> -  (not text-ind)
> -  (format "%d:" ind)) "")
> - (1+ col)
> - (if text-ind (format ":xticlabel(%d)" ind) "")
> - with
> - (or (nth col col-labels)
> - (format "%d" (1+ col
> - plot-lines)
> + (`2d (dolist
> +  (col-with
> +   (org-plot/zip-deps-with num-cols ind deps with))
> +(setf plot-lines
> +  (cons
> +   (format plot-str data-file
> +   (or (and ind (> ind 0)
> +(not text-ind)
> +(format "%d:" ind)) "")
> +   (car col-with)
> +   (if text-ind (format ":xticlabel(%d)" ind) "")
> +   (cdr col-with)
> +   (apply (lambda (x)
> +(if (= 0 (length x))
> +(format "%d" (car col-with))
> +  x))
> +  (list (nth (1- (car col-with)) 
> col-labels

If I'm reading it correctly, (apply ...) could be simplified to

(or (nth (1- (car col-with)) col-labels)
(format "%d" (car col-with)))

> diff --git a/testing/lisp/test-org-plot.el 

Re: `with` as a list.

2020-05-30 Thread Kyle Meyer
Mario Frasca writes:

> btw. are you on irc.freenode.net?  I'm `mariotomo' there.  and I just 
> joined `#org-mode'.  I don't think that my terminal will ring a bell if 
> I'm mentioned there.

No, sorry, I'm not.

> On 30/05/2020 01:22, Kyle Meyer wrote:
>> Mario Frasca writes:
>
>> Two meta-comments:
>>
>>* Please provide a patch with a commit message.  See
>>   for more information.
>>
>>* The link above also explains the copyright assignment requirement
>>  for contributions.  Please consider assigning copyright to the FSF.
>
> I'm editing in my cloned repository, and committing often, so I do not 
> have a single commit, consequently also not a single commit message.

There are various ways to get those fixups into a single commit.  Here's
one that assumes that you're working from the command line and on a
topic branch rather than directly on master.  Do an interactive rebase
(`git rebase -i master').  When the editor pops up, replace "pick" with
"fixup" in all of the lines but the first.  (If any of the "fixup"
commits have message bits that you want to keep in the final message,
you can use "squash" instead.)

For later fixups, you can do the same process.  You could also use
git-commit's --amend.  (Again, there are lots of possible workflows, and
of course once you're working on a series of commits rather than a
single one, the process changes a bit.)

> I just sent my form request to ass...@gnu.org.

Thank you!  Please let us know when the process is complete.

I see you already sent an updated patch, so I'll just respond to one
more point from this message.

>> I haven't looked at this bit too closely (and I know the handling around
>> col-labels changed a bit in the last message you sent), but I did try
>> out a few org-plot invocations and things seemed to work as I expected.
>> I'll plan to take a closer when you send a reroll.
>
> the whole org-plot.el has (had) no unit tests, so if you share a couple 
> of your org-plot invocations, I can convert them to regression tests.

I don't use org-plot.el, so to try this out, I just copied an example
from the Worg tutorial, stripped the table down a bit, and tried a few
`deps' and `with' values.  So there's nothing too useful, but here's is
the last one I had:

--8<---cut here---start->8---
#+PLOT: title:"example table" ind:1 deps:(2 3) type:2d with:(lines points)
#+PLOT: labels:("xlab" "ylab" "zlab")
#+TBLNAME:org-plot-example-1
|   x |y |z |
|-+--+--|
| 0.1 | 0.42 | 0.37 |
| 0.2 | 0.31 | 0.33 |
| 0.3 | 0.24 | 0.28 |
| 0.4 | 0.27 | 0.23 |
--8<---cut here---end--->8---

Thanks for your interest in adding tests.  Of course it'd be good for
org-plot.el to have some, and there are existing spots where I think it
should be easy enough to hook into and test (in particular generating
the script file and data file).  However, that doesn't necessarily have
to be tacked on to this series.



Re: Splitting large org file into smaller ones

2020-05-30 Thread Julius Dittmar



Am 30.05.20 um 17:36 schrieb William Denton:
> On 30 May 2020, Marvin M. Doyley wrote:
>
>> How do I export the subtree to separate org files, say
>>
>> - Candidate-a.org 
>> - Candidate-b.org 
>
> I'll throw out an uninformed suggestion of a possible direction: 
> archiving subtrees.  I guess you'd have to keep changing the name of
> the target archive file, or rename it after you'd moved a tree to it,
> but at least it's getting a whole tree out of the way at once.

If you'll end up naming the files yourself, then I suggest killing the
whole subtree by C-c C-x C-w (|org-cut-subtree|) with point in the
heading, opening the new file, then yanking the subtree by C-c C-x C-y
(org-paste-subtree).

You could also use the refile mechanism for that, though I never managed
to wrap my head around that one.

HTH,
Julius



Re: Possible fix for :includes header argument in org-babel C source blocks

2020-05-30 Thread Brandon Guttersohn


I don't know if it's been mentioned in the "issue tracker?" thread, but
if I could pick just *one* feature off web-based forges, it'd be
automated testing with CI…
[...]


Automated testing has been a massive time-saver everywhere I've seen it 
used, though I'm not sure I've ever seen it combined with the 
mailing-list-workflow that GNU and (off the top of my head) Gnome use. I 
guess a bot could just individually cherry-pick patches onto master, and 
it would usually be the correct thing to do?



OK; IIUC, before the patch it was not possible to generate double-quoted
includes short of backslash-escaping the double quotes; that's why I
assumed that the goal of the patch was to make it easier to use
double-quoted includes, which I thought worth advertising in ORG-NEWS.


Yeah, I believe you understand correctly. Ori found that you could get 
it to work if you escape the double quotes, /and/ place that string 
literal inside a quoted form, but that was more of a happy accident than 
a design choice as far as I can tell. So this patch is sort of a new 
feature, but a trivial one.




Re: nondeterministic org-test-with-temp-text?

2020-05-30 Thread Nicolas Goaziou
Hello,

Kevin Liu  writes:

> I’m trying to add a test (which should fail at the moment, representing
> an org-mode bug), but it seems like each ‘should’ form is actually
> nondeterministic.  The first form returns nil on the first eval and t on
> subsequent evals, its behavior resetting upon any command, and the
> second form does the inverse, returning t on the first eval and nil on
> subsequent evals.
>
> Is this behavior expected?
>
> (ert-deftest test-org/org-next-visible-heading ()
>   (should
>(org-test-with-temp-text "* A\n** B\n\n\n* C"
>  (org-overview)
>  (org-cycle)
>  (org-cycle)
>  (org-next-visible-heading 1)
>  (and (bolp) (org-at-heading-p

You cannot call `org-cycle' consecutively without care, because it
checks `last-command' and `this-command'. You need to fake their values
before calling `org-cycle' again.

Regards,

-- 
Nicolas Goaziou



Re: [PATCH] Fix org-narrow-to-subtree smaller than subtree

2020-05-30 Thread Nicolas Goaziou
Hello,

Kevin Liu  writes:

> Right now a narrowed subtree is one char smaller than the actual
> subtree.  (org-mark-element) on a narrowed subtree will select a
> region 1 char out of bounds, for example.  There doesn't seem like a
> good reason for this to be the case.

There is a good reason for this. If you insert text at (point-max), you
break the following headline.

OTOH `org-mark-element' should pay attention to buffer boundaries.

Regards,

-- 
Nicolas Goaziou



Re: `with` as a list.

2020-05-30 Thread Mario Frasca

what's new …

edited the documentation string to `org-plot/zip-deps-with',

removed some redundancies there,

removed my ›zip‹ function, in favour of ›cl-mapcar 'cons‹,

simplified the double test `stringp', `string=' with `equal'.

simplified the unit tests correspondingly.

make test: no unexpected failing tests.

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index a23195d2a..c44cca991 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -156,7 +156,8 @@ and dependent variables."
 			  table)))
 ;; write table to gnuplot grid datafile format
 (with-temp-file data-file
-  (let ((num-rows (length table)) (num-cols (length (nth 0 table)))
+  (let ((num-rows (length table))
+	(num-cols (length (nth 0 table)))
 	(gnuplot-row (lambda (col row value)
 			   (setf col (+ 1 col)) (setf row (+ 1 row))
 			   (format "%f  %f  %f\n%f  %f  %f\n"
@@ -179,6 +180,22 @@ and dependent variables."
 	  (setf back-edge "") (setf front-edge ""
 row-vals))
 
+(defun org-plot/zip-deps-with (num-cols ind deps with)
+  "Describe each column to be plotted as (col . with).
+Loops over DEPS and WITH in order to cons their elements.
+If the DEPS list of columns is not given, use all columns from 1
+to NUM-COLS, excluding IND.
+If WITH is given as a string, use the given value for all
+columns.
+If WITH is given as a list, and it's shorter than DEPS, expand it
+with the global default value."
+  (unless deps
+(setq deps (remove ind (number-sequence 1 num-cols
+  (unless (listp with)
+(setq with (make-list (length deps) with)))
+  (setq with (append with (make-list (- (length deps) (length with)) "lines")))
+  (cl-mapcar 'cons deps with))
+
 (defun org-plot/gnuplot-script (data-file num-cols params  preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -240,22 +257,24 @@ manner suitable for prepending to a user-specified script."
 			   "%Y-%m-%d-%H:%M:%S") "\"")))
 (unless preface
   (pcase type			; plot command
-	(`2d (dotimes (col num-cols)
-	   (unless (and (eq type '2d)
-			(or (and ind (equal (1+ col) ind))
-(and deps (not (member (1+ col) deps)
-		 (setf plot-lines
-		   (cons
-			(format plot-str data-file
-(or (and ind (> ind 0)
-	 (not text-ind)
-	 (format "%d:" ind)) "")
-(1+ col)
-(if text-ind (format ":xticlabel(%d)" ind) "")
-with
-(or (nth col col-labels)
-(format "%d" (1+ col
-			plot-lines)
+	(`2d (dolist
+		 (col-with
+		  (org-plot/zip-deps-with num-cols ind deps with))
+	   (setf plot-lines
+		 (cons
+		  (format plot-str data-file
+			  (or (and ind (> ind 0)
+   (not text-ind)
+   (format "%d:" ind)) "")
+			  (car col-with)
+			  (if text-ind (format ":xticlabel(%d)" ind) "")
+			  (cdr col-with)
+			  (apply (lambda (x)
+   (if (= 0 (length x))
+	   (format "%d" (car col-with))
+	 x))
+ (list (nth (1- (car col-with)) col-labels
+		  plot-lines
 	(`3d
 	 (setq plot-lines (list (format "'%s' matrix with %s title ''"
 	data-file with
@@ -310,7 +329,8 @@ line directly before or after the table."
 table data-file params)))
 		 (when y-labels (plist-put params :ylabels y-labels)
   ;; Check for timestamp ind column.
-  (let ((ind (1- (plist-get params :ind
+  (let ((ind (1- (plist-get params :ind)))
+	(with (plist-get params :with)))
 	(when (and (>= ind 0) (eq '2d (plist-get params :plot-type)))
 	  (if (= (length
 		  (delq 0 (mapcar
@@ -320,7 +340,7 @@ line directly before or after the table."
 		 0)
 	  (plist-put params :timeind t)
 	;; Check for text ind column.
-	(if (or (string= (plist-get params :with) "hist")
+	(if (or (equal with "hist")
 		(> (length
 			(delq 0 (mapcar
  (lambda (el)
diff --git a/testing/lisp/test-org-plot.el b/testing/lisp/test-org-plot.el
new file mode 100644
index 0..2bbd09b5f
--- /dev/null
+++ b/testing/lisp/test-org-plot.el
@@ -0,0 +1,50 @@
+;;; test-org-plot.el --- Tests for org-plot.el
+
+;; Copyright (C) 2020  Mario Frasca
+
+;; Author: Mario Frasca 
+
+;; Released under the GNU General Public License version 3
+;; see: http://www.gnu.org/licenses/gpl-3.0.html
+
+ Comments
+
+
+
+;;; Code:
+
+(require 'org-test)
+(require 'org-plot)
+
+
+;; General auxiliaries
+
+(ert-deftest test-org-plot/zip-deps-with ()
+  "Test `org-plot/zip-deps-with' specifications."
+  ;; no deps, no with. defaults to all except ind, and "lines"
+  (should
+   (equal (org-plot/zip-deps-with 3 1 nil nil)
+	  '((2 . "lines") (3 . "lines"
+  ;; no deps, single with. defaults to all except ind, and repeated with
+  (should
+   (equal (org-plot/zip-deps-with 3 1 nil "hist")
+	  '((2 . "hist") (3 . "hist"
+  ;; no deps, explicit with
+  (should
+   (equal (org-plot/zip-deps-with 3 1 nil '("points" "hist"))
+	  '((2 . "points") 

Re: Splitting large org file into smaller ones

2020-05-30 Thread William Denton

On 30 May 2020, Marvin M. Doyley wrote:


How do I export the subtree to separate org files, say

- Candidate-a.org 
- Candidate-b.org 


I'll throw out an uninformed suggestion of a possible direction:  archiving 
subtrees.  I guess you'd have to keep changing the name of the target archive 
file, or rename it after you'd moved a tree to it, but at least it's getting a 
whole tree out of the way at once.


Bill
--
William Denton :: Toronto, Canada   ---   Listening to Art: 
https://listeningtoart.org/
https://www.miskatonic.org/ ---   GHG.EARTH: https://ghg.earth/
Caveat lector.  ---   STAPLR: https://staplr.org/



Re: `with` as a list.

2020-05-30 Thread Mario Frasca

On 30/05/2020 09:23, Mario Frasca wrote:

The code above looks fine to me.  Another option would be to use
number-sequence and then filter out the ind value.


no, that would break functionality: I need to keep the given order.
ah, no, sorry, you are totally right here.  I'll see if using 
number-sequence makes the code shorter.


Re: Splitting large org file into smaller ones

2020-05-30 Thread Tim Visher
On Sat, May 30, 2020 at 6:09 AM Marvin M. Doyley 
wrote:

> Is there an efficient way to split a large org file into smaller ones?
>
> Lets say I have a master file with the following
>
> * Notes
> **  Candidate A
> …
> **  Candidate B
> …
>
> How do I export the subtree to separate org files, say
>
> - Candidate-a.org 
> - Candidate-b.org 
>

This seems like it would be fairly trivial with a keyboard macro. Certainly
not the most satisfying solution but if you're not doing this all the time
it might be the closest option.


Re: `with` as a list.

2020-05-30 Thread Mario Frasca

Hi Kyle,

thank you for writing back, I have a couple of questions in reply.

btw. are you on irc.freenode.net?  I'm `mariotomo' there.  and I just 
joined `#org-mode'.  I don't think that my terminal will ring a bell if 
I'm mentioned there.


On 30/05/2020 01:22, Kyle Meyer wrote:

Mario Frasca writes:


[…]

Thanks for the patch and for clearly describing the motivation.  I'm not
an org-plot user, but the change sounds useful.  (It'd be great if
org-plot users could chime in.)


thank you for taking the time to review!



Two meta-comments:

   * Please provide a patch with a commit message.  See
  for more information.

   * The link above also explains the copyright assignment requirement
 for contributions.  Please consider assigning copyright to the FSF.


I'm editing in my cloned repository, and committing often, so I do not 
have a single commit, consequently also not a single commit message.


I just sent my form request to ass...@gnu.org.



diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index a23195d2a..87a415137 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -179,6 +179,28 @@ and dependent variables."
  (setf back-edge "") (setf front-edge ""
  row-vals))
  
+(defun org-plot/zip-deps-with (num-cols ind deps with)

+  "describe each column to be plotted as (col . with)"

This doesn't match the convention used in this code base for docstrings.
Taking a look around should give you a good sense, but (1) the first
word should be capitalized, (2) sentences should end with a period, and
(3) ideally all parameters should be described in the docstring.


ok, 1 and 2 are just consequence of my usual way of typing, however 
wrong, I will fix them.  3 I didn't consider.  useful point.






+  ;; make 'deps explicit

I think this and the other comments in this function could safely be
dropped.


:+1:



+  (unless deps
+(setf deps (let (r)
+(dotimes (i num-cols r)
+  (unless (eq num-cols (+ ind i))
+(setq r (cons (- num-cols i) r)))

[…] using setq unless setf is needed would be more
consistent with this code base.


the "unless needed" makes me suspect I should read what's the difference.



The code above looks fine to me.  Another option would be to use
number-sequence and then filter out the ind value.


no, that would break functionality: I need to keep the given order.

btw my patch allows you to use the same column more than once.





+  ;; invoke zipping function on converted data
+  (org-plot/zip deps with))
+
+(defun org-plot/zip (xs ys)
+  (unless
+  (null xs)
+(cons (cons (car xs) (or (car ys) "lines"))

Is the "lines" fall back ever reached?  It looks like you're extending
`with' above to be the same length as `deps`.


it is needed: I'm not extending any `with' given as a non-empty list.

but I should be using some settings, some global default `with' value, 
which I don't know where to find.  hard coding "lines" can't be the 
right thing to do.



+ (org-plot/zip (cdr xs) (cdr ys)

In Elisp, it's not very common to use recursive functions (and there's
no TCO).  In the case of zipping two lists, I think it'd probably be
easiest to just use cl-loop.  And in my view having a separate function
here is probably an overkill.


I'm not sure about the TCO (in other words: I haven't the faintest idea 
what you mean by that), and I would not know how to write this using 
`cl-loop'.  I'll have a look though.




  (defun org-plot/gnuplot-script (data-file num-cols params  preface)
"Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
  NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -240,22 +262,22 @@ manner suitable for prepending to a user-specified 
script."
   "%Y-%m-%d-%H:%M:%S") "\"")))
  (unless preface
(pcase type ; plot command
-   (`2d (dotimes (col num-cols)
-  (unless (and (eq type '2d)
-   (or (and ind (equal (1+ col) ind))
-   (and deps (not (member (1+ col) deps)
-(setf plot-lines
-  (cons
-   (format plot-str data-file
-   (or (and ind (> ind 0)
-(not text-ind)
-(format "%d:" ind)) "")
-   (1+ col)
-   (if text-ind (format ":xticlabel(%d)" ind) "")
-   with
-   (or (nth col col-labels)
-   (format "%d" (1+ col
-   plot-lines)
+   (`2d (dolist
+(col-with
+ (org-plot/zip-deps-with num-cols ind deps with))
+  (setf plot-lines
+(cons
+ 

nondeterministic org-test-with-temp-text?

2020-05-30 Thread Kevin Liu
I’m trying to add a test (which should fail at the moment, representing
an org-mode bug), but it seems like each ‘should’ form is actually
nondeterministic.  The first form returns nil on the first eval and t on
subsequent evals, its behavior resetting upon any command, and the
second form does the inverse, returning t on the first eval and nil on
subsequent evals.

Is this behavior expected?

(ert-deftest test-org/org-next-visible-heading ()
  (should
   (org-test-with-temp-text "* A\n** B\n\n\n* C"
 (org-overview)
 (org-cycle)
 (org-cycle)
 (org-next-visible-heading 1)
 (and (bolp) (org-at-heading-p
  (should
   (org-test-with-temp-text "* A\n** B\n\n\n* C"
 (org-overview)
 (org-cycle)
 (org-cycle)
 (org-cycle)
 (org-next-visible-heading 1)
 (and (bolp) (org-at-heading-p)



Re: [PATCH] Fix org-narrow-to-subtree smaller than subtree

2020-05-30 Thread Kevin Liu

Oh, of course I attached the wrong patch again.  Wish mu4e-compose could 
preview these.

>From 5f7cf68f92d3fa82d01646f7f1e12a4d18bad2fb Mon Sep 17 00:00:00 2001
From: nivekuil 
Date: Sat, 30 May 2020 00:11:19 -0700
Subject: [PATCH] Make narrowed subtree same size as the subtree, not 1 char
 less

Right now a narrowed subtree is one char smaller than the actual
subtree.  (org-mark-element) on a narrowed subtree will select a
region 1 char out of bounds, for example.  There doesn't seem like a
good reason for this to be the case.

* lisp/org.el (org-toggle-narrow-to-subtree):  Just
use (org-end-of-subtree) as the end of the subtree.
* testing/lisp/test-ob.el (test-ob/parse-header-args2):  Since we're no
longer subtracting the narrowed subtree size by 1, the subtree text
here is now 1 character longer.  I think this is reasonable and
shouldn't be surprising enough to ruin anyone's day.  If it isn't,
then (org-end-of-subtree) should be changed rather than org-narrow-to-subtree.
* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
(test-org-datetree/find-iso-week-create):  No more double
newlines between months in datetree, but this just seems like
incidental behavior more than deliberate behavior to begin with.
---
 lisp/org.el   | 4 +---
 testing/lisp/test-ob.el   | 2 +-
 testing/lisp/test-org-datetree.el | 4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0808fc210..f69919b20 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7748,9 +7748,7 @@ If yes, remember the marker and the distance to BEG."
   (org-with-limited-levels
(narrow-to-region
 	(progn (org-back-to-heading t) (point))
-	(progn (org-end-of-subtree t t)
-	   (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
-	   (point)))
+	(progn (org-end-of-subtree t t) (point)))
 
 (defun org-toggle-narrow-to-subtree ()
   "Narrow to the subtree at point or widen a narrowed buffer."
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 7c44622ef..2a2a66952 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -233,7 +233,7 @@ this is simple"
 (should (string-match (regexp-quote "this is simple")
 			  (org-babel-ref-resolve "simple-subtree")))
 (org-babel-next-src-block)
-(should (= 14 (org-babel-execute-src-block)
+(should (= 15 (org-babel-execute-src-block)
 
 (ert-deftest test-ob/inline-src-blocks ()
   (should
diff --git a/testing/lisp/test-org-datetree.el b/testing/lisp/test-org-datetree.el
index 5557d5e23..f7247766a 100644
--- a/testing/lisp/test-org-datetree.el
+++ b/testing/lisp/test-org-datetree.el
@@ -58,7 +58,7 @@
   ;; Sort new entry in right place.
   (should
(string-match
-"\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'"
+"\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'"
 (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day"
   (let ((org-datetree-add-timestamp nil))
 	(org-datetree-find-date-create '(3 29 2012))
@@ -161,7 +161,7 @@
   ;; Sort new entry in right place.
   (should
(string-match
-"\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\n\\*\\* 2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
+"\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\\*\\* 2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
 (org-test-with-temp-text "* 2015"
   (let ((org-datetree-add-timestamp nil))
 	(org-datetree-find-iso-week-create '(9 1 2015))
-- 
2.26.2



[PATCH] Fix org-narrow-to-subtree smaller than subtree

2020-05-30 Thread Kevin Liu
I noticed that when I narrow to a subtree and then hit org-mark-element,
I can’t kill the text because the narrow is actually 1 char smaller.
This seemed like an unpleasant workaround, and I think the behavior can
be changed without any real negative consequences.

>From 61260469a9ad37ad4011cc489dc4372b02491b4d Mon Sep 17 00:00:00 2001
From: nivekuil 
Date: Tue, 26 May 2020 23:17:43 -0700
Subject: [PATCH] Narrow to whole subtree instead of 1 char less

---
 lisp/org.el   | 1 -
 testing/lisp/test-org-datetree.el | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0808fc210..e9771512d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7749,7 +7749,6 @@ If yes, remember the marker and the distance to BEG."
(narrow-to-region
 	(progn (org-back-to-heading t) (point))
 	(progn (org-end-of-subtree t t)
-	   (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
 	   (point)))
 
 (defun org-toggle-narrow-to-subtree ()
diff --git a/testing/lisp/test-org-datetree.el b/testing/lisp/test-org-datetree.el
index 5557d5e23..f7247766a 100644
--- a/testing/lisp/test-org-datetree.el
+++ b/testing/lisp/test-org-datetree.el
@@ -58,7 +58,7 @@
   ;; Sort new entry in right place.
   (should
(string-match
-"\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'"
+"\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'"
 (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day"
   (let ((org-datetree-add-timestamp nil))
 	(org-datetree-find-date-create '(3 29 2012))
@@ -161,7 +161,7 @@
   ;; Sort new entry in right place.
   (should
(string-match
-"\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\n\\*\\* 2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
+"\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\\*\\* 2015-W36\n\\*\\*\\* 2015-09-01 .*\\'"
 (org-test-with-temp-text "* 2015"
   (let ((org-datetree-add-timestamp nil))
 	(org-datetree-find-iso-week-create '(9 1 2015))
-- 
2.26.2



Re: Splitting large org file into smaller ones

2020-05-30 Thread Marcin Borkowski


On 2020-05-30, at 11:51, Marvin M. Doyley  wrote:

> Hi there,
>
> Is there an efficient way to split a large org file into smaller ones?

I do not know about "efficient", but you might find my org-one-to-many
library useful: https://github.com/mbork/org-one-to-many
(Note that I don't wven know if it works with newer versions of Org; if
not, drop me a line, maybe I'll be able to fix it.)

Best,

-- 
Marcin Borkowski
http://mbork.pl



Using est+ with effort estimate range

2020-05-30 Thread Axel Kielhorn
Hello,

according to the manual, there is a special column type for column view

‘est+’  Add low-high estimates.

This is explained later:

The ‘est+’ summary type requires further explanation. It is used for combining 
estimates, expressed as low-high ranges. For example, instead of estimating a 
particular task will take 5 days, you might estimate it as 5–6 days if you’re 
fairly confident you know how much work is required, or 1–10 days if you do not 
really know what needs to be done. Both ranges average at 5.5 days, but the 
first represents a more predictable delivery.

But I’m not able to define a range.

** Arbeitszeiten planen und erfassen
:PROPERTIES:
:COLUMNS:  %50ITEM(Aufgabe) %11TODO(Status) %EFFORT{est+} %CLOCKSUM
:ID: Arbeitszeiten
:END:

*** Aufgabe 2 [0/1]

 TODO Unteraufgabe 1
:PROPERTIES:
:EFFORT:   3-5 h
:END:

What is the correct format to define a range?

Thanks for your help.

Greetings
Axel





Splitting large org file into smaller ones

2020-05-30 Thread Marvin M. Doyley
Hi there,

Is there an efficient way to split a large org file into smaller ones?

Lets say I have a master file with the following


* Notes
**  Candidate A
 - Strong technical background
 - High H-factor
 - good funding
- More established investigator
- Huge startup need $$

**  Candidate B
- lower startup need
- signal processing  
- young investigator


How do I export the subtree to separate org files, say

- Candidate-a.org 
- Candidate-b.org 


Thanks

M

Re: Bug: babel python html export error [9.3.6 (9.3.6-25-g685b2c-elpaplus @ /home/johannes/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200330/)]

2020-05-30 Thread Johannes Wasmer
Okay, thank you Nicolas. I will let you know if I find something out.
Best, Johannes

Am Sa., 16. Mai 2020 um 19:06 Uhr schrieb Nicolas Goaziou <
m...@nicolasgoaziou.fr>:

> Hello,
>
> Johannes Wasmer  writes:
>
> > I have a very simple test.org file with the content:
> >
> > #+begin_src python
> > return 2+2
> > #+end_src
> >
> > #+RESULTS:
> > : 4
> >
> > When I export this to PDF via ~C-e l p~, I get the PDF with both the
> > code and the output.
> > But when I export to HTML via ~C-e h h~, I get no file.
>
> FWIW, I cannot reproduce it.
>
> > In the *Messages* buffer, I find the following error message:
> > org-babel-exp process python at position 3...
> > Can’t guess python-indent-offset, using defaults: 4
> > pythonic-python-readable-file-name: Wrong type argument: stringp, nil
> >
> > Note: python code evaluation works fine (also with :exports both). Only
> > the HTML export does not work.
> > So this bug is very specific to babel python HTML export.
> > The Python version used is 3.7.4.
> > Thank you for any pointers on how to resolve this.
>
> It may be specific to the package providing
> `pythonic-python-readable-file-name' instead. I suggest to look there.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: `with` as a list.

2020-05-30 Thread Kyle Meyer
Mario Frasca writes:

> now and then I use emacs to make graphs.  now recently I was plotting 
> point data, and a running average "fit", so I wanted to have points, and 
> lines, which I know it's possible in `gnuplot` but now how do I do that 
> from org-plot …
>
> I wrote a small patch for org-plot.el, I'm not a Lisp programmer so I'm 
> sure the patch looks terrible, but it does allow me to do this:
>
> #+PLOT: ind:1 deps:(3 6 4 7) with:(points lines points lines)
>
> it's two additions: [...]

Thanks for the patch and for clearly describing the motivation.  I'm not
an org-plot user, but the change sounds useful.  (It'd be great if
org-plot users could chime in.)

Two meta-comments:

  * Please provide a patch with a commit message.  See
 for more information.

  * The link above also explains the copyright assignment requirement
for contributions.  Please consider assigning copyright to the FSF.

> diff --git a/lisp/org-plot.el b/lisp/org-plot.el
> index a23195d2a..87a415137 100644
> --- a/lisp/org-plot.el
> +++ b/lisp/org-plot.el
> @@ -179,6 +179,28 @@ and dependent variables."
> (setf back-edge "") (setf front-edge ""
>  row-vals))
>  
> +(defun org-plot/zip-deps-with (num-cols ind deps with)
> +  "describe each column to be plotted as (col . with)"

This doesn't match the convention used in this code base for docstrings.
Taking a look around should give you a good sense, but (1) the first
word should be capitalized, (2) sentences should end with a period, and
(3) ideally all parameters should be described in the docstring.

> +  ;; make 'deps explicit

I think this and the other comments in this function could safely be
dropped.

> +  (unless deps
> +(setf deps (let (r)
> +  (dotimes (i num-cols r)
> +(unless (eq num-cols (+ ind i))
> +  (setq r (cons (- num-cols i) r)))

Hmm, org-plot does seem to use setf a lot (more than any other .el file
in the repo), though using setq unless setf is needed would be more
consistent with this code base.

The code above looks fine to me.  Another option would be to use
number-sequence and then filter out the ind value.

> +  ;; make sure 'with matches 'deps
> +  (unless with
> +(setf with "lines"))
> +  (unless (listp with)
> +(setf with (mapcar (lambda (x) with) deps)))

This is make-list in the more recent diff you sent, which I agree is
better.

> +  ;; invoke zipping function on converted data
> +  (org-plot/zip deps with))
> +
> +(defun org-plot/zip (xs ys)
> +  (unless
> +  (null xs)
> +(cons (cons (car xs) (or (car ys) "lines"))

Is the "lines" fall back ever reached?  It looks like you're extending
`with' above to be the same length as `deps`.

> +   (org-plot/zip (cdr xs) (cdr ys)

In Elisp, it's not very common to use recursive functions (and there's
no TCO).  In the case of zipping two lists, I think it'd probably be
easiest to just use cl-loop.  And in my view having a separate function
here is probably an overkill.

>  (defun org-plot/gnuplot-script (data-file num-cols params  preface)
>"Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
>  NUM-COLS controls the number of columns plotted in a 2-d plot.
> @@ -240,22 +262,22 @@ manner suitable for prepending to a user-specified 
> script."
>  "%Y-%m-%d-%H:%M:%S") "\"")))
>  (unless preface
>(pcase type; plot command
> - (`2d (dotimes (col num-cols)
> -(unless (and (eq type '2d)
> - (or (and ind (equal (1+ col) ind))
> - (and deps (not (member (1+ col) deps)
> -  (setf plot-lines
> -(cons
> - (format plot-str data-file
> - (or (and ind (> ind 0)
> -  (not text-ind)
> -  (format "%d:" ind)) "")
> - (1+ col)
> - (if text-ind (format ":xticlabel(%d)" ind) "")
> - with
> - (or (nth col col-labels)
> - (format "%d" (1+ col
> - plot-lines)
> + (`2d (dolist
> +  (col-with
> +   (org-plot/zip-deps-with num-cols ind deps with))
> +(setf plot-lines
> +  (cons
> +   (format plot-str data-file
> +   (or (and ind (> ind 0)
> +(not text-ind)
> +(format "%d:" ind)) "")
> +   (car col-with)
> +   (if text-ind (format ":xticlabel(%d)" ind) "")
> +   (cdr col-with)
> +   (or (nth (1- (car col-with))
> +

Re: [Feature] add a new org-attach dispatcher command to offline save web page

2020-05-30 Thread Ihor Radchenko
> AFAICT, org-board uses the following options, which limit the archiving
> to a single page and all its resources:
>
> wget -e robots=off --page-requisites --adjust-extension --convert-links [...]

This is certainly better. I believe that wget would be a better default
(with right flags). It is much more likely to be installed for average
user.

> You can also create a warc (web archive) file with wget, but then you
> need a web archive replayer to view it, which is not exactly convenient.

Interesting. I did not know about warc.

Matthew Lundin  writes:

> Ihor Radchenko  writes:
>
>>> As I said, PATCH welcome, I admired many times I don't have ability to 
>>> build a
>>> complex archive functionality on url.el or wget or curl.
>>
>> I have found the following solution [1] using wget:
>>
>> wget --mirror -p --convert-links -P ./LOCAL-DIR WEBSITE-URL
>>
>
> I don't think --mirror is what we want this context, since that will
> initiate a recursive download of the entire site. (Ironically, my IP is
> now banned from a personal blog that provides a how-to for using wget
> after I tried to run the above command on it.) From the wget manual:
>
> -m
> --mirror
> Turn on options suitable for mirroring.  This option turns on 
> recursion and
> time-stamping, sets infinite recursion depth and keeps FTP directory 
> listings.
> It is currently equivalent to -r -N -l inf --no-remove-listing.
>
> AFAICT, org-board uses the following options, which limit the archiving
> to a single page and all its resources:
>
> wget -e robots=off --page-requisites --adjust-extension --convert-links [...]
>
>> This will not bundle the page into a single file, but it is better than
>> nothing. org-attach does not have to attach exactly one file.
>
> You can also create a warc (web archive) file with wget, but then you
> need a web archive replayer to view it, which is not exactly convenient.
>
> Best,
>
> Matt
>

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg



bug#41584: 26.3; org-indent-mode's line-prefix text property flickers near overlays

2020-05-30 Thread Eli Zaretskii
> From: Kévin Le Gouguec 
> Cc: 41584-d...@debbugs.gnu.org,  dgu...@yandex.ru
> Date: Fri, 29 May 2020 22:32:11 +0200
> 
> (I guess xdisp.c is something we won't to touch with a 10-foot pole on
> the release branch, especially for a bug that users have lived with for
> so long?)

Exactly.