Path: utzoo!attcan!uunet!husc6!rutgers!topaz.rutgers.edu!steiner From: steiner@topaz.rutgers.edu (Dave Steiner) Newsgroups: comp.emacs Subject: Re: Inverting text from GnuEmacs lisp Keywords: highlighting lisp Message-ID:Date: 21 Jun 88 03:02:44 GMT References: <4748@hoptoad.uucp> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 34 To: hugh@hoptoad.uucp Cc: steiner Got this off the net a while ago: ;;; Highlight a region ;;; From: lrs@esl.UUCP (Lynn Slater) ;;; Date: 24 Feb 88 21:05:21 GMT (defun highlight-region (p1 p2) "Highlight the current region." (interactive "r") (let ((s (buffer-substring p1 p2)) (inverse-video t) (modified-flag (buffer-modified-p)) ; Do not change the modified flag (buffer-read-only nil) ; shadow the true local value of read-only ;; Prevent the generation of autosave files ;; Don't you just love dynamic variable binding? ;; we do not have to worry about backup files because ;; they are not generated unless the buffer is saved. (buffer-auto-save-file-name nil)) (delete-region p1 p2) ;; force a redisplay, so that the screen image of the line "changes" later (if (fboundp 'update-display) (update-display) (sit-for 0)) (insert s) (if (fboundp 'update-display) (update-display) (sit-for 0)) (set-buffer-modified-p modified-flag))) ds -- arpa: Steiner@TOPAZ.RUTGERS.EDU uucp: ...{ames, cbosgd, harvard, moss}!rutgers!topaz.rutgers.edu!steiner