emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Lexical binding bug in org-list.el?


From: Kaushal Modi
Subject: [O] Lexical binding bug in org-list.el?
Date: Fri, 6 Nov 2015 14:43:50 -0500

Hi,

Here the required info:

Org-mode version 8.3.2 (release_8.3.2-287-gcce317 @
/home/kmodi/usr_local/apps/6/emacs/master/share/emacs/site-lisp/org/)

The bug is very easy to recreate.

(1) In any buffer, M-x org-mode

(2) Type * heading 1

(3) Do M-RET
Now you have
* heading 1
*

(4) Do C-c -
Now you have
* heading 1
-

(5) Do C-c *
Boom!

The depth var is not bound to anything in that lexical scope.

===== BACKTRACE

Debugger entered--Lisp error: (void-variable depth)
  (funcall get-stars depth)
  eval((funcall get-stars depth))
  (concat (eval istart) "%s")
  (cond ((eq type (quote descriptive)) (concat (let ((s (eval
istart))) (or (and (string-match "[ \n
]+\\'" s) (replace-match "" t t s)) istart)) "%s" (eval ddend))) ((and
counter (eq type (quote ordered))) (concat (eval icount) "%s")) (t
(concat (eval istart) "%s")))
  (concat (cond ((eq type (quote descriptive)) (concat (let ((s (eval
istart))) (or (and (string-match "[ \n
]+\\'" s) (replace-match "" t t s)) istart)) "%s" (eval ddend))) ((and
counter (eq type (quote ordered))) (concat (eval icount) "%s")) (t
(concat (eval istart) "%s"))) (eval iend))
  (let* ((counter (car-safe (prog1 item (setq item (cdr item))))) (fmt
(concat (cond ((eq type (quote descriptive)) (concat (let ... ...)
"%s" (eval ddend))) ((and counter (eq type ...)) (concat (eval icount)
"%s")) (t (concat (eval istart) "%s"))) (eval iend))) (first (car
item))) (cond ((string-match "\\[CBON\\]" first) (setq first
(replace-match cbon t t first))) ((string-match "\\[CBOFF\\]" first)
(setq first (replace-match cboff t t first))) ((string-match
"\\[CBTRANS\\]" first) (setq first (replace-match cbtrans t t
first)))) (if nobr (progn (setq first (org-list-item-trim-br first))))
(if (eq type (quote descriptive)) (progn (let* ((complete
(string-match "^\\(.*\\)[ ]+::[ ]*" first)) (term (if complete (let
... ...) "???")) (desc (if complete (substring first ...) first)))
(setq first (concat (eval dtstart) term (eval dtend) (eval ddstart)
desc))))) (setcar item first) (format fmt (mapconcat (function (lambda
(e) (if (stringp e) e (funcall export-sublist e (1+ depth))))) item
(or (eval csep) ""))))
  (closure ((export-sublist) (nobr) (cbtrans . "TODO") (cboff .
"TODO") (cbon . "DONE") (csep if org--blankp "\n\n" "\n") (lsep) (isep
if org--blankp "\n\n" "\n") (iend) (icount funcall get-stars depth)
(istart funcall get-stars depth) (ddend) (ddstart) (dtend . " ")
(dtstart . " ") (dend) (dstart) (uend) (ustart) (oend) (ostart)
(splicep . t) (p :splice t :dtstart " " :dtend " " :istart (funcall
get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (item type depth) (let*
((counter (car-safe (prog1 item (setq item (cdr item))))) (fmt (concat
(cond ((eq type ...) (concat ... "%s" ...)) ((and counter ...) (concat
... "%s")) (t (concat ... "%s"))) (eval iend))) (first (car item)))
(cond ((string-match "\\[CBON\\]" first) (setq first (replace-match
cbon t t first))) ((string-match "\\[CBOFF\\]" first) (setq first
(replace-match cboff t t first))) ((string-match "\\[CBTRANS\\]"
first) (setq first (replace-match cbtrans t t first)))) (if nobr
(progn (setq first (org-list-item-trim-br first)))) (if (eq type
(quote descriptive)) (progn (let* ((complete (string-match "^\\(.*\\)[
]+::[ ]*" first)) (term (if complete ... "???")) (desc (if complete
... first))) (setq first (concat (eval dtstart) term (eval dtend)
(eval ddstart) desc))))) (setcar item first) (format fmt (mapconcat
(function (lambda (e) (if (stringp e) e (funcall export-sublist e
...)))) item (or (eval csep) "")))))((nil "") unordered 0)
  funcall((closure ((export-sublist) (nobr) (cbtrans . "TODO") (cboff
. "TODO") (cbon . "DONE") (csep if org--blankp "\n\n" "\n") (lsep)
(isep if org--blankp "\n\n" "\n") (iend) (icount funcall get-stars
depth) (istart funcall get-stars depth) (ddend) (ddstart) (dtend . "
") (dtstart . " ") (dend) (dstart) (uend) (ustart) (oend) (ostart)
(splicep . t) (p :splice t :dtstart " " :dtend " " :istart (funcall
get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (item type depth) (let*
((counter (car-safe (prog1 item (setq item (cdr item))))) (fmt (concat
(cond ((eq type ...) (concat ... "%s" ...)) ((and counter ...) (concat
... "%s")) (t (concat ... "%s"))) (eval iend))) (first (car item)))
(cond ((string-match "\\[CBON\\]" first) (setq first (replace-match
cbon t t first))) ((string-match "\\[CBOFF\\]" first) (setq first
(replace-match cboff t t first))) ((string-match "\\[CBTRANS\\]"
first) (setq first (replace-match cbtrans t t first)))) (if nobr
(progn (setq first (org-list-item-trim-br first)))) (if (eq type
(quote descriptive)) (progn (let* ((complete (string-match "^\\(.*\\)[
]+::[ ]*" first)) (term (if complete ... "???")) (desc (if complete
... first))) (setq first (concat (eval dtstart) term (eval dtend)
(eval ddstart) desc))))) (setcar item first) (format fmt (mapconcat
(function (lambda (e) (if (stringp e) e (funcall export-sublist e
...)))) item (or (eval csep) ""))))) (nil "") unordered 0)
  (closure ((fmt . "%s") (items (nil "")) (type . unordered) (depth .
0) (sub unordered (nil "")) (export-item closure ((export-sublist)
(nobr) (cbtrans . "TODO") (cboff . "TODO") (cbon . "DONE") (csep if
org--blankp "\n\n" "\n") (lsep) (isep if org--blankp "\n\n" "\n")
(iend) (icount funcall get-stars depth) (istart funcall get-stars
depth) (ddend) (ddstart) (dtend . " ") (dtstart . " ") (dend) (dstart)
(uend) (ustart) (oend) (ostart) (splicep . t) (p :splice t :dtstart "
" :dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(params :splice t :dtstart " " :dtend " " :istart (funcall get-stars
depth) :icount (funcall get-stars depth) :isep (if org--blankp "\n\n"
"\n") :csep (if org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO"
:cbtrans "TODO") (list unordered (nil "")) org-tab-ind-state t) (item
type depth) (let* ((counter (car-safe (prog1 item ...))) (fmt (concat
(cond ... ... ...) (eval iend))) (first (car item))) (cond
((string-match "\\[CBON\\]" first) (setq first (replace-match cbon t t
first))) ((string-match "\\[CBOFF\\]" first) (setq first
(replace-match cboff t t first))) ((string-match "\\[CBTRANS\\]"
first) (setq first (replace-match cbtrans t t first)))) (if nobr
(progn (setq first (org-list-item-trim-br first)))) (if (eq type
(quote descriptive)) (progn (let* (... ... ...) (setq first ...))))
(setcar item first) (format fmt (mapconcat (function (lambda ... ...))
item (or (eval csep) ""))))) (export-sublist) (nobr) (cbtrans .
"TODO") (cboff . "TODO") (cbon . "DONE") (csep if org--blankp "\n\n"
"\n") (lsep) (isep if org--blankp "\n\n" "\n") (iend) (icount funcall
get-stars depth) (istart funcall get-stars depth) (ddend) (ddstart)
(dtend . " ") (dtstart . " ") (dend) (dstart) (uend) (ustart) (oend)
(ostart) (splicep . t) (p :splice t :dtstart " " :dtend " " :istart
(funcall get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (e) (funcall
export-item e type depth))((nil ""))
  mapconcat((closure ((fmt . "%s") (items (nil "")) (type . unordered)
(depth . 0) (sub unordered (nil "")) (export-item closure
((export-sublist) (nobr) (cbtrans . "TODO") (cboff . "TODO") (cbon .
"DONE") (csep if org--blankp "\n\n" "\n") (lsep) (isep if org--blankp
"\n\n" "\n") (iend) (icount funcall get-stars depth) (istart funcall
get-stars depth) (ddend) (ddstart) (dtend . " ") (dtstart . " ")
(dend) (dstart) (uend) (ustart) (oend) (ostart) (splicep . t) (p
:splice t :dtstart " " :dtend " " :istart (funcall get-stars depth)
:icount (funcall get-stars depth) :isep (if org--blankp "\n\n" "\n")
:csep (if org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans
"TODO") (params :splice t :dtstart " " :dtend " " :istart (funcall
get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (list unordered (nil ""))
org-tab-ind-state t) (item type depth) (let* ((counter (car-safe
(prog1 item ...))) (fmt (concat (cond ... ... ...) (eval iend)))
(first (car item))) (cond ((string-match "\\[CBON\\]" first) (setq
first (replace-match cbon t t first))) ((string-match "\\[CBOFF\\]"
first) (setq first (replace-match cboff t t first))) ((string-match
"\\[CBTRANS\\]" first) (setq first (replace-match cbtrans t t
first)))) (if nobr (progn (setq first (org-list-item-trim-br first))))
(if (eq type (quote descriptive)) (progn (let* (... ... ...) (setq
first ...)))) (setcar item first) (format fmt (mapconcat (function
(lambda ... ...)) item (or (eval csep) ""))))) (export-sublist) (nobr)
(cbtrans . "TODO") (cboff . "TODO") (cbon . "DONE") (csep if
org--blankp "\n\n" "\n") (lsep) (isep if org--blankp "\n\n" "\n")
(iend) (icount funcall get-stars depth) (istart funcall get-stars
depth) (ddend) (ddstart) (dtend . " ") (dtstart . " ") (dend) (dstart)
(uend) (ustart) (oend) (ostart) (splicep . t) (p :splice t :dtstart "
" :dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(params :splice t :dtstart " " :dtend " " :istart (funcall get-stars
depth) :icount (funcall get-stars depth) :isep (if org--blankp "\n\n"
"\n") :csep (if org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO"
:cbtrans "TODO") (list unordered (nil "")) org-tab-ind-state t) (e)
(funcall export-item e type depth)) ((nil "")) "\n")
  (format fmt (mapconcat (function (lambda (e) (funcall export-item e
type depth))) items (or (eval isep) "")))
  (let* ((type (car sub)) (items (cdr sub)) (fmt (concat (cond
(splicep "%s") ((eq type (quote ordered)) (concat (eval ostart) "%s"
(eval oend))) ((eq type (quote descriptive)) (concat (eval dstart)
"%s" (eval dend))) (t (concat (eval ustart) "%s" (eval uend)))) (eval
lsep)))) (format fmt (mapconcat (function (lambda (e) (funcall
export-item e type depth))) items (or (eval isep) ""))))
  (closure ((export-item closure ((export-sublist) (nobr) (cbtrans .
"TODO") (cboff . "TODO") (cbon . "DONE") (csep if org--blankp "\n\n"
"\n") (lsep) (isep if org--blankp "\n\n" "\n") (iend) (icount funcall
get-stars depth) (istart funcall get-stars depth) (ddend) (ddstart)
(dtend . " ") (dtstart . " ") (dend) (dstart) (uend) (ustart) (oend)
(ostart) (splicep . t) (p :splice t :dtstart " " :dtend " " :istart
(funcall get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (item type depth) (let*
((counter (car-safe (prog1 item ...))) (fmt (concat (cond ... ... ...)
(eval iend))) (first (car item))) (cond ((string-match "\\[CBON\\]"
first) (setq first (replace-match cbon t t first))) ((string-match
"\\[CBOFF\\]" first) (setq first (replace-match cboff t t first)))
((string-match "\\[CBTRANS\\]" first) (setq first (replace-match
cbtrans t t first)))) (if nobr (progn (setq first
(org-list-item-trim-br first)))) (if (eq type (quote descriptive))
(progn (let* (... ... ...) (setq first ...)))) (setcar item first)
(format fmt (mapconcat (function (lambda ... ...)) item (or (eval
csep) ""))))) (export-sublist) (nobr) (cbtrans . "TODO") (cboff .
"TODO") (cbon . "DONE") (csep if org--blankp "\n\n" "\n") (lsep) (isep
if org--blankp "\n\n" "\n") (iend) (icount funcall get-stars depth)
(istart funcall get-stars depth) (ddend) (ddstart) (dtend . " ")
(dtstart . " ") (dend) (dstart) (uend) (ustart) (oend) (ostart)
(splicep . t) (p :splice t :dtstart " " :dtend " " :istart (funcall
get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (sub depth) (let*
((type (car sub)) (items (cdr sub)) (fmt (concat (cond (splicep "%s")
((eq type ...) (concat ... "%s" ...)) ((eq type ...) (concat ... "%s"
...)) (t (concat ... "%s" ...))) (eval lsep)))) (format fmt (mapconcat
(function (lambda (e) (funcall export-item e type depth))) items (or
(eval isep) "")))))((unordered (nil "")) 0)
  funcall((closure ((export-item closure ((export-sublist) (nobr)
(cbtrans . "TODO") (cboff . "TODO") (cbon . "DONE") (csep if
org--blankp "\n\n" "\n") (lsep) (isep if org--blankp "\n\n" "\n")
(iend) (icount funcall get-stars depth) (istart funcall get-stars
depth) (ddend) (ddstart) (dtend . " ") (dtstart . " ") (dend) (dstart)
(uend) (ustart) (oend) (ostart) (splicep . t) (p :splice t :dtstart "
" :dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(params :splice t :dtstart " " :dtend " " :istart (funcall get-stars
depth) :icount (funcall get-stars depth) :isep (if org--blankp "\n\n"
"\n") :csep (if org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO"
:cbtrans "TODO") (list unordered (nil "")) org-tab-ind-state t) (item
type depth) (let* ((counter (car-safe (prog1 item ...))) (fmt (concat
(cond ... ... ...) (eval iend))) (first (car item))) (cond
((string-match "\\[CBON\\]" first) (setq first (replace-match cbon t t
first))) ((string-match "\\[CBOFF\\]" first) (setq first
(replace-match cboff t t first))) ((string-match "\\[CBTRANS\\]"
first) (setq first (replace-match cbtrans t t first)))) (if nobr
(progn (setq first (org-list-item-trim-br first)))) (if (eq type
(quote descriptive)) (progn (let* (... ... ...) (setq first ...))))
(setcar item first) (format fmt (mapconcat (function (lambda ... ...))
item (or (eval csep) ""))))) (export-sublist) (nobr) (cbtrans .
"TODO") (cboff . "TODO") (cbon . "DONE") (csep if org--blankp "\n\n"
"\n") (lsep) (isep if org--blankp "\n\n" "\n") (iend) (icount funcall
get-stars depth) (istart funcall get-stars depth) (ddend) (ddstart)
(dtend . " ") (dtstart . " ") (dend) (dstart) (uend) (ustart) (oend)
(ostart) (splicep . t) (p :splice t :dtstart " " :dtend " " :istart
(funcall get-stars depth) :icount (funcall get-stars depth) :isep (if
org--blankp "\n\n" "\n") :csep (if org--blankp "\n\n" "\n") :cbon
"DONE" :cboff "TODO" :cbtrans "TODO") (params :splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO")
(list unordered (nil "")) org-tab-ind-state t) (sub depth) (let*
((type (car sub)) (items (cdr sub)) (fmt (concat (cond (splicep "%s")
((eq type ...) (concat ... "%s" ...)) ((eq type ...) (concat ... "%s"
...)) (t (concat ... "%s" ...))) (eval lsep)))) (format fmt (mapconcat
(function (lambda (e) (funcall export-item e type depth))) items (or
(eval isep) ""))))) (unordered (nil "")) 0)
  (concat (funcall export-sublist list 0) "\n")
  (let* ((p params) (splicep (plist-get p :splice)) (ostart (plist-get
p :ostart)) (oend (plist-get p :oend)) (ustart (plist-get p :ustart))
(uend (plist-get p :uend)) (dstart (plist-get p :dstart)) (dend
(plist-get p :dend)) (dtstart (plist-get p :dtstart)) (dtend
(plist-get p :dtend)) (ddstart (plist-get p :ddstart)) (ddend
(plist-get p :ddend)) (istart (plist-get p :istart)) (icount
(plist-get p :icount)) (iend (plist-get p :iend)) (isep (plist-get p
:isep)) (lsep (plist-get p :lsep)) (csep (plist-get p :csep)) (cbon
(plist-get p :cbon)) (cboff (plist-get p :cboff)) (cbtrans (plist-get
p :cbtrans)) (nobr (plist-get p :nobr)) export-sublist (export-item
(function (lambda (item type depth) (let* ((counter ...) (fmt ...)
(first ...)) (cond (... ...) (... ...) (... ...)) (if nobr (progn
...)) (if (eq type ...) (progn ...)) (setcar item first) (format fmt
(mapconcat ... item ...)))))) (export-sublist (function (lambda (sub
depth) (let* ((type ...) (items ...) (fmt ...)) (format fmt (mapconcat
... items ...))))))) (concat (funcall export-sublist list 0) "\n"))
  org-list-to-generic((unordered (nil "")) (:splice t :dtstart " "
:dtend " " :istart (funcall get-stars depth) :icount (funcall
get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO"))
  (let* ((rule (cdr (assq (quote heading)
org-blank-before-new-entry))) (level (org-reduced-level (or
(org-current-level) 0))) (org--blankp (or (eq rule t) (and (eq rule
(quote auto)) (save-excursion (outline-previous-heading)
(org-previous-line-empty-p))))) (get-stars (function (lambda (d) (let
((oddeven-level ...)) (concat (make-string ... 42) " "))))))
(org-list-to-generic list (org-combine-plists (quote (:splice t
:dtstart " " :dtend " " :istart (funcall get-stars depth) :icount
(funcall get-stars depth) :isep (if org--blankp "\n\n" "\n") :csep (if
org--blankp "\n\n" "\n") :cbon "DONE" :cboff "TODO" :cbtrans "TODO"))
params)))
  org-list-to-subtree((unordered (nil "")))
  org-toggle-heading(nil)
  funcall-interactively(org-toggle-heading nil)
  call-interactively(org-toggle-heading)
  org-ctrl-c-star()
  funcall-interactively(org-ctrl-c-star)
  call-interactively(org-ctrl-c-star nil nil)
  command-execute(org-ctrl-c-star)


--
Kaushal Modi



reply via email to

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