wiki:Emacs

Version 40 (modified by munepi, 13 years ago) (diff)

--

Emacs

Vine Linux 6

  • emacs: 23.3
  • emacs24: 24.0.50

TODO

  • 5.x でやり残した TODO の洗い出し
  • Vine Linux 向けの Emacs Policy みたいなものを考える
  • 第1回 Emacs会議 を開き、意見を求める
  • Vine Linuxユーザの集い 2010.03 の「Emacsの"vine-default"について」を整理する
  • Debian の emacs flavor について、資料を集める
  • update-alternatives の priority 値のつけ方
  • after-vine-default-setup-hook 廃止への未対応
    • vine-default-scim-bridge.el
    • vine-default-ibus-el.el
    • ... 要調査

vine-default

vine-default の仕組みを新しくしました  VineSeed:22246

新しい仕組み

vine-default を呼ぶタイミングの改善しました。

  1. /usr/share/emacs-24.0.50/site-lisp/site-start.el
  2. /etc/emacs-24.0.50/site-start.d/XX-package-init.el (X ∈ {0, 1, 2,..., 9})
  3. /etc/emacs/emacs24-local.el
  4. vine-default 用設定ファイル
    • ${HOME}/.emacs.d/emacs24-vine-default.el
  5. vine-default-setup を実行
    • /usr/share/emacs-24.0.50/site-lisp/
      • vine-default-base.el, vine-default-faces.el
      • PACKAGE/vine-default-PACKAGE.el
  6. デフォルトのユーザ初期設定ファイル
    • ${HOME}/.emacs.d/init.el
      • バージョン分岐用ファイルとして想定
      • 必要に応じて、ユーザ初期設定ファイルおよびカスタムファイルを指定
        • ${HOME}/.emacs.d/emacs24-init.el
        • ${HOME}/.emacs.d/emacs24-custom.el

これにより、今後は after-vine-default-setup-hook を廃止します。 一部の PACKAGE/vine-default-PACKAGE.el で after-vine-default-setup-hook にひっかけているものがあるので、 しばらくの間は暫定的に残しておきます。

site-start.el

from site-start.el.emacs24 of emacs24-24.0.50-8.20110413vl6

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GNU Emacs EMACS_VERSION default settings for Vine Linux
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq emacs-build-system 
      (concat emacs-build-system ", modified for Vine Linux"))

(setq report-emacs-bug-address "Vine@vinelinux.org")

