Created
February 19, 2013 08:06
-
-
Save informationsea/4983909 to your computer and use it in GitHub Desktop.
A fragment of the emacs elisp for mac
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
(when (>= emacs-major-version 24) ;; for cocoa emacs | |
(if (eq window-system 'ns) | |
(progn | |
(setq mac-mouse-wheel-smooth-scroll t) | |
(dolist (dir (list | |
"/sbin" | |
"/usr/sbin" | |
"/bin" | |
"/usr/bin" | |
"/opt/local/bin" | |
"/usr/local/bin" | |
"/usr/local/ode/bin" | |
"/usr/local/CrossPack-AVR/bin" | |
(expand-file-name "~/bin") | |
(expand-file-name "~/.emacs.d/bin") | |
)) | |
;; PATH と exec-path に同じ物を追加します | |
(when (and (file-exists-p dir) (not (member dir exec-path))) | |
(setenv "PATH" (concat dir ":" (getenv "PATH"))) | |
(setq exec-path (append (list dir) exec-path)))) | |
(global-set-key [wheel-up] '(lambda () "" (interactive) (scroll-down 1))) | |
(global-set-key [wheel-down] '(lambda () "" (interactive) (scroll-up 1))) | |
(global-set-key [double-wheel-up] '(lambda () "" (interactive) (scroll-down 2))) | |
(global-set-key [double-wheel-down] '(lambda () "" (interactive) (scroll-up 2))) | |
(global-set-key [triple-wheel-up] '(lambda () "" (interactive) (scroll-down 3))) | |
(global-set-key [triple-wheel-down] '(lambda () "" (interactive) (scroll-up 3))) | |
;(tool-bar-mode t) ; show toolbar | |
(define-key global-map (kbd "C-c f") 'ns-fullscreen-toggle) | |
;; (setq default-input-method "MacOSX") | |
;; | |
;; (defun mac-change-language-to-ja () | |
;; (interactive) | |
;; (mac-toggle-input-method t)) | |
(global-set-key [(shift control j)] 'ns-inputmethod-change-jp) | |
(global-set-key [(control \:)] 'ns-inputmethod-change-us) ; for us keybord | |
(global-set-key [(control \+)] 'ns-inputmethod-change-us) ; for jp keybord | |
;; (global-set-key [(shift control j)] 'mac-change-language-to-ja) | |
;; (global-set-key [(control \:)] 'mac-change-language-to-us) ; for us keybord | |
;; (global-set-key [(control \+)] 'mac-change-language-to-us) ; for jp keybord | |
(setq ns-command-modifier (quote meta)) | |
;; (setq ns-alternate-modifier (quote super)) | |
(setq initial-frame-alist ;; ウインドウの初期位置を設定 | |
(append (list | |
'(top . 70) | |
'(left . 300) | |
) | |
initial-frame-alist)) | |
(setq default-frame-alist ;; ウインドウの透過率を設定 | |
(append (list | |
'(alpha . (100 95)) | |
;'(background-color . "ivory") | |
'(width . 80) | |
'(height . 40) | |
) default-frame-alist)) | |
(condition-case nil (mac-input-method-mode) (error nil)) | |
;;ドラッグ&ドロップはファイルを開く設定に変更 | |
(define-key global-map [ns-drag-file] 'ns-find-file) | |
(set-face-attribute 'default nil | |
:family "monaco" | |
:height 120) | |
(set-fontset-font | |
(frame-parameter nil 'font) | |
'japanese-jisx0208 | |
'("Hiragino Kaku Gothic Pro" . "iso10646-1")) | |
(set-fontset-font | |
(frame-parameter nil 'font) | |
'japanese-jisx0212 | |
'("Hiragino Kaku Gothic Pro" . "iso10646-1")) | |
(setq face-font-rescale-alist | |
'(("^-apple-hiragino.*" . 1.2) | |
(".*osaka-bold.*" . 1.2) | |
(".*osaka-medium.*" . 1.2) | |
(".*courier-bold-.*-mac-roman" . 1.0) | |
(".*monaco cy-bold-.*-mac-cyrillic" . 0.9) | |
(".*monaco-bold-.*-mac-roman" . 0.9) | |
("-cdac$" . 1.3))) | |
) | |
) | |
) | |
;; 言語を日本語にする | |
(set-language-environment 'utf-8) | |
(prefer-coding-system 'utf-8) | |
(if (or (eq window-system 'mac) (eq window-system 'ns)) | |
;; ファイル名のみutf-8-hfs | |
(progn | |
(when (require 'ucs-normalize nil t) | |
(setq file-name-coding-system 'utf-8-hfs) | |
(setq locale-coding-system 'utf-8-hfs)) | |
(setq default-input-method "MacOSX") | |
) | |
(progn | |
(setq file-name-coding-system 'utf-8) | |
(setq locale-coding-system 'utf-8))) | |
;; Keymap | |
(global-set-key (kbd "C-c c") (lambda () (interactive) (recompile))) ; Recompile with C-c c | |
(global-set-key (kbd "C-c x") (lambda () (interactive) (compile "make"))) ; Recompile with C-c c | |
(global-set-key (kbd "C-c v") (lambda () (interactive) (shell-command "make program"))) ; Recompile with C-c c | |
(keyboard-translate ?\C-h ?\C-?) ; Translate C-h to Backspace | |
(define-key global-map (kbd "C-h") 'delete-backward-char) ; Assign C-h to backward delete for emacsclient | |
(define-key global-map (kbd "C-x h") 'help-command) ; set C-x h to help | |
(define-key global-map (kbd "C-x t") 'ff-find-other-file) ; Toggle Source/Header or find include file | |
(global-set-key "\C-x\C-b" 'bs-show) ; Improved Buffer List | |
(global-set-key (kbd "C-x p") (lambda () (interactive) (other-window -1))) ; opposite of C-x o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment