sebastiencs / company-box

A company front-end with icons
565 stars 64 forks source link

wrong-type-argument window-live-p nil #111

Open shackra opened 4 years ago

shackra commented 4 years ago

in my *scratch* buffer, writing a Elisp function and navigating through the auto-completion I see there are no icons, but worst of all, an error is throw:

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil norecord)
  apply(#<subr select-window> (nil norecord))
  select-window(nil norecord)
  (progn (select-window (car save-selected-window--state) 'norecord) (company-box--update-line selection common))
  (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (company-box--update-line selection common)) (internal--after-with-selected-window save-selected-window--state))
  (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (company-box--update-line selection common)) (internal--after-with-selected-window save-selected-window--state)))
  (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (company-box--update-line selection common)) (internal--after-with-selected-window save-selected-window--state))))
  (let ((selection company-selection) (common company-common)) (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (company-box--update-line selection common)) (internal--after-with-selected-window save-selected-window--state)))) (company-box--update-scrollbar (company-box--get-frame)))
  company-box--change-line()
  (let ((max (min company-candidates-length company-box-max-candidates)) (next (1+ company-selection))) (setq company-selection (if company-selection-wrap-around (mod next max) (min next (1- max)))) (company-box--change-line) (company-box--update-width))
  company-box--next-line()
  #<subr funcall-interactively>(company-box--next-line)
  apply(#<subr funcall-interactively> company-box--next-line)
  funcall-interactively(company-box--next-line)
  #<subr call-interactively>(company-box--next-line nil nil)
  apply(#<subr call-interactively> (company-box--next-line nil nil))
  (unwind-protect (apply original-func args) (let ((top-frame explain-pause--current-command-record)) (if extra-frame (cond ((and (eq (progn ... ...) target-function) (eq (progn ... ...) command-frame)) (explain-pause--command-record-and-store top-frame) (if (progn (or ... ...) (aref top-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling top-frame))) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)) ((eq top-frame command-frame) (explain-pause--command-record-and-store top-frame) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame)) (t (explain-pause-report-measuring-bug "call-interactively has extra-frame" "top-frame" top-frame "target-function" target-function))) (if (not (eq top-frame command-frame)) (explain-pause-report-measuring-bug "call interactively frame does not match" "command-frame" command-frame "should be equal" top-frame) (explain-pause--command-record-and-store command-frame) (if (progn (or (and ... t) (signal ... ...)) (aref command-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling command-frame))) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)))) (if (eq parent explain-pause-root-command-loop) nil (progn (or (and (memq (type-of parent) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record parent))) (let* ((v parent)) (aset v 5 (current-time))))) (setq explain-pause--current-command-record parent))
  (let ((parent explain-pause--current-command-record) (target-function (car args)) (command-frame nil) (extra-frame nil)) (if (eq parent explain-pause-root-command-loop) nil (explain-pause--command-record-and-store parent)) (if (or (eq target-function #'self-insert-command) (eq target-function #'newline) (eq target-function #'next-line) (eq target-function #'previous-line) (eq target-function #'delete-forward-char)) nil (let ((i-spec (car (cdr (interactive-form target-function))))) (if (and (stringp i-spec) (explain-pause--interactive-form-needs-frame-p i-spec)) (progn (setq command-frame (explain-pause--command-record-from-parent parent parent 'call-interactively-interactive t)) (setq extra-frame t))))) (if extra-frame nil (setq command-frame (explain-pause--command-record-from-parent parent parent target-function))) (explain-pause-log--send-command-entry parent command-frame) (setq explain-pause--current-command-record command-frame) (progn (or (and (memq (type-of command-frame) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record command-frame))) (let* ((v command-frame)) (aset v 5 (current-time)))) (if (and (not extra-frame) (explain-pause--command-record-profile-p command-frame)) (progn (explain-pause--command-record-start-profiling command-frame))) (unwind-protect (apply original-func args) (let ((top-frame explain-pause--current-command-record)) (if extra-frame (cond ((and (eq ... target-function) (eq ... command-frame)) (explain-pause--command-record-and-store top-frame) (if (progn ... ...) (progn ...)) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)) ((eq top-frame command-frame) (explain-pause--command-record-and-store top-frame) (explain-pause-log--send-command-exit top-frame) (explain-pause--run-measure-hook top-frame)) (t (explain-pause-report-measuring-bug "call-interactively has extra-frame" "top-frame" top-frame "target-function" target-function))) (if (not (eq top-frame command-frame)) (explain-pause-report-measuring-bug "call interactively frame does not match" "command-frame" command-frame "should be equal" top-frame) (explain-pause--command-record-and-store command-frame) (if (progn (or ... ...) (aref command-frame 7)) (progn (explain-pause--command-record--save-and-stop-profiling command-frame))) (explain-pause-log--send-command-exit command-frame) (explain-pause--run-measure-hook command-frame)))) (if (eq parent explain-pause-root-command-loop) nil (progn (or (and (memq (type-of parent) cl-struct-explain-pause-command-record-tags) t) (signal 'wrong-type-argument (list 'explain-pause-command-record parent))) (let* ((v parent)) (aset v 5 (current-time))))) (setq explain-pause--current-command-record parent)))
  explain-pause--wrap-call-interactively(#<subr call-interactively> company-box--next-line nil nil)
  apply(explain-pause--wrap-call-interactively #<subr call-interactively> (company-box--next-line nil nil))
  call-interactively(company-box--next-line nil nil)
  command-execute(company-box--next-line)

these are the snippets of my configuration:

(defun company-mode-backend-with-yas (backend)
  "Update BACKEND with YaSnippet."
  (if (or (and (listp backend) (member 'company-yasnippet backend)))
      backend
    (append (if (consp backend) backend (list backend))
            '(:with company-yasnippet))))

(defun company-mode-update-backends-with-yasnippet ()
  "Update the backends of company and turn on YaSnippet."
  (yas-minor-mode-on)
  (setf company-backends (mapcar #'company-mode-backend-with-yas company-backends)))

(use-package company-box
  :diminish company-box-mode
  :hook (company-mode . company-box-mode))

(use-package company
  :hook (company-mode . company-mode-update-backends-with-yasnippet)
  :diminish company-mode
  :config
  (add-hook 'after-init-hook #'global-company-mode)
  :custom
  (company-backends '((company-files
                       company-keywords)
                      (company-abbrev company-dabbrev)))
  (company-idle-delay 1)
  (company-tooltip-limit 12)
  (company-minimum-prefix-length 1)
  (company-dabbrev-downcase nil)
  (company-auto-complete t))

(use-package lsp-mode
  :hook (prog-mode . lsp)
  :custom
  (lsp-idle-delay 0.5)
  (lsp-signature-auto-activate nil)
  (lsp-symbol-highlighting-skip-current t)
  (lsp-clients-go-format-tool "goimports")
  (lsp-clients-go-max-parallelism 4)
  (lsp-clients-go-server "gopls")
  (lsp-gopls-hover-kind "FullDocumentation"))

(use-package lsp-ui
  :after (lsp-mode)
  :hook (lsp-mode . lsp-ui-mode)
  :custom
  (lsp-ui-doc-enable t)
  (lsp-eldoc-hook nil)
  (lsp-ui-doc-delay 2)
  :config
  (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
  (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references))
cloudnine commented 4 years ago

Similar error here, in an html buffer:

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil norecord)
  apply(#<subr select-window> (nil norecord))
  select-window(nil norecord)
  company-box--move-selection()
  company-box--update()
  company-box-frontend(update)
  company-call-frontends(update)
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer banner.html> #<window 3 on *Backtrace*> 20531 4186)
  apply(company-idle-begin (#<buffer banner.html> #<window 3 on *Backtrace*> 20531 4186))
  timer-event-handler([t 24401 23303 910444 nil company-idle-begin (#<buffer banner.html> #<window 3 on *Backtrace*> 20531 4186) nil 0])
  read-event(nil t 3)
  sit-for(3)
  (and (not unread-command-events) (sit-for flyspell-delay))
  (cond ((get this-command (quote flyspell-deplacement)) (not (eq flyspell-previous-command this-command))) ((get this-command (quote flyspell-delayed)) (and (not unread-command-events) (sit-for flyspell-delay))) (t t))
  (cond ((<= (- (point-max) 1) (point-min)) nil) ((and (and (> (current-column) 0) (not (eq (current-column) flyspell-pre-column))) (save-excursion (backward-char 1) (and (looking-at (flyspell-get-not-casechars)) (or (string= "" ispell-otherchars) (not (looking-at ispell-otherchars))) (or flyspell-consider-dash-as-word-delimiter-flag (not (looking-at "-")))))) t) ((symbolp this-command) (cond ((get this-command (quote flyspell-deplacement)) (not (eq flyspell-previous-command this-command))) ((get this-command (quote flyspell-delayed)) (and (not unread-command-events) (sit-for flyspell-delay))) (t t))) (t t))
  (let ((ispell-otherchars (ispell-get-otherchars))) (cond ((<= (- (point-max) 1) (point-min)) nil) ((and (and (> (current-column) 0) (not (eq (current-column) flyspell-pre-column))) (save-excursion (backward-char 1) (and (looking-at (flyspell-get-not-casechars)) (or (string= "" ispell-otherchars) (not ...)) (or flyspell-consider-dash-as-word-delimiter-flag (not ...))))) t) ((symbolp this-command) (cond ((get this-command (quote flyspell-deplacement)) (not (eq flyspell-previous-command this-command))) ((get this-command (quote flyspell-delayed)) (and (not unread-command-events) (sit-for flyspell-delay))) (t t))) (t t)))
  flyspell-check-word-p()
  (if (flyspell-check-word-p) (progn (quote (flyspell-debug-signal-word-checked)) (flyspell-word) (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and (symbolp this-command) (get this-command (quote flyspell-delayed))) (progn (setq flyspell-word-cache-end -1) (setq flyspell-word-cache-result (quote _)))))
  (let ((command this-command) deactivate-mark) (if (flyspell-check-pre-word-p) (save-excursion (quote (flyspell-debug-signal-pre-word-checked)) (goto-char flyspell-pre-point) (flyspell-word))) (if (flyspell-check-word-p) (progn (quote (flyspell-debug-signal-word-checked)) (flyspell-word) (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and (symbolp this-command) (get this-command (quote flyspell-delayed))) (progn (setq flyspell-word-cache-end -1) (setq flyspell-word-cache-result (quote _))))) (while (and (not (input-pending-p)) (consp flyspell-changes)) (let ((start (car (car flyspell-changes))) (stop (cdr (car flyspell-changes)))) (if (flyspell-check-changed-word-p start stop) (save-excursion (quote (flyspell-debug-signal-changed-checked)) (goto-char start) (flyspell-word))) (setq flyspell-changes (cdr flyspell-changes)))) (setq flyspell-previous-command command))
  (let ((inhibit-quit nil)) (let ((command this-command) deactivate-mark) (if (flyspell-check-pre-word-p) (save-excursion (quote (flyspell-debug-signal-pre-word-checked)) (goto-char flyspell-pre-point) (flyspell-word))) (if (flyspell-check-word-p) (progn (quote (flyspell-debug-signal-word-checked)) (flyspell-word) (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and (symbolp this-command) (get this-command (quote flyspell-delayed))) (progn (setq flyspell-word-cache-end -1) (setq flyspell-word-cache-result (quote _))))) (while (and (not (input-pending-p)) (consp flyspell-changes)) (let ((start (car (car flyspell-changes))) (stop (cdr (car flyspell-changes)))) (if (flyspell-check-changed-word-p start stop) (save-excursion (quote (flyspell-debug-signal-changed-checked)) (goto-char start) (flyspell-word))) (setq flyspell-changes (cdr flyspell-changes)))) (setq flyspell-previous-command command)))
  (condition-case nil (let ((inhibit-quit nil)) (let ((command this-command) deactivate-mark) (if (flyspell-check-pre-word-p) (save-excursion (quote (flyspell-debug-signal-pre-word-checked)) (goto-char flyspell-pre-point) (flyspell-word))) (if (flyspell-check-word-p) (progn (quote (flyspell-debug-signal-word-checked)) (flyspell-word) (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and (symbolp this-command) (get this-command (quote flyspell-delayed))) (progn (setq flyspell-word-cache-end -1) (setq flyspell-word-cache-result (quote _))))) (while (and (not (input-pending-p)) (consp flyspell-changes)) (let ((start (car ...)) (stop (cdr ...))) (if (flyspell-check-changed-word-p start stop) (save-excursion (quote ...) (goto-char start) (flyspell-word))) (setq flyspell-changes (cdr flyspell-changes)))) (setq flyspell-previous-command command))) (quit (setq quit-flag t) (eval (quote (ignore nil)))))
  (progn (condition-case nil (let ((inhibit-quit nil)) (let ((command this-command) deactivate-mark) (if (flyspell-check-pre-word-p) (save-excursion (quote (flyspell-debug-signal-pre-word-checked)) (goto-char flyspell-pre-point) (flyspell-word))) (if (flyspell-check-word-p) (progn (quote (flyspell-debug-signal-word-checked)) (flyspell-word) (setq flyspell-pre-pre-buffer (current-buffer)) (setq flyspell-pre-pre-point (point))) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and (symbolp this-command) (get this-command ...)) (progn (setq flyspell-word-cache-end -1) (setq flyspell-word-cache-result ...)))) (while (and (not (input-pending-p)) (consp flyspell-changes)) (let ((start ...) (stop ...)) (if (flyspell-check-changed-word-p start stop) (save-excursion ... ... ...)) (setq flyspell-changes (cdr flyspell-changes)))) (setq flyspell-previous-command command))) (quit (setq quit-flag t) (eval (quote (ignore nil))))))
  (if flyspell-mode (progn (condition-case nil (let ((inhibit-quit nil)) (let ((command this-command) deactivate-mark) (if (flyspell-check-pre-word-p) (save-excursion (quote ...) (goto-char flyspell-pre-point) (flyspell-word))) (if (flyspell-check-word-p) (progn (quote ...) (flyspell-word) (setq flyspell-pre-pre-buffer ...) (setq flyspell-pre-pre-point ...)) (setq flyspell-pre-pre-buffer nil) (setq flyspell-pre-pre-point nil) (if (and ... ...) (progn ... ...))) (while (and (not ...) (consp flyspell-changes)) (let (... ...) (if ... ...) (setq flyspell-changes ...))) (setq flyspell-previous-command command))) (quit (setq quit-flag t) (eval (quote (ignore nil)))))))
  flyspell-post-command-hook()

Both our errors feature apply(#<subr select-window> (nil norecord))

sebastiencs commented 4 years ago

@shackra @cloudnine https://github.com/sebastiencs/company-box/commit/292d170e10141aeec4c234b1cc160ef03a304036 should fix your issues. Can you please confirm

cloudnine commented 4 years ago

Fixed. Thanks!

anupam312nwd commented 3 years ago

Hi, I am also getting this error in company-box. I am using Doom-Emacs and have no additional setting related to company. This error goes away after re-starting Emacs, but shows again after some-time and only goes away after re-starting Emacs. Using toggle-debug-on-error, I am getting the following:


  #<subr select-window>(nil norecord)
  ad-Advice-select-window(#<subr select-window> nil norecord)
  apply(ad-Advice-select-window #<subr select-window> (nil norecord))
  select-window(nil norecord)
  company-box--move-selection(t)
  company-box--display(#("\n\n\n\n\n\n\n\n\n\n\n" 0 1 (company-box-candidate) ....)
  company-box-show()
  company-box-frontend(show)
  company-call-frontends(show)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer ds_list.py> #<window 85 on ds_list.py> 598 98)
  apply(company-idle-begin (#<buffer ds_list.py> #<window 85 on ds_list.py> 598 98))
  timer-event-handler([t 24588 41200 963364 nil company-idle-begin (#<buffer ds_list.py> #<window 85 on ds_list.py> 598 98) nil 0])
MoskitoHero commented 3 years ago

I'm having the same issue in Doom-Emacs too with ruby. This is the debug output I get:

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil norecord)
  ad-Advice-select-window(#<subr select-window> nil norecord)
  apply(ad-Advice-select-window #<subr select-window> (nil norecord))
  select-window(nil norecord)
  (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null (get-text-property (1- new-point) 'company-box--rendered))) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it (- company-box--chunk-size))) (let ((it (company-box--point-at-line it ...))) (set-window-start nil it))))))
  (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null (get-text-property ... ...))) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it (- company-box--chunk-size))) (let ((it ...)) (set-window-start nil it)))))) (internal--after-with-selected-window save-selected-window--state))
  (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null ...)) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it ...)) (let (...) (set-window-start nil it)))))) (internal--after-with-selected-window save-selected-window--state)))
  (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and ... ...) (company-box--render-lines ...) (company-box--move-overlays selection)) ((get-text-property new-point ...) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let (...) (let ... ...))))) (internal--after-with-selected-window save-selected-window--state))))
  (let ((selection company-selection) (candidates-length company-candidates-length) (inhibit-redisplay t) (inhibit-modification-hooks t) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point ...) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond (... ... ...) (... ...) (t ... ...))) (if (equal selection (1- candidates-length)) (progn (let ... ...)))) (internal--after-with-selected-window save-selected-window--state)))) (if first-render nil (company-box--update-scrollbar (company-box--get-frame) first-render)) (run-with-idle-timer 0 nil #'(lambda nil (run-hook-with-args 'company-box-selection-hook selection (or (frame-parent) (selected-frame))))))
  company-box--move-selection(t)
  company-box--display(#("\n" 0 1 (company-box-candidate "GenerateEstablishmentSnapshotJob")) nil)
  (let ((string (make-string company-candidates-length 10))) (let ((list company-candidates) (i 0) it it-index) (ignore it it-index) (while list (setq it (car-safe (prog1 list (setq list (cdr list)))) it-index i i (1+ i)) (put-text-property it-index (1+ it-index) 'company-box-candidate it string))) (company-box--display string on-update))
  company-box-show()
  (cond ((eq command 'hide) (company-box-hide)) ((and (equal company-candidates-length 1) (company-box--hide-single-candidate)) (company-box-hide)) ((eq command 'show) (company-box-show)) ((eq command 'update) (company-box--update)))
  company-box-frontend(show)
  company-call-frontends(show)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209)
  apply(company-idle-begin (#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209))
  timer-event-handler([t 24594 31670 751931 nil company-idle-begin (#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209) nil 650000])
anupam312nwd commented 3 years ago

I'm having the same issue in Doom-Emacs too with ruby. This is the debug output I get:

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil norecord)
  ad-Advice-select-window(#<subr select-window> nil norecord)
  apply(ad-Advice-select-window #<subr select-window> (nil norecord))
  select-window(nil norecord)
  (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null (get-text-property (1- new-point) 'company-box--rendered))) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it (- company-box--chunk-size))) (let ((it (company-box--point-at-line it ...))) (set-window-start nil it))))))
  (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null (get-text-property ... ...))) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it (- company-box--chunk-size))) (let ((it ...)) (set-window-start nil it)))))) (internal--after-with-selected-window save-selected-window--state))
  (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and (> new-point 1) (null ...)) (company-box--render-lines (1- new-point)) (company-box--move-overlays selection)) ((get-text-property new-point 'company-box--rendered) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let ((it ...)) (let (...) (set-window-start nil it)))))) (internal--after-with-selected-window save-selected-window--state)))
  (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point (company-box--point-at-line selection)) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond ((and ... ...) (company-box--render-lines ...) (company-box--move-overlays selection)) ((get-text-property new-point ...) (company-box--move-overlays selection new-point)) (t (company-box--render-lines new-point) (company-box--move-overlays selection)))) (if (equal selection (1- candidates-length)) (progn (let (...) (let ... ...))))) (internal--after-with-selected-window save-selected-window--state))))
  (let ((selection company-selection) (candidates-length company-candidates-length) (inhibit-redisplay t) (inhibit-modification-hooks t) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (let ((save-selected-window--state (internal--before-with-selected-window (get-buffer-window (company-box--get-buffer) t)))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (setq company-selection selection) (let ((new-point ...) (buffer-list-update-hook nil) (window-configuration-change-hook nil)) (cond (... ... ...) (... ...) (t ... ...))) (if (equal selection (1- candidates-length)) (progn (let ... ...)))) (internal--after-with-selected-window save-selected-window--state)))) (if first-render nil (company-box--update-scrollbar (company-box--get-frame) first-render)) (run-with-idle-timer 0 nil #'(lambda nil (run-hook-with-args 'company-box-selection-hook selection (or (frame-parent) (selected-frame))))))
  company-box--move-selection(t)
  company-box--display(#("\n" 0 1 (company-box-candidate "GenerateEstablishmentSnapshotJob")) nil)
  (let ((string (make-string company-candidates-length 10))) (let ((list company-candidates) (i 0) it it-index) (ignore it it-index) (while list (setq it (car-safe (prog1 list (setq list (cdr list)))) it-index i i (1+ i)) (put-text-property it-index (1+ it-index) 'company-box-candidate it string))) (company-box--display string on-update))
  company-box-show()
  (cond ((eq command 'hide) (company-box-hide)) ((and (equal company-candidates-length 1) (company-box--hide-single-candidate)) (company-box-hide)) ((eq command 'show) (company-box-show)) ((eq command 'update) (company-box--update)))
  company-box-frontend(show)
  company-call-frontends(show)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209)
  apply(company-idle-begin (#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209))
  timer-event-handler([t 24594 31670 751931 nil company-idle-begin (#<buffer generate_snapshots_job.rb> #<window 328 on generate_snapshots_job.rb> 9569 209) nil 650000])

The error does not seem specific to any programming language as once it shows this error, I get completion-error in all modes once I start getting this error. similar issue reported on doom-emacs here: https://github.com/hlissner/doom-emacs/issues/4000 and corresponding (temporary) fix: https://github.com/hlissner/doom-emacs/commit/15d976142c3ce9d670f54d8b8be9143af57ef42f.

sebastiencs commented 2 years ago

Should be fixed with https://github.com/sebastiencs/company-box/commit/4dc0d9841aca2437f68f07aa540a3fab365ecff1

Artawower commented 1 year ago

Having the same issue with the latest commit

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil norecord)
  ad-Advice-select-window(#<subr select-window> nil norecord)
  apply(ad-Advice-select-window #<subr select-window> (nil norecord))
  select-window(nil norecord)
  company-box--move-selection(t)
  company-box--display(#("\n" 0 1 (company-box-candidate #("expandedNodes" 0 1 (completion-score 0.23076923076923078 face completions-common-part lsp-completion-item (:label #("expandedNodes" 0 13 (match-data ...)) :kind 5 :sortText "11" :commitCharacters ["." "," ";" "("] :insertTextFormat 1 :textEdit (:newText "expandedNodes" :insert (:start ... :end ...) :replace (:start ... :end ...)) :data (:uri "file:///Users/darkawower/projects/pet/orgnote/orgn..." :original (:textEdit ... :data ...) :pluginId "typescript" :virtualDocumentUri "file:///Users/darkawower/projects/pet/orgnote/orgn...") :_emacsStartPoint 674) lsp-sort-text "11" lsp-completion-start-point 674 lsp-completion-markers (674 #<marker (moves after insertion) at 677 in FileManagerSideBar.vue>) lsp-completion-prefix "exp" match-data (0 3 0 1 1 2 2 3)) 1 3 (face completions-common-part lsp-completion-item (:label #("expandedNodes" 0 13 (match-data ...)) :kind 5 :sortText "11" :commitCharacters ["." "," ";" "("] :insertTextFormat 1 :textEdit (:newText "expandedNodes" :insert (:start ... :end ...) :replace (:start ... :end ...)) :data (:uri "file:///Users/darkawower/projects/pet/orgnote/orgn..." :original (:textEdit ... :data ...) :pluginId "typescript" :virtualDocumentUri "file:///Users/darkawower/projects/pet/orgnote/orgn...") :_emacsStartPoint 674) lsp-sort-text "11" lsp-completion-start-point 674 lsp-completion-markers (674 #<marker (moves after insertion) at 677 in FileManagerSideBar.vue>) lsp-completion-prefix "exp" match-data (0 3 0 1 1 2 2 3)) 3 4 (face completions-first-difference lsp-completion-item (:label #("expandedNodes" 0 13 (match-data ...)) :kind 5 :sortText "11" :commitCharacters ["." "," ";" "("] :insertTextFormat 1 :textEdit (:newText "expandedNodes" :insert (:start ... :end ...) :replace (:start ... :end ...)) :data (:uri "file:///Users/darkawower/projects/pet/orgnote/orgn..." :original (:textEdit ... :data ...) :pluginId "typescript" :virtualDocumentUri "file:///Users/darkawower/projects/pet/orgnote/orgn...") :_emacsStartPoint 674) lsp-sort-text "11" lsp-completion-start-point 674 lsp-completion-markers (674 #<marker (moves after insertion) at 677 in FileManagerSideBar.vue>) lsp-completion-prefix "exp" match-data (0 3 0 1 1 2 2 3)) 4 13 (lsp-completion-item (:label #("expandedNodes" 0 13 (match-data ...)) :kind 5 :sortText "11" :commitCharacters ["." "," ";" "("] :insertTextFormat 1 :textEdit (:newText "expandedNodes" :insert (:start ... :end ...) :replace (:start ... :end ...)) :data (:uri "file:///Users/darkawower/projects/pet/orgnote/orgn..." :original (:textEdit ... :data ...) :pluginId "typescript" :virtualDocumentUri "file:///Users/darkawower/projects/pet/orgnote/orgn...") :_emacsStartPoint 674) lsp-sort-text "11" lsp-completion-start-point 674 lsp-completion-markers (674 #<marker (moves after insertion) at 677 in FileManagerSideBar.vue>) lsp-completion-prefix "exp" match-data (0 3 0 1 1 2 2 3))))) nil)
  company-box-show()
  company-box-frontend(show)
  company-call-frontends(show)
  company--begin-new()
  company--perform()
  company-auto-begin()
  company-idle-begin(#<buffer FileManagerSideBar.vue> #<window 769 on FileManagerSideBar.vue> 36741 677)
  apply(company-idle-begin (#<buffer FileManagerSideBar.vue> #<window 769 on FileManagerSideBar.vue> 36741 677))
  timer-event-handler([t 25905 29358 207923 nil company-idle-begin (#<buffer FileManagerSideBar.vue> #<window 769 on FileManagerSideBar.vue> 36741 677) nil 0 nil])