help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ERC] wanna have C-a take me to after prompt..


From: Miles Bader
Subject: Re: [ERC] wanna have C-a take me to after prompt..
Date: 18 Jun 2002 16:36:09 +0900

Roland Winkler <address@hidden> 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  <address@hidden>

        * 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 via email to

[Prev in Thread] Current Thread [Next in Thread]