🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.emacs
Article #9530

Re: Garbaged input in shell buffer

#9530
From: David M. Karr
Date: Tue, 06 Feb 1990 20:02
69 lines
2911 bytes
Some people asked me to just include here my filters and stuff that I
use with my shell buffer so they can try it themselves to see what
happens.  Well, here it is.  Some of it probably isn't important, but
who knows?

(defun shell-backward-command ()
  "Search backwards for the previous command line and go to the end of
that line."
  (interactive)
  (beginning-of-line)
  (re-search-backward shell-prompt-pattern nil t)
  (end-of-line))

(defun shell-forward-command ()
  "Search forwards for the next command line and go to the end of
that line."
  (interactive)
  (end-of-line)
  (re-search-forward shell-prompt-pattern nil t)
  (end-of-line))

(defun ssd-for-lfd ()
  "Instead of just doing shell-send-input, this calls that and then goes to the
beginning of the previous line."
  (interactive)
  (shell-send-input)
  (previous-line 1)
  (beginning-of-line)
  (line-to-top))

(defun shell-filter (proc string)
  "Replace CTL-G(s) in shell output with a single call to ding."
  (save-excursion
    (set-buffer (process-buffer proc))
    (setq nomove (looking-at shell-prompt-pattern))
;    (setq savepoint (point))
    (goto-char (point-max))
    (save-excursion (insert string))
    (while (re-search-forward "\\([]+\\)[^]*" nil t)
      (ding)
      (delete-region (match-beginning 1) (match-end 1)))
;    (goto-char savepoint)
    )
  (move-marker (process-mark proc) (point-max))
  (if (and (not nomove) (eq (current-buffer) (process-buffer proc)))
;  (if (not nomove)
      (goto-char (point-max)))
  )

(setq shell-mode-hook
      '(lambda ()
	 (setq mode-line-format
	       (list "%b--" (getenv "HOST")
		     'default-directory "---%M---%3p---%[(%m: %s)%]%-"))
	 (local-set-key "\^j" 'ssd-for-lfd)
	 (local-set-key "\C-c\C-p" 'shell-backward-command)
	 (local-set-key "\C-c\C-n" 'shell-forward-command)
	 (define-key shell-mode-map "\C-i" 'shell-expand-file-name)
	 (setq shell-prompt-pattern "^\\[[0-9][0-9]*;[a-z][a-z]*\\] ")
	 (setq shell-pushd-regexp "pushd\\|\+")
	 (setq shell-popd-regexp "popd\\|\-")
	 (set-process-filter
	  (get-process (substring (buffer-name) 1 -1)) 'shell-filter)))
-- 
----------------------------------------
David Karr    dave@ttrnds.UUCP  or  ...amc-gw!ttrnds!dave
Teltrend Corp., 12034 115th Ave. NE, Kirkland, WA 98034 (206)820-6500
"The above statements do not necessarily reflect the opinions of my employer."
Technical Details
Message-ID: <17@ttrnds.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!bu.edu!bu-cs!snorkelwacker!think!samsung!caesar.cs.montana.edu!milton!uw-beaver!sumax!amc-gw!morpho!ttrnds!dave

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!bu.edu!bu-cs!snorkelwacker!think!samsung!caesar.cs.montana.edu!milton!uw-beaver!sumax!amc-gw!morpho!ttrnds!dave
From: dave@ttrnds.UUCP (David M. Karr)
Newsgroups: comp.emacs
Subject: Re: Garbaged input in shell buffer
Message-ID: <17@ttrnds.UUCP>
Date: 6 Feb 90 20:02:21 GMT
Reply-To: dave%ttrnds@amc-gw.AMC.com (David M. Karr)
Organization: Teltrend, Inc., Kirkland, WA
Lines: 69