Emacs (Mule)の勧め 若い学生の皆さんは Linux系の計算機を使う機会がこれから多々あるでしょう。 Linux 上で editor でプログラムやTEX sourceを編集する時には Emacs に慣れていると便利です。 (windows で編集して Linux Machineに送るという人は別) |
|
細かいことを書いている暇はないので例えば下記のホームページを参照して下さい。 ・GNU Emacs の使い方 (English) ・Emacsをわたし色に染めて(休刊中,言語毎に予約語を色つきにする等) ・Emacsで編集しているソースファイルを色つきに ・YaTex (Emacs上でTeX sourceの編集とコンパイル,プレヴュー) ・XEmacs 表1 .emacsの例 (下の方に野鳥(YaTeX)の設定スクリプトがあります。) [説明抜き] ;; Red Hat Linux default .emacs initialization file ;; Are we running XEmacs or Emacs? (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) ;; Turn on font-lock mode for Emacs (cond ((not running-xemacs) (global-font-lock-mode t) )) ;; Visual feedback on selections (setq-default transient-mark-mode t) ;; Always end a file with a newline (setq require-final-newline t) ;; Stop at the end of the file, not just add lines (setq next-line-add-newlines nil) ;; Enable wheelmouse support by default (cond (window-system (mwheel-install) )) (custom-set-variables '(load-home-init-file t t)) (custom-set-faces) ;; ;; Sample configuration file for XEmacs. ;; ;; Author TurboLinux Japan ;; Date Sun Mar 19 2000 ;; (setq lang (getenv "LANG")) (if (or (equal lang "ja_JP.eucJP") (equal lang "ja_JP.ujis") (equal lang "ja_JP.EUC") (equal lang "japanese.euc")) (progn ;; Japanese configuration (set-language-environment 'japanese) (set-default-coding-systems 'euc-jp) (set-default-buffer-file-coding-system 'euc-jp) (set-buffer-file-coding-system-for-read 'euc-jp) (set-pathname-coding-system 'euc-jp) (set-keyboard-coding-system 'euc-jp) (set-terminal-coding-system 'euc-jp) (setq coding-system-for-read 'euc-jp))) ;; key binding (global-set-key [f1] 'help-command) ;; F1 Help (global-set-key [f2] 'undo) ;; F2 Undo (global-set-key [f3] 'find-file) ;; F3 Open a file (global-set-key [f4] 'set-mark-command) ;; F4 Region start (global-set-key [f5] "\M-w") ;; F5 Copy resion (global-set-key [f6] "\C-y") ;; F6 Paste/Yank (global-set-key [f7] 'save-buffer) ;; F7 Save buffer (global-set-key [f8] 'start-kbd-macro) ;; F8 Start keyboard macro (global-set-key [f9] 'end-kbd-macro) ;; F9 End keyboard macro (global-set-key [f10] 'call-last-kbd-macro) ;; F10 Run a macro (if (eq window-system 'x) () (progn (global-set-key "\C-h" 'backward-delete-char) ;; Change C-h to delete )) ;; font-lock mode configuration (setq font-lock-use-default-fonts nil) (setq font-lock-use-default-colors nil) (require 'font-lock) (set-face-foreground 'font-lock-string-face "forest green") (copy-face 'italic 'font-lock-comment-face) (set-face-underline-p 'font-lock-comment-face nil 'global 'tty) (set-face-highlight-p 'font-lock-comment-face t 'global 'tty) (copy-face 'font-lock-comment-face 'font-lock-doc-string-face) (set-face-foreground 'font-lock-comment-face "red") (copy-face 'bold 'font-lock-function-name-face) (set-face-foreground 'font-lock-function-name-face "blue") ;; misc. faces (and (find-face 'font-lock-preprocessor-face) ; 19.13 and above (copy-face 'bold 'font-lock-preprocessor-face)) (copy-face 'italic 'font-lock-type-face) (copy-face 'bold 'font-lock-keyword-face) ;; Display time (display-time) ;; Display line and column number (line-number-mode 1) (column-number-mode 1) (setq line-number-mode t) ;; Input Japanese with egg Wnn6 ;(select-input-method "japanese-egg-wnn") ;; change 'nn' to 'n' ('N' is in "Wa Wo N") ;(setq enable-double-n-syntax t) ; Input Japanese with Canna ;(select-input-method "japanese-canna") ;; Mew configuration ;(autoload 'mew "mew" nil t) ;(autoload 'mew-send "mew" nil t) ;(setq mew-mail-domain-list '("yourdomain.co.jp")) ;(setq mew-icon-directory "/usr/lib/xemacs/site-packages/etc/mew/") ;; Wheel mouse (autoload 'mwheel-install "mwheel" "Enabal mouse wheel support.") (mwheel-install) ;; Function-menu configuration ;(require 'func-menu) ;(define-key global-map 'f8 'function-menu) ;(add-hook 'find-file-hooks 'fume-add-menubar-entry) ;(define-key global-map "\C-cl" 'fume-list-functions) ;(define-key global-map "\C-cg" 'fume-prompt-function-goto) ; ;; The Hyperbole information manager package uses (shift button2) and ;; (shift button3) to provide context-sensitive mouse keys. If you ;; use this next binding, it will conflict with Hyperbole's setup. ;; Choose another mouse key if you use Hyperbole. ;(define-key global-map '(shift button3) 'mouse-function-menu) ; ;;; For descriptions of the following user-customizable variables, ;;; type C-h v <variable> ;(setq fume-max-items 25 ; fume-fn-window-position 3 ; fume-auto-position-popup t ; fume-display-in-modeline-p t ; fume-menubar-menu-location "File" ; fume-buffer-name "*Function List*" ; fume-no-prompt-on-valid-default nil) ;) ;------------------------------------------------------------------------------- ; (set-face-background 'default "Powderblue") ; background (set-face-background 'default "AntiqueWhite") ; background (set-face-foreground 'default "Darkslategray") ; text (set-face-background 'zmacs-region "Lightpink") ; when selecting mouse (set-face-foreground 'zmacs-region "Black") (set-face-background 'isearch "Steelblue") ; When highlighting while searching (set-face-foreground 'isearch "White") (set-face-background 'highlight "Seagreen") ; when selecting buffers (set-face-foreground 'highlight "White") (set-face-background 'modeline "Gray") ; bottom of buffer (set-face-foreground 'modeline "Black") ;------------------------------------------------------------------------------- (setq fortran-mode-hook '(lambda () (abbrev-mode 1) (setq scroll-step 1) (setq fortran-continuation-char 38) (setq fortran-check-all-num-for-matching-do 't) (setq fortran-do-indent 2) (setq fortran-if-indent 2) (setq fortran-continuation-indent 2) (setq fortran-line-number-indent 5) (setq fortran-comment-line-column 1) (setq fortran-comment-region "c ") (setq fortran-comment-indent-style 'nil) (local-set-key "\C-M" 'reindent-then-newline-and-indent) (local-set-key "\C-Cr" 'fortran-comment-region) (local-set-key "\C-J" 'fortran-split-line))) ;------------------------------------------------------------------------------- ;;;; YaTeX (野鳥) ;; yatex-mode を起動させる設定 (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) ;; 野鳥が置いてある directry の load-path 設定 ;; default で load-path が通っている場合は必要ありません (setq load-path (cons (expand-file-name "/usr/local/lib/xemacs/site-lisp/yatex") load-path)) ;; 文章作成時の漢字コードの設定 ;; 1 = Shift_JIS, 2 = ISO-2022-JP, 3 = EUC-JP ;; default は 2 (setq YaTeX-kanji-code 3) ; euc-jp ;;YaTeX プルダウンメニュー (setq tex-command "platex" dvi2-command "pxdvi -s 4" dviprint-command-format "pdvips %s") ;;YaTeX オンラインヘルプ (setq YaTeX-help-file "/usr/local/lib/xemacs/site-lisp/YATEXHLP.jp") ;;YaHTMLの設定 (setq auto-mode-alist (cons (cons "\\.htm$" 'yahtml-mode) auto-mode-alist)) (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (setq auto-mode-alist (cons (cons "\\.shtml$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) (setq yahtml-kanji-code 1) ;; 1=Shift JIS, 2=JIS, 3=EUC ;; auto-insert-mode の設定 : HTML のテンプレートを挿入 ;; 新しいファイルをオープンするとき, ;; skelton.html というファイルを挿入するかどうか尋ねられます (if (boundp 'auto-insert-alist) (setq auto-insert-alist (cons '((yahtml-mode . "YaHTML mode") . "skelton.htm") auto-insert-alist))) ;; YaHTML のプレビュアーを netscape モードにする (setq yahtml-www-browser "netscape") ;; YaHTML のプレビュアーのパス ;; 下の例だと, file:///home/simm/data/www/... を ;; http://www.hogehoge.ne.jp/~simm/... とよみかえてくれます ;(setq yahtml-path-url-alist ; '(("/home/simm/data/www" . "http://www.hogehoge.ne.jp/~simm"))) ;; YaHTML モードのキーバインド (add-hook 'yahtml-mode-hook (function lambda() (yahtml-define-begend-key "bp" "p" yahtml-prefix-map) (yahtml-define-begend-key "bP" "pre" yahtml-prefix-map))) |