* Re: Opening a bookmark in the init file
[not found] <mailman.1196.1425343655.31049.help-gnu-emacs@gnu.org>
@ 2015-03-03 1:04 ` Emanuel Berg
2015-03-03 2:34 ` Robert Thorpe
0 siblings, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2015-03-03 1:04 UTC (permalink / raw)
To: help-gnu-emacs
Robert Thorpe <rt@robertthorpeconsulting.com> writes:
> For years I've setup Emacs so it presents me with my
> ToDo list at startup. It doesn't put me in the right
> place in the file though. I can bookmark the place
> in the file, but using bookmark-jump in the init
> file doesn't work and it doesn't work in
> emacs-startup-hook either.
What's the right place? At the end of the file where
the most recent entries are?
(find-file "~/TODO")
(goto-char (point-max))
--
underground experts united
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Opening a bookmark in the init file
2015-03-03 1:04 ` Opening a bookmark in the init file Emanuel Berg
@ 2015-03-03 2:34 ` Robert Thorpe
0 siblings, 0 replies; 10+ messages in thread
From: Robert Thorpe @ 2015-03-03 2:34 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
> (find-file "~/TODO")
> (goto-char (point-max))
That's exactly the code I was using previously. The problem was the
I've organized the file so the least important tasks are at the bottom.
It's got so long that the most important tasks are no longer on the same
screen. I should probably be doing things in my TODO list rather than
fixing how it's shown.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <mailman.1200.1425350100.31049.help-gnu-emacs@gnu.org>]
* Re: Opening a bookmark in the init file
[not found] <mailman.1200.1425350100.31049.help-gnu-emacs@gnu.org>
@ 2015-03-03 2:52 ` Emanuel Berg
0 siblings, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2015-03-03 2:52 UTC (permalink / raw)
To: help-gnu-emacs
Robert Thorpe <rt@robertthorpeconsulting.com> writes:
>> (find-file "~/TODO") (goto-char (point-max))
>
> That's exactly the code I was using previously. The
> problem was the I've organized the file so the least
> important tasks are at the bottom. It's got so long
> that the most important tasks are no longer on the
> same screen. I should probably be doing things in my
> TODO list rather than fixing how it's shown.
Ha! Ranking the tasks sounds like overkill. If I
remember correctly from CS theory SJF (Shortest Job
First) is the best algorithm provided you can tell
what task is the shortest (an estimate should be
sufficient in real life).
But, I like the idea of a lightning-fast TODO list
interface so whenever you get an idea, you can just
add it to the TODO list 1 second and continue to work
on whatever you were doing. When you get bored, bring
up the TODO list to the rescue...
I have it as M-x todo as well as todo in the shell.
Emacs: http://user.it.uu.se/~embe8573/conf/emacs-init/todo-did.el
zsh: http://user.it.uu.se/~embe8573/conf/.zsh/todo
--
underground experts united
^ permalink raw reply [flat|nested] 10+ messages in thread
* Opening a bookmark in the init file
@ 2015-03-03 0:47 Robert Thorpe
2015-03-03 0:56 ` Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2015-03-03 0:47 UTC (permalink / raw)
To: help-gnu-emacs
For years I've setup Emacs so it presents me with my ToDo list at
startup. It doesn't put me in the right place in the file though. I
can bookmark the place in the file, but using bookmark-jump in the init
file doesn't work and it doesn't work in emacs-startup-hook either.
I know I can use desktop.el to save and restore everything. I don't
want all the other buffers saved and restored though.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Opening a bookmark in the init file
2015-03-03 0:47 Robert Thorpe
@ 2015-03-03 0:56 ` Drew Adams
2015-03-03 2:32 ` Robert Thorpe
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2015-03-03 0:56 UTC (permalink / raw)
To: Robert Thorpe, help-gnu-emacs
> For years I've setup Emacs so it presents me with my ToDo list at
> startup. It doesn't put me in the right place in the file though. I
> can bookmark the place in the file, but using bookmark-jump in the init
> file doesn't work and it doesn't work in emacs-startup-hook either.
Why doesn't it work in your init file? Of course you will need to
load your bookmarks file before trying to jump to the bookmark.
But doing that and jumping to a bookmark is just invoking Lisp
functions. Nothing special - you can invoke pretty much any
Lisp functions you like from your init file.
I suggest that you specify in detail what you have tried, and
perhaps people here will be able to help. If you do that, keep
it simple - an init file that does only what you are trying to
do in this regard.
Start by just trying to jump to a simple bookmark from your init
file - not a special bookmark (just a static file position),
not involving any other code, whether Org to-do stuff or anything
else, and with a bookmarks file that contains very little - maybe
only that bookmark. And start from `emacs -Q`, of course.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Opening a bookmark in the init file
2015-03-03 0:56 ` Drew Adams
@ 2015-03-03 2:32 ` Robert Thorpe
[not found] ` <(message>
2015-03-08 19:18 ` Robert Thorpe
0 siblings, 2 replies; 10+ messages in thread
From: Robert Thorpe @ 2015-03-03 2:32 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
Drew Adams <drew.adams@oracle.com> writes:
>> For years I've setup Emacs so it presents me with my ToDo list at
>> startup. It doesn't put me in the right place in the file though. I
>> can bookmark the place in the file, but using bookmark-jump in the init
>> file doesn't work and it doesn't work in emacs-startup-hook either.
>
> Why doesn't it work in your init file? Of course you will need to
> load your bookmarks file before trying to jump to the bookmark.
That was the problem. When I loaded the file with (bookmark-load
"~/.emacs.bmk") it worked.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <(message>]
* Re: Opening a bookmark in the init file
2015-03-03 2:32 ` Robert Thorpe
[not found] ` <(message>
@ 2015-03-08 19:18 ` Robert Thorpe
2015-03-08 21:24 ` Drew Adams
1 sibling, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2015-03-08 19:18 UTC (permalink / raw)
To: Robert Thorpe; +Cc: help-gnu-emacs
Robert Thorpe <rt@robertthorpeconsulting.com> writes:
> Drew Adams <drew.adams@oracle.com> writes:
>
>>> For years I've setup Emacs so it presents me with my ToDo list at
>>> startup. It doesn't put me in the right place in the file though. I
>>> can bookmark the place in the file, but using bookmark-jump in the init
>>> file doesn't work and it doesn't work in emacs-startup-hook either.
>>
>> Why doesn't it work in your init file? Of course you will need to
>> load your bookmarks file before trying to jump to the bookmark.
>
> That was the problem. When I loaded the file with (bookmark-load
> "~/.emacs.bmk") it worked.
This fix only worked for a while. 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.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Opening a bookmark in the init file
2015-03-08 19:18 ` Robert Thorpe
@ 2015-03-08 21:24 ` Drew Adams
2015-03-08 21:48 ` Robert Thorpe
0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2015-03-08 21:24 UTC (permalink / raw)
To: Robert Thorpe; +Cc: help-gnu-emacs
> 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Opening a bookmark in the init file
2015-03-08 21:24 ` Drew Adams
@ 2015-03-08 21:48 ` Robert Thorpe
2015-03-08 22:52 ` Drew Adams
0 siblings, 1 reply; 10+ messages in thread
From: Robert Thorpe @ 2015-03-08 21:48 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
Drew Adams <drew.adams@oracle.com> writes:
> For some reason, you chose to call function `bookmark-load'.
> If you do that it behooves you to check its doc first ;-):
Good point.
> 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.)
Using that works without any problems. Thanks.
> 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.
I'm loading the bookmark file because it doesn't work otherwise. If I
just do:
(add-hook 'emacs-startup-hook '(lambda () (bookmark-jump "TODO")))
Then Emacs gives an error "Invalid Bookmark TODO". It seems that the
bookmarks are loaded after emacs-startup-hook, which is odd. If I load
them before it works though.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Opening a bookmark in the init file
2015-03-08 21:48 ` Robert Thorpe
@ 2015-03-08 22:52 ` Drew Adams
0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2015-03-08 22:52 UTC (permalink / raw)
To: Robert Thorpe; +Cc: help-gnu-emacs
> > 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.
>
> I'm loading the bookmark file because it doesn't work otherwise.
> If I just do:
>
> (add-hook 'emacs-startup-hook '(lambda () (bookmark-jump "TODO")))
>
> Then Emacs gives an error "Invalid Bookmark TODO". It seems that the
> bookmarks are loaded after emacs-startup-hook, which is odd. If I load
> them before it works though.
Many functions call `bookmark-maybe-load-default-file' (which loads
the bookmark file if it has not been loaded).
If you don't want to call that instead of `bookmark-load' then
try to find out what, during your startup, loads the file.
Do `M-x debug-on-entry RET bookmark-load RET' to see what calls
`bookmark-load' the first time.
There is no harm in calling `bookmark-maybe-load-default-file'.
I mention trying to find out what was causing the first load as a
way of helping you understanding what was happening.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-08 22:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1196.1425343655.31049.help-gnu-emacs@gnu.org>
2015-03-03 1:04 ` Opening a bookmark in the init file Emanuel Berg
2015-03-03 2:34 ` Robert Thorpe
[not found] <mailman.1200.1425350100.31049.help-gnu-emacs@gnu.org>
2015-03-03 2:52 ` Emanuel Berg
2015-03-03 0:47 Robert Thorpe
2015-03-03 0:56 ` Drew Adams
2015-03-03 2:32 ` Robert Thorpe
[not found] ` <(message>
[not found] ` <from>
[not found] ` <Robert>
[not found] ` <Thorpe>
[not found] ` <on>
[not found] ` <Tue>
[not found] ` <03>
[not found] ` <Mar>
[not found] ` <2015>
[not found] ` <14:24:18>
[not found] ` <-0700>
[not found] ` <02:32:50>
[not found] ` <Sun>
[not found] ` <Drew>
2015-03-08 19:18 ` Robert Thorpe
2015-03-08 21:24 ` Drew Adams
2015-03-08 21:48 ` Robert Thorpe
2015-03-08 22:52 ` Drew Adams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).