emacs semantic,speedbar,gdb汇总
- 在emacs 里使用gdb
- emacs speedbar功能介绍
- semantic功能介绍
 上面3篇文章精华,都汇总到下面的.emacs文件里了。
;;启动semantic功能
(semantic-mode 1)
;;当光标移到到某个函数调用的地方,或者变量使用的地方的时候,
;;函数的原型(返回值,参数),变量的类型,会显示在emacs最下面的辅助入力区
(global-semantic-idle-summary-mode)
;;启动代码补齐的功能
(global-semantic-idle-completions-mode)
;;启动bookmark功能,为了函数semantic-mrub-switch-tags可以被使用。
;;进而实现当跳转到函数/变量定义的地方后,还能跳回来
(global-semantic-mru-bookmark-mode)
;;ctrl-回车,绑定自动补全
(add-hook 'semantic-after-idle-scheduler-reparse-hook
	  (lambda ()
	    (message "parse done!")
	    (local-set-key (kbd "C-<return>")
			    'semantic-complete-analyze-inline-idle)))
;;让speedbar使用由semantic解析出来的tags,semantic解析出来的tags里的信息比speedbar自己的tags要详细
(add-hook 'speedbar-load-hook
	  (lambda () (require 'semantic/sb)))
;;跳转到函数/变量定义的地方
(global-set-key [f12] 'semantic-ia-fast-jump)
;;为了跳回去,要使用函数semantic-mrub-switch-tags,但老是报出【Semantic Bookmark ring is currently empty】错误。原因是函数semantic-ia-fast-jump调用了函数push-mark,而函数push-mark里面没有做push bookmark的操作,所以要修改函数push-mark,把bookmark放入semantic-mru-bookmark-ring里。放入后再执行semantic-mrub-switch-tags就不会出错了
(defadvice push-mark (around semantic-mru-bookmark activate)
  "Push a mark at LOCATION with NOMSG and ACTIVATE passed to `push-mark'.
If `semantic-mru-bookmark-mode' is active, also push a tag onto
the mru bookmark stack."
  (semantic-mrub-push semantic-mru-bookmark-ring
                      (point)
                      'mark)
  ad-do-it)
;;跳转后再跳回原来的地方
(global-set-key [f11]
      (lambda()
    (interactive)
    (if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
        (error "Semantic Bookmark ring is currently empty"))
    (let* ((ring (oref semantic-mru-bookmark-ring ring))
           (alist (semantic-mrub-ring-to-assoc-list ring))
           (first (cdr (car alist))))
    (if (semantic-equivalent-tag-p (oref first tag)
                       (semantic-current-tag))
        (setq first (cdr (car (cdr alist)))))
    (semantic-mrub-switch-tags first))))
;;cedet
;;To enable more advanced functionality for name completion, etc.
(require 'semantic/ia)
;;If you're using GCC for programming in C & C++, then Semantic can automatically find directory, where system include files are stored. Just load semantic/bovine/gcc package with following command
(require 'semantic/bovine/gcc)
;;当输入【.】或者【>】后,自动提示出结构体或者类里的成员变量和函数
(defun my-c-mode-cedet-hook ()
 (local-set-key "." 'semantic-complete-self-insert)
 (local-set-key ">" 'semantic-complete-self-insert))
(add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
;;当使用外部的库时,下面的命令可以把外部库的头文件所在目录告诉给semantic,
;;然后semantic就可以解析这些头文件,从而提供代码补齐,跳转等
;;(semantic-add-system-include "~/exp/include/boost_1_37" 'c++-mode)
;;speedbar和buffer间的切换
(add-hook 'speedbar-load-hook
	  (lambda ()
	    (local-set-key (kbd "C-w")
			   'speedbar-get-focus)))
;;gdb
(add-hook 'gdb-mode-hook
	  (lambda ()
	    (gdb-many-windows);;M-x gdb 后,是多窗口显示
	    (gud-tooltip-mode);;minor mode 当鼠标放到变量上后,会弹出tooltip来显示变量的值
	    (local-set-key [f4] 'gdb-restore-windows);;恢复gdb多窗口
	    (local-set-key [f5] 'gud-step);;进入函数
	    (local-set-key [f6] 'gud-next);;不进入函数
	    (local-set-key [f7] 'gud-finish);;跳出函数
	    (local-set-key [f8] 'gud-until)));;继续执行
;;关闭自动备份功能
(setq make-backup-files nil)
;;打开emacs时,不显示工具条
(tool-bar-mode 0)
;;打开emacs时,不显示菜单
(menu-bar-mode 0)
;;高亮当前行
(global-hl-line-mode 1)
;;打开自动换行和饥饿删除功能
(add-hook 'c-mode-common-hook
;;(add-hook 'c-mode-hook
	  (lambda ()
	     (c-toggle-auto-hungry-state)))
;;save
(define-key global-map "\C-s" 'save-buffer)
;;search
(global-set-key (kbd "\C-x s") 'isearch-forward)
;;这一条语句的作用是让 windmove 在边缘的窗口也能正常运作。举个例子,当前窗口已经是最左端的窗口了,如果使用 ctrl+left ,将仍会停留在当前窗口——因为已经到边缘了,左边没有窗口可供选择。但在添加了上面这句后,ctrl+left 将会跳到最右边的窗口中。垂直方向上的窗口切换同理。
(setq windmove-wrap-around t)
(global-set-key (kbd "C-x <left>")  'windmove-left)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <up>")    'windmove-up)
(global-set-key (kbd "C-x <down>")  'windmove-down)
;;启动后,c-c left是undo 窗口;c-c right是redo窗口
(winner-mode t)
;;当代码需要补齐的时候,让补齐代码的显示方式是在tooltip里
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(gdb-use-colon-colon-notation t)
 '(package-selected-packages
   (quote
    (phi-rectangle highlight-symbol ggtags auto-complete)))
 '(semantic-complete-inline-analyzer-idle-displayor-class (quote semantic-displayor-tooltip)))
;;设置face:default的背景色为黑色,前景色为白色,字体大小为218
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 200 :width normal :foundry "DAMA" :family "Ubuntu Mono"))))
 '(tooltip ((t (:background "steel blue" :foreground "white" :weight normal :height 200 :width normal :foundry "DAMA" :family "Ubuntu Mono")))))
c/c++ 学习互助QQ群:877684253

本人微信:xiaoshitou5854
emacs semantic,speedbar,gdb汇总的更多相关文章
- 在emacs 里使用gdb
		在emacs 里使用gdb M-x gdb就在emacs里启动了gdb 在gdb窗口里shell-mode的命令都适用 启动gdb后,再启动minor mode:M-x gud-tooltip-mod ... 
- emacs配置详解及C/C++IDE全功能配置演示(附配置文件)
		我的emacs插件下载地址: http://pan.baidu.com/share/link?shareid=4196458904&uk=3708780105 说明: 1.为什么使用emacs ... 
- 在Emacs下用C/C++编程(转载)
		转自:http://www.caole.net/diary/emacs_write_cpp.html Table of Contents 版权说明和参考文献 参考文献: 版权说明: 序 基本流程 基本 ... 
- Emacs安装配置全攻略之中的一个编译安装简单配置
		/*************************************************************************************************** ... 
- ubuntu 下emacs 配置
		(set-language-environment 'Chinese-GB) (set-keyboard-coding-system 'utf-8) (set-clipboard-coding-sys ... 
- 手把手教你学会 Emacs 定制
		Table of Contents 1 前言 2 配置Emacs 2.1 设置界面 2.2 全屏以及最大化 2.3 设置周边 2.4 显示时间设置 2.5 设置日历 2.6 设置符合个人的操作习惯 2 ... 
- GDB 调试器使用手冊
		使用GDB: 本文描写叙述GDB,GNU的原代码调试器. (这是4.12版1994年一月.GDB版本号4.16) * 文件夹: * 摘要: GDB的摘要 * 实例: 一个使用实例 * 入门: 进入和退 ... 
- Emacs常用基本操作
		按键约定 组合按键 Emacs中大量的按键操作都是各式各样的组合按键(快捷键),下面是几种通常的约定: Ctrl键:表示为C Alt键:表示为M Shift键:表示为S 组合按键:比如向下移动一行的组 ... 
- Emacs常用命令快速参考
		原文地址 Emacs常用命令的汇总,来自Emacs参考卡片 注意:以下命令中标注的按键,大写的C代表Control,在键盘上通常是Ctrl键,而M代表Meta,在键盘上通常是Alt键,S则代表Shif ... 
随机推荐
- 通过C#代码调用Dynamics 365 Web API执行批量操作
			我是微软Dynamics 365 & Power Platform方面的工程师罗勇,也是2015年7月到2018年6月连续三年Dynamics CRM/Business Solutions方面 ... 
- GO 全面解析 json tag 篇
			在处理json格式字符串的时候,经常会看到声明struct结构的时候,属性的右侧还有反引号括起来的内容.形如: type User struct { UserId int `json:"us ... 
- c程序内存检测工具 - Valgrind
			常用C程序内存泄露检测工具 https://blog.csdn.net/u012662731/article/details/78652651 
- mysql主从配置实现一主一从读写分离
			主从介绍Mysql主从又叫Replication.AB复制.简单讲就是A与B两台机器做主从后,在A上写数据,另外一台B也会跟着写数据,实现数据实时同步mysql主从是基于binlog,主上需开启bin ... 
- poj 1182  食物链 并查集 题解《挑战程序设计竞赛》
			地址 http://poj.org/problem?id=1182 题解 可以考虑使用并查集解决 但是并不是简单的记录是否同一组的这般使用 每个动物都有三个并查集 自己 天敌 捕食 并查集 那么在获得 ... 
- 算法问题实战策略 PICNIC
			下面是另一道搜索题目的解答过程题目是<算法问题实战策略>中的一题oj地址是韩国网站 连接比较慢 https://algospot.com/judge/problem/read/PICNIC ... 
- Linux学习笔记-第19天 结束了。突然感觉配置一个服务好简单的样子
			课程结束了,这本书又过了一遍,感觉学习到了不少的新知识.虽然整个过程老师讲的有点仓促,但回头想想身处于这个知识大爆炸的时代,学习不单要追求知识面宽广,更需要注重学习的效率,某种角度来讲,这也是一种鞭策 ... 
- Spring Batch与ETL工具比较
			在实际应用中,在批处理中用得较多的是场景是数据同步.在做数据集成工作中,常常需要从源位置把数据同步到目标位置,以便于进行后续的逻辑操作.在做这种批处理工具时,在网上查资料,发现用得比较多的是kettl ... 
- php time() 和 $_SERVER['REQUEST_TIME']
			time() 和 $_SERVER['REQUEST_TIME']效率 结果:(其中之一) 结论: time() : 执行时间在0.10 - 0.30 之间 $_SERVER['REQUEST_TIM ... 
- 【shell脚本】nginx启动脚本
			[root@localhost init.d]# cat nginx #!/bin/bash #nx Startup script for the Nginx HTTP Server # it ver ... 
