unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Ivanov Dmitry'" <usr345@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: RE: Re[2]: How to open dired bookmarks in the same window
Date: Sun, 28 Oct 2012 10:19:36 -0700	[thread overview]
Message-ID: <93FCAA847D3A4F94B0014975DEB58B56@us.oracle.com> (raw)
In-Reply-To: <1477041223.20121028201017@gmail.com>

> I installed bookmark+ and tried bmkp-dired-jump. But it still 
> opens the directory in a new buffer.

Of course it does.  `dired' always does that.  And `bmkp-dired-jump' invokes
`dired'.

Your request was that jumping to the bookmark open the dir in the same _window_.
Is that not what you see with `bmkp-dired-jump'?  It works for me.

If you want the opened Dired buffer to replace the _buffer_ that was current
when you asked to jump to the bookmark, then add a function that kills that
buffer to `bookmark-after-jump-hook'.

It's not clear what you want.

Be aware BTW that in Dired, even when you use `find-alternate-file' to visit a
subdir in the listing, that does not change how the command `dired' works.

For example, if you use Dired+ and you choose to reuse Dired buffers, so that
when you hit RET on a subdir name in Dired the new Dired buffer replaces the one
where you hit RET, that simply makes use of `find-alternate-file' - it does not
invoke command `dired'.

That Dired+ config choice does not change the behavior of command `dired'.  So
for example, if you use `C-x d some-dir', the Dired buffer for `some-dir' does
_not_ replace the buffer that was current when you did `C-x d'.

With that Dired+ config choice, RET in Dired does replace the current Dired
buffer with the one for the subdir you hit RET on - but that's not the same
thing as invoking `dired' on it.

Do you really want to kill the current buffer - whatever it might be - when you
jump to a Dired bookmark?  If so, then try doing what I suggested above: use
`bookmark-after-jump-hook'.

For example, try this command (with Bookmark+):

(defun foo (bookmark)
  (interactive
   (let ((alist  (bmkp-dired-alist-only)))
     (list (bookmark-get-bookmark
            (bmkp-read-bookmark-for-type
             "Dired" alist nil nil 'bmkp-dired-history)))))
  (let ((this-buf  (current-buffer)))
    (add-hook 'bookmark-after-jump-hook
              `(lambda () (kill-buffer ,this-buf)))
    (bmkp-jump-1 bookmark 'switch-to-buffer nil)
    (remove-hook 'bookmark-after-jump-hook
                 `(lambda () (kill-buffer ,this-buf)))))

HTH.  I expect that you have enough info now to come up with whatever it is you
really want.  If not, look in bookmark+-1.el (and perhaps dired+.el) for more
info.




      reply	other threads:[~2012-10-28 17:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-28  9:25 How to open dired bookmarks in the same window Ivanov Dmitry
2012-10-28 14:52 ` Drew Adams
2012-10-28 16:10   ` Re[2]: " Ivanov Dmitry
2012-10-28 17:19     ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93FCAA847D3A4F94B0014975DEB58B56@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=usr345@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).