all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Combining two short lisp routines
Date: Fri, 06 May 2011 11:04:51 -0300	[thread overview]
Message-ID: <jwv7ha42afg.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: barmar-6EB8AF.01453906052011@reserved-multicast-range-not-delegated.example.com

> (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


      parent reply	other threads:[~2011-05-06 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 23:47 Combining two short lisp routines B. T. Raven
2011-05-06  5:45 ` Barry Margolin
2011-05-06 13:14   ` B. T. Raven
2011-05-06 21:51     ` Barry Margolin
2011-05-07  3:34       ` B. T. Raven
2011-05-07  7:23         ` Barry Margolin
2011-05-07 22:37           ` B. T. Raven
2011-05-06 14:04   ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7ha42afg.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.