27/02/23 Emacs tinkering
This commit is contained in:
parent
bd8d701dcf
commit
e759527248
2 changed files with 191 additions and 69 deletions
|
|
@ -1,3 +1,12 @@
|
|||
;; I fixed custom variables here
|
||||
(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.
|
||||
'(custom-safe-themes
|
||||
'("a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)))
|
||||
|
||||
;; Machine-dependent configuration - adapt as required for your computer!
|
||||
|
||||
;; There are two kinds of settings that might have to be adapted to the
|
||||
|
|
@ -61,14 +70,14 @@
|
|||
("melpa" . 50)
|
||||
("gnu" . 10)))
|
||||
|
||||
(require 'cl)
|
||||
;(require 'cl)
|
||||
(let* ((required-packages
|
||||
'(dash
|
||||
htmlize
|
||||
ess
|
||||
auctex
|
||||
magit))
|
||||
(missing-packages (remove-if #'package-installed-p required-packages)))
|
||||
(missing-packages (cl-remove-if #'package-installed-p required-packages)))
|
||||
(when missing-packages
|
||||
(message "Missing packages: %s" missing-packages)
|
||||
(package-refresh-contents)
|
||||
|
|
@ -86,8 +95,8 @@
|
|||
'("Emacs - " (buffer-file-name "%f"
|
||||
(dired-directory dired-directory "%b"))))
|
||||
|
||||
(global-font-lock-mode t)
|
||||
(custom-set-faces
|
||||
(global-font-lock-mode t)
|
||||
(custom-set-faces
|
||||
'(flyspell-incorrect ((t (:inverse-video t)))))
|
||||
|
||||
(line-number-mode 1)
|
||||
|
|
@ -106,7 +115,7 @@
|
|||
(set-keyboard-coding-system 'utf-8)
|
||||
(prefer-coding-system 'utf-8)
|
||||
|
||||
(setq
|
||||
(setq
|
||||
ns-command-modifier 'meta ; Apple/Command key is Meta
|
||||
ns-alternate-modifier nil ; Option is the Mac Option key
|
||||
ns-use-mac-modifier-symbols nil ; display standard Emacs (and not standard Mac) modifier symbols
|
||||
|
|
@ -226,7 +235,7 @@ Entered on %U
|
|||
;; code block every time you export.
|
||||
(setq org-confirm-babel-evaluate nil) ;; Do not ask for confirmation all the time!!
|
||||
|
||||
(org-babel-do-load-languages
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'(
|
||||
(emacs-lisp . t)
|
||||
|
|
@ -246,7 +255,7 @@ Entered on %U
|
|||
(org . t)
|
||||
(makefile . t)
|
||||
))
|
||||
(setq org-src-preserve-indentation t)
|
||||
(setq org-src-preserve-indentation t)
|
||||
|
||||
(setq rrmooc/new-org-templates (version<= "9.2" (org-version)))
|
||||
(when rrmooc/new-org-templates
|
||||
|
|
@ -257,8 +266,8 @@ Entered on %U
|
|||
(add-to-list 'org-structure-template-alist
|
||||
(if rrmooc/new-org-templates
|
||||
(cons
|
||||
(first old-style-template)
|
||||
(string-trim-right (substring (second old-style-template) 8 -9)))
|
||||
(cl-first old-style-template)
|
||||
(string-trim-right (substring (cl-second old-style-template) 8 -9)))
|
||||
old-style-template)))
|
||||
|
||||
(unless rrmooc/new-org-templates
|
||||
|
|
@ -329,8 +338,11 @@ flycheck-grammalecte ; grammar
|
|||
counsel ; ivy autocomplete for M-x
|
||||
eldoc-box ; adding popup for eldoc
|
||||
powerline ; A cool powerline
|
||||
rainbow-delimiters ; To color parenthesis, brackets
|
||||
focus ; A package to dim surrounding text to focus on the current text
|
||||
aggressive-indent ; A package to force indentation and tidy code
|
||||
))
|
||||
(missing-wanted-packages (remove-if #'package-installed-p wanted-packages)))
|
||||
(missing-wanted-packages (cl-remove-if #'package-installed-p wanted-packages)))
|
||||
(when missing-wanted-packages
|
||||
(message "Missing wanted packages: %s" missing-wanted-packages)
|
||||
(package-refresh-contents)
|
||||
|
|
@ -338,8 +350,12 @@ flycheck-grammalecte ; grammar
|
|||
(package-install pkg)
|
||||
(message "Wanted package %s has been installed" pkg))))
|
||||
|
||||
(require 'powerline)
|
||||
(powerline-default-theme)
|
||||
(use-package smart-mode-line
|
||||
:ensure t
|
||||
:init
|
||||
(setq sml/theme 'automatic) ; To prevent the popup for loading custom theme
|
||||
:config
|
||||
(sml/setup))
|
||||
|
||||
;; Below we modify Org Mode behavior
|
||||
|
||||
|
|
@ -355,6 +371,7 @@ flycheck-grammalecte ; grammar
|
|||
;; Auto-toggle LaTeX fragments
|
||||
(add-hook 'org-mode-hook 'org-fragtog-mode)
|
||||
|
||||
(global-linum-mode 1)
|
||||
(global-visual-line-mode 1) ; 1 for on & 0 for off
|
||||
|
||||
(global-company-mode)
|
||||
|
|
@ -372,10 +389,12 @@ flycheck-grammalecte ; grammar
|
|||
:defer t
|
||||
:commands (eglot eglot-ensure)
|
||||
:hook
|
||||
((ess-mode . eglot-ensure))
|
||||
((ess-mode . eglot-ensure)
|
||||
(python-mode . eglot-ensure))
|
||||
:config
|
||||
;(setq eglot-stay-out-of '(company))
|
||||
;(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10"))
|
||||
(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10")
|
||||
)
|
||||
)
|
||||
|
||||
;; Forcing the ESS mode to work
|
||||
|
|
@ -396,4 +415,47 @@ flycheck-grammalecte ; grammar
|
|||
(advice-add 'eldoc-doc-buffer
|
||||
:around 'quit-eldoc-box-frame-before-doc-buffer)
|
||||
|
||||
(load-theme 'wombat t)
|
||||
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
||||
|
||||
(global-aggressive-indent-mode 1)
|
||||
(add-to-list 'aggressive-indent-excluded-modes 'html-mode)
|
||||
|
||||
(use-package numpydoc
|
||||
:ensure t
|
||||
:bind (:map python-mode-map
|
||||
("C-c C-n" . numpydoc-generate)))
|
||||
|
||||
(use-package projectile
|
||||
:ensure t
|
||||
:config
|
||||
(projectile-mode +1)
|
||||
;(setq projectile-switch-project-action #'magit-status)
|
||||
;(setq projectile-switch-project-action #'treemacs)
|
||||
;; Recommended keymap prefix on Windows/Linux
|
||||
:bind (:map projectile-mode-map
|
||||
("C-c p" . projectile-command-map)))
|
||||
|
||||
;; The YASnippet package
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
:config
|
||||
(yas-global-mode 1))
|
||||
|
||||
;; The snippets for YASnippet
|
||||
(use-package yasnippet-snippets
|
||||
:ensure t)
|
||||
|
||||
;; Perspective
|
||||
(use-package perspective
|
||||
:ensure t
|
||||
:bind
|
||||
("C-x C-b" . persp-list-buffers) ; or use a nicer switcher, see below
|
||||
:custom
|
||||
(persp-mode-prefix-key (kbd "C-c M-p")) ; pick your own prefix key here
|
||||
:init
|
||||
(persp-mode))
|
||||
|
||||
(use-package solo-jazz-theme
|
||||
:ensure t
|
||||
:config
|
||||
(load-theme 'solo-jazz t nil)) ;; t nil supposed to enable NO-CONFIRM disable NO-ENABLE
|
||||
|
|
|
|||
|
|
@ -16,6 +16,15 @@ document, simply =M-x org-babel-tangle=.
|
|||
|
||||
* Machine-dependent configuration
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
;; I fixed custom variables here
|
||||
(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.
|
||||
'(custom-safe-themes
|
||||
'("a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)))
|
||||
|
||||
;; Machine-dependent configuration - adapt as required for your computer!
|
||||
|
||||
;; There are two kinds of settings that might have to be adapted to the
|
||||
|
|
@ -85,14 +94,14 @@ document, simply =M-x org-babel-tangle=.
|
|||
#+END_SRC
|
||||
* Install packages
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(require 'cl)
|
||||
;(require 'cl)
|
||||
(let* ((required-packages
|
||||
'(dash
|
||||
htmlize
|
||||
ess
|
||||
auctex
|
||||
magit))
|
||||
(missing-packages (remove-if #'package-installed-p required-packages)))
|
||||
(missing-packages (cl-remove-if #'package-installed-p required-packages)))
|
||||
(when missing-packages
|
||||
(message "Missing packages: %s" missing-packages)
|
||||
(package-refresh-contents)
|
||||
|
|
@ -403,8 +412,8 @@ Sourced from [[https://stackoverflow.com/questions/10969617/hiding-markup-elemen
|
|||
(add-to-list 'org-structure-template-alist
|
||||
(if rrmooc/new-org-templates
|
||||
(cons
|
||||
(first old-style-template)
|
||||
(string-trim-right (substring (second old-style-template) 8 -9)))
|
||||
(cl-first old-style-template)
|
||||
(string-trim-right (substring (cl-second old-style-template) 8 -9)))
|
||||
old-style-template)))
|
||||
#+end_src
|
||||
*** With capital letters:
|
||||
|
|
@ -508,7 +517,7 @@ This often fails, yielding an ugly warning, and isn't of any use in Org-mode any
|
|||
#+begin_src emacs-lisp :tangle init.el
|
||||
;;; Beginning of my customisations
|
||||
#+end_src
|
||||
** Installing wanted packages
|
||||
** TODO Change to use package for clarity ! Installing wanted packages
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(let* ((wanted-packages
|
||||
'(flycheck ; grammar
|
||||
|
|
@ -522,8 +531,11 @@ flycheck-grammalecte ; grammar
|
|||
counsel ; ivy autocomplete for M-x
|
||||
eldoc-box ; adding popup for eldoc
|
||||
powerline ; A cool powerline
|
||||
rainbow-delimiters ; To color parenthesis, brackets
|
||||
focus ; A package to dim surrounding text to focus on the current text
|
||||
aggressive-indent ; A package to force indentation and tidy code
|
||||
))
|
||||
(missing-wanted-packages (remove-if #'package-installed-p wanted-packages)))
|
||||
(missing-wanted-packages (cl-remove-if #'package-installed-p wanted-packages)))
|
||||
(when missing-wanted-packages
|
||||
(message "Missing wanted packages: %s" missing-wanted-packages)
|
||||
(package-refresh-contents)
|
||||
|
|
@ -548,10 +560,14 @@ flycheck-grammalecte ; grammar
|
|||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
#+end_src
|
||||
** Powerline
|
||||
** Smart mode line (Powerline)
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(require 'powerline)
|
||||
(powerline-default-theme)
|
||||
(use-package smart-mode-line
|
||||
:ensure t
|
||||
:init
|
||||
(setq sml/theme 'automatic) ; To prevent the popup for loading custom theme
|
||||
:config
|
||||
(sml/setup))
|
||||
#+end_src
|
||||
** Org modifications
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
|
|
@ -581,6 +597,7 @@ This mode makes the emphasis markers appear when the cursor is on it
|
|||
#+end_src
|
||||
** Visual line mode activated on startup
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(global-linum-mode 1)
|
||||
(global-visual-line-mode 1) ; 1 for on & 0 for off
|
||||
#+end_src
|
||||
** Remote image display :disabled:
|
||||
|
|
@ -620,7 +637,7 @@ This code was taken from https://emacs.stackexchange.com/questions/42281/org-mod
|
|||
(setq ivy-use-virtual-buffers t)
|
||||
(setq ivy-count-format "(%d/%d) ")
|
||||
#+end_src
|
||||
** LSP and other IDE features
|
||||
** LSP, programming and other IDE features
|
||||
*** 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
|
||||
|
|
@ -632,10 +649,12 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
|
|||
:defer t
|
||||
:commands (eglot eglot-ensure)
|
||||
:hook
|
||||
((ess-mode . eglot-ensure))
|
||||
((ess-mode . eglot-ensure)
|
||||
(python-mode . eglot-ensure))
|
||||
:config
|
||||
;(setq eglot-stay-out-of '(company))
|
||||
;(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10"))
|
||||
(add-to-list 'eglot-server-programs '((c-mode c++-mode) "clangd-10")
|
||||
)
|
||||
)
|
||||
|
||||
;; Forcing the ESS mode to work
|
||||
|
|
@ -660,7 +679,47 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
|
|||
:around 'quit-eldoc-box-frame-before-doc-buffer)
|
||||
|
||||
#+end_src
|
||||
** Treemacs :disabled:
|
||||
*** Rainbow delimiters
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
|
||||
#+end_src
|
||||
*** Aggressive indent
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(global-aggressive-indent-mode 1)
|
||||
(add-to-list 'aggressive-indent-excluded-modes 'html-mode)
|
||||
#+end_src
|
||||
*** NumpyDoc to generate python docstring
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(use-package numpydoc
|
||||
:ensure t
|
||||
:bind (:map python-mode-map
|
||||
("C-c C-n" . numpydoc-generate)))
|
||||
#+end_src
|
||||
*** Projectile for project management
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(use-package projectile
|
||||
:ensure t
|
||||
:config
|
||||
(projectile-mode +1)
|
||||
;(setq projectile-switch-project-action #'magit-status)
|
||||
;(setq projectile-switch-project-action #'treemacs)
|
||||
;; Recommended keymap prefix on Windows/Linux
|
||||
:bind (:map projectile-mode-map
|
||||
("C-c p" . projectile-command-map)))
|
||||
#+end_src
|
||||
*** YASnippet to provided code snippets
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
;; The YASnippet package
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
:config
|
||||
(yas-global-mode 1))
|
||||
|
||||
;; The snippets for YASnippet
|
||||
(use-package yasnippet-snippets
|
||||
:ensure t)
|
||||
#+end_src
|
||||
*** Treemacs :disabled:
|
||||
#+begin_src emacs-lisp
|
||||
;:tangle init.el
|
||||
(use-package treemacs
|
||||
|
|
@ -669,7 +728,10 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
|
|||
:init
|
||||
(with-eval-after-load 'winum
|
||||
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||
(with-eval-after-load 'treemacs
|
||||
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action))
|
||||
:config
|
||||
(add-hook 'prog-mode-hook 'treemacs)
|
||||
(progn
|
||||
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
|
||||
treemacs-deferred-git-apply-delay 0.5
|
||||
|
|
@ -752,10 +814,6 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
|
|||
("C-x t C-t" . treemacs-find-file)
|
||||
("C-x t M-t" . treemacs-find-tag)))
|
||||
|
||||
(use-package treemacs-evil
|
||||
:after (treemacs evil)
|
||||
:ensure t)
|
||||
|
||||
(use-package treemacs-projectile
|
||||
:after (treemacs projectile)
|
||||
:ensure t)
|
||||
|
|
@ -767,22 +825,24 @@ Language Server Protocol (LSP) provides intellisense completion and other nice f
|
|||
(use-package treemacs-magit
|
||||
:after (treemacs magit)
|
||||
:ensure t)
|
||||
|
||||
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
|
||||
:after (treemacs persp-mode) ;;or perspective vs. persp-mode
|
||||
#+end_src
|
||||
** Perspective to handle multiple workspaces
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
;; Perspective
|
||||
(use-package perspective
|
||||
:ensure t
|
||||
:config (treemacs-set-scope-type 'Perspectives))
|
||||
|
||||
(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
|
||||
:after (treemacs)
|
||||
:ensure t
|
||||
:config (treemacs-set-scope-type 'Tabs))
|
||||
:bind
|
||||
("C-x C-b" . persp-list-buffers) ; or use a nicer switcher, see below
|
||||
:custom
|
||||
(persp-mode-prefix-key (kbd "C-c M-p")) ; pick your own prefix key here
|
||||
:init
|
||||
(persp-mode))
|
||||
#+end_src
|
||||
* Theme
|
||||
** Activation du thème
|
||||
#+begin_src emacs-lisp :tangle init.el
|
||||
(load-theme 'wombat t)
|
||||
(use-package solo-jazz-theme
|
||||
:ensure t
|
||||
:config
|
||||
(load-theme 'solo-jazz t nil)) ;; t nil supposed to enable NO-CONFIRM disable NO-ENABLE
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue