0

I use flyspell-lazy to improve flyspell performance and it works really well. However, when I open a buffer with a lot of text, I get this error:

Debugger entered--Lisp error: (args-out-of-range #<buffer buffer2> 155 215)
  #<subr buffer-substring-no-properties>(215 155)
  ad-Advice-buffer-substring-no-properties(#<subr buffer-substring-no-properties> 215 155)
  apply(ad-Advice-buffer-substring-no-properties #<subr buffer-substring-no-properties> (215 155))
  buffer-substring-no-properties(215 155)
  flyspell-lazy-check-pending()
  apply(flyspell-lazy-check-pending nil)
  timer-event-handler([t 0 3 0 t flyspell-lazy-check-pending nil idle 0])

Here's another version of the error:

Debugger entered--Lisp error: (args-out-of-range #<buffer 0-why-I-wrote-this-book.txt> 90378 90651)
  buffer-substring-no-properties(90651 90378)
  flyspell-lazy-check-pending()
  apply(flyspell-lazy-check-pending nil)
  timer-event-handler([t 0 3 0 t flyspell-lazy-check-pending nil idle 0])

How can I resolve this error?

As requested, here are my flyspell settings:

(use-package flyspell
:config
'(flyspell-abbrev-p t)
'(flyspell-use-global-abbrev-table-p t)
'(global-flyspell-mode t)

:bind
(:map flyspell-mode-map 
("C-." . nil)
)
)

;; flyspell skip source blocks
;; NO spell check for embedded snippets
(defadvice org-mode-flyspell-verify (after org-mode-flyspell-verify-hack activate)
  (let ((rlt ad-return-value)
        (begin-regexp "^[ \t]*#\\+begin_\\(src\\|html\\|latex\\)")
        (end-regexp "^[ \t]*#\\+end_\\(src\\|html\\|latex\\)")
        old-flag
        b e)
    (when ad-return-value
      (save-excursion
        (setq old-flag case-fold-search)
        (setq case-fold-search t)
        (setq b (re-search-backward begin-regexp nil t))
        (if b (setq e (re-search-forward end-regexp nil t)))
        (setq case-fold-search old-flag))
      (if (and b e (< (point) e)) (setq rlt nil)))
    (setq ad-return-value rlt)))

(add-hook 'org-mode-hook (lambda () (flyspell-lazy-mode 1))) 
  • 1
    In general, most forum participants would probably rather help you fix your problem instead of suppressing a meaningful error message. It's like disconnecting the engine light indicator inside a vehicle rather than going to see a mechanic ... :) – lawlist Apr 5 '17 at 2:05
1

flyspell-lazy.el does not apply any advice to buffer-substring-no-properties. It will be necessary to find out where else in the user-configuration said function has been advised and undo-it or fix-it.

  • Here's another version of the same error: Debugger entered--Lisp error: (args-out-of-range #<buffer 0-why-I-wrote-this-book.txt> 90378 90651) buffer-substring-no-properties(90651 90378) flyspell-lazy-check-pending() apply(flyspell-lazy-check-pending nil) timer-event-handler([t 0 3 0 t flyspell-lazy-check-pending nil idle 0]) – incandescentman Apr 5 '17 at 0:55
  • You have likely broken buffer-substring-no-properties by applying an unknown advice at some point in the past -- either you did it yourself, or you installed something from somewhere that did it. Your problem is not likely with the flyspell-lazy.el library. I cannot see a legitimate reason to ever advise buffer-substring-no-properties, but there may be one that you are aware of. In either case, your advice is not correct -- it needs to be fixed or removed, wherever it is. There is no way to know what you did when creating the advice because you have not provided that code. – lawlist Apr 5 '17 at 1:39
  • To the extent that you are able to locate and remove the advice and the problem still persists, please consider updating your question with the relevant settings for both flyspell and flyspell-lazy so that the forum participants can reproduce your results/issues when loading lengthy files. – lawlist Apr 5 '17 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.