[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Opening a bookmark in the init file
From: |
Drew Adams |
Subject: |
RE: Opening a bookmark in the init file |
Date: |
Sun, 8 Mar 2015 14:24:18 -0700 (PDT) |
> In my .emacs file I put:
> (bookmark-load "~/.emacs.bmk")
> (add-hook 'emacs-startup-hook '(lambda () (bookmark-jump "TODO")))
>
> It worked for a few days but I noticed Emacs was becoming slow to
> startup. Today I had to restart Emacs a few times. The last time it
> took several minutes to starts. The bookmark file was the culprit. For
> some reason every entry had been duplicated with the text <2> in front
> of it. Then it had been duplicated again with the text <3> in front of
> that, and so one. This caused by bookmark file to double in size on
> every restart until it was ~50MB long. I found that the two lines above
> are the cause. If you add a bookmark-jump to emacs-startup-hook then
> something goes wrong somewhere.
For some reason, you chose to call function `bookmark-load'.
If you do that it behooves you to check its doc first ;-):
,----
| bookmark-load is an interactive autoloaded Lisp function in
| `bookmark.el'.
|
| It is bound to <menu-bar> <edit> <bookmark> <load>.
|
| (bookmark-load FILE &optional OVERWRITE NO-MSG)
|
| Load bookmarks from FILE (which must be in bookmark format).
| Appends loaded bookmarks to the front of the list of bookmarks. If
| optional second argument OVERWRITE is non-nil, existing bookmarks are
| destroyed. Optional third arg NO-MSG means don't display any messages
| while loading.
|
| If you load a file that doesn't contain a proper bookmark alist, you
| will corrupt Emacs's bookmark list. Generally, you should only load
| in files that were created with the bookmark functions in the first
| place. Your own personal bookmark file, `~/.emacs.bmk', is
| maintained automatically by Emacs; you shouldn't need to load it
| explicitly.
|
| If you load a file containing bookmarks with the same names as
| bookmarks already present in your Emacs, the new bookmarks will get
| unique numeric suffixes "<2>", "<3>", etc.
`----
See the last paragraph. You are loading your bookmark file more
than once. Most likely you are doing an explicit `bookmark-load'
when your bookmark file has already been loaded. Don't do that. ;-)
You can use function `bookmark-maybe-load-default-file'
instead of `bookmark-load'. (There is also variable
`bookmarks-already-loaded', but you should not need to check it.)
But before bothering to fiddle with such things, check what you
are really doing, to see how/why/where else you are loading your
bookmark file, and perhaps simplify your code accordingly.