admin管理员组文章数量:1122846
I am using Emacs 29.4 (built from source) and would like to customize it for C/C++ programming. I followed this tutorial (/) and all the features (e.g., code completion, code navigation, etc...) work fine.
However, when I insert a comment like:
/* this is a comment */
Emacs prompts 'Install package all? (yes or no)' as soon as I type three letters inside the comment (i.e., /* thi). The problem occurs only when I edit a file from a project built with CMake. If I edit a new .c file not related to a project, comments work fine.
This is my init.el
;; Display line numbers
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
;; Add packages
(require 'package)
(add-to-list 'package-archives '("melpa" . "/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "/") t)
(package-initialize)
;; C/C++ Settings
(setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp
projectile hydra flycheck company avy which-key helm-xref dap-mode))
(when (cl-find-if-not #'package-installed-p package-selected-packages)
(package-refresh-contents)
(mapc #'package-install package-selected-packages))
;; sample `helm' configuration use / for details
(helm-mode)
(require 'helm-xref)
(define-key global-map [remap find-file] #'helm-find-files)
(define-key global-map [remap execute-extended-command] #'helm-M-x)
(define-key global-map [remap switch-to-buffer] #'helm-mini)
(which-key-mode)
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.2
company-minimum-prefix-length 3
lsp-idle-delay 0.1) ;; clangd is fast
(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(require 'dap-cpptools)
(yas-global-mode))
The problem seems related to:
(which-key-mode)
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
If I comment out these lines, the problem disappears but, of course, I loose all the C/C++ features.
本文标签: Emacs asks for 39install package all39 when typing a comment in CC modeStack Overflow
版权声明:本文标题:Emacs asks for 'install package all?' when typing a comment in CC++ mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308684a1933751.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论