From: "Drew Adams" <drew.adams@oracle.com>
To: <r_mercado@o2.co.uk>, <help-gnu-emacs@gnu.org>
Subject: RE: filter from find-dired
Date: Mon, 14 Jan 2013 09:50:21 -0800 [thread overview]
Message-ID: <581F4AB161744C9893141A0547AD64E4@us.oracle.com> (raw)
In-Reply-To: <23721201.139161358184410041.JavaMail.defaultUser@defaultHost>
> 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.
next prev parent reply other threads:[~2013-01-14 17:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-14 17:26 filter from find-dired r_mercado
2013-01-14 17:50 ` Drew Adams [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-14 21:41 r_mercado
2013-01-14 16:28 r_mercado
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=581F4AB161744C9893141A0547AD64E4@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=r_mercado@o2.co.uk \
/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.
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.