Skip to content

Instantly share code, notes, and snippets.

@ento
Created March 1, 2011 18:11
Show Gist options
  • Save ento/849569 to your computer and use it in GitHub Desktop.
Save ento/849569 to your computer and use it in GitHub Desktop.
My latest .emacs
;(global-set-key "\C-h" 'backward-delete-char)
;
;(global-font-lock-mode t)
;(setq transient-mark-mode t)
;(set-face-background 'region "indianred")
;(tool-bar-mode 0)
;(show-paren-mode t)
;(setq w3m-home-page "http://www.google.com")
;
;(defun gettext (&optional arg)
; "Variation of insert-parenthesis: enclose with _().
;If region is active, and the region is not capped by quotation,
;enclose with _('')"
; (interactive "P")
; (let ((start "_(")
; (end ")"))
; (if (and transient-mark-mode mark-active)
; (progn
; (save-excursion
; (goto-char (region-beginning))
; (if (not (looking-at "['\"]"))
; (setq start (concat "<%= " start "'"))))
; (save-excursion
; (goto-char (region-end))
; (backward-char)
; (if (not (looking-at "['\"]"))
; (setq end (concat "'" end " %>"))))))
; (insert-pair arg start end)))
;
;(defun my-objc-mode-hook ()
; ;; my customizations for all of c-mode and related modes
; (c-set-style "whitesmith")
; )
;(add-hook 'objc-mode-hook 'my-objc-mode-hook)
;
;(autoload 'po-mode "po-mode+"
; "Major mode for translators to edit PO files" 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.
; '(make-backup-files nil)
; '(po-translator "ento <[email protected]>")
; '(safe-local-variable-values (quote ((c-file-style . whitesmith) (encoding . utf-8)))))
;(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.
; )
;
;
;;;; slime
;(setq inferior-lisp-program "/opt/local/bin/clisp -K full")
;
(add-to-list 'load-path (expand-file-name "~/.emacs.d"))
(load (expand-file-name "~/.emacs.d/init.el"))
(put 'narrow-to-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;; --------------------------------------------------------
;; nice little alternative visual bell; Miles Bader <miles /at/ gnu.org>
;; http://www.emacswiki.org/emacs/MilesBader#toc3
(defcustom echo-area-bell-string "*DING* " ;"♪"
"Message displayed in mode-line by `echo-area-bell' function."
:group 'user)
(defcustom echo-area-bell-delay 0.1
"Number of seconds `echo-area-bell' displays its message."
:group 'user)
;; internal variables
(defvar echo-area-bell-cached-string nil)
(defvar echo-area-bell-propertized-string nil)
(defun echo-area-bell ()
"Briefly display a highlighted message in the echo-area.
The string displayed is the value of `echo-area-bell-string',
with a red background; the background highlighting extends to the
right margin. The string is displayed for `echo-area-bell-delay'
seconds.
This function is intended to be used as a value of `ring-bell-function'."
(unless (equal echo-area-bell-string echo-area-bell-cached-string)
(setq echo-area-bell-propertized-string
(propertize
(concat
(propertize
"x"
'display
`(space :align-to (- right ,(+ 2 (length echo-area-bell-string)))))
echo-area-bell-string)
'face '(:background "Firebrick")))
(setq echo-area-bell-cached-string echo-area-bell-string))
(message echo-area-bell-propertized-string)
(sit-for echo-area-bell-delay)
(message ""))
(setq ring-bell-function 'echo-area-bell)
;; Command-Key and Option-Key
(setq ns-command-modifier (quote meta))
(setq ns-alternate-modifier (quote super))
;; Font
;; (insert (prin1-to-string (x-list-fonts "*")))
(setq mac-allow-anti-aliasing t)
(if (= emacs-major-version 22)
(require 'carbon-font))
; http://d.hatena.ne.jp/setoryohei/20110122/1295768666
(defun set-font-ascii_japanese (ascii-font-family jp-font-family size)
"フレーム上の英字フォントと日本語フォントをASCII-FONT-FAMILY と JP-FONT-FAMILY に
設定する(フォントはファミリー名で指定)。英字フォントのサイズを SIZE に設定する。"
(interactive
(let* ((completion-ignore-case t)
(af (completing-read "ascii font: "
'("Menlo"
"Monaco"
"Courier")))
(jf (completing-read "japanese font: "
'("Hiragino Maru Gothic ProN"
"Hiragino Kaku Gothic ProN"
"Hiragino Mincho ProN"
"Osaka")))
(si (completing-read "size: " nil)))
(list af jf si)))
(let* ((h (* (string-to-number size) 10))
(fontspec (if (string= ascii-font-family "") nil
(font-spec :family ascii-font-family)))
(jp-fontspec (if (string= jp-font-family "") nil
(font-spec :family jp-font-family))))
(if (and fontspec jp-fontspec)
(progn
(if (eq h 0) (setq h 140))
(set-face-attribute 'default nil :family ascii-font-family :height h)
(set-fontset-font nil 'japanese-jisx0213.2004-1 jp-fontspec)
(set-fontset-font nil 'japanese-jisx0213-2 jp-fontspec)
(set-fontset-font nil 'katakana-jisx0201 jp-fontspec) ; 半角カナ
(set-fontset-font nil '(#x0370 . #x03FF) fontspec) ; ギリシャ文字
(set-fontset-font nil '(#x0080 . #x024F) fontspec) ; 分音符付きラテン
))))
(dolist (elt '(("^-apple-hiragino.*" . 1.2)
(".*osaka-bold.*" . 1.2)
(".*osaka-medium.*" . 1.2)
(".*meiryo.*" . 1.0)
(".*courier-bold-.*-mac-roman" . 1.0)
(".*verdana.*" . 1.0)
(".*monaco cy-bold-.*-mac-cyrillic" . 0.9)
(".*monaco-bold-.*-mac-roman" . 0.9)))
(add-to-list 'face-font-rescale-alist elt))
(when window-system
(set-font-ascii_japanese "Verdana" "Meiryo" "14")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment