emacs应用点滴

以下内容都是从网上搜集而来或者是自己使用过程中的意外发现,从网上搜集来的内容会注明出处。如果您觉得不妥,请告知我将其中相关内容删除。

 

emacs中中文显示的时候一个汉字只显示半个的问题:

解决方法来自:http://tikii.javaeye.com/blog/135007

 

如上图所显示的样子,“没”和“妙”两个字都是显示了半个。

http://tikii.javaeye.com/blog/135007找到了答案,原来是安装了lingoes的问题。在需要删除lingoes安装的字体就可以了。具体是在c:/windows/fonts目录下删掉lingoes.ttf文件即可。或者是找到lingoes的安装目录,把下面的font子目录中列出的字体文件都从C:/windows/fonts里面把对应的删除。

 

emacs中编译命令的设置:

来自:http://suchang.net/slack/Emacs.html

在.emacs中添加如下代码:

  1. ;; C-f5, 设置编译命令,用 Emacs 原来的 compile 
  2. ;; f5, 保存当前窗口并选用不同的编译器编译,可如法往上添加匹配
  3. (defun sucha-smart-compile ()
  4.   "Simply compile your file according to the file type."
  5.   (interactive)
  6.   (save-some-buffers t)
  7.   (let
  8.       ((compile-command nil)
  9.        (alist
  10.         (list '("//.c$" .  "c:/mingw/bin/gcc")
  11.               '("//.cc$" . "c:/mingw/bin/g++")
  12.               '("//.cpp$" . "c:/mingw/bin/g++"))))
  13.     (while (not (null alist))
  14.       (if (string-match (caar alist) (buffer-file-name))
  15.           (setq compile-command
  16.                 (concat (cdar alist) " " "/"" (buffer-file-name) "/"")))
  17.         (setq alist (cdr alist)))
  18.     (if (null compile-command)
  19.          (setq compile-command
  20.                (read-from-minibuffer "Compile command: ")))
  21.     (compile compile-command)))
  22. (global-set-key [C-f5] 'compile)
  23. (global-set-key [f5] 'sucha-smart-compile)

作者原文中10,11,12行代码后面分别是:"gcc","g++","g++",c:/mingw/bin是自己电脑上的编译器路径。在16行代码中,buffer-file-name前后自己加了双引号,以防止路径中有空格的情况。

 

在光标处插入当前系统时间:

来自:http://if.ustc.edu.cn/~xbzhou/blog/archives/000072.html

  1. ; insert-current-time
  2. (defun insert-current-time () 
  3.     "Insert the current time" 
  4.     (interactive "*"
  5.     (insert (current-time-string))) 
  6. (global-set-key "/C-xt" 'insert-current-time) 

 

emacs启动时窗口界面的设置:

来自:http://if.ustc.edu.cn/~xbzhou/blog/archives/000072.html

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置窗口界面 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. (set-foreground-color "grey")
  3. (set-background-color "black")
  4. (set-cursor-color "gold1")
  5. (set-mouse-color "gold1")
  6. (set-scroll-bar-mode nil)
  7. ;;取消滚动栏
  8. ;;(customize-set-variable 'scroll-bar-mode 'right))
  9. ;;设置滚动栏在窗口右侧,而默认是在左侧
  10. (tool-bar-mode nil)
  11. ;;取消工具栏
  12. (setq default-frame-alist
  13. '((vertical-scroll-bars) 
  14. (top . 25)
  15. (left . 45) 
  16. (width . 110)
  17. (height . 40) 
  18. (background-color . "black")
  19. (foreground-color . "grey")
  20. (cursor-color . "gold1")
  21. (mouse-color . "gold1")
  22. (tool-bar-lines . 0)
  23. (menu-bar-lines . 1)
  24. (right-fringe)
  25. (left-fringe)))
  26. ;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
  27. (set-face-foreground 'highlight "white")
  28. (set-face-background 'highlight "blue")
  29. (set-face-foreground 'region "cyan")
  30. (set-face-background 'region "blue")
  31. (set-face-foreground 'secondary-selection "skyblue")
  32. (set-face-background 'secondary-selection "darkblue")
  33. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置界面结束 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

修改上面17--30行的部分代码就可以实现启动时窗口自动最大化等等。非常方便。

拷贝当前行(即当我们需要复制一行或剪切一行的时候不需要把该行先选中成为region,只需要光标停留在当前行然后执行普通的拷贝剪切命令就可以)

来自:http://blog.youkuaiyun.com/g9yuayon/archive/2007/03/04/1520466.aspx

  1. (defadvice kill-ring-save (before slickcopy activate compile)
  2.   "When called interactively with no active region, copy a single line instead."
  3.   (interactive
  4.    (if mark-active (list (region-beginning) (region-end))
  5.      (list (line-beginning-position) 
  6.    (line-beginning-position 2)))))
  7. (defadvice kill-region (before slickcut activate compile)
  8.   "When called interactively with no active region, kill a single line instead."
  9.   (interactive
  10.    (if mark-active (list (region-beginning) (region-end))
  11.      (list (line-beginning-position) 
  12.    (line-beginning-position 2)))))

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值