;; Nince URL: ;; http://home.att.ne.jp/alpha/z123/elisp-j.html;;mac-japanese ;; ;; Japanese Environments for MacOSX ;(utf-translate-cjk-mode t) (set-language-environment 'Japanese) ;;(set-default-coding-systems 'utf-8-unix) ;;(set-terminal-coding-system 'utf-8-unix) ;;(set-keyboard-coding-system 'utf-8-unix) ;;(set-buffer-file-coding-system 'utf-8-unix) ;;(set-clipboard-coding-system 'utf-8-unix) (set-default-coding-systems 'euc-jp-unix) (set-terminal-coding-system 'euc-jp-unix) (set-keyboard-coding-system 'euc-jp-unix) (set-buffer-file-coding-system 'euc-jp-unix) (set-clipboard-coding-system 'euc-jp-unix) ; Anthy Input Methed ;;(push "/usr/local/share/emacs/site-lisp/anthy/" load-path) ;;(load-library "anthy") ;;(setq default-input-method 'japanese-anthy) ;; Shutcut Key for MacOSX (setq mac-command-key-is-meta nil) (global-set-key [(alt c)] 'kill-ring-save) (global-set-key [(alt v)] 'yank) (global-set-key [(alt x)] 'kill-region) (global-set-key [(alt a)] 'mark-whole-buffer) (global-set-key [(alt z)] 'undo) (global-set-key [(alt f)] 'isearch-forward) (global-set-key [(alt o)] 'find-file) (global-set-key [(alt s)] 'save-buffer) (global-set-key [(alt p)] 'mac-preview) ; requires mac-preview (global-set-key [(alt w)] 'kill-this-buffer) (global-set-key [(alt m)] 'iconify-frame) (global-set-key [(alt q)] 'save-buffers-kill-emacs) (global-set-key [(alt .)] 'keyboard-quit) (global-set-key [(alt up)] 'beginning-of-buffer) (global-set-key [(alt down)] 'end-of-buffer) (global-set-key [(alt left)] 'beginning-of-line) (global-set-key [(alt right)] 'end-of-line) ;; Open HTML file utilizing Safari ;; M-x html-mode --> C-c C-v --> own file is opened by Safari. (setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "/usr/bin/open" browse-url-generic-args '("-a" "Safari")) (setq browse-url-filename-alist '(("/webmaster@webserver:/home/www/html/" . "http://www.acme.co.uk/") ("^/\(ftp@\|anonymous@\)?\([^:]+\):/*" . "ftp://\2/") ("^/\([^:@]+@\)?\([^:]+\):/*" . "ftp://\1\2/") ("^/+" . "/") )) ;; Compile Mode ;; http://home.att.ne.jp/alpha/z123/files/smart-compile.el ;; ~/bin/ ;; Standard: M-x compile = make -k ;; This LISP: *.c --> gcc, *.java --> javac ;; Please see the head of smart-compile.el if you wanto kind of this type. (load-file "~/bin/smart-compile.el") ;; And M-x compile = C-c C-c. (global-set-key "\C-c\C-c" 'smart-compile) (add-hook 'c-mode-common-hook '(lambda ()(local-set-key "\C-c\C-c" 'smart-compile))) (add-hook 'sh-mode-hook '(lambda ()(local-set-key "\C-c\C-c" 'smart-compile))) ;; preview on Mac OS X (color/Kanji) (defalias 'ps-mule-header-string-charsets 'ignore) (defun mac-preview(&optional dummy) "Open a color image of the buffer by Preview.app on Mac OS X." (interactive) (let* ((ps-multibyte-buffer 'non-latin-printer) (ps-print-header (if (null current-prefix-arg) t nil)) (ps-file "/tmp/carbon-emacs-print.ps") (pdf-file "/tmp/carbon-emacs-print.pdf") (gs-command (concat "/usr/local/bin/gs -q -dNOPAUSE -dBATCH " "-sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dAutoFilterGrayImages=false " "-dAutoFilterColorImages=false -dGrayImageFilter=/FlateEncode " "-dColorImageFilter=/FlateEncode -dUseFlateCompression=true " "-sOutputFile=" pdf-file " -c .setpdfwrite -f " ps-file " -c quit")) (preview-command (concat "/usr/bin/open -a Preview " pdf-file)) ) (ps-spool-buffer-with-faces) (switch-to-buffer "*PostScript*") (write-file ps-file) (kill-buffer (buffer-name)) (shell-command (concat gs-command " && " preview-command)) )) ;; MacOSX標準の開くを利用 (defun mac-open-file () "Document forthcoming..." (interactive) (let ((file (do-applescript "try POSIX path of (choose file) end try"))) (if (> (length file) 3) (setq file (replace-regexp-in-string "\\\\\\(.\\)" "\\1" (decode-coding-string (substring file 1 (- (length file) 1)) 'sjis-mac)))) (if (and (not (equal file ""))(file-readable-p file)) (find-file file) (beep)) )) ;;MacOSX標準のFilderを利用。 (defun mac-show-in-finder () "Document forthcoming..." (interactive) (if (stringp (buffer-file-name)) (do-applescript (format " tell application \"Finder\" activate try select file \"%s\" on error beep end try end tell" (replace-regexp-in-string "\\\\" "\\\\\\\\" (encode-coding-string (posix-file-name-to-mac (buffer-file-name)) 'sjis-unix)) ;; sjis-mac doesn't work )) (shell-command "/usr/bin/open .") )) ;; iTermを使って編集中のファイルがあるディレクトリに移動 ;; M-x mac-open-terminal (defun mac-open-terminal () (interactive) (let ((dir "")) (cond ((and (local-variable-p 'dired-directory) dired-directory) (setq dir dired-directory)) ((stringp (buffer-file-name)) (setq dir (file-name-directory (buffer-file-name)))) ) (do-applescript (format " tell application \"Terminal\" activate try do script with command \"cd %s\" on error beep end try end tell" dir)) )) (load "$HOME/.htmlize.el") ;;(load "$HOME/.php.el")