Re: [O] [Feature Request] Add an dispatcher command (keybinding) for inserting dynamic blocks

2018-12-19 Thread stardiviner

I add code patch in attachment. Nicolas, can you review it? Any
suggestion welcome.

After running test with "make test", I got some failed test might related to my 
code changing. But I checked out the tests, have not found anywhere invoking 
the renamed functions.

Ran 814 tests, 808 results as expected, 6 unexpected (2018-12-20 09:57:41+0800)
9 expected failures

6 unexpected results:
   FAILED  ob-D/inhomogeneous_table
   FAILED  ob-D/list-list-var
   FAILED  ob-D/list-var
   FAILED  ob-D/vector-var
   FAILED  test-org-clock/clocktable/lang
   FAILED  test-org-colview/columns-width


>From 16ff083a475b7f125136a7bbd131e85833ad822d Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Thu, 20 Dec 2018 09:21:38 +0800
Subject: [PATCH] org.el: Add dispatch command for inserting dynamic blocks

* lisp/org.el (org-dynamic-block-insert-dispatch): The dispatch command
  for inserting dynamic blocks.

  (org-dynamic-block-parameters, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-set-parameters,
  org-dynamic-block-get-parameter): New custom option, and new functions
  about dynamic blocks.

  (org-clock-report, org-columns-insert-dblock) Those functions are
  renamed to new name, and removed corresponding keybinding, take
  controled by dispatch command org-dynamic-block-insert-dispatch.

* doc/org-manual.org: Add manual for dispatch command
  ~org-dynamic-block-insert-dispatch~.
---
 doc/org-manual.org  |  9 ---
 etc/ORG-NEWS| 20 +++
 lisp/org-clock.el   |  2 +-
 lisp/org-colview.el |  2 +-
 lisp/org-compat.el  |  2 --
 lisp/org.el | 59 -
 6 files changed, 81 insertions(+), 13 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 051ffaa4d..37afad5b2 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -19872,9 +19872,12 @@ users mailing list, at mailto:emacs-orgmode@gnu.org.
 
 Org supports /dynamic blocks/ in Org documents.  They are inserted
 with begin and end markers like any other code block, but the contents
-are updated automatically by a user function.  For example, {{{kbd(C-c
-C-x C-r)}}} inserts a dynamic table that updates the work time (see
-[[*Clocking Work Time]]).
+are updated automatically by a user function. You can use dispatch
+command ~org-dynamic-block-insert-dispatch~ which is bind to
+keybinding {{{kbd(C-c C-x i)}}} by default.
+
+For example, {{{kbd(C-c C-x i)}}} + ~clocktable~ inserts a dynamic
+table that updates the work time (see [[*Clocking Work Time]]).
 
 Dynamic blocks can have names and function parameters.  The syntax is
 similar to source code block specifications:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 811e98147..5bce606f9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.2
 ** Incompatible changes
+*** Renamed some dynamic block generate functions name
+
+- Renamed ~org-clock-report~ to ~org-insert-dblock:clocktable~
+- Renamed ~org-columns-insert-dblock~ to ~org-insert-dblock:columnview~
+
 *** Removal of OrgStruct mode mode and radio lists
 
 OrgStruct minor mode and radio lists mechanism (~org-list-send-list~
@@ -170,6 +175,15 @@ This is consistent with the naming of =org-dblock-write:columnview=
 options, where =:match= is also used as a headlines filter.
 
 ** New features
+
+*** Add a dispatcher command to insert dynamic blocks
+
+You can add dynamic block into ~org-dynamic-block-parameters~ with
+function ~org-dynamic-block-set-parameters~ just like
+~org-link-set-parameters~. All dynamic blocks in
+~org-dynamic-block-set-parameters~ can be used by
+~org-dynamic-block-insert-dispatch~ command.
+
 *** Add ~:results link~ support for Babel
 
 With this output format, create a link to the file specified in
@@ -314,6 +328,12 @@ remove it.
 
 ** New commands and functions
 
+*** ~org-dynamic-block-insert-dispatch~
+
+Use default keybinding =[C-c C-x i]= to run command
+~org-dynamic-block-insert-dispatch~. It will prompt user to select
+dynamic block in ~org-dynamic-block-parameters~.
+
 *** ~org-insert-structure-template~
 
 This function can be used to wrap existing text of Org elements in
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 494423e4e..ebe7b8637 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2024,7 +2024,7 @@ fontified, and then returned."
 (point-at-bol)
 
 ;;;###autoload
-(defun org-clock-report (&optional arg)
+(defun org-insert-dblock:clocktable (&optional arg)
   "Update or create a table containing a report about clocked time.
 
 If point is inside an existing clocktable block, update it.
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 932275836..6a9a8a601 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1489,7 +1489,7 @@ PARAMS is a property list of parameters:
 	(org-table-align)
 
 ;;;###autoload
-(defun org-columns-insert-dblock ()
+(defun org-insert-dblock:columnview (

Re: [O] [PATCH] org-protocol.el: Fix `org-protocol-capture' return value

2018-12-19 Thread Renato Ferreira
On Wed, 19 Dec 2018 22:17:47 +0100, Nicolas Goaziou  
said:

> Let me know if it fixes the issue.

Fixed. Thank you very much!

-- 
Renato Ferreira



Re: [O] Bug: Add option to fontify latex blocks [9.1.9 (release_9.1.9-65-g5e4542 @ /home/carlos/local/stow/emacs-26/share/emacs/26.1.50/lisp/org/)]

2018-12-19 Thread Nicolas Goaziou
Hello,

Carlos Pita  writes:

> So in order to get all this properly working:
>
> 1. Also ignore the limit in org-do-latex-and-related.
>
> 2. Install a region extension function so that multiline regions are
> properly identified at the start and after syntax breaking change
> (that is, at the beginning or at the end).

I pushed a different fix for LaTeX environment fontification. Please let
me know if it fixes your issue.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] Suggestion to self-link headlines exported to HTML

2018-12-19 Thread Nicolas Goaziou
Hello,

Toon Claes  writes:

> Recently I wrote a blog post on making headlines clickable when Org mode
> is exported to HTML:
> https://writepermission.com/org-blogging-clickable-headlines.html
>
> With this mail, I'd like to suggest a change to bring this feature to
> the Org mode core.
>
> It's my first contribution to Org mode, but I've already completed the
> paperwork to contribute to Emacs core in the past.
>
> Of course any comment is welcome.

Thank you. Comments, indeed, follow :)

>  | ~:html-postamble~  | ~org-html-postamble~  
> |
>  | ~:html-preamble-format~| 
> ~org-html-preamble-format~|
>  | ~:html-preamble~   | ~org-html-preamble~   
> |
> +| ~:html-self-link-headlines~| 
> ~org-html-self-link-headlines~|
>  | ~:html-table-align-individual-field~   | 
> ~de{org-html-table-align-individual-fields~   |
>  | ~:html-table-attributes~   | 
> ~org-html-table-default-attributes~   |
>  | ~:html-table-caption-above~| 
> ~org-html-table-caption-above~|

Could this also be documented somewhere in "HTML Export" section of the
manual?

> +(defcustom org-html-self-link-headlines nil
> +  "When set, the headlines contain a hyperlink to themselves."

When non-nil, ...

> +  :group 'org-export-html
> +  :version "27.1"

No need for :version keyword if :package-version is provided.

> +  :package-version '(Org . "9.2")

It should be "9.3" actually, since 9.2 is feature-freeze.

> +  :type 'boolean)

Please also add :safe #'booleanp

>   Inlinetasks
>  
>  (defcustom org-html-format-inlinetask-function
> @@ -2592,7 +2600,11 @@ holding contextual information."
> todo todo-type priority text tags info))
> (contents (or contents ""))
>  (id (or (org-element-property :CUSTOM_ID headline)
> -(org-export-get-reference headline info
> +(org-export-get-reference headline info)))
> +(formatted-text
> + (if (and id (plist-get info :html-self-link-headlines))

`id' cannot be nil, so you only need (plist-get ...)

> + (format "%s" id full-text)
> +   text)))

Why `text' and not `full-text' as a fall-back?


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] org-protocol.el: Fix `org-protocol-capture' return value

2018-12-19 Thread Nicolas Goaziou
Hello,

Renato Ferreira  writes:

> This fixes `org-protocol-capture' removing the message because protocols
> with :kill-client exit it with `server-edit' causing
> `server-visit-files' to receive "Item captured." which it interpret as a
> file name.

Thank you. I applied your patch with a slight modification.

Let me know if it fixes the issue.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Special property ITEM without stars [9.1.14]

2018-12-19 Thread Nicolas Goaziou
Allen Li  writes:

> I have worked around this locally, but I hope we can revisit this later since
> it makes Org mode's user interface better.

I'm not totally convinced about that.

> Does it make sense for Org mode to keep a separate release branch so
> new features can be worked on while a release is prepared (like how I
> think Emacs does it)?

This is what "next" branch is about.



Re: [O] Bug: Special property ITEM without stars [9.1.14]

2018-12-19 Thread Allen Li
On Wed, Dec 19, 2018 at 6:11 AM Nicolas Goaziou  wrote:
>
> Hello,
>
> Allen Li  writes:
>
> > Okay, thanks.  I guess we can see how this works out with respect to users
> > like Brent using org-tags-match-list-sublevels or otherwise using
> > hierarchy.
>
> On second thought, this may not be a good idea, especially on master
> branch, which is close from being released.
>
> As suggested before, you ought to use
> `org-columns-modify-value-for-display-function' instead. This is
> probably the cleanest way to solve the current issue.

I have worked around this locally, but I hope we can revisit this later since
it makes Org mode's user interface better.

Does it make sense for Org mode to keep a separate release branch so
new features can be worked on while a release is prepared (like how I
think Emacs does it)?

>
> Regards,
>
> --
> Nicolas Goaziou



[O] Problem with references to babel source blocks (possible bug).

2018-12-19 Thread Emmanuel Charpentier
I wish to be able to reference (i. e cross-references, lists) both some
tables or figures AND the code producing the objects.

To this effect, I added (distinct) #+caption:s to the source blocks AND
to the results, adorned with (distinct) org-ref's labels. An example ( 
Min-Ref.org) is included in this Google Drive directory*: 
https://drive.google.com/drive/folders/1T6N_-WwphlnL2mB4f6BgX0u1K5mLnz4i?usp=sharing
.

The comparison of this source, the LaTeX code obtained by org-latex
export-to latex (Min-Ref.tex) and the resultant PDF (Min-Ref exported
by org-latex-export-to-pdf.pdf) show that the labels attributed to
source blocks are mislabeled as figures. Furthermore, while the org
source requests a list of figure, a list of table and a list of
listings (in that order), the list of figures appears *after* the list
of tables.

I am tempted to conclude that there is some confusion between figures
and listings. Further attempts tend to show that the problem may live n
the core org's code, rather than any specific exporter :

The ODT "native" exporter (org-odt-export-to-odt) is much less capable,
as shown in Min-Ref exported by org-odt-export-to-odt.odt.

Attempts to export via Pandoc to PDF (Min-Ref exported by org-pandoc-
export-to-latex-pdf.pdf), ODT (Min-Ref exported by org-pandoc-export-
to-odt.odt) and DOCX (Min-Ref.docx) show that these exporters may need
some specific configurations in order to be even vaguely usable.

Previous trials, using #+names: rather than org-ref's labels, gave
similar failures. If needed, I can reproduce these trials.

So I have a couple questions :

1) Is the confusion of source blocks and figures a bug, or do I miss a
subtle point ?

2) Is there some introductory material to the care and feeding of ox-
pandoc demonstrating the use of this exporter's options to enable the
addition of the needed features (figure inclusion, tables of tables /
figures / listings, etc...) ? The "manual" available as a README is way
too terse to be usable without diving in the source code and pandoc's
documentation.

Sincerely,

--
Emmanuel Charpentier

* Six attempts at posting those files attached to the present mail have
convinced me that the list manager rejects at least the messages
containing some attachments (docx ? dot ?) ; I'm a little bit fed up
with this...




Re: [O] Meta : what can be sent to this mailing list ?

2018-12-19 Thread Emmanuel Charpentier
Thanks ! I'll make a sixth attempt...

--
Emmanuel Charpentier

Le mer. 19 déc. 2018 à 16:04, Eric S Fraga  a écrit :

> On Wednesday, 19 Dec 2018 at 15:39, Emmanuel Charpentier wrote:
> > Could you let me know if some attachments are blocked by the list manager
> > or mail server ?
>
> Not that I have seen.
>
> This email obviously got through.
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442
>


Re: [O] Meta : what can be sent to this mailing list ?

2018-12-19 Thread Eric S Fraga
On Wednesday, 19 Dec 2018 at 15:39, Emmanuel Charpentier wrote:
> Could you let me know if some attachments are blocked by the list manager
> or mail server ?

Not that I have seen.

This email obviously got through.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442



Re: [O] Meta : what can be sent to this mailing list ?

2018-12-19 Thread Kaushal Modi
I think that emails with attachments exceeding a certain size are blocked.

You might want to upload your attachments somewhere else, and simply link
to them in your emails sent to this list.

--
Kaushal Modi

On Wed, Dec 19, 2018, 9:40 AM Emmanuel Charpentier <
emanuel.charpent...@gmail.com wrote:

> Dear list,
>
> I have made five attempts in three days to post a question to this list.
> Three of them may have failed due to the use of an SMTP server flagged on
> one site as possible spam source. The other two has been sent via gmai. So
> far, none of these message have appeared on the list, and I received no
> error message.
>
> I know tha *some* attachments are accepted (a previous question of mine
> included .tex, .pdf and .org files). However, I waonder if my mails may
> have been blocked by .docx and .odt attachments.
>
> Could you let me know if some attachments are blocked by the list manager
> or mail server ?
>
> Tkanks in advance,
>
> --
> Emmanuel Charpentier
>
>


[O] Meta : what can be sent to this mailing list ?

2018-12-19 Thread Emmanuel Charpentier
Dear list,

I have made five attempts in three days to post a question to this list.
Three of them may have failed due to the use of an SMTP server flagged on
one site as possible spam source. The other two has been sent via gmai. So
far, none of these message have appeared on the list, and I received no
error message.

I know tha *some* attachments are accepted (a previous question of mine
included .tex, .pdf and .org files). However, I waonder if my mails may
have been blocked by .docx and .odt attachments.

Could you let me know if some attachments are blocked by the list manager
or mail server ?

Tkanks in advance,

--
Emmanuel Charpentier


Re: [O] Bug: Special property ITEM without stars [9.1.14]

2018-12-19 Thread Nicolas Goaziou
Hello,

Allen Li  writes:

> Okay, thanks.  I guess we can see how this works out with respect to users
> like Brent using org-tags-match-list-sublevels or otherwise using
> hierarchy.

On second thought, this may not be a good idea, especially on master
branch, which is close from being released.

As suggested before, you ought to use
`org-columns-modify-value-for-display-function' instead. This is
probably the cleanest way to solve the current issue.

Regards,

-- 
Nicolas Goaziou