From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: [emacs-lisp newbie] print-something() -> clipboard? Date: Sat, 19 May 2012 09:19:36 +0200 Message-ID: <4FB74988.9000404@easy-emacs.de> References: <87r4uhxof8.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1337411991 2297 80.91.229.3 (19 May 2012 07:19:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 May 2012 07:19:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 19 09:19:50 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SVdx7-0002bM-6V for geh-help-gnu-emacs@m.gmane.org; Sat, 19 May 2012 09:19:49 +0200 Original-Received: from localhost ([::1]:47891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVdx6-0006D6-EG for geh-help-gnu-emacs@m.gmane.org; Sat, 19 May 2012 03:19:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVdx1-0006Cr-9p for help-gnu-emacs@gnu.org; Sat, 19 May 2012 03:19:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SVdwz-0006QQ-EM for help-gnu-emacs@gnu.org; Sat, 19 May 2012 03:19:42 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:62630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVdwz-0006Px-4q for help-gnu-emacs@gnu.org; Sat, 19 May 2012 03:19:41 -0400 Original-Received: from [192.168.178.27] (brln-4d0c26de.pool.mediaWays.net [77.12.38.222]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0LtypG-1S3hkK07uw-010swL; Sat, 19 May 2012 09:19:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120421 Thunderbird/12.0 In-Reply-To: <87r4uhxof8.fsf@pobox.com> X-Provags-ID: V02:K0:KV0UZL/6Qs6uldy9a9Aq9Av9t10qon/zOMO6lIQpx2V Lfyi8xVXVLy0J+esDRyg4ELr117DR0UOI8UCRbkIRbHIRUKJs5 OvVzI0lF79J7qVdEVuyaHOH4WFEPeL8whCSFge+yfeR1wYvncL Ls65dXr09iGESVtMEvCGamyWrFj4E58D0o2JWddDx4B83tAYPT STJZnIssPAlPiwlWlDbdboVWPw/MkX/0glEedsaJLT8B5cnGMc biODTsOWUY1NG+HFIySyct++dgb8HtxvceueL4JfquL2JDLLnP r3HRuPHK6ZtH59/fK9scVIP/0z/tIqvXZyUSKMzONRoB+Q8fwK YseCH8iYYoEJqHOl4phY1uTpeskPHcLZsFApiCzuU X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.126.171 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84894 Archived-At: Am 18.05.2012 21:46, schrieb Tom Roche: > >> From my init.el I load a file that contains function definitions which > all have the form > >> (defun print-path-and-filename () >> "Print the current buffer's file's path at point." >> (interactive "*") ; abort if buffer is read-only >> (if buffer-file-name (insert buffer-file-name) nil)) >> (global-set-key "\C-pp" 'print-path-and-filename) > ... >> (defun print-buffer-name () >> "Print (at point) the current buffer's name." >> (interactive "*") ; abort if buffer is read-only >> (insert (buffer-name (window-buffer (minibuffer-selected-window))))) >> (global-set-key "\C-pb" 'print-buffer-name) >> >> (provide 'tlr-print) > > Most of the functions are buffer-independent (printing, e.g., current > time, emacs version) but some (like the above) are not. For the > latter, I'd like to have the option to "print" the datum to the > clipboard. How can I (easily :-) do that? > > Examples esp appreciated. Feel free to point to doc. > > TIA, Tom Roche > > Hi, the answer might not be a one-liner, as the X-clipboard does not come with Emacs. This example works at my machine: (defun yank-date-clipboard () "Insert into the kill-ring, at X also into the clipboard." (interactive) (kill-new (format-time-string "%Y%m%d"))) HTH, Andreas