From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "leo" Newsgroups: gmane.emacs.help Subject: problems with dired-filename-at-point (was Re: dired: goto directory of a file) Date: Fri, 16 Jan 2004 09:37:40 +1100 Organization: Netspace Internet Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <1c58a7c3.0401150420.7ffe6306@posting.google.com> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1074208043 28825 80.91.224.253 (15 Jan 2004 23:07:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Jan 2004 23:07:23 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 16 00:07:13 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AhGa0-0003y5-00 for ; Fri, 16 Jan 2004 00:07:13 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AhGFa-0003Bb-Ab for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jan 2004 17:46:06 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.media.kyoto-u.ac.jp!news1.optus.net.au!optus!news.mel.connect.com.au!news.netspace.net.au!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-NNTP-Posting-Host: dsl-210-15-204-246.nsw.netspace.net.au Original-X-Trace: otis.netspace.net.au 1074206236 66584 210.15.204.246 (15 Jan 2004 22:37:16 GMT) Original-X-Complaints-To: usenet@otis.netspace.net.au Original-NNTP-Posting-Date: Thu, 15 Jan 2004 22:37:16 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Original-Xref: shelby.stanford.edu gnu.emacs.help:120139 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16080 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16080 "Barman Brakjoller" wrote in message news:1c58a7c3.0401150420.7ffe6306@posting.google.com... > > in a dired buffer (particu;ar in a dired-find buffer) it would be very > > handy to be able to jump to the containing directory of a file: > > > > eg. the dired buffer shows the line > > > > -rw-r--r-- 1 leo staff 618385 30 Nov 08:29 Audio/Apps/iCDc4.3.3.dmg.sit > > > > then just jump to the directory Audio/Apps in a new dired window. > > I came up with the following function which works in most cases I > guess: > > (defun dired-open-containing-directory () > "Opens the directory where the file at point is located" > (interactive) > (let ((file (dired-filename-at-point))) > (string-match "\\(.*/\\)" file) > (find-file (substring file 0 (match-end 1))))) thanks. i have tried this and it works in dired-find buffers but unfortunatly not in dired subdirs: dired-filename-at-point doesn't work correctly in subdirs. eg the buffer shows something like c:/_home: total 17 free 6651216 drwxrwxrwx 0 Jan 15 15:13 . drwxrwxrwx 0 Jan 1 1970 .. drwxrwxrwx 0 Jan 6 16:24 emacs [...] c:/_home/emacs: total 3 drwxrwxrwx 0 Jan 6 16:24 . drwxrwxrwx 0 Jan 15 15:13 .. drwxrwxrwx 0 Jan 15 17:41 user-lisp [...] c:/_home/emacs/user-lisp: total 36 drwxrwxrwx 0 Jan 16 09:23 . drwxrwxrwx 0 Jan 6 16:24 .. -rw-rw-rw- 4922 Jan 15 17:41 leo-frames.el now i set the point to the line with leo-frames.el, then `dired-filename-at-point' tells me c:/_home/leo-frames.el. that's obviously wrong. any idea? leo