Skip to content

Instantly share code, notes, and snippets.

@wangyeee
Created January 7, 2022 22:27
Show Gist options
  • Save wangyeee/eaecf433ec5f4a7f92252f0d50d622f4 to your computer and use it in GitHub Desktop.
Save wangyeee/eaecf433ec5f4a7f92252f0d50d622f4 to your computer and use it in GitHub Desktop.
;; Emacs startup file
(if window-system
(progn
(tool-bar-mode -1)
(setq frame-title-format '("%b [%m] Emacs " emacs-version))
(set-frame-size (selected-frame) 100 36))
(progn
(menu-bar-mode -1)
(setq ring-bell-function 'ignore)))
;; No tabs when indenting
(setq-default indent-tabs-mode nil)
(global-font-lock-mode t)
(global-linum-mode t)
(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.
'(inhibit-startup-screen t)
;; '(package-selected-packages (quote (vlf js2-mode csv-mode javaimp html5-schema auctex)))
'(warning-suppress-types (quote ((undo discard-info)))))
(setq backup-inhibited t)
(setq auto-save-default nil)
(setq c-default-style "linux")
(setq c-basic-offset 4)
(setq url-using-proxy t)
(defun comment-or-uncomment-line-or-region ()
"Comments or uncomments the current line or region."
(interactive)
(if (region-active-p)
(comment-or-uncomment-region (region-beginning) (region-end))
(comment-or-uncomment-region (line-beginning-position) (line-end-position))))
(global-set-key "\M-;" 'comment-or-uncomment-line-or-region)
(defun format-xml-region()
(interactive)
(delete-trailing-whitespace)
(goto-char (point-min))
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region (point-min) (point-max) nil)
(untabify (point-min) (point-max)))
(require 'cc-mode)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(add-hook 'c-mode-common-hook
(lambda()
(c-set-offset 'inextern-lang 0)))
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.pde\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.pkb\\'" . sql-mode))
(add-to-list 'auto-mode-alist '("\\.pkh\\'" . sql-mode))
(add-to-list 'auto-mode-alist '("\\.net\\'" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.kicad_pcb\\'" . lisp-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment