【问题标题】:Emacs is slow opening recent files!Emacs 打开最近的文件很慢!
【发布时间】:2010-01-15 00:49:12
【问题描述】:

直接打开文件时速度很快,但是当我打开最近激活的文件时,在我的.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))

【问题讨论】:

  • 什么版本的emacs?我发现 23.1 在 Windows 上的速度并不快。
  • 请参阅stackoverflow.com/questions/2007329/… 以了解一些尝试。
  • 我最近遇到了同样的问题。你解决了吗?

标签: emacs file performance


【解决方案1】:

当远程主机消失时,recentf 和远程文件出现问题。

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

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

【讨论】:

    【解决方案2】:

    应该不会花那么长时间。

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

    ALT+xrecentf-cleanup

    要做的另一件事是确保你的 .emacs 文件是新编译的,如果你只改变了一两个字符,那么 Emacs 会发现你的 .emacs 文件比编译后的版本新,它不会使用编译版。

    运行这个:

    ALT+x字节编译文件

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

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

    【讨论】:

    • 谢谢,但没用我觉得我的 .emacs 文件太小,看不到编译效果。它刚刚从 3kb 变成了 2kb。
    猜你喜欢
    • 2021-07-28
    • 1970-01-01
    • 2015-09-19
    • 2010-11-19
    • 2017-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-24
    相关资源
    最近更新 更多