Files
azos/pkgs/elisp/azos-emacs-dev.org
T
2024-11-18 09:11:55 +02:00

3.4 KiB

Aner's Emacs Development Configuration

Base dev

Require

(require 'azos-emacs-base)

Flycheck

Flycheck is for syntax checking. Mode-specific configs in their relevant sections.

(use-package flycheck
  :config
    (global-flycheck-mode 1)
)

Dev modes

Irony-mode

Must work on this. While it does work, can get slow and for weird projects can show errors.

Namespace indent disabling based on: https://stackoverflow.com/questions/13825188/suppress-c-namespace-indentation-in-emacs

;; == irony-mode ==
(use-package irony
  :ensure t
  :defer t
  :init
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  :config
  ;; replace the `completion-at-point' and `complete-symbol' bindings in
  ;; irony-mode's buffers by irony-mode's function
  (defun azos/irony-mode-hook ()
    (define-key irony-mode-map [remap completion-at-point]
      'irony-completion-at-point-async)
    (define-key irony-mode-map [remap complete-symbol]
      'irony-completion-at-point-async))
  (add-hook 'irony-mode-hook 'azos/irony-mode-hook)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

  (defconst azos/cc-style
    '("gnu"
        (c-offsets-alist . ((innamespace . [0])))
        (c-basic-offset . 4)))

  (c-add-style "azos/cc-style" azos/cc-style)
  (add-hook 'irony-mode-hook (lambda () (c-set-style "azos/cc-style")))
  )

Integration with flycheck

(use-package flycheck-irony
  :after flycheck irony
  :config
    (add-hook 'flycheck-mode-hook #'flycheck-irony-setup)
    (add-hook 'c++-mode-hook (lambda () (setq flycheck-checker 'irony)))
)

CMake

(use-package cmake-mode)

YAML

(use-package yaml-mode)

Nix

(use-package nix-mode)

Python

(setq
    ;; python-shell-interpreter "python3"
    python-shell-completion-native-enable nil)

(defun azos/python/set-fringes () "Sets fringes for python"
       (setq left-fringe-width 10 right-fringe-width 0))

(add-hook 'python-mode-hook 'azos/python/set-fringes)

(use-package elpy
  :ensure t
  :defer t)
  ;; :init
  ;; (elpy-enable))

(define-key azos/global-minor-mode/open-keymap
  (kbd "r p") 'run-python)

org src block

(setq org-babel-python-command "python3")

Rust

(use-package rust-mode)

Jupyter (ein)

(use-package ein
  :config
    (setq ein:output-area-inlined-images t)
    (add-hook 'ein:notebook-mode-hook (lambda () (progn
        ;; (elpy-mode -1)
        (define-key ein:notebook-mode-map (kbd "C-c C-k") nil)))))

Python

Python version for ORG

(require 'ob)
(setq org-babel-python-command "python3")

ORG

Async blocks

(use-package ob-async
  :config
    ;Setting command of async blocks to Python3
    (add-hook 'ob-async-pre-execute-src-block-hook
            '(lambda ()
            (setq org-babel-python-command "python3")
    ))
)

Provide

(provide 'azos-emacs-dev)
(add-hook 'after-init-hook (lambda () (require 'azos-emacs-dev)))