Enhanced comments and enabled company mode with eglot

This commit is contained in:
Louis Lacoste 2023-02-24 17:38:11 +01:00
parent 2054d46570
commit bd8d701dcf
2 changed files with 68 additions and 28 deletions

View file

@ -87,12 +87,7 @@
(dired-directory dired-directory "%b"))))
(global-font-lock-mode t)
(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.
(custom-set-faces
'(flyspell-incorrect ((t (:inverse-video t)))))
(line-number-mode 1)
@ -320,12 +315,15 @@ A->B
(setq python-shell-completion-native-enable nil)
;;; Beginning of my customisations
(let* ((wanted-packages
'(flycheck ; grammar
flycheck-grammalecte ; grammar
company ; auto-complete
org-appear ; org emphasis appear
org-fragtog ; see latex fragment in org
org-bullets ; Nicer bullets
use-package
eglot ; LSP client
counsel ; ivy autocomplete for M-x
@ -343,15 +341,22 @@ flycheck-grammalecte ; grammar
(require 'powerline)
(powerline-default-theme)
;; Below we modify Org Mode behavior
;; When loading org-mode turns off auto-fill-mode
(add-hook 'org-mode-hook 'turn-off-auto-fill)
;; Emphasis markers now appear when hovering
(add-hook 'org-mode-hook 'org-appear-mode)
(global-visual-line-mode 1) ; 1 for on & 0 for off
;; Nicer org bullets
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
;; Auto-toggle LaTeX fragments
(add-hook 'org-mode-hook 'org-fragtog-mode)
(global-visual-line-mode 1) ; 1 for on & 0 for off
(global-company-mode)
(ivy-mode 1)
@ -359,7 +364,8 @@ flycheck-grammalecte ; grammar
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
; Enables LSP for the provided languages
;;; LSP features
;; Enables LSP for the provided languages
(require 'use-package)
(use-package eglot
@ -368,22 +374,26 @@ flycheck-grammalecte ; grammar
:hook
((ess-mode . eglot-ensure))
:config
(setq eglot-stay-out-of '(company))
;(setq eglot-stay-out-of '(company))
;(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10"))
)
;; Forcing the ESS mode to work
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(ess-mode . ("R" "--slave" "-e" "languageserver::run()"))))
;; Activating eldoc-box to have a popup with the doc
(require 'eldoc-box)
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t)
(load-theme 'leuven t)
(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.
'(package-selected-packages
'(powerline cmake-mode use-package treemacs-tab-bar treemacs-projectile treemacs-persp treemacs-magit treemacs-icons-dired treemacs-evil org-fragtog org-appear lsp-pyright htmlize helm flycheck-grammalecte ess eldoc-box eglot counsel company auctex)))
;; Workaround to disable the popup when we open the buffer
(defun quit-eldoc-box-frame-before-doc-buffer (orig-fun &rest _arg)
(eldoc-box-quit-frame)
(funcall orig-fun t))
(advice-add 'eldoc-doc-buffer
:around 'quit-eldoc-box-frame-before-doc-buffer)
(load-theme 'wombat t)

View file

@ -1,4 +1,3 @@
# -*- mode: org -*-
#+TITLE: Emacs init file written in org-mode
#+AUTHOR: Arnaud Legrand, Konrad Hinsen
@ -506,6 +505,9 @@ This often fails, yielding an ugly warning, and isn't of any use in Org-mode any
(setq python-shell-completion-native-enable nil)
#+end_src
* Custom Louis :LOUIS:
#+begin_src emacs-lisp :tangle init.el
;;; Beginning of my customisations
#+end_src
** Installing wanted packages
#+begin_src emacs-lisp :tangle init.el
(let* ((wanted-packages
@ -514,6 +516,7 @@ flycheck-grammalecte ; grammar
company ; auto-complete
org-appear ; org emphasis appear
org-fragtog ; see latex fragment in org
org-bullets ; Nicer bullets
use-package
eglot ; LSP client
counsel ; ivy autocomplete for M-x
@ -550,25 +553,36 @@ flycheck-grammalecte ; grammar
(require 'powerline)
(powerline-default-theme)
#+end_src
** Disabling auto-fill-mode when using org
** Org modifications
#+begin_src emacs-lisp :tangle init.el
;; Below we modify Org Mode behavior
#+end_src
*** Disabling auto-fill-mode when using org
This snippet disables the auto-fill-mode which wraps the line when it exceeds a certain length
#+begin_src emacs-lisp :tangle init.el
;; When loading org-mode turns off auto-fill-mode
(add-hook 'org-mode-hook 'turn-off-auto-fill)
#+end_src
** Activating org-appear minor mode
*** Activating org-appear minor mode
This mode makes the emphasis markers appear when the cursor is on it
#+begin_src emacs-lisp :tangle init.el
;; Emphasis markers now appear when hovering
(add-hook 'org-mode-hook 'org-appear-mode)
#+end_src
*** Nicer Org bullets
#+begin_src emacs-lisp :tangle init.el
;; Nicer org bullets
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
#+end_src
*** Auto toggle the preview of LaTeX fragments
#+begin_src emacs-lisp :tangle init.el
;; Auto-toggle LaTeX fragments
(add-hook 'org-mode-hook 'org-fragtog-mode)
#+end_src
** Visual line mode activated on startup
#+begin_src emacs-lisp :tangle init.el
(global-visual-line-mode 1) ; 1 for on & 0 for off
#+end_src
** Auto toggle the preview of LaTeX fragments
#+begin_src emacs-lisp :tangle init.el
(add-hook 'org-mode-hook 'org-fragtog-mode)
#+end_src
** Remote image display :disabled:
This code was taken from https://emacs.stackexchange.com/questions/42281/org-mode-is-it-possible-to-display-online-images and makes use of the =org-yt= package.
@ -610,7 +624,8 @@ This code was taken from https://emacs.stackexchange.com/questions/42281/org-mod
*** Enabling eglot and adding ess-mode lsp
Language Server Protocol (LSP) provides intellisense completion and other nice features of VS Code.
#+begin_src emacs-lisp :tangle init.el
; Enables LSP for the provided languages
;;; LSP features
;; Enables LSP for the provided languages
(require 'use-package)
(use-package eglot
@ -619,10 +634,12 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
:hook
((ess-mode . eglot-ensure))
:config
(setq eglot-stay-out-of '(company))
;(setq eglot-stay-out-of '(company))
;(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10"))
)
;; Forcing the ESS mode to work
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(ess-mode . ("R" "--slave" "-e" "languageserver::run()"))))
@ -630,8 +647,18 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
#+end_src
*** Floating pop-up for eldoc
#+begin_src emacs-lisp :tangle init.el
;; Activating eldoc-box to have a popup with the doc
(require 'eldoc-box)
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t)
;; Workaround to disable the popup when we open the buffer
(defun quit-eldoc-box-frame-before-doc-buffer (orig-fun &rest _arg)
(eldoc-box-quit-frame)
(funcall orig-fun t))
(advice-add 'eldoc-doc-buffer
:around 'quit-eldoc-box-frame-before-doc-buffer)
#+end_src
** Treemacs :disabled:
#+begin_src emacs-lisp
@ -754,5 +781,8 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
* Theme
** Activation du thème
#+begin_src emacs-lisp :tangle init.el
(load-theme 'leuven t)
(load-theme 'wombat t)
#+end_src
#+RESULTS:
: t