免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: flw
打印 上一主题 下一主题

有关 Emacs 使用技巧的内容请在这个帖子讨论。 [复制链接]

论坛徽章:
0
631 [报告]
发表于 2008-02-03 21:00 |只看该作者
原帖由 william.zhang 于 2008-2-3 11:16 发表
用emacs
注释的时候可以c-c c但是取消注释的时候却没有相应的命令。

不知道是否真的没有?


那是因为你用错键了。

加注释,去注释都是
  1. M-;
复制代码

(Meta + 分号)
当然前提是 (setq-default transient-mark-mode t)                                                                                          打开了。

为什么是分号?因为 elisp 里面 ';' 是注释符(就相当于shell里的 '#')。

论坛徽章:
0
632 [报告]
发表于 2008-02-15 17:18 |只看该作者

回复 #630 lgfang 的帖子

thanks

论坛徽章:
0
633 [报告]
发表于 2008-02-25 22:23 |只看该作者

提个小问题

在多个buffer(窗口)的情况下,每当我输入一个命令时,输出结果老是跑到另一个窗口中,我能将结果在当前窗口上显示吗??

论坛徽章:
0
634 [报告]
发表于 2008-02-27 20:16 |只看该作者
我写的,计算 NCSL 的 elisp 脚本

http://blog.chinaunix.net/u/23408/showart.php?id=480258


  1. #!/home/lungangfang/local/bin/emacs --script

  2. ;;; ncsl.el --- counting NCSL

  3. ;; Created:  Fang lungang 02/27/2008
  4. ;; Modified: Fang lungang 02/28/2008 19:25>

  5. ;; Copyright (C) 2008  Fang lungang

  6. ;; Author: Fang lungang <lgfang at users.sourceforge.net>
  7. ;; Keywords: files, tools

  8. ;; This file is NOT part of GNU Emacs.

  9. ;; This file is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.

  13. ;; This file is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ;; GNU General Public License for more details.

  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs; see the file COPYING.  If not, write to
  19. ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20. ;; Boston, MA 02110-1301, USA.

  21. ;;; Commentary:

  22. ;; This script is to count (and sum up) number of NCSLs (Non-Comment
  23. ;; Source Line).  Comments and blank lines are ignored.  For C/C++
  24. ;; code, lines between '#if 0' and '#endif' are ignored as well.

  25. ;; Examples:
  26. ;; find . -type f -name '*.[hc]' | ncsl.el
  27. ;; find . -type f -name '*.[hc]' | emacs --script /path/to/ncsl.el

  28. ;;; Code:

  29. (require 'hideif)
  30. (require 'newcomment)

  31. (let ((file nil) (sum 0) (ncsl 0))
  32.   (condition-case nil
  33.       (while (setq file (read-string "")) ; for each file
  34.         (find-file file)
  35.         (setq ncsl 0)

  36.         ;; for C/c++ files, hide if 0
  37.         (when (or (equal 'c-mode major-mode) (equal 'c++-mode major-mode))
  38.           (goto-char (point-min))
  39.           (while (re-search-forward "^[ \t]*#if[ \t]*0" nil t)
  40.             (hide-ifdef-block)))

  41.         (goto-char (point-min))
  42.         (while (not (eobp))
  43.           ;; suppose there won't be 10000 consecutive comments
  44.           (forward-comment 10000)
  45.           (setq ncsl (+ 1 ncsl))
  46.           ;; In case a comment starts at current line and spans several
  47.           ;; lines.
  48.           (let* ((eol (line-end-position)) (cs (comment-search-forward eol t)))
  49.             (while cs
  50.               (goto-char cs)
  51.               (forward-comment 10000)
  52.               (setq cs (comment-search-forward eol t)))
  53.             (unless (> (point) eol)     ; unless already a new line
  54.               (forward-visible-line 1))))
  55.         (setq sum (+ sum ncsl))
  56.         (kill-buffer nil)
  57.         (princ (format "%d %s\n" ncsl file)))
  58.     (error (princ (format "%s total\n" sum)))))

  59. ;;; ncsl.el ends here
复制代码

[ 本帖最后由 lgfang 于 2008-2-28 19:25 编辑 ]

论坛徽章:
0
635 [报告]
发表于 2008-03-14 13:12 |只看该作者

ecb make不成功

请问一下,什么原因?      cedet.el存在谢谢

[heixia@localhost ecb-2.32]$ make
Byte-compiling ECB with LOADPATH= ...
emacs -batch -no-site-file -l ecb-compile-script --eval '(ecb-byte-compile t)'
Loading subst-jis...
Loading subst-ksc...
Loading subst-big5...
Loading subst-gb2312...
Cannot open load file: /home/heixia/lisp/ecb-2.32/c:/Programme/emacs-21/site-lisp/package-development/cedet/common/cedet.el
make: *** [ecb] 错误 255

论坛徽章:
0
636 [报告]
发表于 2008-03-17 18:18 |只看该作者
原帖由 heixia108 于 2008-3-14 13:12 发表
请问一下,什么原因?      cedet.el存在谢谢

[heixia@localhost ecb-2.32]$ make
Byte-compiling ECB with LOADPATH= ...
emacs -batch -no-site-file -l ecb-compile-script --eval '(ecb-byte-compile t)'
Loading subst-jis...
Loading subst-ksc...
Loading subst-big5...
Loading subst-gb2312...
Cannot open load file: /home/heixia/lisp/ecb-2.32/c:/Programme/emacs-21/site-lisp/package-development/cedet/common/cedet.el
make: *** [ecb] 错误 255


猜想是不是是load path没有设对

论坛徽章:
0
637 [报告]
发表于 2008-03-18 14:04 |只看该作者

请教关于Emacs中配置Java Jde的

唉,找了N多论坛,没看到几个人用Emacs开发Java的,可能是Eclipse太出才了吧。

我装了Emacs 23.0 JDEE 2.3.5但是配置总是出问题

想问下有谁配置成功过,将配置文件发来参考下。

谢谢!

论坛徽章:
0
638 [报告]
发表于 2008-03-25 17:21 |只看该作者
怎么在EMACS中运行C代码?

论坛徽章:
0
639 [报告]
发表于 2008-03-29 23:27 |只看该作者

回复 #635 lgfang 的帖子

嗯,是path没设对,谢谢
不好意思才看到

论坛徽章:
0
640 [报告]
发表于 2008-03-29 23:30 |只看该作者

回复 #637 projoy 的帖子

我是写了个通用的Makefile,然后,在emacs里只用make就行了,运行可以进入shell模式
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP