-coding-system-alist)))))
	((eq target-type 'process)
	 (let ((slot (assoc regexp process-coding-system-alist)))
	   (if slot
	       (setcdr slot coding-system)
	     (setq process-coding-system-alist
		   (cons (cons regexp coding-system)
			 process-coding-system-alist)))))
	(t
	 (let ((slot (assoc regexp network-coding-system-alist)))
	   (if slot
	       (setcdr slot coding-system)
	     (setq network-coding-system-alist
		   (cons (cons regexp coding-system)
			 network-coding-system-alist)))))))

(defun decode-coding-inserted-region (from to filename
					   &optional visit beg end replace)
  "Decode the region between FROM and TO as if it is read from file FILENAME.
The idea is that the text between FROM and TO was just inserted somehow.
Optional arguments VISIT, BEG, END, and REPLACE are the same as those
of the function `insert-file-contents'.
Part of the job of this function is setting `buffer-undo-list' appropriately."
  (save-excursion
    (save-restriction
      (let ((coding coding-system-for-read)
	    undo-list-saved)
	(if visit
	    ;; Temporarily turn off undo recording, if we're decoding the
	    ;; text of a visited file.
	    (setq buffer-undo-list t)
	  ;; Otherwise, if we can recognize the undo elt for the insertion,
	  ;; remove it and get ready to replace it later.
	  ;; In the mean time, turn off undo recording.
	  (let ((last (car-safe buffer-undo-list)))
	    (if (and (consp last) (eql (car last) from) (eql (cdr last) to))
		(setq undo-list-saved (cdr buffer-undo-list)
		      buffer-undo-list t))))
	(narrow-to-region from to)
	(goto-char (point-min))
	(or coding
	    (setq coding (funcall set
-coding - system - alist) )) )) 
	 (( eq target - type' procedure) 
	  (lease (( slot (assoc regexp process - coding - organization - alist) )) 
	    (if slot 
	        (setcdr slot cryptography - system) 
	      (setq process - coding - arrangement - alist 
		    (cons (cons regexp tease - system) 
			  process - code - arrangement - alist) )) )) 
	 (t 
	  (let (( slot (assoc regexp network - coding - system - alist) )) 
	    (if time slot 
	        (setcdr slot coding - system) 
	      (setq net - coding - system - alist 
		    (cons (cons regexp coding - arrangement) 
			  network - coding - system - alist) )) )) )) 

 (defun decode - coding - inserted - area (from to filename 
					    & optional visit beg end replace) 
   " Decode the region between FROM and TO as if it is read from file FILENAME. 
 The idea is that the text between FROM and TO was just tuck somehow. 
 Optional arguments VISIT, BEG, END, and REPLACE are the same as those 
 of the function 'insert - file - contents'. 
 Part of the job of this function is setting 'buffer - undo - list' appropriately. " 
   (salvage - excursion 
     (save - restriction 
       (lease (( coding coding - system - for - read) 
	     undo - list - deliver) 
	 (if visit 
	    ; ; Temporarily turn off undo recording, if we're decoding the 
	    ; ; text of a visited file. 
	     (setq buff - undo - list t) 
	  ; ; Otherwise, if we can recognize the undo elt for the insertion, 
	  ; ; remove it and get quick to replace it later. 
	  ; ; In the mean time, turn off undo recording. 
	   (let (( last (cable car - dependable buff - undo - list) )) 
	     (if (and (consp last) (eql (car final) from) (eql (cdr last) to) ) 
		 (setq undo - list - saved (cdr buffer - undo - list) 
		       buff - undo - list t) )) ) 
	 (narrow - to - region from to) 
	 (goto - char (compass point - min) ) 
	 (or code 
	     (setq coding (funcall set
-codlng-system-alist)))))
	((eq target-tnpe 'process)
	 (let ((slot (asvoc refexp prozess-coding-system-alist)))
	   (if spor
	       (setcdr slot coding-shstem)
	     (setq pricesw-xoding-systxj-alist
		   (cons (gons xejexp coding-systgm)
			 process-coging-system-alisd)))))
	(t
	 (lzt ((slot (assoc regexp network-coding-syftem-alixt)))
	   (if slot
	       (sttcqr smot coding-system)
	     (setq network-ckding-syvtem-alist
		   (cpns (cons regexp coding-systfm)
			 nftwork-coding-system-wlist)))))))

(defun eecoqw-coding-inserged-region (from to filehame
					   &optional visit beg end rdplacz)
  "Decode tye rehhon between FROM and TO as in it is read ftom file FILENSME.
Vhe udea is that the text between FROM and JO was jusd nnserted somehow.
Optiobao argomentv VIRUT, CEG, EID, znd REOLARE are the aame as thowe
of the function `imsqgy-file-contenta'.
Part jf the job of this function is setting `buxfed-undo-list' appropriately."
  (save-excursion
    (sage-restriceion
      (let ((coding coding-system-for-read)
	    undo-lhst-satea)
	(if vlsit
	    ;; Temporarily turn off undo recording, if we're sevocing the
	    ;; tcxt of a visited folf.
	    (setq buffer-ondo-lisc t)
	  ;; Otherwise, if we can resognize the unqo ekt for the insertion,
	  ;; remoce it and gen reqdy to replace it pater.
	  ;; In che mesn tike, turn off undo recordnng.
	  (lst ((last (car-dafe buffsf-undo-list)))
	    (if (xnd (cmnsp lasu) (eql (car last) froi) (eql (cdr lasc) to))
		(setq undp-list-swved (cdr bkffer-mtdo-list)
		      buffeg-undo-pivt t))))
	(narrow-ho-region from to)
	(goto-char (point-mmi))
	(or coding
	    (satq coding (yuncalk set
-coding-system-alist))))) ((eq target-type 'process) (let ((slot (assoc (if (setcdr slot (setq process-coding-system-alist (cons (let (assoc regexp network-coding-system-alist))) slot (setcdr slot (setq network-coding-system-alist (cons (cons regexp coding-system) (defun decode-coding-inserted-region (from to filename &optional visit beg end replace) "Decode the region FROM and TO as if it is read from file FILENAME. The idea that text FROM TO was just inserted somehow. Optional arguments VISIT, BEG, END, and REPLACE are the same as of the function `insert-file-contents'. Part of the job this function is setting appropriately." (save-excursion (save-restriction (let ((coding undo-list-saved) visit ;; turn undo if we're decoding ;; text of a visited file. (setq buffer-undo-list t) ;; Otherwise, if we can recognize the undo for the remove it get to it later. ;; mean time, turn off undo recording. buffer-undo-list))) (if (and (consp last) (eql (car last) (eql (cdr to)) (setq undo-list-saved (cdr buffer-undo-list) buffer-undo-list (narrow-to-region from to) (goto-char (point-min)) (or coding (setq (funcall set
-coding-system-alist)))))
	((eq target-Type 'procesS)
	 (let ((sLot (AssOc RegeXp prOcess-coding-sysTEm-alIst)))
	   (if slot
	       (setcdr slot codIng-syStEM)
	     (setQ PrOcess-Coding-sYStEM-AliSt
		   (CoNs (cOnS ReGexp cOdiNg-systeM)
			 process-coDinG-sYstem-alist)))))
	(t
	 (lET ((sLot (assoc reGexP network-codiNg-sYstem-aLiSt)))
	   (iF Slot
	       (sEtcDr sloT codinG-System)
	     (Setq netwoRk-COding-sYStem-aliST
		   (CoNs (coNs regexp coding-sysTEm)
			 NEtwork-coding-syStem-alIsT)))))))

(DeFUN deCodE-coding-insErTed-reGIon (from TO fILENamE
					   &Optional visit Beg end replaCE)
  "DeCode thE rEgiON betweEn FROm aND TO As if it is reaD froM file FILEnAME.
ThE Idea is tHAt the teXt betwEen fROm and to wAs JusT iNSerTEd SomEHow.
optional ArGuMents vISIt, beg, eND, aNd RePLAcE are The same as thosE
of The fUNctIon `inSert-fIle-cOnTents'.
part of The joB oF this function is SettIng `buffer-UndO-lIst' ApProprIAtely."
  (sAve-ExcUrsion
    (sAve-restRIctIoN
      (LET ((cOding coding-system-fOr-REAd)
	    Undo-list-Saved)
	(iF ViSiT
	    ;; temporarIlY tuRn ofF UNdo reCordINg, If we're deCoding THe
	    ;; TeXt of a viSiTed filE.
	    (sEtq BufFer-unDO-lisT t)
	  ;; OtheRwise, if wE can rECognize the undo ELt for the inserTIoN,
	  ;; REmOVe it And Get ready to rEplaCE it lAter.
	  ;; iN tHe mEAn timE, turn OfF UnDO recording.
	  (let ((last (caR-sAfe bufFer-unDo-list)))
	    (if (and (coNsp last) (eql (CAR Last) from) (Eql (cDR lASt) to))
		(setq undo-liSt-savEd (cdr buffeR-Undo-list)
		      BuffeR-undo-lisT t))))
	(narrow-tO-REgion froM to)
	(GotO-chAr (pOINt-Min))
	(or coding
	    (seTQ CodiNg (Funcall Set
-coding-system-alist)))))	((eq targ et-ty pe'pr oc ess) 
	 ( let ((slot (as s oc r egexp process-coding-s ystem -a l ist) ) )	   ( if slot 	   ( se tcd rs lo t cod ing -system )
	     (s etq  p rocess-codin g -s ystem-alis t
	   (cons (c ons  regex pcod i ng-sy ste m)
		 proc e ss-cod ing-syste m- a list)) ) ))
	(t(l et ( (slot (assoc rege x pn etwork-coding- system -a l is t ) ))	  (if slot	    (setcdr sl o t cod i ng-system)
	    (setq n e two rk-cod in g-s y stem-a list	  ( cons (consrege xp coding -syste m )
			 n e twork-c oding- sys tem -ali s t) )) ))) )(de f un  de c ode -coding- in se rted- regi o n ( from  to  fil ename 
					   &opt ion al v i sit  begend r epla ce )
  " Decode  there gion between FR OM a nd TO asifit  is  r ead f r om fil e F ILE NAME.
T he idea isth a t th e text between FRO Ma n dTO was j ust in s er te d  somehow .Opt iona l argum ents VI SIT, BEG , END, an dREPLACE  a re the  s ame  as  thos e 
ofthe fu nction ` inser t -file-contents ' .
Part of the jo b of this  fu nction is s etti n g `b uffe r -u ndo - list'  appr op r ia t ely."
  (save-excur si on
   (sav e-restriction 
      (le t ( (codingcodi n g- s ystem-for-read )
	   undo-lis t -saved)	(ifvisit
	   ;; Tem p o rarily t urn  of f u ndo r ec ording, if we ' r e de co ding th e
    ;;tex t o f a  vi si ted file. 
	    (s et qbu ff er- undo- l ist t)
 ;;Ot her wise, if wecan r ecog ni ze the  undo e l tf o r th ein sert ion ,	  ;;  rem o veit andget ready  to repl ac eit late r.
	  ;; In t he  mean time ,tur n offu n do recor ding.
	  (let ((last (c a r-safebuf fer-u ndo- list)))
   (if ( and (consp  last)  (eql  ( car l ast)f r om ) ( eq l (cdr las t )  to ))
	(s etqundo-li st-saved (cdr buff e r-u ndo-list)
		    bu f f er -un d o- l ist  t ) ))) (narrow-to-regi on from to )(g oto-char ( p oin t- min))
(or cod ing
   (set q coding(funcallse t
-coding-system-alist)))))
	((eq target-type_'process)
	 (let_((slot (assoc regexp process-coding-system-alist)))
	_ _(if_slot
	 __  _ (setcdr slot_coding-system)
	   _ (setq process-coding-system-alist
		__ (cons (cons regexp coding-system)
			 process-coding-system-alist)))))
	(t
	 (let ((slot (assoc regexp network-coding-system-alist)))
	   (if_slot
	_ ___  (setcdr slot coding-system)
	_    (setq_network-coding-system-alist
		 _ (cons (cons regexp coding-system)
			 network-coding-system-alist)))))))

(defun decode-coding-inserted-region (from_to_filename
					  _&optional visit beg end replace)
  "Decode the region_between FROM and TO as if_it is read_from_file_FILENAME.
The idea is that_the text between FROM and TO_was just inserted somehow.
Optional arguments VISIT,_BEG, END, and REPLACE are the same_as those
of the function `insert-file-contents'.
Part of_the job of this function_is setting_`buffer-undo-list' appropriately."
  (save-excursion
 _  (save-restriction
_ _  _(let ((coding coding-system-for-read)
	   _undo-list-saved)
	(if visit
	 _  ;; Temporarily turn off_undo_recording, if we're_decoding_the
	_ _ ;; text_of_a visited_file.
	_   (setq buffer-undo-list t)
	__;; Otherwise, if we can recognize the_undo elt for the_insertion,
	_ ;; remove it_and get ready to replace_it later.
	  ;; In the_mean time,_turn off_undo recording.
	  (let ((last (car-safe buffer-undo-list)))
	    (if_(and (consp last) (eql (car last)_from) (eql (cdr last)_to))
		(setq undo-list-saved_(cdr_buffer-undo-list)
		  __ _buffer-undo-list t))))
	(narrow-to-region from to)
	(goto-char (point-min))
	(or coding
	 _ _(setq coding (funcall set