emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] error in orgstruct-mode


From: Nick Dokos
Subject: Re: [O] error in orgstruct-mode
Date: Sat, 20 Oct 2012 19:11:52 -0400

Peter Salazar <address@hidden> wrote:

> OK, I was able to successfully install org-mode 7.9.2. But there's something 
> still wrong with the
> way org-mode and orgstruct-mode are handling numbered lists. 
> 
> In org-mode itself, when I enter "1. " and then hit OPTION-RETURN, it 
> generates the next line "2. "
> but my cursor stays on the first line "1. "
> 

It does that for me too if I leave the item empty, but if I say

1. foo

and press META-RET it generates the 2. line and goes to it.

> In markdown-mode with orgstruct-mode on, I get the following error:
> 

I don't have markdown mode, but in fundamental mode, turning on
orgstruct-mode and adding a numbered list behaves properly for me.
Can you try that? Is markdown mode a necessary prerequisite for the
bug to occur? If so, where does one get markdown mode?

I looked at the code a bit, but it's not obvious to me what's wrong.
The relevant code (in org-list.el:org-list-struct-apply-struct) is

,----
|       ;; 3. Shift each slice in buffer, provided delta isn't 0, from
|       ;;    end to beginning.  Take a special action when beginning is
|       ;;    at item bullet.
|       (mapc (lambda (e)
|             (unless (zerop (nth 2 e)) (apply shift-body-ind e))
|             (let* ((beg (nth 1 e))
|                    (cell (assq beg struct)))
|               (unless (or (not cell) (equal cell (assq beg old-struct)))
|                 (funcall modify-item beg))))
|           sliced-struct))
`----

in the (funcall modify-item beg) line. The modify-item function does

,----
|              (looking-at org-list-full-item-re)
|              ;; a.  Replace bullet
|              (unless (equal old-bul new-bul)
|                (replace-match new-bul nil nil nil 1))
`----

which is where it blows up. It uses match data from the previous search,
the call to looking-at, but what happens if looking-at returned nil?
Does it set the match data or is it then the case that the replace-match
is trying to use match data from some previous unrelated search?

Nick

> Debugger entered--Lisp error: (args-out-of-range -1 2)
>   replace-match("- " nil nil nil 1)
>   (if (equal old-bul new-bul) nil (replace-match new-bul nil nil nil 1))
>   (unless (equal old-bul new-bul) (replace-match new-bul nil nil nil 1))
>   (let* ((new-ind ...) (old-ind ...) (new-bul ...) (old-bul ...) (new-box 
> ...)) (looking-at
> org-list-full-item-re) (unless (equal old-bul new-bul) (replace-match new-bul 
> nil nil nil 1)) (cond
> (...) (... ...) (... ... ...) (t ...)) (unless (= new-ind old-ind) 
> (delete-region ... ...)
> (indent-to new-ind)))
>   (lambda (item) (goto-char item) (let* (... ... ... ... ...) (looking-at 
> org-list-full-item-re)
> (unless ... ...) (cond ... ... ... ...) (unless ... ... ...)))(399)
>   funcall((lambda (item) (goto-char item) (let* (... ... ... ... ...) 
> (looking-at
> org-list-full-item-re) (unless ... ...) (cond ... ... ... ...) (unless ... 
> ... ...))) 399)
>   (if (or (not cell) (equal cell ...)) nil (funcall modify-item beg))
>   (unless (or (not cell) (equal cell ...)) (funcall modify-item beg))
>   (let* ((beg ...) (cell ...)) (unless (or ... ...) (funcall modify-item 
> beg)))
>   (lambda (e) (unless (zerop ...) (apply shift-body-ind e)) (let* (... ...) 
> (unless ... ...)))((404
> 399 0))
>   mapc((lambda (e) (unless (zerop ...) (apply shift-body-ind e)) (let* (... 
> ...) (unless ... ...)))
> ((408 404 0) (404 399 0) (399 379 0) (379 300 0) (300 231 0) (231 147 0)))
>   (let (end-list acc-end itm-shift all-ends sliced-struct) (mapc (lambda ... 
> ...) old-struct) (setq
> all-ends (sort ... ...)) (while (cdr all-ends) (let* ... ...)) (mapc (lambda 
> ... ... ...)
> sliced-struct))
> ...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]