Home > Tags > emacs
emacs
colinuxからmountしたwindowsのファイルをemacsで保存するには
- 2009/02/04
- Web開発関連
以前解決しなかった問題をなにげに調べると簡単に解決できそう。明日会社で試してみよう。
cofsでmountしたWindowsのファイルをemacsで保存する – 寄り道ばかりの お勉強日記★
write-region-inhibit-fsync
という変数をtにしておけば、emacsくんがfsyncを呼ばないということが判明。
この設定をしたら無事にemacsから保存できたーっ!
最新のcoLinux-.emacs
- 2007/12/26
- Web開発関連
;; ~/elisp をライブラリパスに追加
(setq load-path
(append
(list
(expand-file-name "~/elisp/")
)
load-path))
;; 日本語設定 (UTF-8)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
;; ChangeLog の設定
(setq user-full-name "xxx")
(setq user-mail-address "xxx")
(defun memo ()
(interactive)
(add-change-log-entry
nil
(expand-file-name "~/memo/diary.txt")))
(define-key ctl-x-map "M" 'memo)
;; タブの基本設定
(setq tab-width 4)
(setq c-basic-offset 4)
;; フォントロックモード (強調表示等) を有効にする
(global-font-lock-mode t)
;; 一時マークモードの自動有効化
(setq-default transient-mark-mode t)
;; C-x C-u が何もしないように変更する (undo の typo 時誤動作防止)
(global-unset-key "\C-x\C-u")
;; 括弧の対応をハイライト.
(show-paren-mode 1)
;; バッファ末尾に余計な改行コードを防ぐための設定
(setq next-line-add-newlines nil)
;; C-x l で goto-line を実行
(define-key ctl-x-map "l" 'goto-line)
;; 時間を表示
(display-time)
;; 列数表示
(column-number-mode 1)
;; メニューバーを消す
(menu-bar-mode -1)
;; バックアップファイルを作成しない
(setq make-backup-files nil)
;; grep-find の結果に .svn ディレクトリを含まないようにする
(setq grep-find-command "find . -type f -path '*.svn*' -prune -o -print0 | xargs -0 -e grep -nH -e ")
;; C-h でカーソルの左にある文字を消す
(define-key global-map "\C-h" 'delete-backward-char)
;; C-h に割り当てられている関数 help-command を C-x C-h に割り当てる
(define-key global-map "\C-x\C-h" 'help-command)
;; C-z のキーバインドを開放
(global-unset-key "\C-z")
;; toggle-truncate-lines を "C-z l" に定義する
(define-key global-map "\C-zl" 'toggle-truncate-lines)
;; 画面の左端に行番号を表示できるように
(require 'wb-line-number)
;; "C-z n" に定義する
(define-key global-map "\C-zn" 'wb-line-number-toggle)
;; C-o に動的略語展開機能を割り当てる
;;(define-key global-map "\C-o" 'dabbrev-expand)
;;(setq dabbrev-case-fold-search nil) ; 大文字小文字を区別
;; 日本語・英語混じり文での区切判定
;; http://www.alles.or.jp/~torutk/oojava/meadow/Meadow210Install.html
(defadvice dabbrev-expand
(around modify-regexp-for-japanese activate compile)
"Modify `dabbrev-abbrev-char-regexp' dynamically for Japanese words."
(if (bobp)
ad-do-it
(let ((dabbrev-abbrev-char-regexp
(let ((c (char-category-set (char-before))))
(cond
((aref c ?a) "[-_A-Za-z0-9]") ; ASCII
((aref c ?j) ; Japanese
(cond
((aref c ?K) "\\cK") ; katakana
((aref c ?A) "\\cA") ; 2byte alphanumeric
((aref c ?H) "\\cH") ; hiragana
((aref c ?C) "\\cC") ; kanji
(t "\\cj")))
((aref c ?k) "\\ck") ; hankaku-kana
((aref c ?r) "\\cr") ; Japanese roman ?
(t dabbrev-abbrev-char-regexp)))))
ad-do-it)))
;; BS で選択範囲を消す
(delete-selection-mode 1)
;; The local variables list in .emacs と言われるのを抑止
(add-to-list 'ignored-local-variables 'syntax)
;; ミニバッファ中での補完機構を補強
(iswitchb-mode t)
;; kill リングバッファの内容を表示しながらヤンクできるようにする
(autoload 'kill-summary "kill-summary" nil t)
(define-key global-map "\ey" 'kill-summary)
;; php-mode
(autoload 'php-mode "php-mode")
(setq auto-mode-alist
(append '(("\\.[php|inc]$" . php-mode)) auto-mode-alist))
(setq php-mode-force-pear t)
(add-hook 'php-mode-user-hook
'(lambda ()
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq php-manual-path "/usr/local/share/php/doc/html")
(setq php-manual-url "http://www.phppro.jp/phpmanual/")))
;;;; ruby-mode (要 ruby-mode.el)
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '(("\\.rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)))
;; cperl-mode の設定。インデントをいい感じに、他。
(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq cperl-auto-newline t)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)
(setq cperl-indent-level 4)
(setq cperl-label-offset -4)
(setq cperl-continued-statement-offset 4)
(setq cperl-highlight-variables-indiscriminately t)
(add-hook 'cperl-mode-hook
(lambda ()
(set-face-italic-p 'cperl-hash-face nil)))
(add-hook 'cperl-mode-hook
'(lambda ()
(define-key cperl-mode-map "\C-cc" 'cperl-check-syntax)
(setq indent-tabs-mode nil)))
;; cf-mode
(autoload 'cf-mode "cf-mode"
"Mode for editing cf source files" t)
(setq auto-mode-alist
(append '(("\\.[cfm|cfc]$" . cf-mode)) auto-mode-alist))
(add-hook 'cf-mode-user-hook
'(lambda ()
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)))
;; mmm-mode
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
(set-face-background 'mmm-default-submode-face nil) ;;背景色不要
(setq mmm-submode-decoration-level 2) ;;カラー表示
(setq mmm-font-lock-available-p t) ;;カラー表示
(mmm-add-mode-ext-class nil "\\.ctp?\\'" 'html-php)
(mmm-add-classes
'((html-php
:submode php-mode
:front "<\\?\\(php\\)?"
:back "\\?>")))
(add-to-list 'auto-mode-alist '("\\.ctp?\\'" . html-mode))
;; css-mode
(autoload 'css-mode "css-mode")
(setq auto-mode-alist
(cons '("\\.css\\'" . css-mode) auto-mode-alist))
(setq cssm-indent-function #'cssm-c-style-indenter)
;; リセットされた場合に UTF-8 に戻す
;; http://0xcc.net/blog/archives/000041.html
(set-default-coding-systems 'utf-8)
;; 矢印などの文字がうまく使用できない問題に対応
;; http://www.pqrs.org/~tekezo/emacs/doc/wide-character/index.html
(utf-translate-cjk-set-unicode-range
'((#x00a2 . #x00a3) ; ¢, £
(#x00a7 . #x00a8) ; §, ¨
(#x00ac . #x00ac) ; ¬
(#x00b0 . #x00b1) ; °, ±
(#x00b4 . #x00b4) ; ´
(#x00b6 . #x00b6) ; ¶
(#x00d7 . #x00d7) ; ×
(#X00f7 . #x00f7) ; ÷
(#x0370 . #x03ff) ; Greek and Coptic
(#x0400 . #x04FF) ; Cyrillic
(#x2000 . #x206F) ; General Punctuation
(#x2100 . #x214F) ; Letterlike Symbols
(#x2190 . #x21FF) ; Arrows
(#x2200 . #x22FF) ; Mathematical Operators
(#x2300 . #x23FF) ; Miscellaneous Technical
(#x2500 . #x257F) ; Box Drawing
(#x25A0 . #x25FF) ; Geometric Shapes
(#x2600 . #x26FF) ; Miscellaneous Symbols
(#x2e80 . #xd7a3) (#xff00 . #xffef)))
mmm-modeを試してみる
次の記事で.emacsをメモしているけど、なぜか上手く動かない。mmm-modeを設定するとcf-modeも何故か動かなくなった。mmm-modeを削除してもcf-modeは復活しない。。
colinuxでetags
colinuxでetagsを使うとき、
etags -e -R –langmap=PHP:+.inc
だとうまくいかなかったので
etags --append --language=php `find . -name "*.php"`
etags --append --language=php `find . -name "*.inc"`
みたいなシェルファイル etags.php を作って /usr/local/bin/ に置いてみた。
emacs で矢印などの文字が使用できない
- 2007/10/02
- その他
Meadow から coLinux 上の emacs に移行してから矢印などの文字を使用すると、なぜか文字が壊れたり表示がおかしくなったりするので使用禁止にしていたが、解決方法を Web で見つけた。
Emacs22 + UTF-8 における文脈依存な文字幅の問題について
(utf-translate-cjk-set-unicode-range
'((#x00a2 . #x00a3) ; ¢, £
(#x00a7 . #x00a8) ; §, ¨
(#x00ac . #x00ac) ; ¬
(#x00b0 . #x00b1) ; °, ±
(#x00b4 . #x00b4) ; ´
(#x00b6 . #x00b6) ; ¶
(#x00d7 . #x00d7) ; ×
(#X00f7 . #x00f7) ; ÷
(#x0370 . #x03ff) ; Greek and Coptic
(#x0400 . #x04FF) ; Cyrillic
(#x2000 . #x206F) ; General Punctuation
(#x2100 . #x214F) ; Letterlike Symbols
(#x2190 . #x21FF) ; Arrows
(#x2200 . #x22FF) ; Mathematical Operators
(#x2300 . #x23FF) ; Miscellaneous Technical
(#x2500 . #x257F) ; Box Drawing
(#x25A0 . #x25FF) ; Geometric Shapes
(#x2600 . #x26FF) ; Miscellaneous Symbols
(#x2e80 . #xd7a3) (#xff00 . #xffef)))
この方法でばっちり表示できるようになった。
mac で etags を使って php 用のタグファイルを作ってみる
symfonyで開発日記 : emacsのetagsを活用する
http://blog.symfony.jp/2007/08/13/emacs-etags/
を参考に。
実行したコマンドは以下。
etags `find . -name "*.php"`
cperl-mode がエラーになって、てこずる
- 2007/09/12
- その他
Index of /modules/by-module/CPAN/ILYAZ/cperl-mode
から cperl-mode をダウンロードして elisp ディレクトリにコピー
そのままだとエラーになるので、emacs から Shift+B でバイトコンパイルして一つ目のエラーはわからないのでコード自体を削除。(? がシンタックスエラー)
次のエラーは以下のページを参考に修正。
Yet Another Hackadelic - cperl-mode で Non-hex digit used for Unicode escape な現象が起きる
会社 PC の .emacs 設定
会社 PC の .emacs 設定
wb-line-number
http://homepage1.nifty.com/blankspace/emacs/wb-line-number.html
kill-summary.el
http://mibai.tec.u-ryukyu.ac.jp/~oshiro/Programs/elisp/kill-summary.el
kill-summary.el の234行目を修正して、truncate-string を truncate-string-to-width に変更
mac で利用する時は、"C-xC-h" を "\C-x\C-h" のように変更する必要がある
;;;; -*- mode: lisp-interaction; syntax: elisp; coding: utf-8-unix -*-
;; ~/elisp をライブラリパスに追加
(setq load-path
(append
(list
(expand-file-name "~/elisp/")
)
load-path))
;; 日本語設定 (UTF-8)
(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
;; ChangeLog の設定
(setq user-full-name "Xxx Xxx")
(setq user-mail-address "xxx@xxx.com")
(defun memo ()
(interactive)
(add-change-log-entry
nil
(expand-file-name "~/memo/diary.txt")))
(define-key ctl-x-map "M" 'memo)
;; タブの基本設定
(setq tab-width 4)
(setq c-basic-offset 4)
;; フォントロックモード (強調表示等) を有効にする
(global-font-lock-mode t)
;; 一時マークモードの自動有効化
(setq-default transient-mark-mode t)
;; C-x C-u が何もしないように変更する (undo の typo 時誤動作防止)
(global-unset-key "C-xC-u")
;; 括弧の対応をハイライト.
(show-paren-mode 1)
;; バッファ末尾に余計な改行コードを防ぐための設定
(setq next-line-add-newlines nil)
;; C-x l で goto-line を実行
(define-key ctl-x-map "l" 'goto-line)
;; 時間を表示
(display-time)
;; 列数表示
(column-number-mode 1)
;; メニューバーを消す
(menu-bar-mode -1)
;; バックアップファイルを作成しない
(setq make-backup-files nil)
;; grep-find の結果に .svn ディレクトリを含まないようにする(mac だとこの方法ではうまくいかない)
(setq grep-find-command "find . -type f -path '*.svn*' -prune -o -print0 | xargs -0 -e grep -nH -e ")
;; C-h でカーソルの左にある文字を消す
(define-key global-map "C-h" 'delete-backward-char)
;; C-h に割り当てられている関数 help-command を C-x C-h に割り当てる
(define-key global-map "C-xC-h" 'help-command)
;; C-z のキーバインドを開放
(global-unset-key "C-z")
;; toggle-truncate-lines を "C-z l" に定義する
(define-key global-map "C-zl" 'toggle-truncate-lines)
;; 画面の左端に行番号を表示できるように
(require 'wb-line-number)
;; "C-z n" に定義する
(define-key global-map "C-zn" 'wb-line-number-toggle)
;; C-o に動的略語展開機能を割り当てる
;;(define-key global-map "C-o" 'dabbrev-expand)
;;(setq dabbrev-case-fold-search nil) ; 大文字小文字を区別
;; 日本語・英語混じり文での区切判定
;; http://www.alles.or.jp/~torutk/oojava/meadow/Meadow210Install.html
(defadvice dabbrev-expand
(around modify-regexp-for-japanese activate compile)
"Modify `dabbrev-abbrev-char-regexp' dynamically for Japanese words."
(if (bobp)
ad-do-it
(let ((dabbrev-abbrev-char-regexp
(let ((c (char-category-set (char-before))))
(cond
((aref c ?a) "[-_A-Za-z0-9]") ; ASCII
((aref c ?j) ; Japanese
(cond
((aref c ?K) "cK") ; katakana
((aref c ?A) "cA") ; 2byte alphanumeric
((aref c ?H) "cH") ; hiragana
((aref c ?C) "cC") ; kanji
(t "cj")))
((aref c ?k) "ck") ; hankaku-kana
((aref c ?r) "cr") ; Japanese roman ?
(t dabbrev-abbrev-char-regexp)))))
ad-do-it)))
;; BS で選択範囲を消す
(delete-selection-mode 1)
;; The local variables list in .emacs と言われるのを抑止
(add-to-list 'ignored-local-variables 'syntax)
;; ミニバッファ中での補完機構を補強
(iswitchb-mode t)
;; kill リングバッファの内容を表示しながらヤンクできるようにする
(autoload 'kill-summary "kill-summary" nil t)
(define-key global-map "ey" 'kill-summary)
;; php-mode
(autoload 'php-mode "php-mode")
(setq auto-mode-alist
(cons '(".php'" . php-mode) auto-mode-alist))
(setq php-mode-force-pear t)
(add-hook 'php-mode-user-hook
'(lambda ()
(setq tab-width 4)
(setq c-basic-offset 4)
(setq indent-tabs-mode nil)
(setq php-manual-path "/usr/local/share/php/doc/html")
(setq php-manual-url "http://www.phppro.jp/phpmanual/")))
;;;; ruby-mode (要 ruby-mode.el)
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '((".rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)))
;; cperl-mode の設定。インデントをいい感じに、他。
(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq cperl-auto-newline t)
(setq cperl-indent-parens-as-block t)
(setq cperl-close-paren-offset -4)
(setq cperl-indent-level 4)
(setq cperl-label-offset -4)
(setq cperl-continued-statement-offset 4)
(setq cperl-highlight-variables-indiscriminately t)
(add-hook 'cperl-mode-hook
(lambda ()
(set-face-italic-p 'cperl-hash-face nil)))
(add-hook 'cperl-mode-hook
'(lambda ()
(define-key cperl-mode-map "C-cc" 'cperl-check-syntax)
(setq indent-tabs-mode nil)))
;; リセットされた場合に UTF-8 に戻す
;; http://0xcc.net/blog/archives/000041.html
(set-default-coding-systems 'utf-8)
macの.emacs設定
現在の.emacsをメモしておきます。会社と家で設定が違うのでなんとか同期かさせたいなあ。でもWindowsとMacなんでそんなわけにもいかないかなー。
;;japanese
(set-language-environment 'Japanese)
;;ChangeLog
(setq user-full-name "Xxx Xxx")
(setq user-mail-address "xxx@xxx.com")
;;not use backupfile
(setq make-backup-files nil)
;;iswitchb-mode
(iswitchb-mode t)
;;transient-mark-mode
(transient-mark-mode t)
;;php
(defun php-mode-hook ()
(setq tab-width 4
c-basic-offset 4
c-hanging-comment-ender-p nil
indent-tabs-mode
(not
(and (string-match "/(PEAR|pear)/" (buffer-file-name))
(string-match ".php$" (buffer-file-name))))))
;;ruby
(autoload 'ruby-mode "ruby-mode"
"Mode for editing ruby source files" t)
(setq auto-mode-alist
(append '((".rb$" . ruby-mode)) auto-mode-alist))
(setq interpreter-mode-alist (append '(("ruby" . ruby-mode))
interpreter-mode-alist))
(autoload 'run-ruby "inf-ruby"
"Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby"
"Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook
'(lambda ()
(inf-ruby-keys)))
(global-font-lock-mode 1)
(setq default-frame-alist
(append
'((foreground-color . "gray") ;
(background-color . "black") ;
(cursor-color . "blue") ;
)
default-frame-alist))
最新の .emacs 設定
- 2007/08/06
- Web開発関連
(cd "~")
(set-language-environment "Japanese")
(mw32-ime-initialize)(setq default-input-method "MW32-IME")
;;euc(setq default-buffer-file-coding-system 'euc-japan-unix)
;;font(create-fontset-from-request "private-fontset" '((width . 8) (height . 16) (fixed . t) (italic . nil)) '((family . "MS ゴシック") (family . "Courier New")))
;; font shinonome(不要なら nil にする)(setq bdf-font-directory-shinonome "D:/apps/Meadow/fonts/shinonome")(setq bdf-use-shinonome12 t bdf-use-shinonome12min t bdf-use-shinonome12maru t bdf-use-shinonome14 t bdf-use-shinonome14min t bdf-use-shinonome16 t bdf-use-shinonome16min t)(load "meadow2-shinonome-fontset")
;;font default set(setq default-frame-alist (append (list '(font . "shinonome16") '(top . 10) '(left . 20) '(width . 81) '(height . 35) ) default-frame-alist))
;;color(global-font-lock-mode t)(require 'font-lock)
;;transient-mark-mode(transient-mark-mode t)
;;line number(require 'setnu)(global-set-key [f12] 'setnu-mode)
;;toggle(global-set-key [f8] 'toggle-truncate-lines)
;;windmove-default-keybindings(windmove-default-keybindings)
;;not use backupfile(setq make-backup-files nil)
;;iswitchb-mode(iswitchb-mode t)
;;shell(setq explicit-shell-file-name "bash.exe")(setq shell-file-name "bash.exe")(setq shell-command-switch "-c")
;;lgrep(setq grep-command "lgrep -n -Ks -Os ")(setq grep-find-command "find . -type f -path '*.svn*' -prune -o -print0 | xargs -0 -e lgrep -n -Ks -Os ")(setq grep-program "lgrep")
;;tab(setq-default tab-width 4)(setq-default c-basic-offset 4)(setq-default indent-tabs-mode nil)
;;php(load-library "php-mode-120")(require 'php-mode)(add-to-list 'auto-mode-alist '(".inc$" . php-mode))(add-to-list 'auto-mode-alist '(".tpl$" . php-mode))(add-to-list 'auto-mode-alist '(".thtml$" . php-mode))(setq php-mode-force-pear t)(add-hook 'php-mode-user-hook '(lambda () (setq tab-width 4) (setq c-basic-offset 4) (setq indent-tabs-mode nil) (setq php-manual-path "~/php/doc/html/") (setq php-manual-url "http://www.phppro.jp/phpmanual/") ) )
;;show-paren-mode(show-paren-mode t)(setq show-paren-style 'mixed)(set-face-background 'show-paren-match-face "gray10")(set-face-foreground 'show-paren-match-face "SkyBlue")
;;svn todo;;(add-to-list 'vc-handled-backends 'SVN)(autoload 'svn-status "psvn" nil t)
;;zengaku space tab(defface my-face-b-1 '((t (:background "medium aquamarine"))) nil)(defface my-face-b-2 '((t (:background "gray26"))) nil)(defface my-face-u-1 '((t (:foreground "SteelBlue" :underline t))) nil)(defvar my-face-b-1 'my-face-b-1)(defvar my-face-b-2 'my-face-b-2)(defvar my-face-u-1 'my-face-u-1)(defadvice font-lock-mode (before my-font-lock-mode ()) (font-lock-add-keywords major-mode '( (" " 0 my-face-b-1 append) ("t" 0 my-face-b-2 append) ("[ ]+$" 0 my-face-u-1 append) )))(ad-enable-advice 'font-lock-mode 'before 'my-font-lock-mode)(ad-activate 'font-lock-mode)(add-hook 'find-file-hooks '(lambda ()(if font-lock-modenil(font-lock-mode t))) t)
- コメント: 0
- トラックバック(閉): 0
ホーム > タグ > emacs