From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Combining two short lisp routines Date: Fri, 06 May 2011 11:04:51 -0300 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306268464 16874 80.91.229.12 (24 May 2011 20:21:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 20:21:04 +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 May 24 22:21:00 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOy61-0005Je-5r for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 22:20:53 +0200 Original-Received: from localhost ([::1]:57132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOy60-0007Vp-GE for geh-help-gnu-emacs@m.gmane.org; Tue, 24 May 2011 16:20:52 -0400 Original-Path: usenet.stanford.edu!newsfeed.news.ucla.edu!news.snarked.org!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 16 Injection-Info: mx02.eternal-september.org; posting-host="SH9UCpE8J/NOOMHA4fcilQ"; logging-data="15193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gMDYOGISQO9EDVslf2EDi" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:+G3SvOa390/ujIF1hrqnmslYn/s= sha1:pgS40+eXqgI0DIT1Xdlnq56Gsc4= Original-Xref: usenet.stanford.edu gnu.emacs.help:186797 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:81122 Archived-At: > (defun insert-definition (word) > "Search for WORD in dictionary, insert definition here." > (interactive "sWord:") > (switch-to-buffer "dict.txt") > (re-search-forward (concat "^" word) > (let ((text (buffer-substring (point) > (progn (end-of-line) > (point))))) > (other-buffer) > (insert text))) Please, never call switch-to-buffer and/or other-buffer from such Lisp code. Use set-buffer instead. Stefan