Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!rutgers!uwvax!ai!neves
From: neves@ai.cs.wisc.edu (David M. Neves)
Newsgroups: comp.emacs
Subject: Re: Copyleft
Message-ID: <6741@spool.cs.wisc.edu>
Date: 29 Nov 88 04:32:02 GMT
References: <8811231526.AA23326@EDDIE.MIT.EDU> <6724@spool.cs.wisc.edu>
Sender: news@spool.cs.wisc.edu
Reply-To: neves@ai.cs.wisc.edu (David M. Neves)
Organization: U of Wisconsin CS Dept
Lines: 43

In article <6724@spool.cs.wisc.edu> neves@ai.cs.wisc.edu (David M. Neves) writes:
>I'm too lazy to do the following but perhaps someone else will...
>
>Add a function to find-file-hooks that ...
...
Well I guess everyone is lazier than I so here is code that skips by
GNU copyright notices.
;;; ----- CUT HERE -----
;;; Skip by copyright information in gnu emacs files.
;;; Copyright (c) (you've got to be kidding) 1988  neves@cs.wisc.edu
;;; Handles most gnu emacs files on /lisp and /src
;;; Known bugs:  It knows only about official GNU library files.
;;;   Unofficial files may not have the same text and so this code will
;;;   not skip by unofficial header comments.
;;; To use: Put this file in your .emacs file (before any other code that
;;;   sets find-file-hooks) and help stamp out software hoarding!
;;; 
(if (not (memq 'skipcopyright find-file-hooks))
	 (setq find-file-hooks (cons 'skipcopyright find-file-hooks)))
(defun skipcopyright nil
  (let ((p (point)) n (case-fold-search t))
    (if (= p (point-min))  ;anyone else fiddled with point?
	(progn
	  (goto-line 8)
	  (setq n (point))
	  (goto-line 1)
	  ;; "Copyright" is almost always found in the 1st 7 lines
	  ;; assume no more than 2000 characters in copyright comment
	  (if (null (and (search-forward "Copyright (C)" n t)
			 (or (search-forward "all copies." (+ (point) 2000) t)
			     (search-forward "hoarding!" (+ (point) 6000) t))))
	      (goto-char p)
	    (next-line 1)
	    ;; kludge code for setting last_window_start field of buffer.
	    ;; Is there a better way?
	    (save-window-excursion
	      (switch-to-buffer (current-buffer))
	      (set-window-start (selected-window) (point))
	      (switch-to-buffer nil)))))))

;David Neves, Computer Sciences Department, University of Wisconsin-Madison
;Usenet:  {rutgers,ucbvax}!uwvax!neves
;Arpanet: neves@cs.wisc.edu