* bookmark+ help required
@ 2015-04-15 19:24 Guido Van Hoecke
2015-04-15 19:55 ` Milan Stanojević
2015-04-15 20:02 ` tomas
0 siblings, 2 replies; 6+ messages in thread
From: Guido Van Hoecke @ 2015-04-15 19:24 UTC (permalink / raw)
To: Emacs
Hi,
I switched to bookmark+ and some of my bookmarks now have a different
format:
Old format:
#1=(#("past.org" 0 8
(bmkp-full-record #1#))
(filename . "~/org/past.org")
(front-context-string . "* DONE <2013-04-")
(rear-context-string)
(position . 1))
New format:
#1=(#("agenda.org" 0 10
(bmkp-full-record #1#))
(end-position . 12206)
(time 21790 27563 50717 0)
(visits . 0)
(filename . "~/org/agenda.org")
(front-context-string . "* TODO <2013-05-")
(rear-context-string . "g niet gestart!\n")
(position . 12206))
I have an eshell function that allows me to type `j bookmark` (got it
from http://www.emacswiki.org/emacs/EshellBmk (thanks!)) and it fails
with the new format: it expects the 'filename' cell up front in the
record. That works with the old records, but not the new ones. In the
above 'agenda.org' bookmark it thinks that the filename is '12206'.
Here's the relevant code:
(if (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))
My lisp is not up to turning this into an expression that would
correctly load the filename from old formats as well as from the newer
format.
Any help and suggestion would be most welcome and appreciated.
TIA,
Guido
Note: I am very willing to update the wiki with proposed working
solution and give due credit to you guys.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: bookmark+ help required
2015-04-15 19:24 bookmark+ help required Guido Van Hoecke
@ 2015-04-15 19:55 ` Milan Stanojević
2015-04-15 20:02 ` tomas
1 sibling, 0 replies; 6+ messages in thread
From: Milan Stanojević @ 2015-04-15 19:55 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: Emacs
Try this
(if (setq filename (cdr (assoc 'filename (bookmark-get-bookmark-record
bookmark))))
On Wed, Apr 15, 2015 at 3:24 PM, Guido Van Hoecke <guivho@gmail.com> wrote:
> Hi,
>
> I switched to bookmark+ and some of my bookmarks now have a different
> format:
>
> Old format:
> #1=(#("past.org" 0 8
> (bmkp-full-record #1#))
> (filename . "~/org/past.org")
> (front-context-string . "* DONE <2013-04-")
> (rear-context-string)
> (position . 1))
>
> New format:
> #1=(#("agenda.org" 0 10
> (bmkp-full-record #1#))
> (end-position . 12206)
> (time 21790 27563 50717 0)
> (visits . 0)
> (filename . "~/org/agenda.org")
> (front-context-string . "* TODO <2013-05-")
> (rear-context-string . "g niet gestart!\n")
> (position . 12206))
>
> I have an eshell function that allows me to type `j bookmark` (got it
> from http://www.emacswiki.org/emacs/EshellBmk (thanks!)) and it fails
> with the new format: it expects the 'filename' cell up front in the
> record. That works with the old records, but not the new ones. In the
> above 'agenda.org' bookmark it thinks that the filename is '12206'.
>
> Here's the relevant code:
> (if (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))
>
> My lisp is not up to turning this into an expression that would
> correctly load the filename from old formats as well as from the newer
> format.
>
> Any help and suggestion would be most welcome and appreciated.
>
> TIA,
>
> Guido
>
> Note: I am very willing to update the wiki with proposed working
> solution and give due credit to you guys.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: bookmark+ help required
2015-04-15 19:24 bookmark+ help required Guido Van Hoecke
2015-04-15 19:55 ` Milan Stanojević
@ 2015-04-15 20:02 ` tomas
1 sibling, 0 replies; 6+ messages in thread
From: tomas @ 2015-04-15 20:02 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: Emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, Apr 15, 2015 at 09:24:15PM +0200, Guido Van Hoecke wrote:
> Hi,
>
> I switched to bookmark+ and some of my bookmarks now have a different
> format:
>
> Old format:
> #1=(#("past.org" 0 8
> (bmkp-full-record #1#))
> (filename . "~/org/past.org")
> (front-context-string . "* DONE <2013-04-")
> (rear-context-string)
> (position . 1))
>
> New format:
> #1=(#("agenda.org" 0 10
> (bmkp-full-record #1#))
> (end-position . 12206)
> (time 21790 27563 50717 0)
> (visits . 0)
> (filename . "~/org/agenda.org")
> (front-context-string . "* TODO <2013-05-")
> (rear-context-string . "g niet gestart!\n")
> (position . 12206))
>
> I have an eshell function that allows me to type `j bookmark` (got it
> from http://www.emacswiki.org/emacs/EshellBmk (thanks!)) and it fails
> with the new format: it expects the 'filename' cell up front in the
> record. That works with the old records, but not the new ones. In the
> above 'agenda.org' bookmark it thinks that the filename is '12206'.
>
> Here's the relevant code:
> (if (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))
You might try instead
(if (setq filename (cdr (assq 'filename (bookmark-get-bookmark-record bookmark))))
The "assq filename" extracts just the pair whose first half is the symbol
'filename: thus it should hit home in both cases.
HTH
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlUuw7oACgkQBcgs9XrR2kbM2wCfQUve85zQ65cZDrfMMwaQcbo2
SvkAn1aVpbDyYBF2FQGvtVjtsl6MwJ/P
=NMSu
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <<m28udtmbz4.fsf@gmail.com>]
* RE: bookmark+ help required
[not found] <<m28udtmbz4.fsf@gmail.com>
@ 2015-04-15 20:23 ` Drew Adams
2015-04-15 21:14 ` Guido Van Hoecke
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2015-04-15 20:23 UTC (permalink / raw)
To: Guido Van Hoecke, Emacs
> I switched to bookmark+ and some of my bookmarks now have a different
> format:
>
> Old format:
> #1=(#("past.org" 0 8
> (bmkp-full-record #1#))
> (filename . "~/org/past.org")
> (front-context-string . "* DONE <2013-04-")
> (rear-context-string)
> (position . 1))
>
> New format:
> #1=(#("agenda.org" 0 10
> (bmkp-full-record #1#))
> (end-position . 12206)
> (time 21790 27563 50717 0)
> (visits . 0)
> (filename . "~/org/agenda.org")
> (front-context-string . "* TODO <2013-05-")
> (rear-context-string . "g niet gestart!\n")
> (position . 12206))
>
> I have an eshell function that allows me to type `j bookmark` (got it
> from http://www.emacswiki.org/emacs/EshellBmk (thanks!)) and it fails
> with the new format: it expects the 'filename' cell up front in the
> record. That works with the old records, but not the new ones. In the
> above 'agenda.org' bookmark it thinks that the filename is '12206'.
>
> Here's the relevant code:
> (if (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))
That code is mistaken. This is the proper code to access the `filename'
field of bookmark BOOKMARK:
(bookmark-get-filename BOOKMARK)
And for any field that does not have its own dedicated access function
(such as field `filename' has with `bookmark-get-filename'), code should
use `bookmark-prop-get' to access that field value.
This is not Bookmark+-specific. This is what is used for vanilla
bookmark.el also. The order of the field recorded in a bookmark is
(must be) irrelevant. The only positional requirement is that the
bookmark name be the car of the full bookmark record.
> My lisp is not up to turning this into an expression that would
> correctly load the filename from old formats as well as from the newer
> format. Any help and suggestion would be most welcome and appreciated.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: bookmark+ help required
2015-04-15 20:23 ` Drew Adams
@ 2015-04-15 21:14 ` Guido Van Hoecke
2015-04-16 6:43 ` tomas
0 siblings, 1 reply; 6+ messages in thread
From: Guido Van Hoecke @ 2015-04-15 21:14 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs
Thanks Milan, Tomas and Drew.
I adopted Drew's solution and updated the wiki
Guido
On 15 April 2015 at 22:23, Drew Adams <drew.adams@oracle.com> wrote:
> > I switched to bookmark+ and some of my bookmarks now have a different
> > format:
> >
> > Old format:
> > #1=(#("past.org" 0 8
> > (bmkp-full-record #1#))
> > (filename . "~/org/past.org")
> > (front-context-string . "* DONE <2013-04-")
> > (rear-context-string)
> > (position . 1))
> >
> > New format:
> > #1=(#("agenda.org" 0 10
> > (bmkp-full-record #1#))
> > (end-position . 12206)
> > (time 21790 27563 50717 0)
> > (visits . 0)
> > (filename . "~/org/agenda.org")
> > (front-context-string . "* TODO <2013-05-")
> > (rear-context-string . "g niet gestart!\n")
> > (position . 12206))
> >
> > I have an eshell function that allows me to type `j bookmark` (got it
> > from http://www.emacswiki.org/emacs/EshellBmk (thanks!)) and it fails
> > with the new format: it expects the 'filename' cell up front in the
> > record. That works with the old records, but not the new ones. In the
> > above 'agenda.org' bookmark it thinks that the filename is '12206'.
> >
> > Here's the relevant code:
> > (if (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))
>
> That code is mistaken. This is the proper code to access the `filename'
> field of bookmark BOOKMARK:
>
> (bookmark-get-filename BOOKMARK)
>
> And for any field that does not have its own dedicated access function
> (such as field `filename' has with `bookmark-get-filename'), code should
> use `bookmark-prop-get' to access that field value.
>
> This is not Bookmark+-specific. This is what is used for vanilla
> bookmark.el also. The order of the field recorded in a bookmark is
> (must be) irrelevant. The only positional requirement is that the
> bookmark name be the car of the full bookmark record.
>
> > My lisp is not up to turning this into an expression that would
> > correctly load the filename from old formats as well as from the newer
> > format. Any help and suggestion would be most welcome and appreciated.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: bookmark+ help required
2015-04-15 21:14 ` Guido Van Hoecke
@ 2015-04-16 6:43 ` tomas
0 siblings, 0 replies; 6+ messages in thread
From: tomas @ 2015-04-16 6:43 UTC (permalink / raw)
To: Guido Van Hoecke; +Cc: Emacs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, Apr 15, 2015 at 11:14:15PM +0200, Guido Van Hoecke wrote:
> Thanks Milan, Tomas and Drew.
>
> I adopted Drew's solution and updated the wiki
...which is definitely the Right One (TM). Thanks, Drew :-)
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlUvWhsACgkQBcgs9XrR2kYb2ACfXZzGKZ3w3hJbiNPfGI3e9Nto
vawAnjyeYUKPV6U2gsG1ReFBY/CdHcjq
=3ddd
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-16 6:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15 19:24 bookmark+ help required Guido Van Hoecke
2015-04-15 19:55 ` Milan Stanojević
2015-04-15 20:02 ` tomas
[not found] <<m28udtmbz4.fsf@gmail.com>
2015-04-15 20:23 ` Drew Adams
2015-04-15 21:14 ` Guido Van Hoecke
2015-04-16 6:43 ` tomas
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).