[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Filename of buffer into kill-ring functionality
From: |
Marco Wahl |
Subject: |
Re: Filename of buffer into kill-ring functionality |
Date: |
01 Sep 2006 09:38:52 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
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
- Re: Filename of buffer into kill-ring functionality,
Marco Wahl <=