Emacs中的tabbar问题

Vim、Emacs配置和使用
回复
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

Emacs中的tabbar问题

#1

帖子 houdini » 2007-03-10 0:00

最早用的是tabbar.el 1.2版本,发现打开文本文件.txt的时候正常,但打开代码文件是,tabbar上显示的不是文件名,而是文件的第一行。升级到2.0,问题依旧。

.txt tabbar显示正常
图片

代码文件 tabbar显示异常
图片

请问有没有朋友解决了这个问题? 谢谢

我用的是GNU Emacs23 CVS,.emacs中tabbar.el相关设置如下:

代码: 全选

(require 'tabbar)
(tabbar-mode) ;comment out this line to start without the tab on top
(global-set-key [(control shift h)] 'tabbar-mode)
(global-set-key [(control shift up)] 'tabbar-backward-group)
(global-set-key [(control shift down)] 'tabbar-forward-group)
(global-set-key [(control shift left)] 'tabbar-backward)
(global-set-key [(control shift right)] 'tabbar-forward)
(global-set-key [(control next)] 'tabbar-forward-tab)
(global-set-key [(control prior)] 'tabbar-backward-tab)
morningboat
帖子: 179
注册时间: 2006-06-09 20:31

#2

帖子 morningboat » 2007-03-10 13:52

你使用了ecb包,当文件是源代码文件而且ecb启动时,他会覆盖tabbar的显示。
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

#3

帖子 houdini » 2007-03-11 0:16

morningboat 写了:你使用了ecb包,当文件是源代码文件而且ecb启动时,他会覆盖tabbar的显示。
请问有什么解决的办法没有?

我暂时转进到 ibuffer.el了
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2007-03-11 12:32

我的没有问题啊~..
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

#5

帖子 houdini » 2007-03-11 13:42

BigSnake.NET 写了:我的没有问题啊~..
你装了ECB吗? GNU Emacs
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#6

帖子 BigSnake.NET » 2007-03-11 15:09

houdini 写了:
BigSnake.NET 写了:我的沒有問題啊~..
你裝了ECB嗎? GNU Emacs
跟你一樣

我的 .emacs.el

代码: 全选

;;基本加載路徑
(add-to-list 'load-path "~/.emacs.d")
(load "~/.emacs.d/subdirs")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(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.
 '(ecb-analyse-face ((((class color) (background dark)) (:inherit ecb-default-highlight-face :background "magenta3"))))
 '(ecb-method-non-semantic-face ((((class color) (background dark)) (:inherit ecb-methods-general-face :foreground "brown1"))))
 '(ecb-tag-header-face ((((class color) (background dark)) (:background "SeaGreen")))))

(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.
 '(ecb-options-version "2.32"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; 界面設置

                                        ;字體設置
(create-fontset-from-fontset-spec
 "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-fontset-sans")
(set-fontset-font
 "fontset-default" nil
 "-*-simsun-*-*-*-*-12-*-*-*-*-*-iso10646-1" nil 'prepend)
(set-default-font "fontset-sans")
(setq default-frame-alist
      (append '((font . "fontset-sans")) default-frame-alist))
                                        ;關閉起動時的那個"開機畫面"
(setq inhibit-startup-message t)
                                        ;關掉工具欄和滾動條
(tool-bar-mode -1)
(scroll-bar-mode -1)
                                        ;顏色主題
(require 'color-theme)
(color-theme-initialize)
(if window-system (color-theme-dark-blue2))
                                        ;語法高亮 
(global-font-lock-mode t)
(require 'generic)
(require 'generic-x)
                                        ;在標題欄顯示buffer的名字
(setq frame-title-format "emacs - %f")
                                        ;當有兩個文件名相同的緩衝時使用前綴的目錄名做 buffer名字
(setq uniquify-buffer-name-style 'forward)
                                        ;顯示時間
(setq display-time-24hr-format t)
(setq display-time-interval 10)
(display-time)
                                        ;用yes/no代替y/n
(fset 'yes-or-no-p 'y-or-n-p)
                                        ;顯示行列號
(line-number-mode t)
(column-number-mode t)
(require 'display-line-number)
(setq display-line-number-format "%3d|")
(global-set-key (kbd "C-c n") 'display-line-number-mode)
                                        ;當行數超過一定數值不再顯示行號
(setq line-number-display-limit 1000000)
                                        ;開關自動折行(Warp)
(setq truncate-partial-width-windows nil)
(global-set-key (kbd "C-c w") 'toggle-truncate-lines)
                                        ;設置有用的個人信息
(setq user-full-name "貓の中秋")
(setq user-mail-address "bigsnake_net@hotmail.com")
                                        ;進入Shell
(global-set-key (kbd "C-c s") 'shell)
                                        ;當使用M-x COMMAND後過1秒鐘顯示該 COMMAND 綁定的鍵
(setq suggest-key-bindings 1)


;;設置備份

(setq make-backup-files t) 
(setq version-control t) 
(setq kept-new-versions 3)
(setq kept-old-versions 1)
(setq delete-old-versions t)
(setq dired-kept-versions 1)


;; 編輯設置

                                        ;防止光標來回跳
(show-paren-mode t)
(setq show-paren-style 'parentheses)
                                        ;當光標在行尾上下移動的時候,始終保持在行尾。
(setq track-eol t)
                                        ;防止頁面滾動時跳動
(setq scroll-margin 3
      scroll-conservatively 10000)
                                        ;光標靠近鼠標指針時讓鼠標指針自動讓開
(mouse-avoidance-mode 'animate)
                                        ;中鍵粘貼
(setq mouse-yank-at-point t)
                                        ;支持emacs和外部程序的粘貼 
(setq x-select-enable-clipboard t)
                                        ;可以直接打開和顯示圖片
(auto-image-file-mode t)
                                        ;縮進設置
(setq-default indent-tabs-mode nil) 
(setq default-tab-width 8)
                                        ;設置 sentence-end 可以識別中文標點
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
                                        ;大多數情況下,回車後是要縮進的
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)
                                        ;Vim 的 o
(local-set-key (kbd "M-<return>") 'vi-open-next-line)
(defun vi-open-next-line (arg)
  "Move to the next line (like vi) and then opens a line."
  (interactive "p")
  (end-of-line)
  (open-line arg)
  (next-line 1)
  (indent-according-to-mode))
                                        ;啟動進入text mode
(setq default-major-mode 'text-mode)
                                        ;redo
(require 'redo)
(global-set-key (kbd "C-+") 'redo)



;; mark 相關

                                        ;高亮顯示要拷貝的區域
(transient-mark-mode t)
                                        ;高亮矩形
(require 'rect-mark)
                                        ;mark 的鍵綁定
(global-set-key (kbd "s-SPC") 'set-mark-command)
(global-set-key (kbd "S-SPC") 'set-mark-command)
(global-set-key (kbd "C-x r s-SPC") 'rm-set-mark)
(global-set-key (kbd "C-x r S-SPC") 'rm-set-mark)
(global-set-key (kbd "C-x r C-x") 'rm-exchange-point-and-mark)


;; 高級的killing和yanking
                                        ;沒有選擇任何東西時復制/剪切整行
(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)))))

;; (global-set-key [(control w)] 'kill-syntax-backward)
;; (global-set-key [(control d)] 'kill-syntax-forward)
;; (defun kill-syntax-forward ()
;;   "Kill characters with syntax at point."
;;   (interactive)
;;   (kill-region (point)
;;                (progn (skip-syntax-forward (string (char-syntax (char-after))))
;;                       (point))))
;; (defun kill-syntax-backward ()
;;   "Kill characters with syntax at point."
;;   (interactive)
;;   (kill-region (point)
;;                (progn (skip-syntax-backward (string (char-syntax (char-before))))
;;                       (point))))


                                        ;移動整行的功能
                                        ;meta+箭頭移動行
(defun bsn-move-line (&optional n)
  "Move current line N (1) lines up/down leaving point in place."
  (interactive "p")
  (when (null n)
    (setq n 1))
  (let ((col (current-column)))
    (beginning-of-line)
    (next-line 1)
    (transpose-lines n)
    (previous-line 1)
    (forward-char col)))
(defun bsn-move-line-up (n)
  "Moves current line N (1) lines up leaving point in place."
  (interactive "p")
  (bsn-move-line (if (null n) -1 (- n)))) 
(defun bsn-move-line-down (n)
  "Moves current line N (1) lines down leaving point in place."
  (interactive "p")
  (bsn-move-line (if (null n) 1 n)))
(global-set-key (kbd "M-<down>") 'bsn-move-line-down) 
(global-set-key (kbd "M-<up>") 'bsn-move-line-up)
                                        ;設置刪除紀錄
(setq kill-ring-max 200)
(require 'browse-kill-ring+)
(global-set-key (kbd "C-c k") 'browse-kill-ring)


;; 更強的搜索

                                        ;Always end searches at the beginning of the matching expression.
(defun bsn-goto-match-beginning ()
  "Use with isearch hook to end search at first char of match."
  (when isearch-forward (goto-char isearch-other-end)))
(add-hook 'isearch-mode-end-hook 'bsn-goto-match-beginning)
                                        ;C-s和C-r改成漸進正則表達式搜索
(global-set-key [(control s)] 'isearch-forward-regexp)
(global-set-key [(control r)] 'isearch-backward-regexp)

;搜索光標下的東東
(defun isearch-forward-current-word-keep-offset ()
  "Mimic vi search foward at point feature."
  (interactive)
  (let ((re-curword) (curword) (offset (point)) 
        (old-case-fold-search case-fold-search) )
    (setq curword (thing-at-point 'symbol))
    (setq re-curword (concat "\\<" (thing-at-point 'symbol) "\\>") )
    (beginning-of-thing 'symbol)
    (setq offset (- offset (point))) ; offset from start of symbol/word
    (setq offset (- (length curword) offset)) ; offset from end
    (forward-char)
    (setq case-fold-search nil)
    (if (re-search-forward re-curword nil t)
        (backward-char offset)
      ;; else
      (progn (goto-char (point-min))
             (if (re-search-forward re-curword nil t)
                 (progn (message "Searching from top. %s" (what-line))
                        (backward-char offset))
               ;; else
               (message "Searching from top: Not found"))))
    (setq case-fold-search old-case-fold-search)))
(defun isearch-backward-current-word-keep-offset ()
  "Mimic vi search backwards at point feature."
  (interactive)
  (let ((re-curword) (curword) (offset (point)) 
        (old-case-fold-search case-fold-search) )
    (setq curword (thing-at-point 'symbol))
    (setq re-curword (concat "\\<" curword "\\>") )
    (beginning-of-thing 'symbol)
    (setq offset (- offset (point))) ; offset from start of symbol/word
    (forward-char)
    (setq case-fold-search nil)
    (if (re-search-backward re-curword nil t)
        (forward-char offset)
      ;; else
      (progn (goto-char (point-max))
             (if (re-search-backward re-curword nil t)
                 (progn (message "Searching from bottom. %s" (what-line))
                        (forward-char offset))
               ;; else
               (message "Searching from bottom: Not found"))))
    (setq case-fold-search old-case-fold-search)))
(global-set-key (kbd "C-M-s") 'isearch-forward-current-word-keep-offset)
(global-set-key (kbd "C-M-r") 'isearch-backward-current-word-keep-offset)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;buffer 管理
                                        ;ido 和 ibuffer
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(require 'ido)
(ido-mode t)
(setq ido-enable-tramp-completion t)
(setq ido-save-directory-list-file nil)

                                        ;tab欄
(require 'tabbar)
(tabbar-mode t)
(global-set-key (kbd "s-<up>") 'tabbar-backward-group)
(global-set-key (kbd "s-<down>") 'tabbar-forward-group)
(global-set-key (kbd "s-<left>") 'tabbar-backward)
(global-set-key (kbd "s-<right>") 'tabbar-forward)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;dired

                                        ;讓dired 可以遞歸的拷貝和刪除目錄
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
                                        ;這裡以後將會有一大堆東西..占位
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 編程設置

                                        ; C/C++
(defun bsn-linux-c-mode()
  (define-key c++-mode-map [return] 'newline-and-indent)
  (define-key c-mode-map [return] 'newline-and-indent)
  (interactive)
  (require 'cc-mode)
  (c-set-style "K&R")
  ;;  (setq c-basic-offset 8)
  (c-toggle-auto-newline t)
  (c-toggle-hungry-state t)
  (imenu-add-menubar-index)
  (setq c-basic-offset 8)
  )
(add-hook 'c-mode-hook 'bsn-linux-c-mode)
(add-hook 'c++-mode-hook 'bsn-linux-c-mode)

;自動補全
(setq hippie-expand-try-functions-list
      '(try-expand-line
        try-expand-dabbrev
        try-expand-line-all-buffers
        try-expand-list
        try-expand-list-all-buffers
        try-expand-dabbrev-visible
        try-expand-dabbrev-all-buffers
        try-expand-dabbrev-from-kill
        try-complete-file-name
        try-complete-file-name-partially
        try-complete-lisp-symbol
        try-complete-lisp-symbol-partially
        try-expand-whole-kill))
;;(global-set-key (kbd "M-;") 'hippie-expand)
(global-set-key (kbd "M-/") 'hippie-expand)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;一些插件

;;xcscope
(require 'xcscope)

;;cede
(require 'cogre)
(require 'ede)
(require 'speedbar)
(require 'semantic)
(require 'eieio)
(require 'cedet)


;;ecb代碼瀏覽器
(require 'ecb)
(setq ecb-tip-of-the-day nil)
(setq ecb-options-version "2.32")
;; (ecb-tree-truncate-line nil)
(setq ecb-truncate-long-names nil)
(setq ecb-windows-height 0.25)
(setq ecb-windows-width 0.25)


;;session和desktop插件,需要放在最後
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
(require 'desktop)
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

#7

帖子 houdini » 2007-03-12 16:45

怪了,我看了你的.emacs,相关设置和我的没什么大区别,但在我这里就是不行。

Emacs 23 alpha
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#8

帖子 BigSnake.NET » 2007-03-13 20:40

我的是一月份编的CVS
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
weigangme
帖子: 34
注册时间: 2006-05-22 23:16
来自: 湖北武汉
联系:

#9

帖子 weigangme » 2007-04-22 14:54

可能是semantic 的 问题
按照这里的 方法:
viewtopic.php?t=18274
弄好后会出现上面的问题。

代码: 全选

(add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
     (load-file "/home/zhan/myEmacs/cedet-1.0beta3b/common/cedet.el")
     (semantic-load-enable-code-helpers)
     (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
     (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
     (define-key-after (lookup-key global-map [menu-bar tools])
                                       [speedbar]
                                       '("Speedbar" .
                                       speedbar-frame-mode)
                                       [calendar]) 
把上面的

代码: 全选

  (semantic-load-enable-code-helpers)
换成下面的第1 和第 4 个

代码: 全选

 
           (semantic-load-enable-minimum-features)                                    
           (semantic-load-enable-code-helpers)                                       
           (semantic-load-enable-excessive-code-helpers)                             
           (semantic-load-enable-semantic-debugging-helpers)  
就没有问题。而第2和3 个有问题。不过换成第1 和第 4 个的话,emacs的菜单中就没有了 TAGS 和 senator 选项,不知道怎么解决。
cnspy
帖子: 51
注册时间: 2005-07-13 9:06

re

#10

帖子 cnspy » 2007-04-30 16:48

问题解决了吗?我的emacs 21不能把打开的文件放到同一个 bar上。
haoeng
帖子: 70
注册时间: 2005-08-24 10:21

我的Emacs23也遇到过同样的问题

#11

帖子 haoeng » 2007-07-01 22:16

我把下面这句注释了就好了
(semantic-load-enable-guady-code-helpers)
在我们力求安定的未来的岁月里,我们期待一个建立在四项人类基本自由之上的世界。
第一是在全世界任何地方发表言论和表达意见的自由。
第二是在全世界任何地方,人人有以自己的方式来崇拜上帝的自由。
第三是不虞匮乏的自由
第四是免除恐惧的自由
--富兰克林.罗斯福
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

#12

帖子 houdini » 2007-07-20 23:22

最近重新编译了CVS版本的GNU Emacs,安装了cedet-1.0pre4和ecb-2.32,这个问题又诡异地消失了
An Addicted KDE User
头像
houdini
帖子: 250
注册时间: 2006-04-08 22:07
联系:

Re: re

#13

帖子 houdini » 2007-07-21 16:53

cnspy 写了:问题解决了吗?我的emacs 21不能把打开的文件放到同一个 bar上。
这是分组的原因。如下解决(这样最多有两个group):

代码: 全选

;; ignore groups, max group=2
(setq tabbar-buffer-groups-function 'tabbar-buffer-ignore-groups)
(defun tabbar-buffer-ignore-groups (buffer)
"Return the list of group names BUFFER belongs to.
Return only one group for each buffer."
(with-current-buffer (get-buffer buffer)
(cond
((or (get-buffer-process (current-buffer))
(memq major-mode
'(comint-mode compilation-mode)))
'("Process")
)
((member (buffer-name)
'("*scratch*" "*Messages*"))
'("Common")
)
((eq major-mode 'dired-mode)
'("Dired")
)
((memq major-mode
'(help-mode apropos-mode Info-mode Man-mode))
'("Help")
)
((memq major-mode
'(rmail-mode
rmail-edit-mode vm-summary-mode vm-mode mail-mode
mh-letter-mode mh-show-mode mh-folder-mode
gnus-summary-mode message-mode gnus-group-mode
gnus-article-mode score-mode gnus-browse-killed-mode))
'("Mail")
)
(t
(list
"default" ;; no-grouping
(if (and (stringp mode-name) (string-match "[^ ]" mode-name))
mode-name
(symbol-name major-mode)))
)
)))
An Addicted KDE User
回复