all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Joost Kremers <joost.m.kremers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to make Emacs paths in the minibuffer start at root (/) instead of $HOME (~)?
Date: 26 Mar 2014 01:23:18 GMT	[thread overview]
Message-ID: <slrnlj4b06.83c.joost.m.kremers@j.kremers4.news.arnhem.chello.nl> (raw)
In-Reply-To: mailman.18211.1395792654.10748.help-gnu-emacs@gnu.org

Christopher Howard wrote:
> I'm not a guru, but I would think you could get a similiar result
> writing an interactive lisp function. Just looking at the docs, I was
> thinking
>
> (expand-file-name (pwd))
>
> with a function around that to save it for pasting. Only problem is
> that, apparently, the `pwd' function includes other junk in the string
> along with the expanded file name. Any thoughts from the real
> gurus...?

Well, `pwd' really only does

(message "Directory %s" default-directory)

so 

(expand-file-name default-directory)

should do the trick.

Putting it in the kill ring (which should normally make it available for
pasting outside Emacs) is not difficult either:

(kill-new (expand-file-name default-directory))

Wrap it in an interactive function:

(defun my-copy-pwd ()
  "Copy the current directory to the kill ring."
  (interactive)
  (kill-new (expand-file-name default-directory)))

And assign it to a key:

(global-set-key "C-c p" 'my-copy-pwd)

There ya go!


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


  parent reply	other threads:[~2014-03-26  1:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-25 18:15 How to make Emacs paths in the minibuffer start at root (/) instead of $HOME (~)? MBR
2014-03-26  0:11 ` Christopher Howard
     [not found] ` <mailman.18211.1395792654.10748.help-gnu-emacs@gnu.org>
2014-03-26  1:23   ` Joost Kremers [this message]
2014-03-27  0:46 ` Bob Proulx

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=slrnlj4b06.83c.joost.m.kremers@j.kremers4.news.arnhem.chello.nl \
    --to=joost.m.kremers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.