From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: RE: filter from find-dired Date: Mon, 14 Jan 2013 21:41:04 +0000 (GMT) Message-ID: <9170160.132321358199664807.JavaMail.defaultUser@defaultHost> Reply-To: r_mercado@o2.co.uk NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1358199684 21037 80.91.229.3 (14 Jan 2013 21:41:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jan 2013 21:41:24 +0000 (UTC) To: , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 14 22:41:42 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Turmi-00063E-In for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Jan 2013 22:41:36 +0100 Original-Received: from localhost ([::1]:45286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TurmS-0001p3-Ap for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Jan 2013 16:41:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TurmJ-0001oY-Hr for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 16:41:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TurmG-00082C-BF for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 16:41:11 -0500 Original-Received: from vader.london.02.net ([82.132.130.150]:45270 helo=mail.o2.co.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TurmG-00081z-2M for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 16:41:08 -0500 Original-Received: from hill (82.132.130.218) by mail.o2.co.uk (8.5.140.03) (authenticated as r_mercado) id 50D6EDD206A9B6CE; Mon, 14 Jan 2013 21:41:04 +0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 82.132.130.150 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88618 Archived-At: Great. Thanks Drew what I needed was 'default-directory' That simplifies my previous problem to (defun find-substitutions () "find substitution files in the current directory" (interactive) (find-name-dired (default-directory) "*substitutions*") ) I would like to filter the entries under ".svn" directories, so that they are not included. ----Original Message---- From: drew.adams@oracle.com Date: Jan 14, 2013 17:50 To: , Subject: RE: filter from find-dired > get-directory-name is my function too. Glad to receive suggestions on > how to improve it. > > (defun get-directory-name () > "return the current directory" > (interactive) > (let (dirname components) > (if (null (buffer-file-name (current-buffer))) > (setq dirname (expand-file-name default-directory)) > (setq components (butlast (split-string (get-file-name) "/"))) > (setq dirname (mapconcat 'identity components "/"))) > (message dirname) > (kill-new dirname) > dirname)) Not sure what you are trying to do. You don't show `get-file-name', for one thing, so your code cannot be evaluated by someone trying to help. If you are trying to get the (non-)directory component of an absolute file name, consider using `file-name-(non)directory'. When you ask for improvement suggestions, I recommend that you start by saying what your code is intended to do. Sometimes a completely different implementation might be suggested, but only if someone can tell what you are really trying to do. Looking at just your doc string (which might be inaccurate), it would seem that all you need is `default-directory'. That _is_ "the current directory". If you need that added to the kill buffer, then (kill-new default- directory) should be adequate.