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

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

Re: Jump to directory from a *Locate* buffer


From: John Mastro
Subject: Re: Jump to directory from a *Locate* buffer
Date: Wed, 14 Jan 2015 17:14:01 -0800

Marcin Borkowski <mbork@wmi.amu.edu.pl> wrote:
> Definitely there /should/ be.  And if there are not, someone has to code
> them.  (I need this almost on a daily basis, so it's definitely worth
> optimizing.)

If I understand the situation correctly, something like this is all it
takes.

    (defun locate-open-in-dired (file)
      (interactive (list (dired-filename-at-point)))
      (cond ((file-directory-p file)
             (dired file))
            ((file-regular-p file)
             (dired (file-name-directory file)))
            (t
             (error "Not a file: '%s'" file))))

    (define-key locate-mode-map (kbd "C-c d") #'locate-open-in-dired)

-- 
john



reply via email to

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