From: Houda Araj
Subject: load repeat.lisp
Date: 
Message-ID: <7d0055df.0111120545.1fde7285@posting.google.com>
Please tell me how to run this program on UNIX. 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; File Name: repeat.el
;;;
;;; Useful for writers -- catches a standard bug. Finds occurrences
;;; of repeated words, like "the the".
;;; Written by Mark Shirley.
;;;
;;; Modified by Ramesh Gopinath 7/30/93. It will now query the user 
;;; for removing the repeated word -- crude.

;;; Should not consider the <the> as a repeated word sequence
;;; Need to handle math-mode. (E.g., should not find p^p)
;;; Should to handle LaTex mode. (E.g., should not find aa aa)

(defun find-next-repeated-word ()
  "Search forward for the next repeated word."
  (interactive)
  (catch `found-one
    (progn
      (if (and (forward-word 1)
	       (forward-word -1))
	  (let ((a nil) (b nil))
	    (setq a (downcase (buffer-substring
			       (point)
			       (progn (forward-word 1) (point)))))
	    (message "searching...")
	    (while (forward-word 1)
	      (setq b (downcase (buffer-substring
				 (save-excursion (forward-word -1) (point))
				 (point))))
	      (if (string-equal a b)
		  (progn
		    ;; Modify Begin - Ramesh Gopinath - Fri Jul 30 10:20:46 1993
		    (message "Repeated word! Delete one word (y or n)?")
		    (cond ((= 121 (read-char))
			   (progn (forward-word -2) (forward-word 1)
				  (kill-region (point) (progn (forward-word 1) (point)))
				  (push-mark))
			   ;; Modify End 
			   (message "searching..."))
			  (t (throw `found-one nil)))))
	      (setq a b))))
      (message "Could find no more repeated words"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

From: Janis Dzerins
Subject: Re: load repeat.lisp
Date: 
Message-ID: <87wv0wf5gu.fsf@asaka.latnet.lv>
··········@cogmedia.com (Houda Araj) writes:

> Please tell me how to run this program on UNIX. 

It is repeat.el not repeat.lisp.

And it is therefore intended to be run in emacs, which in turn can be
run in [some] UNIXes.

emacs accepts a --batch commnd-line argument (or is it switch?), which
can be used to run emacs in (guess what) batch mode. You might find
-l, --no-site-file and --eval arguments helpful as well.

For more info, try emacs specific newsgroup.

-- 
Janis Dzerins

  Eat shit -- billions of flies can't be wrong.
From: Thomas F. Burdick
Subject: Re: load repeat.lisp
Date: 
Message-ID: <xcveln3jono.fsf@conquest.OCF.Berkeley.EDU>
··········@cogmedia.com (Houda Araj) writes:

> Please tell me how to run this program on UNIX. 

> ;;; File Name: repeat.el

This is an emacs lisp file, so question should go to an emacs group
(gnu.emacs.help, for example, or comp.editors.emacs).  First, rename
the file to repeat.el.

Start Emacs, type M-x load-file, and enter the path to it, when you're
prompted.  When you want to use the function defined here, type
M-x find-next-repeated-word

> ;;;
> ;;; Useful for writers -- catches a standard bug. Finds occurrences
> ;;; of repeated words, like "the the".
> ;;; Written by Mark Shirley.
> ;;;
> ;;; Modified by Ramesh Gopinath 7/30/93. It will now query the user 
> ;;; for removing the repeated word -- crude.
> 
> ;;; Should not consider the <the> as a repeated word sequence
> ;;; Need to handle math-mode. (E.g., should not find p^p)
> ;;; Should to handle LaTex mode. (E.g., should not find aa aa)
> 
> (defun find-next-repeated-word ()
>   "Search forward for the next repeated word."
>   (interactive)
>   (catch `found-one
>     (progn
>       (if (and (forward-word 1)
> 	       (forward-word -1))
> 	  (let ((a nil) (b nil))
> 	    (setq a (downcase (buffer-substring
> 			       (point)
> 			       (progn (forward-word 1) (point)))))
> 	    (message "searching...")
> 	    (while (forward-word 1)
> 	      (setq b (downcase (buffer-substring
> 				 (save-excursion (forward-word -1) (point))
> 				 (point))))
> 	      (if (string-equal a b)
> 		  (progn
> 		    ;; Modify Begin - Ramesh Gopinath - Fri Jul 30 10:20:46 1993
> 		    (message "Repeated word! Delete one word (y or n)?")
> 		    (cond ((= 121 (read-char))
> 			   (progn (forward-word -2) (forward-word 1)
> 				  (kill-region (point) (progn (forward-word 1) (point)))
> 				  (push-mark))
> 			   ;; Modify End 
> 			   (message "searching..."))
> 			  (t (throw `found-one nil)))))
> 	      (setq a b))))
>       (message "Could find no more repeated words"))))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'