diff --git a/.emacs.d/init.el b/.emacs.d/init.el index c2da8b0..637fe53 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -5,22 +5,22 @@ ;; Packages I typically use can be reinstalled by using: ;; M-x package-install-selected-packages -(setq user-full-name "Julien Palard") -(setq user-mail-address "julien@palard.fr") +(setq user-full-name "Julien Palard" + user-mail-address "julien@palard.fr") (require 'use-package) (require 'package) (package-initialize) (server-mode) (setq exec-path (append exec-path '("/home/mdk/.local/bin"))) -;; If there are no archived package contents, refresh them -(when (not package-archive-contents) - (package-refresh-contents)) - (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("org" . "https://orgmode.org/elpa/") ("melpa" . "https://melpa.org/packages/"))) +;; If there are no archived package contents, refresh them +(when (not package-archive-contents) + (package-refresh-contents)) + (use-package ido :ensure t :init @@ -42,8 +42,6 @@ :ensure t :custom (lsp-jedi-hover-disable-keyword-all t) -;; (lsp-ui-sideline-show-code-actions nil) -;; (lsp-ui-sideline-show-hover nil) (lsp-signature-doc-lines 1) (lsp-diagnostics-provider :none) (lsp-jedi-pylsp-extra-paths []) @@ -52,17 +50,8 @@ (set-face-attribute 'lsp-face-highlight-textual nil :background "#666" :foreground "#ffffff" ) - (lsp-register-client - (make-lsp-client - :new-connection (lsp-stdio-connection "po-language-server") - :activation-fn (lsp-activate-on "gettext" "plaintext") - :priority -1 - :server-id 'po - )) - (add-to-list 'lsp-language-id-configuration '(po-mode . "gettext")) - :hook ((po-mode python-mode) . lsp) + :hook ((python-mode) . lsp) :commands lsp-mode - ) (use-package python @@ -100,23 +89,6 @@ :config (setq org-fancy-priorities-list '("⚡" "⬆" "⬇" "☕"))) -;; lsp-mode can only work on named buffers -(defun po-mode-name-buffer () - (setq-local buffer-file-name "msgstr.po") - (lsp)) - -(defun po-mode-unname-buffer () - (setq-local buffer-file-name nil)) - -(add-hook 'po-mode-hook - (lambda () - (advice-add 'po-edit-msgstr :after 'po-mode-name-buffer) - (advice-add 'po-subedit-exit :before 'po-mode-unname-buffer))) - - -;; Disable all version control backends (Start faster): -(setq vc-handled-backends ()) - ;; Disable transient mark mode, I don't like it: (transient-mark-mode nil) @@ -131,15 +103,13 @@ (lambda() (make-local-variable 'show-trailing-whitespace) (setq show-trailing-whitespace nil))) -(setq inhibit-startup-message t) - (global-font-lock-mode t) (column-number-mode t) (show-paren-mode t) (global-set-key "\C-cc" 'compile) -;(global-set-key "\M-n" 'forward-paragraph) -;(global-set-key "\M-p" 'backward-paragraph) +(global-set-key "\M-n" 'forward-paragraph) +(global-set-key "\M-p" 'backward-paragraph) (global-set-key "\C-xrv" 'list-registers) (global-set-key (kbd "M-h") 'backward-kill-word) (global-set-key "\C-cj" 'windmove-left) @@ -153,18 +123,19 @@ (global-set-key "\C-cb" 'org-switchb) (global-set-key "\C-\M-v" 'clipboard-yank) - -(add-hook 'write-file-hooks 'delete-trailing-whitespace) +(add-hook 'before-save-hook 'delete-trailing-whitespace) (add-hook 'after-init-hook 'global-company-mode) -;; Enable backup files. -(setq make-backup-files t) -;; Enable versioning of backup files. -(setq version-control t) +(setq version-control t ; (for backup files) + mouse-yank-at-point t + solarized-high-contrast-mode-line t + inhibit-startup-message t + make-backup-files t + backup-directory-alist (quote ((".*" . "~/.emacs.d/backup/"))) + ) ;; Save all backup file in this directory. -(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/backup/")))) (setq-default delete-old-versions t) (fset 'yes-or-no-p 'y-or-n-p) @@ -213,31 +184,6 @@ (yas-global-mode 1) -(defun konix/find-file-hook () - "Permits file opening with line suffix like foo.py:21." - (if (and - (string-match "^\\(.+\\):\\([0-9]+\\)$" buffer-file-name) - (not - (file-exists-p buffer-file-name))) - ;; the given file does not exist and is of the form file_name:number, I - ;; most likely wants to open file_name at line number - (progn - (let ( - (old_buffer (current-buffer)) - (file_name (match-string-no-properties 1 buffer-file-name)) - (line (match-string-no-properties 2 buffer-file-name)) - ) - (if (file-exists-p file_name) - (progn - (find-file file_name) - (forward-line (string-to-number line)) - (kill-buffer old_buffer) - nil) - nil))) - nil)) - -(add-to-list 'find-file-hook 'konix/find-file-hook) - (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -248,10 +194,7 @@ '(package-selected-packages '(flycheck-grammalecte blacken spacemacs-theme company yasnippet-snippets use-package zenburn-theme markdown-mode org po-mode yaml-mode))) -; (load-theme 'zenburn t) (load-theme 'spacemacs-light t) -;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") -;(load-theme 'github-modern 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. @@ -259,9 +202,5 @@ ;; If there is more than one, they won't work right. ) -;(custom-set-faces -; '(default ((t (:family "Terminus" :foundry "UNKN" :slant normal :weight normal :height 90 :width normal))))) -; (add-to-list 'default-frame-alist '(font . "LiberationMono:size=18")) (set-face-attribute 'default t :font "LiberationMono:size=18") -(setq solarized-high-contrast-mode-line t)