From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Martin Rubey Newsgroups: gmane.emacs.help Subject: help needed writing a mode for axiom Date: 25 May 2007 23:50:32 +0200 Message-ID: <9qd50oindj.fsf@aquin.mat.univie.ac.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1180163299 16835 80.91.229.12 (26 May 2007 07:08:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 May 2007 07:08:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 26 09:08:18 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HrqNt-0004F0-Ja for geh-help-gnu-emacs@m.gmane.org; Sat, 26 May 2007 09:08:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HrqNr-00026C-8F for geh-help-gnu-emacs@m.gmane.org; Sat, 26 May 2007 03:08:15 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.ision.net!newsfeed2.easynews.net!ision!news-fra1.dfn.de!newscore.univie.ac.at!aconews-feed.univie.ac.at!aconews.univie.ac.at!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-NNTP-Posting-Host: aquin.mat.univie.ac.at Original-X-Trace: 1180129832 usenet.univie.ac.at 28520 131.130.16.163 Original-X-Complaints-To: abuse@univie.ac.at Original-Xref: shelby.stanford.edu gnu.emacs.help:148851 X-Mailman-Approved-At: Sat, 26 May 2007 03:07:57 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44442 Archived-At: Dear all, I'm stuck. I tried to write an emacs mode for the computer algebra system axiom, based on comint mode. One feature that was generally requested was to write-protect all output, and colorize it. So, what I thought was to use (add-hook 'comint-output-filter-functions 'axiom-output-filter)) and set text-properties as text is sent by the process: (defvar axiom-prompt "^(\\([0-9]+\\)) -> ") (defface axiom-output '((t (:background "green"))) "Face used for output." :group 'axiom) (defun axiom-make-output (begin end) (let ((inhibit-read-only t)) (put-text-property begin (1- end) 'face 'axiom-output) ; (put-text-property begin (1- end) 'front-sticky t) ; (put-text-property (1+ begin) end 'rear-non-sticky t) (put-text-property begin (1- end) 'read-only t))) (defvar axiom-last-output-end 0) (defun axiom-output-filter (str) (when (zerop axiom-last-output-end) (setq axiom-last-output-end comint-last-input-end)) (axiom-make-output axiom-last-output-end (setq axiom-last-output-end (+ axiom-last-output-end (length str)))) (when (string-match axiom-prompt str) (setq axiom-last-output-end 0 axiom-waiting-for-output nil))) However, as written here, it does not work. After axiom (or in fact, a shell) sends the first line of output, it complains that the text is read only. As you can see I played around with the rear-non-sticky property, but without success. Since at times it is not clear whether more output is still going to arrive or not, I'd really love to set text-properties as output comes in. But I seem to be missing something. In a different version, I was unable to use C-c C-c to interrupt the process. But I find it hard to nail down the cause. By the way, why is axiom-output-filter such a pain to debug? if I "instrument" it for edebug, it get's the last strings sent to the buffer first!? (in emacs 21.4.1, on kubuntu, that is.) Many many thanks, Martin (34, using emacs since 2000, I think. )