Re: [O] [PATCH] fix org-num-mode detect enabled already issue

2019-01-06 Thread stardiviner


I fixed my previous patch which work in reverse direction.

modified   lisp/org-num.el
@@ -438,17 +438,16 @@ NUMBERING is a list of numbers."
 (define-minor-mode org-num-mode
   "Dynamic numbering of headlines in an Org buffer."
   :lighter " o#"
-  (cond
-   (org-num-mode
-(unless (derived-mode-p 'org-mode)
-  (user-error "Cannot activate headline numbering outside Org mode"))
-(setq org-num--numbering nil)
-(setq org-num--overlays (nreverse (org-num--number-region nil nil)))
-(add-hook 'after-change-functions #'org-num--verify nil t))
-   (t
+  (if org-num-mode
+  (progn
+   (unless (derived-mode-p 'org-mode)
+ (user-error "Cannot activate headline numbering outside Org mode"))
+   (setq org-num--numbering nil)
+   (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
+   (add-hook 'after-change-functions #'org-num--verify nil t))
 (mapc #'delete-overlay org-num--overlays)
 (setq org-num--overlays nil)
-(remove-hook 'after-change-functions #'org-num--verify t
+(remove-hook 'after-change-functions #'org-num--verify t)))
 

-- 
[ 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] [PATCH] fix org-num-mode detect enabled already issue

2019-01-06 Thread stardiviner

Here is the screenshot which can demostrate this issue:



And here is the steps to reproduce this issue:

my config:

(require 'org-num)
(setq org-num-skip-footnotes t)
(add-hook 'org-mode-hook #'org-num-mode)

1. Then open an Org file, it has `org-num-mode` enabled because upper
   config added to hook.

2. Execute command with `[M-x org-mode]` again, then it will become as
   in screenshot.

-- 
[ 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] Org-drill broken with Org 9.2

2019-01-06 Thread stardiviner


Confirmed, I got same problem.

I'm using the latest master branch of Org source code.

-- 
[ 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] please read: bug when marking tasks done

2019-01-06 Thread Nicolas Goaziou
Hello,

cesar mena  writes:

> hello everyone,
>
> in the maint branch, marking a repeatable task as DONE causes the
> "Rescheduled from" dates to be lost in the :LOGBOOK:.
>
> in the below diff all of the from dates are rewritten with the new
> scheduled date:
>
>   -  SCHEDULED: <2018-12-04 Tue .+1m>
>   +  SCHEDULED: <2019-02-05 Tue .+1m>
>  :PROPERTIES:
>   -  :LAST_REPEAT: [2018-08-08 Wed 07:40]
>   +  :LAST_REPEAT: [2019-01-05 Sat 18:47]
>  :END:
>  :LOGBOOK:
>   -  - Rescheduled from "[2018-11-28 Wed .+1m]" on [2018-11-28 Wed 08:35]
>   -  - Rescheduled from "[2018-11-25 Sun .+1m]" on [2018-11-25 Sun 09:17]
>   -  - Rescheduled from "[2018-11-20 Tue .+1m]" on [2018-11-22 Thu 10:03]
>   -  - Rescheduled from "[2018-11-13 Tue .+1m]" on [2018-11-17 Sat 09:48]
>   -  - Rescheduled from "[2018-11-06 Tue .+1m]" on [2018-11-08 Thu 07:02]
>   -  - Rescheduled from "[2018-10-28 Sun .+1m]" on [2018-10-30 Tue 16:22]
>   -  - Rescheduled from "[2018-10-25 Thu .+1m]" on [2018-10-25 Thu 07:34]
>   -  - Rescheduled from "[2018-10-19 Fri .+1m]" on [2018-10-19 Fri 07:48]
>   -  - Rescheduled from "[2018-10-16 Tue .+1m]" on [2018-10-16 Tue 16:21]
>   -  - Rescheduled from "[2018-10-11 Thu .+1m]" on [2018-10-14 Sun 10:31]
>   -  - Rescheduled from "[2018-10-07 Sun .+1m]" on [2018-10-08 Mon 08:48]
>   -  - Rescheduled from "[2018-09-27 Thu .+1m]" on [2018-09-29 Sat 18:50]
>   -  - Rescheduled from "[2018-09-20 Thu .+1m]" on [2018-09-20 Thu 09:50]
>   -  - Rescheduled from "[2018-09-08 Sat .+1m]" on [2018-09-14 Fri 07:10]
>   +  - State "DONE"   from "TODO"   [2019-01-05 Sat 18:47]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-11-28 Wed 08:35]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-11-25 Sun 09:17]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-11-22 Thu 10:03]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-11-17 Sat 09:48]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-11-08 Thu 07:02]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-30 Tue 16:22]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-25 Thu 07:34]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-19 Fri 07:48]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-16 Tue 16:21]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-14 Sun 10:31]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-10-08 Mon 08:48]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-09-29 Sat 18:50]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-09-20 Thu 09:50]
>   +  - Rescheduled from "[2019-02-05 Tue .+1m]" on [2018-09-14 Fri 07:10]
>   
> bisect says it was introduced in
> af81211fdc01b64449179bcdb77fb1c8ecb3fb94.

