phillord / lentic

Create views of the same content in two Emacs buffers
183 stars 12 forks source link

wrong-type-argument number-or-marker-p nil in lentic-chunk-comment-buffer #53

Open kevinboulain opened 5 years ago

kevinboulain commented 5 years ago

Here is another bug that I accidentally encounter when I don't pay much attention while editing some files. I used the same setup as in #52, but with the patch to avoid the crash on M-c.

I added to the beginning of config.el:

(setq load-prefer-newer t) ; to be sure I pick the local patch
(setq debug-on-error t) ; to get the following traceback

Create and open crash.org:

cat > /tmp/trash/crash.org  << EOF
#+begin_src emacs-lisp
#+begin_src emacs-lisp
#+begin_src emacs-lisp
EOF

emacs -Q -l /tmp/trash/config.el /tmp/trash/crash.org

Validate the local variables with !. Then C-c , c & C-c , t.

Finally, update crash.org to reflect the following (add #+end_src between the second and third #+begin_src emacs-lisp):

#+begin_src emacs-lisp
#+begin_src emacs-lisp
#+end_src
#+begin_src emacs-lisp

Then lentic will crash with (sorry for the wall of text):

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  #f(compiled-function (pairs) #<bytecode 0x40414249>)((nil #<marker at 52 in crash.el>))
  mapcar(#f(compiled-function (pairs) #<bytecode 0x40414249>) ((#<marker at 1 in crash.el> #<marker at 26 in crash.el>) (nil #<marker at 52 in crash.el>) (#<marker at 53 in crash.el> #<marker at 92 in crash.el>)))
  -map(#f(compiled-function (pairs) #<bytecode 0x40414249>) ((#<marker at 1 in crash.el> #<marker at 26 in crash.el>) (nil #<marker at 52 in crash.el>) (#<marker at 53 in crash.el> #<marker at 92 in crash.el>)))
  lentic-chunk-comment-buffer(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> ((#<marker at 1 in crash.el> #<marker at 26 in crash.el>) (nil #<marker at 52 in crash.el>) (#<marker at 53 in crash.el> #<marker at 92 in crash.el>)) 64 65 #<buffer crash.el>)
  #f(compiled-function (conf &optional start stop length-before start-converted stop-converted) "Update the contents in the lentic without comments." #<bytecode 0x410d282d>)(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>)
  apply(#f(compiled-function (conf &optional start stop length-before start-converted stop-converted) "Update the contents in the lentic without comments." #<bytecode 0x410d282d>) (#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>))
  #f(compiled-function (cl-cnm conf &optional start stop length-before start-converted stop-converted) "Update the contents in the lentic without comments." #<bytecode 0x410d3261>)(#f(compiled-function (&rest cnm-args) #<bytecode 0x40413a35>) #<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>)
  apply(#f(compiled-function (cl-cnm conf &optional start stop length-before start-converted stop-converted) "Update the contents in the lentic without comments." #<bytecode 0x410d3261>) #f(compiled-function (&rest cnm-args) #<bytecode 0x40413a35>) (#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>))
  #f(compiled-function (&rest args) #<bytecode 0x412dfcb9>)(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>)
  apply(#f(compiled-function (&rest args) #<bytecode 0x412dfcb9>) #<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> (55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>))
  lentic-clone(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0 #<marker at 64 in crash.el> #<marker at 64 in crash.el>)
  lentic-update-contents(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration> 55 56 0)
  #f(compiled-function (config) #<bytecode 0x4048019d>)(#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration>)
  mapcar(#f(compiled-function (config) #<bytecode 0x4048019d>) (#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration>))
  -map(#f(compiled-function (config) #<bytecode 0x4048019d>) (#<lentic-unmatched-uncommented-chunk-configuration lentic-unmatched-uncommented-chunk-configuration>))
  lentic-after-change-function-1(#<buffer crash.org> 55 56 0)
  lentic-after-change-function(55 56 0)
  self-insert-command(1)
  org-self-insert-command(1)
  funcall-interactively(org-self-insert-command 1)
  call-interactively(org-self-insert-command nil nil)
  command-execute(org-self-insert-command)