unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [ERC] wanna have C-a take me to after prompt..
       [not found]             ` <m33cvlu3gd.fsf@tfkp00.physik.uni-erlangen.de>
@ 2002-06-18  7:36               ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
  2002-06-18 17:56                 ` Roland Winkler
  0 siblings, 2 replies; 3+ messages in thread
From: Miles Bader @ 2002-06-18  7:36 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
> I'd like to use the field properties to get the expected behavior
> from `C-a' (comint-bol). But with the prompt being inserted by the
> process filter function, this doesn't work.

The reason is that processing of `comint-output-filter-functions' is
done _after_ the prompt is set up.  It's probably OK to move the filter
processing after that point (though I'm not sure), but it will still
require some care on your part if you do this sort of thing -- in
particular, if you insert text after the process-mark, you have to be
sure to move the process-mark to reflect that, or else it will be
considered `after' the prompt.

An example output-filter function that does this might be like:

   (defun of-foo (s)
     (unless (zerop (length s))
       (save-excursion 
         (insert (format "[foo]"))
         (set-marker (process-mark (get-buffer-process (current-buffer)))
                     (point)))))

Can you try the following patch to comint, and see if this makes things
work correctly for you?

Thanks,

-Miles


2002-06-18  Miles Bader  <miles@gnu.org>

	* comint.el (comint-output-filter): Run output-filter functions
	before setting up the prompt.

--- comint.el.~1.277.~	Mon Jun 17 17:01:22 2002
+++ comint.el	Tue Jun 18 16:29:25 2002
@@ -1660,6 +1660,9 @@ This function should be in the list `com
 	    ;; Advance process-mark
 	    (set-marker (process-mark process) (point))
 
+	    (run-hook-with-args 'comint-output-filter-functions string)
+	    (goto-char (process-mark process)) ; in case a filter moved it
+
 	    (unless comint-use-prompt-regexp-instead-of-fields
               (let ((inhibit-read-only t))
                 (add-text-properties comint-last-output-start (point)
@@ -1684,9 +1687,7 @@ This function should be in the list `com
 		  (overlay-put comint-last-prompt-overlay
 			       'font-lock-face 'comint-highlight-prompt))))
 
-	    (goto-char saved-point)
-
-	    (run-hook-with-args 'comint-output-filter-functions string)))))))
+	    (goto-char saved-point)))))))
 
 (defun comint-preinput-scroll-to-bottom ()
   "Go to the end of buffer in all windows showing it.


-- 
Run away!  Run away!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` [ERC] wanna have C-a take me to after prompt Miles Bader
@ 2002-06-18  7:44                 ` Miles Bader
  2002-06-18 17:56                 ` Roland Winkler
  1 sibling, 0 replies; 3+ messages in thread
From: Miles Bader @ 2002-06-18  7:44 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel

miles@lsi.nec.co.jp (Miles Bader) writes:
> It's probably OK to move the filter processing after that point
                                                 ^^^^^, er, I mean, before

-Miles
-- 
The secret to creativity is knowing how to hide your sources.
  --Albert Einstein

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` [ERC] wanna have C-a take me to after prompt Miles Bader
  2002-06-18  7:44                 ` Miles Bader
@ 2002-06-18 17:56                 ` Roland Winkler
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Winkler @ 2002-06-18 17:56 UTC (permalink / raw)
  Cc: help-gnu-emacs, emacs-devel

On     Jun 18 2002 Miles Bader wrote:
> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
> > I'd like to use the field properties to get the expected behavior
> > from `C-a' (comint-bol). But with the prompt being inserted by the
> > process filter function, this doesn't work.
> 
> The reason is that processing of `comint-output-filter-functions' is
> done _after_ the prompt is set up.  It's probably OK to move the filter
> processing after that point (though I'm not sure), but it will still
> require some care on your part if you do this sort of thing -- in
> particular, if you insert text after the process-mark, you have to be
> sure to move the process-mark to reflect that, or else it will be
> considered `after' the prompt.

Thanks a lot!

It seems to me that I have to dig deeper in the code of comint.el.
Right now I define the filter function by using the function
set-process-filter instead of using the variable
comint-output-filter-functions. The reason is that three different
buffers display the output of the process, and only one of these
buffers uses a mode that is derived from comint-mode. Then I can
simply change the filter function that connects to one or the other
buffer.

Therefore I never thought about using the features of comint for
handling the output of my process. But now I am browsing through the
code of comint.el and it seems to me that it offers quite some
suport for my problems. I need not reinvent the wheel.

(Sometimes I was thinking that it would be very helpful to have info
pages for the very powerful comint package.)

> Can you try the following patch to comint, and see if this makes
> things work correctly for you?

First I expect I have to modify my code so that the process output
is handled by comint. This might require some (major?) rewriting of
my code. So it might take a little while till I can tell you whether
your patch solves my problem.

Thank you once again.

Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-18 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ap3sn3ouxr7.fsf@student1.physics.umd.edu>
     [not found] ` <m33cvnwfr1.fsf@ID-87814.user.dfncis.de>
     [not found]   ` <ap3y9dfgjzy.fsf@z.glue.umd.edu>
     [not found]     ` <m3n0tukih3.fsf@ID-87814.user.dfncis.de>
     [not found]       ` <ap3n0tveytt.fsf@z.glue.umd.edu>
     [not found]         ` <m3adpuke9j.fsf@ID-87814.user.dfncis.de>
     [not found]           ` <87ofea6p5z.fsf@tc-1-100.kawasaki.gol.ne.jp>
     [not found]             ` <m33cvlu3gd.fsf@tfkp00.physik.uni-erlangen.de>
2002-06-18  7:36               ` [ERC] wanna have C-a take me to after prompt Miles Bader
2002-06-18  7:44                 ` Miles Bader
2002-06-18 17:56                 ` Roland Winkler

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).