Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Marcin Borkowski


On 2019-01-01, at 17:34, Andrea Giugliano  wrote:

> Hi,
>
> Thanks for your reply. You are right org-drill does spaced repetition. I
> just was unclear: I would like to see that in the agenda as a normal
> item (that gets space-repeated every time I mark it DONE though).
> I could not get from the docs if org-drill does that.

That is an interesting idea.  I am pretty sure you could make it happen
with `org-trigger-hook' or `org-after-todo-state-change-hook' (I am not
entirely sure why both exist, btw).

> Thanks,
>
> Andrea

Hth,

--
Marcin Borkowski
http://mbork.pl



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

2019-01-01 Thread stardiviner

Nicolas Goaziou  writes:

> Hello,
>
> stardiviner  writes:
>
>> Indeed, I mimicked `org-link-set-parameters' almost all. About this, I
>> originally just lazy, now I have a thought about this alist of plist
>> design, I think adding snippet-like text template string. This idea is
>> still coarse. I will update this idea in my org agenda todo list.
>
> We are not sure this would end up as a good idea anyway. Meanwhile,
> I think the alist of plists idea is a bit complicated.

Ok, I changed data structure into alist now.

>
>> And I have another reason, I think use same structure can make user feel
>> comfortable, because it is same as `org-link-set-parameters`. It's a
>> good reason.
>
> Org uses a lot of data types in its defcustoms. I don't think there is
> more comfort in sticking to a particular one. OTOH, a simpler structure
> means simpler code.

Ditto

>
> So if we have no other property than :function, I'd rather have a simple
> alist (KEY . FUNCTION). If we ever need more properties, we can change
> the structure, as long as it is in master, it is not set in stone.
>
>> About test, would you allow me to write it later?
>
> No problem. They do not need to be complex, tho.

I added a test by insert clocktable. It's passed.

>
>> At last, present my updated patch. Merry Christmas.
>
> Thank you.
>
>> -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-dblock~, which is bound to
>> +keybinding {{{kbd(C-c C-x i)}}} by default.
>> +
>> +#+kindex: C-c C-x i
>> +#+findex: org-dynamic-block-insert-dblock
>> +Select one type of dynamic block to insert.
>> +
>> +For example, {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a
>> +dynamic table that updates the work time (see [[*Clocking Work
>> Time]]).
>
> by a user function.
>
> #+kindex: C-c C-x x
> #+findex: org-dynamic-block-insert-dblock
> You can insert a dynamic block with ~org-dynamic-block-insert-dblock~,
> which is bound to {{{kbd(C-c C-x i)}}} by default. For example,
> {{{kbd(C-c C-x i c l o c k t a b l e RET)}}} inserts a table that
> updates the work time (see [[*Clocking Work Time]]).

Copied.

>
>> +(org-dynamic-block-set-parameters
>> + "clocktable"
>> + :function 'org-clock-report)
>
> The function could be, e.g.,
>
>   (org-dynamic-block-define "clocktable" #'org-clock-report)

Updated.

>
>> +(defun org-dynamic-block-get-parameter (type key)
>> +  "Get TYPE dynamic block property for KEY.
>> +TYPE is a string and KEY is a plist keyword."
>> +  (plist-get
>> +   (cdr (assoc type org-dynamic-block-parameters))
>> +   key))
>
> Simply
>
>   (cdr (assoc type org-dynamic-block-parameters))
>
> if you simplify the structure.

Updated.

>
>> +(defun org-dynamic-block-set-parameters (type  parameters)
>> +  "Set dynamic block TYPE properties to PARAMETERS.
>> +PARAMETERS should be :key val pairs.
>> +The key is usually is `:function', and the value is a function name symbol."
>> +  (let ((data (assoc type org-dynamic-block-parameters)))
>> +(if data (setcdr data (org-combine-plists (cdr data) parameters))
>> +  (push (cons type parameters) org-dynamic-block-parameters
>
> Ditto. It could be
>
> (defun org-dynamic-block-define (type fun)
>   (push (cons type fun) org-dynamic-block-parameters))

Updated.

>
>> +(defun org-dynamic-block-types ()
>> +  "Return a list of known dynamic block types."
>> +  (mapcar #'car org-dynamic-block-parameters))
>> +
>> +(defun org-dynamic-block-functions ()
>> +  "Return a list of functions that are called to insert dynamic block."
>> +  (cl-loop for dblock in org-dynamic-block-parameters
>> +   with insert-func
>> +   do (setq insert-func (org-dynamic-block-get-parameter (car 
>> dblock) :function))
>> +   if insert-func
>> +   collect insert-func))
>
> Is this function necessary?

Updated.

>
>> +(defun org-dynamic-block-insert-dblock (dblock-type)
>> +  "Insert a dynamic block of type DBLOCK-TYPE.
>> +When used interactively, select the dynamic block types among
>> +defined types, per `org-dynamic-block-set-parameters'."
>> +  (interactive (list (completing-read "dynamic block: "
>> +  (mapcar #'car 
>> org-dynamic-block-parameters
>
> (mapcar #'car ...) -> (org-dynamic-block-types)

Updated.

>
>> +  (let ((func (org-dynamic-block-get-parameter dblock-type :function)))
>
> See above.

Updated.

Regards.

As always, add patch as attachment.

>From ac812470f074e40727a0ee5487f4608418ec18ea Mon Sep 17 00:00:00 2001
From: stardiviner 
Date: Sun, 23 Dec 2018 13:35:38 +0800
Subject: [PATCH] * lisp/org.el (org-dynamic-block-insert-dblock): New
 function.

  (org-dynamic-block-alist, org-dynamic-block-functions,
  org-dynamic-block-types, org-dynamic-block-define,
  

[O] How about Org Mode invalid link handling strategy for exporting?

2019-01-01 Thread stardiviner
When I use package "ox-epub" to export current Org buffer to EPUB file,
it is based on "ox-html", I got some issues. One issue is about the
external file resource link which can't add into EPUB, or internal link
but invalid (I use narrow to subtree to debug Org buffer when using
ox-epub, so some internal links to other headlines will be invalid).

I hope Org Mode can enhance this invalid link handling strategy to not
interrupt user exporting process. Just display warning to user. Or add
an option to controlled by user?

Because I'm exporting a big Clojure language reference to EPUB, so
really hard to handling those invalid links.

About the handling strategy, I have some ideas:

- raise warning about invalid links no matter internal links or external
  links.

- don't interrupt process when meet invalid links.

- keep link description part as link part. Replace the original link
  part with an empty link.

Do you any ideas?

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

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



Re: [O] [BUG] org-agenda-skip-*-if-* variables change log mode

2019-01-01 Thread Samuel Wales
On 1/1/19, Nicolas Goaziou  wrote:
>> stuff you don't need in the agenda, or you have a broken log mode.]
>>
>> but i'm wondering if my emails are reaching the list.
>
> They do.
>
> For the record, I will not try to fix that bug. Someone else may do,
> though.
>
> Regards,

thank you for responding and confirming.

probably a lot of people turn those variables on, to create a clean
agenda.  scheduled doneish tasks are likely to be significantly fewer
than all timestamps, so the incompleteness of the log might go
unnoticed for years.

you are, of course, not required to fix any bug.  i appreciate the
work you do on org.



[O] how do I search state change dates?

2019-01-01 Thread Christopher W. Ryan
I try to keep track of books I want to read, and when I eventually read
them.  I use TODO keyword for books I intend to read, and I change the
state to READING and then DONE, as appropriate. Each state change gets a
date/time stamp.

My preamble is:

#+TODO: TODO(t!) READING(r!) POSTPONED(p!) RESTARTED(s!) | DONE(d!)
NA(n!) ABANDONED(a!)


An entry for a book not yet read might look like this:

** TODO America: the Farewell Tour
   :PROPERTIES:
   :AUTHORLNAME: Hedges
   :AUTHORFNAME: Chris
   :ISBN: 9781501152672
   :DATEADDED: <2018-10-10 Wed>
   :END:

An entry for a book I've read might look like this:

** DONE Northland
   - State "DONE"   from "READING"[2018-10-21 Sun 22:45]
   - State "READING"from "TODO"   [2018-10-08 Mon 22:09]
   :PROPERTIES:
   :AUTHORLNAME: Fox
   :AUTHORFNAME: Porter
   :ISBN: 9780393248852
   :DATEADDED: <2018-10-07 Sun>
   :END:


How can I retrieve all the entries for the books I've read in 2018? In
other words, all those that changed state to DONE in 2018?

Thanks.

--Chris Ryan



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/)]

2019-01-01 Thread Nicolas Goaziou
Carlos Pita  writes:

> 2. If the parser identifies a block how is it in a better position to flag
> it as outdated regarding fontification? Do you mean completely
> circumventing the search based font lock mechanism with its multiline
> property and region extensions? That is, directly setting face related
> properties and forcing a refresh of the region?

Indeed. Barring headlines, info lines and properties drawers, I suggest
to have Font lock delegate fontification to a function that would parse
an appropriate region and apply faces according to the AST.

One subtle problem is to determine the region to parse according to the
changes, but this is not specific to fontification. I.e., this function
needs to be written for proper parser caching anyway.



Re: [O] Bug: Latex preview fg color w/tikz (known problem, fix suggested) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/carlos/local/stow/emacs-26/share/emacs/26.1.90/lisp/org/)]

2019-01-01 Thread Carlos Pita
Considering the above, do you still want me to write a patch for this?

Some options:

1. Add the above as a remark in the user guide or the wiki.

2. Add a variant of the dvipng backend, say dvipng-xcolor, as explained.

3. Remove the dvipng cli color code and (maybe just deprecate or ignore)
the use-xcolor option altogether and make xcolor the default for every
backend.

4. Do nothing.

What do you think?

Regards
--
Carlos


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/)]

2019-01-01 Thread Carlos Pita
3. Or maybe you mean a region extension function that uses the parser to
find out the opposite delimiter of a block?


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/)]

2019-01-01 Thread Carlos Pita
>
>
> I'd
> rather see work to integrate fontification with the parser.
>

I could take a look at this sometime in the next few months but I'm not
sure what do you mean. In particular:

1. Is the parser doing partial parsings of every inserted/removed character
or line in a more or less complete syntactical environment around the
insertion/removal?

2. If the parser identifies a block how is it in a better position to flag
it as outdated regarding fontification? Do you mean completely
circumventing the search based font lock mechanism with its multiline
property and region extensions? That is, directly setting face related
properties and forcing a refresh of the region?


> Meanwhile, I applied your patch in master. I also added a commit
> message.
>

Thanks, Nicolas!

Best regards
--
Carlos


Re: [O] Feature request: Add support for org-toggle-pretty-entities preview of org-entities-user which are more than one unicode character

2019-01-01 Thread Nicolas Goaziou
Hello,

Ilja Kocken  writes:

> Is there a particular reason that I'm missing for why it will only
> preview single-character entities?

Entities provide a way to insert special characters using only ASCII.
You are trying to use them as a templating system, or some such, which
is not the initial use case.

> Or am I going about this the wrong way in this particular case?
> I could of course also write yasnippets to autocomplete the full
> org-source, but I would like more control over what the latex export
> looks like (since I have to format everything according to strict
> latex conventions for scientific journals, so for example the default
> CO_2 -> CO\(_{\text{2}}\) is wrong).

You have control over what the LaTeX output will be, e.g., CO_{$2$}, or
\(CO_2\), whichever you need.

IOW, I think a package like Yasnippet already fulfills your needs.

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] org-agenda-skip-*-if-* variables change log mode

2019-01-01 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> On 12/22/18, Samuel Wales  wrote:
>> at least i /think/ this is a bug.
>
> [what i mean is, as opposed to there already being a fix, or it being
> an intentional feature.  i am pretty sure it is a bug: you either have
> stuff you don't need in the agenda, or you have a broken log mode.]
>
> but i'm wondering if my emails are reaching the list.

They do.

For the record, I will not try to fix that bug. Someone else may do,
though.

Regards,

-- 
Nicolas Goaziou



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/)]

2019-01-01 Thread Nicolas Goaziou
Hello,

Carlos Pita  writes:

> Here is a patch on top of latest revision. It just adds an extension
> function while initializing font locking, as documented in [1]. It
> indeed reduces lines of code to some extent by moving the dirty stuff
> out of the fontification function (but I tried to keep the code
> formatting of your last commit, since it was rather different than the
> one shipped with emacs). The approach is more robust AFAICS since the
> font locking framework is correctly informed of which blocks should be
> refontified before fontification itself happens. It covers all types
> of blocks: #+BEGIN/#+END, \begin\end, \[\]. It's not a full parser but
> at least it matches corresponding delimiters by type by using a simple
> heuristic.

I still think it is not a good long-term solution for fontification. I'd
rather see work to integrate fontification with the parser.

Meanwhile, I applied your patch in master. I also added a commit
message.

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Andrea Giugliano
Hi,

Thanks for your reply. You are right org-drill does spaced repetition. I
just was unclear: I would like to see that in the agenda as a normal
item (that gets space-repeated every time I mark it DONE though).
I could not get from the docs if org-drill does that.

Thanks,

Andrea

On Tue 01 Jan 2019 at 16:39, Bingo  wrote:

> Le 1 janvier 2019 18:02:31 GMT+05:30, Andrea Giugliano  a 
> écrit :
>>Happy 2019 everyone!
>>
>>I would like to slightly change my learning method this year. I have
>>heard that spaced learning is much better than bang your head against
>>the same material multiple times in a row.
>>
>>Spaced learning is simply reviewing some interesting topic at given
>>intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...
>>
>>It seems to me that org-mode does not support this: how would you make
>>a
>>repetitive task with spaced intervals?
>>
>>I saw org-drill.el, but I do not think it does this.
>>Ideally I could do something like:
>>
>>""
>>* review this interesting thing
>>SCHEDULED: <2019-01-01 Tue>
>>:PROPERTIES:
>>:SPACED:
>>:END:
>>""
>>
>>If this is not an interesting use case for org-mode, what do you think
>>about me trying to extend org-habits.el instead?
>>
>>Best wishes to all the community,
>>
>>Andrea
>
> Hi,
>Why do you think org-drill doesn't do spaced repetition ? I used it for a 
> while in 2017, and it does. I've since moved to Anki on Android phone for the 
> same purpose, because phones are accessible for longer, but was happy with 
> org-drill.


Re: [O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-01 Thread Nicolas Goaziou
Hello,

David Wen Riccardi-Zhu  writes:

> I use the following capture template to store bookmarks:
>
> * %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: - Added %U. :END: 
>
> It was working fine until I updated my packages today. If I try to use
> the template now, the following is displayed in the minibuffer:
>
> org-capture: Capture abort: Wrong type argument: stringp, nil

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Secondary smart quotes are exported as apostrophes. [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/coleman/.emacs.d/elpa/org-9.1.14/)]

2019-01-01 Thread Nicolas Goaziou
Hello,

Coleman Gariety  writes:

> According to documentation (org-export-with-smart-quotes) should treat
> "pairs of single quotes as secondary quotes." This text:

Only within primary quotes! If there are no primary quotes around, you
don't need a second level of quotation, and single quotes are not
special.

Regards,

-- 
Nicolas Goaziou



Re: [O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Bingo
Le 1 janvier 2019 18:02:31 GMT+05:30, Andrea Giugliano  a 
écrit :
>Happy 2019 everyone!
>
>I would like to slightly change my learning method this year. I have
>heard that spaced learning is much better than bang your head against
>the same material multiple times in a row.
>
>Spaced learning is simply reviewing some interesting topic at given
>intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...
>
>It seems to me that org-mode does not support this: how would you make
>a
>repetitive task with spaced intervals?
>
>I saw org-drill.el, but I do not think it does this.
>Ideally I could do something like:
>
>""
>* review this interesting thing
>SCHEDULED: <2019-01-01 Tue>
>:PROPERTIES:
>:SPACED:
>:END:
>""
>
>If this is not an interesting use case for org-mode, what do you think
>about me trying to extend org-habits.el instead?
>
>Best wishes to all the community,
>
>Andrea

Hi,
   Why do you think org-drill doesn't do spaced repetition ? I used it for a 
while in 2017, and it does. I've since moved to Anki on Android phone for the 
same purpose, because phones are accessible for longer, but was happy with 
org-drill.




[O] Org mode repeated dates to do spaced learning

2019-01-01 Thread Andrea Giugliano
Happy 2019 everyone!

I would like to slightly change my learning method this year. I have
heard that spaced learning is much better than bang your head against
the same material multiple times in a row.

Spaced learning is simply reviewing some interesting topic at given
intervals: after 1 day, 1 week, 2 weeks, 1 month, 3 months, etc...

It seems to me that org-mode does not support this: how would you make a
repetitive task with spaced intervals?

I saw org-drill.el, but I do not think it does this.
Ideally I could do something like:

""
* review this interesting thing
SCHEDULED: <2019-01-01 Tue>
:PROPERTIES:
:SPACED:
:END:
""

If this is not an interesting use case for org-mode, what do you think
about me trying to extend org-habits.el instead?

Best wishes to all the community,

Andrea



[O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-01 Thread David Wen Riccardi-Zhu



I use the following capture template to store bookmarks:

* %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: 
- Added %U. 
:END: 

It was working fine until I updated my packages today. If I try to 
use the template now, the following is displayed in the 
minibuffer:


org-capture: Capture abort: Wrong type argument: stringp, nil

This happens after the first prompt.

Remember to cover the basics, that is, what you expected to happen 
and what in fact did happen.  You don't know how to make a good 
report?  See 

https://orgmode.org/manual/Feedback.html#Feedback 

Your bug report will be posted to the Org mailing list. 
 
Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.22.30) 
of 2018-07-05 
Package: Org mode version 9.2 (9.2-elpaplus @ 
/home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/) 



--
dwrz|朱为文



[O] Bug: Secondary smart quotes are exported as apostrophes. [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/coleman/.emacs.d/elpa/org-9.1.14/)]

2019-01-01 Thread Coleman Gariety
According to documentation (org-export-with-smart-quotes) should treat
"pairs of single quotes as secondary quotes." This text:

'foo'

Should be exported to HTML as:

foo

However, org-mode 9.1.14 exports this text as:

foo

This does not occur when a secondary pair of quotations occurs within a
pair of primary quotations. This text:

"'foo'"

Gets exported (properly) as:

foo

This also occurs when exporting to pdf, latex and odt.

I was able to get org to export smart quotes as expected by commenting
out line `5505` of `ox.el`:

5503 ;; Not already in a level 1 quote: this is an
5504 ;; apostrophe.
5505 ;; ((not level1-open) 'apostrophe)

Even with this line commented out, apostrophes are properly
exported. (Even within pairs of primary and secondary quotations.)

Is something wrong with my configuration? Or is there a problem with the
org-export--smart-quote-status function?

Thank you.
Coleman

Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05
Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @
/home/coleman/.emacs.d/elpa/org-9.1.14/)