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中添加如下代码:
- ;; C-f5, 设置编译命令,用 Emacs 原来的 compile
- ;; f5, 保存当前窗口并选用不同的编译器编译,可如法往上添加匹配
- (defun sucha-smart-compile ()
- "Simply compile your file according to the file type."
- (interactive)
- (save-some-buffers t)
- (let
- ((compile-command nil)
- (alist
- (list '("//.c$" . "c:/mingw/bin/gcc")
- '("//.cc$" . "c:/mingw/bin/g++")
- '("//.cpp$" . "c:/mingw/bin/g++"))))
- (while (not (null alist))
- (if (string-match (caar alist) (buffer-file-name))
- (setq compile-command
- (concat (cdar alist) " " "/"" (buffer-file-name) "/"")))
- (setq alist (cdr alist)))
- (if (null compile-command)
- (setq compile-command
- (read-from-minibuffer "Compile command: ")))
- (compile compile-command)))
- (global-set-key [C-f5] 'compile)
- (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
- ; insert-current-time
- (defun insert-current-time ()
- "Insert the current time"
- (interactive "*")
- (insert (current-time-string)))
- (global-set-key "/C-xt" 'insert-current-time)
emacs启动时窗口界面的设置:
来自:http://if.ustc.edu.cn/~xbzhou/blog/archives/000072.html
- ;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置窗口界面 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (set-foreground-color "grey")
- (set-background-color "black")
- (set-cursor-color "gold1")
- (set-mouse-color "gold1")
- (set-scroll-bar-mode nil)
- ;;取消滚动栏
- ;;(customize-set-variable 'scroll-bar-mode 'right))
- ;;设置滚动栏在窗口右侧,而默认是在左侧
- (tool-bar-mode nil)
- ;;取消工具栏
- (setq default-frame-alist
- '((vertical-scroll-bars)
- (top . 25)
- (left . 45)
- (width . 110)
- (height . 40)
- (background-color . "black")
- (foreground-color . "grey")
- (cursor-color . "gold1")
- (mouse-color . "gold1")
- (tool-bar-lines . 0)
- (menu-bar-lines . 1)
- (right-fringe)
- (left-fringe)))
- ;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
- (set-face-foreground 'highlight "white")
- (set-face-background 'highlight "blue")
- (set-face-foreground 'region "cyan")
- (set-face-background 'region "blue")
- (set-face-foreground 'secondary-selection "skyblue")
- (set-face-background 'secondary-selection "darkblue")
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;; 设置界面结束 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
修改上面17--30行的部分代码就可以实现启动时窗口自动最大化等等。非常方便。
拷贝当前行(即当我们需要复制一行或剪切一行的时候不需要把该行先选中成为region,只需要光标停留在当前行然后执行普通的拷贝剪切命令就可以)
来自:http://blog.youkuaiyun.com/g9yuayon/archive/2007/03/04/1520466.aspx
- (defadvice kill-ring-save (before slickcopy activate compile)
- "When called interactively with no active region, copy a single line instead."
- (interactive
- (if mark-active (list (region-beginning) (region-end))
- (list (line-beginning-position)
- (line-beginning-position 2)))))
- (defadvice kill-region (before slickcut activate compile)
- "When called interactively with no active region, kill a single line instead."
- (interactive
- (if mark-active (list (region-beginning) (region-end))
- (list (line-beginning-position)
- (line-beginning-position 2)))))