使用GTK在emacs 23.2中滚动滞后

时间:2010-06-02 07:00:50

标签: emacs emacs23

我正在使用带有GTK工具包的emacs 23.2。我使用以下configure-params从源代码构建了emacs:

./configure --prefix=/usr --without-makeinfo --without-sound

使用以下配置构建emacs:

  Where should the build process find the source code?    /home/****/incoming/emacs-23.2
  What operating system and machine description files should Emacs use?
        `s/gnu-linux.h' and `m/intel386.h'
  What compiler should emacs be built with?               gcc -g -O2 -Wdeclaration-after-statement -Wno-pointer-sign  
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    yes
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use -lpng?                                   yes
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 no
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   yes
  Does Emacs use -lxft?                                   yes
  Does Emacs use toolkit scroll bars?                     yes

我的操作系统是OpenSuSE 11.1,GTK版本是2.14.4。 当我在持有向上/向下键的常见大小(大约1000行)的文件中滚动时,emacs几乎挂起并产生大约50%的CPU负载。我使用以下插件:

  • IDO
  • 亚麻
  • 的TabBar
  • 自动完成-配置

使用-q启动emacs可以解决问题,但之后我没有任何插件。我无法弄清楚,.emacs的哪一部分对此行为负责。 这是我.emacs文件的摘录:

(require 'ido)
(ido-mode 1)

(require 'linum)
(global-linum-mode 1)

(require 'tabbar)
(tabbar-mode 1)
(tabbar-local-mode 0)
(tabbar-mwheel-mode 0)
(setq tabbar-buffer-groups-function
      (lambda ()
        (list "All")))
(global-set-key [M-left] 'tabbar-backward)
(global-set-key [M-right] 'tabbar-forward)

;; hide the toolbar (gtk etc.)
(tool-bar-mode -1)

;; Mouse scrolling enhancements
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-scroll-amount '(5 ((shift) . 5) ((control) . nil)))

;; Smart-HOME
(defun smart-beginning-of-line ()
  "Forces the cursor to jump to the first none whitespace char of the current line when pressing HOME"
  (interactive)
  (let ((oldpos (point)))
    (back-to-indentation)
    (and (= oldpos (point))
         (beginning-of-line))))
(put 'smart-beginning-of-line 'CUA 'move)
(global-set-key [home] 'smart-beginning-of-line)

(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.
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(custom-buffer-indent 4)
 '(delete-selection-mode nil)
 '(display-time-24hr-format t)
 '(display-time-day-and-date 1)
 '(display-time-mode t)
 '(global-font-lock-mode t nil (font-lock))
 '(inhibit-startup-buffer-menu t)
 '(inhibit-startup-screen t)
 '(pc-select-meta-moves-sexps t)
 '(pc-select-selection-keys-only t)
 '(pc-selection-mode t nil (pc-select))
 '(scroll-bar-mode (quote right))
 '(show-paren-mode t)
 '(standard-indent 4)
 '(uniquify-buffer-name-style (quote forward) nil (uniquify)))

(setq-default tab-width 4)
(setq-default indent-tabs-mode t)
(setq c-basic-offset 4)

;; Highlighting of the current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "#E8F2FE")

(defalias 'yes-or-no-p 'y-or-n-p)
(display-time)
(set-language-environment "Latin-1")

;; Change cursor color according to mode
(setq djcb-read-only-color       "gray")
;; valid values are t, nil, box, hollow, bar, (bar . WIDTH), hbar,
;; (hbar. HEIGHT); see the docs for set-cursor-type
(setq djcb-read-only-cursor-type 'hbar)
(setq djcb-overwrite-color       "red")
(setq djcb-overwrite-cursor-type 'box)
(setq djcb-normal-color          "black")
(setq djcb-normal-cursor-type    'bar)

(defun djcb-set-cursor-according-to-mode ()
  "change cursor color and type according to some minor modes."
  (cond
    (buffer-read-only
      (set-cursor-color djcb-read-only-color)
      (setq cursor-type djcb-read-only-cursor-type))
    (overwrite-mode
      (set-cursor-color djcb-overwrite-color)
      (setq cursor-type djcb-overwrite-cursor-type))
    (t 
      (set-cursor-color djcb-normal-color)
      (setq cursor-type djcb-normal-cursor-type))))
(add-hook 'post-command-hook 'djcb-set-cursor-according-to-mode)

(define-key global-map '[C-right] 'forward-sexp)
(define-key global-map '[C-left] 'backward-sexp)
(define-key global-map '[s-left] 'windmove-left)
(define-key global-map '[s-right] 'windmove-right)
(define-key global-map '[s-up] 'windmove-up)
(define-key global-map '[s-down] 'windmove-down)
(define-key global-map '[S-down-mouse-1] 'mouse-stay-and-copy)
(define-key global-map '[C-M-S-down-mouse-1] 'mouse-stay-and-swap)
(define-key global-map '[S-mouse-2] 'mouse-yank-and-kill)
(define-key global-map '[C-S-down-mouse-1] 'mouse-stay-and-kill)
(define-key global-map "\C-a" 'mark-whole-buffer)

(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 "#f7f9fa" :foreground "#191919" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
 '(font-lock-builtin-face ((((class color) (min-colors 88) (background light)) (:foreground "#642880" :weight bold))))
 '(font-lock-comment-face ((((class color) (min-colors 88) (background light)) (:foreground "#3f7f5f"))))
 '(font-lock-constant-face ((((class color) (min-colors 88) (background light)) (:weight bold))))
 '(font-lock-doc-face ((t (:inherit font-lock-string-face :foreground "#3f7f5f"))))
 '(font-lock-function-name-face ((((class color) (min-colors 88) (background light)) (:foreground "Black" :weight bold))))
 '(font-lock-keyword-face ((((class color) (min-colors 88) (background light)) (:foreground "#7f0055" :weight bold))))
 '(font-lock-preprocessor-face ((t (:inherit font-lock-builtin-face :foreground "#7f0055" :weight bold))))
 '(font-lock-string-face ((((class color) (min-colors 88) (background light)) (:foreground "#0000c0"))))
 '(font-lock-type-face ((((class color) (min-colors 88) (background light)) (:foreground "#7f0055" :weight bold))))
 '(font-lock-variable-name-face ((((class color) (min-colors 88) (background light)) (:foreground "Black"))))
 '(minibuffer-prompt ((t (:foreground "medium blue"))))
 '(mode-line ((t (:background "#222222" :foreground "White"))))
 '(tabbar-button ((t (:inherit tabbar-default :foreground "dark red"))))
 '(tabbar-button-highlight ((t (:inherit tabbar-default :background "white" :box (:line-width 2 :color "white")))))
 '(tabbar-default ((t (:background "gray90" :foreground "gray50" :box (:line-width 3 :color "gray90") :height 100))))
 '(tabbar-highlight ((t (:underline t))))
 '(tabbar-selected ((t (:inherit tabbar-default :foreground "blue" :weight bold))))
 '(tabbar-separator ((t nil)))
 '(tabbar-unselected ((t (:inherit tabbar-default)))))

有什么建议吗? 亲切的问候, mefiX

3 个答案:

答案 0 :(得分:5)

对我来说还不错。它与emacs -q一起运行的事实是关键,因为这意味着你可以解决问题。

现在,我希望有人根据您的文件为您提供简单的诊断,但如果没有(嘿,这是7个小时),您可以随时尝试标准的.emacs-debugging慢速教练。这不是特别有趣,但它会起作用。

选择你的快乐:

(A)分而治之

将您的.emacs精神分为4个部分。现在通过制作四个单独的试用emacs配置来确定哪个季度导致了您的问题:第一个包含1/4的emacs,下一个包含一半,下一个包含三个季度,最后一个包含所有内容。

emacs --no-site-file    # see if the problem is in your site-wide emacs init
emacs -q -l config1     # is it in the first quarter
emacs -q -l config2     # is it in the first half (i.e. the second quarter)
emacs -q -l config3     # is it in the third quarter
emads -q -l config4     # gotta be here, but test again to be sure

如果你没有找到罪魁祸首,你可以进一步分裂。如果您怀疑自己有罪魁祸首,或者更喜欢这种方法,请尝试以下方法:

(B)检查每一步

使用emacs -q

加载空白emacs

在缓冲区中访问您的.emacs

在另一个缓冲区中访问您的1K行文件。

使用eval-last-sexp C-x C-e或eval-region从头开始系统地尝试.emacs中的每个部分或行,或者从任何可疑的函数调用开始。

慢慢但肯定地,你会把它抽出来。对不起,我无法为您提供即时诊断。

答案 1 :(得分:2)

根据我的经验,关闭linum模式可以解决滚动冻结问题。

答案 2 :(得分:0)

我遇到了与emacs相同的问题24.原来是tabbar模式会降低它的速度。