From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anselm Helbig Newsgroups: gmane.emacs.help Subject: Re: Why emacsclient -e "(current-word nil t)" does not print ? Date: Wed, 22 Jul 2009 08:35:20 +0200 Organization: Freie Universitaet Berlin Message-ID: <87bpnd9qdz.wl%anselm.helbig+news2009@googlemail.com> References: <87r5waa3t8.fsf@galatea.local> <7cskgqjm0s.fsf@pbourguignon.informatimago.com> <7ck522jh0n.fsf@pbourguignon.informatimago.com> <7cy6qihxdo.fsf@pbourguignon.anevia.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1248244905 12067 80.91.229.12 (22 Jul 2009 06:41:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jul 2009 06:41:45 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 22 08:41:38 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTVWE-0005eb-0m for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Jul 2009 08:41:38 +0200 Original-Received: from localhost ([127.0.0.1]:34377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTVWD-0004vz-FY for geh-help-gnu-emacs@m.gmane.org; Wed, 22 Jul 2009 02:41:37 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 21 Original-X-Trace: news.uni-berlin.de XE9It2NqbYmFph924Aq+YQV9BlkK25gjVm62XYM1/1cRs4a3BexQ6HzN+/ Cancel-Lock: sha1:2VGb8FsJxzExclWp8haFo3iq/KI= In-Reply-To: Mail-Followup-To: anselm.helbig+news2009@googlemail.com Original-Xref: news.stanford.edu gnu.emacs.help:171145 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:66335 Archived-At: > NOW. Maybe having two choices is ok. Because if I really want to > integrate everything, "get word from screen" should be my choice, not > selection ang prompt. Thanks for you help! So I understand that you really require to call your code from outside of emacs. When you're not in emacs, there's AFAIK no way to tell which buffer is "current". You may have many buffers, and also any number of frames and windows. This code takes the buffer that the first window of the currently selected frame is pointing to, which will probably do what you want: (with-current-buffer (window-buffer (frame-first-window)) (current-word nil t)) HTH, Anselm -- Anselm Helbig mailto:anselm.helbig+news2009@googlemail.com