tags:

views:

360

answers:

2

When opening a file directly its fast, but when I open a recent file which is activated adding the following lines in my .emacs.:

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

it takes around 2 seconds to open.

Is this a normal behavior can I do something about it?

The command I use to open recent files:

My whole .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))
+1  A: 

It shouldnt take that long.

One thing to do is to clean up your recent files list.

ALT+x recentf-cleanup

Another thing to do is make sure that your .emacs file is freshly compiled, if you've changed even just a character or two then Emacs will see that your .emacs file is newer than the compiled version and it wont use the compiled version.

Run this:

ALT+x byte-compile-file

Then navigate to your .emacs file and hit Enter, it will create a file named .emacs.elc

Emacs will use .emacs.elc as long as it is not older than your .emacs file

AlexCombas
Thanks but didn't work I think my .emacs file is too small to see the compiled effect. It just went from 3kb to 2kb.
janoChen
+1  A: 

I had problem with recentf and remote file when the remote host was gone.

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

May solve your problem (remote file will be kept without testing if they still exists).

Rémi
Thanks but didn't work
janoChen