Emacs打开最近的文件很慢!

时间:2010-01-15 00:49:13

标签: emacs file performance

直接打开文件的速度很快,但当我打开最近激活的文件时,在.emacs.中添加以下行:

(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

打开需要大约2秒钟。

这是一种正常行为吗?我能为此做点什么吗?

我用来打开最近文件的命令:

我的整个.emacs:

(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.
 '(tool-bar-mode nil))
(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 "Grey15" :foreground "Grey" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 92 :width normal :foundry "outline" :family "Monaco")))))

  ;;colot theme plugin
(add-to-list 'load-path "~/.emacs.d/")
(require 'color-theme)
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-charcoal-black)))

  ;;YASnippets
(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c")
    (require 'yasnippet) ;; not yasnippet-bundle
    (yas/initialize)
    (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets")

;; disable splash screen and startup message
(setq inhibit-startup-message t)

;; set yasnippet no indent
(setq yas/indent-line 'none)

;; set the tab width
(setq default-tab-width 4)
(setq tab-width 4)
(setq c-basic-indent 4)

;; set open recent files

(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)

;; set line number
(global-linum-mode 1)

;; prevent emacs from making backup files
(setq make-backup-files nil) 

;; same syntax hightlight for all languages
(global-font-lock-mode 1)

;; remove bold and underline
 (mapc
  (lambda (face)
    (set-face-attribute face nil :weight 'normal :underline nil))
  (face-list))

2 个答案:

答案 0 :(得分:9)

当远程主机消失时,我遇到了recentf和远程文件的问题。

(setq recentf-keep '(file-remote-p file-readable-p))

可以解决您的问题(远程文件将保留而不进行测试,如果它们仍然存在)。

答案 1 :(得分:2)

不应该花那么长时间。

要做的一件事是清理最近的文件列表。

ALT + x recentf-cleanup

要做的另一件事是确保您的.emacs文件是新编译的,如果您甚至只更改了一两个字符,那么Emacs将看到您的.emacs文件比编译版本更新并且它不会使用编译版。

运行:

ALT + x byte-compile-file

然后导航到.emacs文件并按Enter键,它将创建一个名为.emacs.elc的文件

Emacs将使用.emacs.elc,只要它不比您的.emacs文件旧