Add emacs config

This commit is contained in:
2025-02-01 22:54:28 -10:00
parent 920488b144
commit 6054636e05
6 changed files with 1192 additions and 1 deletions

View File

@@ -24,3 +24,6 @@ alias which-command=whence
alias copy="xclip -selection clipboard"
alias kdiff="kitten diff"
alias kssh="kitten ssh"
alias gf2="/usr/bin/gf2 &> /dev/null &"
alias qemu-monitor="telnet 127.0.0.1 7777"

426
.emacs Normal file
View File

@@ -0,0 +1,426 @@
(setq custom-file "~/.emacs.custom.el")
(package-initialize)
(add-to-list 'load-path "~/.emacs.local/")
(load "~/.emacs.rc/rc.el")
(load "~/.emacs.rc/misc-rc.el")
;;; Appearance
(add-to-list 'default-frame-alist `(font . "Iosevka-16"))
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
(column-number-mode 1)
(show-paren-mode 1)
(rc/require-theme 'gruber-darker)
;; (rc/require-theme 'zenburn)
;; (load-theme 'adwaita t)
(rc/require 'all-the-icons 'all-the-icons-dired)
(eval-after-load 'zenburn
(set-face-attribute 'line-number nil :inherit 'default))
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
(this-win-2nd (not (and (<= (car this-win-edges)
(car next-win-edges))
(<= (cadr this-win-edges)
(cadr next-win-edges)))))
(splitter
(if (= (car this-win-edges)
(car (window-edges (next-window))))
'split-window-horizontally
'split-window-vertically)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
(if this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
(if this-win-2nd (other-window 1))))))
(global-set-key (kbd "C-t") 'toggle-window-split)
;;; ido
(rc/require 'smex 'ido-completing-read+)
(require 'ido-completing-read+)
(ido-mode 1)
(ido-everywhere 1)
(ido-ubiquitous-mode 1)
(setq ido-auto-merge-work-directories-length -1)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(setq compile-command "")
;;; comment
(rc/require 'comment-dwim-2)
(global-set-key (kbd "C-;") 'comment-dwim-2)
;;; c-mode
(setq-default c-basic-offset 4
c-default-style '((java-mode . "java")
(awk-mode . "awk")
(other . "bsd")))
(add-hook 'c-mode-hook (lambda ()
(interactive)
(c-toggle-comment-style -1)))
;;; Paredit
(rc/require 'paredit)
(defun rc/turn-on-paredit ()
(interactive)
(paredit-mode 1))
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'clojure-mode-hook 'rc/turn-on-paredit)
(add-hook 'lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'common-lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'scheme-mode-hook 'rc/turn-on-paredit)
(add-hook 'racket-mode-hook 'rc/turn-on-paredit)
;;; Emacs lisp
(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(local-set-key (kbd "C-c C-j")
(quote eval-print-last-sexp))))
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
;;; uxntal-mode
(rc/require 'uxntal-mode)
;;; Haskell mode
(rc/require 'haskell-mode)
(setq haskell-process-type 'cabal-new-repl)
(setq haskell-process-log t)
(add-hook 'haskell-mode-hook 'haskell-indent-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
(add-hook 'haskell-mode-hook 'haskell-doc-mode)
(require 'fasm-mode)
(add-to-list 'auto-mode-alist '("\\.asm\\'" . fasm-mode))
(require 'simpc-mode)
;; (add-to-list 'auto-mode-alist '("\\.[hc]\\(pp\\)?\\'" . simpc-mode))
(setq path-to-ctags "/usr/bin/ctags")
(defun create-tags (dir-name)
"Create tags file."
(interactive "Directory: ")
(shell-command
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name)))
)
(global-set-key (kbd "M-;") 'xref-find-definitions)
;;; Whitespace mode
(defun rc/set-up-whitespace-handling ()
(interactive)
(whitespace-mode 0)
(add-to-list 'write-file-functions 'delete-trailing-whitespace))
(add-hook 'tuareg-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'c++-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'c-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'simpc-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'emacs-lisp-mode 'rc/set-up-whitespace-handling)
(add-hook 'java-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'lua-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'rust-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'scala-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'markdown-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'haskell-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'python-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'erlang-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'asm-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'fasm-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'go-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'nim-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'yaml-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'porth-mode-hook 'rc/set-up-whitespace-handling)
;;; display-line-numbers-mode
(when (version<= "26.0.50" emacs-version)
(global-display-line-numbers-mode))
(setq display-line-numbers-type 'relative)
;;; magit
;; magit requres this lib, but it is not installed automatically on
;; Windows.
(rc/require 'cl-lib)
(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)
;;; multiple cursors
(rc/require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C-S-n") 'mc/mark-next-like-this)
(global-set-key (kbd "C-S-p") 'mc/mark-previous-like-this)
;(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;(global-set-key (kbd "C-\"") 'mc/skip-to-next-like-this)
;(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
;;; markdown
(rc/require 'markdown-mode 'impatient-mode 'simple-httpd)
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
(setq markdown-command "pandoc -t html5")
(setq httpd-port 7070)
(setq httpd-host (system-name))
(defun github-markdown-filter (buffer)
(princ
(with-temp-buffer
(let ((tmp (buffer-name)))
(set-buffer buffer)
(set-buffer (markdown tmp))
(format "<!DOCTYPE html><html><title>Markdown preview</title><link rel=\"stylesheet\" href = \"https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css\"/>
<body><article class=\"markdown-body\" style=\"box-sizing: border-box;min-width: 200px;max-width: 980px;margin: 0 auto;padding: 45px;\">%s</article></body></html>" (buffer-string))))
(current-buffer)))
(defun github-markdown-preview ()
"Preview markdown with github style"
(interactive)
(unless (process-status "httpd")
(httpd-start))
(impatient-mode)
(imp-set-user-filter 'github-markdown-filter)
(imp-visit-buffer))
;;; dired
(require 'dired-x)
(setq dired-omit-files
(concat dired-omit-files "\\|^\\..+$"))
(setq-default dired-dwim-target t)
(setq dired-listing-switches "-alh")
(setq dired-mouse-drag-files t)
(global-set-key (kbd "C-d") 'dired)
;;; helmn
(rc/require 'helm)
(global-set-key (kbd "C-c h t") 'helm-cmd-t)
;;; yasnippet
(rc/require 'yasnippet)
(require 'yasnippet)
(setq yas/triggers-in-field nil)
(setq yas-snippet-dirs '("~/.emacs.snippets/"))
(yas-global-mode 1)
;;; word-wrap
(defun rc/enable-word-wrap ()
(interactive)
(toggle-word-wrap 1))
(add-hook 'markdown-mode-hook 'rc/enable-word-wrap)
;;; nxml
(add-to-list 'auto-mode-alist '("\\.html\\'" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.xsd\\'" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.ant\\'" . nxml-mode))
;;; Makefile
(add-to-list 'auto-mode-alist '("\\make.config\\'" . makefile-mode))
;;; tramp
;;; http://stackoverflow.com/questions/13794433/how-to-disable-autosave-for-tramp-buffers-in-emacs
(setq tramp-auto-save-directory "/tmp")
;;; powershell
(rc/require 'powershell)
(add-to-list 'auto-mode-alist '("\\.ps1\\'" . powershell-mode))
(add-to-list 'auto-mode-alist '("\\.psm1\\'" . powershell-mode))
;;; eldoc mode
(defun rc/turn-on-eldoc-mode ()
(interactive)
(eldoc-mode 1))
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-eldoc-mode)
;;; Company
(rc/require 'company)
(require 'company)
(global-company-mode)
;; (add-hook 'tuareg-mode-hook
;; (lambda ()
;; (interactive)
;; (company-mode 0)))
;;; Typescript
(rc/require 'typescript-mode)
(add-to-list 'auto-mode-alist '("\\.mts\\'" . typescript-mode))
;;; Tide
(rc/require 'tide)
(defun rc/turn-on-tide-and-flycheck () ;Flycheck is a dependency of tide
(interactive)
(tide-setup)
(flycheck-mode 1))
(add-hook 'typescript-mode-hook 'rc/turn-on-tide-and-flycheck)
;;; Proof general
(rc/require 'proof-general)
(add-hook 'coq-mode-hook
'(lambda ()
(local-set-key (kbd "C-c C-q C-n")
(quote proof-assert-until-point-interactive))))
;;; LaTeX mode
(add-hook 'tex-mode-hook
(lambda ()
(interactive)
(add-to-list 'tex-verbatim-environments "code")))
(setq font-latex-fontify-sectioning 'color)
;;; Move Text
(rc/require 'move-text)
(global-set-key (kbd "M-p") 'move-text-up)
(global-set-key (kbd "M-n") 'move-text-down)
;;; Ebisp
(add-to-list 'auto-mode-alist '("\\.ebi\\'" . lisp-mode))
;;; Go
(rc/require 'go-mode)
;(add-to-list 'compilation-error-regexp-alist 'gotest)
;(add-to-list 'compilation-error-regexp-alist-alist '(gotest "^ \\(\\([^:\n]+\\):\\([0-9]+\\)\\)" 2 3 nil nil 1))
;(add-to-list 'compilation-error-regexp-alist 'gotraceback)
;(add-to-list 'compilation-error-regexp-alist-alist '(gotraceback "^\t\\(\\([^\n\t]+\\):\\([0-9]+\\)\\)\\( \\+0x[0-9a-f]+\\)?$" 2 3 nil (nil . 4) 1))
;;; OCaml
(rc/require 'tuareg)
;;; ASM
(defun my-asm-mode-hook ()
(local-unset-key (vector asm-comment-char))
(setq tab-always-indent (default-value 'tab-always-indent))
(setq comment-start "//"))
(add-hook 'asm-mode-hook #'my-asm-mode-hook)
;;; Lsp-mode
(rc/require 'lsp-mode
'lsp-treemacs
'helm-lsp
'projectile
'hydra
'flycheck
'company
'avy
'which-key
'helm-xref)
(which-key-mode)
(setq lsp-keymap-prefix "s-i")
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(add-hook 'python-mode 'lsp)
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.5
company-minimum-prefix-length 1
lsp-idle-delay 0.1)
(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(yas-global-mode))
;;; Packages that don't require configuration
(rc/require
'scala-mode
'd-mode
'yaml-mode
'glsl-mode
'lua-mode
'less-css-mode
'graphviz-dot-mode
'clojure-mode
'cmake-mode
'rust-mode
'csharp-mode
'nim-mode
'jinja2-mode
'purescript-mode
'nix-mode
'dockerfile-mode
'toml-mode
'nginx-mode
'kotlin-mode
'php-mode
'racket-mode
'qml-mode
'ag
'elpy
'typescript-mode
'rfc-mode
'sml-mode
)
(defun astyle-buffer (&optional justify)
(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)))
(add-hook 'simpc-mode-hook
(lambda ()
(interactive)
(setq-local fill-paragraph-function 'astyle-buffer)))
(require 'compile)
;; pascalik.pas(24,44) Error: Can't evaluate constant expression
compilation-error-regexp-alist-alist
(add-to-list 'compilation-error-regexp-alist
'("\\([a-zA-Z0-9\\.]+\\)(\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?) \\(Warning:\\)?"
1 2 (4) (5)))
(load-file custom-file)

480
.emacs.local/fasm-mode.el Normal file
View File

@@ -0,0 +1,480 @@
;;; fasm-mode.el --- Fasm major mode
;; Author: Fanael Linithien <fanael4@gmail.com>
;; URL: https://github.com/Fanael/fasm-mode
;; Version: 0.1.8
;; This file is NOT part of GNU Emacs.
;; Copyright (c) 2013, Fanael Linithien
;; All rights reserved.
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;; * Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of the copyright holder(s) nor the names of any
;; contributors may be used to endorse or promote products derived from
;; this software without specific prior written permission.
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
;; IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
;; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
;; OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;; Code:
(defvar fasm-mode-syntax-table
(let ((syntaxtable (make-syntax-table)))
(modify-syntax-entry ?_ "_" syntaxtable)
(modify-syntax-entry ?. "_" syntaxtable)
(modify-syntax-entry ?$ "_" syntaxtable)
(modify-syntax-entry ?@ "_" syntaxtable)
(modify-syntax-entry ?~ "_" syntaxtable)
(modify-syntax-entry ?? "_" syntaxtable)
(modify-syntax-entry ?! "_" syntaxtable)
(modify-syntax-entry ?= "." syntaxtable)
(modify-syntax-entry ?+ "." syntaxtable)
(modify-syntax-entry ?- "." syntaxtable)
(modify-syntax-entry ?* "." syntaxtable)
(modify-syntax-entry ?/ "." syntaxtable)
(modify-syntax-entry ?\\ "." syntaxtable)
(modify-syntax-entry ?\; "<" syntaxtable)
(modify-syntax-entry ?\n ">" syntaxtable)
(modify-syntax-entry ?\" "\"" syntaxtable)
(modify-syntax-entry ?\' "\"" syntaxtable)
syntaxtable)
"Syntax table for FASM mode.")
(defvar fasm-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<return>") (lambda () (interactive) (insert ?\n)))
map)
"Local keymap for FASM mode.")
(defvar fasm-basic-offset 2
"Offset for FASM mode indentation.")
(eval-when-compile
(defun fasm--regexp-from-keywords (&rest keywords)
(regexp-opt keywords 'symbols)))
(defconst fasm-font-lock-keywords
`(;; Numbers
("\\_<[01]+b\\_>" . 'font-lock-constant-face)
("\\_<[0-9][0-9a-fA-F]*h\\_>" . 'font-lock-constant-face)
("\\_<\\(?:0x\\|\\$\\)[0-9a-fA-F]+\\_>" . 'font-lock-constant-face)
("\\_<[0-9]+\\(?:\\.[0-9]*\\)?\\(?:e[+-]?[0-9]+\\)?\\_>"
. 'font-lock-constant-face)
;; Types
(,(eval-when-compile
(fasm--regexp-from-keywords
"xx"
"xxxx"
"preserve"
"byte" "word" "dword" "fword" "pword" "qword" "tbyte" "tword"
"dqword" "xword" "qqword" "yword" "db" "rb" "dw" "du" "rw" "dd" "rd"
"df" "dp" "rf" "rp" "dq" "rq" "dt" "rt")) . 'font-lock-type-face)
;; Directives and operators
(,(eval-when-compile
(fasm--regexp-from-keywords
"labeling"
"mod" "rva" "plt" "align" "as" "at" "defined" "dup" "eq" "eqtype"
"from" "ptr" "relativeto" "used" "binary" "export" "fixups" "import"
"native" "static" "console" "dynamic" "efiboot" "linkinfo" "readable"
"resource" "writable" "shareable" "writeable" "efiruntime"
"executable" "linkremove" "discardable" "interpreter" "notpageable"
"if"
"end"
"tail_call"
"finish" ;; as end
"literal"
"address"
"branch"
"false?branch"
"err" "org" "data" "else" "heap" "load" "align" "break"
"entry" "extrn" "label" "stack" "store" "times" "while" "assert"
"format" "public" "repeat" "display" "section" "segment" "virtual"
"file")) . 'font-lock-keyword-face)
;; Preprocessor directives
(,(eval-when-compile
(fasm--regexp-from-keywords
"define" "include" "irp" "irps" "macro" "match" "purge" "rept"
"restore" "restruc" "struc" "common" "forward" "local" "reverse"
"equ" "fix")) . 'font-lock-preprocessor-face)
;; Registers
(,(eval-when-compile
(fasm--regexp-from-keywords
"al" "bl" "cl" "dl" "spl" "bpl" "sil" "dil" "r8b" "r9b" "r10b" "r11b"
"r12b" "r13b" "r14b" "r15b" "ah" "bh" "ch" "dh" "ax" "bx" "cx" "dx"
"sp" "bp" "si" "di" "r8w" "r9w" "r10w" "r11w" "r12w" "r13w" "r14w"
"r15w" "eax" "ebx" "ecx" "edx" "esp" "ebp" "esi" "edi" "r8d" "r9d"
"r10d" "r11d" "r12d" "r13d" "r14d" "r15d"
"rax" "rbx" "rcx" "rdx" "rsp" "rbp" "rsi" "rdi"
"r8" "r9" "r10" "r11" "r12" "r13" "r14" "r15"
;; "xax" "xbx" "xcx" "xdx" "xsp" "xbp" "xsi" "xdi"
;; "x8" "x9" "x10" "x11" "x12" "x13" "x14" "x15"
"rip" "es" "cs" "ss" "ds" "fs" "gs" "cr0" "cr2" "cr3" "cr4" "dr0"
"dr1" "dr2" "dr3" "st0" "st1" "st2" "st3" "st4" "st5" "st6" "st7"
"mm0" "mm1" "mm2" "mm3" "mm4" "mm5" "mm6" "mm7" "xmm0" "xmm1" "xmm2"
"xmm3" "xmm4" "xmm5" "xmm6" "xmm7" "xmm8" "xmm9" "xmm10" "xmm11"
"xmm12" "xmm13" "xmm14" "xmm15" "ymm0" "ymm1" "ymm2" "ymm3" "ymm4"
"ymm5" "ymm6" "ymm7" "ymm8" "ymm9" "ymm10" "ymm11" "ymm12" "ymm13"
"ymm14" "ymm15")) . 'font-lock-variable-name-face)
;; Instructions
(,(eval-when-compile
(fasm--regexp-from-keywords
"bt" "in" "ja" "jb" "jc" "je" "jg" "jl" "jo" "jp" "js" "jz" "or"
"aaa" "aad" "aam" "aas" "adc" "add" "and" "bsf" "bsr" "btc" "btr"
"bts" "cbw" "cdq" "clc" "cld" "cli" "cmc" "cmp" "cqo" "cwd" "daa"
"das" "dec" "div" "fld" "fst" "hlt" "inc" "ins" "int" "jae" "jbe"
"jge" "jle" "jmp" "jna" "jnb" "jnc" "jne" "jng" "jnl" "jno" "jnp"
"jns" "jnz" "jpe" "jpo" "lar" "lds" "lea" "les" "lfs" "lgs" "lsl"
"lss" "ltr" "mov" "mul" "neg" "nop" "not" "out" "pop" "por" "rcl"
"rcr" "rep" "ret" "rol" "ror" "rsm" "sal" "sar" "sbb" "shl" "shr"
"stc" "std" "sti" "str" "sub" "ud2" "xor" "adcx" "adox" "andn" "arpl"
"blci" "blcs" "blsi" "blsr" "bzhi" "call" "cdqe" "clac" "clgi" "clts"
"cmps" "cwde" "dppd" "dpps" "emms" "fabs" "fadd" "fbld" "fchs" "fcom"
"fcos" "fdiv" "feni" "fild" "fist" "fld1" "fldz" "fmul" "fnop" "fsin"
"fstp" "fsub" "ftst" "fxam" "fxch" "idiv" "imul" "insb" "insd" "insw"
"int1" "int3" "into" "invd" "iret" "jcxz" "jnae" "jnbe" "jnge" "jnle"
"lahf" "lgdt" "lidt" "lldt" "lmsw" "lock" "lods" "loop" "movd" "movq"
"movs" "mulx" "orpd" "orps" "outs" "pand" "pdep" "pext" "popa" "popd"
"popf" "popq" "popw" "push" "pxor" "repe" "repz" "retd" "retf" "retn"
"retq" "retw" "rorx" "sahf" "salc" "sarx" "scas" "seta" "setb" "setc"
"sete" "setg" "setl" "seto" "setp" "sets" "setz" "sgdt" "shld" "shlx"
"shrd" "shrx" "sidt" "sldt" "smsw" "stac" "stgi" "stos" "test" "verr"
"verw" "vpor" "wait" "xadd" "xchg" "xend" "xlat" "addpd" "addps"
"addsd" "addss" "andpd" "andps" "bextr" "blcic" "blsic" "bound"
"bswap" "cmova" "cmovb" "cmovc" "cmove" "cmovg" "cmovl" "cmovo"
"cmovp" "cmovs" "cmovz" "cmppd" "cmpps" "cmpsb" "cmpsd" "cmpsq"
"cmpss" "cmpsw" "cpuid" "crc32" "divpd" "divps" "divsd" "divss"
"enter" "extrq" "f2xm1" "faddp" "fbstp" "fclex" "fcomi" "fcomp"
"fdisi" "fdivp" "fdivr" "femms" "ffree" "fiadd" "ficom" "fidiv"
"fimul" "finit" "fistp" "fisub" "fldcw" "fldpi" "fmulp" "fneni"
"fprem" "fptan" "fsave" "fsqrt" "fstcw" "fstsw" "fsubp" "fsubr"
"fucom" "fwait" "fyl2x" "icebp" "iretd" "iretq" "iretw" "jecxz"
"jrcxz" "lddqu" "leave" "lodsb" "lodsd" "lodsq" "lodsw" "loopd"
"loope" "loopq" "loopw" "loopz" "lzcnt" "maxpd" "maxps" "maxsd"
"maxss" "minpd" "minps" "minsd" "minss" "movbe" "movsb" "movsd"
"movsq" "movss" "movsw" "movsx" "movzx" "mulpd" "mulps" "mulsd"
"mulss" "mwait" "outsb" "outsd" "outsw" "pabsb" "pabsd" "pabsw"
"paddb" "paddd" "paddq" "paddw" "pandn" "pause" "pavgb" "pavgw"
"pf2id" "pf2iw" "pfacc" "pfadd" "pfmax" "pfmin" "pfmul" "pfrcp"
"pfsub" "pi2fd" "pi2fw" "popad" "popaw" "popfd" "popfq" "popfw"
"pslld" "psllq" "psllw" "psrad" "psraw" "psrld" "psrlq" "psrlw"
"psubb" "psubd" "psubq" "psubw" "ptest" "pusha" "pushd" "pushf"
"pushq" "pushw" "rcpps" "rcpss" "rdmsr" "rdpmc" "rdtsc" "repne"
"repnz" "retfd" "retfq" "retfw" "retnd" "retnq" "retnw" "scasb"
"scasd" "scasq" "scasw" "setae" "setbe" "setge" "setle" "setna"
"setnb" "setnc" "setne" "setng" "setnl" "setno" "setnp" "setns"
"setnz" "setpe" "setpo" "stosb" "stosd" "stosq" "stosw" "subpd"
"subps" "subsd" "subss" "tzcnt" "tzmsk" "vdppd" "vdpps" "vmovd"
"vmovq" "vmrun" "vmxon" "vorpd" "vorps" "vpand" "vpxor" "wrmsr"
"xlatb" "xorpd" "xorps" "xsave" "xtest" "aesdec" "aesenc" "aesimc"
"andnpd" "andnps" "blcmsk" "blsmsk" "cmovae" "cmovbe" "cmovge"
"cmovle" "cmovna" "cmovnb" "cmovnc" "cmovne" "cmovng" "cmovnl"
"cmovno" "cmovnp" "cmovns" "cmovnz" "cmovpe" "cmovpo" "comisd"
"comiss" "fcmovb" "fcmove" "fcmovu" "fcomip" "fcompp" "fdivrp"
"ffreep" "ficomp" "fidivr" "fisttp" "fisubr" "fldenv" "fldl2e"
"fldl2t" "fldlg2" "fldln2" "fnclex" "fndisi" "fninit" "fnsave"
"fnstcw" "fnstsw" "fpatan" "fprem1" "frstor" "frstpm" "fsaved"
"fsavew" "fscale" "fsetpm" "fstenv" "fsubrp" "fucomi" "fucomp"
"fxsave" "getsec" "haddpd" "haddps" "hsubpd" "hsubps" "invept"
"invlpg" "lfence" "llwpcb" "looped" "loopeq" "loopew" "loopne"
"loopnz" "loopzd" "loopzq" "loopzw" "lwpins" "lwpval" "mfence"
"movapd" "movaps" "movdqa" "movdqu" "movhpd" "movhps" "movlpd"
"movlps" "movnti" "movntq" "movsxd" "movupd" "movups" "paddsb"
"paddsw" "pextrb" "pextrd" "pextrq" "pextrw" "pfnacc" "pfsubr"
"phaddd" "phaddw" "phsubd" "phsubw" "pinsrb" "pinsrd" "pinsrq"
"pinsrw" "pmaxsb" "pmaxsd" "pmaxsw" "pmaxub" "pmaxud" "pmaxuw"
"pminsb" "pminsd" "pminsw" "pminub" "pminud" "pminuw" "pmuldq"
"pmulhw" "pmulld" "pmullw" "popcnt" "psadbw" "pshufb" "pshufd"
"pshufw" "psignb" "psignd" "psignw" "pslldq" "psrldq" "psubsb"
"psubsw" "pswapd" "pushad" "pushaw" "pushfd" "pushfq" "pushfw"
"rdmsrq" "rdrand" "rdseed" "rdtscp" "setalc" "setnae" "setnbe"
"setnge" "setnle" "sfence" "shufpd" "shufps" "skinit" "slwpcb"
"sqrtpd" "sqrtps" "sqrtsd" "sqrtss" "swapgs" "sysret" "t1mskc"
"vaddpd" "vaddps" "vaddsd" "vaddss" "vandpd" "vandps" "vcmppd"
"vcmpps" "vcmpsd" "vcmpss" "vdivpd" "vdivps" "vdivsd" "vdivss"
"vlddqu" "vmaxpd" "vmaxps" "vmaxsd" "vmaxss" "vmcall" "vminpd"
"vminps" "vminsd" "vminss" "vmload" "vmovsd" "vmovss" "vmread"
"vmsave" "vmulpd" "vmulps" "vmulsd" "vmulss" "vmxoff" "vpabsb"
"vpabsd" "vpabsw" "vpaddb" "vpaddd" "vpaddq" "vpaddw" "vpandn"
"vpavgb" "vpavgw" "vpcmov" "vpcomb" "vpcomd" "vpcomq" "vpcomw"
"vpermd" "vpermq" "vpperm" "vprotb" "vprotd" "vprotq" "vprotw"
"vpshab" "vpshad" "vpshaq" "vpshaw" "vpshlb" "vpshld" "vpshlq"
"vpshlw" "vpslld" "vpsllq" "vpsllw" "vpsrad" "vpsraw" "vpsrld"
"vpsrlq" "vpsrlw" "vpsubb" "vpsubd" "vpsubq" "vpsubw" "vptest"
"vrcpps" "vrcpss" "vsubpd" "vsubps" "vsubsd" "vsubss" "vxorpd"
"vxorps" "wbinvd" "wrmsrq" "xabort" "xbegin" "xgetbv" "xrstor"
"xsetbv" "blcfill" "blendpd" "blendps" "blsfill" "clflush" "cmovnae"
"cmovnbe" "cmovnge" "cmovnle" "cmpeqpd" "cmpeqps" "cmpeqsd" "cmpeqss"
"cmplepd" "cmpleps" "cmplesd" "cmpless" "cmpltpd" "cmpltps" "cmpltsd"
"cmpltss" "cmpxchg" "fcmovbe" "fcmovnb" "fcmovne" "fcmovnu" "fdecstp"
"fincstp" "fldenvd" "fldenvw" "fnsaved" "fnsavew" "fnstenv" "frndint"
"frstord" "frstorw" "fsincos" "fstenvd" "fstenvw" "fucomip" "fucompp"
"fxrstor" "fxtract" "fyl2xp1" "insertq" "invlpga" "invpcid" "invvpid"
"ldmxcsr" "loopned" "loopneq" "loopnew" "loopnzd" "loopnzq" "loopnzw"
"monitor" "movddup" "movdq2q" "movhlps" "movlhps" "movntdq" "movntpd"
"movntps" "movntsd" "movntss" "movq2dq" "mpsadbw" "paddusb" "paddusw"
"palignr" "pavgusb" "pblendw" "pcmpeqb" "pcmpeqd" "pcmpeqq" "pcmpeqw"
"pcmpgtb" "pcmpgtd" "pcmpgtq" "pcmpgtw" "pfcmpeq" "pfcmpge" "pfcmpgt"
"pfpnacc" "pfrsqrt" "phaddsw" "phsubsw" "pmaddwd" "pmulhrw" "pmulhuw"
"pmuludq" "pshufhw" "pshuflw" "psubusb" "psubusw" "roundpd" "roundps"
"roundsd" "roundss" "rsqrtps" "rsqrtss" "stmxcsr" "syscall" "sysexit"
"sysretq" "ucomisd" "ucomiss" "vaesdec" "vaesenc" "vaesimc" "vandnpd"
"vandnps" "vcomisd" "vcomiss" "vfrczpd" "vfrczps" "vfrczsd" "vfrczss"
"vhaddpd" "vhaddps" "vhsubpd" "vhsubps" "vmclear" "vmmcall" "vmovapd"
"vmovaps" "vmovdqa" "vmovdqu" "vmovhpd" "vmovhps" "vmovlpd" "vmovlps"
"vmovupd" "vmovups" "vmptrld" "vmptrst" "vmwrite" "vpaddsb" "vpaddsw"
"vpcomub" "vpcomud" "vpcomuq" "vpcomuw" "vpermpd" "vpermps" "vpextrb"
"vpextrd" "vpextrq" "vpextrw" "vphaddd" "vphaddw" "vphsubd" "vphsubw"
"vpinsrb" "vpinsrd" "vpinsrq" "vpinsrw" "vpmaxsb" "vpmaxsd" "vpmaxsw"
"vpmaxub" "vpmaxud" "vpmaxuw" "vpminsb" "vpminsd" "vpminsw" "vpminub"
"vpminud" "vpminuw" "vpmuldq" "vpmulhw" "vpmulld" "vpmullw" "vpsadbw"
"vpshufb" "vpshufd" "vpsignb" "vpsignd" "vpsignw" "vpslldq" "vpsllvd"
"vpsllvq" "vpsravd" "vpsrldq" "vpsrlvd" "vpsrlvq" "vpsubsb" "vpsubsw"
"vshufpd" "vshufps" "vsqrtpd" "vsqrtps" "vsqrtsd" "vsqrtss" "vtestpd"
"vtestps" "xsave64" "addsubpd" "addsubps" "blendvpd" "blendvps"
"cmpneqpd" "cmpneqps" "cmpneqsd" "cmpneqss" "cmpnlepd" "cmpnleps"
"cmpnlesd" "cmpnless" "cmpnltpd" "cmpnltps" "cmpnltsd" "cmpnltss"
"cmpordpd" "cmpordps" "cmpordsd" "cmpordss" "cvtdq2pd" "cvtdq2ps"
"cvtpd2dq" "cvtpd2pi" "cvtpd2ps" "cvtpi2pd" "cvtpi2ps" "cvtps2dq"
"cvtps2pd" "cvtps2pi" "cvtsd2si" "cvtsd2ss" "cvtsi2sd" "cvtsi2ss"
"cvtss2sd" "cvtss2si" "fcmovnbe" "fnstenvd" "fnstenvw" "fxsave64"
"insertps" "maskmovq" "movmskpd" "movmskps" "movntdqa" "movshdup"
"movsldup" "packssdw" "packsswb" "packusdw" "packuswb" "pblendvb"
"pfrcpit1" "pfrcpit2" "pfrsqit1" "pmovmskb" "pmovsxbd" "pmovsxbq"
"pmovsxbw" "pmovsxdq" "pmovsxwd" "pmovsxwq" "pmovzxbd" "pmovzxbq"
"pmovzxbw" "pmovzxdq" "pmovzxwd" "pmovzxwq" "pmulhrsw" "prefetch"
"rdfsbase" "rdgsbase" "sysenter" "sysexitq" "unpckhpd" "unpckhps"
"unpcklpd" "unpcklps" "vblendpd" "vblendps" "vcmpeqpd" "vcmpeqps"
"vcmpeqsd" "vcmpeqss" "vcmpgepd" "vcmpgeps" "vcmpgesd" "vcmpgess"
"vcmpgtpd" "vcmpgtps" "vcmpgtsd" "vcmpgtss" "vcmplepd" "vcmpleps"
"vcmplesd" "vcmpless" "vcmpltpd" "vcmpltps" "vcmpltsd" "vcmpltss"
"vfmaddpd" "vfmaddps" "vfmaddsd" "vfmaddss" "vfmsubpd" "vfmsubps"
"vfmsubsd" "vfmsubss" "vldmxcsr" "vmlaunch" "vmovddup" "vmovhlps"
"vmovlhps" "vmovntdq" "vmovntpd" "vmovntps" "vmpsadbw" "vmresume"
"vpaddusb" "vpaddusw" "vpalignr" "vpblendd" "vpblendw" "vpcmpeqb"
"vpcmpeqd" "vpcmpeqq" "vpcmpeqw" "vpcmpgtb" "vpcmpgtd" "vpcmpgtq"
"vpcmpgtw" "vpcomeqb" "vpcomeqd" "vpcomeqq" "vpcomeqw" "vpcomgeb"
"vpcomged" "vpcomgeq" "vpcomgew" "vpcomgtb" "vpcomgtd" "vpcomgtq"
"vpcomgtw" "vpcomleb" "vpcomled" "vpcomleq" "vpcomlew" "vpcomltb"
"vpcomltd" "vpcomltq" "vpcomltw" "vphaddbd" "vphaddbq" "vphaddbw"
"vphadddq" "vphaddsw" "vphaddwd" "vphaddwq" "vphsubbw" "vphsubdq"
"vphsubsw" "vphsubwd" "vpmacsdd" "vpmacswd" "vpmacsww" "vpmaddwd"
"vpmulhuw" "vpmuludq" "vpshufhw" "vpshuflw" "vpsubusb" "vpsubusw"
"vroundpd" "vroundps" "vroundsd" "vroundss" "vrsqrtps" "vrsqrtss"
"vstmxcsr" "vucomisd" "vucomiss" "vzeroall" "wrfsbase" "wrgsbase"
"xacquire" "xrelease" "xrstor64" "xsaveopt" "cmpxchg8b" "cvttpd2dq"
"cvttpd2pi" "cvttps2dq" "cvttps2pi" "cvttsd2si" "cvttss2si"
"extractps" "fxrstor64" "pclmulqdq" "pcmpestri" "pcmpestrm"
"pcmpistri" "pcmpistrm" "pmaddubsw" "prefetchw" "punpckhbw"
"punpckhdq" "punpckhwd" "punpcklbw" "punpckldq" "punpcklwd"
"vaddsubpd" "vaddsubps" "vblendvpd" "vblendvps" "vcmpneqpd"
"vcmpneqps" "vcmpneqsd" "vcmpneqss" "vcmpngepd" "vcmpngeps"
"vcmpngesd" "vcmpngess" "vcmpngtpd" "vcmpngtps" "vcmpngtsd"
"vcmpngtss" "vcmpnlepd" "vcmpnleps" "vcmpnlesd" "vcmpnless"
"vcmpnltpd" "vcmpnltps" "vcmpnltsd" "vcmpnltss" "vcmpordpd"
"vcmpordps" "vcmpordsd" "vcmpordss" "vcvtdq2pd" "vcvtdq2ps"
"vcvtpd2dq" "vcvtpd2ps" "vcvtph2ps" "vcvtps2dq" "vcvtps2pd"
"vcvtps2ph" "vcvtsd2si" "vcvtsd2ss" "vcvtsi2sd" "vcvtsi2ss"
"vcvtss2sd" "vcvtss2si" "vfnmaddpd" "vfnmaddps" "vfnmaddsd"
"vfnmaddss" "vfnmsubpd" "vfnmsubps" "vfnmsubsd" "vfnmsubss"
"vinsertps" "vmovmskpd" "vmovmskps" "vmovntdqa" "vmovshdup"
"vmovsldup" "vpackssdw" "vpacksswb" "vpackusdw" "vpackuswb"
"vpblendvb" "vpcomequb" "vpcomequd" "vpcomequq" "vpcomequw"
"vpcomgeub" "vpcomgeud" "vpcomgeuq" "vpcomgeuw" "vpcomgtub"
"vpcomgtud" "vpcomgtuq" "vpcomgtuw" "vpcomleub" "vpcomleud"
"vpcomleuq" "vpcomleuw" "vpcomltub" "vpcomltud" "vpcomltuq"
"vpcomltuw" "vpcomneqb" "vpcomneqd" "vpcomneqq" "vpcomneqw"
"vpermilpd" "vpermilps" "vphaddubd" "vphaddubq" "vphaddubw"
"vphaddudq" "vphadduwd" "vphadduwq" "vpmacsdqh" "vpmacsdql"
"vpmacssdd" "vpmacsswd" "vpmacssww" "vpmadcswd" "vpmovmskb"
"vpmovsxbd" "vpmovsxbq" "vpmovsxbw" "vpmovsxdq" "vpmovsxwd"
"vpmovsxwq" "vpmovzxbd" "vpmovzxbq" "vpmovzxbw" "vpmovzxdq"
"vpmovzxwd" "vpmovzxwq" "vpmulhrsw" "vunpckhpd" "vunpckhps"
"vunpcklpd" "vunpcklps" "aesdeclast" "aesenclast" "cmpunordpd"
"cmpunordps" "cmpunordsd" "cmpunordss" "cmpxchg16b" "loadall286"
"loadall386" "maskmovdqu" "phminposuw" "prefetcht0" "prefetcht1"
"prefetcht2" "punpckhqdq" "punpcklqdq" "vcmptruepd" "vcmptrueps"
"vcmptruesd" "vcmptruess" "vcvttpd2dq" "vcvttps2dq" "vcvttsd2si"
"vcvttss2si" "vextractps" "vgatherdpd" "vgatherdps" "vgatherqpd"
"vgatherqps" "vmaskmovpd" "vmaskmovps" "vpclmulqdq" "vpcmpestri"
"vpcmpestrm" "vpcmpistri" "vpcmpistrm" "vpcomnequb" "vpcomnequd"
"vpcomnequq" "vpcomnequw" "vpcomtrueb" "vpcomtrued" "vpcomtrueq"
"vpcomtruew" "vperm2f128" "vperm2i128" "vpermil2pd" "vpermil2ps"
"vpgatherdd" "vpgatherdq" "vpgatherqd" "vpgatherqq" "vpmacssdqh"
"vpmacssdql" "vpmadcsswd" "vpmaddubsw" "vpmaskmovd" "vpmaskmovq"
"vpunpckhbw" "vpunpckhdq" "vpunpckhwd" "vpunpcklbw" "vpunpckldq"
"vpunpcklwd" "vzeroupper" "xsaveopt64" "pclmulhqhdq" "pclmullqhdq"
"prefetchnta" "vaesdeclast" "vaesenclast" "vcmpeq_ospd" "vcmpeq_osps"
"vcmpeq_ossd" "vcmpeq_osss" "vcmpeq_uqpd" "vcmpeq_uqps" "vcmpeq_uqsd"
"vcmpeq_uqss" "vcmpeq_uspd" "vcmpeq_usps" "vcmpeq_ussd" "vcmpeq_usss"
"vcmpfalsepd" "vcmpfalseps" "vcmpfalsesd" "vcmpfalsess" "vcmpge_oqpd"
"vcmpge_oqps" "vcmpge_oqsd" "vcmpge_oqss" "vcmpgt_oqpd" "vcmpgt_oqps"
"vcmpgt_oqsd" "vcmpgt_oqss" "vcmple_oqpd" "vcmple_oqps" "vcmple_oqsd"
"vcmple_oqss" "vcmplt_oqpd" "vcmplt_oqps" "vcmplt_oqsd" "vcmplt_oqss"
"vcmpord_spd" "vcmpord_sps" "vcmpord_ssd" "vcmpord_sss" "vcmpunordpd"
"vcmpunordps" "vcmpunordsd" "vcmpunordss" "vfmadd132pd" "vfmadd132ps"
"vfmadd132sd" "vfmadd132ss" "vfmadd213pd" "vfmadd213ps" "vfmadd213sd"
"vfmadd213ss" "vfmadd231pd" "vfmadd231ps" "vfmadd231sd" "vfmadd231ss"
"vfmaddsubpd" "vfmaddsubps" "vfmsub132pd" "vfmsub132ps" "vfmsub132sd"
"vfmsub132ss" "vfmsub213pd" "vfmsub213ps" "vfmsub213sd" "vfmsub213ss"
"vfmsub231pd" "vfmsub231ps" "vfmsub231sd" "vfmsub231ss" "vfmsubaddpd"
"vfmsubaddps" "vinsertf128" "vinserti128" "vmaskmovdqu" "vpcomfalseb"
"vpcomfalsed" "vpcomfalseq" "vpcomfalsew" "vpcomtrueub" "vpcomtrueud"
"vpcomtrueuq" "vpcomtrueuw" "vphminposuw" "vpunpckhqdq" "vpunpcklqdq"
"pclmulhqhqdq" "pclmulhqlqdq" "pclmullqhqdq" "pclmullqlqdq"
"vbroadcastsd" "vbroadcastss" "vcmpneq_oqpd" "vcmpneq_oqps"
"vcmpneq_oqsd" "vcmpneq_oqss" "vcmpneq_ospd" "vcmpneq_osps"
"vcmpneq_ossd" "vcmpneq_osss" "vcmpneq_uspd" "vcmpneq_usps"
"vcmpneq_ussd" "vcmpneq_usss" "vcmpnge_uqpd" "vcmpnge_uqps"
"vcmpnge_uqsd" "vcmpnge_uqss" "vcmpngt_uqpd" "vcmpngt_uqps"
"vcmpngt_uqsd" "vcmpngt_uqss" "vcmpnle_uqpd" "vcmpnle_uqps"
"vcmpnle_uqsd" "vcmpnle_uqss" "vcmpnlt_uqpd" "vcmpnlt_uqps"
"vcmpnlt_uqsd" "vcmpnlt_uqss" "vextractf128" "vextracti128"
"vfnmadd132pd" "vfnmadd132ps" "vfnmadd132sd" "vfnmadd132ss"
"vfnmadd213pd" "vfnmadd213ps" "vfnmadd213sd" "vfnmadd213ss"
"vfnmadd231pd" "vfnmadd231ps" "vfnmadd231sd" "vfnmadd231ss"
"vfnmsub132pd" "vfnmsub132ps" "vfnmsub132sd" "vfnmsub132ss"
"vfnmsub213pd" "vfnmsub213ps" "vfnmsub213sd" "vfnmsub213ss"
"vfnmsub231pd" "vfnmsub231ps" "vfnmsub231sd" "vfnmsub231ss"
"vpbroadcastb" "vpbroadcastd" "vpbroadcastq" "vpbroadcastw"
"vpclmulhqhdq" "vpclmullqhdq" "vpcomfalseub" "vpcomfalseud"
"vpcomfalseuq" "vpcomfalseuw" "vpermilmo2pd" "vpermilmo2ps"
"vpermilmz2pd" "vpermilmz2ps" "vpermiltd2pd" "vpermiltd2ps"
"vcmptrue_uspd" "vcmptrue_usps" "vcmptrue_ussd" "vcmptrue_usss"
"vcmpunord_spd" "vcmpunord_sps" "vcmpunord_ssd" "vcmpunord_sss"
"vpclmulhqlqdq" "vpclmullqlqdq" "vbroadcastf128" "vbroadcasti128"
"vcmpfalse_ospd" "vcmpfalse_osps" "vcmpfalse_ossd" "vcmpfalse_osss"
"vfmaddsub132pd" "vfmaddsub132ps" "vfmaddsub213pd" "vfmaddsub213ps"
"vfmaddsub231pd" "vfmaddsub231ps" "vfmsubadd132pd" "vfmsubadd132ps"
"vfmsubadd213pd" "vfmsubadd213ps" "vfmsubadd231pd" "vfmsubadd231ps"
"aeskeygenassist" "vaeskeygenassist")) . 'font-lock-builtin-face)
;; Labels
("^[ \t]*\\([a-z$A-Z0-9.?!@]\\(?:\\sw\\|\\s_\\)*\\):"
. (1 'font-lock-function-name-face))
;; Macro names
("\\(?:macro\\|struc\\)[ \t]+\\([a-zA-Z0-9.?!@]\\(?:\\sw\\|\\s_\\)*\\)"
. (1 'font-lock-function-name-face)))
"Syntax highlighting for FASM mode.")
;; (defun fasm--get-indent-level (lineoffset)
;; (save-excursion
;; (forward-line (1- lineoffset))
;; (back-to-indentation)
;; (current-column)))
(defun empty-line? ()
(save-excursion
(let ((column-a (progn (move-beginning-of-line nil)
(current-column)))
(column-b (progn (back-to-indentation)
(current-column))))
;; 下面这个谓词看似是冗余的 但是没有关系
(and (= column-b column-a)
(eq (following-char) 10))
)))
(defun above-char ()
(interactive)
(save-excursion
(backward-char 1)
(following-char)))
(defun fasm-label? ()
(interactive)
(save-excursion
(and (progn
(whitespace-cleanup)
(not (empty-line?)))
(progn
;; (whitespace-cleanup)
(end-of-line)
(eq 58 ;; 58 -- ":"
(above-char))))))
;; (defun' test-fasm-get-indent ()
;; (interactive)
;; (message "><><><"))
(defun fasm-get-indent (n)
(save-excursion
(forward-line n)
(cond ((empty-line?)
"empty-line")
((fasm-label?)
"fasm-label")
(t
(progn
(back-to-indentation)
(current-column))))))
(defun fasm-indent-line ()
"Indent according to FASM major mode."
(interactive)
;; 可以发现缩进函数根本就写不好 因为emacs不能真正明白文本的语法
(cond
;; 下面是根据当前一行来缩进
((fasm-label?)
(let ()
(back-to-indentation)
(delete-backward-char (current-column))))
;; 下面是根据上一行来缩进
(t;; else
(back-to-indentation)
(let ((prev-indent (fasm-get-indent -1))
(curr-indent (current-column)))
(cond ((equal prev-indent "empty-line")
;; (indent-to 8)
(indent-to 3)
)
((equal prev-indent "fasm-label")
;; (indent-to 0)
;; 上面的那个命令根本不会缩进 这样看似是合理的 所以增加下面这句:
(message "do not indent at all !"))
((< curr-indent prev-indent)
(indent-to prev-indent))
((>= curr-indent prev-indent)
(delete-backward-char (- curr-indent prev-indent)))
((>= curr-indent prev-indent)
(delete-backward-char (- curr-indent prev-indent)))
)))))
;; Emacs < 24 did not have prog-mode
(defalias 'fasm-parent-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
;;;###autoload
(define-derived-mode fasm-mode fasm-parent-mode
"Fasm"
"Major mode for editing assembly in FASM format."
(set (make-local-variable 'font-lock-defaults)
(list 'fasm-font-lock-keywords nil t))
(set (make-local-variable 'indent-line-function) 'fasm-indent-line)
(set (make-local-variable 'comment-start) ";; "))
(provide 'fasm-mode)
;;; fasm-mode.el ends here

111
.emacs.local/simpc-mode.el Normal file
View File

@@ -0,0 +1,111 @@
(require 'subr-x)
(defvar simpc-mode-syntax-table
(let ((table (make-syntax-table)))
;; C/C++ style comments
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
;; Preprocessor stuff?
(modify-syntax-entry ?# "." table)
;; Chars are the same as strings
(modify-syntax-entry ?' "\"" table)
;; Treat <> as punctuation (needed to highlight C++ keywords
;; properly in template syntax)
(modify-syntax-entry ?< "." table)
(modify-syntax-entry ?> "." table)
(modify-syntax-entry ?& "." table)
(modify-syntax-entry ?% "." table)
table))
(defun simpc-types ()
'("char" "int" "long" "short" "void" "bool" "float" "double" "signed" "unsigned"
"char16_t" "char32_t" "char8_t"
"int8_t" "uint8_t" "int16_t" "uint16_t" "int32_t" "uint32_t" "int64_t" "uint64_t"
"uintptr_t"
"size_t"))
(defun simpc-keywords ()
'("auto" "break" "case" "const" "continue" "default" "do"
"else" "enum" "extern" "for" "goto" "if" "register"
"return" "sizeof" "static" "struct" "switch" "typedef"
"union" "volatile" "while" "alignas" "alignof" "and"
"and_eq" "asm" "atomic_cancel" "atomic_commit" "atomic_noexcept" "bitand"
"bitor" "catch" "class" "co_await"
"co_return" "co_yield" "compl" "concept" "const_cast" "consteval" "constexpr"
"constinit" "decltype" "delete" "dynamic_cast" "explicit" "export" "false"
"friend" "inline" "mutable" "namespace" "new" "noexcept" "not" "not_eq"
"nullptr" "operator" "or" "or_eq" "private" "protected" "public" "reflexpr"
"reinterpret_cast" "requires" "static_assert" "static_cast" "synchronized"
"template" "this" "thread_local" "throw" "true" "try" "typeid" "typename"
"using" "virtual" "wchar_t" "xor" "xor_eq"))
(defun simpc-font-lock-keywords ()
(list
`("# *[#a-zA-Z0-9_]+" . font-lock-preprocessor-face)
`("#.*include \\(\\(<\\|\"\\).*\\(>\\|\"\\)\\)" . (1 font-lock-string-face))
`(,(regexp-opt (simpc-keywords) 'symbols) . font-lock-keyword-face)
`(,(regexp-opt (simpc-types) 'symbols) . font-lock-type-face)))
(defun simpc--previous-non-empty-line ()
(save-excursion
(forward-line -1)
(while (and (not (bobp))
(string-empty-p
(string-trim-right
(thing-at-point 'line t))))
(forward-line -1))
(thing-at-point 'line t)))
(defun simpc--indentation-of-previous-non-empty-line ()
(save-excursion
(forward-line -1)
(while (and (not (bobp))
(string-empty-p
(string-trim-right
(thing-at-point 'line t))))
(forward-line -1))
(current-indentation)))
(defun simpc--desired-indentation ()
(let* ((cur-line (string-trim-right (thing-at-point 'line t)))
(prev-line (string-trim-right (simpc--previous-non-empty-line)))
(indent-len 4)
(prev-indent (simpc--indentation-of-previous-non-empty-line)))
(cond
((string-match-p "^\\s-*switch\\s-*(.+)" prev-line)
prev-indent)
((and (string-suffix-p "{" prev-line)
(string-prefix-p "}" (string-trim-left cur-line)))
prev-indent)
((string-suffix-p "{" prev-line)
(+ prev-indent indent-len))
((string-prefix-p "}" (string-trim-left cur-line))
(max (- prev-indent indent-len) 0))
((string-suffix-p ":" prev-line)
(if (string-suffix-p ":" cur-line)
prev-indent
(+ prev-indent indent-len)))
((string-suffix-p ":" cur-line)
(max (- prev-indent indent-len) 0))
(t prev-indent))))
;;; TODO: customizable indentation (amount of spaces, tabs, etc)
(defun simpc-indent-line ()
(interactive)
(when (not (bobp))
(let* ((desired-indentation
(simpc--desired-indentation))
(n (max (- (current-column) (current-indentation)) 0)))
(indent-line-to desired-indentation)
(forward-char n))))
(define-derived-mode simpc-mode prog-mode "Simple C"
"Simple major mode for editing C files."
:syntax-table simpc-mode-syntax-table
(setq-local font-lock-defaults '(simpc-font-lock-keywords))
(setq-local indent-line-function 'simpc-indent-line)
(setq-local comment-start "// "))
(provide 'simpc-mode)

137
.emacs.rc/misc-rc.el Normal file
View File

@@ -0,0 +1,137 @@
(require 'ansi-color)
(global-set-key (kbd "C-c p") 'find-file-at-point)
(global-set-key (kbd "C-c i m") 'imenu)
(setq-default inhibit-splash-screen t
make-backup-files nil
tab-width 4
indent-tabs-mode nil
compilation-scroll-output t
visible-bell (equal system-type 'windows-nt))
(defun rc/colorize-compilation-buffer ()
(read-only-mode 'toggle)
(ansi-color-apply-on-region compilation-filter-start (point))
(read-only-mode 'toggle))
(add-hook 'compilation-filter-hook 'rc/colorize-compilation-buffer)
(defun rc/buffer-file-name ()
(if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name)))
(defun rc/parent-directory (path)
(file-name-directory (directory-file-name path)))
(defun rc/root-anchor (path anchor)
(cond
((string= anchor "") nil)
((file-exists-p (concat (file-name-as-directory path) anchor)) path)
((string-equal path "/") nil)
(t (rc/root-anchor (rc/parent-directory path) anchor))))
(defun rc/clipboard-org-mode-file-link (anchor)
(interactive "sRoot anchor: ")
(let* ((root-dir (rc/root-anchor default-directory anchor))
(org-mode-file-link (format "file:%s::%d"
(if root-dir
(file-relative-name (rc/buffer-file-name) root-dir)
(rc/buffer-file-name))
(line-number-at-pos))))
(kill-new org-mode-file-link)
(message org-mode-file-link)))
;;; Taken from here:
;;; http://stackoverflow.com/questions/2416655/file-path-to-clipboard-in-emacs
(defun rc/put-file-name-on-clipboard ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (rc/buffer-file-name)))
(when filename
(kill-new filename)
(message filename))))
(defun rc/put-buffer-name-on-clipboard ()
"Put the current buffer name on the clipboard"
(interactive)
(kill-new (buffer-name))
(message (buffer-name)))
(defun rc/kill-autoloads-buffers ()
(interactive)
(dolist (buffer (buffer-list))
(let ((name (buffer-name buffer)))
(when (string-match-p "-autoloads.el" name)
(kill-buffer buffer)
(message "Killed autoloads buffer %s" name)))))
(defun rc/start-python-simple-http-server ()
(interactive)
(shell-command "python -m SimpleHTTPServer 3001 &"
"*Simple Python HTTP Server*"))
(global-set-key (kbd "C-x p s") 'rc/start-python-simple-http-server)
;;; Taken from here:
;;; http://blog.bookworm.at/2007/03/pretty-print-xml-with-emacs.html
(defun bf-pretty-print-xml-region (begin end)
"Pretty format XML markup in region. You need to have nxml-mode
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
this. The function inserts linebreaks to separate tags that have
nothing but whitespace between them. It then indents the markup
by using nxml's indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region begin end))
(message "Ah, much better!"))
;;; Stolen from http://ergoemacs.org/emacs/emacs_unfill-paragraph.html
(defun rc/unfill-paragraph ()
"Replace newline chars in current paragraph by single spaces.
This command does the inverse of `fill-paragraph'."
(interactive)
(let ((fill-column 90002000)) ; 90002000 is just random. you can use `most-positive-fixnum'
(fill-paragraph nil)))
(global-set-key (kbd "C-c M-q") 'rc/unfill-paragraph)
(defun rc/load-path-here ()
(interactive)
(add-to-list 'load-path default-directory))
(defconst rc/frame-transparency 85)
(defun rc/toggle-transparency ()
(interactive)
(let ((frame-alpha (frame-parameter nil 'alpha)))
(if (or (not frame-alpha)
(= (cadr frame-alpha) 100))
(set-frame-parameter nil 'alpha
`(,rc/frame-transparency
,rc/frame-transparency))
(set-frame-parameter nil 'alpha '(100 100)))))
(defun rc/duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'rc/duplicate-line)
;;; A little hack which fixes a problem with meta key in fluxbox under VNC.
(setq x-alt-keysym 'meta)
;(setq confirm-kill-emacs 'y-or-n-p)

34
.emacs.rc/rc.el Normal file
View File

@@ -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)