Path: 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 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."