Adult-Oriented Punk!

+ Cygwin で emacs メモ

last mod.2020/05/08 

lucidasanstypewriter-12 フォントセットで大体シアワセだけど、日本語をMSゴシックの12にするともっと幸せ。以下メモ。

Cygwin X jp のフォントのやつもらってきて
/home/kuruma-k/.ttfonts/
に入れる。

$ \ls -log
合計 54
lrwxrwxrwx 1    35 Jan  5  2006 arial.ttf -> /cygdrive/c/WINDOWS/Fonts/arial.ttf
lrwxrwxrwx 1    37 Jan  5  2006 arialbd.ttf -> /cygdrive/c/WINDOWS/Fonts/arialbd.ttf
lrwxrwxrwx 1    37 Jan  5  2006 arialbi.ttf -> /cygdrive/c/WINDOWS/Fonts/arialbi.ttf
lrwxrwxrwx 1    36 Jan  5  2006 ariali.ttf -> /cygdrive/c/WINDOWS/Fonts/ariali.ttf
-rw-r--r-- 1  5224 Jan  5  2006 encodings.dir
-rw-r--r-- 1  2610 Jan  5  2006 fonts.alias
-rw-r--r-- 1 15684 Jan  5  2006 fonts.dir
-rw-r--r-- 1 15684 Jan  5  2006 fonts.scale
lrwxrwxrwx 1    38 Jan  5  2006 msgothic.ttc -> /cygdrive/c/WINDOWS/Fonts/msgothic.ttc
lrwxrwxrwx 1    38 Jan  5  2006 msmincho.ttc -> /cygdrive/c/WINDOWS/Fonts/msmincho.ttc
lrwxrwxrwx 1    35 Jan  5  2006 times.ttf -> /cygdrive/c/WINDOWS/Fonts/times.ttf
lrwxrwxrwx 1    37 Jan  5  2006 timesbd.ttf -> /cygdrive/c/WINDOWS/Fonts/timesbd.ttf
lrwxrwxrwx 1    37 Jan  5  2006 timesbi.ttf -> /cygdrive/c/WINDOWS/Fonts/timesbi.ttf
lrwxrwxrwx 1    36 Jan  5  2006 timesi.ttf -> /cygdrive/c/WINDOWS/Fonts/timesi.ttf
$ 

メモ:
startup.tgz の instal.sh のうち、ttfonts のところだけ実行したら幸せになった。この辺。
i=ttfonts
cd "$HOME/.$i";
ln -s `cygpath -u $WINDIR`/Fonts/ms*.ttc .
ln -s `cygpath -u $WINDIR`/Fonts/arial*.ttf .
ln -s `cygpath -u $WINDIR`/Fonts/times*.ttf .

mystartxwin.bat の記述
%RUN% XWin -multiwindow -clipboard -silent-dup-error

:WAIT1
@echo waiting...
sleep 1
if not exist %CYGWIN_ROOT%\tmp\.X11-unix\X0 goto WAIT1

xset fp+ /home/kuruma-k/.ttfonts
xrdb -nocpp -merge /home/kuruma-k/.Xresources
(Xが立ち上がる前にxsetとかしても上手く行かない)


.Xresources
Emacs.Fontset-0:-*-fixed-medium-*-normal-*-12-*-*-*-*-*-fontset-myFixedFontset1,\
	ascii:-*-lucidatypewriter-medium-r-*-*-12-*-*-*-m-*-iso8859-*,\
	japanese-jisx0208:-aliastt-gothic-medium-*-normal-*-12-*-*-*-c-*-jisx0208.1990-*,\
	katakana-jisx0201:-aliastt-gothic-medium-*-normal-*-12-*-*-*-c-*-jisx0201.1976-*

メモ:一行目の書き方
Emacs.Fontset-一意となる番号:フォントセット名

M-x list-fontsets
で出てくる名前は、上記※1。

.emacs の default-frame-alist 記述
(font . "フォントセット名")

例だと
(font . "-*-fixed-medium-*-normal-*-12-*-*-*-*-*-fontset-myfixedfontset1")

どうも端末がそのようなキーコードを送っているらしい...
とりあえず、Windowsの設定で環境変数 CYGWIN を
CYGWIN=tty notitle glob
にしたら解消。

メモ:
CYGWIN 環境変数

メモ:終われないよ...のためのメモ
M-x kill-emacs
M-x save-buffers-kill-emacs

未解消。
stty erase ^?
で動きは変わったが...

;; 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)
))

;; kuruma
;;(setq-default tab-width 8)

