From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marco Wahl Newsgroups: gmane.emacs.help Subject: Re: Filename of buffer into kill-ring functionality Date: 01 Sep 2006 09:38:52 +0200 Organization: Linux Private Site Message-ID: <9obqq0qbn7.fsf@gonzo.vircinity> References: <9ofyfdql0b.fsf@gonzo.vircinity> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1157096455 28999 80.91.229.2 (1 Sep 2006 07:40:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 1 Sep 2006 07:40:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 01 09:40:51 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GJ3dX-0002qi-Fy for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Sep 2006 09:40:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GJ3dW-0004Za-UL for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Sep 2006 03:40:22 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsserver.news.garr.it!kanaga.switch.ch!switch.ch!news.belwue.de!news.uni-stuttgart.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-X-Trace: infosun2.rus.uni-stuttgart.de 1157096332 23062 129.69.226.229 (1 Sep 2006 07:38:52 GMT) Original-X-Complaints-To: news@news.uni-stuttgart.de Original-NNTP-Posting-Date: Fri, 1 Sep 2006 07:38:52 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-Xref: shelby.stanford.edu gnu.emacs.help:141476 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37097 Archived-At: Kevin Rodgers 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