この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
emacs [2013/12/25 11:14] saito [スタートアップスクリーン] |
emacs [2017/10/03 12:55] (現在) |
||
|---|---|---|---|
| ライン 1: | ライン 1: | ||
| ====== emacs ====== | ====== emacs ====== | ||
| + | * emacsの設定は.emacs.d/init.el に書くのが主流らしい. | ||
| * reference.pdf があるとショートカットを覚えるのに便利 | * reference.pdf があるとショートカットを覚えるのに便利 | ||
| * [[http://clip.dia.fi.upm.es/~albegarcia/emacs-reference.pdf]] | * [[http://clip.dia.fi.upm.es/~albegarcia/emacs-reference.pdf]] | ||
| ライン 9: | ライン 10: | ||
| | C-c Enter | (.f90モード) &(改行)&を出力| | | C-c Enter | (.f90モード) &(改行)&を出力| | ||
| + | ===== Frotran90でopenmpに色付け ===== | ||
| + | |||
| + | |||
| + | <code lisp> | ||
| + | ;;; highlight fortran openmp code | ||
| + | ;;; original version is ... | ||
| + | ;;; https://www.pgroup.com/userforum/viewtopic.php?t=5214&sid=51dc5164d4b5962373b0adda3fa62705 | ||
| + | (when (require 'font-lock nil 'noerror ) | ||
| + | |||
| + | (defface openmp-face | ||
| + | '((t | ||
| + | :foreground "#666666" | ||
| + | ;; :background "yellow" | ||
| + | ;; :bold t | ||
| + | )) | ||
| + | "Face for !$ [a-zA-Z] comments" | ||
| + | ) | ||
| + | (defvar openmp-face 'openmp-face) | ||
| + | |||
| + | (defface openmp2-face | ||
| + | '((t | ||
| + | :foreground "#999999" | ||
| + | ;; :background "yellow" | ||
| + | ;; :bold t | ||
| + | )) | ||
| + | "Face for !$OMP comments" | ||
| + | ) | ||
| + | (defvar openmp2-face 'openmp2-face) | ||
| + | |||
| + | |||
| + | (defvar omp-regex "$[\t ][a-zA-Z].*") | ||
| + | (defvar omp-regex2 "$omp[\t ].*") | ||
| + | (defvar omp-regex-f90 (concat "^[ \t]*\\(!" omp-regex "\\)" ) ) | ||
| + | (defvar omp-regex2-f90 (concat "^[ \t]*\\(!" omp-regex2 "\\)" ) ) | ||
| + | |||
| + | (font-lock-add-keywords 'f90-mode | ||
| + | ( list | ||
| + | ( list omp-regex-f90 1 'openmp-face t) | ||
| + | ( list omp-regex2-f90 1 'openmp2-face t) | ||
| + | )) | ||
| + | |||
| + | ) | ||
| + | </code> | ||
| + | |||
| + | ===== Changelog memo ===== | ||
| + | http://0xcc.net/unimag/1/ | ||
| + | |||
| + | Ctrl-c M とするとChangelog mode でdiary.txtが立ち上がる. | ||
| + | ~/memo/diary.txt をDropbox内のファイルに変更しておくと幸せになれる. | ||
| + | <code lisp> | ||
| + | (defun memo () | ||
| + | (interactive) | ||
| + | (add-change-log-entry | ||
| + | nil | ||
| + | (expand-file-name "~/memo/diary.txt"))) | ||
| + | (define-key ctl-x-map "M" 'memo) | ||
| + | </code> | ||
| + | |||
| + | 名前やアドレスの設定 | ||
| + | <code lisp> | ||
| + | (setq user-full-name "hoge piyo") | ||
| + | (setq user-mail-address "...@???.com") | ||
| + | </code> | ||
| + | |||
| + | ===== Headline ===== | ||
| + | 起動時にウィンドウが2つに割れないようにする. | ||
| + | <code> | ||
| + | (setq inhibit-startup-message t) | ||
| + | </code> | ||
| ===== テキストの印刷 ===== | ===== テキストの印刷 ===== | ||
| + | emacsで<code> | ||
| C-u M-x ps-print-buffer-with-faces | C-u M-x ps-print-buffer-with-faces | ||
| - | でpsファイルにカラーのまま出力. | + | </code>でpsファイルにカラーのまま出力. |
| 白黒でよければ, | 白黒でよければ, | ||
| - | C-u M-x ps-print-buffer | + | <code>C-u M-x ps-print-buffer</code> |
| + | |||
| + | psファイルをpdfにしておけば,タブレットでも見れる. | ||
| + | 以下は端末でのコマンド. | ||
| + | <code bash> ps2pdf file.ps</code> | ||
| + | |||
| + | |||
| + | 細かい字でも平気な人は以下の設定でOK. http://www.emacswiki.org/emacs/PsPrint | ||
| + | <code> | ||
| + | (setq ps-paper-type 'a4 | ||
| + | ps-font-size 7.0 | ||
| + | ps-print-header nil | ||
| + | ps-landscape-mode t | ||
| + | ps-number-of-columns 2) | ||
| + | </code> | ||
| ===== エラーメッセージ ===== | ===== エラーメッセージ ===== | ||
| <code> | <code> | ||
| ライン 60: | ライン 145: | ||
| http://www.bookshelf.jp/soft/meadow_42.html#SEC634 | http://www.bookshelf.jp/soft/meadow_42.html#SEC634 | ||
| http://www.emacswiki.org/emacs/?action=browse;oldid=TagFile;id=TagsFile | http://www.emacswiki.org/emacs/?action=browse;oldid=TagFile;id=TagsFile | ||
| + | |||
| + | ====コンパイラオプションを付けてもエラーの行数が出ない==== | ||
| + | |||
| + | <code bash> | ||
| + | sudo apt-get install gdb | ||
| + | gfortran ◯◯◯◯.f90 -g -fbounds-check | ||
| + | gdb ./a.out | ||
| + | </code> | ||
| + | 実行するには | ||
| + | <code bash> | ||
| + | run | ||
| + | </code> | ||
| + | 抜け出すには | ||
| + | <code bash> | ||
| + | quit | ||
| + | </code> | ||
| + | =====起動時の下の画面を消す===== | ||
| + | 端末で下のようにファイルを作る. | ||
| + | <code bash> | ||
| + | emacs .emacs.d/init.el& | ||
| + | </code> | ||
| + | できたファイルに下記のものを貼る. | ||
| + | <code bash> | ||
| + | (setq inhibit-startup-message t) | ||
| + | (put 'upcase-region 'disabled nil) | ||
| + | </code> | ||
| + | その他の便利な機能はgoogleで,「emacs init.el」で検索すると出るはず. | ||
| ===== 背景を黒く ===== | ===== 背景を黒く ===== | ||
| 背景が黒の方が目にやさしいらしい。 | 背景が黒の方が目にやさしいらしい。 | ||
| - | .zshrcか何かに、 | + | .zshrcか.bashrcか何かに、 |
| <code bash> | <code bash> | ||
| alias emacs='emacs -r' | alias emacs='emacs -r' | ||
| ライン 125: | ライン 237: | ||
| (anthy-change-hiragana-map "," ",") | (anthy-change-hiragana-map "," ",") | ||
| (anthy-change-hiragana-map "." ".") | (anthy-change-hiragana-map "." ".") | ||
| - | </code> | ||
| - | |||
| - | ===== スタートアップスクリーン ===== | ||
| - | デフォルトで分割されている窓を1つに | ||
| - | <code lisp> | ||
| - | (custom-set-variables | ||
| - | '(inhibit-startup-screen t)) | ||
| - | (custom-set-faces | ||
| - | ) | ||
| </code> | </code> | ||
| ライン 182: | ライン 285: | ||
| </code> | </code> | ||
| - | ===== emacs.elのサンプル ===== | ||
| - | <code lisp> | ||
| - | (setq ps-multibyte-buffer 'non-latin-printer) | ||
| - | (require 'ps-mule) | ||
| - | (defalias 'ps-mule-header-string-charsets 'ignore) | ||
| - | (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. | ||
| - | '(inhibit-startup-screen t)) | ||
| - | (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. | ||
| - | ) | ||
| - | |||
| - | |||
| - | ;;*.texで自動的にYaTeXモード | ||
| - | (setq auto-mode-alist | ||
| - | (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) | ||
| - | (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) | ||
| - | ;;TeX typeset | ||
| - | (setq tex-command "platex") | ||
| - | ;;dvi preview | ||
| - | (setq dvi2-command "xdvi") | ||
| - | ;; Kanji code | ||
| - | ;;; 1=Shift JIS | ||
| - | ;;; 2=JIS | ||
| - | ;;; 3=EUC | ||
| - | (setq YaTeX-kanji-code 3) | ||
| - | ;;use LaTeX2e and AMS-LaTeX | ||
| - | (setq YaTeX-use-LaTeX2e t) | ||
| - | (setq YaTeX-use-AMS-LaTeX t) | ||
| - | ;;font latex hook | ||
| - | (add-hook 'yatex-mode-hook | ||
| - | '(lambda () (require 'font-latex) | ||
| - | (font-latex-setup))) | ||
| - | ;;RefTeX mode | ||
| - | ;(add-hook 'yatex-mode-hook '(lambda () (reftex-mode t))) | ||
| - | ;;auto fill mode | ||
| - | ;(add-hook 'yatex-mode-hook '(lambda () (auto-fill-mode t) (setq fill-column 70))) | ||
| - | ;;color | ||
| - | ;;(setq YaTeX-use-font-lock t) | ||
| - | ;; section color | ||
| - | ;;(setq YaTeX-hilit-sectioning-face '(light時のforecolor/backcolor dark時の forecolor/backcolor)) | ||
| - | ;;(setq YaTeX-hilit-sectioning-face '(white/snow3 snow1/snow3)) | ||
| - | ;(add-hook 'yatex-mode-hook | ||
| - | ;'(lambda () (require 'font-latex) | ||
| - | ; (font-latex-setup) | ||
| - | ; (progn | ||
| - | ; (modify-syntax-entry ?% "<" (syntax-table)) | ||
| - | ; (modify-syntax-entry 10 ">" (syntax-table)) | ||
| - | ; (make-variable-buffer-local 'outline-level) | ||
| - | ; (setq outline-level 'latex-outline-level) | ||
| - | ; (make-variable-buffer-local 'outline-regexp) | ||
| - | ; (setq outline-regexp | ||
| - | ; (concat "[ \t]*\\\\\\(documentstyle\\|documentclass\\|chapter\\|" | ||
| - | ; "section\\|subsection\\|subsubsection\\|paragraph\\)" | ||
| - | ; "\\*?[ \t]*[[{]") | ||
| - | ; )))) | ||
| - | ;;outline-minor-mode | ||
| - | ;(add-hook 'yatex-mode-hook '(lambda () (outline-minor-mode t))) | ||
| - | ;(setq-default outline-level 'outline-level) | ||
| - | ; | ||
| - | ;(defun latex-outline-level () | ||
| - | ; (save-excursion | ||
| - | ; (looking-at outline-regexp) | ||
| - | ; (let ((title (buffer-substring (match-beginning 1) (match-end 1)))) | ||
| - | ; (cond ((equal (substring title 0 4) "docu") 20) | ||
| - | ; ((equal (substring title 0 4) "para") 15) | ||
| - | ; ((equal (substring title 0 4) "chap") 0) | ||
| - | ; ((equal (substring title 0 4) "appe") 0) | ||
| - | ; (t (length title)))))) | ||
| - | ; | ||
| - | ;;misc mode | ||
| - | ;(add-hook 'yatex-mode-load-hook | ||
| - | ; (function | ||
| - | ; (lambda () | ||
| - | ; (YaTeX-define-key "w" 'sdic-describe-word) | ||
| - | ; (YaTeX-define-key "\C-w" 'YaTeX-switch-mode-menu)))) | ||
| - | ; | ||
| - | ;math-sign の追加 | ||
| - | ; | ||
| - | ;(setq | ||
| - | ; YaTeX-math-sign-alist-private | ||
| - | ; '( | ||
| - | ; ("q" "Q" "(Q)") | ||
| - | ; ("z" "Z" "ZZ") | ||
| - | ; ("t""text""text") | ||
| - | ; ("qu" "quad" "__") | ||
| - | ; ("qq" "qquad" "____") | ||
| - | ; ("ls" "varlimsup" "___\nlim") | ||
| - | ; ("li" "varliminf" "lim\n---") | ||
| - | ; ("il" "varinjlim" "lim\n-->") | ||
| - | ; ("pl" "varprojlim" "lim\n<--") | ||
| - | ; ("st" "text{ s.t. }" "s.t.") | ||
| - | ; ("bigop" "bigoplus" "_\n(+)~") | ||
| - | ; ("bigot" "bigotimes" "_\n(x)\n ~") | ||
| - | ; )) | ||
| - | ;;dvipdfmxの追加 | ||
| - | ;; dviからpdfを作成する%sはファイル名 | ||
| - | (setq dviprint-command-format "dvipdfmx %s") | ||
| - | ;; latexmkを使う場合 | ||
| - | ; (setq tex-command "latexmk -dvi") | ||
| - | ;;mendexの指定 † | ||
| - | ;(setq makeindex-command "mendex") | ||
| - | ;;テンプレート | ||
| - | ;; ~/.LaTeX-templateは新規ファイル作成時に自動挿入するファイル名 | ||
| - | ;(setq YaTeX-template-file "~/.LaTeX-template") | ||
| - | |||
| - | ;;;==================================== | ||
| - | ;;;; print - 印刷設定 | ||
| - | ;;;==================================== | ||
| - | ;;; Postscript で印刷 | ||
| - | (setq print-command-format "a2psj| lpr") | ||
| - | (defun print-region (begin end) | ||
| - | (interactive "r") | ||
| - | (shell-command-on-region begin end print-command-format)) | ||
| - | (defun print-buffer () | ||
| - | (interactive) | ||
| - | (print-region (point-min) (point-max))) | ||
| - | (setq print-function (function print-buffer)) | ||
| - | </code> | ||