help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: filemananger for emacs with meta information about


From: Drew Adams
Subject: RE: [External] : Re: filemananger for emacs with meta information about a file without opening it
Date: Sat, 5 Nov 2022 21:05:09 +0000

> > Bookmark `aaa.el'
> > -----------------
> >
> > File:                       aaa.el
> > Directory:          z:/foo/bar/toto/
> > Position:             1
> > Visits:                     5
> > Last visit:         7/30/2017 6:00:12 PM
> > Tags:
> >  "magenta"
> >  "orange"
> >  "blue"
>
>
> There it is, full tagging system without renaming files.
> But where are tags stored?

The tags for a bookmark are stored in the bookmark itself
(the bookmark record), under property `tags'.  See:

https://www.emacswiki.org/emacs/BookmarkPlus#BookmarkRecords

See here, for more description of tags, what their values
can be, and how you can use them:

https://www.emacswiki.org/emacs/BookmarkPlus#BookmarkTags

___

BTW, you say "full tagging system" - and you're right.
But I didn't say anything about that.  This tells you
about it:

https://www.emacswiki.org/emacs/BookmarkPlus#TagsAsAttributes

A tag is a string with any text - any length, any chars.
Beyond that, it can instead be a key-value pair: a cons
whose car is the tag name and whose cdr is an associated
value.  Here's a `tags' property from a bookmark record:

 (tags "bmkp-jump" ("bookmark-jump" lambda nil (message "Hello!"))
       "tata tuto titi"
       ("titi" . 42)
       ("foobar" foo bar)
       "beta"
       ("alpha"))

There are six tags there. Their names are "bmkp-jump",
"tata tuto titi", "titi", "foobar", "beta", and "alpha".

The value of "titi" is 42; the value of "foobar" is
`(foo bar)', the value of "alpha" is nil, and the value
of "bmkp-jump" is `("bookmark-jump" lambda nil (message
"Hello!"))'.  The tags named "tata tuto titi" and "beta"
have no associated value.  ("bmkp-jump" is a predefined
tag name - it's explained at the above link.)

___

BTW - Wrt the example you quoted above, I misspoke.
Instead of saying that a non-positive prefix arg means
include the autofile (bookmark) description, I should
have said this (from the `diredp-describe-file' doc):

  If the file has an autofile bookmark and you use
  library `Bookmark+', then show also the bookmark
  information (tags etc.).  In this case, a
  non-positive prefix arg shows the internal form
  of the bookmark.

So what that example shows is what you get with just
`C-h RET': if the file is an autofile then its description
includes the bookmark description.  With a non-positive
prefix arg you see the internal (i.e., Lisp) form of the
bookmark record:

_________________________________________

Bookmark `aaa.el'
-----------------

("aaa.el"
 (end-position . 1)
 (time 22910 33052 672000)
 (visits . 5)
 (tags "magenta" "orange" "blue")
 (filename . "z:/foo/bar/toto/aaa.el")
 (position . 1))


z:/foo/bar/toto/aaa.el
----------------------

File type:                  Normal file
Content type:               Lisp/Scheme program, UTF-8 Unicode text
Permissions:                -rw-rw-rw-
Size in bytes:              96476
Time of last access:        Sat Nov  5 13:17:36 2022 (Pacific Daylight Time)
Time of last modification:  Thu Feb 27 09:04:48 2014 (Pacific Standard Time)
Time of last status change: Wed Jul 25 07:58:32 2018 (Pacific Daylight Time)
Number of links:            1
User ID (UID):              37786
Group ID (GID):             513
Inode:                      281474976868278
Device number:              315267003
_________________________________________

Actually, by default the string that names the bookmark,
"aaa.el" in this example, is propertized, like this:

  #("aaa.el" 0 6 (bmkp-full-record #0))

That is, the bookmark name, which is the car of the
bookmark record, is a string with a property whose
value is the entire record (the cons whose car is that
string!).  This means the string itself is all that
any code needs, to get the full bookmark record.

(This is a kind of circular/self-referential object:
a list whose car is a string that contains that same
list as one of its text properties.  Another case of
Lisp chasing its tail.)

If the name is propertized then you can effectively
have more than one bookmark with the same name.

This is important, for example, for autofiles, whose
names are the nondir part of the file name.  You can
have the same autofile name for files with the same
name in different dirs.

Whether the name is thus propertized is controlled
by option `bmkp-propertize-bookmark-names-flag'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]