all messages for Emacs-related lists mirrored at yhetil.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               ` [ERC] wanna have C-a take me to after prompt Miles Bader
@ 2002-06-18  7:36               ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
                                   ` (3 more replies)
  1 sibling, 4 replies; 8+ 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] 8+ messages in thread

* 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:36               ` Miles Bader
  1 sibling, 0 replies; 8+ 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] 8+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` Miles Bader
@ 2002-06-18  7:44                 ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
                                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ 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] 8+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
@ 2002-06-18  7:44                 ` Miles Bader
  2002-06-18 17:56                 ` Roland Winkler
  2002-06-18 17:56                 ` Roland Winkler
  3 siblings, 0 replies; 8+ 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] 8+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
  2002-06-18  7:44                 ` Miles Bader
@ 2002-06-18 17:56                 ` Roland Winkler
  2002-06-18 17:56                 ` Roland Winkler
  3 siblings, 0 replies; 8+ 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] 8+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-18  7:36               ` Miles Bader
                                   ` (2 preceding siblings ...)
  2002-06-18 17:56                 ` Roland Winkler
@ 2002-06-18 17:56                 ` Roland Winkler
  3 siblings, 0 replies; 8+ 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] 8+ messages in thread

* Re: [ERC] wanna have C-a take me to after prompt..
       [not found]                 ` <ap3n0tsacd9.fsf@z.glue.umd.edu>
@ 2002-06-19  1:41                   ` Miles Bader
  2002-06-19  1:57                     ` Miles Bader
  0 siblings, 1 reply; 8+ messages in thread
From: Miles Bader @ 2002-06-19  1:41 UTC (permalink / raw)


D. Goel <deego@glue.umd.edu> writes:
> In other words, pressing C-a twice does *not* seem to take you to the
> beginning of prompt.   IMHO, it would be more convenient if the second
> C-a directly took you to the beg of prompt, as Lawrence's code
> achieved. 

Completely disagree.  99% of the time you don't want to be inside the
prompt, and having C-a at the beginning of the line jump there would
simply be confusing.  For the remaining 1%, it's easy enough to type
`C-b C-a'.

-Miles
-- 
o The existentialist, not having a pillow, goes everywhere with the book by
  Sullivan, _I am going to spit on your graves_.

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

* Re: [ERC] wanna have C-a take me to after prompt..
  2002-06-19  1:41                   ` Miles Bader
@ 2002-06-19  1:57                     ` Miles Bader
  0 siblings, 0 replies; 8+ messages in thread
From: Miles Bader @ 2002-06-19  1:57 UTC (permalink / raw)


miles@lsi.nec.co.jp (Miles Bader) writes:
> Completely disagree.  99% of the time you don't want to be inside the
> prompt, and having C-a at the beginning of the line jump there would
> simply be confusing.  For the remaining 1%, it's easy enough to type
> `C-b C-a'.

Oh, and another important point is that it would make C-a `feel wrong':

In normal usage, C-a is an `absolute' movement command -- it jumps to a
fixed point and sticks there -- not a `relative' movement command (like
many other emacs movement commands).  The current operation of C-a in
comint preserves that feeling, which I think is quite important; changing
that makes the command feel kind of flaky (I know because I used emacs for
a while with `C-a moves twice' behavior, when working on the field code
for the minibuffer).

-Miles
-- 
[|nurgle|]  ddt- demonic? so quake will have an evil kinda setting? one that 
            will  make every christian in the world foamm at the mouth? 
[iddt]      nurg, that's the goal 

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

end of thread, other threads:[~2002-06-19  1:57 UTC | newest]

Thread overview: 8+ 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:36               ` Miles Bader
2002-06-18  7:44                 ` Miles Bader
2002-06-18  7:44                 ` Miles Bader
2002-06-18 17:56                 ` Roland Winkler
2002-06-18 17:56                 ` Roland Winkler
     [not found]             ` <m3bsa9hdyp.fsf@ID-87814.user.dfncis.de>
     [not found]               ` <871yb57mcn.fsf@tc-1-100.kawasaki.gol.ne.jp>
     [not found]                 ` <ap3n0tsacd9.fsf@z.glue.umd.edu>
2002-06-19  1:41                   ` Miles Bader
2002-06-19  1:57                     ` Miles Bader

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.