Re: [O] How to use the list search?

2017-09-03 Thread edgar

Date: Fri, 01 Sep 2017 20:13:37 -0500

You're not doing anything wrong


Thanks.

-

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  



Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Josiah Schwab  writes:

> Hi Eric,
>
>> Erm, I'd be surprised if there's a single Org mode binding that
>> *doesn't* start with C-c. That convention is right out the window with
>> Org...
>
> To be clear, this is referring to C-c and then a single ASCII letter,
> not just any binding that starts with C-c.
>
> The manual /suggests/ globally binding things to C-c a, C-c b, C-c c and
> C-c l, and then proceeds as if you have, but I really don't think it is
> correct to say this convention is out the window.
>
> Josiah

I stand corrected! I hadn't realized the conventions were that narrowly
defined, and now I see that Org indeed doesn't bind "C-c [a-zA-Z]".
Thanks for pointing that out.

Eric




Re: [O] function for inserting a block

2017-09-03 Thread Josiah Schwab
Hi Eric,

> Erm, I'd be surprised if there's a single Org mode binding that
> *doesn't* start with C-c. That convention is right out the window with
> Org...

To be clear, this is referring to C-c and then a single ASCII letter,
not just any binding that starts with C-c.

The manual /suggests/ globally binding things to C-c a, C-c b, C-c c and
C-c l, and then proceeds as if you have, but I really don't think it is
correct to say this convention is out the window.

Josiah



Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Josiah Schwab  writes:

> Hi Eric,
>
>>> We cannot bind it to "C-c i", this is a reserved key-binding. But we can
>>> suggest users to do so in the manual. Or find another binding.
>>
>> That's fine. Incidentally, why is "C-c i" reserved? It's not bound to
>> anything here. Does it look like  in terminal Emacs?
>
> The keybinding convention docs say:
>
> Don't define C-c letter as a key in Lisp programs. Sequences consisting
> of C-c and a letter (either upper or lower case) are reserved for users;
> they are the only sequences reserved for users, so do not block them.
>
> See 
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html

Erm, I'd be surprised if there's a single Org mode binding that
*doesn't* start with C-c. That convention is right out the window with
Org...




Re: [O] export to s9y blog

2017-09-03 Thread Christian Garbs

Hi!

Am 03.09.2017 um 20:44 schrieb Josiah Schwab:


3. Is there a way to use something like inheritance to import all
~ox-html.el~ functions at once and then simply overwrite what I
need to change?


I would encourage you to take a look at the org-export docs, with
particular attention to the idea of a derived backend.

   http://orgmode.org/worg/dev/org-export-reference.html


That looks great, thanks for the pointer!

Regards
Christian



Re: [O] export to s9y blog

2017-09-03 Thread Josiah Schwab
Hi Christian,

> 3. Is there a way to use something like inheritance to import all
>~ox-html.el~ functions at once and then simply overwrite what I
>need to change?

I would encourage you to take a look at the org-export docs, with
particular attention to the idea of a derived backend.

  http://orgmode.org/worg/dev/org-export-reference.html

Hope that helps,
Josiah



[O] export to s9y blog

2017-09-03 Thread Christian Garbs
Hello,

I want to write an org export plugin for the serendipity blog system[1].
Basically I need the HTML export with some changes:

- I only need the content of the  tag and nothing else.  I just
  found the BODY-ONLY argument, so I think I'm good :-)

- I don't want any CSS classes and selectors in the output.  I have
  not found any option for that yet.  In the worst case, I'll have to
  remove all ~class=~ strings from the lisp source.

- As I already use GeSHi[2] in my blog, I want any code blocks to be
  exported like this:

  [geshi lang=perl]
  print "Hello World\n";
  [/geshi]

  GeSHi will then convert that to HTML as needed.  I think I should be
  able to change the ~org-html-code~ for that.

I think I will get this done somehow.
My main question this is:

How can I do this in a way to not deviate too far from the original
~ox-html.el~?  I want to be able to easily import changes to
~ox-html.el~ into my source code.

1. I could just copy ~ox-html.el~ to ~ox-s9y.el~ and change it as
   needed.  But then I would have to manually check and perhaps apply
   any changes to ~ox-html.el~ to my ~ox-s9y.el~.

2. I could probably write a minimal ~ox-s9y.el~ that only handles my
   needs (eg. everything related to MathML or JavaScript can be
   deleted).  I would then change functions as needed and replace all
   /unchanged/ functions with calls the the corresponding in
   ~ox-html.el~ (method delegates).

   Eg. ~org-s9y-code~ would be a rewrite to produce the ~[geshi]~ code
   block and ~org-s9y-clock~ would just contain a call to the original
   ~org-html-clock~ function.

3. Is there a way to use something like inheritance to import all
   ~ox-html.el~ functions at once and then simply overwrite what I
   need to change?

What is the way to go?

Are there any other export plugins that are closely related where I
could have a look at an existing solution?

Thanks
Christian

[1] https://docs.s9y.org/
[2] http://qbnz.com/highlighter/
-- 
Christian.Garbshttps://www.cgarbs.de

Oh Lord, won't you buy me a 4BSD?
My friends all got sources, so why can't I see?
Come all you moby hackers, come sing it out with me:
To hell with the lawyers from AT!



Re: [O] function for inserting a block

2017-09-03 Thread Josiah Schwab
Hi Eric,

>> We cannot bind it to "C-c i", this is a reserved key-binding. But we can
>> suggest users to do so in the manual. Or find another binding.
>
> That's fine. Incidentally, why is "C-c i" reserved? It's not bound to
> anything here. Does it look like  in terminal Emacs?

The keybinding convention docs say:

Don't define C-c letter as a key in Lisp programs. Sequences consisting
of C-c and a letter (either upper or lower case) are reserved for users;
they are the only sequences reserved for users, so do not block them.

See 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html

Josiah



Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Joon Ro  writes:

>> 2.  Write a function to look up the tree from point and export the first
>> subtree with a certain property.
> I thought about implementing the second approach. I have slides for
> several talks in the same org file. Since I mostly need this
> functionality when I'm developing slides, just going up from point until
> reaching the desired heading is easy to implement.
>
> If you can implement this, that would be great as I find myself doing
> this all the time as well.
I use this ad hoc implementation:


(defun hmw/org-export ( level)
  "Go up to a section of level `level', if there is any, and then call 
`org-export-dispatch'. `level' defaults to 1."
  (interactive)
  (unless level (setq level 1))
  (save-excursion
  (while (< level (or (org-up-heading-safe) -1)))
  (if (org-at-heading-p)
  (org-export-dispatch


That hack could be optimised, but works for me ;).


Regards
hmw



Re: [O] Export subtrees of level n

2017-09-03 Thread Joon Ro
> 2.  Write a function to look up the tree from point and export the first
> subtree with a certain property.
I thought about implementing the second approach. I have slides for
several talks in the same org file. Since I mostly need this
functionality when I'm developing slides, just going up from point until
reaching the desired heading is easy to implement.

If you can implement this, that would be great as I find myself doing this all 
the time as well. Currently what I do is make sure to export the right subtree 
first, and then start using "\C-u\C-c\C-e". I bind f5 to "\C-u\C-c\C-e" with 
the following in my init file:

(fset 'export-last-subtree
  "\C-u\C-c\C-e")

(eval-after-load "org"
  '(progn
 (define-key org-mode-map (kbd "") 'export-last-subtree)))







Re: [O] [PATCH] Update statistic cookies when archiving

2017-09-03 Thread Jay Kamat
Hi,

> Be warned that we're in a feature-freeze phase. It will have to wait for
> Org 9.1 before being merged.

Sounds good to me!

>
>> +;; Go to parent, even if no children exist
>
> Nitpick: Missing final dot.
>
>> +(org-up-heading-safe)
>> +;; Update cookie of parent
>
> Ditto.
>> +(org-update-statistics-cookies nil)))
>>  (message "Subtree archived %s"
>>   (if (eq this-buffer buffer)
>>   (concat "under heading: " heading)
>> @@ -470,6 +476,9 @@ Archiving time is retained in the ARCHIVE_TIME node 
>> property."
>>  (outline-hide-subtree)
>>  (org-cycle-show-empty-lines 'folded)
>>  (goto-char pos)))
>> +(when org-provide-todo-statistics
>> +  ;; update todo statistics of parent
>
> Ditto. Missing capital, too.
>
>> +  (org-update-parent-todo-statistics))
>>  (org-reveal)
>>  (if (looking-at "^[ \t]*$")
>>  (outline-next-visible-heading 1

Fixed.

> Could you provide some tests and an ORG-NEWS entry? For the latter, you
> can start a new "Version 9.2" top heading.

Done.

I'm not sure if I did the tests 'correctly' though. I placed them in
test-org-element.el since there was a little bit of archive based
testing there, is there a better place to put them? I couldn't find any
file for org-archive testing. Maybe I'll write some more archive tests
later...

+(should (string=
+ (org-element-property :title (org-element-at-point))
+ "Top [0%]")))
Is there a better way to extract the status cookie percentage from the
header? I couldn't find anything in (org-element-property)'s output.

Thanks,
-Jay

>From 612d4daac54e12556333fcd2e07771aa8344c86c Mon Sep 17 00:00:00 2001
From: Jay Kamat 
Date: Sat, 2 Sep 2017 15:57:36 -0400
Subject: [PATCH] org-archive.el: Update statistic cookies when archiving

* lisp/org-archive.el (org-archive-subtree): Update todo statistics
  when calling `org-archive-subtree'.
(org-archive-to-archive-sibling): Update cookie statistics when
calling `org-archive-to-archive-sibling'.

This can be disabled by setting `org-provide-todo-statistics' to nil.
---
 etc/ORG-NEWS | 22 ++
 lisp/org-archive.el  |  9 +
 testing/lisp/test-org-element.el | 33 +
 3 files changed, 64 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9f3e62406..316a75f2f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -8,6 +8,28 @@ See the end of the file for license conditions.
 
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
+* Version 9.2
+
+** Incompatible changes
+** New features
+*** ~org-archive~ functions update status cookies
+
+Archiving headers through ~org-archive-subtree~ and
+~org-archive-to-archive-sibling~ such as the ones listed below:
+
+#+BEGIN_SRC org
+  ,* Top [1/2]
+  ,** DONE Completed
+  ,** TODO Working
+#+END_SRC
+
+Will update the status cookie in the top level header.
+
+** Removed functions
+** Removed options
+** New functions
+** Miscellaneous
+
 * Version 9.1
 
 ** Incompatible changes
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index adb922e75..9ba73a8de 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -393,6 +393,12 @@ direct children of this heading."
 	(when (featurep 'org-inlinetask)
 	  (org-inlinetask-remove-END-maybe))
 	(setq org-markers-to-move nil)
+	(when org-provide-todo-statistics
+	  (save-excursion
+	;; Go to parent, even if no children exist.
+	(org-up-heading-safe)
+	;; Update cookie of parent.
+	(org-update-statistics-cookies nil)))
 	(message "Subtree archived %s"
 		 (if (eq this-buffer buffer)
 		 (concat "under heading: " heading)
@@ -470,6 +476,9 @@ Archiving time is retained in the ARCHIVE_TIME node property."
 	(outline-hide-subtree)
 	(org-cycle-show-empty-lines 'folded)
 	(goto-char pos)))
+(when org-provide-todo-statistics
+  ;; Update todo statistics of parent.
+  (org-update-parent-todo-statistics))
 (org-reveal)
 (if (looking-at "^[ \t]*$")
 	(outline-next-visible-heading 1
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 7d1c55f36..e9506d2b0 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1070,6 +1070,39 @@ Some other text
  (let ((org-archive-tag "Archive"))
(org-element-property :archivedp (org-element-at-point))
 
+(ert-deftest test-org-element/archive-update-status-cookie ()
+  "Test archiving properly updating status cookies."
+  ;; Test org-archive-subtree with two children.
+  (org-test-with-temp-text-in-file "* Top [%]\n** DONE One\n** TODO Two"
+(forward-line 1)
+(org-archive-subtree)
+(forward-line -1)
+(should (string=
+	  (org-element-property :title (org-element-at-point))
+	  "Top [0%]")))
+  ;; Test org-archive-subtree with one child.
+  (org-test-with-temp-text-in-file "* Top [%]\n** TODO 

Re: [O] function for inserting a block

2017-09-03 Thread Eric Abrahamsen
Nicolas Goaziou  writes:

> Hello,
>
> Eric Abrahamsen  writes:
>
>> The easy template entry thing is useful as far as it goes, but for some
>> reason I find myself "marking up" existing text in Org as least as often
>> as I'm writing new text from scratch. I've always wanted a "wrap region
>> in block" command, and finally wrote one. Don't know why it took me so
>> long. Would something like this be attractive for inclusion in Org?
>
> Thanks. I agree Org needs something like this.
>
>> (defun org-insert-structure-template (type start end)
>>   "Insert a block structure as in #+BEGIN_TYPE/#+END_TYPE.
>>
>> Prompts for a block TYPE, and inserts the block.  With an active
>> region, wrap the region in the block."
>>   (interactive "sBlock type: \nr")
>>   (let ((s (set-marker (make-marker) start))
>>  (e (set-marker (make-marker) end)))
>
> (set-marker (make-marker) start) -> (copy-marker start)
>
> You need to clean these markers at the end of the function. Markers set
> to a position are never garbage-collected. Usually, it happens at the
> end of an `unwind-protect'.

Okay.

>>(goto-char s)
>>(goto-char (line-beginning-position))
>>(insert (format "#+BEGIN_%s\n" (upcase type)))
>
> (upcase type) is wrong, because special blocks are case sensitive.

I discovered that the moment I started using it!

>>(goto-char e)
>>(goto-char (line-end-position))
>
> (end-of-line) ?

Bah, I can never keep track of what's available.

>>(insert (format "\n#+END_%s" (upcase type)
>
> The function also needs to take care about global indentation. Inserting
> at column 0 may not be desirable.
>
> What happens if no region is active? Can it mark the element at point
> (see `org-mark-element')? What happens if the chosen type is verbatim
> (e.g. "example"), can it protect "#+", "*" and so on with commas (see
> `org-escape-code-in-region')?

The "r" interactive code just isn't that useful, I wish it wouldn't
raise an error.

Here's another stab at it. Is "example" the only block that should be
verbatim? Will using `newline-and-indent' instead of inserting literal
newlines solve the indentation problem?


(defun org-insert-structure-template (type)
  "Insert a block structure of the type #+BEGIN_FOO/#+END_FOO.
Prompts for a block type, and inserts the block.  With an active
region, wrap the region in the block.  With no active region, wrap the
current element."
  (interactive "sBlock type: ")
  (unless (use-region-p)
(org-mark-element))
  (let ((s (copy-marker (min (point) (mark
(e (copy-marker (max (point) (mark)
(when (string-equal (downcase type) "example")
  (org-escape-code-in-region s e))
(goto-char s)
(beginning-of-line)
(insert (format "#+BEGIN_%s" type))
(newline-and-indent)
(goto-char e)
(unless (bolp)
  (end-of-line)
  (newline-and-indent))
(insert (format "#+END_%s" type))
(newline-and-indent)
(set-marker s nil)
(set-marker e nil)))

>> If this is acceptable, I'd like to bind it to "C-c i", and would provide
>> docs.
>
> We cannot bind it to "C-c i", this is a reserved key-binding. But we can
> suggest users to do so in the manual. Or find another binding.

That's fine. Incidentally, why is "C-c i" reserved? It's not bound to
anything here. Does it look like  in terminal Emacs?

Eric




[O] getting development version on windows

2017-09-03 Thread Ian Garmaise
I recently reported a bug in sort headlines which was fixed
in the development version.  However I am using the elpa package in windows,
which only has the latest official release of Aug. 28.
My efforts to install the development version failed.

Is there a straightforward recipe to install the development version?
I have the git-bash toolkit installed (all typical unix tools included),
and gnu make etc., but I gather that elpa version uses emacs equivalents of
make and install.

Is there a way that I can apply the fix to the release package and then
rebuild org using the same method elpa uses?


-- 
=
Ian Garmaise
Consultant
Phorix Solutions Group
ia...@phorixsol.com
Toronto cell: 416.432.2251
NYC: 917.512.9535

My linkedin profile 

http://www.PhorixSol.com


Re: [O] org-babel-expand-src-block v.s. org-babel-execute-src-block with Python

2017-09-03 Thread Nicolas Goaziou
Hello,

ed...@openmail.cc writes:

> I have noticed that doing C-c C-v v (org-babel-expand-src-block) and
> C-c 
> C-c (org-babel-execute-src-block) yield different results in Python.

I guess this is related to the :session parameter, which is not obeyed
when using "C-c C-v v".

> * Question:
>   1. Is this the expected behaviour?
>   2. Is there a way to get ~#+RESULTS:~ with C-c C-c directly for this kind 
> of blocks?

I don't think so. It looks like a bug with sessions.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-agenda-span value not quoted via customize interface

2017-09-03 Thread Nicolas Goaziou
Hello,

Niall Dooley  writes:

> This is my first mail to this list so please tell me if I haven't
> followed the expected conventions.
>
> I created the following org-agenda-custom-command via the customise
> interface
>
>  '(org-agenda-custom-commands
>(quote
> (("A" "Priority #A tasks" agenda ""
>   ((org-agenda-span day)
>(org-agenda-overriding-header "Today's priority #A tasks: ")
>(org-agenda-skip-function
> (quote
>  (org-agenda-skip-entry-if
>   (quote notregexp)
>   "\\=.*\\[#A\\]"
>
> I receive the following error:
>
> Symbol’s value as variable is void: day
>
> The default value of week seems to be quoted. Manually, quoting the
> value day in the above snippet resolves the error. So it just seems like
> choosing a value through the available choices in the customise
> interface does not automatically quote the choice.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] recreating .org-id-locations file

2017-09-03 Thread Nicolas Goaziou
Hello,

kevinbanjo  writes:

> is there a utility to do this if it gets messed up?

I don't understand your question. What is the problem you are
encountering?

Regards,

-- 
Nicolas Goaziou



Re: [O] function for inserting a block

2017-09-03 Thread Nicolas Goaziou
Adam Porter  writes:

> "...it is a good idea to make a marker point nowhere if you are sure you
> don’t need it any more.  Markers that can no longer be accessed are
> eventually removed (*note Garbage Collection::)."
>
> I asked on /r/emacs about this but never got a firm answer; some thought
> that they are never collected and require manual clearing, others
> thought that ones that go out-of-scope are eventually collected and that
> it's not typically necessary to clear them manually.  I also recall
> seeing some code recently that didn't manually clear the markers it
> created, so I wonder if that is true.

The are not collected as long as the buffer they point to is alive. If
they are not attached to any buffer, they are marked for garbage
collection.

Regards,



Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Adam Porter  writes:

> Michael Welle  writes:
>
>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> I think you'll have to do it yourself.  Here are a couple of ideas:
>
> 1.  Write a function to export a subtree with a specific Org ID.
>
> 2.  Write a function to look up the tree from point and export the first
> subtree with a certain property.
I thought about implementing the second approach. I have slides for
several talks in the same org file. Since I mostly need this
functionality when I'm developing slides, just going up from point until
reaching the desired heading is easy to implement. 

Regards
hmw



Re: [O] function for inserting a block

2017-09-03 Thread Adam Porter
Nicolas Goaziou  writes:

> You need to clean these markers at the end of the function. Markers set
> to a position are never garbage-collected. Usually, it happens at the
> end of an `unwind-protect'.

Not that I oppose cleaning up markers after you're done with them, but
are they actually never collected?  The manual says:

"...it is a good idea to make a marker point nowhere if you are sure you
don’t need it any more.  Markers that can no longer be accessed are
eventually removed (*note Garbage Collection::)."

I asked on /r/emacs about this but never got a firm answer; some thought
that they are never collected and require manual clearing, others
thought that ones that go out-of-scope are eventually collected and that
it's not typically necessary to clear them manually.  I also recall
seeing some code recently that didn't manually clear the markers it
created, so I wonder if that is true.




Re: [O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

Nicolas Goaziou  writes:

> Hello,
>
> Michael Welle  writes:
>
>> imagine the following document structure:
>>
>> * talk1
>> * talk2
>> ** foo
>> ** bar
>> ** foobaz
>>
>>
>> Now the point is in section foobaz and I want to export the subtree
>> talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
>> up to * talk2, export the subtree and then move the point back.
>
> Note that subsequent C-u C-c C-e will re-use the same subtree.
ah, learned something new here.


>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> The latter, if you want to have this right from the start (and not from
> the second call)
I think, I will stick with this, because even if I use C-u C-c C-e I
will forget to move up to the right heading the first time I use it ;).

Regards
hmw



Re: [O] [Patch] Hide the file column in a clock report.

2017-09-03 Thread Nicolas Goaziou
Hello,

Michaël Cadilhac  writes:

> From f251bf0fa764e245eabe88e3959e801af5c8fd37 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= 
> Date: Thu, 31 Aug 2017 19:37:55 +0100
> Subject: [PATCH] Add the option of hiding the file column in a clock
> report

Thank you.

We are in feature-freeze phase, but it can go in master once Org 9.1 is
released.

Could you provide tests in "test-org-clock.el"? This can be named
"test-org-clock/clocktable/hidefiles". There are examples in the file.

Regards,

-- 
Nicolas Goaziou



Re: [O] Export subtrees of level n

2017-09-03 Thread Adam Porter
Michael Welle  writes:

> Is there an existing way to say that I want to go up to a level n
> heading and then export, or do I have to implement that by myself?

I think you'll have to do it yourself.  Here are a couple of ideas:

1.  Write a function to export a subtree with a specific Org ID.

2.  Write a function to look up the tree from point and export the first
subtree with a certain property.




Re: [O] Export subtrees of level n

2017-09-03 Thread Nicolas Goaziou
Hello,

Michael Welle  writes:

> imagine the following document structure:
>
> * talk1
> * talk2
> ** foo
> ** bar
> ** foobaz
>
>
> Now the point is in section foobaz and I want to export the subtree
> talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
> up to * talk2, export the subtree and then move the point back.

Note that subsequent C-u C-c C-e will re-use the same subtree.

> Is there an existing way to say that I want to go up to a level n
> heading and then export, or do I have to implement that by myself?

The latter, if you want to have this right from the start (and not from
the second call)

Regards,

-- 
Nicolas Goaziou



Re: [O] function for inserting a block

2017-09-03 Thread Nicolas Goaziou
Hello,

Eric Abrahamsen  writes:

> The easy template entry thing is useful as far as it goes, but for some
> reason I find myself "marking up" existing text in Org as least as often
> as I'm writing new text from scratch. I've always wanted a "wrap region
> in block" command, and finally wrote one. Don't know why it took me so
> long. Would something like this be attractive for inclusion in Org?

Thanks. I agree Org needs something like this.

> (defun org-insert-structure-template (type start end)
>   "Insert a block structure as in #+BEGIN_TYPE/#+END_TYPE.
>
> Prompts for a block TYPE, and inserts the block.  With an active
> region, wrap the region in the block."
>   (interactive "sBlock type: \nr")
>   (let ((s (set-marker (make-marker) start))
>   (e (set-marker (make-marker) end)))

(set-marker (make-marker) start) -> (copy-marker start)

You need to clean these markers at the end of the function. Markers set
to a position are never garbage-collected. Usually, it happens at the
end of an `unwind-protect'.

>(goto-char s)
>(goto-char (line-beginning-position))
>(insert (format "#+BEGIN_%s\n" (upcase type)))

(upcase type) is wrong, because special blocks are case sensitive.

>(goto-char e)
>(goto-char (line-end-position))

(end-of-line) ?

>(insert (format "\n#+END_%s" (upcase type)

The function also needs to take care about global indentation. Inserting
at column 0 may not be desirable.

What happens if no region is active? Can it mark the element at point
(see `org-mark-element')? What happens if the chosen type is verbatim
(e.g. "example"), can it protect "#+", "*" and so on with commas (see
`org-escape-code-in-region')?

> If this is acceptable, I'd like to bind it to "C-c i", and would provide
> docs.

We cannot bind it to "C-c i", this is a reserved key-binding. But we can
suggest users to do so in the manual. Or find another binding.


Regards,

-- 
Nicolas Goaziou



[O] Export subtrees of level n

2017-09-03 Thread Michael Welle
Hello,

imagine the following document structure:

* talk1
* talk2
** foo
** bar
** foobaz


Now the point is in section foobaz and I want to export the subtree
talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
up to * talk2, export the subtree and then move the point back.

Is there an existing way to say that I want to go up to a level n
heading and then export, or do I have to implement that by myself?

Regards
hmw



Re: [O] [PATCH] Update statistic cookies when archiving

2017-09-03 Thread Nicolas Goaziou
Hello,

Jay Kamat  writes:

> Sorry, forgot to actually attach the patch, here it is.
>
> From 95cdfa8c3ec81b3a0763b68044611c10a4dadc29 Mon Sep 17 00:00:00 2001
> From: Jay Kamat 
> Date: Sat, 2 Sep 2017 15:57:36 -0400
> Subject: [PATCH] org-archive.el: Update statistic cookies when
> archiving

Thank you!

Be warned that we're in a feature-freeze phase. It will have to wait for
Org 9.1 before being merged.

> + ;; Go to parent, even if no children exist

Nitpick: Missing final dot.

> + (org-up-heading-safe)
> + ;; Update cookie of parent

Ditto.
> + (org-update-statistics-cookies nil)))
>   (message "Subtree archived %s"
>(if (eq this-buffer buffer)
>(concat "under heading: " heading)
> @@ -470,6 +476,9 @@ Archiving time is retained in the ARCHIVE_TIME node 
> property."
>   (outline-hide-subtree)
>   (org-cycle-show-empty-lines 'folded)
>   (goto-char pos)))
> +(when org-provide-todo-statistics
> +  ;; update todo statistics of parent

Ditto. Missing capital, too.

> +  (org-update-parent-todo-statistics))
>  (org-reveal)
>  (if (looking-at "^[ \t]*$")
>   (outline-next-visible-heading 1

Could you provide some tests and an ORG-NEWS entry? For the latter, you
can start a new "Version 9.2" top heading.

Regards,

-- 
Nicolas Goaziou