From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Why emacsclient -e "(current-word nil t)" does not print ? Date: Tue, 21 Jul 2009 17:24:51 +0200 Organization: Anevia SAS Message-ID: <7cy6qihxdo.fsf@pbourguignon.anevia.com> References: <87r5waa3t8.fsf@galatea.local> <7cskgqjm0s.fsf@pbourguignon.informatimago.com> <7ck522jh0n.fsf@pbourguignon.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248191927 28800 80.91.229.12 (21 Jul 2009 15:58:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 15:58:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 21 17:58:42 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 1MTHjk-0007tR-Ls for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 17:58:40 +0200 Original-Received: from localhost ([127.0.0.1]:46633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTHjk-0001IA-4m for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Jul 2009 11:58:40 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp8-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:euiRR+Qqq1LGsCeynJ6/mW13f9o= Original-Lines: 59 Original-NNTP-Posting-Date: 21 Jul 2009 17:24:52 MEST Original-NNTP-Posting-Host: 88.170.236.224 Original-X-Trace: 1248189892 news-2.free.fr 12978 88.170.236.224:44143 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:171124 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:66314 Archived-At: Wang Lei writes: >>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)". Ok, in this case, it's normal that you get "t" since that the word that is before the cursor (just before the closing parenthesis) when you type C-x C-e. >>$ 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. Yes. But as mentionned by Miles, you can write a more complex expression to select the buffer where you want to work: $ emacsclient -e '(mapcar (function buffer-name) (buffer-list))' ("some" "buffer" "names" ...) $ emacsclient -e '(with-current-buffer "index" (current-word nil t))' "source" > 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. (You could, but you must know what buffer you want.) Why do it from the exterior? Stay with emacs. Write an emacs command. (defun search-with-sdcv () (interactive) (let ((word (current-word nil t))) (when word (shell-command (format "sdcv %S" word) "*sdcv output*" "*sdcv errors*")))) Then you may even bind that command to a key: (global-set-key (kbd "") 'search-with-sdcv) so you just have one key to type to initiate that search from emacs, without leaving emacs. -- __Pascal Bourguignon__