From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: looking for: query-replace with a "yank-word" binding ala isearch Date: Tue, 12 Nov 2002 10:46:37 -0700 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3DD13E7D.5060800@ihs.com> References: <2bd747c7.0211072024.1619ac84@posting.google.com> <3DCBEFFE.2030202@ihs.com> <2bd747c7.0211111421.bd052a1@posting.google.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1037124584 16344 80.91.224.249 (12 Nov 2002 18:09:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 12 Nov 2002 18:09:44 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18BfTq-0004FD-00 for ; Tue, 12 Nov 2002 19:09:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18BfQ1-0003WG-00; Tue, 12 Nov 2002 13:05:45 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 59 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: fu-berlin.de 1037123195 13002207 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:106972 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3525 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3525 bigfaceworm wrote: > Kevin's help worked wonderfully, > *except* now I have some odd behavior in my elisp. > When I debug the routine (via edebug) it works just > fine, but when it's loaded outside of edebug, it > grabs the wrong characters: > > (defun bfw-insert-word () > "insert word the cursor is on into minibuffer" > (interactive) > (let ((oldtxt (buffer-substring (save-excursion (beginning-of-line) > (point)) (point)))) > (insert > (save-excursion > (set-buffer (window-buffer minibuffer-scroll-window)) > (buffer-substring (progn (forward-char (length oldtxt)) > (point)) (progn (forward-word 1) (point))))))) Why should the contents of the minibuffer affect what text is inserted? (defun bfw-insert-word () "Insert the word after point from the selected buffer into the minibuffer. This advances point in the selected buffer." (interactive) (insert (save-excursion (set-buffer (window-buffer minibuffer-scroll-window)) (buffer-substring (point) (progn (forward-word 1) (point)))))) > M-x global-set-key f9 bfw-insert-word > > Create a new buffer, with contents: > > 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z > > move the point to the left of the `1', and query-replace > > M-% f9 f9 f9 f9 f9 f9 > > gives you "12 4 7 b g" > > but if you debug the routine (M-x edebug-defun) > and do the same test (hitting 'c' to continue) > you get "1 2 3 4 5 6" > > > Any idea why a defun would act differently when debugged versus > normal? Perhaps the debugger is restoring point or some other aspect of the window/ buffer configuration. -- Kevin Rodgers