QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1901|回复: 0

emacs 写C程序问题,几个实用的function

[复制链接]
发表于 2007-12-25 23:03:50 | 显示全部楼层 |阅读模式
大家好,我用emacs写C程序,现在有几个问题:

1 如何高亮显示所有同名局部变量?
2 如果更改一个变量的名称(或者一个struct 里元素的名称),如何让所有的引用都同时更名?(这个好像对struct很困难)
3 怎么format一个C文件? (以前用Eclipse写Java程序的时候可以很简单的format一个Java文件,不知道对Emacs有没有类似的包)

我再贡献我自己配置里面的几个function,挺方便的,大家看看吧。有些我自己写的,但是因为我对Lisp并不是很熟,大家不要见笑。能用就好。

(defun insert-new-line-up ()
"Opens a new line before the current line. Equivalent to beginning-of-line, open-line"
(interactive) (beginning-of-line) (open-line 1) (indent-according-to-mode)
)

(global-set-key [(control shift return)] 'insert-new-line-up)


(defun insert-new-line-down()
"Opens a new line after the current line."

(interactive) (beginning-of-line 2) (open-line 1) (indent-according-to-mode)
)
(global-set-key [(control return)] 'insert-new-line-down)


;;++++++++++++++ scroll one line up and down ++++++++++++++
(defun scroll-up-one-line ()
(interactive)
(scroll-up 1))

(defun scroll-down-one-line ()
(interactive)
(scroll-down 1))

(global-set-key [(control down)] 'scroll-up-one-line)
(global-set-key [(control up)] 'scroll-down-one-line)

这个我忘了下载地址了,大家自己google一下吧。
;go to the last edit point.
(require 'goto-last-change)
(global-set-key [(meta left)] 'goto-last-change)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-3-29 17:14 , Processed in 0.099603 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表