(defcustom emacs-ime (getenv "EMACS_IME")
  "A variable of default Input Method Editor"
  :type 'string)
(if (null emacs-ime)
    (setq emacs-ime "ibus-el"))

(defconst vine-default-major-version VINE_DEFAULT_MAJOR_VERSION "\
Major version number of this version of vine-default.
This variable equals the major version number of Vine Linux that is running.")

(defconst vine-default-minor-version 0 "\
Minor version number of this version of vine-default.
This variable is the system number for vine-default-major-version.")

(defconst vine-default-version (+ vine-default-major-version (/ (float vine-default-minor-version) 10)) "\
The version of vine-default.")

(defcustom vine-default t
  "A boolean for all Vine Linux default settings"
  :type 'boolean)
(if (equal (getenv "LOGNAME") "root") 
    (setq vine-default nil))

(defcustom vine-default-base t
  "A boolean for vine-default-base"
  :type 'boolean)

(defcustom vine-default-faces t
  "A boolean for vine-default-faces"
  :type 'boolean)

(defvar vine-default-setup-hook nil
  "List of functions to be called at vine-default-setup")

;; (defvar after-vine-default-setup-hook nil 
;;   "This hook is obsolete! Please do not use this hook. 
;;    List of functions to be called at the end of vine-default-setup")

(defun vine-default-setup ()
  "A function for setup to default configurations of Vine Linux"
  (when vine-default
    (message "Starting vine-default-setup ...")
    (when vine-default-base 
      (message "Loading vine-default-base ...")
      (require 'vine-default-base))
    (when vine-default-faces 
      (message "Loading vine-default-faces ...")
      (require 'vine-default-faces))
    (run-hooks 'vine-default-setup-hook)
    ;; (run-hooks 'after-vine-default-setup-hook); obsolete
    )
  )

(defun show-vine-default ()
  "A function to show current vine-default configurations"
  (interactive)
  (shell-command 
   "/usr/lib/emacsen-common/show-vine-default.sh EMACS_VERSION"))

(defun drop-vine-default-from-load-path (regex)
  "A function to drop a path matching to REGEX from load-path"
  (setq load-path
	(let (list)
	  (dolist (x (reverse load-path) list)
	    (unless (string-match regex x)
	      (setq list (cons x list))))
	  )
	)
  )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; run functions from the /etc/emacs-EMACS_VERSION/site-start.d directory
;;; Files in this directory ending with ".el" are run on startup
(mapc 'load (directory-files "/etc/emacs-EMACS_VERSION/site-start.d" t "\\.el\\'"))

;;; load local configuration
(if (file-exists-p (expand-file-name "/etc/emacs/emacs24-local.el"))
    (load (expand-file-name "/etc/emacs/emacs24-local.el")))

;;; load vine-default configuration per user before vine-default-setup
(if (file-exists-p (expand-file-name "~/.emacs.d/emacs24-vine-default.el"))
    (load (expand-file-name "~/.emacs.d/emacs24-vine-default.el")))

;;; run vine-default-setup
(vine-default-setup)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:

package-init.el

from howm-init.el of howm-1.3.9.1-2vl6.noarch

;;
;; howm-init.el
;;
;; 	for Vine Linux with emacsen-common
;; 	Munehiro Yamamoto <munepi@vinelinux.org>

(defcustom vine-default-howm t
  "A boolean for vine-default-howm"
  :type 'boolean)

(add-hook 'vine-default-setup-hook
	  (lambda()
	    (when vine-default-howm
	      (message "Loading vine-default-howm ...")
	      (require 'vine-default-howm))))

;;; end of file

emacs24-local.el

from emacs24-local.el of emacs24-24.0.50-3.20110128vl6.x86_64

;; 
;; GNU Emacs EMACS_VERSION local configuration file
;; 
;; This configuration is read at the end of site-start.el. 
;; Emacs configuration files are read
;;   - distribution wide from site-start.el 
;;   - system wide from this configuration file
;;   - per user from ~/.emacs.d/init.el, 
;; where per user settings override system wide settings, 
;; and system wide settings override site-start.el. 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:

~/.emacs.d/emacsXX-vine-default.el

Emacs XX を起動して、vine-default-setup が実行される前に、~/.emacs.d/emacsXX-vine-default.el から vine-default に関する設定を読み込みます。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  -*- coding: utf-8-unix -*-
;;  FSF Emacs 24 用 vine-default 設定ファイル
;;    Munehiro Yamamoto <munepi@vinelinux.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Vine Linux のデフォルト設定を無効にしたい場合は、
;; 以下を有効にしてください。
;; (setq vine-default nil)

;;; 環境変数 EMACS_IME と異なる IME を使いたい場合は、
;;; 以下を有効にして設定することができます。
;; (setq emacs-ime "atokx3");; anthy-el atokx3 ibus-el mozc tamago scim scim-bridge skk wnn7egg

;;; マクロサーチパスの追加
;;; 例えば、~/lib/emacs 以下にユーザ用の *.el, *.elc を置くことができます。
;; (add-to-list 'load-path "~/lib/emacs")
;; (add-to-list 'load-path "~/.emacs.d/auto-install")


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:

vine-default-package.el

from vine-default-howm.el of howm-1.3.9.1-2vl6.noarch

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  -*- coding: utf-8-unix -*-
;;  FSF Emacs 23 用 Vine Linux howm 設定
;;    Munehiro Yamamoto <munepi@vinelinux.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; howm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(autoload 'howm-menu "howm-mode" "Hitori Otegaru Wiki Modoki" t)

(setq howm-process-coding-system 'utf-8)
(setq howm-menu-lang 'ja)
;; (global-set-key "\C-c,," 'howm-menu)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(provide 'vine-default-howm)

;; Local Variables:
;; mode: emacs-lisp
;; End:

デフォルトのユーザ初期設定ファイル

Vine Linux 6 では、デフォルトのユーザ初期設定ファイルとして、 ${HOME}/.emacs.d/init.el を推奨します。

Emacs は、~/.emacs, ~/.emacs.el, ~/.emacs.d/init.el の順番に探し、 一番最初に見つけたファイルを「デフォルトのユーザ初期設定ファイル」とする挙動をします。

~/.emacs.d/init.el

${HOME}/.emacs.d/init.el は、 例えばこのような感じで良いと考えています。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  -*- coding: utf-8-unix -*-
;;  FSF Emacs バージョン分岐用ファイル
;;    Munehiro Yamamoto <munepi@vinelinux.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq user-init-file 
      (concat "~/.emacs.d/emacs" (number-to-string emacs-major-version) 
	      "-init.el"))

(setq custom-file 
  (concat "~/.emacs.d/emacs" (number-to-string emacs-major-version) 
	  "-custom.el"))

(if (file-exists-p (expand-file-name user-init-file))
    (load-file (expand-file-name user-init-file)))
(if (file-exists-p (expand-file-name custom-file))
    (load-file (expand-file-name custom-file)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:
====================

このようにしておくと、複数のバージョンのユーザ初期設定ファイルと カスタムファイル(M-x customize により書き込まれる設定ファイル)を別々に管理できます。

必要であれば、Emacs バージョン共通の設定ファイルなどを設けて、以下のようにしてもよいでしょう。

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  -*- coding: utf-8-unix -*-
;;  FSF Emacs バージョン分岐用ファイル
;;    Munehiro Yamamoto <munepi@vinelinux.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; ユーザーの初期設定ファイルの指定
(setq user-init-file 
      (concat "~/.emacs.d/emacs" (number-to-string emacs-major-version) 
	      "-init.el"))
(setq custom-file 
      (concat "~/.emacs.d/emacs" (number-to-string emacs-major-version) 
	      "-custom.el"))

(if (file-exists-p (expand-file-name user-init-file))
    (load (expand-file-name user-init-file)))
(if (file-exists-p (expand-file-name custom-file))
    (load (expand-file-name custom-file)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; 個人的な設定ファイル: Emacs バージョン共通
(setq my-emacs-common-file "~/.emacs.d/emacs-common.el")
(if (file-exists-p (expand-file-name my-emacs-common-file))
    (load-file (expand-file-name my-emacs-common-file)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:

~/.emacs.d/emacsXX-init.el

Emacs XX を起動すると、上記の ~/.emacs.d/init.el から ~/.emacs.d/emacsXX-init.el が

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  -*- coding: utf-8-unix -*-
;;  FSF Emacs 24 用 ユーザ設定ファイル
;;    Munehiro Yamamoto <munepi@vinelinux.org>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Local Variables:
;; mode: emacs-lisp
;; End:

vupgrade???

Vine Linux 5 までの設定ファイル ~/.emacs.* は、すべて ~/.emacs.d/dot.emacs/ 以下に移すようにするのはどうでしょうか?