2011年5月22日

タブ, 全角スペース、改行直前の半角スペースを表示する jspace.el

M-x install-elisp [RET]
http://homepage3.nifty.com/satomii/software/jaspace.el [RET]
C-c

で、 init.el は以下。色を若干変更

;; ------------------------------------------------------------------------
;; @ タブ, 全角スペース、改行直前の半角スペースを表示する jspace.el
;; http://openlab.dino.co.jp/2008/08/29/230500336.html
(require 'jaspace)
(setq jaspace-alternate-eol-string "\xab\n")    ; 改行を表示

;; jaspace-mode is not compatible with mmm-mode by default. If you want
;; to use both jaspace-mode and mmm-mode, try:
(add-hook 'mmm-mode-hook 'jaspace-mmm-mode-hook)

(when (require 'jaspace nil t)
  (when (boundp 'jaspace-modes)
    (setq jaspace-modes (append jaspace-modes
                                (list 'php-mode
                                      'yaml-mode
                                      'javascript-mode
                                      'ruby-mode
                                      'text-mode
                                      'fundamental-mode
                                      'ansys-mode))))
  (when (boundp 'jaspace-alternate-jaspace-string)
    (setq jaspace-alternate-jaspace-string "□"))
  (when (boundp 'jaspace-highlight-tabs)
    (setq jaspace-highlight-tabs ?^))
  (add-hook 'jaspace-mode-off-hook
            (lambda ()
              (when (boundp 'show-trailing-whitespace)
                (setq show-trailing-whitespace nil))))
  (add-hook 'jaspace-mode-hook
            (lambda ()
              (progn
                (when (boundp 'show-trailing-whitespace)
                  (setq show-trailing-whitespace t))
                (face-spec-set 'jaspace-highlight-jaspace-face
                               '((((class color) (background light))
                                  (:foreground "blue"))
                                 (t (:foreground "DarkRed"))))
                (face-spec-set 'jaspace-highlight-tab-face
                               '((((class color) (background light))
                                  (:foreground "red"
                                   :background "unspecified"
                                   :strike-through nil
                                   :underline t))
                                 (t (:foreground "DarkGreen"
                                     :background "unspecified"
                                     :strike-through nil
                                     :underline t))))
                (face-spec-set 'trailing-whitespace
                               '((((class color) (background light))
                                  (:foreground "red"
                                   :background "unspecified"
                                   :strike-through nil
                                   :underline t))
                                 (t (:foreground "gray"
                                     :background "unspecified"
                                     :strike-through nil
                                     :underline t))))))))

[QED]
************************************************************************

0 件のコメント:

コメントを投稿