Re: Manual 2.2.2 and 16.7 needs to amended

2020-05-13 Thread Kyle Meyer
Charles Millar writes:

> I think the following changes are required: in the manual, if they 
> already have not been made in the past few hours:
>
> 2.2.2
> When Emacs first visits an Org file, the global state is set to
> SHOWEVERYTHING, i.e., all file content is visible(1).
>
> (No idea if the footnote needs to be changed.)

The footnote looks okay. It's about org-agenda-inhibit-startup and isn't
dependent on the default value of org-startup-folded.

> Likewise in section 16.7 the explanation for #+STARTUP, to wit:
>
> responding variable for global default
> settings is ‘org-startup-folded’ with a default value of ‘t’, which
> is the same as ‘overview’.
>
> needs amendment to reflect the current change in default visibility 
> behavior.

I've updated the two spots you mentioned (cd2b108d2).  Thanks.



Re: [RFC] Let Org Mode's completion support all Babel header arguments

2020-05-13 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Add a test for Babel src block languages and header arguments.
>
> Thank you.

Glad this test is simple to write and passed.

>
>> I'm wandering how to complete header argument values? Do you have any
>> hints?
>
> You can use, again, `org-babel-common-header-args-w-values' for some
> parameters. However, most of them specify `:any', which means the value
> can be anything, and, therefore, cannot be completed.

I see. Thanks.

>
> You may want to have a look at `org-lint-wrong-header-value' for an
> example on how to treat
>
>> +(ert-deftest test-org-pcomplete/src-block ()
>> +  "Test Babel src block header arguments completion."
>
> "source block" instead of "src block".

Fixed

>
>> +  (should
>> +   (string-prefix-p
>> +"#+begin_src emacs-lisp"
>> +(org-test-with-temp-text "#+begin_src emac"
>> +  (pcomplete)
>> +  (buffer-string))
>> +t))
>
> You can remove the t

Done.

>
>> +  (should
>> +   (string-prefix-p
>> +"#+begin_src emacs-lisp :session"
>> +(org-test-with-temp-text "#+begin_src emacs-lisp :sess"
>> +  (pcomplete)
>> +  (buffer-string))
>> +t)))
>
> Ditto.

Ditto.

I attached the new patch.

>
> Regards,


-- 
[ 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
  
From 5b0e7bb971d1459bc1247ce14bec49d897aa2fa5 Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Tue, 12 May 2020 21:44:04 +0800
Subject: [PATCH] org-pcomplete.el: improve header arguments completion

* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): Make it
complete real all available header arguments like command
`org-babel-insert-header-arg'.

