all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bookmark Plus: Bookmarking "locate"d files
@ 2015-02-03 21:07 Tory S. Anderson
  2015-02-03 22:08 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Tory S. Anderson @ 2015-02-03 21:07 UTC (permalink / raw)
  To: emacs list

I follow a regular process in my note-taking and can create a locate command that returns a complete list of my note org files within a portion of my directory heirarchy. I had hoped the results of (locate) would count as an occur/compilation buffer; it even partially works as a dired buffer. But whenever I try the dired bookmark command after marking the results, I am told the command is only available in dired or dired-derived modes (which, I was sure, the results of locate were). 

In following http://www.emacswiki.org/emacs/BookmarkPlus#toc33, How can I bookmark such a list of files? Is it a bug that I cannot do it from the "locate" buffer? 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Bookmark Plus: Bookmarking "locate"d files
  2015-02-03 21:07 Bookmark Plus: Bookmarking "locate"d files Tory S. Anderson
@ 2015-02-03 22:08 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2015-02-03 22:08 UTC (permalink / raw)
  To: torys.anderson, emacs list

> I follow a regular process in my note-taking and can create a locate command
> that returns a complete list of my note org files within a portion of my
> directory heirarchy. I had hoped the results of (locate) would count as an
> occur/compilation buffer; it even partially works as a dired buffer. But
> whenever I try the dired bookmark command after marking the results, I am
> told the command is only available in dired or dired-derived modes (which, I
> was sure, the results of locate were).
> 
> In following http://www.emacswiki.org/emacs/BookmarkPlus#toc33, How can I
> bookmark such a list of files? Is it a bug that I cannot do it from the
> "locate" buffer?

I don't use Org (shameful confession, I know), and I'm not familiar
with such buffers.  But if the buffer normally exists or you can
easily re-create it, then you can of course just bookmark it
normally.  You can also put the code to re-create it in a function
bookmark (or in a separate command).

But it sounds like your question is more about something like what
`C-c C-M-b' does in occur mode or compilation mode: create bookmarks
for the targets of all of the hits.  (This is similar to what `M-b'
does in Dired: bookmark each of the marked files.)

If so, then you would need to create a command similar to the commands
that `C-c C-M-b' is bound to there: `bmkp-occur-target-set-all' and
`bmkp-compilation-target-set-all'.  You can see that the code for
those two commands is pretty much the same.  This is the meat of it:

(while (ignore-errors (occur-next) t) ; "No more matches" ends loop
  (ignore-errors (bmkp-occur-target-set prefix)) ; Ignore killed buf
  (setq count  (1+ count)))

That iterates over the hits, setting a bookmark for each one.
You need a function that gives you the next hit, similar to
`occur-next' and `compilation-next-error'.  Probably your Org
buffer's mode has such a function.

And you need a function analogous to `bmkp-occur-target-set',
to set a single such bookmark.  For that, you need a function
that follows a hit, similar to `occur-mode-find-occurrence' (and
`find-file-noselect' for compilation mode).  Probably your buffer's
mode has that too.

Try something similar for your context.  Let me know what you find.

(In principle, `next-error', with `next-error-function', provides
a single, unified way to get the next hit but there are sometimes
particularities to take into account, I think.  Anyway, Bookmark+
supports older Emacs versions that do not unify this.)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-03 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 21:07 Bookmark Plus: Bookmarking "locate"d files Tory S. Anderson
2015-02-03 22:08 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.