From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: [BUG] fill-paragraph in orgstruct mode blows up Date: Sat, 19 Mar 2011 21:56:44 -0400 Message-ID: <10983.1300586204@alphaville.dokosmarshall.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=54780 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q17t2-0002pk-9K for emacs-orgmode@gnu.org; Sat, 19 Mar 2011 21:56:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q17t0-0004Gk-RK for emacs-orgmode@gnu.org; Sat, 19 Mar 2011 21:56:56 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:60509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q17t0-0004Ge-Id for emacs-orgmode@gnu.org; Sat, 19 Mar 2011 21:56:54 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LIC00J8Z2QKQXC0@vms173003.mailsrvcs.net> for emacs-orgmode@gnu.org; Sat, 19 Mar 2011 20:56:49 -0500 (CDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: nicholas.dokos@hp.com I use orgstruct mode when composing email and fill-paragraph blew up with the following backtrace when I tried to fill a paragraph after a drawer, as described in the last paragraph of this email. :SETUP: # Local variables: # eval: (org-update-all-dblocks) -*- # End: :END: This is a dummy paragraph after the drawer. Put cursor here and call fill-paragraph after enabling orgstruct-mode. You should get the error below. Nick Org-mode version 7.5 (release_7.5.86.g6daa.dirty) ,---- | Debugger entered--Lisp error: (wrong-type-argument stringp nil) | re-search-backward(nil nil t) | (cond ((and (looking-at item-re) (or (< ind ind-ref) (eq org-list-ending-method (quote regexp)))) (throw (quote exit) (point))) ((<= (point) lim-up) (throw (quote exit) nil)) ((and (not (eq org-list-ending-method (quote indent))) (looking-at org-list-end-re)) (throw (quote exit) nil)) ((looking-at "^[ ]*#\\+end_") (re-search-backward "^[ ]*#\\+begin_" nil t)) ((looking-at "^[ ]*:END:") (re-search-backward org-drawer-regexp nil t) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) (forward-line -1)) ((looking-at "^[ ]*$") (forward-line -1)) ((zerop ind) (throw (quote exit) nil)) ((< ind ind-ref) (setq ind-ref ind) (forward-line -1)) (t (forward-line -1))) | (let ((ind (org-get-indentation))) (cond ((and (looking-at item-re) (or (< ind ind-ref) (eq org-list-ending-method (quote regexp)))) (throw (quote exit) (point))) ((<= (point) lim-up) (throw (quote exit) nil)) ((and (not (eq org-list-ending-method (quote indent))) (looking-at org-list-end-re)) (throw (quote exit) nil)) ((looking-at "^[ ]*#\\+end_") (re-search-backward "^[ ]*#\\+begin_" nil t)) ((looking-at "^[ ]*:END:") (re-search-backward org-drawer-regexp nil t) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) (forward-line -1)) ((looking-at "^[ ]*$") (forward-line -1)) ((zerop ind) (throw (quote exit) nil)) ((< ind ind-ref) (setq ind-ref ind) (forward-line -1)) (t (forward-line -1)))) | (while t (let ((ind (org-get-indentation))) (cond ((and (looking-at item-re) (or (< ind ind-ref) (eq org-list-ending-method (quote regexp)))) (throw (quote exit) (point))) ((<= (point) lim-up) (throw (quote exit) nil)) ((and (not (eq org-list-ending-method (quote indent))) (looking-at org-list-end-re)) (throw (quote exit) nil)) ((looking-at "^[ ]*#\\+end_") (re-search-backward "^[ ]*#\\+begin_" nil t)) ((looking-at "^[ ]*:END:") (re-search-backward org-drawer-regexp nil t) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) (forward-line -1)) ((looking-at "^[ ]*$") (forward-line -1)) ((zerop ind) (throw (quote exit) nil)) ((< ind ind-ref) (setq ind-ref ind) (forward-line -1)) (t (forward-line -1))))) | (catch (quote exit) (while t (let ((ind (org-get-indentation))) (cond ((and (looking-at item-re) (or (< ind ind-ref) (eq org-list-ending-method ...))) (throw (quote exit) (point))) ((<= (point) lim-up) (throw (quote exit) nil)) ((and (not (eq org-list-ending-method ...)) (looking-at org-list-end-re)) (throw (quote exit) nil)) ((looking-at "^[ ]*#\\+end_") (re-search-backward "^[ ]*#\\+begin_" nil t)) ((looking-at "^[ ]*:END:") (re-search-backward org-drawer-regexp nil t) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) (forward-line -1)) ((looking-at "^[ ]*$") (forward-line -1)) ((zerop ind) (throw (quote exit) nil)) ((< ind ind-ref) (setq ind-ref ind) (forward-line -1)) (t (forward-line -1)))))) | (cond ((eq (nth 2 context) (quote invalid)) nil) ((looking-at item-re) (point)) (t (let ((hl 0) (i -1) end-bounds) (when (and (not (eq org-list-ending-method (quote indent))) (progn (while (setq i ...) (setq hl ...)) (setq end-bounds (org-in-regexp org-list-end-re hl))) (>= (point) (car end-bounds)) (< (point) (cdr end-bounds))) (goto-char (car end-bounds)) (forward-line -1))) (catch (quote exit) (while t (let ((ind (org-get-indentation))) (cond ((and ... ...) (throw ... ...)) ((<= ... lim-up) (throw ... nil)) ((and ... ...) (throw ... nil)) ((looking-at "^[ ]*#\\+end_") (re-search-backward "^[ ]*#\\+begin_" nil t)) ((looking-at "^[ ]*:END:") (re-search-backward org-drawer-regexp nil t) (beginning-of-line)) ((and inlinetask-re ...) (org-inlinetask-goto-beginning) (forward-line -1)) ((looking-at "^[ ]*$") (forward-line -1)) ((zerop ind) (throw ... nil)) ((< ind ind-ref) (setq ind-ref ind) (forward-line -1)) (t (forward-line -1)))))))) | (let* ((case-fold-search t) (context (org-list-context)) (lim-up (car context)) (inlinetask-re (and (featurep (quote org-inlinetask)) (org-inlinetask-outline-regexp))) (item-re (org-item-re)) (ind-ref (if (or (looking-at "^[ ]*$") (and inlinetask-re (looking-at inlinetask-re))) 10000 (org-get-indentation)))) (cond ((eq (nth 2 context) (quote invalid)) nil) ((looking-at item-re) (point)) (t (let ((hl 0) (i -1) end-bounds) (when (and (not (eq org-list-ending-method ...)) (progn (while ... ...) (setq end-bounds ...)) (>= (point) (car end-bounds)) (< (point) (cdr end-bounds))) (goto-char (car end-bounds)) (forward-line -1))) (catch (quote exit) (while t (let ((ind ...)) (cond (... ...) (... ...) (... ...) (... ...) (... ... ...) (... ... ...) (... ...) (... ...) (... ... ...) (t ...)))))) )) | (save-excursion (beginning-of-line) (let* ((case-fold-search t) (context (org-list-context)) (lim-up (car context)) (inlinetask-re (and (featurep (quote org-inlinetask)) (org-inlinetask-outline-regexp))) (item-re (org-item-re)) (ind-ref (if (or (looking-at "^[ ]*$") (and inlinetask-re (looking-at inlinetask-re))) 10000 (org-get-indentation)))) (cond ((eq (nth 2 context) (quote invalid)) nil) ((looking-at item-re) (point)) (t (let ((hl 0) (i -1) end-bounds) (when (and (not ...) (progn ... ...) (>= ... ...) (< ... ...)) (goto-char (car end-bounds)) (forward-line -1))) (catch (quote exit) (while t (let (...) (cond ... ... ... ... ... ... ... ... ... ...)))))))) | org-in-item-p() | (setq itemp (org-in-item-p)) | (save-excursion (forward-paragraph -1) (setq itemp (org-in-item-p))) | (cond ((and (equal (char-after (point-at-bol)) 42) (save-excursion (goto-char (point-at-bol)) (looking-at outline-regexp))) t) (table\.el-p t) (table-p (org-table-align) t) (itemp (let* ((struct (save-excursion (goto-char itemp) (org-list-struct))) (parents (org-list-parents-alist struct)) (children (org-list-get-children itemp struct parents)) beg end prev next prefix) (cond ((not children) (setq prefix (make-string (org-list-item-body-column itemp) 32) beg itemp end (org-list-get-item-end itemp struct))) ((< (point) (setq next (car children))) (setq prefix (make-string (org-list-item-body-column itemp) 32) beg itemp end next)) ((> (point) (setq prev (car ...))) (setq beg (org-list-get-item-end prev struct) end (org-list-get-item-end itemp struct) prefix (save-excursion (goto-char beg ) (skip-chars-forward " ") (make-string ... 32)))) (t (catch (quote exit) (while (setq next ...) (if ... ... ... ...))))) (flet ((fill-context-prefix (from to &optional flr) prefix)) (save- restriction (narrow-to-region beg end) (save-excursion (fill-paragraph justify)))) t)) ((save-excursion (forward-paragraph -1) (setq itemp (org-in-item-p))) (let ((struct (save-excursion (goto-char itemp) (org-list-struct)))) (save-restriction (narrow-to-region (org-list-get-bottom-point struct) (save-excursion (forward-paragraph 1) (point))) (fill-paragraph justify) t))) (t nil)) | (let ((table-p (org-at-table-p)) (table\.el-p (org-at-table\.el-p)) (itemp (org-in-item-p))) (cond ((and (equal (char-after (point-at-bol)) 42) (save-excursion (goto-char (point-at-bol)) (looking-at outline-regexp))) t) (table\.el-p t) (table-p (org-table-align) t) (itemp (let* ((struct (save-excursion (goto-char itemp) (org-list-struct))) (parents (org-list-parents-alist struct)) (children (org-list-get-children itemp struct parents)) beg end prev next prefix) (cond ((not children) (setq prefix (make-string ... 32) beg itemp end (org-list-get-item-end itemp struct))) ((< (point) (setq next ...)) (setq prefix (make-string ... 32) beg itemp end next)) ((> (point) (setq prev ...)) (setq beg (org-list-get-item-end prev struct) end (org-list-get-item-end itemp struct) prefix (save-excursio n ... ... ...))) (t (catch (quote exit) (while ... ...)))) (flet ((fill-context-prefix (from to &optional flr) prefix)) (save-restriction (narrow-to-region beg end) (save-excursion (fill-par agraph justify)))) t)) ((save-excursion (forward-paragraph -1) (setq itemp (org-in-item-p))) (let ((struct (save-excursion (goto-char itemp) (org-list-struct)))) (save-restriction (narrow-to-region (org-list-get-bottom-point struct) (save-excursion (forward-paragraph 1) (point))) (fill-paragraph justify) t))) (t nil))) | org-fill-paragraph(nil) | fill-paragraph(nil t) | call-interactively(fill-paragraph t nil) `----