[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Combining two short lisp routines
From: |
Stefan Monnier |
Subject: |
Re: Combining two short lisp routines |
Date: |
Tue, 24 May 2011 20:01:56 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> (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