;;(set-default-coding-systems)
;;(default-value 'buffer-file-coding-system) ;;japanese-shift-jis
;;default-buffer-file-coding-system
;;default-file-name-coding-system
;;default-keyboard-coding-system
;;default-process-coding-system
;;default-terminal-coding-system

;;(setq default-buffer-file-coding-system 'japanese-shift-jis) ;;'shift_jis
(setq default-buffer-file-coding-system 'japanese-iso-8bit) ;;'euc-japan
;;(setq default-buffer-file-coding-system 'utf-8)

(define-key global-map "\C-z" 'undo)
(define-key global-map "\M-o" 'other-window)
(define-key global-map "\M-\C-o" 'other-frame)
(define-key global-map "\C-cg" 'goto-line)
;;(define-key global-map [zenkaku-hankaku] 'toggle-input-method)
;;(define-key global-map [zenkaku-hankaku] 'skk-mode)
;;(define-key skk-j-mode-map [henkan] 'skk-insert)
(define-key global-map "\C-xl" "\C-x#")
(define-key global-map "\M-:" 'kill-comment)
(define-key global-map "\M-[2~" 'overwrite-mode) ;; for PuTTY
(define-key global-map "\M-[3~" 'delete-char)    ;; for PuTTY
(define-key global-map "\M-[5~" (lambda () (interactive) (scroll-down 5)) ) ;; wheel
(define-key global-map "\M-[6~" (lambda () (interactive) (scroll-up 5)) ) ;; wheel
(defun toggle-dedicate () 
  "toggle dedicate status"
  (interactive)
  (let ((d (not (window-dedicated-p (selected-window)))))
    (set-window-dedicated-p (selected-window) d)
    (if d
	(message "dedicated.")
      (message "not dedicated."))
    ))
(define-key global-map [f1] 'toggle-dedicate)
(define-key global-map [(shift f1)] '(lambda () (interactive) (message "ahya!")))
(define-key global-map [f2] "\C-xe")
(define-key global-map [f3] "\C-x(")
(define-key global-map [f4] "\C-x)")
(define-key global-map [f5] 'toggle-truncate-lines)
(define-key global-map [f6] 'bury-buffer)
(define-key global-map [f7] '(lambda ()
			(interactive)
			(setq tab-width (- tab-width 1))
			(redraw-display)
			(message "tab-width = %d" tab-width)))
(define-key global-map [f8] '(lambda ()
			(interactive)
			(setq tab-width (+ tab-width 1))
			(redraw-display)
			(message "tab-width = %d" tab-width)))
(define-key global-map [f9] "\M--3\C-x^")
(define-key global-map [f10] "\M-3\C-x^")
(define-key global-map [f11] "\M-6\C-x{")
(define-key global-map [f12] "\M-6\C-x}")

(eval-after-load "dired"
  '(progn
     (fset 'dired-find-file-eucjp "\C-x\C-mceuc-japan\C-mf")
     (define-key dired-mode-map "e" 'dired-find-file-eucjp)
     ))

;;
(load-library "generic-x")

;;
(utf-translate-cjk-mode 1)

;;
(setq directory-free-space-program nil)


;; frame title
;; hint: frame-title-format, icon-title-format
(setq frame-title-format
      ;;original... '(multiple-frames "%b" ("" invocation-name "@" system-name))
      '("[E] %b @" system-name ":" default-directory)
      )


(server-start)

;;
;; '(default-frame-alist (quote ((tool-bar-lines . 0) (menu-bar-lines . 0) (font . "lucidasanstypewriter-12")
;; (foreground-color . "white") (background-color . "gray20") (cursor-color . "red") (mouse-color . "red"))))

(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.
 '(auto-compression-mode t nil (jka-compr))
 '(auto-revert-interval 1)
 '(backup-directory-alist (quote ((".*" . "~/.emacsbak"))))
 '(c++-font-lock-extra-types (quote ("\\sw+_t" "\\([iof]\\|str\\)+stream\\(buf\\)?"
"ios" "string" "rope" "list" "slist" "deque" "vector" "bit_vector" "set" "multiset" "map" "multimap"
"hash\\(_\\(m\\(ap\\|ulti\\(map\\|set\\)\\)\\|set\\)\\)?"
"stack" "queue" "priority_queue" "type_info" "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator"
"reference" "const_reference" "u_?\\(int\\|long\\|short\\|char\\)")))
 '(c-default-style (quote ((c-mode . "cc-mode") (c++-mode . "cc-mode") (java-mode . "java"))))
 '(c-echo-syntactic-information-p t)
 '(c-font-lock-extra-types (quote ("FILE" "\\sw+_t" "Lisp_Object" "u_?\\(int\\|long\\|short\\|char\\)")))
 '(c-offsets-alist (quote ((inline-open . 0) (member-init-cont . c-lineup-dont-change))))
 '(c-tab-always-indent nil)
 '(comint-scroll-to-bottom-on-input t)
 '(default-frame-alist (quote ((tool-bar-lines . 0) (menu-bar-lines . 0)
(font . "-*-fixed-medium-*-normal-*-12-*-*-*-*-*-fontset-myfixedfontset1")
(foreground-color . "white") (background-color . "gray20") (cursor-color . "red") (mouse-color . "red"))))
 '(dired-listing-switches "-alog")
 '(dired-recursive-copies t)
 '(explicit-shell-file-name "/bin/bash")
 '(generic-define-mswindows-modes t)
 '(global-auto-revert-mode t nil (autorevert))
 '(ls-lisp-verbosity nil)
 '(revert-without-query (quote (".log$")))
 '(same-window-buffer-names (quote ("*shell*" "*mail*" "*info*" "*inferior-lisp*" "*ielm*" "*scheme*" "*Buffer List*")))
 '(same-window-regexps (quote ("\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)"
"\\*telnet-.*\\*\\(\\|<[0-9]+>\\)" "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)"
"\\*gud-.*\\*\\(\\|<[0-9]+>\\)"
"\\`\\*Customiz.*\\*\\'" "\\*Man .*\\*")))
 '(scroll-step 1)
 '(skk-egg-like-newline t)
 '(tooltip-mode nil nil (tooltip))
 '(truncate-lines t)
 '(woman-fill-frame 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.
 '(ediff-even-diff-face-Ancestor ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-even-diff-face-B ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-face-A ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(ediff-odd-diff-face-C ((((class color)) (:background "Grey" :foreground "Blue"))))
 '(font-lock-comment-face ((((class color) (background dark)) (:foreground "forestgreen"))))
 '(font-lock-function-name-face ((nil (:foreground "skyblue")))))

(put 'narrow-to-region 'disabled nil)