Skip to content

Instantly share code, notes, and snippets.

@toshikaz55
Last active June 23, 2016 13:38
Show Gist options
  • Save toshikaz55/a959c43f374f5a65a25d to your computer and use it in GitHub Desktop.
Save toshikaz55/a959c43f374f5a65a25d to your computer and use it in GitHub Desktop.
;;; start.el
;; Seiji Zenitani's configuration for Emacs 22/23.
;; I put this file in ~/lib/emacs/ and then byte-compile it.
;; The *.elc file is loaded from the following .emacs.el:
;;
;; ;; load all *.elc files...
;; (mapcar (lambda (x)(load-file x))(directory-files "~/lib/emacs" t "\\.elc$"))
;; basic setup
(setq inhibit-startup-message t) ; don't show the startup message
(setq kill-whole-line t) ; C-k deletes the end of line
(setq make-backup-files nil) ; don't make *~
(setq auto-save-list-file-prefix nil) ; don't make ~/.saves-PID-hostname
(setq auto-save-default nil) ; disable auto-saving
(column-number-mode 1)
(display-time-mode 1)
(setq initial-frame-alist
(append (list
'(width . 120)
'(height . 60)
)
initial-frame-alist))
;; recentf
(require 'recentf)
(setq recentf-auto-cleanup 'never)
(setq recentf-max-saved-items 100)
(recentf-mode 1)
;; misc stuff
(setq htmlize-output-type 'font)
;; keys
(global-set-key "\C-z" 'undo)
(global-set-key "\C-x\C-b" 'electric-buffer-list)
(global-set-key "\C-c\C-i" 'indent-region) ; C-u C-c TAB => (un)indent-region
(global-set-key "\C-c;" 'comment-or-uncomment-region)
(global-set-key "\C-ck" (lambda ()(interactive)(kill-line 0)))
(global-set-key "\C-cu" 'untabify)
;; --------- Window system ---------
(when window-system
(add-to-list 'default-frame-alist '(width . 90))
(add-to-list 'default-frame-alist '(height . 40))
;; default color
(add-to-list 'default-frame-alist '(cursor-color . "SlateBlue2"))
(add-to-list 'default-frame-alist '(mouse-color . "SlateBlue2"))
(add-to-list 'default-frame-alist '(foreground-color . "gray10"))
(add-to-list 'default-frame-alist '(background-color . "white"))
(set-face-foreground 'modeline "white")
(set-face-background 'modeline "SlateBlue2")
(set-face-background 'region "LightSteelBlue1")
;; faces
(set-face-foreground 'font-lock-comment-face "MediumSeaGreen")
(set-face-foreground 'font-lock-string-face "purple")
(set-face-foreground 'font-lock-keyword-face "blue")
(set-face-foreground 'font-lock-function-name-face "blue")
(set-face-bold-p 'font-lock-function-name-face t)
(set-face-foreground 'font-lock-variable-name-face "black")
(set-face-foreground 'font-lock-type-face "LightSeaGreen")
(set-face-foreground 'font-lock-builtin-face "purple")
(set-face-foreground 'font-lock-constant-face "black")
(set-face-foreground 'font-lock-warning-face "blue")
(set-face-bold-p 'font-lock-warning-face nil)
;; pc-selection-mode/transient-mark-mode
(when (>= emacs-major-version 22)
(setq pc-select-selection-keys-only t)
(pc-selection-mode 1)
(set-scroll-bar-mode 'right)
)
;; nxhtml
(when (load "autostart" t)
(setq nxhtml-skip-welcome t)
)
;; additional menu
(require 'easymenu)
(setq my-encoding-map (make-sparse-keymap "Encoding Menu"))
(easy-menu-define my-encoding-menu my-encoding-map
"Encoding Menu."
'("Change File Encoding"
["UTF8 - Unix (LF)" (set-buffer-file-coding-system 'utf-8-unix) t]
["UTF8 - Mac (CR)" (set-buffer-file-coding-system 'utf-8-mac) t]
["UTF8 - Win (CR+LF)" (set-buffer-file-coding-system 'utf-8-dos) t]
["--" nil nil]
["Shift JIS - Mac (CR)" (set-buffer-file-coding-system 'sjis-mac) t]
["Shift JIS - Win (CR+LF)" (set-buffer-file-coding-system 'sjis-dos) t]
["--" nil nil]
["EUC - Unix (LF)" (set-buffer-file-coding-system 'euc-jp-unix) t]
["JIS - Unix (LF)" (set-buffer-file-coding-system 'junet-unix) t]
))
(define-key-after menu-bar-file-menu [my-file-separator]
'("--" . nil) 'kill-buffer)
(define-key-after menu-bar-file-menu [my-encoding-menu]
(cons "File Encoding" my-encoding-menu) 'my-file-separator)
)
;全角空白表示
(setq whitespace-style
'(tabs tab-mark spaces space-mark))
(setq whitespace-space-regexp "\\(\x3000+\\)")
(setq whitespace-display-mappings
'((space-mark ?\x3000 [?\□])
(tab-mark ?\t [?\xBB ?\t])
))
(require 'whitespace)
(global-whitespace-mode 1)
(set-face-foreground 'whitespace-space "LightSlateGray")
(set-face-background 'whitespace-space "DarkSlateGray")
(set-face-foreground 'whitespace-tab "LightSlateGray")
(set-face-background 'whitespace-tab "DarkSlateGray")
;; ShellモードでANSIカラーが文字化けするのを防ぐ
(autoload 'ansi-color-for-comint-mode-on "ansi-color" "Set `ansi-color-for-comint-mode' to t." t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;; タブ幅を 4 に設定
(setq-default tab-width 4)
;; タブ幅の倍数を設定
(setq tab-stop-list
'(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
;; タブはスペースではなくタブ
(setq-default indent-tabs-mode t)
(add-hook 'c-mode-common-hook
'(lambda ()
(c-set-style "GNU")
(setq c-basic-offset 4)
(setq c-tab-width 4 )
(setq c-tab-always-indent t)
(setq tab-width 4)
))
;;elscreen
(setq elscreen-prefix-key "\C-t")
(load "elscreen" "ElScreen" t)
;(elscreen-set-prefix-key "\C-t")
;行番号表示
(global-linum-mode t)
(setq linum-format "%4d| ")
;; GDB
;;; GDB 関連
;;; 有用なバッファを開くモード
(setq gdb-many-windows t)
;;; 変数の上にマウスカーソルを置くと値を表示
(add-hook 'gdb-mode-hook '(lambda () (gud-tooltip-mode t)))
(xterm-mouse-mode)
;;; start.el ends here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment