🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99403

Re: using set-buffer in a filter.

#99403
From: Lars Bo Nielsen
Date: Thu, 20 Sep 1990 08:13
44 lines
2274 bytes
In article <9009192153.AA28609@pogo> rms@AI.MIT.EDU (Richard Stallman) writes:

rms>   Here is how to do these things:
rms>
rms>   @example
rms>   (let ((old-buffer (current-buffer)))
rms>     (unwind-protect
rms>	 (let (moving)
rms>	   (set-buffer (process-buffer proc))
rms>	   (setq moving (= (point) (process-mark proc)))
rms>	   (save-excursion
rms>	     ;; Insert the text, moving the process-marker.
rms>	     (goto-char (process-mark proc))
rms>	     (insert string)
rms>	     (set-marker (process-mark proc) (point)))
rms>	   (if moving (goto-char (process-mark proc))))
rms>       (set-buffer old-buffer)))
rms>   @end example

Then, is this the right way to have a process-filter that ALWAYS pops
up the process-buffer when new text arrives, AND scrolls the
process-buffer (always showing the bottom of the process-buffer).

(defun pop-up-and-scroll-process-filter (proc string)
  (let ((cur-win (selected-window))
	(old-buf (current-buffer))
	(pop-up-windows t))
    (unwind-protect
	(let (moving)
	  (pop-to-buffer (process-buffer proc))
	  (setq moving (= (point) (process-mark proc)))
	  (save-excursion
	    ;; Insert the text, moving the process-marker.
	    (goto-char (process-mark proc))
	    (insert string)
	    (set-marker (process-mark proc) (point)))
	  (if moving (goto-char (process-mark proc))))
      (select-window cur-win)
      (set-buffer old-buf))))

---
 Lars Bo Nielsen @ Aalborg University - Denmark
 lbn@iesd.auc.dk  -**-  {...}!mcsun!dkuug!auc!iesd!lbn
---
Technical Details
Message-ID: <LBN.90Sep20091300@alpha.iesd.auc.dk>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!dkuug!iesd!iesd.auc.dk!lbn
References: <9009191916.AA05503@life.ai.mit.edu> <9009192153.AA28609@pogo>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,a4a0dbdb4374810
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-20 19:44:45 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!dkuug!iesd!iesd.auc.dk!lbn
From: lbn@iesd.auc.dk (Lars Bo Nielsen)
Newsgroups: gnu.emacs.bug
Subject: Re: using set-buffer in a filter.
Message-ID: <LBN.90Sep20091300@alpha.iesd.auc.dk>
Date: 20 Sep 90 08:13:00 GMT
References: <9009191916.AA05503@life.ai.mit.edu> <9009192153.AA28609@pogo>
Sender: news@iesd.auc.dk (UseNet News)
Distribution: gnu
Organization: Mathematics and Computer Science, University of Aalborg
Lines: 44
Posted: Thu Sep 20 09:13:00 1990
In-reply-to: rms@AI.MIT.EDU's message of 19 Sep 90 21:53:38 GMT