unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marco Wahl <mw@visenso.de>
Subject: Re: Filename of buffer into kill-ring functionality
Date: 01 Sep 2006 09:38:52 +0200	[thread overview]
Message-ID: <9obqq0qbn7.fsf@gonzo.vircinity> (raw)
In-Reply-To: mailman.6092.1157039301.9609.help-gnu-emacs@gnu.org

Kevin Rodgers <ihs_4664@yahoo.com> writes:
> [...]
> (defun kill-new-string-variable (variable)
>    "Make the string value of VARIABLE the latest kill in the kill ring."
>    (interactive (let ((current-buffer (current-buffer)))
> 		 (intern (completing-read "Variable: " obarray
> 					  (lambda (symbol)
> 					    (with-current-buffer current-buffer
> 					      (and (boundp symbol)
> 						   (stringp
> 						    (symbol-value symbol)))))
> 					  t))))
>    ;; Let symbol-value and kill-new signal errors for unbound variables
>    ;; and non-string values, respectively:
>    (kill-new (symbol-value variable)))
> 
> (defun kill-new-buffer-file-name ()
>    (kill-new-string-variable 'buffer-file-name))

Thank you all!

Just a micro-remark for the not so lisp-experienced
user.  To be able to key-bind the latter function add
of '(interaction)' is needed:

(defun kill-new-buffer-file-name ()
  (interactive)
  (kill-new-string-variable 'buffer-file-name))


Best regards
-- 
Marco Wahl
http://visenso.com

  parent reply	other threads:[~2006-09-01  7:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 10:04 Filename of buffer into kill-ring functionality Marco Wahl
2006-08-31 12:40 ` Reiner Steib
2006-08-31 15:43   ` Kevin Rodgers
2006-08-31 19:08     ` Reiner Steib
2006-08-31 20:40       ` Kevin Rodgers
     [not found]   ` <mailman.6092.1157039301.9609.help-gnu-emacs@gnu.org>
2006-09-01  7:38     ` Marco Wahl [this message]
2006-09-01  8:58 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9obqq0qbn7.fsf@gonzo.vircinity \
    --to=mw@visenso.de \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).