Open hongyi-zhao opened 2 years ago
I don't know what's the correct fix here, but you can do the following to get rid of bell noise completely.
(defun nil-bell ()) ; Turn off the bell on macOS
(setq visible-bell nil
ring-bell-function 'nil-bell)
@jcs090218 Do you have this problem too? But in my opinion, the problem now seems to disappear with the following current configuration:
;;https://github.com/emacs-lsp/dap-mode/issues/520
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
:config
;; https://github.com/emacs-lsp/dap-mode/issues/372#issuecomment-939248097
;; (defun disable-lsp-ui-doc (orig-fun &rest args)
;; ;; (message "orig-fun called with args %S" args)
;; ;; (let ((res (apply orig-fun args)))
;; ;; (message "orig-fun returned %S" res)
;; ;; res)
;; (lsp-ui-doc-mode -1))
;; (defun enable-lsp-ui-doc (orig-fun &rest args)
;; ;; (message "orig-fun called with args %S" args)
;; ;; (let ((res (apply orig-fun args)))
;; ;; (message "orig-fun returned %S" res)
;; ;; res)
;; (lsp-ui-doc-mode))
;; (advice-add 'dap-debug :after #'disable-lsp-ui-doc)
;; (advice-add 'dap-disconnect :after #'enable-lsp-ui-doc)
(define-advice dap-debug (:after (orig-func &rest args) disable-lsp-ui-doc) (lsp-ui-doc-mode -1))
(define-advice dap-disconnect (:after (orig-func &rest args) enable-lsp-ui-doc) (lsp-ui-doc-mode t))
;; https://github.com/emacs-lsp/lsp-ui/issues/467#issuecomment-651466309
(add-hook 'lsp-ui-doc-mode-hook
(lambda ()
(when lsp-ui-doc-mode
(remove-hook 'post-command-hook #'lsp-ui-doc--make-request t))))
;; https://github.com/emacs-lsp/lsp-ui/issues/467#issuecomment-651505324
;; (defun my/lsp-ui-doc--make-request nil
;; (if (not (eq this-command 'self-insert-command))
;; (lsp-ui-doc--make-request)
;; (lsp-ui-doc--hide-frame)))
;; (add-hook
;; 'lsp-ui-doc-mode-hook
;; (lambda ()
;; (when lsp-ui-doc-mode
;; (remove-hook 'post-command-hook #'lsp-ui-doc--make-request t)
;; (add-hook 'post-command-hook 'my/lsp-ui-doc--make-request nil t))))
)
See here for some relevant (probably) discussion.
I’m encountering this, though only on the first LSP request I make. My visual-bell
is t
and my ring-bell-function
is doom-themes-visual-bell-fn
. It’s not clear to me what part of lsp-ui-doc--make-request
would cause a triggered bell event.
I found that when scrolling down the document with the mouse, a continuous beep will be triggered after reaching the bottom. Sometimes this sound prevents Emacs from responding to the user. As shown below:
Any hints for fixing this problem?
Regards, HZ