Created
          July 17, 2023 00:49 
        
      - 
      
 - 
        
Save pce1991/faf6b23e5852c62adf721fa6410079b9 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (require 'misc) | |
| (setq user-full-name "Patrick Collin Eye") | |
| (set-frame-parameter nil 'fullscreen 'fullboth) | |
| (add-to-list 'default-frame-alist '(fullscreen . maximized)) | |
| (setq backup-directory-alist | |
| `((".*" . ,temporary-file-directory))) | |
| (setq auto-save-file-name-transforms | |
| `((".*" ,temporary-file-directory t))) | |
| (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) | |
| (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) | |
| (if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) | |
| (setq inhibit-startup-message t) | |
| (setq column-number-mode t) | |
| (setq inhibit-splash-screen t | |
| initial-scratch-message nil | |
| initial-major-mode 'org-mode) | |
| (delete-selection-mode t) | |
| (transient-mark-mode t) | |
| (setq x-select-enable-clipboard t) | |
| (if (eq (length (window-list)) 1) | |
| (progn | |
| (split-window-right) | |
| (balance-windows))) | |
| (require 'cl) | |
| (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
| ("marmalade" . "https://marmalade-repo.org/packages/") | |
| ("melpa" . "http://melpa.milkbox.net/packages/"))) | |
| (load "package") | |
| (package-initialize) | |
| (setq-default indent-tabs-mode nil) | |
| (setq sentence-end-double-space nil) | |
| ;; (setq electric-pair-pairs '( | |
| ;; (?\" . ?\") | |
| ;; (?\{ . ?\}) | |
| ;; )) | |
| (blink-cursor-mode 0) | |
| (setq redisplay-dont-pause t) | |
| (global-auto-revert-mode 1) | |
| (defun set-window-undedicated-p (window flag) | |
| "Never set window dedicated." | |
| flag) | |
| (advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p) | |
| (defadvice pop-to-buffer (before cancel-other-window first) | |
| (ad-set-arg 1 nil)) | |
| (ad-activate 'pop-to-buffer) | |
| ;; Toggle window dedication | |
| (defun toggle-window-dedicated () | |
| "Toggle whether the current active window is dedicated or not" | |
| (interactive) | |
| (message | |
| (if (let (window (get-buffer-window (current-buffer))) | |
| (set-window-dedicated-p window | |
| (not (window-dedicated-p window)))) | |
| "Window '%s' is dedicated" | |
| "Window '%s' is normal") | |
| (current-buffer))) | |
| (global-hl-line-mode t) | |
| (defvar my-cpp-other-file-alist | |
| '(("\\.cpp\\'" (".h")) | |
| ("\\.c\\'" (".h")) | |
| ("\\.h\\'" (".c" ".cpp")) | |
| ("\\.vert\\'" (".frag")) | |
| ("\\.frag\\'" (".vert")) | |
| )) | |
| (setq-default ff-other-file-alist 'my-cpp-other-file-alist) | |
| (add-hook 'c-initialization-hook (lambda () | |
| (define-key c-mode-base-map [(meta o)] 'ff-get-other-file))) | |
| ;;(add-hook 'c-mode-hook 'electric-pair-mode) | |
| (add-hook 'c-mode-hook 'hs-minor-mode) | |
| ;;(add-hook 'c++-mode-hook 'electric-pair-mode) | |
| (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.vert\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.frag\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.geom\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.glsl\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.hlsl\\'" . c++-mode)) | |
| (add-to-list 'auto-mode-alist '("\\.changes_music\\'" . lisp-mode)) | |
| (defun is-letter(c) | |
| (if (or (and (>= c 65) (<= c 90)) (and (>= c 97) (<= c 122))) | |
| t | |
| f)) | |
| (defun is-numeral(c) | |
| (if (and (>= c 48) (<= c 57)) | |
| t | |
| f)) | |
| (which-function-mode t) | |
| (defvar eye/packages '( | |
| ;;ace-window | |
| ;;avy | |
| ;; csharp-mode | |
| ivy | |
| org | |
| ;;company | |
| ;;swiper | |
| ) | |
| "Default packages") | |
| (defun eye/packages-installed-p () | |
| (loop for pkg in eye/packages | |
| when (not (package-installed-p pkg)) do (return nil) | |
| finally (return t))) | |
| (unless (eye/packages-installed-p) | |
| (message "%s" "Refreshing package database...") | |
| (package-refresh-contents) | |
| (dolist (pkg eye/packages) | |
| (when (not (package-installed-p pkg)) | |
| (package-install pkg)))) | |
| (set-language-environment "UTF-8") | |
| (show-paren-mode 1) | |
| (setq show-paren-delay 0) | |
| (global-linum-mode 1) | |
| ;(add-hook 'prog-mode-hook 'subword-mode) | |
| (global-subword-mode 1) | |
| ;;(global-subword-mode 1) | |
| (add-hook 'comint-output-filter-functions | |
| 'comint-watch-for-password-prompt) | |
| (put 'erase-buffer 'disabled nil) | |
| (defalias 'yes-or-no-p 'y-or-n-p) | |
| (setq-default mode-line-format '("%e" mode-line-front-space | |
| ;; Standard info about the current buffer | |
| mode-line-frame-identification | |
| mode-line-buffer-identification " " mode-line-position | |
| " " | |
| mode-line-misc-info | |
| ;; And the modes, which I don't really care for anyway | |
| " " mode-line-modes mode-line-end-spaces)) | |
| (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. | |
| '(global-linum-mode t) | |
| '(linum-delay t) | |
| '(linum-eager nil) | |
| '(package-selected-packages (quote (swiper ivy ace-window))) | |
| '(windmove-wrap-around t)) | |
| (require 'linum) | |
| (defcustom linum-disabled-modes-list '(eshell-mode erc-mode org-mode wl-summary-mode compilation-mode text-mode dired-mode twittering-mode) | |
| "* List of modes disabled when global linum mode is on" | |
| :type '(repeat (sexp :tag "Major mode")) | |
| :tag " Major modes where linum is disabled: " | |
| :group 'linum) | |
| (defcustom linum-disable-starred-buffers 't | |
| "* Disable buffers that have stars in them like *Gnu Emacs*" | |
| :type 'boolean | |
| :group 'linum) | |
| (defun linum-on () | |
| "* When linum is running globally, disable line number in modes defined in `linum-disabled-modes-list'. Changed by linum-off. Also turns off numbering in starred modes like *scratch*" | |
| (unless (or (minibufferp) (member major-mode linum-disabled-modes-list) | |
| (string-match "*" (buffer-name))) | |
| (linum-mode 1))) | |
| (provide 'linum-off) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;C STUFF | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (setq-default c-basic-offset 4) | |
| ;indent switch statements | |
| (add-hook 'c-mode-common-hook | |
| (lambda () (c-set-offset 'case-label '+))) | |
| ;; this is much more straightforward than the old system. | |
| (defvar pce-project-run-fn nil) | |
| (defvar pce-project-directory nil) | |
| (defvar pce-project-compile-fn nil) | |
| (defvar corsair-run-fn nil) | |
| (defvar corsair-directory nil) | |
| (defvar corsair-compile-fn nil) | |
| (defvar written-war-run-fn nil) | |
| (defvar written-war-directory nil) | |
| (defvar written-war-compile-fn nil) | |
| (defvar project-etcetera t) | |
| (defvar project-corsair t) | |
| (defvar project-written-war t) | |
| (defun pce-define-project (directory compile-fn run-fn) | |
| (message directory) | |
| (setq pce-project-directory directory) | |
| (setq pce-project-run-fn run-fn) | |
| (setq pce-project-compile-fn compile-fn) | |
| (message pce-project-directory) | |
| ;;(dir-locals-set-directory-class directory name) | |
| ) | |
| (defvar project-dir nil) | |
| (defvar project-compile nil) | |
| (defvar project-run nil) | |
| (defun pce-compile-project3 () | |
| (interactive) | |
| (if (get-buffer "*compilation*") | |
| (kill-buffer "*compilation*")) | |
| (if (and project-dir project-compile) | |
| (let ((working-directory default-directory) | |
| (prev-compile-command compile-command)) | |
| (cd project-dir) | |
| (setq compilation-read-command nil) | |
| (setq compile-command (funcall project-compile project-dir)) | |
| (call-interactively 'compile) | |
| (setq compile-command prev-compile-command) | |
| (cd working-directory))) | |
| ) | |
| (defun set-corsair () | |
| (interactive) | |
| (cd corsair-directory) | |
| (setq project-etcetera nil) | |
| (setq project-corsair t) | |
| (setq project-dir corsair-directory) | |
| (setq project-compile corsair-compile-fn) | |
| (setq project-run corsair-run-fn) | |
| ) | |
| (defun set-etcetera () | |
| (interactive) | |
| (cd pce-project-directory) | |
| (setq project-etcetera t) | |
| (setq project-corsair nil) | |
| (setq project-dir pce-project-directory) | |
| (setq project-compile pce-project-compile-fn) | |
| (setq project-run pce-project-run-fn) | |
| ) | |
| (defun set-written-war () | |
| (interactive) | |
| (cd written-war-directory) | |
| (setq project-etcetera nil) | |
| (setq project-corsair nil) | |
| (setq project-written-war t) | |
| (setq project-dir written-war-directory) | |
| (setq project-compile written-war-compile-fn) | |
| (setq project-run written-war-run-fn) | |
| ) | |
| (defun set-spanish () | |
| (interactive) | |
| (cd spanish-directory) | |
| (setq project-etcetera nil) | |
| (setq project-corsair nil) | |
| (setq project-spanish t) | |
| (setq project-dir spanish-directory) | |
| (setq project-compile spanish-compile-fn) | |
| (setq project-run spanish-run-fn) | |
| ) | |
| (defun set-aof () | |
| (interactive) | |
| (cd aof-directory) | |
| (setq project-etcetera nil) | |
| (setq project-corsair nil) | |
| (setq project-aof t) | |
| (setq project-dir aof-directory) | |
| (setq project-compile aof-compile-fn) | |
| (setq project-run aof-run-fn) | |
| ) | |
| (defun pce-compile-project () | |
| (interactive) | |
| (if (get-buffer "*compilation*") | |
| (kill-buffer "*compilation*")) | |
| (if (and pce-project-directory pce-project-compile-fn) | |
| (let ((working-directory default-directory) | |
| (prev-compile-command compile-command)) | |
| (cd pce-project-directory) | |
| (setq compilation-read-command nil) | |
| (setq compile-command (funcall pce-project-compile-fn pce-project-directory)) | |
| (call-interactively 'compile) | |
| (setq compile-command prev-compile-command) | |
| (cd working-directory)))) | |
| (defun pce-run-project () | |
| (interactive) | |
| (funcall project-run project-dir nil)) | |
| (defun pce-run-project-debug () | |
| (interactive) | |
| (if pce-project-run-fn | |
| (funcall run dir t))) | |
| (setq compilation-skip-threshold 2) | |
| ;ORG MODE | |
| (require 'org) | |
| (setq org-log-done t) | |
| (setq org-startup-truncated nil) | |
| (add-hook 'org-mode-hook (lambda () (visual-line-mode 1) (line-move-visual 1))) | |
| (setq create-lockfiles nil) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;BINDINGS BINDINGS BINDINGS BIDINGS | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;(define-key key-translation-map [?\C-h] [?\C-?]) | |
| ;;(global-set-key [(hyper h)] 'help-command) | |
| (defun beginning-of-line-custom () | |
| (interactive) | |
| (let ((oldpos (point))) | |
| (back-to-indentation) | |
| (and (= oldpos (point)) | |
| (beginning-of-line)))) | |
| (defun isearch-yank-regexp (regexp) | |
| "Pull REGEXP into search regexp." | |
| (let ((isearch-regexp nil)) ;; Dynamic binding of global. | |
| (isearch-yank-string regexp)) | |
| (isearch-search-and-update)) | |
| (defun project-grep () | |
| (interactive) | |
| (let ((working-directory default-directory)) | |
| (cd pce-project-directory) | |
| (call-interactively 'grep-find) | |
| (cd working-directory))) | |
| (defun date () | |
| (interactive) | |
| (format-time-string "%d.%m.%Y")) | |
| (defun timestamp () | |
| (interactive) | |
| (format-time-string "%Y-%m-%dT%H:%M:%S")) | |
| (defun pce-todo () | |
| (interactive) | |
| (insert (concat "@pce: "))) | |
| ;; customize for C | |
| (setq punctuation '("(" ")" | |
| "{" "}" | |
| "[" "]" | |
| "," | |
| "." | |
| "!" | |
| "->" | |
| "&&" | |
| "||" | |
| "&" | |
| "*" | |
| )) | |
| (defun forward-punct () | |
| (interactive) | |
| (search-forward-regexp punctuation-regex)) | |
| (defun backward-punct () | |
| (interactive) | |
| (search-backward-regexp punctuation-regex)) | |
| (defun next-punct () | |
| (interactive) | |
| (forward-punct) | |
| (forward-punct) | |
| (backward-punct)) | |
| (defun previous-punct () | |
| (interactive) | |
| (backward-punct) | |
| (backward-punct) | |
| (forward-punct)) | |
| (defun jump-to-next-brace () | |
| (interactive) | |
| (avy-goto-char-in-line ?\{) | |
| ) | |
| ;; BUG: doesnt handle whitespaces well | |
| (defun align-whitespace (start end) | |
| "Align columns by whitespace" | |
| (interactive "r") | |
| (align-regexp start end | |
| "\\(\\s-*\\)\\s-" 1 0 t)) | |
| (defun my-foward-list () | |
| (interactive) | |
| ;; if we're on a brace go fowards | |
| ;; (if (eq ?{ (char-after)) | |
| ;; (foward-sexp)) | |
| ;; else | |
| ) | |
| (setq punctuation-regex (regexp-opt punctuation)) | |
| (defun backward-whitespace (arg) | |
| "Move point to the beginning of the current sequence of whitespace characters." | |
| (interactive "^p") | |
| (forward-whitespace (- arg))) | |
| (defvar my-keys-minor-mode-map | |
| (let ((map (make-sparse-keymap))) | |
| ;; RIGHT HAND | |
| ;; TOP | |
| (define-key map (kbd "C-x C-u") 'ff-find-other-file) | |
| (define-key map (kbd "C-f") 'goto-line) | |
| (define-key map (kbd "M-f") 'project-grep) | |
| (define-key map (kbd "M-g") 'avy-goto-line) | |
| (define-key map (kbd "M-c") 'capitalize-backwards) | |
| (define-key map (kbd "C-o") 'repeat) | |
| (define-key map (kbd "M-o") 'replace-string) | |
| (define-key map (kbd "M-O") 'query-replace) | |
| ;; MID | |
| (define-key map (kbd "C-;") 'forward-char) | |
| (define-key map (kbd "M-;") 'forward-word) | |
| (define-key map (kbd "C-S-h") 'backward-whitespace) | |
| (define-key map (kbd "C-S-s") 'forward-whitespace) | |
| (define-key map (kbd "M-q") 'fill-paragraph) | |
| (define-key map (kbd "C-l") 'next-line) | |
| (define-key map (kbd "M-l") 'forward-paragraph) | |
| ;;(define-key map (kbd "C-M-n") 'gud-next) | |
| (define-key map (kbd "C-x C-l") 'next-error) | |
| (define-key map (kbd "C-k") 'previous-line) | |
| (define-key map (kbd "M-k") 'backward-paragraph) | |
| (define-key map (kbd "C-x C-k") 'previous-error) | |
| (define-key map (kbd "C-j") 'backward-char) | |
| (define-key map (kbd "M-j") 'backward-word) | |
| ;;BOTTOM | |
| (define-key map (kbd "C-b") 'switch-to-buffer) | |
| ;; THUMB | |
| (keyboard-translate ?\C-m ?\H-m) | |
| (define-key map [?\H-m] 'comment-region) | |
| (define-key map (kbd "M-m") 'uncomment-region) | |
| (define-key map (kbd "C-<return>") 'switch-to-buffer) | |
| ;; LEFT HAND | |
| ;; TOP | |
| (define-key map (kbd "C-r") 'other-window) | |
| (define-key map (kbd "C-t") 'yank) | |
| (define-key map (kbd "C-u") 'goto-line) | |
| ;; MID | |
| (define-key map (kbd "C-a") 'beginning-of-line-custom) | |
| (define-key map (kbd "C-<") 'beginning-of-buffer) | |
| (define-key map (kbd "C->") 'end-of-buffer) | |
| (define-key map (kbd "M-s") nil) | |
| (define-key map (kbd "C-s") 'isearch-backward) | |
| (define-key map (kbd "C-M-s") 'swiper) | |
| (define-key isearch-mode-map "\C-s" 'isearch-repeat-backward) | |
| ;;(define-key map (kbd "C-e") 'avy-goto-char-2-below) | |
| (define-key map (kbd "M-d") nil) | |
| (define-key map (kbd "C-d") 'isearch-forward) | |
| (define-key map (kbd "C-M-e") 'swiper) | |
| (define-key isearch-mode-map "\C-d" 'isearch-repeat-forward) | |
| (define-key map (kbd "C-f") 'end-of-line) | |
| ;;(define-key map (kbd "M-u") 'forward-sentence) ;; gets rebound to c-end-of-statement after c-mode activated | |
| (define-key map (kbd "C-M-f") 'end-of-defun) | |
| (define-key map (kbd "C-M-a") 'beginning-of-defun) | |
| (define-key map (kbd "M-a") 'backward-up-list) | |
| (define-key map (kbd "M-f") 'my-foward-list) | |
| (keyboard-translate ?\C-i ?\H-i) | |
| (global-set-key [?\H-i] 'universal-argument) | |
| ;; BOTTOM | |
| (define-key map (kbd "M-c") 'kill-line) | |
| (define-key map (kbd "C-c") 'kill-line) | |
| (define-key map (kbd "C-n") 'forward-sexp) | |
| (define-key map (kbd "M-n") 'backward-sexp) | |
| (define-key map (kbd "C-z") 'undo) | |
| (define-key map (kbd "C-x C-z") 'undo) | |
| (define-key map (kbd "M-RET") 'indent-new-comment-line) | |
| ;; need all and previous... | |
| ;; how often do I need to do this instead of just string replace? | |
| (define-key map (kbd "M-SPC") 'mark-next-like-this) | |
| map) | |
| "my-keys-minor-mode keymap.") | |
| (global-set-key [(control l)] 'next-line) | |
| (global-set-key [(control k)] 'previous-line) | |
| (global-set-key [(control \;)] 'forward-char) | |
| (global-set-key [(control j)] 'backward-char) | |
| (define-minor-mode my-keys-minor-mode | |
| "A minor mode so that my key settings override annoying major modes." | |
| :global t | |
| :init-value nil | |
| :lighter "my-keys" | |
| ) | |
| ;; I want a minor mode to have different bindings depending on the major-mode | |
| (defun my-c-mode-hook () | |
| (let ((oldmap (cdr (assoc 'my-keys minor-mode-map-alist))) | |
| (newmap (make-sparse-keymap))) | |
| (set-keymap-parent newmap oldmap) | |
| (set-syntax-table c-mode-syntax-table) | |
| (make-local-variable 'minor-mode-overriding-map-alist) | |
| (line-move-visual 1) | |
| (push `(my-keys . ,newmap) minor-mode-overriding-map-alist))) | |
| (add-hook 'c-mode-common-hook 'my-c-mode-hook) | |
| (add-hook 'minibuffer-setup-hook | |
| (lambda () (my-keys-minor-mode -1) | |
| (define-key ivy-minibuffer-map (kbd "C-t") 'ivy-previous-line) | |
| (define-key ivy-minibuffer-map (kbd "M-o") 'swiper-avy) | |
| (define-key ivy-minibuffer-map (kbd "M-e") 'swiper-avy) | |
| (define-key ivy-minibuffer-map (kbd "TAB") 'ivy-alt-done))) | |
| (add-hook 'minibuffer-exit-hook (lambda () (my-keys-minor-mode 1))) | |
| (ivy-mode 1) | |
| (defun c-bindings () | |
| ;;(define-key my-keys-minor-mode-map (kbd "M-u") 'c-end-of-statement) | |
| ) | |
| (my-keys-minor-mode 1) | |
| (add-hook 'c-mode-common-hook 'c-bindings) | |
| (global-set-key (kbd "M-q") (fill-paragraph)) | |
| (setq-default fill-column 90) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;LISP STUFF | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (defun uncomment-sexp (&optional n) | |
| "Uncomment a sexp around point." | |
| (interactive "P") | |
| (let* ((initial-point (point-marker)) | |
| (p) | |
| (end (save-excursion | |
| (when (elt (syntax-ppss) 4) | |
| (re-search-backward comment-start-skip | |
| (line-beginning-position) | |
| t)) | |
| (setq p (point-marker)) | |
| (comment-forward (point-max)) | |
| (point-marker))) | |
| (beg (save-excursion | |
| (forward-line 0) | |
| (while (= end (save-excursion | |
| (comment-forward (point-max)) | |
| (point))) | |
| (forward-line -1)) | |
| (goto-char (line-end-position)) | |
| (re-search-backward comment-start-skip | |
| (line-beginning-position) | |
| t) | |
| (while (looking-at-p comment-start-skip) | |
| (forward-char -1)) | |
| (point-marker)))) | |
| (unless (= beg end) | |
| (uncomment-region beg end) | |
| (goto-char p) | |
| ;; Indentify the "top-level" sexp inside the comment. | |
| (while (and (ignore-errors (backward-up-list) t) | |
| (>= (point) beg)) | |
| (skip-chars-backward (rx (syntax expression-prefix))) | |
| (setq p (point-marker))) | |
| ;; Re-comment everything before it. | |
| (ignore-errors | |
| (comment-region beg p)) | |
| ;; And everything after it. | |
| (goto-char p) | |
| (forward-sexp (or n 1)) | |
| (skip-chars-forward "\r\n[:blank:]") | |
| (if (< (point) end) | |
| (ignore-errors | |
| (comment-region (point) end)) | |
| ;; If this is a closing delimiter, pull it up. | |
| (goto-char end) | |
| (skip-chars-forward "\r\n[:blank:]") | |
| (when (= 5 (car (syntax-after (point)))) | |
| (delete-indentation)))) | |
| ;; Without a prefix, it's more useful to leave point where | |
| ;; it was. | |
| (unless n | |
| (goto-char initial-point)))) | |
| (defun comment-sexp--raw () | |
| "Comment the sexp at point or ahead of point." | |
| (pcase (or (bounds-of-thing-at-point 'sexp) | |
| (save-excursion | |
| (skip-chars-forward "\r\n[:blank:]") | |
| (bounds-of-thing-at-point 'sexp))) | |
| (`(,l . ,r) | |
| (goto-char r) | |
| (skip-chars-forward "\r\n[:blank:]") | |
| (save-excursion | |
| (comment-region l r)) | |
| (skip-chars-forward "\r\n[:blank:]")))) | |
| (defun comment-or-uncomment-sexp (&optional n) | |
| "Comment the sexp at point and move past it. | |
| If already inside (or before) a comment, uncomment instead. | |
| With a prefix argument N, (un)comment that many sexps." | |
| (interactive "P") | |
| (if (or (elt (syntax-ppss) 4) | |
| (< (save-excursion | |
| (skip-chars-forward "\r\n[:blank:]") | |
| (point)) | |
| (save-excursion | |
| (comment-forward 1) | |
| (point)))) | |
| (uncomment-sexp n) | |
| (dotimes (_ (or n 1)) | |
| (comment-sexp--raw)))) | |
| (global-set-key (kbd "C-;") #'comment-or-uncomment-sexp) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; OS SPECIFIC | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (defun pce-compile-etcetera-linux (directory) | |
| (concat "time python2 " directory "/build.py")) | |
| (defun pce-run-etcetera-linux (directory debug) | |
| (let ((exec-relative-path "build/etcetera_linux")) | |
| (if debug | |
| (progn | |
| (gdb (concat "gdb --quiet -i=mi -cd ~/etcetera " "./build/etcetera_linux"))) | |
| (progn | |
| (async-shell-command "~/etcetera/build/etcetera_linux"))))) | |
| (defun pce-compile-etcetera-windows (directory) | |
| (concat "Call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64 & python " directory "\\build.py game")) | |
| (defun pce-compile-full-etcetera-windows (directory) | |
| (concat "Call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" x64 & python " directory "\\build.py game")) | |
| (defun pce-run-etcetera-windows (directory debug) | |
| (let ((exec-relative-path "build/etcetera_win")) | |
| (async-shell-command (concat directory "\\build\\etcetera_win.exe")))) | |
| ;; (defun pce-run-etcetera-windows (directory debug) | |
| ;; (let ((exec-relative-path "build/etcetera_win")) | |
| ;; (async-shell-command "C:\\Users\\pce\\etal\\etcetera\\build\\etcetera_win"))) | |
| ;; (custom-set-faces | |
| ;; '(default ((t (:background "Black" :foreground "#97db93" :weight | |
| ;; normal :height 100 :width normal)))) | |
| ;; '(error ((t (:foreground "Red" :weight bold)))) | |
| ;; '(font-lock-builtin-face ((t (:foreground "#bf55ff")))) | |
| ;; '(font-lock-comment-face ((t (:foreground "gray50")))) | |
| ;; '(font-lock-constant-face ((t (:foreground "#70fff8")))) | |
| ;; '(font-lock-function-name-face ((t (:foreground "#00a0ff")))) | |
| ;; '(font-lock-keyword-face ((t (:foreground "#BB83D1")))) | |
| ;; '(font-lock-negation-char-face ((t (:foreground "#ff0923")))) | |
| ;; '(font-lock-string-face ((t (:foreground "White")))) | |
| ;; '(font-lock-type-face ((t (:foreground "#5992CD")))) | |
| ;; '(font-lock-variable-name-face ((t (:foreground "#FCFF79")))) | |
| ;; '(font-lock-which-func-face ((t (:foreground "Yellow")))) | |
| ;; '(highlight ((t (:background "gray20")))) | |
| ;; '(region ((t (:background "gray40")))) | |
| ;; '(which-func ((t (:foreground "#0000FF"))))) | |
| (custom-set-faces | |
| ;; custom-set-faces 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. | |
| '(default ((t (:background "#1a1a26" :foreground "#89C2DD" :weight normal :height 140 :width normal)))) | |
| '(error ((t (:foreground "#ff3030" :weight bold)))) | |
| '(font-lock-builtin-face ((t (:foreground "#97ff93")))) | |
| '(font-lock-comment-face ((t (:foreground "gray50")))) | |
| '(font-lock-constant-face ((t (:foreground "#97ff93")))) | |
| '(font-lock-function-name-face ((t (:foreground "#00a0ff")))) | |
| '(font-lock-keyword-face ((t (:foreground "#cca9ff")))) | |
| '(font-lock-negation-char-face ((t (:foreground "#ff3030")))) | |
| '(font-lock-string-face ((t (:foreground "White")))) | |
| '(font-lock-type-face ((t (:foreground "#fcdf28")))) | |
| '(font-lock-variable-name-face ((t (:foreground "#fbf079")))) | |
| '(font-lock-which-func-face ((t (:foreground "Yellow")))) | |
| '(highlight ((t (:background "gray20")))) | |
| '(region ((t (:background "gray40")))) | |
| '(which-func ((t (:foreground "#0000FF"))))) | |
| ;; Sunset | |
| ;; (custom-set-faces | |
| ;; '(default ((t (:background "#1a1a1a" :foreground "#fbf0c9" :weight | |
| ;; normal :height 100 :width normal)))) | |
| ;; '(error ((t (:foreground "#ff3030" :weight bold)))) | |
| ;; '(font-lock-builtin-face ((t (:foreground "#97ff93")))) | |
| ;; '(font-lock-comment-face ((t (:foreground "gray50")))) | |
| ;; '(font-lock-negation-char-face ((t (:foreground "#ff3030")))) | |
| ;; '(font-lock-string-face ((t (:foreground "White")))) | |
| ;; ;; if/for/switch statements | |
| ;; '(font-lock-keyword-face ((t (:foreground "#ffa070")))) | |
| ;; '(font-lock-function-name-face ((t (:foreground "#fcdf28")))) | |
| ;; '(font-lock-type-face ((t (:foreground "#ff7665")))) | |
| ;; '(font-lock-variable-name-face ((t (:foreground "#ffd265")))) | |
| ;; '(font-lock-which-func-face ((t (:foreground "Yellow")))) | |
| ;; '(highlight ((t (:background "gray20")))) | |
| ;; '(region ((t (:background "gray40")))) | |
| ;; '(which-func ((t (:foreground "#0000FF"))))) | |
| (cond ((eq system-type 'gnu/linux) | |
| (set-face-attribute 'default nil :family "Meslo LG S" :height 100) | |
| (global-set-key (kbd "C-x m") 'pce-compile-project) | |
| (global-set-key (kbd "C-x C-r") 'pce-run-project-debug) | |
| (pce-define-project 'etcetera "~/etcetera" 'pce-compile-etcetera-linux 'pce-run-etcetera-linux) | |
| (cd "~/")) | |
| ((eq system-type 'windows-nt) | |
| (setq ring-bell-function 'ignore) | |
| (set-face-attribute 'default | |
| nil :family "Consolas" :height 120) | |
| ;;(set-face-attribute 'default nil :family "Inconsolata" :height 120) | |
| ;;(global-set-key (kbd "C-x m") 'pce-compile-project) | |
| (global-set-key (kbd "C-x m") 'pce-compile-project3) | |
| (global-set-key (kbd "C-x C-r") 'pce-run-project) | |
| ;;(pce-define-project "C:\\Users\\pce\\etal\\etcetera" 'pce-compile-etcetera-windows 'pce-run-etcetera-windows) | |
| ;;(pce-define-project "C:\\Users\\pce\\etal\\etcetera" 'pce-compile-etcetera-windows 'pce-run-etcetera-windows) | |
| (setq pce-project-directory "C:\\Users\\pce\\etal\\etcetera") | |
| (setq pce-project-compile-fn 'pce-compile-etcetera-windows) | |
| (setq pce-project-run-fn 'pce-run-etcetera-windows) | |
| (setq corsair-directory "C:\\Users\\pce\\Projects\\corsair\\game") | |
| (setq corsair-compile-fn 'pce-compile-etcetera-windows) | |
| (setq corsair-run-fn 'pce-run-etcetera-windows) | |
| (setq written-war-directory "C:\\Users\\pce\\Projects\\written_war\\etcetera") | |
| (setq written-war-compile-fn 'pce-compile-etcetera-windows) | |
| (setq written-war-run-fn 'pce-run-etcetera-windows) | |
| (setq spanish-directory "C:\\Users\\pce\\Projects\\spanish\\etcetera") | |
| (setq spanish-compile-fn 'pce-compile-etcetera-windows) | |
| (setq spanish-run-fn 'pce-run-etcetera-windows) | |
| (setq aof-directory "C:\\Users\\pce\\Projects\\aof\\art_of_flight") | |
| (setq aof-compile-fn 'pce-compile-etcetera-windows) | |
| (setq aof-run-fn 'pce-run-etcetera-windows) | |
| ;;(setq spanish-compile-full-fn 'pce-compile-full-etcetera-windows) | |
| (set-written-war) | |
| ) | |
| ((eq system-type 'darwin) | |
| (set-face-attribute 'default nil :family "Menlo" :height 100) | |
| (cd "C:\\Users\\pce"))) | |
| (put 'upcase-region 'disabled nil) | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment