From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: strange behavior with multi-buffer Lisp code Date: 17 Nov 2002 18:40:53 -0800 Organization: http://extra.newsguy.com Sender: help-gnu-emacs-admin@gnu.org Message-ID: <86heefd2h6.fsf@kronstadt.homeunix.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1037606541 9188 80.91.224.249 (18 Nov 2002 08:02:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 18 Nov 2002 08:02:21 +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 18DgrL-0002O4-00 for ; Mon, 18 Nov 2002 09:02:20 +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 18Dgoy-0002kH-00; Mon, 18 Nov 2002 02:59:52 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!cyclone.bc.net!newsfeed.telusplanet.net!xmission!news-out.spamkiller.net!propagator2-maxim!news-in.spamkiller.net!news.he.net!cyclone-sf.pbi.net!199.106.71.17!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!enews1 Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-NNTP-Posting-Host: p-503.newsdawg.com User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Original-Xref: shelby.stanford.edu gnu.emacs.help:107143 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:3694 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3694 Hi, I am having a terrible time tracking this down. Help! I have written a programming language mode that can communicate with an asynchronous process in a separate comint buffer. The subprocess runs an interpreter for the language, there are commands to send chunks of code from the editing buffer to the interpreter. And the output from the interpreter is shown in the comint buffer. Pretty standard fare, I think. One last thing I'd like to do is to look for error messages from the interpreter in the comint buffer and jump to the error location in the editing buffer. This already mostly works, too. The problem I am having is that point changes in the comint buffer are not preserved. Here's the code: (defun simple-ml-goto-error () "Jump to the location of a syntax error indicated in interpreter output. Initially, this is the first error in the last chunk of code sent; when repeated this command locates subsequent errors." (interactive) (let ((err-line (with-current-buffer (get-buffer "*Simple ML*") (if (eobp) (comint-previous-prompt 1)) (if (re-search-forward simple-ml-error-regexp nil 'move) (string-to-int (match-string 1)) nil)))) (if err-line (progn (goto-char simple-ml-eval-marker) (forward-line (1- err-line))) (message "No more errors in this code")))) This command is intended to be executed when the language buffer is in the selected window. simple-ml-eval-marker is set earlier by the code that sends the chunk over to the interpreter. What happens is that this _always jumps to the same error_, because even after the point is moved by the re-search-forward in the comint buffer, it is restored for some unfathomable (to me - not to you, I hope) reason when the command returns. Even stranger, this only happens when the comint buffer is already shown in some window. It works perfectly when it is hidden. I should add that I use GNU Emacs 20.7. -- Ian Zimmerman, Oakland, California, U.S.A. I did not vote for Emperor Bush. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087