[PATCH] org-manual.org: Fix syntax

2021-04-26 Thread Cheong Yiu Fung
Hi, 

Here's a tiny syntax fix in org manual.

YiufungFrom 2b63acfdb9f48fd48bce180f4894ed89b3910fe3 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Tue, 27 Apr 2021 10:10:14 +0800
Subject: [PATCH] org-manual.org: Fix syntax

* doc/org-manual.org (HTML export commands): Fix kbd representation

TINYCHANGE
---
 doc/org-manual.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 16dd4a52f..6d1a47637 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -12600,7 +12600,7 @@ compatible with XHTML 1.0 strict standard.
   #+findex: org-html-export-to-html
 
   Export as HTML file with a =.html= extension.  For =myfile.org=, Org
-  exports to =myfile.html=, overwriting without warning.  {{{kbd{C-c
+  exports to =myfile.html=, overwriting without warning.  {{{kbd(C-c
   C-e h o)}}} exports to HTML and opens it in a web browser.
 
 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) ::
-- 
2.31.1



Re: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-22 Thread Cheong Yiu Fung
Hi,

On Thu, Apr 22, 2021, at 9:32 PM, Nicolas Goaziou wrote:
> I would say
> 
>   See also [[*Sparse Trees]].
> 
> The ~org-show-context-detail~ variable is mentioned there anyway.

I agree. A new patch for docs is attached. 

> > +  ancestors-full show current subtree and its direct ancestors
> 
> IIUC, it seems to be current subtree, its direct ancestors along with
> their contents. But see below.

Current subtree means everything under it: heading + entry + children.  They
are shown. 

Regarding its ancestors: Only headings are shown. Contents of ancestors are 
*not*
to be shown.  

> > +(should (equal '(0 3 7 8 9 10 11)
> > +   (funcall list-visible-lines 'ancestors-full t)))
> > +(should (equal '(0 3 7 8 9 10 11)
> > +   (funcall list-visible-lines 'ancestors-full nil)))
> 
> Are you sure you want to display line 10? No other visibility does that.

Yes, that is the main purpose. The idea is to show the whole subtree (what 
"full" would
mean). So, whether target is in Self(7) or Match(8), 7-11 should all be shown. 
This is to
facilitate using tag or TODO keyword to choose what tree to be shown.

YiufungFrom 5fdbffd88f573f132ace4bae2f1665e325bca3a4 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Thu, 22 Apr 2021 23:25:03 +0800
Subject: [PATCH] org-manual.org: add hints for visible-only export

---
 doc/org-manual.org | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e809ecadb..74a7c735a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11524,7 +11524,7 @@ further alter what is exported, and how.
 
   Toggle visible-only export.  This is useful for exporting only
   certain parts of an Org document by adjusting the visibility of
-  particular headings.
+  particular headings.  See also [[*Sparse Trees]].
 
 ** Export Settings
 :PROPERTIES:
-- 
2.31.0



Re: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-21 Thread Cheong Yiu Fung
Hi Nicolas,

On Wed, Apr 21, 2021, at 5:15 PM, Cheong Yiu Fung wrote:
> The first patch implements the changes. I took the liberty to show 
> entry of its ancestors
> too (4 in the test case). Many users, I believe, rarely put text there, 
> so it does not
> make a difference. 

I would like to rescind my previous comments. It's awkward for me to realize I 
do have a
lot of ancestor text that I do not wish to be exported.

Please ignore patches in the previous message and use the latest ones attached. 
Thanks!

YiufungFrom 203364db88d25e5aea4cf295584617757c18591c Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Wed, 21 Apr 2021 16:27:03 +0800
Subject: [PATCH 2/2] org-manual.org: add hints for visible-only export

---
 doc/org-manual.org | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index efe956877..16dd4a52f 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11524,7 +11524,8 @@ further alter what is exported, and how.
 
   Toggle visible-only export.  This is useful for exporting only
   certain parts of an Org document by adjusting the visibility of
-  particular headings.
+  particular headings.  See also the variable
+  ~org-show-context-detail~ and the command ~org-sparse-tree~.
 
 ** Export Settings
 :PROPERTIES:
-- 
2.31.1

From ad1611831535a602c1d4b0bd8c92fea2ddde0551 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Wed, 21 Apr 2021 16:26:14 +0800
Subject: [PATCH 1/2] org.el (org-show-context-detail): add option
 'ancestors-full

* lisp/org.el: Add option 'ancestors-full to
`org-show-context-detail', update `org-show-set-visibility'
accordingly
* testing/lisp/test-org.el: Add tests.
---
 lisp/org.el  | 15 ++-
 testing/lisp/test-org.el |  4 
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 675a614e2..ac006eb6d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1199,6 +1199,8 @@ Allowed visibility spans are
   ancestors  show current headline and its direct ancestors; if
  point is not on headline, also show entry
 
+  ancestors-full show current subtree and its direct ancestors
+
   lineageshow current headline, its direct ancestors and all
  their children; if point is not on headline, also show
  entry and first child
@@ -1240,6 +1242,7 @@ more context."
 			   (const minimal)
 			   (const local)
 			   (const ancestors)
+   (const ancestors-full)
 			   (const lineage)
 			   (const tree)
 			   (const canonical))
@@ -6758,9 +6761,9 @@ be shown."
 
 (defun org-show-set-visibility (detail)
   "Set visibility around point according to DETAIL.
-DETAIL is either nil, `minimal', `local', `ancestors', `lineage',
-`tree', `canonical' or t.  See `org-show-context-detail' for more
-information."
+DETAIL is either nil, `minimal', `local', `ancestors',
+`ancestors-full', `lineage', `tree', `canonical' or t.  See
+`org-show-context-detail' for more information."
   ;; Show current heading and possibly its entry, following headline
   ;; or all children.
   (if (and (org-at-heading-p) (not (eq detail 'local)))
@@ -6775,14 +6778,16 @@ information."
   (org-with-limited-levels
(cl-case detail
 	 ((tree canonical t) (org-show-children))
-	 ((nil minimal ancestors))
+	 ((nil minimal ancestors ancestors-full))
 	 (t (save-excursion
 	  (outline-next-heading)
 	  (org-flag-heading nil)))
+  ;; Show whole subtree.
+  (when (eq detail 'ancestors-full) (org-show-subtree))
   ;; Show all siblings.
   (when (eq detail 'lineage) (org-show-siblings))
   ;; Show ancestors, possibly with their children.
-  (when (memq detail '(ancestors lineage tree canonical t))
+  (when (memq detail '(ancestors ancestors-full lineage tree canonical t))
 (save-excursion
   (while (org-up-heading-safe)
 	(org-flag-heading nil)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index f6fb4b3ca..47732dfa3 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7982,6 +7982,10 @@ CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] =>  6:40"
 (should (equal '(0 7 8 9) (funcall list-visible-lines 'local nil)))
 (should (equal '(0 3 7) (funcall list-visible-lines 'ancestors t)))
 (should (equal '(0 3 7 8) (funcall list-visible-lines 'ancestors nil)))
+(should (equal '(0 3 7 8 9 10 11)
+   (funcall list-visible-lines 'ancestors-full t)))
+(should (equal '(0 3 7 8 9 10 11)
+   (funcall list-visible-lines 'ancestors-full nil)))
 (should (equal '(0 3 5 7 12) (funcall list-visible-lines 'lineage t)))
 (should (equal '(0 3 5 7 8 9 12) (funcall list-visible-lines 'lineage nil)))
 (should (equal '(0 1 3 5 7 12 13) (funcall list-visible-lines 'tree t)))
-- 
2.31.1



Re: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-21 Thread Cheong Yiu Fung
Hi Nicolas,

The first patch implements the changes. I took the liberty to show entry of its 
ancestors
too (4 in the test case). Many users, I believe, rarely put text there, so it 
does not
make a difference. But when someone write short notes at this location, I think 
it serves
as brief "contextual" information for all its children, our target headline 
included. It
may indicate the intention to include contextual information in output too, so 
I go with
such guess. If user does not want it to be included, it is easier for him to 
work around
(e.g., by creating a new heading and put text under), than the other way 
around, that is,
to reveal text one by one.

The second patch suggests how it can be integrated with `org-sparse-tree' in 
the manual. I
think the new option, as the first visibility option to show subtree, would make
`visible-only' option a lot more useful. Whether to include it in the manual I 
leave it to
your consideration.

Lastly I'd like to say thanks as a daily Org user, thank you for putting time in
overseeing the project. Your efforts are appreciated by many :)

Regards,
Yiufung

From d278837240c2cd03bc3ac448b8fb40d8c0866c5c Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Wed, 21 Apr 2021 16:26:14 +0800
Subject: [PATCH 1/2] org.el (org-show-context-detail): add option
 'ancestors-full

* lisp/org.el: Add option 'ancestors-full to
`org-show-context-detail', update `org-show-set-visibility'
accordingly
* testing/lisp/test-org.el: Add tests.
---
 lisp/org.el  | 18 --
 testing/lisp/test-org.el |  4 
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 675a614e2..80039c802 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1199,6 +1199,9 @@ Allowed visibility spans are
   ancestors  show current headline and its direct ancestors; if
  point is not on headline, also show entry
 
+  ancestors-full show current headline, entry, subtree, current
+ headline's direct ancestors and their entries
+
   lineageshow current headline, its direct ancestors and all
  their children; if point is not on headline, also show
  entry and first child
@@ -1240,6 +1243,7 @@ more context."
 			   (const minimal)
 			   (const local)
 			   (const ancestors)
+   (const ancestors-full)
 			   (const lineage)
 			   (const tree)
 			   (const canonical))
@@ -6758,9 +6762,9 @@ be shown."
 
 (defun org-show-set-visibility (detail)
   "Set visibility around point according to DETAIL.
-DETAIL is either nil, `minimal', `local', `ancestors', `lineage',
-`tree', `canonical' or t.  See `org-show-context-detail' for more
-information."
+DETAIL is either nil, `minimal', `local', `ancestors',
+`ancestors-full', `lineage', `tree', `canonical' or t.  See
+`org-show-context-detail' for more information."
   ;; Show current heading and possibly its entry, following headline
   ;; or all children.
   (if (and (org-at-heading-p) (not (eq detail 'local)))
@@ -6775,18 +6779,20 @@ information."
   (org-with-limited-levels
(cl-case detail
 	 ((tree canonical t) (org-show-children))
-	 ((nil minimal ancestors))
+	 ((nil minimal ancestors ancestors-full))
 	 (t (save-excursion
 	  (outline-next-heading)
 	  (org-flag-heading nil)))
+  ;; Show whole subtree.
+  (when (eq detail 'ancestors-full) (org-show-subtree))
   ;; Show all siblings.
   (when (eq detail 'lineage) (org-show-siblings))
   ;; Show ancestors, possibly with their children.
-  (when (memq detail '(ancestors lineage tree canonical t))
+  (when (memq detail '(ancestors ancestors-full lineage tree canonical t))
 (save-excursion
   (while (org-up-heading-safe)
 	(org-flag-heading nil)
-	(when (memq detail '(canonical t)) (org-show-entry))
+	(when (memq detail '(ancestors-full canonical t)) (org-show-entry))
 	(when (memq detail '(tree canonical t)) (org-show-children))
 
 (defvar org-reveal-start-hook nil
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index f6fb4b3ca..36658d51d 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7982,6 +7982,10 @@ CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] =>  6:40"
 (should (equal '(0 7 8 9) (funcall list-visible-lines 'local nil)))
 (should (equal '(0 3 7) (funcall list-visible-lines 'ancestors t)))
 (should (equal '(0 3 7 8) (funcall list-visible-lines 'ancestors nil)))
+(should (equal '(0 3 4 7 8 9 10 11)
+   (funcall list-visible-lines 'ancestors-full t)))
+(should (equal '(0 3 4 7 8 9 10 11)
+   (funcall list-visible-lines 'ancestors-full nil)))

Re: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-20 Thread Cheong Yiu Fung
Hi, 

> OK. Then what about a shorter `ancestors-full'?

That sounds better, I will use this one. 

> Also, could you provide tests for it in `test-org/show-set-visibility'?

Sure, I'll see how to do it and submit a patch later. 

Yiufung

On Tue, Apr 20, 2021, at 9:15 PM, Nicolas Goaziou wrote:
> Hello,
> 
> "Cheong Yiu Fung"  writes:
> 
> > Yes, but that would work only for one entry. My main use case is to
> > first filter tree by `org-sparse-tree', then export all filtered
> > contents with `visible-only' option. If I am to use `ancestors' view
> > and move point within each entry one by one to expand, it would be
> > very repetitive. I think this is helpful for generating HTML page or
> > PDF from matching query quickly.
> 
> OK. Then what about a shorter `ancestors-full'?
> 
> Also, could you provide tests for it in `test-org/show-set-visibility'?
> 
> Regards,
> -- 
> Nicolas Goaziou
> 



Re: [PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-19 Thread Cheong Yiu Fung
Hi Nicolas, 

> Don't you need to simply move point within the entry and use `ancestors'
> view?

Yes, but that would work only for one entry. My main use case is to first 
filter tree by `org-sparse-tree', then export all filtered contents with 
`visible-only' option. If I am to use `ancestors' view and move point within 
each entry one by one to expand, it would be very repetitive. I think this is 
helpful for generating HTML page or PDF from matching query quickly. 

Yiufung

On Mon, Apr 19, 2021, at 4:21 PM, Nicolas Goaziou wrote:
> Hello,
> 
> Cheong Yiu Fung  writes:
> 
> > Hi, I'm proposing a new option in `org-show-context-detail', which shows
> > current headline, its ancestors, *and the entry itself*. This is useful
> > when export matched subtrees and their contents quickly with least
> > manual intervention.
> >
> > Consider when working on different aspects of a project and taking notes
> > as we go:
> >
> > * Project
> > A project tree
> > ** Task1
> > ** Task2
> > *** ASK Something to align
> > Something for discussion
> > ** Task3
> > ** Task4
> > *** ASK Something else to align
> > Something else.
> >
> > At some point, we may wish to export only certain contents. For example,
> > to export headings with TODO keyword of "ASK", along with the task
> > context (ancestors TASK heading name), and their own content for
> > discussion with colleagues. Ideally, this can be done by
> > org-sparse-tree, followed by org-export with visible-only + subtree-only
> > option.
> >
> > Expected output:
> > * Project
> > ** Task2
> > *** ASK Something to align
> > Something for discussion
> > ** Task4
> > *** ASK Something else to align
> > Something else.
> >
> > Current options, though, either require manual expansion to show both
> > ancestors AND entry, which becomes tedious soon;
> >
> > * Project
> > ** Task2
> > *** ASK Something to align
> > ** Task4
> > *** ASK Something else to align
> >
> > or it shows extra contents (`local' will include the *next* heading, in
> > this example, the non-related Task3)
> >
> > * Project
> > *** ASK Something to align
> > Something for discussion
> > ** Task3
> > *** ASK Something else to align
> > Something else.
> >
> > `ancestor-with-entries' is a long name that pose some difficulties to
> > updating documentations, so I wish to have some feedbacks before moving
> > on. Is there better way to achieve this effect? Am I overlooking
> > something?
> 
> Don't you need to simply move point within the entry and use `ancestors'
> view?
> 
> Regards,
> -- 
> Nicolas Goaziou
> 



[PATCH] org.el (org-show-context-detail): add option 'ancestors-with-entry

2021-04-16 Thread Cheong Yiu Fung
Hi, I'm proposing a new option in `org-show-context-detail', which shows
current headline, its ancestors, *and the entry itself*. This is useful
when export matched subtrees and their contents quickly with least
manual intervention.

Consider when working on different aspects of a project and taking notes
as we go:

* Project
A project tree
** Task1
** Task2
*** ASK Something to align
Something for discussion
** Task3
** Task4
*** ASK Something else to align
Something else.

At some point, we may wish to export only certain contents. For example,
to export headings with TODO keyword of "ASK", along with the task
context (ancestors TASK heading name), and their own content for
discussion with colleagues. Ideally, this can be done by
org-sparse-tree, followed by org-export with visible-only + subtree-only
option.

Expected output:
* Project
** Task2
*** ASK Something to align
Something for discussion
** Task4
*** ASK Something else to align
Something else.

Current options, though, either require manual expansion to show both
ancestors AND entry, which becomes tedious soon;

* Project
** Task2
*** ASK Something to align
** Task4
*** ASK Something else to align

or it shows extra contents (`local' will include the *next* heading, in
this example, the non-related Task3)

* Project
*** ASK Something to align
Something for discussion
** Task3
*** ASK Something else to align
Something else.

`ancestor-with-entries' is a long name that pose some difficulties to
updating documentations, so I wish to have some feedbacks before moving
on. Is there better way to achieve this effect? Am I overlooking
something?

Yiufung

>From 38703eace6062ec4e4ccdf1912a641b266efbf61 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Fri, 16 Apr 2021 18:35:17 +0800
Subject: [PATCH] org.el (org-show-context-detail): add option
 'ancestors-with-entry

* lisp/org.el: Add option 'ancestors-with-entry to
`org-show-context-detail', which shows current headline, entry, and
its direct ancestors.
---
 lisp/org.el | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 675a614e2..0e625d9ed 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1240,6 +1240,7 @@ more context."
 			   (const minimal)
 			   (const local)
 			   (const ancestors)
+   (const ancestors-with-entry)
 			   (const lineage)
 			   (const tree)
 			   (const canonical))
@@ -6763,7 +6764,7 @@ DETAIL is either nil, `minimal', `local', `ancestors', `lineage',
 information."
   ;; Show current heading and possibly its entry, following headline
   ;; or all children.
-  (if (and (org-at-heading-p) (not (eq detail 'local)))
+  (if (and (org-at-heading-p) (not (memq detail '(local ancestors-with-entry
   (org-flag-heading nil)
 (org-show-entry)
 ;; If point is hidden within a drawer or a block, make sure to
@@ -6775,14 +6776,14 @@ information."
   (org-with-limited-levels
(cl-case detail
 	 ((tree canonical t) (org-show-children))
-	 ((nil minimal ancestors))
+	 ((nil minimal ancestors ancestors-with-entry))
 	 (t (save-excursion
 	  (outline-next-heading)
 	  (org-flag-heading nil)))
   ;; Show all siblings.
   (when (eq detail 'lineage) (org-show-siblings))
   ;; Show ancestors, possibly with their children.
-  (when (memq detail '(ancestors lineage tree canonical t))
+  (when (memq detail '(ancestors ancestors-with-entry lineage tree canonical t))
 (save-excursion
   (while (org-up-heading-safe)
 	(org-flag-heading nil)
-- 
2.31.0



[PATCH] ox-odt.el: quote output file name

2020-11-20 Thread Cheong Yiu Fung
Hello,

Here's a patch to quote output file name following the fashion of input file 
name as used in `org-odt-convert'. It avoids conversion errors in the 
underlying shell commands.

YiufungFrom e77284cc511afc9d3e9ad68c9b36f9f69bcad413 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Fri, 20 Nov 2020 16:43:53 +0800
Subject: [PATCH] ox-odt.el: quote output file name

* lisp/ox-odt.el (org-odt-do-convert): Add `shell-quote-argument'
around output file name.

TINYCHANGE
---
 lisp/ox-odt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 01c0e6a90..59fe369e9 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -4240,9 +4240,9 @@ Return output file's name."
 			   `((?i . ,(shell-quote-argument in-file))
 			 (?I . ,(browse-url-file-url in-file))
 			 (?f . ,out-fmt)
-			 (?o . ,out-file)
+			 (?o . ,(shell-quote-argument out-file))
 			 (?O . ,(browse-url-file-url out-file))
-			 (?d . , (shell-quote-argument out-dir))
+			 (?d . ,(shell-quote-argument out-dir))
 			 (?D . ,(browse-url-file-url out-dir))
 			 (?x . ,extra-options)
 (when (file-exists-p out-file)
-- 
2.29.2



[PATCH] ox-odt.el: quote output file name

2020-11-20 Thread Cheong Yiu Fung
Hello,

Here's a patch to quote output file name following the fashion of input file 
name as used in `org-odt-convert'. It avoids conversion errors in the 
underlying shell commands.

YiufungFrom e77284cc511afc9d3e9ad68c9b36f9f69bcad413 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Fri, 20 Nov 2020 16:43:53 +0800
Subject: [PATCH] ox-odt.el: quote output file name

* lisp/ox-odt.el (org-odt-do-convert): Add `shell-quote-argument'
around output file name.

TINYCHANGE
---
 lisp/ox-odt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 01c0e6a90..59fe369e9 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -4240,9 +4240,9 @@ Return output file's name."
 			   `((?i . ,(shell-quote-argument in-file))
 			 (?I . ,(browse-url-file-url in-file))
 			 (?f . ,out-fmt)
-			 (?o . ,out-file)
+			 (?o . ,(shell-quote-argument out-file))
 			 (?O . ,(browse-url-file-url out-file))
-			 (?d . , (shell-quote-argument out-dir))
+			 (?d . ,(shell-quote-argument out-dir))
 			 (?D . ,(browse-url-file-url out-dir))
 			 (?x . ,extra-options)
 (when (file-exists-p out-file)
-- 
2.29.2



Make org-babel-next-src-block respect ARCHIVE tag

2019-12-03 Thread Cheong Yiu Fung
Hi, 

When navigating using `org-babel-next-src-block`(C-c C-v C-n), if the next 
source block is in an archived subtree, Org mode would expand it and move 
cursor to it. 

Is this an expected behavior / desired feature? It seems more natural to skip 
source blocks that are under an archived subtree. 

* Heading
#+BEGIN_SRC R
message("Press C-c C-v C-n here")
#+END_SRC
* Heading   :ARCHIVE:
#+BEGIN_SRC R
message("cursor moved to this block")
#+END_SRC
* Heading
#+BEGIN_SRC R
message("or should it jump to here instead?")
#+END_SRC

--
Yiufung



Re: [PROPOSAL] New function `org-headings-to-point' and displayer.

2019-12-03 Thread Cheong Yiu Fung
This is really useful. Thanks!

Yiufung

On Tue, Dec 3, 2019, at 10:56 AM, Karl Fogel wrote:
> Hi.  I've been using this for a while and find it very handy.
> 
> If people like this and want it in Org Mode, I'll do the rest of the 
> work to package it up as a patch, with ChangeLog entry, NEWS, etc, and 
> post it here for review before committing.
> 
> To try it out, just evaluate both functions and then run
> 
>   `M-x org-display-headings-to-point'
> 
> from somewhere deep in an org subtree.  Comments/feedback welcome.
> 
> Best regards,
> -Karl
> 
> (defun org-headings-to-point ()
>   "Return all the Org Mode headings leading to point."
>   (when (not (eq major-mode 'org-mode))
> (error "ERROR: this only works in Org Mode"))
>   (let ((headings (list (org-heading-components
> (save-excursion
>   (save-match-data
> (save-restriction
>   (widen)
>   (while (org-up-heading-safe)
> (setq headings (cons (org-heading-components) headings)
>   headings)))
> 
> (defun org-display-headings-to-point ()
>   "Display Org Mode heading titles from level 1 to current subtree.
> Display each title on its own line, indented proportionally to its level."
>   (interactive)
>   (let* ((heading-titles (mapcar (lambda (heading)
>(nth 4 heading))
>  (org-headings-to-point)))
>  (level 0)
>  (hierarchy (mapcar (lambda (title)
>   (prog1
>   (if (zerop level)
>   (concat "• " title)
> (concat "\n" 
> (make-string (* level 2) ? )
> "→ " title))
> (setq level (1+ level
> heading-titles)))
> (display-message-or-buffer (string-join hierarchy
> 
>



Re: [O] What happened to ATTR_ORG?

2019-05-24 Thread Cheong Yiu Fung
I'm using the latest Org and it's working. If you'd like to dig the
cause you might want to dig in `org-display-inline-images'. It accepts
`:width' in any #+ATTR.*-like option, then immediately call
`create-image'. I would guess it's an imagemagick problem too.

steen  writes:

> I am also having the same issue. I don't have time right now to try to
> track down causes, but this is not a unique problem. The behavior I am
> seeing is that #+ATTR_ORG no longer causes the images to be resized, they
> display at original size.
> -- Steen
>
>
> On Fri, May 24, 2019 at 8:34 AM John Kitchin 
> wrote:
>
>> I still use this. Do you see any issues in the Messages?
>>
>> If you try attr_latex does it work? If not you may have an imagemagick
>> problem that can’t rescale the thumbnail. Note you will have to toggle the
>> image display after you add that.
>>
>> On Fri, May 24, 2019 at 11:18 AM William Denton  wrote:
>>
>>> It used to be possible use ATTR_ORG on images to make them display at a
>>> different size, which was very useful when the images were large.  It
>>> worked
>>> like this:
>>>
>>> #+ATTR_ORG: :width 300
>>> [[file:very-large-image.jpg]]
>>>
>>> I haven't needed it for a while, but today I went to use it and it's
>>> gone!  I
>>> grepped the source code, ORG-NEWS and the git log, but didn't see any
>>> mention of
>>> it.  What happened?  Did it go in version 9?  Am I overlooking
>>> something?  I
>>> feel like I've stepped into some parallel universe where everything is
>>> the same
>>> except this one Org command.
>>>
>>> Bill
>>> --
>>> William Denton :: Toronto, Canada   ---   Listening to Art:
>>> https://listeningtoart.org/
>>> https://www.miskatonic.org/ ---   GHG.EARTH: https://ghg.earth/
>>> Caveat lector.  ---   STAPLR: http://staplr.org/
>>>
>>> --
>> 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
>>
>>



[O] [PATCH] Docstring update

2019-05-17 Thread Cheong Yiu Fung
Fix docstring of `org-latex-packages-alist'.

--
YiufungFrom f854de4a4570a433871a2559160a7499c4c054d7 Mon Sep 17 00:00:00 2001
From: Cheong Yiu Fung 
Date: Fri, 17 May 2019 17:15:43 +0800
Subject: [PATCH] org.el: Fix docstring of org-latex-packages-alist

* lisp/org.el (org-latex-packages-alist): Fix docstring to match
`org-latex-default-packages-alist'

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

diff --git a/lisp/org.el b/lisp/org.el
index a5a2bdc51..645d507a7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4181,7 +4181,7 @@ Each element is either a cell or a string.
 
 A cell is of the format:
 
-(\"options\" \"package\" SNIPPET-FLAG)
+(\"options\" \"package\" SNIPPET-FLAG COMPILERS)
 
 SNIPPET-FLAG, when non-nil, indicates that this package is also
 needed when turning LaTeX snippets into images for inclusion into
-- 
2.21.0



[O] [PATCH] org-manual: Small fixes

2019-05-16 Thread Cheong Yiu Fung
* doc/org-manual.org (Handling Links): update variable
`org-id-link-to-org-use-id', which is changed in v7.9.2.
---
 doc/org-manual.org | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 54b89e5bf..c519d310b 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -3173,17 +3173,17 @@ current buffer:
   to the target.  Otherwise it points to the current headline, which
   is also the description[fn:28].
 
-  #+vindex: org-link-to-org-use-id
+  #+vindex: org-id-link-to-org-use-id
   #+cindex: @samp{CUSTOM_ID}, property
   #+cindex: @samp{ID}, property
   If the headline has a =CUSTOM_ID= property, store a link to this
   custom ID.  In addition or alternatively, depending on the value of
-  ~org-link-to-org-use-id~, create and/or use a globally unique =ID=
-  property for the link[fn:29].  So using this command in Org buffers
-  potentially creates two links: a human-readable link from the custom
-  ID, and one that is globally unique and works even if the entry is
-  moved from file to file.  Later, when inserting the link, you need
-  to decide which one to use.
+  ~org-id-link-to-org-use-id~, create and/or use a globally unique
+  =ID= property for the link[fn:29].  So using this command in Org
+  buffers potentially creates two links: a human-readable link from
+  the custom ID, and one that is globally unique and works even if the
+  entry is moved from file to file.  Later, when inserting the link,
+  you need to decide which one to use.
 
 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ ::
 
-- 
2.21.0