Which is a bugfix…

I think a solution would be to remove the repeater from timestamps
inserted upon logging a state change or a re-scheduling.

However, you would have to fix your old documents manually.

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] fix org-num-mode detect enabled already issue

2019-01-06 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> When I execute command `[M-x org-mode]` on an Org buffer which is
> already have `org-num-mode` enabled. It will re-generate overlay.

I don't understand the issue you are encountering. Could you elaborate?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Can't create org-link to heading containing an ampersand

2019-01-06 Thread Nicolas Goaziou
Hello,

Joseph Lloyd  writes:

> I have the following heading:
>
> * Example & Test
>
> When I create the following link to it, I expect it to navigate to the 
> heading when I call org-open-at-point (C-c C-o):
> [[Example & Test][Example & Test]]
>
> Instead, calling org-open-at-point offers to create a new heading. If
> I say yes, a new heading is created, but calling org-open-at-point
> again on the link offers to create another heading identical to the
> first that was created.

I cannot reproduce it. Please update Org, or fix its installation (see below).

> Package: Org mode version N/A (N/A @
> /Users/joseph/.local/src/org-mode/lisp/)

This looks dubious.

Regards,

-- 
Nicolas Goaziou



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

2019-01-06 Thread Andrea Giugliano
Hi there,

That was a very helpful suggestion. At the bottom of the mail I attached
my first (working) stab at it.

The idea is to have an headline with the :spaced: tag and another tag
maintaining the number of repetition performed so far. At the beginning
I was thinking to use scheduled times instead of a "counter" tag, but it
was not worth the complexity of the code.

If anybody else finds this feature useful, what would be the best way
to share this?

#+begin_src elisp
(defun my/space-repeat-if-tag-spaced (e)
  "Resets the header on the TODO states and increases the scheduled date
according to a suggested spaced repetition interval."
  (let* ((spaced-rep-map '((0 . "++1d")
  (1 . "++2d")
  (2 . "++10d")
  (3 . "++30d")
  (4 . "++60d")
  (5 . "++4m")))
 (spaced-key "spaced")
 (tags (org-get-tags nil t))
 (spaced-todo-p (member spaced-key tags))
 (repetition-n (first (cdr spaced-todo-p)))
 (n+1 (if repetition-n (+ 1 (string-to-number (substring repetition-n 
(- (length repetition-n) 1) (length repetition-n 0))
 (spaced-repetition-p (alist-get n+1 spaced-rep-map))
 (new-repetition-tag (concat "repetition" (number-to-string n+1)))
 (new-tags (reverse (if repetition-n
(seq-reduce
 (lambda (a x) (if (string-equal x 
repetition-n) (cons new-repetition-tag a) (cons x a)))
 tags
 '())
  (seq-reduce
   (lambda (a x) (if (string-equal x spaced-key) 
(cons new-repetition-tag (cons x a)) (cons x a)))
   tags
   '())
(if (and spaced-todo-p spaced-repetition-p)
  (progn
  ;; avoid infinitive looping
  (remove-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced)
  ;; reset to previous state
  (org-call-with-arg 'org-todo 'left)
  ;; schedule to next spaced repetition
  (org-schedule nil (alist-get n+1 spaced-rep-map))
  ;; rewrite local tags
  (org-set-tags new-tags)
  (add-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced))
)))

(add-hook 'org-trigger-hook 'my/space-repeat-if-tag-spaced)
#+end_src


Thanks,

Andrea




On Wed 02 Jan 2019 at 05:59, Marcin Borkowski  wrote:

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



[O] Org-drill broken with Org 9.2

2019-01-06 Thread Neeum Zawan



Hi,

When I try to run Org-drill, I get the backtrace below.

Others are seeing it too:

https://bitbucket.org/eeeickythump/org-drill/issues/62/org-drill-doesnt-work-with-org-mode-92
Ideas?

Thanks.

Debugger entered--Lisp error: (error "Invalid match tag: \"\"")
 signal(error ("Invalid match tag: \"\""))
 error("Invalid match tag: %S" "")
 org-tags-expand("")
 org-make-tags-matcher("")
 org-map-entries((lambda nil (if (and (not (org-invisible-p)) (> 
 (org-current-level) drill-entry-level)) (progn (if (or (/= 
 (org-current-level) (1+ drill-entry-level)) (funcall test)) 
 (progn (hide-subtree))) (setq drill-sections (cons (point) 
 drill-sections) "" tree)
 (save-excursion (org-map-entries (function (lambda nil (if (and 
 (not (org-invisible-p)) (> (org-current-level) 
 drill-entry-level)) (progn (if (or (/= (org-current-level) (1+ 
 drill-entry-level)) (funcall test)) (progn (hide-subtree))) 
 (setq drill-sections (cons (point) drill-sections)) "" 
 'tree))
 (let ((drill-entry-level (org-current-level)) (drill-sections 
 nil)) (org-show-subtree) (save-excursion (org-map-entries 
 (function (lambda nil (if (and (not (org-invisible-p)) (> 
 (org-current-level) drill-entry-level)) (progn (if (or (/= 
 (org-current-level) (1+ drill-entry-level)) (funcall test)) 
 (progn (hide-subtree))) (setq drill-sections (cons (point) 
 drill-sections)) "" 'tree)) (reverse drill-sections))
 org-drill-hide-subheadings-if((lambda nil (let ((drill-heading 
 (org-get-heading t))) (not (member drill-heading 
 heading-list)

 org-drill-hide-all-subheadings-except(nil)
 (progn (org-drill-hide-all-subheadings-except nil) 
 (org-drill--show-latex-fragments) (condition-case nil (progn 
 (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p)))
 (unwind-protect (progn (org-drill-hide-all-subheadings-except 
 nil) (org-drill--show-latex-fragments) (condition-case nil 
 (progn (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text))
 (progn (org-drill-hide-clozed-text) (unwind-protect (progn 
 (org-drill-hide-all-subheadings-except nil) 
 (org-drill--show-latex-fragments) (condition-case nil (progn 
 (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text)))
 (progn (progn (org-drill-hide-clozed-text) (unwind-protect 
 (progn (org-drill-hide-all-subheadings-except nil) 
 (org-drill--show-latex-fragments) (condition-case nil (progn 
 (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text
 (unwind-protect (progn (progn (org-drill-hide-clozed-text) 
 (unwind-protect (progn (org-drill-hide-all-subheadings-except 
 nil) (org-drill--show-latex-fragments) (condition-case nil 
 (progn (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text 
 (org-drill-unhide-text))
 (progn (org-drill-hide-cloze-hints) (unwind-protect (progn 
 (progn (org-drill-hide-clozed-text) (unwind-protect (progn 
 (org-drill-hide-all-subheadings-except nil) 
 (org-drill--show-latex-fragments) (condition-case nil (progn 
 (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text 
 (org-drill-unhide-text)))
 (progn (progn (org-drill-hide-cloze-hints) (unwind-protect 
 (progn (progn (org-drill-hide-clozed-text) (unwind-protect 
 (progn (org-drill-hide-all-subheadings-except nil) 
 (org-drill--show-latex-fragments) (condition-case nil (progn 
 (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text 
 (org-drill-unhide-text
 (unwind-protect (progn (progn (org-drill-hide-cloze-hints) 
 (unwind-protect (progn (progn (org-drill-hide-clozed-text) 
 (unwind-protect (progn (org-drill-hide-all-subheadings-except 
 nil) (org-drill--show-latex-fragments) (condition-case nil 
 (progn (org-display-inline-images t)) (error nil)) 
 (org-cycle-hide-drawers 'all) (prog1 
 (org-drill-presentation-prompt) (org-drill-hide-subheadings-if 
 'org-drill-entry-p))) (org-drill-unhide-clozed-text 
 (org-drill-unhide-text (org-drill-unhide-text))
 (progn (if org-drill-hide-item-headings-p 
 (org-drill-hide-heading-at-point)) (org-drill-hide-comments) 
 (unwind-protect (progn (progn (