Differences between revisions 6 and 7
Revision 6 as of 2007-01-15 05:45:44
Size: 7976
Editor: nickcheng
Comment:
Revision 7 as of 2007-01-15 05:46:22
Size: 8010
Editor: nickcheng
Comment:
Deletions are marked like this. Additions are marked like this.
Line 90: Line 90:
        * python-mode中是不带folding的. 上面那个缩进使用的是Emacs自带的outline-minor-mode. 原帖见: http://groups.google.ca/group/comp.lang.python/browse_thread/thread/43a4d75404cc64fe/956f1c2d37f93995?&hl=en#956f1c2d37f93995         * python-mode中是不带folding的. 上面那个缩进使用的是Emacs自带的outline-minor-mode. 原帖见: http://groups.google.ca/group/comp.lang.python/browse_thread/thread/43a4d75404cc64fe/956f1c2d37f93995?&hl=en#956f1c2d37f93995 -- ["nickcheng"]
Line 93: Line 93:
  * folding可以参考: http://wiki.woodpecker.org.cn/moin/Emacs23#head-ebd91b388c6955805dda8ebf4899a3f2d92fa90a   * folding可以参考: http://wiki.woodpecker.org.cn/moin/Emacs23#head-ebd91b388c6955805dda8ebf4899a3f2d92fa90a -- ["nickcheng"]
  • 我想在 Win 环境中使用! Lisp 的控制可以管理到M$ 系统的方方面面? -- ZoomQuiet

  • 我在win下用的,配置我还不太懂,好象不太容易配置,还有不支持win系统自带的输入法,python的编程插件倒是可以正常工作,其他问题问询hoxide,他好象清楚一些,我在学习中 :) -- Dreamingk
  • 不支持win自带的输入法吗? 不是吧, 我一直都在用啊? 输入的时候可能看到乱码, 用Ctrl+L刷新一下屏幕就好了.
    • Emacs里面的编码选择蛮复杂的, 关于中文的编码太多了, 在保存文件时他还会猜测编码, 要看准哦. -- hoxide
  • 这样嘛。我一看输入的都是乱码,我还以为不支持win自带的输入法呢。 -- Dreamingk
  • 因为现在的版本还不是unicode编码,因此汉字都按半个字符来处理。我就是因为汉字问题不爽才不再学了。庞大的软件要想做系统级调整就会这样。它出现得太早了。 -- Limodou
    • Emacs有Unicode分支, 不过还是处于开发状态, 但是基本已经可用, 而且使用汉字是没问题的! 这是最爽的! -- Nickcheng
  • 配置文件写好,汉字不是半个字符。windows下的优点就是可以用win的输入法。linux下我还没调出来,只能用emacs自带的输入法。vim我只用最基本的功能,稍微高级的需求都用emacs解决。emacs的pythonmode是不是成熟度不够?只能实现idle的功能,连folding都没有。所以我还是用leo。leo真不错。一个万能工具。by tomz


  • 咦咦咦?!??!Leo!! 唉呀呀!! tomz 是怎么使用的?开始文章化编程了? 我仅仅用它来进行信息管理,可以自个儿加菜单什么的进去? -- Zoomq
    • 可以叫文学化编程吧,我理解文学化编程是一种更好的fold,并能部分代替uml。我现在用leo管理我的代码。感觉非常棒。再也不为代码多而烦恼了。它有多文件管理功能,自动同步文件,能够同步链接两个代码部分。都很有用。leo可以叫做项目管理工具吧。在debian的安装中也包括文学编程,看来文学编程是一个主流编程工具,并不是冷僻的工具。by tomz
      • 谢谢!!请汇聚是也乎!
      • LiterateProgramming -- 文章化编程! 早就想系统的学习了,只是总感觉无从下手!

  • 能不能给个配置文件看看?我的配置过了,但是好象没有什么效果 -- Dreamingk
    • 我这个电脑没emacs,就是上面的链接emacs中文化指南中找吧。或者王垠的主页上有。需要什么效果?就是将汉字识别为一个字。并能输入中文吧。另外,xemacs的win版不行。by tomz
    • 编辑c盘根目录下的“.emacs”文件。这样应该起作用。by tomz
  • 我只用python-mode来编辑python程序, 代替idle? 没试过. -- hoxide
    • 代替idle的意思是,它只能有基本的编辑功能,并能调出shell来运行。没有其他功能。 by tomz
    • 还要什么功能? 调试环境? 类和模块的树形显示? 我好像从来不用的啊~~~ -- hoxide
      • 函数以及函数中的函数的fold功能,就是说pythonmode不支持outline,最基本的功能,pdb和emacs的结合也不好用。自动完成和文档提示可能也没有。我用leo就是为了fold。 by tomz
        • 哦, 这么回事, leo 我试试~~~ -- hoxide
        • emacs中可以通过folding mode来支持folding
        • 没有python-mode的folding 。by tomz
        • http://www.chrislott.org/geek/emacs/n2n_folding_mode.php 去这里看看把,规则可以定制的。 by eddyxu

        • http://www.cs.unc.edu/~gb/Software.html 这里有python的folding脚本,可以试一下。 by flyaflya

        • 问一下,python-model和这个folding脚本该怎么安装?(刚开始用emacs) by flyaflya
          • 我用的windows,安装python-mode如下:创建一个 .emacs 文件放到你的 c:/ 下,.emacs内容如下:
            • (setq load-path (cons "c:/emacs/python_mode" load-path))
              (setq auto-mode-alist
                    (cons '("\\.py$" . python-mode) auto-mode-alist))
              (setq interpreter-mode-alist
                    (cons '("python" . python-mode)
                          interpreter-mode-alist))
              ;;(setq python-mode-hook
              ;;      '(lambda() (progn
              ;;                 (set-variable 'py-indent-offset 4)
              ;;                 (set-variable 'py-smart-indentation nil)
              ;;                 (set-variable 'indent-tabs-mode nil) )))
              (defconst py-python-command "c:/python24/python.exe")
              (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)
              )
              
              ;;----------------------------------
              (custom-set-variables
                ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
                ;; Your init file should contain only one such instance.
               '(case-fold-search t)
               '(current-language-environment "English")
               '(default-input-method "latin-1-prefix")
               '(global-font-lock-mode t nil (font-lock)))
              (custom-set-faces
                ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
                ;; Your init file should contain only one such instance.
               )
              使用的时候 M-x (alt + x ) ,然后输入 python-mode 就可以启动了。 --瘦青蛙
            • 谢谢瘦青蛙提供配置文件。可是我还没有体会出这么复杂的配置emacs的好处。目前,我是把空格数量当作确定outline级别的依据。不知道py-outline-level什么意思。另外,发现这里有人已经提到了folding,当时,我还以为是outline的一种称呼。现在,我比较重度的使用folding来代替leo。 - tomz
            • python-mode中是不带folding的. 上面那个缩进使用的是Emacs自带的outline-minor-mode. 原帖见: http://groups.google.ca/group/comp.lang.python/browse_thread/thread/43a4d75404cc64fe/956f1c2d37f93995?&hl=en#956f1c2d37f93995 -- ["nickcheng"]

    • 嗯嗯?感觉折叠和Leo的节点还是有区分的,前者是通过预先约定的语法原则,Leo 则是完全的根据需要,不同的理念吧……ZoomQuiet

      • folding不是outline那样根据语法规则来确定折叠。而是能够随意选择一部分来折叠。这样,在emacs中就有了两种折叠方式。一个是随意的折叠,就像leo那样,另外,是根据语法来折叠,这样,就不用象leo那样,每个函数还要再分别定义节点,减少了这个重复工作量。而且,用folding这种方式,就没有leo那样的预处理过程,完全就在python文件中操作。同时和python-mode相结合,能够方便的调试。当然,不像leo这样专门的工具那样友好。所以,我建议还是体会leo的感觉,才能体会到folding到底有多重要。 -tomz
    • folding可以参考: http://wiki.woodpecker.org.cn/moin/Emacs23#head-ebd91b388c6955805dda8ebf4899a3f2d92fa90a -- ["nickcheng"]

Emacs/discuss (last edited 2009-12-25 07:16:27 by localhost)