unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@lsi.nec.co.jp>
Cc: help-gnu-emacs@gnu.org, emacs-devel@gnu.org
Subject: Re: [ERC] wanna have C-a take me to after prompt..
Date: 18 Jun 2002 16:36:09 +0900	[thread overview]
Message-ID: <buod6up2g46.fsf@mcspd15.ucom.lsi.nec.co.jp> (raw)
In-Reply-To: <m33cvlu3gd.fsf@tfkp00.physik.uni-erlangen.de>

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!

       reply	other threads:[~2002-06-18  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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               ` Miles Bader [this message]
2002-06-18  7:44                 ` [ERC] wanna have C-a take me to after prompt Miles Bader
2002-06-18 17:56                 ` Roland Winkler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=buod6up2g46.fsf@mcspd15.ucom.lsi.nec.co.jp \
    --to=miles@lsi.nec.co.jp \
    --cc=emacs-devel@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).