From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: error in orgstruct-mode Date: Sat, 20 Oct 2012 19:11:52 -0400 Message-ID: <12148.1350774712@alphaville> References: <12840.1350687277@alphaville.americas.hpqcorp.net> <3572.1350695622@alphaville> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPiD8-0003yK-6S for emacs-orgmode@gnu.org; Sat, 20 Oct 2012 19:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPiD3-0007Yo-Ga for emacs-orgmode@gnu.org; Sat, 20 Oct 2012 19:12:05 -0400 Received: from g1t0026.austin.hp.com ([15.216.28.33]:30723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPiD3-0007Y6-9o for emacs-orgmode@gnu.org; Sat, 20 Oct 2012 19:12:01 -0400 In-Reply-To: Message from Peter Salazar of "Sat\, 20 Oct 2012 17\:27\:10 EDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Peter Salazar Cc: org-mode Peter Salazar wrote: > OK, I was able to successfully install org-mode 7.9.2. But there's someth= ing still wrong with the > way org-mode and orgstruct-mode are handling numbered lists.=C2=A0 >=20 > In org-mode itself, when I enter "1. " and then hit OPTION-RETURN, it gen= erates the next line "2. " > but my cursor stays on the first line "1. " >=20 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: >=20 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) > =C2=A0 replace-match("- " nil nil nil 1) > =C2=A0 (if (equal old-bul new-bul) nil (replace-match new-bul nil nil nil= 1)) > =C2=A0 (unless (equal old-bul new-bul) (replace-match new-bul nil nil nil= 1)) > =C2=A0 (let* ((new-ind ...) (old-ind ...) (new-bul ...) (old-bul ...) (ne= w-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 (=3D new-ind old-ind) (del= ete-region ... ...) > (indent-to new-ind))) > =C2=A0 (lambda (item) (goto-char item) (let* (... ... ... ... ...) (looki= ng-at org-list-full-item-re) > (unless ... ...) (cond ... ... ... ...) (unless ... ... ...)))(399) > =C2=A0 funcall((lambda (item) (goto-char item) (let* (... ... ... ... ...= ) (looking-at > org-list-full-item-re) (unless ... ...) (cond ... ... ... ...) (unless ..= . ... ...))) 399) > =C2=A0 (if (or (not cell) (equal cell ...)) nil (funcall modify-item beg)) > =C2=A0 (unless (or (not cell) (equal cell ...)) (funcall modify-item beg)) > =C2=A0 (let* ((beg ...) (cell ...)) (unless (or ... ...) (funcall modify-= item beg))) > =C2=A0 (lambda (e) (unless (zerop ...) (apply shift-body-ind e)) (let* (.= .. ...) (unless ... ...)))((404 > 399 0)) > =C2=A0 mapc((lambda (e) (unless (zerop ...) (apply shift-body-ind e)) (le= t* (... ...) (unless ... ...))) > ((408 404 0) (404 399 0) (399 379 0) (379 300 0) (300 231 0) (231 147 0))) > =C2=A0 (let (end-list acc-end itm-shift all-ends sliced-struct) (mapc (la= mbda ... ...) old-struct) (setq > all-ends (sort ... ...)) (while (cdr all-ends) (let* ... ...)) (mapc (lam= bda ... ... ...) > sliced-struct)) > ...