Differences between revisions 6 and 8 (spanning 2 versions)
Revision 6 as of 2007-01-13 03:53:27
Size: 1123
Editor: nickcheng
Comment:
Revision 8 as of 2007-01-15 05:35:25
Size: 3033
Editor: nickcheng
Comment:
Deletions are marked like this. Additions are marked like this.
Line 28: Line 28:

=== 用于Python开发的配置 ===
'' 在啄木鸟, 当然要说Python相关的话题了! ''
Line 33: Line 36:

=== 如何方便的加载配置 ===

=== Folding ===
'' 参考: http://groups.google.ca/group/comp.lang.python/browse_thread/thread/43a4d75404cc64fe/956f1c2d37f93995?&hl=en#956f1c2d37f93995 ''
python-mode不带folding功能. 我们只能使用Emacs内建的outline-minor-mode, 来为python设置不同的outline-regexp和outline-level. 参考下面的代码:
{{{
;; setup python mode
(setq auto-mode-alist ; trigger python mode automatically
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)
            interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
; add my customization
(add-hook 'python-mode-hook 'my-python-hook)
; this gets called by outline to deteremine the level. Just use the length of the whitespace
(defun py-outline-level ()
  (let (buffer-invisibility-spec)
    (save-excursion
      (skip-chars-forward "\t ")
      (current-column))))
; this get called after python mode is enabled
(defun my-python-hook ()
  ; outline uses this regexp to find headers. I match lines with no indent and indented "class"
  ; and "def" lines.
  (setq outline-regexp "[^ \t]\\|[ \t]*\\(def\\|class\\) ")
  ; enable our level computation
  (setq outline-level 'py-outline-level)
  ; do not use their \C-c@ prefix, too hard to type. Note this overides some python mode bindings
  (setq outline-minor-mode-prefix "\C-c")
  ; turn on outline mode
  (outline-minor-mode t)
  ; initially hide all but the headers
  (hide-body)
  ; I use CUA mode on the PC so I rebind these to make the more accessible
  (local-set-key [?\C-\t] 'py-shift-region-right)
  (local-set-key [?\C-\S-\t] 'py-shift-region-left)
  ; make paren matches visible
  (show-paren-mode 1)
)
}}}

含有章节索引的中文 文章模板

::-- ["nickcheng"] [DateTime(2007-01-13T03:30:15Z)] TableOfContents

1. Emacs23 (Unicode branch)

Emacs23是Emacs在CVS中的一个分支: emacs-unicode-2 branch, 这个分支的内部编码改为了Unicode. 这样一来, 在Emacs21和Emacs22中困扰咱们的中文问题就直接迎刃而解了! 再也不用配置那么一大堆CJK的东东了!

  • 据目前的了解, Emacs的主力都在应对Emacs22的最后的bug, 也许是RMS想现Release Emacs22, 然后再把主力放入Emacs23的开发. -- ["nickcheng"] [DateTime(2007-01-13T03:40:42Z)]

1.1. 下载

1.1.1. Win32平台

1.1.2. Linux平台

  • 期待您的添加

1.1.3. 其他平台

1.1.3.1. MacOS

  • 期待您的添加

1.1.3.2. Any others?

  • 期待您的添加

1.2. 配置

1.2.1. 用于Python开发的配置

在啄木鸟, 当然要说Python相关的话题了!

  • 期待您的添加

1.3. 技巧

1.3.1. .emacs文件的位置

1.3.2. 如何方便的加载配置

1.3.3. Folding

参考: http://groups.google.ca/group/comp.lang.python/browse_thread/thread/43a4d75404cc64fe/956f1c2d37f93995?&hl=en#956f1c2d37f93995 python-mode不带folding功能. 我们只能使用Emacs内建的outline-minor-mode, 来为python设置不同的outline-regexp和outline-level. 参考下面的代码:

;; setup python mode
(setq auto-mode-alist ; trigger python mode automatically
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)
            interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
; add my customization
(add-hook 'python-mode-hook 'my-python-hook)
; this gets called by outline to deteremine the level. Just use the length of the whitespace
(defun py-outline-level ()
  (let (buffer-invisibility-spec)
    (save-excursion
      (skip-chars-forward "\t ")
      (current-column))))
; this get called after python mode is enabled
(defun my-python-hook ()
  ; outline uses this regexp to find headers. I match lines with no indent and indented "class"
  ; and "def" lines.
  (setq outline-regexp "[^ \t]\\|[ \t]*\\(def\\|class\\) ")
  ; enable our level computation
  (setq outline-level 'py-outline-level)
  ; do not use their \C-c@ prefix, too hard to type. Note this overides some python mode bindings
  (setq outline-minor-mode-prefix "\C-c")
  ; turn on outline mode
  (outline-minor-mode t)
  ; initially hide all but the headers
  (hide-body)
  ; I use CUA mode on the PC so I rebind these to make the more accessible
  (local-set-key [?\C-\t] 'py-shift-region-right)
  (local-set-key [?\C-\S-\t] 'py-shift-region-left)
  ; make paren matches visible
  (show-paren-mode 1)
) 

Emacs23 (last edited 2010-01-11 17:55:01 by flyinflash)