免费注册 查看新帖 |

Chinaunix

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

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

论坛徽章:
0
261 [报告]
发表于 2005-12-09 09:12 |只看该作者
贴个有趣的设置
(mouse-avoidance-mode 'animate)
当你的鼠标在光标之上时,鼠标会自动移开。

论坛徽章:
0
262 [报告]
发表于 2005-12-12 15:20 |只看该作者
每次启动emacs都有这样的错误提示
  1. Symbol's function definition is void: terminal-init-rxvt
复制代码

我用的是rxvt,以前是好的,好像自从装了ecb还是什么后,就会有这样的东东了
不影响使用,但在命令行不能指定打开一个文件
例如我输入
  1. emacs -nw a.c
复制代码
就会有上面的错误
然后a.c也不会打开,出来的只是Message buffer,要另外C-x C-f才行
哪位大虾知道怎么解决?
thx

论坛徽章:
0
263 [报告]
发表于 2005-12-20 21:16 |只看该作者

emacs dired模式下实现目录拷贝

有哪位在emacs dired模式下实现目录拷贝呀?

论坛徽章:
0
264 [报告]
发表于 2006-01-02 02:11 |只看该作者
请问怎么能设置字号的大小为奇数?
我只看到设置courier 12,14..我想设置成13,有办法吗?

论坛徽章:
0
265 [报告]
发表于 2006-01-02 02:20 |只看该作者
再问一个,我用的FC4+GCC4.0,我在emas里用make,显示出来的是乱码,不是中文,和在shell下编译出的显示不一样,请问怎么改改才能和shell下显示的一致阿?
谢谢!!

论坛徽章:
0
266 [报告]
发表于 2006-01-05 12:07 |只看该作者
www.newsmth.org上有一个专门的emacs版面。看起来还是很不错地!

论坛徽章:
0
267 [报告]
发表于 2006-01-09 10:49 |只看该作者
如何让emacs启动后就最大化?

论坛徽章:
0
268 [报告]
发表于 2006-01-20 10:54 |只看该作者

回复 264楼 unixer2i 的帖子

M-x customize-variable RET dired-recursive-copies RET

论坛徽章:
0
269 [报告]
发表于 2006-01-20 10:58 |只看该作者
原帖由 sdemon915 于 2006-1-9 10:49 发表
如何让emacs启动后就最大化?


(setq initial-frame-alist '((top . 0) (left . 0) (width . 97) (height . 49)))

数值自己修改吧。

论坛徽章:
0
270 [报告]
发表于 2006-01-23 14:25 |只看该作者

我的.emacs和贴图


  1. ;; .emacs initialization file
  2. ; -*- mode: emacs-lisp -*-

  3. ;; Set up the keyboard so the delete key on both the regular keyboard
  4. ;; and the keypad delete the character under the cursor and to the right
  5. ;; under X, instead of the default, backspace behavior.
  6. (global-set-key [delete] 'delete-char)
  7. (global-set-key [kp-delete] 'delete-char)

  8. ;; turn on font-lock mode
  9. (global-font-lock-mode t)
  10. ;; enable visual feedback on selections
  11. (setq-default transient-mark-mode t)

  12. ;; always end a file with a newline
  13. (setq require-final-newline t)

  14. ;; stop at the end of the file, not just add lines
  15. (setq next-line-add-newlines nil)

  16. (when window-system
  17.   ;; enable wheelmouse support by default
  18.   (mwheel-install)
  19.   ;; use extended compound-text coding for X clipboard
  20.   (set-selection-coding-system 'compound-text-with-extensions))



  21. (defun recentf-open-files-compl ()
  22.   (interactive)
  23.   (let* ((all-files recentf-list)
  24.          (tocpl (mapcar (function
  25.                          (lambda (x) (cons (file-name-nondirectory x) x))) all-files))
  26.          (prompt (append '("File name: ") tocpl))
  27.          (fname (completing-read (car prompt) (cdr prompt) nil nil)))
  28.     (find-file (cdr (assoc-ignore-representation fname tocpl)))))

  29. (global-set-key [(control x)(control r)] 'recentf-open-files-compl)


  30. ;; 让sentence-end可以识别全角的标点符号
  31. (setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
  32. (setq sentence-end-double-space nil)

  33. (load "desktop")
  34. (desktop-load-default)
  35. (desktop-read)

  36. ;;打开文件和转换 buffer 的方便模式。
  37. ;;在Win下这个东西不爽,不能切换盘符
  38. (require 'ido)
  39. (ido-mode t)

  40. (require 'color-theme)
  41. (color-theme-gnome2)

  42. (autoload 'table-insert "table" "WYGIWYS table editor")

  43. (require 'tabbar)
  44. (tabbar-mode)
  45. (global-set-key (kbd "") 'tabbar-backward-group)
  46. (global-set-key (kbd "") 'tabbar-forward-group)
  47. (global-set-key (kbd "") 'tabbar-backward)
  48. (global-set-key (kbd "") 'tabbar-forward)


  49. (require 'swbuff)
  50. (global-set-key (kbd "") 'swbuff-switch-to-previous-buffer)
  51. (global-set-key (kbd "") 'swbuff-switch-to-next-buffer)
  52. (setq swbuff-exclude-buffer-regexps
  53.      '("^ " "\\*.*\\*"))

  54. (setq swbuff-status-window-layout 'scroll)
  55. (setq swbuff-clear-delay 1)
  56. (setq swbuff-separator "|")
  57. (setq swbuff-window-min-text-height 1)


  58. (require 'browse-kill-ring)
  59. (global-set-key [(control c)(k)] 'browse-kill-ring)
  60. (browse-kill-ring-default-keybindings)


  61. (require 'ibuffer)
  62. (global-set-key (kbd "C-x C-b") 'ibuffer)

  63. ;; copy lines
  64. (defun copy-lines(&optional arg)
  65.   (interactive "p")
  66.   (save-excursion
  67.     (beginning-of-line)
  68.     (set-mark (point))
  69.     (if arg
  70.         (next-line (- arg 1)))
  71.     (end-of-line)
  72.     (kill-ring-save (mark) (point))))
  73. ;; set key
  74. (global-set-key (kbd "C-c w") 'copy-lines)



  75. ;; Load CEDET
  76. (load-file "C:/emacs/cedet-1.0pre3/common/cedet.el")

  77. (add-to-list 'load-path "C:/emacs/ecb-2.32/")
  78. (require 'ecb-autoloads)

  79. ;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
  80. ;; Select one of the following
  81. (semantic-load-enable-code-helpers)
  82. ;; (semantic-load-enable-guady-code-helpers)
  83. ;; (semantic-load-enable-excessive-code-helpers)

  84. ;; Enable this if you develop in semantic, or develop grammars
  85. ;; (semantic-load-enable-semantic-debugging-helpers)
  86. (custom-set-variables
  87.   ;; custom-set-variables was added by Custom.
  88.   ;; If you edit it by hand, you could mess it up, so be careful.
  89.   ;; Your init file should contain only one such instance.
  90.   ;; If there is more than one, they won't work right.
  91. '(column-number-mode t)
  92. '(cua-mode nil)
  93. '(ecb-auto-activate t)
  94. '(ecb-gzip-setup (quote ("c:\\emacs\\bin\\gzip.exe" . windows)))
  95. '(ecb-options-version "2.32")
  96. '(ecb-other-window-behavior (quote all))
  97. '(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
  98. '(ecb-source-path (quote ("D:/")))
  99. '(ecb-tar-setup (quote ("c:\\emacs\\bin\\tar.exe" . windows)))
  100. '(ecb-wget-setup (quote ("c:\\emacs\\bin\\wget.exe" . windows)))
  101. '(ecb-windows-width 0.2)
  102. '(global-font-lock-mode t nil (font-core))
  103. '(hscroll-margin 0)
  104. '(show-paren-mode t nil (paren))
  105. '(transient-mark-mode t))
  106. (custom-set-faces
  107.   ;; custom-set-faces was added by Custom.
  108.   ;; If you edit it by hand, you could mess it up, so be careful.
  109.   ;; Your init file should contain only one such instance.
  110.   ;; If there is more than one, they won't work right.
  111. )

  112. (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
  113. ;(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
  114. ;(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
  115. ;;禁用启动信息
  116. (setq inhibit-startup-message t)

  117. ;;关闭烦人的出错时的提示声
  118. (setq visible-bell t)

  119. ;;把title设置为“文件名@LC's Emacs"
  120. (setq frame-title-format
  121.         '("GNU Emacs[ " (buffer-file-name "%f \]"
  122.                 (dired-directory dired-directory "%b \]"))))

  123. ;;光标靠近鼠标的时候,让鼠标自动让开,别挡住视线
  124. (mouse-avoidance-mode 'animate)

  125. ;;下面的这个设置可以让光标指到某个括号的时候显示与它匹配的括号
  126. (show-paren-mode t)
  127. (setq show-paren-style 'parentheses)

  128. ;;设置缺省模式是text,而不是基本模式
  129. ;(setq default-major-mode 'text-mode)
  130. ;(add-hook 'text-mode-hook 'turn-on-auto-fill)

  131. ;;打开文本的默认格式为gb2312-dos
  132. ;(setq inhibit-eol-conversion 'gb2312-dos)

  133. ;;设置tab为4个空格的宽度,而不是原来的2
  134. ;(setq default-tab-width 4)

  135. ;;防止页面滚动时跳动
  136. (setq scroll-margin 3
  137.       scroll-conservatively 10000)

  138. ;; 所有的备份文件转移到~/backups目录下
  139. (setq backup-directory-alist (quote (("." . "~/backups"))))
  140. (setq version-control t)
  141. (setq kept-old-versions 2)
  142. (setq kept-new-versions 5)
  143. (setq delete-old-versions t)
  144. (setq backup-directory-alist '(("." . "~/backups")))
  145. (setq backup-by-copying t)
  146. ;; Emacs 中,改变文件时,默认都会产生备份文件(以 ~ 结尾的文件)。可以完全去掉
  147. ;; (并不可取),也可以制定备份的方式。这里采用的是,把所有的文件备份都放在一
  148. ;; 个固定的地方("~/var/tmp")。对于每个备份文件,保留最原始的两个版本和最新的
  149. ;; 五个版本。并且备份的时候,备份文件是复本,而不是原件。

  150. ;;不产生备份文件
  151. ;(setq make-backup-files nil)

  152. ;;设置kill-ring-max(我不知道怎么翻译这个词:)为200,以防不测:)
  153. (setq kill-ring-max 200)

  154. ;; 当有两个文件名相同的缓冲时,使用前缀的目录名做 buffer 名字,不用原来的
  155. ;; foobar<?> 形式。
  156. (setq uniquify-buffer-name-style 'forward)

  157. ;;显示日期
  158. (setq display-time-day-and-date t)
  159. (display-time)

  160. ;;显示时间
  161. (setq display-time-24hr-format t)
  162. (setq display-time-day-and-date t)
  163. (setq display-time-use-mail-icon t)
  164. (setq display-time-interval 10)

  165. ;; 设置时间戳,标识出最后一次保存文件的时间。
  166. (setq time-stamp-active t)
  167. (setq time-stamp-warn-inactive t)
  168. (setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S K.T")

  169. ;; 默认的日记文件
  170. ;(setq diary-file "~/diary/rj")

  171. ;; 设置所在地的经纬度和地名,calendar 可以根据这些信息告知你每天的日出和日落
  172. ;; 的时间。
  173. (setq calendar-latitude +45.75)
  174. (setq calendar-longitude +126.63)
  175. (setq calendar-location-name "Harbin")

  176. ;;保存上次的操作记录到SESSION
  177. (add-to-list 'load-path "~/tmp")
  178. (require 'session)
  179. (add-hook 'after-init-hook 'session-initialize)

  180. (load "desktop")
  181. (desktop-load-default)
  182. (desktop-read)

  183. ;;设置默认工作目录
  184. (setq default-directory "D:/")

  185. ;;显示列号
  186. (setq column-number-mode t)

  187. ;设置默认的列数是110
  188. (setq default-fill-column 168)

  189. ;;设置行号,开启命令:M-x setnu-mode
  190. ;(require 'setnu)

  191. ;;'y' for 'yes', 'n' for 'no'
  192. (fset 'yes-or-no-p 'y-or-n-p)

  193. ;; 代码折叠
  194. (load-library "hideshow")
  195. (add-hook 'java-mode-hook 'hs-minor-mode)
  196. (add-hook 'perl-mode-hook 'hs-minor-mode)
  197. (add-hook 'php-mode-hook 'hs-minor-mode)
  198. (add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)

  199. ;;开启图片浏览
  200. (require 'thumbs)
  201. (auto-image-file-mode t)

  202. ;; 如果设置为 t,光标在 TAB 字符上会显示为一个大方块 :)。
  203. (setq x-stretch-cursor nil)

  204. ;;语法高亮,除 shell-mode 和 text-mode 之外的模式中使用语法高亮
  205. ;;可是打开后PHP不高亮了,-_-!
  206. ;(setq font-lock-maximum-decoration t)
  207. ;(setq font-lock-global-modes '(not shell-mode text-mode))
  208. ;(setq font-lock-verbose t)
  209. ;(setq font-lock-maximum-size
  210. ;       '((t . 1048576) (vm-mode . 5250000)))

  211. ;;打开压缩文件时自动解压缩。
  212. ;(auto-compression-mode 1)                             

  213. ;;光标不要闪烁。
  214. ;(blink-cursor-mode -1)

  215. ;;高亮显示匹配的括号。
  216. (show-paren-mode 1)

  217. ;;给出用 M-x foo-bar-COMMAND 输入命令的提示。
  218. ;(icomplete-mode 1)


  219. ;;SET KEY
  220. (global-set-key "\C-xk" 'kill-this-buffer)
  221. (global-set-key "\C-xr" 'replace-string)
  222. (global-set-key "\C-xt" 'insert-now-time);把插入当前时间绑定到 C-x t

  223. ;; 打开文件的时候过滤掉[^M] 键盘上输入为[C-q-m] 或者
  224. ;; C-x <RET> r gb2312-dos 或者
  225. ;; C-x <RET> r gb2312-unix 或者
  226. ;; 运行下面的函数
  227. (defun remove-trailing-ctrl-m ()
  228.         (interactive)
  229.         (goto-char (point-min))
  230.         (while (search-forward-regexp "
  231.         " nil t)
  232.         (replace-match "" nil t)))


  233. ;;导出成html高亮显示
  234. ;(require 'htmlize)

  235. (autoload 'php-mode "php-mode" "PHP editing mode" t)
  236. (add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode))
  237. (autoload 'css-mode "css-mode" "CSS editing mode" t)
  238. (add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
复制代码

[ 本帖最后由 jerryfleming 于 2006-1-23 14:30 编辑 ]

snap001.jpg (68.87 KB, 下载次数: 67)

效果图

效果图
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP