diff options
| author | Cori Barker <coribarker2@gmail.com> | 2026-02-19 21:38:29 +0000 |
|---|---|---|
| committer | Cori Barker <coribarker2@gmail.com> | 2026-02-19 21:38:29 +0000 |
| commit | 7020f806357e1d94ed830e74711074573ef805e5 (patch) | |
| tree | f16496ba5c17aa1b0b5d169e5f5c068b58af2ca6 | |
| parent | effd0f6e45aef565869af1bcf07d43c6bc7df73b (diff) | |
[emacs] added rc/require and simpc and configured some packages
| -rw-r--r-- | .emacs | 44 | ||||
| -rw-r--r-- | .emacs.custom.el | 2 | ||||
| -rw-r--r-- | .emacs.local/simpc-mode.el (renamed from .emacs.local/simpc-mode/simpc-mode.el) | 0 | ||||
| -rw-r--r-- | .emacs.local/simpc-mode/LICENSE | 20 | ||||
| -rw-r--r-- | .emacs.local/simpc-mode/README.md | 61 | ||||
| -rw-r--r-- | .emacs.rc/rc.el | 34 |
6 files changed, 77 insertions, 84 deletions
@@ -1,13 +1,53 @@ (setq custom-file "~/.emacs.custom.el") (load custom-file) +(package-initialize) + (add-to-list 'load-path "~/.emacs.local") -(require 'simpc-mode) -(add-to-list 'auto-mode-alist '("\\.[hc]\\(pp\\)?\\'" . simpc-mode)) + +(load "~/.emacs.rc/rc.el") + +;; Appearance +(add-to-list 'default-frame-alist `(font . "FiraCode-11")) (tool-bar-mode 0) (menu-bar-mode 0) (scroll-bar-mode 0) (global-display-line-numbers-mode 1) + +;; simpc +(require 'simpc-mode) +(add-to-list 'auto-mode-alist '("\\.[hc]\\(pp\\)?\\'" . simpc-mode)) + +;; evil +(rc/require 'evil) (evil-mode) + +;; ido +(rc/require 'ido) (ido-mode) +(ido-everywhere) + +;; magit +(rc/require 'magit) + +(setq magit-auto-revert-mode nil) + +(global-set-key (kbd "C-c m s") 'magit-status) +(global-set-key (kbd "C-c m l") 'magit-log) + +;; compile +(add-to-list 'display-buffer-alist + '("\\*compilation\\*" + (display-buffer-below-selected) + (window-height . 0.3))) + +(global-set-key (kbd "C-c c") #'compile) + +;; reload ~/.emacs +(defun reload-init-file () + "Reload the Emacs init file." + (interactive) + (load-file "~/.emacs")) + +(global-set-key (kbd "C-c i") #'reload-init-file) diff --git a/.emacs.custom.el b/.emacs.custom.el index b0ac4c5..993786f 100644 --- a/.emacs.custom.el +++ b/.emacs.custom.el @@ -7,7 +7,7 @@ '(display-line-numbers-type 'relative) '(evil-undo-system 'undo-redo) '(inhibit-startup-screen t) - '(package-selected-packages '(evil gruber-darker-theme magit pdf-tools poker))) + '(package-selected-packages nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/.emacs.local/simpc-mode/simpc-mode.el b/.emacs.local/simpc-mode.el index 928bb93..928bb93 100644 --- a/.emacs.local/simpc-mode/simpc-mode.el +++ b/.emacs.local/simpc-mode.el diff --git a/.emacs.local/simpc-mode/LICENSE b/.emacs.local/simpc-mode/LICENSE deleted file mode 100644 index b196837..0000000 --- a/.emacs.local/simpc-mode/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2020 Alexey Kutepov <reximkut@gmail.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/.emacs.local/simpc-mode/README.md b/.emacs.local/simpc-mode/README.md deleted file mode 100644 index 7c879fa..0000000 --- a/.emacs.local/simpc-mode/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# Simple C mode for Emacs - -Because whatever comes with Emacs is too slow. - -This mode does not try to be as featureful as `c-mode`, `c++-mode`, -`cc-mode`, etc. Instead we are trying to implement a bare minimum -syntax highlighting and indentation to maintain high performance on -big files with long lines. - -The goal is to be able to comfortably browse and modify the following files: -- [imgui](https://raw.githubusercontent.com/ocornut/imgui/fb7f6cab8c322731da336e553915e944bf386e62/imgui.h) -- [amalgamated sqlite3.c](https://raw.githubusercontent.com/IreneKnapp/direct-sqlite/a74cc50c735053c7c49c487a66e7756b524db883/cbits/sqlite3.c) -- [miniaudio.h](https://raw.githubusercontent.com/mackron/miniaudio/refs/heads/master/miniaudio.h) -- ... - -Right now the only way to work with these files in Emacs is to use -`text-mode`. Which is actually a good evidence that Emacs itself can -handle such files! It's `c-mode` (and others) that cannot. - -## Installing locally - -Put [simpc-mode.el](./simpc-mode.el) to some folder `/path/to/simpc/`. Add this to your `.emacs`: - -```el -;; Adding `/path/to/simpc` to load-path so `require` can find it -(add-to-list 'load-path "/path/to/simpc/") -;; Importing simpc-mode -(require 'simpc-mode) -;; Automatically enabling simpc-mode on files with extensions like .h, .c, .cpp, .hpp -(add-to-list 'auto-mode-alist '("\\.[hc]\\(pp\\)?\\'" . simpc-mode)) -``` - -## Indentation - -Right now the mode supports only very simple indentations based on the -analysing the previous non-empty line and its surrounding curly -braces. Anything more complicated is outside of the scope of the -project. - -It is recommended to use an external formatter such as -[indent](https://www.gnu.org/software/indent/), -[astyle](http://astyle.sourceforge.net/), -[clang-format](https://clang.llvm.org/docs/ClangFormat.html), etc. - -Here is how I use [astyle](http://astyle.sourceforge.net/): - -```emacs-lisp -(defun astyle-buffer () - (interactive) - (let ((saved-line-number (line-number-at-pos))) - (shell-command-on-region - (point-min) - (point-max) - "astyle --style=kr" - nil - t) - (goto-line saved-line-number))) -``` - -Then I bind `astyle-buffer` to some key combination and invoke it -periodically to reformat the whole current buffer. diff --git a/.emacs.rc/rc.el b/.emacs.rc/rc.el new file mode 100644 index 0000000..c57f380 --- /dev/null +++ b/.emacs.rc/rc.el @@ -0,0 +1,34 @@ +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/") t) +;; (add-to-list 'package-archives +;; '("melpa-stable" . "https://stable.melpa.org/packages/") t) + +(defvar rc/package-contents-refreshed nil) + +(defun rc/package-refresh-contents-once () + (when (not rc/package-contents-refreshed) + (setq rc/package-contents-refreshed t) + (package-refresh-contents))) + +(defun rc/require-one-package (package) + (when (not (package-installed-p package)) + (rc/package-refresh-contents-once) + (package-install package))) + +(defun rc/require (&rest packages) + (dolist (package packages) + (rc/require-one-package package))) + +(defun rc/require-theme (theme) + (let ((theme-package (->> theme + (symbol-name) + (funcall (-flip #'concat) "-theme") + (intern)))) + (rc/require theme-package) + (load-theme theme t))) + +(rc/require 'dash) +(require 'dash) + +(rc/require 'dash-functional) +(require 'dash-functional) |
