ntangle icon indicating copy to clipboard operation
ntangle copied to clipboard

[ERROR] IndexDefect: index 3 not in 0 .. 2

Open madorian opened this issue 3 years ago • 6 comments

Any way to have a better way of understanding why it can't parse the file?

This error is not very helpful

 [ERROR] IndexDefect: index 3 not in 0 .. 2

madorian avatar Feb 04 '23 09:02 madorian

Can you please post a reproducible example?

kaushalmodi avatar Feb 04 '23 14:02 kaushalmodi

Well, that's a problem, cause it's my 500 line org-mode file and it contains some secrets, but can't the program say anything about where it has problems, like what line number, etc?

madorian avatar Feb 05 '23 11:02 madorian

I have to bisect the file?

madorian avatar Feb 07 '23 09:02 madorian

I should be able to output the line number of the Org file when that unhandled exception happens, but I don't have that mechanism in place. When I fix this, I'll look into adding that feature.

I have to bisect the file?

That's the easiest way. Keep on commenting out your file in half until you stop getting that exception. Then uncomment in halves again until you reproduce this exception.

kaushalmodi avatar Feb 07 '23 09:02 kaushalmodi

ok, here's a reproducible;)

* emacs
#+property: header-args :tangle yes
#+INCLUDE: early-init.el src emacs-lisp
#+INCLUDE: init.el src emacs-lisp

***** word
https://www.emacswiki.org/emacs/CopyWithoutSelection
#+begin_src elisp
    (defun get-point (symbol &optional arg)
      "get the point"
      (funcall symbol arg)
      (point)
      )

    (defun copy-thing (begin-of-thing end-of-thing &optional arg)
      "copy thing between beg & end into kill ring"
      (save-excursion
	(let ((beg (get-point begin-of-thing 1))
	      (end (get-point end-of-thing arg)))
	  (copy-region-as-kill beg end)))
      )

    (defun paste-to-mark(&optional arg)
      "Paste things to mark, or to the prompt in shell-mode"
      (let ((pasteMe
	     (lambda()
	       (if (string= "shell-mode" major-mode)
		   (progn (comint-next-prompt 25535) (yank))
		 (progn (goto-char (mark)) (yank) )))))
	(if arg
	    (if (= arg 1)
		nil
	      (funcall pasteMe))
	  (funcall pasteMe))
	))

    ;; now copy the god damn word
    (defun copy-word (&optional arg)
      "Copy words at point into kill-ring"
      (interactive "P")
      (copy-thing 'backward-word 'forward-word arg)
      ;;(paste-to-mark arg)
      )

  (define-key my-mode-map (kbd "C-M-w c") 'copy-word)
#+end_src






madorian avatar Feb 08 '23 11:02 madorian

Any idea what this could be?;)

madorian avatar Feb 11 '23 09:02 madorian