org-archive-subtree errors when logbook lines are unindented

2020-11-21 Thread Duianto
Source:
org-archive-subtree does not work on subtrees with clock entries #14033
https://github.com/syl20bnr/spacemacs/issues/14033

Description:
The error message:
indent-line-to: Wrong type argument: wholenump, -1

appears when org-archive-subtree (C-c C-x C-s) is called on a
subheading that has :LOGBOOK: lines without indentation.

With indentation:

* a
** b
  :LOGBOOK:
  CLOCK: [2020-08-10 Mon 17:49]--[2020-08-10 Mon 18:34] => 0:45
  :END:

With the cursor on the subheading: ** b
After pressing: C-c C-x C-s

The buffer contents changed to:

* a

The *Messages* buffer shows:

(New file)
Copied: Subtree(s) with 89 characters
Saving file c:/Users/username/Temp/14033/org-archive-subtree.org_archive...
Wrote c:/Users/username/Temp/14033/org-archive-subtree.org_archive
Cut: Subtree(s) with 89 characters
Subtree archived in file:
c:/Users/username/Temp/14033/org-archive-subtree.org_archive

The file: org-archive-subtree.org_archive contains:

#-*- mode: org -*-


Archived entries from file c:/Users/username/Temp/14033/org-archive-subtree.org


* b
  :PROPERTIES:
  :ARCHIVE_TIME: 2020-11-21 Sat 08:12
  :ARCHIVE_FILE: c:/Users/username/Temp/14033/org-archive-subtree.org
  :ARCHIVE_OLPATH: a
  :ARCHIVE_CATEGORY: org-archive-subtree
  :END:
 :LOGBOOK:
 CLOCK: [2020-08-10 Mon 17:49]--[2020-08-10 Mon 18:34] => 0:45
 :END:

Without indentation:

* a
** b
:LOGBOOK:
CLOCK: [2020-08-10 Mon 17:49]--[2020-08-10 Mon 18:34] => 0:45
:END:

With the cursor on the subheading: ** b
After pressing: C-c C-x C-s

The buffer contents didn't change.

The *Messages* buffer shows:

(New file)
Copied: Subtree(s) with 83 characters
indent-line-to: Wrong type argument: wholenump, -1



Re: org-insert-item, indent causes a soft freeze or error message

2020-07-06 Thread Duianto -
I applied the fix manually and there are no more freezes or error messages.

Thank you.

On Mon, Jul 6, 2020 at 12:08 PM Nicolas Goaziou  wrote:
>
> Hello,
>
> Duianto -  writes:
>
> > Reproduction Steps:
> >
> > Copy the following lines:
> > 1. a
> >b
> > 2. c
> >
>
> [...]
>
> > Move the cursor to the end of the first line, after the: a
>
> [...]
>
> > Evaluate the following command: S-M-; (org-insert-item) RET
>
> [...]
>
> > A Backtrace buffer opens with the message:
> >
> > Debugger entered--Lisp error: (args-out-of-range 0 1)
> >   replace-match("1. " nil nil nil 1)
> >   #f(compiled-function (struct old-struct item) # > 0x497071>)(((1 0 "1. " nil nil nil 6) (6 0 "2. " nil nil nil 13) (16 0
> > "1. " nil nil nil 20)) ((1 0 "1. " nil nil nil 6) (6 0 "1. " nil nil
> > nil 13) (16 0 "2. " nil nil nil 20)) 16)
> >   org-list-struct-apply-struct(((1 0 "1. " nil nil nil 6) (6 0 "2. "
> > nil nil nil 13) (16 0 "1. " nil nil nil 20)) ((1 0 "1. " nil nil nil
> > 6) (6 0 "1. " nil nil nil 13) (16 0 "2. " nil nil nil 20)))
> >   org-list-write-struct(((1 0 "1. " nil nil nil 6) (6 0 "2. " nil nil
> > nil 13) (16 0 "1. " nil nil nil 20)) ((1) (6) (16)))
> >   org-insert-item()
> >   eval((org-insert-item) nil)
> >   eval-expression((org-insert-item) nil nil 127)
> >   funcall-interactively(eval-expression (org-insert-item) nil nil 127)
> >   call-interactively(eval-expression nil nil)
> >   command-execute(eval-expression)
>
> Fixed. Thank you.
> >
> > No indentation:
> > If the indentation is removed from the second line:
> > 1. a
> > b
> > 2. c
> >
> > Then it might be working as expected:
> > 1. a
> > 2.
> > b
> > 2. c
> >
> > a correctly numbered list item is inserted.
> >
> > The fourth lines list number: 2. c
> > didn't change, but it might be expected since there was no indentation
> > before the: b
> > therefore it might be assumed that the list ended there.
>
> This is expected. You need to fix the second list manually, with C-c C-c.
>
> Regards,
> --
> Nicolas Goaziou



