From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wang Lei Newsgroups: gmane.emacs.help Subject: Re: Why emacsclient -e "(current-word nil t)" does not print ? Date: Tue, 21 Jul 2009 22:56:16 +0800 Message-ID: References: <87r5waa3t8.fsf@galatea.local> <7cskgqjm0s.fsf@pbourguignon.informatimago.com> <7ck522jh0n.fsf@pbourguignon.anevia.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1248189126 18450 80.91.229.12 (21 Jul 2009 15:12:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 15:12:06 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Pascal J. Bourguignon" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 21 17:11:59 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 1MTH0I-00035v-U8 for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 17:11:59 +0200 Original-Received: from localhost ([127.0.0.1]:33042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTH0C-0007x1-L2 for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 11:11:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTGlU-00047A-BJ for help-gnu-emacs@gnu.org; Tue, 21 Jul 2009 10:56:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTGlP-000421-Kp for help-gnu-emacs@gnu.org; Tue, 21 Jul 2009 10:56:23 -0400 Original-Received: from [199.232.76.173] (port=56401 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTGlP-00041q-Ey for help-gnu-emacs@gnu.org; Tue, 21 Jul 2009 10:56:19 -0400 Original-Received: from mail-px0-f193.google.com ([209.85.216.193]:62608) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTGlO-0007Rs-PJ for help-gnu-emacs@gnu.org; Tue, 21 Jul 2009 10:56:19 -0400 Original-Received: by pxi31 with SMTP id 31so2132884pxi.14 for ; Tue, 21 Jul 2009 07:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gie6tV33J4xpDMjlG9kB/dnRQgzTjCSyIZbhtRC3z/o=; b=wJzA5s4nF5yFonxdD3PBiFTG38N4lxbvfn6pT1eaeFwb3OnQ6fZf88CzB+esjzXSVX xKJf1I2rriOoFt2t6MTPgiPPwUjh5KUemfhyd789mVAZY1y3Wd1Ij07en7DCPUvXvK+t 7eKeIXC3+4SNLR7g9+b3Aw1ygEnnPqaBa2Z9k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=xPb5GAs/5kxQv0dVS84rj4vK4SVE9rs72rUdssBd9+XkkpxUOG2hSKT1qlLvd4zJnE +Pn270PEepL+aGNJzvF1/M3FQ0IPwG1fArXOEqKPHYXIoCk4hzW3Zw530ct6gjIo6OSe iZoBRkS1I79upkwy8KeHkYjj5epYFe7fhBwDU= Original-Received: by 10.220.100.1 with SMTP id w1mr7628154vcn.15.1248188176735; Tue, 21 Jul 2009 07:56:16 -0700 (PDT) In-Reply-To: <7ck522jh0n.fsf@pbourguignon.anevia.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:66308 Archived-At: >What is the "it" that should print 't'? In my (current-word nil t) C-x C-e shows "t" in minibuffer. This "it" means this expression "(current-word nil t)". >$ emacsclient -e '(list emacs-version (buffer-name) (current-word))' >("22.2.1" "Main.cc" "FilterFunction") Mine. In urxvt and emacs shell mode: $emacsclient -e '(list emacs-version (buffer-name) (current-word))' ("23.1.50.1" " *server*" nil) It looks like the output really depends on the version. > Anyway, it proves what i have thought is wrong. Here, I wanted to say I have tried to write a external program, that gets the emacs' current word with emacsclient and send it to sdcv to search. This is part of the whole function, the rest is to get it from selection or prompt for. But now, it looks like i can not integrate the emacs-part. On 7/21/09, Pascal J. Bourguignon wrote: > Wang Lei writes: > >> On 7/21/09, Pascal J. Bourguignon wrote: >>> Wang Lei writes: >>> >>>> On 7/21/09, Pascal J. Bourguignon wrote: >>>>> Wang Lei writes: >>>>> >>>>>> Hi, all. >>>>>> >>>>>> I'm doing a piece of code. What needs get the output of >>>>>> emacsclient -e "(current-word nil t)" >>>>>> >>>>>> and send it to an external command. But there was NO output. I don't >>>>>> understand. >>>>>> >>>>>> Could someone explain that? >>>>> >>>>> That's because -e prints the result only when it's not nil. >>>>> Try: >>>>> >>>>> emacsclient -e "(or (current-word nil t) :nil)" >>>>> >>>> Actually, what am i interested is the "current word", in this line, >>>> it's should print 't'. In emacs it does print 't'. But with >>>> emacsclient, nothing. >>>> >>>> Is this normal? >>> >>> Perhaps. I cannot parse your sentence starting with "Actually". >>> >> I mean "in fact", sorry for my poor english. ;) > > Yes, I understand the meaning of the word "Actually", but it's the > whole sentence that I don't understand: > > Actually, what am i interested is the "current word", in this > line, it's should print 't'. > > What is the "it" that should print 't'? > > "current word" is two words, "current" and "word"... Which of those > two words are you interested in? The current word, or the word > "current", or the word "word"? Or do you mean that "this line" refers > to another line? > > > >>> Did you read what I wrote above? I won't repeat it. >>> >> Yes, I read and tried. It return :nil. > > So this shows that there is no current word, since current-word > returns nil, which my expression explicitely substitute with :nil. > > >>> Otherwise, if you use emacsclient from within emacs (eg. from the M-x >>> shell) you will obviously get different results. Once you hit RET, >>> emacs changes the position of the cursor, so the current word is not >>> the same as when you hit RET, and current-word will return nil. >>> >> Yes. Maybe this is the reason, or maybe as Miles Bader said, it is in >> the *server* buffer and it is empty. >> >> Anyway, it proves what i have thought is wrong. > > I can confirm that with my version of emacs, I get the current buffer > and the current word: > > $ emacsclient -e '(list emacs-version (buffer-name) (current-word))' > ("22.2.1" "Main.cc" "FilterFunction") > > >>> And I don't see how current-word could return t. At best, it could >>> return "t", if you had the cursor on a single letter 't'. >>> >> I meant, in emacs C-x C-e, it returns "t". > > With my emacs, > > On a line alone, (current-word) C-x C-e shows =C2=AB"current-word"=C2=BB= in the mini > buffer. > > On a line alone, (current-word) SPC t C-b C-x C-e shows =C2=AB"t"=C2=BB i= n the mini > buffer. > > On a line alone, (current-word) SPC SPC t C-b C-b C-x C-e shows > =C2=AB"current-word"=C2=BB in the mini buffer. > > > -- > __Pascal Bourguignon__ > --=20 Regards Lei