summaryrefslogtreecommitdiffstats
path: root/.emacs.d/lisp/bandali-prog.el
blob: f777f885391a90453639b36e78b62c9ebcfddeb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
;;; bandali-prog.el --- programming modes setup -*- lexical-binding: t; -*-

;; Copyright (c) 2018-2025 Amin Bandali <bandali@gnu.org>

;; Author: Amin Bandali <bandali@gnu.org>
;; Keywords: languages

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; My customizations for various programming language modes.

;;; Code:

(use-package elisp-mode
  :bind
  ("C-c e e" . eval-last-sexp))

(use-package pp
  :bind
  ("C-c e m" . pp-macroexpand-last-sexp))

(use-package lisp-mode
  :hook
  (lisp-interaction-mode . (lambda () (setq-local indent-tabs-mode nil))))

(use-package alloy-mode
  :disabled
  :load-path "lisp/alloy-mode"
  :mode "\\.\\(als\\|dsh\\)\\'"
  :hook
  (alloy-mode . (lambda nil (setq-local indent-tabs-mode nil)))
  :init
  (defun b/alloy-simple-indent (start end)
    (interactive "r")
    ;; (if (region-active-p)
    ;;     (indent-rigidly start end alloy-basic-offset)
    ;;   (if (bolp)
    ;;       (indent-rigidly (line-beginning-position)
    ;;                       (line-end-position)
    ;;                       alloy-basic-offset)))
    (indent-to (+ (current-column) alloy-basic-offset)))
  :bind
  (:map
   alloy-mode-map
   (;; ("TAB" . b/alloy-simple-indent)
    "RET" . electric-newline-and-maybe-indent))
  :custom
  (alloy-basic-offset 2))

;; (eval-when-compile (defvar lean-mode-map))
;; (run-with-idle-timer 0.4 nil #'require 'lean-mode)
;; (with-eval-after-load 'lean-mode
;;   (require 'lean-input)
;;   (setq default-input-method "Lean"
;;         lean-input-tweak-all '(lean-input-compose
;;                                (lean-input-prepend "/")
;;                                (lean-input-nonempty))
;;         lean-input-user-translations '(("/" "/")))
;;   (lean-input-setup)
;;   ;; local key bindings
;;   (define-key lean-mode-map (kbd "S-SPC") #'company-complete))

(use-package sgml-mode
  :defer t
  :custom
  (sgml-basic-offset 0))

(use-package css-mode
  :defer t
  :custom
  (css-indent-offset 2))

(use-package cmake-mode
  :mode
  (("CMakeLists\\.txt\\'" . cmake-mode)
   ("\\.cmake\\'" . cmake-mode)))

(use-package cmake-font-lock
  :after cmake-mode
  :load-path "lisp/cmake-font-lock")

(use-package reftex
  :hook
  (latex-mode . reftex-mode))

(provide 'bandali-prog)
;;; bandali-prog.el ends here