org-insert-item, indent causes a soft freeze or error message

2020-07-06 Thread Duianto -
Hello

Depending on the indentation amount on the line following a list item,
when (org-insert-item) is evaluated.

Causes Emacs to soft freeze (can be canceled by pressing: C-g)
or an error message is shown: (args-out-of-range 0 1)


Reproduction Steps:

Copy the following lines:
1. a
   b
2. c

(the second line is indented by 3 spaces)

Open a new buffer: C-x b test.org RET
Switch to org mode: M-x org-mode RET
Paste the copied lines: C-y
Move the cursor to the end of the first line, after the: a
(if the cursor is before the a, then the list item is added on a new line above
probably as expected)
Evaluate the following command: S-M-; (org-insert-item) RET

Observed:
The only visible change is that the cursor moves to the beginning of
the "Eval:" prompt in the minibuffer.
The Emacs cpu usage spikes (an infinite loop?)
The soft freeze can be canceled by pressing: C-g
The buffer now shows:
1. a
1.
   b
2. c

The initial example above had three spaces before the: b
The same soft freeze is observed if more spaces are added before the: b
(I only tested it, up to five spaces, but I there might not be an upper limit)

Indented by one or two spaces:
If the initial second line is indented with one or two spaces, then
Emacs shows an error message instead of freezing.
A Backtrace buffer opens with the message:

Debugger entered--Lisp error: (args-out-of-range 0 1)
  replace-match("1. " nil nil nil 1)
  #f(compiled-function (struct old-struct item) #)(((1 0 "1. " nil nil nil 6) (6 0 "2. " nil nil nil 13) (16 0
"1. " nil nil nil 20)) ((1 0 "1. " nil nil nil 6) (6 0 "1. " nil nil
nil 13) (16 0 "2. " nil nil nil 20)) 16)
  org-list-struct-apply-struct(((1 0 "1. " nil nil nil 6) (6 0 "2. "
nil nil nil 13) (16 0 "1. " nil nil nil 20)) ((1 0 "1. " nil nil nil
6) (6 0 "1. " nil nil nil 13) (16 0 "2. " nil nil nil 20)))
  org-list-write-struct(((1 0 "1. " nil nil nil 6) (6 0 "2. " nil nil
nil 13) (16 0 "1. " nil nil nil 20)) ((1) (6) (16)))
  org-insert-item()
  eval((org-insert-item) nil)
  eval-expression((org-insert-item) nil nil 127)
  funcall-interactively(eval-expression (org-insert-item) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)


No indentation:
If the indentation is removed from the second line:
1. a
b
2. c

Then it might be working as expected:
1. a
2.
b
2. c

a correctly numbered list item is inserted.

The fourth lines list number: 2. c
didn't change, but it might be expected since there was no indentation
before the: b
therefore it might be assumed that the list ended there.

At least Emacs didn't freeze or show any errors.


System info:
Org mode version 9.3.7 (9.3.7-4-gba6ca7-elpaplus @
c:/Users/username/.emacs.d/elpa/org-plus-contrib-20200622/)
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
Windows 1903



ol-notmuch.el first line, incorrect filename: org-notmuch.el

2020-01-10 Thread Duianto -
Problem:
The first line of `ol-notmuch.el` shows the filename as: `org-notmuch.el`
https://code.orgmode.org/bzg/org-mode/src/3a6061e787efc9793ce1b7445a1f2502f679b40e/contrib/lisp/ol-notmuch.el#L1

Cause:
It was overlooked when the other instances in the same file, were
renamed in this commit:
https://code.orgmode.org/bzg/org-mode/commit/499c0a50cc4b11e37b91374af23cb27ab8fc20d2#diff-6c345091b7fe5d259065a88d401cb738915e6f4R1

Solution:
Before:
;;; org-notmuch.el --- Links to notmuch messages

After:
;;; ol-notmuch.el --- Links to notmuch messages