parinfer-mode icon indicating copy to clipboard operation
parinfer-mode copied to clipboard

Error when running 'parinfer-mode'

Open samis opened this issue 9 years ago • 1 comments

Whenever I do M-x parinfer-mode, I get an error. After toggling debug-on-error I then attempted to enable parinfer-mode in the scratch buffer for testing. I got the following backtrace.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  =(nil 41)
  (and (= (char-before (point)) 10) (= (char-after (point)) 41))
  (not (and (= (char-before (point)) 10) (= (char-after (point)) 41)))
  (and (plist-get result :success) (not (and (= (char-before (point)) 10) (= (char-after (point)) 41))))
  (if (and (plist-get result :success) (not (and (= (char-before (point)) 10) (= (char-after (point)) 41)))) (let ((old-buffer (current-buffer)) (old-point (point))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert (plist-get result :text)) (copy-to-buffer old-buffer (point-min) (point-max))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (goto-char old-point)))
  parinfer-mode-insert-result((:success t :text #(";; This buffer is for notes you don't want to save, and for Lisp evaluation.\n;; If you want to create a file, visit that file with C-x C-f,\n;; then enter the text in that file's own buffer.\n\n" 0 3 (fontified t face font-lock-comment-delimiter-face) 3 76 (fontified t face font-lock-comment-face) 77 80 (fontified t face font-lock-comment-delimiter-face) 80 139 (fontified t face font-lock-comment-face) 140 143 (fontified t face font-lock-comment-delimiter-face) 143 189 (fontified t face font-lock-comment-face))))
  parinfer-mode-paren-mode()
  (progn (parinfer-mode-paren-mode) (add-hook (quote post-self-insert-hook) (quote parinfer-mode-indent-mode) nil t))
  (if parinfer-mode (progn (parinfer-mode-paren-mode) (add-hook (quote post-self-insert-hook) (quote parinfer-mode-indent-mode) nil t)) (remove-hook (quote post-self-insert-hook) (quote parinfer-mode-indent-mode) t))
  (let ((last-message (current-message))) (setq parinfer-mode (if (eq arg (quote toggle)) (not parinfer-mode) (> (prefix-numeric-value arg) 0))) (if parinfer-mode (progn (parinfer-mode-paren-mode) (add-hook (quote post-self-insert-hook) (quote parinfer-mode-indent-mode) nil t)) (remove-hook (quote post-self-insert-hook) (quote parinfer-mode-indent-mode) t)) (run-hooks (quote parinfer-mode-hook) (if parinfer-mode (quote parinfer-mode-on-hook) (quote parinfer-mode-off-hook))) (if (called-interactively-p (quote any)) (progn nil (if (and (current-message) (not (equal last-message (current-message)))) nil (message "Parinfer mode %sabled" (if parinfer-mode "en" "dis"))))))
  parinfer-mode(toggle)
  #<subr call-interactively>(parinfer-mode record nil)
  ad-Advice-call-interactively(#<subr call-interactively> parinfer-mode record nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (parinfer-mode record nil))
  call-interactively(parinfer-mode record nil)
  command-execute(parinfer-mode record)
  execute-extended-command(nil "parinfer-mode")
  smex-read-and-run(("parinfer-mode" "toggle-debug-on-error" "purpose-mode" "el-get-describe" "e2wm:start-management" "customize-group" "sr-speedbar-open" "eval-buffer" "other-window" "org-refile" "org-capture" "find-library" "nlinum-mode" "org-cut-subtree" "org-paste-subtree" "Info-speedbar-browser" "aggressive-indent-mode" "eshell" "org-version" "describe-key" "org-store-link" "org-table-align" "ido-ubiquitous-debug-mode" "ielm" "dired" "apropos" "org-mode" "org-yank" "linum-mode" "org-reload" "buffer-menu" "company-diag" "org-clock-in" "describe-char" "el-get-reload" "org-clock-out" "org-customize" "describe-package" "byte-compile-file" "my-load-all-in-directory" "global-aggressive-indent-mode" "ido-ubiquitous-restore-default-overrides" "cd" "5x5" "arp" "dbx" "dig" "erc" "ert" "eww" ...))
  smex()
  #<subr call-interactively>(smex nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> smex nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (smex nil nil))
  call-interactively(smex nil nil)
  command-execute(smex)

samis avatar Mar 08 '16 19:03 samis

This happens when the cursor points next to EOF. This expression evaluates to nil:

(char-after (point))

And it leads to the invalid comparison captured in the trace.

lukateras avatar Apr 07 '16 18:04 lukateras