* testing/lisp/test-org-pcomplete.el (test-org-pcomplete/src-block):
Test Babel source block language and header arguments completing.
---
 lisp/org-pcomplete.el  | 16 +++-
 testing/lisp/test-org-pcomplete.el | 15 +++
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index 28b40fadd..65651512a 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -418,11 +418,17 @@ (defun pcomplete/org-mode/block-option/src ()
 (symbol-plist
  'org-babel-load-languages)
 'custom-type)))
-  (while (pcomplete-here
-	  '("-n" "-r" "-l"
-	":cache" ":colnames" ":comments" ":dir" ":eval" ":exports"
-	":file" ":hlines" ":no-expand" ":noweb" ":results" ":rownames"
-	":session" ":shebang" ":tangle" ":tangle-mode" ":var"
+  (let* ((info (org-babel-get-src-block-info 'light))
+	 (lang (car info))
+	 (lang-headers (intern (concat "org-babel-header-args:" lang)))
+	 (headers (org-babel-combine-header-arg-lists
+		   org-babel-common-header-args-w-values
+		   (and (boundp lang-headers) (eval lang-headers t)
+(while (pcomplete-here
+	(append (mapcar
+		 (lambda (arg) (format ":%s" (symbol-name (car arg
+		 headers)
+		'("-n" "-r" "-l"))
 
 (defun pcomplete/org-mode/block-option/clocktable ()
   "Complete keywords in a clocktable line."
diff --git a/testing/lisp/test-org-pcomplete.el b/testing/lisp/test-org-pcomplete.el
index e6b0e8a7e..2de4f4934 100644
--- a/testing/lisp/test-org-pcomplete.el
+++ b/testing/lisp/test-org-pcomplete.el
@@ -75,6 +75,21 @@ (ert-deftest test-org-pcomplete/keyword ()
   (buffer-string))
 t)))
 
+(ert-deftest test-org-pcomplete/src-block ()
+  "Test Babel source block header arguments completion."
+  (should
+   (string-prefix-p
+"#+begin_src emacs-lisp"
+(org-test-with-temp-text "#+begin_src emac"
+  (pcomplete)
+  (buffer-string
+  (should
+   (string-prefix-p
+"#+begin_src emacs-lisp :session"
+(org-test-with-temp-text "#+begin_src emacs-lisp :sess"
+  (pcomplete)
+  (buffer-string)
+
 (ert-deftest test-org-pcomplete/link ()
   "Test link completion"
   (should
-- 
2.26.2



signature.asc
Description: PGP signature


Re: [PATCH 0/1] Fix various typos

2020-05-13 Thread Kyle Meyer
Jonas Bernoulli writes:

> There isn't much to be said about the typo fixes in the attached patch.
>
> However, I noticed a few more typos, which I did not fix:
>
> * In CONTRIBUTE several occurances of "maintainance" should be
>   replaced with "maintenance".  One of them occurs in a URL to
>   a Worg page, which has to be renamed at the same time.

I'll try to fix those in step, perhaps seeing if I can add the old name
as a link pointing to the corrected name for posterity, though I don't
think it matters much for these particular pages.

> * One of the suggested values for `org-s5-control-visibility'
>   is `visibile'.  The correct spelling is "visible".  The value
>   is ultimately used like so:
>
>   (format ""
>   (plist-get info :s5-control-visibility))
>
>   I don't know whether this has to be misspelled to function as
>   expected, so I did't fix the typo.

I don't know either.  I recall this one from your last typo series.  At
the time, I cc'd the author, but I guess nothing came of that:

https://yhetil.org/orgmode/875zjj30uc@kyleam.com

I suspect the typo means things are broken.  Can some kind org-s5 user
out there check?

>  contrib/lisp/org-depend.el | 4 ++--
>  doc/org-manual.org | 2 +-
>  lisp/org-clock.el  | 2 +-
>  lisp/org.el| 2 +-
>  mk/server.mk   | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)

Applied (71604cbc2).  Thanks.



[SOLVED] Re: Babel cached result active timestamps cause headline displayed in Org Agenda

2020-05-13 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> I agree, this angle brackets is unnecessary.
>
> OK. Thank you for the feedback.
>
>   #+RESULTS[2020-05-12 13:24:05 808b...]:
>
> is not possible, because 
>
>   [2020-05-12 13:24:05 808b...]
>
> is an inactive time stamp.
>
> So, in master, this is now:
>
>   [(2020-05-12 13:24:05) 808b...]

This is acceptable too. Thanks, Nicolas.

>
> Regards,


- -- 
[ 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-

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68tr0UHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsORdgf+Ly8N6xEztkUc/4xeKjjX8sAmOWRL
bwl8g9ryOMCoe3mfF8H+8SVhJ08Y9z048i//jAIy/xQIxkA+9nLOpmixkVSHvOAe
YKgwKM9qX3zKyovjab9Bm6vSUHOR0mMlE0QeO15iRs6wSlKksls8JPXzIiUNpAHZ
1gwemCBKo+wX4S2G+YZG+GM4p/4m7RnVosR3+4Lsr6XxYdvjRIfp01NELOJPi2aC
doyWLqIchB4/L/j6zy40tpwMCYZTUNPE5s3bZw+StspxZIryBnQwd5mXVDfcaWJo
9AGd+Y+fyLOyp7Z1SmbA+peOIk4PsVIgNXruKCJIVemE+cn0u3x3fpTS4A==
=Z7Nu
-END PGP SIGNATURE-



Re: Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Nick Dokos
Charles Millar  writes:

> Hi,
>
> In the last two or three days, all my org files open as if I have set 
> the visibility in every file to
>
> #+STARTUP: showeverything
>
> Org mode version 9.3.6 (release_9.3.6-619-g434940 @ 
> /usr/local/share/org-mode/lisp/)
> GNU Emacs 28.0.50 (build 123, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
> cairo version 1.16.0) of 2020-05-13
>
> As far as I recall, I have not changed any settings in my init or elsewhere.
>
> Charlie Millar
>
>

That is correct. It's been discussed in the list and Nicolas announced that it's
been merged into master on Tuesday. Look for the thread entitled

   [RFC] Change default value for `org-startup-folded'?

It can also be found at 


C-h v org-startup-folded RET

You can get the previous default by setting it to t in your init file.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[PATCH 1/1] Fix typos

2020-05-13 Thread Jonas Bernoulli
---
 contrib/lisp/org-depend.el | 4 ++--
 doc/org-manual.org | 2 +-
 lisp/org-clock.el  | 2 +-
 lisp/org.el| 2 +-
 mk/server.mk   | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/org-depend.el b/contrib/lisp/org-depend.el
index b727acece..263cd7175 100644
--- a/contrib/lisp/org-depend.el
+++ b/contrib/lisp/org-depend.el
@@ -210,7 +210,7 @@ (defun org-depend-trigger-todo (change-plist)
 (pos (plist-get change-plist :position))
 (from (plist-get change-plist :from))
 (to (plist-get change-plist :to))
-(org-log-done nil) ; IMPROTANT!: no logging during automatic trigger!
+(org-log-done nil) ; IMPORTANT!: no logging during automatic trigger!
 trigger triggers tr p1 p2 kwd id)
 (catch 'return
   (unless (eq type 'todo-state-change)
@@ -367,7 +367,7 @@ (defun org-depend-block-todo (change-plist)
 (pos (plist-get change-plist :position))
 (from (plist-get change-plist :from))
 (to (plist-get change-plist :to))
-(org-log-done nil) ; IMPROTANT!: no logging during automatic trigger
+(org-log-done nil) ; IMPORTANT!: no logging during automatic trigger
 blocker blockers bl p1 p2
 (proceed-p
  (catch 'return
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 3905da112..f57a97593 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -21752,7 +21752,7 @@ In-Buffer Settings]]).
 
 [fn:142] For shell source blocks, the default is to return the output.
 If you want to enforce returning the exit status, add =:results value=
-explicitely.
+explicitly.
 
 [fn:143] C++ language is handled in =ob-C.el=.  Even though the
 identifier for such source blocks is =C++=, you activate it by loading
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 34179096d..0dca790c0 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1425,7 +1425,7 @@ (defun org-clock-auto-clockout ()
   "Clock out the currently clocked in task if Emacs is idle.
 See `org-clock-auto-clockout-timer' to set the idle time span.
 
-Thie is only effective when `org-clock-auto-clockout-insinuate'
+This is only effective when `org-clock-auto-clockout-insinuate'
 is present in the user configuration."
   (when (and (numberp org-clock-auto-clockout-timer)
 org-clock-current-task)
diff --git a/lisp/org.el b/lisp/org.el
index ef2e61916..be1d1c701 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16236,7 +16236,7 @@ (defcustom org-display-remote-inline-images 'skip
 skipDon't display remote images.
 downloadAlways download and display remote images.
 cache   Display remote images, and open them in separate buffers
-for cacheing.  Silently update the image buffer when a file
+for caching.  Silently update the image buffer when a file
 change is detected."
   :group 'org-appearance
   :package-version '(Org . "9.4")
diff --git a/mk/server.mk b/mk/server.mk
index 2c5294507..30bc3b858 100644
--- a/mk/server.mk
+++ b/mk/server.mk
@@ -15,7 +15,7 @@ help helpall helpserver::
$(info release - clean up, create the distribution archives)
$(info elpa- clean up, create the org-*.tar ELPA 
archive)
$(info elpaplus- clean up, create the 
org-plus-contrib-*.tar ELPA archive)
-   $(info upload-release  - clean up, populate the server with arhives)
+   $(info upload-release  - clean up, populate the server with 
archives)
$(info upload-elpa - clean up, populate the server with 
org-*.tar)
$(info upload-elpaplus - clean up, populate the server with 
org-plus-contrib-*.tar)
$(info upload-doc  - clean up, populate the server with docs)
-- 
2.26.0




Manual 2.2.2 and 16.7 needs to amended

2020-05-13 Thread Charles Millar
I think the following changes are required: in the manual, if they 
already have not been made in the past few hours:


2.2.2
When Emacs first visits an Org file, the global state is set to
SHOWEVERYTHING, i.e., all file content is visible(1).

(No idea if the footnote needs to be changed.)

Likewise in section 16.7 the explanation for #+STARTUP, to wit:

responding variable for global default
settings is ‘org-startup-folded’ with a default value of ‘t’, which
is the same as ‘overview’.

needs amendment to reflect the current change in default visibility 
behavior.


Current version Org mode version 9.3.6 (release_9.3.6-619-g434940 @ 
/usr/local/share/org-mode/lisp/)


Best,

Charlie



[PATCH 0/1] Fix various typos

2020-05-13 Thread Jonas Bernoulli
There isn't much to be said about the typo fixes in the attached patch.

However, I noticed a few more typos, which I did not fix:

* In CONTRIBUTE several occurances of "maintainance" should be
  replaced with "maintenance".  One of them occurs in a URL to
  a Worg page, which has to be renamed at the same time.

* One of the suggested values for `org-s5-control-visibility'
  is `visibile'.  The correct spelling is "visible".  The value
  is ultimately used like so:

  (format ""
  (plist-get info :s5-control-visibility))

  I don't know whether this has to be misspelled to function as
  expected, so I did't fix the typo.

Jonas Bernoulli (1):
  Fix typos

 contrib/lisp/org-depend.el | 4 ++--
 doc/org-manual.org | 2 +-
 lisp/org-clock.el  | 2 +-
 lisp/org.el| 2 +-
 mk/server.mk   | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.26.0




Setting org-export-headline-levels depending on export backend

2020-05-13 Thread Rafael


I would like to have an org document export nicely (including some
subtleties like theorems) to a latex document and to a beamer
presentation. I have been mostly successful using filters, but it would
help me a lot if there was some way to declare to use the #+option H:2
when exporting to beamer, and H:3 when exporting to latex. Thoughts?




Re: Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Charles Millar

Hoi Nicholas,

On 5/13/20 2:13 PM, Nicolas Goaziou wrote:

Hello,

Charles Millar  writes:


In the last two or three days, all my org files open as if I have set
the visibility in every file to

#+STARTUP: showeverything



[...]


As far as I recall, I have not changed any settings in my init or
elsewhere.


I changed `org-startup-folded' default value to `showeverything'
yesterday.

You may want to use:

   (setq org-startup-folded t)

to get the old behaviour back.


Thanks.

I did that already.

However, I still stand by comments that I forwarded in reply to Josiah's 
response. I do not believe that the original message was clear.


Charlie




Re: Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Charles Millar

On 5/13/20 1:58 PM, Josiah Schwab wrote:

As far as I recall, I have not changed any settings in my init or elsewhere.


The default was changed.  See

https://lists.gnu.org/archive/html/emacs-orgmode/2020-04/msg00452.html
https://lists.gnu.org/archive/html/emacs-orgmode/2020-05/msg00201.html

Josiah



Thank you.

I recall seeing these messages, but did not realize that this change was 
going to effect all org files and by default, use lots and lots of space 
when an org file is opened.


As dar as I am concerned,the past default was OK and it took only a 
brief time to learn the past behavior and the visibility settings on a 
per file basis.


I may be only a user but if I had I would have voted no.

Charlie Millar




Re: Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Nicolas Goaziou
Hello,

Charles Millar  writes:

> In the last two or three days, all my org files open as if I have set 
> the visibility in every file to
>
> #+STARTUP: showeverything
>

[...]

> As far as I recall, I have not changed any settings in my init or
> elsewhere.

I changed `org-startup-folded' default value to `showeverything'
yesterday.

You may want to use:

  (setq org-startup-folded t)

to get the old behaviour back.

Regards,

-- 
Nicolas Goaziou



Re: Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Josiah Schwab
> As far as I recall, I have not changed any settings in my init or elsewhere.

The default was changed.  See

https://lists.gnu.org/archive/html/emacs-orgmode/2020-04/msg00452.html
https://lists.gnu.org/archive/html/emacs-orgmode/2020-05/msg00201.html

Josiah



Bug - all org files open as if visibilty is set to "showeverything"

2020-05-13 Thread Charles Millar

Hi,

In the last two or three days, all my org files open as if I have set 
the visibility in every file to


#+STARTUP: showeverything


Org mode version 9.3.6 (release_9.3.6-619-g434940 @ 
/usr/local/share/org-mode/lisp/)
GNU Emacs 28.0.50 (build 123, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
cairo version 1.16.0) of 2020-05-13


As far as I recall, I have not changed any settings in my init or elsewhere.

Charlie Millar



Re: [RFC] Let Org Mode's completion support all Babel header arguments

2020-05-13 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> Add a test for Babel src block languages and header arguments.

Thank you.

> I'm wandering how to complete header argument values? Do you have any
> hints?

You can use, again, `org-babel-common-header-args-w-values' for some
parameters. However, most of them specify `:any', which means the value
can be anything, and, therefore, cannot be completed.

You may want to have a look at `org-lint-wrong-header-value' for an
example on how to treat

> +(ert-deftest test-org-pcomplete/src-block ()
> +  "Test Babel src block header arguments completion."

"source block" instead of "src block".

> +  (should
> +   (string-prefix-p
> +"#+begin_src emacs-lisp"
> +(org-test-with-temp-text "#+begin_src emac"
> +  (pcomplete)
> +  (buffer-string))
> +t))

You can remove the t

> +  (should
> +   (string-prefix-p
> +"#+begin_src emacs-lisp :session"
> +(org-test-with-temp-text "#+begin_src emacs-lisp :sess"
> +  (pcomplete)
> +  (buffer-string))
> +t)))

Ditto.

Regards,

-- 
Nicolas Goaziou



Re: get the body of a heading up to the next subheading

2020-05-13 Thread Ihor Radchenko
> I don't think there's anything built-in, no. I have needed this in
> various places, and did something similar to the above, except with a
> combination of `org-back-to-heading', `org-end-of-meta-data', then
> `outline-next-heading'. 

Hmm. I just noticed a reference to built-in
org-agenda-get-some-entry-text in the function I sent earlier.
I do not see why it cannot be used outside agenda. Maybe something like

(let ((org-agenda-entry-text-cleanup-hook nil))
(org-agenda-get-some-entry-text (point-marker) #x4000))


Eric Abrahamsen  writes:

> John Kitchin  writes:
>
>> Thanks! Here is what I am currently using:
>>
>> (defun canvas-org-get-heading-body ()
>>   "Return the body of the current heading up to the next heading."
>>   (interactive)
>>   (save-excursion
>> (unless (org-at-heading-p)
>>   (org-previous-visible-heading 1))
>> (org-end-of-meta-data)
>> (buffer-substring (point)
>>(progn (re-search-forward org-heading-regexp nil 'mv)
>>   (line-beginning-position)
>>
>> So far it gets what I want. I am pretty sure I have reinvented this,
>> maybe even from code I wrote before... I couldn't find my answer on SO
>> or my blog though.
>
> I don't think there's anything built-in, no. I have needed this in
> various places, and did something similar to the above, except with a
> combination of `org-back-to-heading', `org-end-of-meta-data', then
> `outline-next-heading'. 

-- 
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



Re: [Bug] org-store-link should not insert a document level ID property

2020-05-13 Thread Nicolas Goaziou
Matthew Lundin  writes:

> Nicolas Goaziou  writes:
>>
>> AFAIK, ID is associated to a file name, and possibly a location in it.
>> In this case, the ID is strictly equivalent to the file name, so why
>> bother?
>
> I'm not sure I understand the question. Are you asking: Why bother
> generating IDs at the top level of a file (which was the change Gustav
> introduced)? Or why bother turning off that behavior? I can't address
> the former question but I will address the latter. 

Sorry for not being clear. This was the first question. I don't
understand why we are generating an ID for the whole file.

> The main reason is that I find these IDs redundant and visually
> distracting. I can see how file IDs would be useful if one is
> constantly renaming files (or perhaps writing custom functions that
> convert files to entries and vice versa).

IIUC, currently, renaming the file breaks the association between the ID
and the file name. IOW, the ID is useless if you rename the file.

Regards,



Re: Babel cached result active timestamps cause headline displayed in Org Agenda

2020-05-13 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> I agree, this angle brackets is unnecessary.

OK. Thank you for the feedback.

  #+RESULTS[2020-05-12 13:24:05 808b...]:

is not possible, because 

  [2020-05-12 13:24:05 808b...]

is an inactive time stamp.

So, in master, this is now:

  [(2020-05-12 13:24:05) 808b...]

Regards,

-- 
Nicolas Goaziou



Re: get the body of a heading up to the next subheading

2020-05-13 Thread Eric Abrahamsen
John Kitchin  writes:

> Thanks! Here is what I am currently using:
>
> (defun canvas-org-get-heading-body ()
>   "Return the body of the current heading up to the next heading."
>   (interactive)
>   (save-excursion
> (unless (org-at-heading-p)
>   (org-previous-visible-heading 1))
> (org-end-of-meta-data)
> (buffer-substring (point)
> (progn (re-search-forward org-heading-regexp nil 'mv)
>(line-beginning-position)
>
> So far it gets what I want. I am pretty sure I have reinvented this,
> maybe even from code I wrote before... I couldn't find my answer on SO
> or my blog though.

I don't think there's anything built-in, no. I have needed this in
various places, and did something similar to the above, except with a
combination of `org-back-to-heading', `org-end-of-meta-data', then
`outline-next-heading'. 



Re: get the body of a heading up to the next subheading

2020-05-13 Thread John Kitchin
good point, thanks!

Here is a new version that might fail some other way!

(defun canvas-org-get-heading-body ()
  "Return the body of the current heading up to the next heading."
  (interactive)
  (save-excursion
(unless (org-at-heading-p)
  (org-previous-visible-heading 1))
(org-end-of-meta-data)
(buffer-substring (point)
 (progn (org-next-visible-heading 1) (point)



John

---
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



On Wed, May 13, 2020 at 10:42 AM Ihor Radchenko  wrote:

> > Thanks! Here is what I am currently using:
>
> Note that your code may fail if there is an inline task in the body.
>
> Best,
> Ihor
>
> John Kitchin  writes:
>
> > Thanks! Here is what I am currently using:
> >
> > (defun canvas-org-get-heading-body ()
> >   "Return the body of the current heading up to the next heading."
> >   (interactive)
> >   (save-excursion
> > (unless (org-at-heading-p)
> >   (org-previous-visible-heading 1))
> > (org-end-of-meta-data)
> > (buffer-substring (point)
> > (progn (re-search-forward org-heading-regexp nil 'mv)
> >(line-beginning-position)
> >
> > So far it gets what I want. I am pretty sure I have reinvented this,
> > maybe even from code I wrote before... I couldn't find my answer on SO
> > or my blog though.
> >
> > Ihor Radchenko  writes:
> >
> >> You may use something similar to org-quick-peek--get-entry-text from
> >> org-quick-peek package (https://github.com/alphapapa/org-quick-peek):
> >>
> >> (cl-defun org-quick-peek--get-entry-text (marker  keep-drawers
> keep-planning)
> >>   "Return Org entry text from node at MARKER.
> >> If KEEP-DRAWERS is non-nil, drawers will be kept, otherwise
> >> removed."
> >>   ;; Modeled after `org-agenda-get-some-entry-text'
> >>   (let (text)
> >> (with-current-buffer (marker-buffer marker)
> >>   ;; Get raw entry text
> >>   (org-with-wide-buffer
> >>(goto-char marker)
> >>;; Skip heading
> >>(end-of-line 1)
> >>;; Get entry text
> >>(setq text (buffer-substring
> >>(point)
> >>(or (save-excursion (outline-next-heading) (point))
> >>(point-max))
> >> (with-temp-buffer
> >>   (org-mode)
> >>   (insert text)
> >>   (unless keep-drawers
> >> (goto-char (point-min))
> >> (while (re-search-forward org-drawer-regexp nil t)
> >>   ;; Remove drawers
> >>   (delete-region (match-beginning 0)
> >>  (progn (re-search-forward
> >>  "^[ \t]*:END:.*\n?" nil 'move)
> >> (point)
> >>   (unless keep-planning
> >> (goto-char (point-min))
> >> (while (re-search-forward org-planning-line-re nil t)
> >>   ;; Remove planning line
> >>   (kill-whole-line)))
> >>   (setq text (buffer-substring (point-min) (point-max
> >> (-reduce-r #'funcall (reverse (cons text (cons #'identity
> org-quick-peek-filter-functions))
> >>
> >> Best,
> >> Ihor
> >>
> >> John Kitchin  writes:
> >>
> >>> Hi everyone,
> >>>
> >>> I am trying to get the body of a heading up to the next subheading. For
> >>> example with this org file,
> >>>
> >>> * quiz one
> >>>
> >>> This is the description.
> >>> Use emacs for this.
> >>>
> >>> ** question 1
> >>> what is 40 + 2
> >>>
> >>> If the point is in the first heading, I want to run a function that
> would
> >>> return the string "This is the description.\nUse emacs for this."
> >>>
> >>> I thought there was a simple way to do that, but so far it has eluded
> my
> >>> google fu. Any hints?
> >>>
> >>> John
> >>>
> >>> ---
> >>> 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
>
> --
> 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
>


Re: get the body of a heading up to the next subheading

2020-05-13 Thread Ihor Radchenko
> Thanks! Here is what I am currently using:

Note that your code may fail if there is an inline task in the body.

Best,
Ihor

John Kitchin  writes:

> Thanks! Here is what I am currently using:
>
> (defun canvas-org-get-heading-body ()
>   "Return the body of the current heading up to the next heading."
>   (interactive)
>   (save-excursion
> (unless (org-at-heading-p)
>   (org-previous-visible-heading 1))
> (org-end-of-meta-data)
> (buffer-substring (point)
> (progn (re-search-forward org-heading-regexp nil 'mv)
>(line-beginning-position)
>
> So far it gets what I want. I am pretty sure I have reinvented this,
> maybe even from code I wrote before... I couldn't find my answer on SO
> or my blog though.
>
> Ihor Radchenko  writes:
>
>> You may use something similar to org-quick-peek--get-entry-text from
>> org-quick-peek package (https://github.com/alphapapa/org-quick-peek):
>>
>> (cl-defun org-quick-peek--get-entry-text (marker  keep-drawers 
>> keep-planning)
>>   "Return Org entry text from node at MARKER.
>> If KEEP-DRAWERS is non-nil, drawers will be kept, otherwise
>> removed."
>>   ;; Modeled after `org-agenda-get-some-entry-text'
>>   (let (text)
>> (with-current-buffer (marker-buffer marker)
>>   ;; Get raw entry text
>>   (org-with-wide-buffer
>>(goto-char marker)
>>;; Skip heading
>>(end-of-line 1)
>>;; Get entry text
>>(setq text (buffer-substring
>>(point)
>>(or (save-excursion (outline-next-heading) (point))
>>(point-max))
>> (with-temp-buffer
>>   (org-mode)
>>   (insert text)
>>   (unless keep-drawers
>> (goto-char (point-min))
>> (while (re-search-forward org-drawer-regexp nil t)
>>   ;; Remove drawers
>>   (delete-region (match-beginning 0)
>>  (progn (re-search-forward
>>  "^[ \t]*:END:.*\n?" nil 'move)
>> (point)
>>   (unless keep-planning
>> (goto-char (point-min))
>> (while (re-search-forward org-planning-line-re nil t)
>>   ;; Remove planning line
>>   (kill-whole-line)))
>>   (setq text (buffer-substring (point-min) (point-max
>> (-reduce-r #'funcall (reverse (cons text (cons #'identity 
>> org-quick-peek-filter-functions))
>>
>> Best,
>> Ihor
>>
>> John Kitchin  writes:
>>
>>> Hi everyone,
>>>
>>> I am trying to get the body of a heading up to the next subheading. For
>>> example with this org file,
>>>
>>> * quiz one
>>>
>>> This is the description.
>>> Use emacs for this.
>>>
>>> ** question 1
>>> what is 40 + 2
>>>
>>> If the point is in the first heading, I want to run a function that would
>>> return the string "This is the description.\nUse emacs for this."
>>>
>>> I thought there was a simple way to do that, but so far it has eluded my
>>> google fu. Any hints?
>>>
>>> John
>>>
>>> ---
>>> 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

-- 
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



Re: get the body of a heading up to the next subheading

2020-05-13 Thread John Kitchin
Thanks! Here is what I am currently using:

(defun canvas-org-get-heading-body ()
  "Return the body of the current heading up to the next heading."
  (interactive)
  (save-excursion
(unless (org-at-heading-p)
  (org-previous-visible-heading 1))
(org-end-of-meta-data)
(buffer-substring (point)
  (progn (re-search-forward org-heading-regexp nil 'mv)
 (line-beginning-position)

So far it gets what I want. I am pretty sure I have reinvented this,
maybe even from code I wrote before... I couldn't find my answer on SO
or my blog though.

Ihor Radchenko  writes:

> You may use something similar to org-quick-peek--get-entry-text from
> org-quick-peek package (https://github.com/alphapapa/org-quick-peek):
>
> (cl-defun org-quick-peek--get-entry-text (marker  keep-drawers 
> keep-planning)
>   "Return Org entry text from node at MARKER.
> If KEEP-DRAWERS is non-nil, drawers will be kept, otherwise
> removed."
>   ;; Modeled after `org-agenda-get-some-entry-text'
>   (let (text)
> (with-current-buffer (marker-buffer marker)
>   ;; Get raw entry text
>   (org-with-wide-buffer
>(goto-char marker)
>;; Skip heading
>(end-of-line 1)
>;; Get entry text
>(setq text (buffer-substring
>(point)
>(or (save-excursion (outline-next-heading) (point))
>(point-max))
> (with-temp-buffer
>   (org-mode)
>   (insert text)
>   (unless keep-drawers
> (goto-char (point-min))
> (while (re-search-forward org-drawer-regexp nil t)
>   ;; Remove drawers
>   (delete-region (match-beginning 0)
>  (progn (re-search-forward
>  "^[ \t]*:END:.*\n?" nil 'move)
> (point)
>   (unless keep-planning
> (goto-char (point-min))
> (while (re-search-forward org-planning-line-re nil t)
>   ;; Remove planning line
>   (kill-whole-line)))
>   (setq text (buffer-substring (point-min) (point-max
> (-reduce-r #'funcall (reverse (cons text (cons #'identity 
> org-quick-peek-filter-functions))
>
> Best,
> Ihor
>
> John Kitchin  writes:
>
>> Hi everyone,
>>
>> I am trying to get the body of a heading up to the next subheading. For
>> example with this org file,
>>
>> * quiz one
>>
>> This is the description.
>> Use emacs for this.
>>
>> ** question 1
>> what is 40 + 2
>>
>> If the point is in the first heading, I want to run a function that would
>> return the string "This is the description.\nUse emacs for this."
>>
>> I thought there was a simple way to do that, but so far it has eluded my
>> google fu. Any hints?
>>
>> John
>>
>> ---
>> 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: [Bug] org-store-link should not insert a document level ID property

2020-05-13 Thread Matthew Lundin
Nicolas Goaziou  writes:

> Matthew Lundin  writes:
>
>> What I was thinking of in terms of configuration is being able to
>> preserve path-based links (instead of IDs) if creating a link above the
>> first headline. This is the behavior that existed in the past when
>> org-id-link-to-org-use-id was set to t or
>> 'create-if-interactive-and-no-custom-id.
>
> I don't understand what is the meaning of an ID property for a whole
> document. 
>
> AFAIK, ID is associated to a file name, and possibly a location in it.
> In this case, the ID is strictly equivalent to the file name, so why
> bother?

I'm not sure I understand the question. Are you asking: Why bother
generating IDs at the top level of a file (which was the change Gustav
introduced)? Or why bother turning off that behavior? I can't address
the former question but I will address the latter. The main reason is
that I find these IDs redundant and visually distracting. I can see how
file IDs would be useful if one is constantly renaming files (or perhaps
writing custom functions that convert files to entries and vice versa).
But in other ways they are more fragile than paths, since a :PROPERTIES:
drawer at the top of a file looks like clutter and is *very* tempting to
delete:

 beginning of file 
:PROPERTIES:
:ID:   d4ef67e6-ffcd-4df3-b821-b92c0138eb9c
:END:
#+FILETAGS: work inbox
#+CATEGORY: work
 file continues...

That said, I'm happy to hack together a personal solution by advising
org-id-store-link if we decide not to allow users to customize this
behavior.

Best,
Matt



Re: Babel cached result active timestamps cause headline displayed in Org Agenda

2020-05-13 Thread stardiviner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256


Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> For example an org file which is one of org-agenda-files contains this:
>>
>> #+begin_src org
>> ,#+begin_src emacs-lisp
>> org-babel-default-header-args:emacs-lisp
>> ,#+end_src
>>
>> ,#+RESULTS[<2020-05-12 13:24:05> 808b4ccafd1eda0937f8a1dc6d9b569e297d38c6]:
>> : ((:noweb . yes) (:results . value) (:lexical . no))
>>
>> #+end_src
>>
>> It will cause this headline entry displays in Org Agenda.
>>
>> I want Org to display active timestamp entries. But not cached result 
>> entries.
>>
>> This problem seems hard to decide. Does anyone has good solution?
>
> I think we can simply remove the angle brackets from the hash.
>
>   #+RESULTS[2020-05-12 13:24:05 808b4ccafd1eda0937f8a1dc6d9b569e297d38c6]:
>
> This should solve the problem. WDYT?

I agree, this angle brackets is unnecessary.

>
> Regards,


- -- 
[ 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-

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl67wLQUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNovwf/Q9dTegGzbDjUmy/mPF0JUzn3vgNj
PdnR58HFLVQb9sk/J8A/aPqTGIcqCqeC2F4qeO27IlqcoSyC2s6nMW+ue0VlY3ID
Z0B6Txt+y+cOXUfkzGgyCQcZWzsWaJ7m5lg4TlooPWeJc/Y5DW7NbTWqXw0CO+oX
/ryyi9y0ela7UANrdS5oju+PrT304AdP7M1hyvXrwGlDBKRlPxMrqPO0r/2B2fkr
gEVYp5d6RZOl9T5qaQA8M2DGkUd51g70mBTE+wCcga42A9M0slQs2x2TcNDLjb72
AXdQR1psh0EwS86a9fdoZ7Ex3aCZXv/qB+Pnznp+PZxj4rKWOssqQ4iEZg==
=ZmKh
-END PGP SIGNATURE-



Re: [RFC] Let Org Mode's completion support all Babel header arguments

2020-05-13 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Subject: [PATCH] org-pcomplete.el: improve header arguments completion
>
> Thank you. Some comments follow.
>
>> -  (while (pcomplete-here
>> -  '("-n" "-r" "-l"
>> -":cache" ":colnames" ":comments" ":dir" ":eval" ":exports"
>> -":file" ":hlines" ":no-expand" ":noweb" ":results" ":rownames"
>> -":session" ":shebang" ":tangle" ":tangle-mode" ":var"
>> +  (let* ((info (org-babel-get-src-block-info 'light))
>> + (lang (car info))
>> + (lang-headers (intern (concat "org-babel-header-args:" lang)))
>> + (headers (org-babel-combine-header-arg-lists
>> +   org-babel-common-header-args-w-values
>> +   (when (boundp lang-headers) (eval lang-headers t)
>
> (when ...)  -> (and (bounp lang-headers)) (symbol-value lang-headers)

Done.

>
>> +(while (pcomplete-here
>> +(mapcar
>> + (lambda (arg) (concat ":" (symbol-name (car arg
>
> (concat ...) -> (format ":%s" (car arg))

Fixed

>
>> + headers)
>
> It looks like you dropped the switches "-n", "-r", "-l".
>
> Also, could you add a few tests in "test-org-pcomplete.el"?

Add a test for Babel src block languages and header arguments.

I'm wandering how to complete header argument values? Do you have any hints?

>
> Regards,


-- 
[ 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
  
From 70232e4b1798725d81edab1dfd7984d41d120e0e Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Tue, 12 May 2020 21:44:04 +0800
Subject: [PATCH] org-pcomplete.el: improve header arguments completion

* lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): Make it
complete real all available header arguments like command
`org-babel-insert-header-arg'.
---
 lisp/org-pcomplete.el  | 16 +++-
 testing/lisp/test-org-pcomplete.el | 17 +
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index 28b40fadd..65651512a 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -418,11 +418,17 @@ (defun pcomplete/org-mode/block-option/src ()
 (symbol-plist
  'org-babel-load-languages)
 'custom-type)))
-  (while (pcomplete-here
-	  '("-n" "-r" "-l"
-	":cache" ":colnames" ":comments" ":dir" ":eval" ":exports"
-	":file" ":hlines" ":no-expand" ":noweb" ":results" ":rownames"
-	":session" ":shebang" ":tangle" ":tangle-mode" ":var"
+  (let* ((info (org-babel-get-src-block-info 'light))
+	 (lang (car info))
+	 (lang-headers (intern (concat "org-babel-header-args:" lang)))
+	 (headers (org-babel-combine-header-arg-lists
+		   org-babel-common-header-args-w-values
+		   (and (boundp lang-headers) (eval lang-headers t)
+(while (pcomplete-here
+	(append (mapcar
+		 (lambda (arg) (format ":%s" (symbol-name (car arg
+		 headers)
+		'("-n" "-r" "-l"))
 
 (defun pcomplete/org-mode/block-option/clocktable ()
   "Complete keywords in a clocktable line."
diff --git a/testing/lisp/test-org-pcomplete.el b/testing/lisp/test-org-pcomplete.el
index e6b0e8a7e..4a7184100 100644
--- a/testing/lisp/test-org-pcomplete.el
+++ b/testing/lisp/test-org-pcomplete.el
@@ -75,6 +75,23 @@ (ert-deftest test-org-pcomplete/keyword ()
   (buffer-string))
 t)))
 
+(ert-deftest test-org-pcomplete/src-block ()
+  "Test Babel src block header arguments completion."
+  (should
+   (string-prefix-p
+"#+begin_src emacs-lisp"
+(org-test-with-temp-text "#+begin_src emac"
+  (pcomplete)
+  (buffer-string))
+t))
+  (should
+   (string-prefix-p
+"#+begin_src emacs-lisp :session"
+(org-test-with-temp-text "#+begin_src emacs-lisp :sess"
+  (pcomplete)
+  (buffer-string))
+t)))
+
 (ert-deftest test-org-pcomplete/link ()
   "Test link completion"
   (should
-- 
2.26.2



signature.asc
Description: PGP signature


Re: [Bug] org-store-link should not insert a document level ID property

2020-05-13 Thread Nicolas Goaziou
Hello,

Matthew Lundin  writes:

> Gustav Wikström  writes:
>
>> Hi again,
>>
>> Patch is attached. It's not applied yet as it doesn't include anything
>> about user-configuration yet. @Matt Lundin, care to elaborate what you
>> had in mind in terms of that?
>>
>> With this patch a link before first headline is stored with the
>> filename (no path) as description. Following the link does what you'd
>> expect. Tests ran fine with the patch applied.
>
> Hi Gustav,
>
> Sorry it's taken so long to get back to you. Thanks for applying this.
> It makes the behavior consistent.
>
> What I was thinking of in terms of configuration is being able to
> preserve path-based links (instead of IDs) if creating a link above the
> first headline. This is the behavior that existed in the past when
> org-id-link-to-org-use-id was set to t or
> 'create-if-interactive-and-no-custom-id.

I don't understand what is the meaning of an ID property for a whole
document. 

AFAIK, ID is associated to a file name, and possibly a location in it.
In this case, the ID is strictly equivalent to the file name, so why
bother?

Regards,

-- 
Nicolas Goaziou



Re: patch for org-capture.el to allow for no file extension on open-source, protocol

2020-05-13 Thread Nicolas Goaziou
Hello,

Stacey Marshall  writes:

> Will do.  sorry didn't realize I was over the Tiny change limit.  I can
> sign FSF papers if still needed.

It is still needed :)

Please let me know once the process is complete, or if you have question
regarding the process.

Thank you!

Regards,

-- 
Nicolas Goaziou



Re: [PATCH] colview: Display active time stamps as inactive

2020-05-13 Thread Nicolas Goaziou
Hello,

Kyle Meyer  writes:

> Kyle Meyer writes:
>
>> Okay, here's a patch for that to go along with the documentation patch.
>
> Pushed (7684b59c7, 75902a473).

Thank you!

Regards,

-- 
Nicolas Goaziou