emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Lexical binding bug in org-list.el?
@ 2015-11-06 19:43 Kaushal Modi
  2015-11-06 19:47 ` Kaushal Modi
  0 siblings, 1 reply; 12+ messages in thread
From: Kaushal Modi @ 2015-11-06 19:43 UTC (permalink / raw)
  To: emacs-org list

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-11-11  9:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06 19:43 Lexical binding bug in org-list.el? Kaushal Modi
2015-11-06 19:47 ` Kaushal Modi
2015-11-06 20:45   ` Aaron Ecay
2015-11-06 21:13     ` Kaushal Modi
2015-11-07  0:20     ` Nicolas Goaziou
2015-11-07 11:54       ` Aaron Ecay
2015-11-07 16:48         ` Nicolas Goaziou
2015-11-07 21:30           ` Aaron Ecay
2015-11-08 14:57             ` Nicolas Goaziou
2015-11-08 19:55               ` Aaron Ecay
2015-11-09 15:23                 ` Kaushal Modi
2015-11-11  9:33                 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).