redguardtoo / wucuo

Fastest solution to spell check camel case code or plain text
121 stars 4 forks source link

Wucuo error from time to time #9

Open casouri opened 4 years ago

casouri commented 4 years ago

Wucuo has reported errors when I load themes and delete packages. Seems to be because wucuo-split-camel-case called on irregular words. Also, whywucuo-spell-check-visible-region runs at all? In this case I'm loading a theme and customize is saving the custom file, which isn't visible.

Debugger entered--Lisp error: (args-out-of-range ["b" "8350" "ecb" "9" "d" "5" "b" "5" "cd" "63" "fe" "207" "f" "57" "a" "6525" "ae" "9" "abcd" "4" "ebf" "63" "fa" "6" "f" "50278" "ed" "88" "e" "9" "b" "2"] 32)
  wucuo-split-camel-case(#("b8350ecb9d5b5cd63fe207f57a6525ae9abcd4ebf63fa6f502..." 0 64 (face font-lock-string-face fontified t)))
  wucuo-generic-check-word-predicate()
  flyspell-word(nil t)
  flyspell-external-point-words()
  flyspell-large-region(1 3112)
  flyspell-region(1 3112)
  wucuo-spell-check-visible-region()
  wucuo-spell-check-buffer()
  run-hooks(after-save-hook)
  basic-save-buffer(nil)
  save-buffer()
  custom-save-all()
  customize-save-variable(custom-safe-themes ("51b44babc881e57ee3f437277e3f7e85afee337d112e5a128b..." "6e34442cc79dd570c6877930f19f36eab8be4a6922c3e54de6..." "9b27abb4441d26c75111bbe54cf0d6842b985d073c138047c6..." "6fe050167d55f7335b2f3120790590350063777e46ad39b144..." "7063e792dc9ab7f418954f6f5dd3ff54980af57fa3351130f9..." "a002783a6ca2b0d12b45907ed6599008cc2e5c1a18f6534fa2..." "b8350ecb9d5b5cd63fe207f57a6525ae9abcd4ebf63fa6f502..." "995a2dcdfd772dfef667a3d90463c1a20d8ce9bb1fac4d1492..." "43d0b23972479ed58ff68eb0f064b59cf01bd310c189278208..." "fcdee8dc1a8cb82abc187b4f80c3231fea9cdbe76f7e5156bb..." "7c4adc5c6cd215852319c1d848264de6422537ff7e08daf9cf..." "5265adbf733ebe74f9a366288f1fe99bfe9280fa0539e607ad..." "6494af259a0893a71fdf4bb597cd09c8f004061bcd01329b27..." "ecb52aaf85e7900831a5320850e11e02669f2166a76be8f5a0..." "a4402c565270062994d553d7d5e094410f455ed48df6d20a9b..." "fa8eeb80f79cb4483dbd7d8032f330d4398ed661ba14ea43cf..." "ff44a7b58f34cb0716d7afe51237d52c94e4680f80eedf43d5..." "6015b0b81604eb6991b95bdd60f4fd8b44ee675ad545fbea6c..." "465f151c723ebc0ebcd92594ca4100cbc0bf8542c5722369ac..." "1942390a3b4d3527ba3fa1f9322424c113fb2bd3ffa89b354e..."))
  customize-push-and-save(custom-safe-themes ("51b44babc881e57ee3f437277e3f7e85afee337d112e5a128b..."))
  custom-theme-load-confirm("51b44babc881e57ee3f437277e3f7e85afee337d112e5a128b...")
  load-theme(cyberpunk nil nil)
  funcall-interactively(load-theme cyberpunk nil nil)
  call-interactively(load-theme record nil)
  command-execute(load-theme record)
  counsel-M-x-action("load-theme")
  #f(compiled-function (x) #<bytecode 0x1fe176d6d74d>)("load-theme")
  ivy-call()
  #f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially.  An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero.  Otherwise, use the first occurrence of\nPRESELECT in the collection.  Comparison is first done with\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input.  It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x43e09c89>)("M-x " [rng-ipattern-after localp olivetti-mode-on-hook isearch--state-pop-fun--cmacro locals luna-lsp rng-what-schema vc-git-stash-snapshot magit-submodule-update custom-face-menu flycheck-next-error magit-reflog-commit help-variable 0 eglot--dbind 0 url-cookie-multiple-line switch-function adwaita vc-src-log-switches _message mixal dired-at-point avl-tree--stack-store--cmacro cl-print--preprocess -deferred-actions \(setf\ eglot--project-nickname\) edebug-clear-frequency-count -some\? vc-git-conflicted-files 0 0 checkdoc-package-keywords-flag being checkdoc-output-mode-map f-directory\? Edebug\ All\ Defs ibuffer-update Info-apropos-find-file \' :name-match M-kp-down :contents org-babel-results-keyword muletibetan-2 - not-at-beginning-of-line f-empty\? use-< calendar-debug-sexp ...] :predicate #f(compiled-function (sym) #<bytecode 0x43ed9db9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  apply(#f(compiled-function (arg1 arg2 &rest rest) "Read a string in the minibuffer, with completion.\n\nPROMPT is a string, normally ending in a colon and a space.\n`ivy-count-format' is prepended to PROMPT during completion.\n\nCOLLECTION is either a list of strings, a function, an alist, or\na hash table, supplied for `minibuffer-completion-table'.\n\nPREDICATE is applied to filter out the COLLECTION immediately.\nThis argument is for compatibility with `completing-read'.\n\nWhen REQUIRE-MATCH is non-nil, only members of COLLECTION can be\nselected.\n\nIf INITIAL-INPUT is non-nil, then insert that input in the\nminibuffer initially.\n\nHISTORY is a name of a variable to hold the completion session\nhistory.\n\nKEYMAP is composed with `ivy-minibuffer-map'.\n\nPRESELECT, when non-nil, determines which one of the candidates\nmatching INITIAL-INPUT to select initially.  An integer stands\nfor the position of the desired candidate in the collection,\ncounting from zero.  Otherwise, use the first occurrence of\nPRESELECT in the collection.  Comparison is first done with\n`equal'.  If that fails, and when applicable, match PRESELECT as\na regular expression.\n\nDEF is for compatibility with `completing-read'.\n\nUPDATE-FN is called each time the candidate list is re-displayed.\n\nWhen SORT is non-nil, `ivy-sort-functions-alist' determines how\nto sort candidates before displaying them.\n\nACTION is a function to call after selecting a candidate.\nIt takes one argument, the selected candidate. If COLLECTION is\nan alist, the argument is a cons cell, otherwise it's a string.\n\nMULTI-ACTION, when non-nil, is called instead of ACTION when\nthere are marked candidates. It takes the list of candidates as\nits only argument. When it's nil, ACTION is called on each marked\ncandidate.\n\nUNWIND is a function of no arguments to call before exiting.\n\nRE-BUILDER is a function transforming input text into a regex\npattern.\n\nMATCHER is a function which can override how candidates are\nfiltered based on user input.  It takes a regex pattern and a\nlist of candidates, and returns the list of matching candidates.\n\nDYNAMIC-COLLECTION is a boolean specifying whether the list of\ncandidates is updated after each input by calling COLLECTION.\n\nEXTRA-PROPS is a plist that can be used to store\ncollection-specific session-specific data.\n\nCALLER is a symbol to uniquely identify the caller to `ivy-read'.\nIt is used, along with COLLECTION, to determine which\ncustomizations apply to the current completion session." #<bytecode 0x43e09c89>) ("M-x " [rng-ipattern-after localp olivetti-mode-on-hook isearch--state-pop-fun--cmacro locals luna-lsp rng-what-schema vc-git-stash-snapshot magit-submodule-update custom-face-menu flycheck-next-error magit-reflog-commit help-variable 0 eglot--dbind 0 url-cookie-multiple-line switch-function adwaita vc-src-log-switches _message mixal dired-at-point avl-tree--stack-store--cmacro cl-print--preprocess -deferred-actions \(setf\ eglot--project-nickname\) edebug-clear-frequency-count -some\? vc-git-conflicted-files 0 0 checkdoc-package-keywords-flag being checkdoc-output-mode-map f-directory\? Edebug\ All\ Defs ibuffer-update Info-apropos-find-file \' :name-match M-kp-down :contents org-babel-results-keyword muletibetan-2 - not-at-beginning-of-line f-empty\? use-< calendar-debug-sexp ...] :predicate #f(compiled-function (sym) #<bytecode 0x43ed9db9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
  ivy-read("M-x " [rng-ipattern-after localp olivetti-mode-on-hook isearch--state-pop-fun--cmacro locals luna-lsp rng-what-schema vc-git-stash-snapshot magit-submodule-update custom-face-menu flycheck-next-error magit-reflog-commit help-variable 0 eglot--dbind 0 url-cookie-multiple-line switch-function adwaita vc-src-log-switches _message mixal dired-at-point avl-tree--stack-store--cmacro cl-print--preprocess -deferred-actions \(setf\ eglot--project-nickname\) edebug-clear-frequency-count -some\? vc-git-conflicted-files 0 0 checkdoc-package-keywords-flag being checkdoc-output-mode-map f-directory\? Edebug\ All\ Defs ibuffer-update Info-apropos-find-file \' :name-match M-kp-down :contents org-babel-results-keyword muletibetan-2 - not-at-beginning-of-line f-empty\? use-< calendar-debug-sexp ...] :predicate #f(compiled-function (sym) #<bytecode 0x43ed9db9>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)
redguardtoo commented 4 years ago

What's value of custom-file? What's the content of that file?

casouri commented 4 years ago
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ad-redefinition-action 'accept)
 '(ansi-color-faces-vector
   [default default default italic underline success warning error])
 '(ansi-color-names-vector
   ["#f0f0f0" "#e45649" "#50a14f" "#986801" "#4078f2" "#a626a4" "#0184bc" "#1b2229"])
 '(apropos-do-all t)
 '(auto-save-timeout 5)
 '(compilation-always-kill t)
 '(compilation-ask-about-save nil)
 '(confirm-nonexistent-file-or-buffer t)
 '(create-lockfiles nil)
 '(custom-safe-themes
   '("51b44babc881e57ee3f437277e3f7e85afee337d112e5a128b1332b364b82518" "6e34442cc79dd570c6877930f19f36eab8be4a6922c3e54de626c38a3ebe6141" "9b27abb4441d26c75111bbe54cf0d6842b985d073c138047c6c4b880f763ced8" "6fe050167d55f7335b2f3120790590350063777e46ad39b144223d5ac4cdbecd" "7063e792dc9ab7f418954f6f5dd3ff54980af57fa3351130f9a905c1dadf54a9" "a002783a6ca2b0d12b45907ed6599008cc2e5c1a18f6534fa23da1377477ce84" "b8350ecb9d5b5cd63fe207f57a6525ae9abcd4ebf63fa6f50278ed88e9b2a255" "995a2dcdfd772dfef667a3d90463c1a20d8ce9bb1fac4d1492d557b8f0f6187d" "43d0b23972479ed58ff68eb0f064b59cf01bd310c189278208c9450b81a3da2c" "fcdee8dc1a8cb82abc187b4f80c3231fea9cdbe76f7e5156bb80dd6f5b225099" "7c4adc5c6cd215852319c1d848264de6422537ff7e08daf9cfee5f80ca917b24" "5265adbf733ebe74f9a366288f1fe99bfe9280fa0539e607ad2a036bc8b6b3df" "6494af259a0893a71fdf4bb597cd09c8f004061bcd01329b2706da936e2e6898" "ecb52aaf85e7900831a5320850e11e02669f2166a76be8f5a0bb5caa84b59763" "a4402c565270062994d553d7d5e094410f455ed48df6d20a9b7b4c08734daf01" "fa8eeb80f79cb4483dbd7d8032f330d4398ed661ba14ea43cff0f20c2744e6e0" "ff44a7b58f34cb0716d7afe51237d52c94e4680f80eedf43d585972931e54d74" "6015b0b81604eb6991b95bdd60f4fd8b44ee675ad545fbea6c3f669bbf1920db" "465f151c723ebc0ebcd92594ca4100cbc0bf8542c5722369ac0a63a942b7c552" "1942390a3b4d3527ba3fa1f9322424c113fb2bd3ffa89b354e134ff13a0b55c8"))
 '(debug-on-error t)
 '(delete-auto-save-files nil)
 '(delete-by-moving-to-trash t)
 '(dired-omit-files "\\`[.]?#\\|\\`[.][.]?" nil nil "Hide all dot files")
 '(display-line-numbers-width 3)
 '(ediff-split-window-function 'split-window-horizontally)
 '(ediff-window-setup-function 'ediff-setup-windows-plain)
 '(electric-pair-mode t)
 '(electric-quote-mode t)
 '(enable-recursive-minibuffers t)
 '(flywrap-debug-mode t)
 '(help-window-select t)
 '(history-length 500)
 '(idle-update-delay 0.5)
 '(indent-tabs-mode nil)
 '(inhibit-startup-screen t)
 '(kill-ring-max 100)
 '(minibuffer-electric-default-mode t)
 '(mouse-scroll-delay 0)
 '(mouse-wheel-flip-direction t)
 '(mouse-wheel-progressive-speed nil)
 '(mouse-wheel-scroll-amount '(0.005))
 '(mouse-wheel-tilt-scroll t)
 '(ns-pop-up-frames nil nil nil "This way emacsclient doesn't open new frames.")
 '(org-fontify-quote-and-verse-blocks t)
 '(org-hide-emphasis-markers t)
 '(org-image-actual-width '(300))
 '(package-archives
   '(("melpa" . "http://melpa.org/packages/")
     ("gnu" . "https://elpa.gnu.org/packages/")))
 '(package-selected-packages
   '(exec-path-from-shell restclient php-mode all-the-icons-dired yasnippet yaml-mode xr wucuo ws-butler writegood-mode which-key web-mode visual-regexp use-package tuareg tree-sitter-lang-c tide srefactor sly sage-shell-mode rainbow-mode rainbow-delimiters racket-mode quickrun pyvenv proof-general org-download orderless olivetti ob-mermaid mips-mode minions memory-usage matlab-mode magit-todos magit-patch-changelog lua-mode latex-preview-pane ivy-xref imenu-list icomplete-vertical htmlize highlight-parentheses hierarchy helpful haskell-mode gnu-apl-mode git-timemachine general geiser eyebrowse eglot edit-indirect dumb-jump diff-hl debbugs counsel company-posframe cdlatex ccls buffer-move benchmark-init auto-pause auctex aggressive-indent))
 '(recentf-max-saved-items 300)
 '(ring-bell-function 'ignore)
 '(safe-local-variable-values '((git-commit-major-mode . git-commit-elisp-text-mode)))
 '(savehist-additional-variables '(tablist-named-filter extended-command-history))
 '(savehist-mode t)
 '(scroll-bar-mode nil)
 '(scroll-conservatively 101)
 '(scroll-margin 4)
 '(send-mail-function 'mailclient-send-it)
 '(sentence-end-double-space nil)
 '(tool-bar-mode t)
 '(use-dialog-box nil)
 '(use-package-hook-name-suffix "")
 '(vc-annotate-background "#fafafa")
 '(vc-annotate-color-map
   (list
    (cons 20 "#50a14f")
    (cons 40 "#688e35")
    (cons 60 "#807b1b")
    (cons 80 "#986801")
    (cons 100 "#ae7118")
    (cons 120 "#c37b30")
    (cons 140 "#da8548")
    (cons 160 "#c86566")
    (cons 180 "#b74585")
    (cons 200 "#a626a4")
    (cons 220 "#ba3685")
    (cons 240 "#cf4667")
    (cons 260 "#e45649")
    (cons 280 "#d2685f")
    (cons 300 "#c07b76")
    (cons 320 "#ae8d8d")
    (cons 340 "#383a42")
    (cons 360 "#383a42")))
 '(vc-annotate-very-old-color nil)
 '(visible-cursor nil)
 '(which-function-mode t)
 '(winner-mode t)
 '(xref-prompt-for-identifier
   '(not xref-find-references xref-find-definitions xref-find-definitions-other-window xref-find-definitions-other-frame)))

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "SF Mono" :foundry "nil" :slant normal :weight normal :height 130 :width normal))))
 '(ghelp-entry ((t :inherit nil)))
 '(info-body ((t (:inherit variable-pitch :height 1.1 :family "Charter"))))
 '(org-table ((t nil))))
casouri commented 4 years ago

I looked at wucuo-split-camel-case. It seems that you assume 32 subwords are enough and it turns out the word has more. My two cents.

casouri commented 4 years ago

Also, I think it makes sense to only check visible buffers, e.g., add a check of get-buffer-window in wucuo-spell-check-visible-region or something like that.

redguardtoo commented 4 years ago

18ab14c avoid check buffer whose window is not live (Chen Bin)