Article View: gnu.emacs.bug
Article #8745619.26: jka-compr-insert-file-contents and the replace flag
From: Jay Adams
Date: Thu, 15 Sep 1994 05:22
Date: Thu, 15 Sep 1994 05:22
41 lines
2286 bytes
2286 bytes
jka-compr-insert-file-contents does not implement the 'replace' arg for compressed files. I came up with one quick solution, the patch I've included, but it's not perfect. I just delete the portion of the buffer that should be overwritten, so it doesn't preserve the marks the way the regular insert-file-contents would. The problem is that since I use call-process to get the uncompressed data into the buffer, I can't make it overwrite the buffer contents. I bring the uncompressed data in using call-process so I don't have to worry about whether there's enough space in /tmp to hold the uncompressed data. Otherwise, I would just put the uncompressed file in /tmp and insert it using real-insert-file-contents. Suggestions? *** jka-compr.el Thu Sep 15 00:41:48 1994 --- jka-compr.el Thu Sep 15 00:59:08 1994 *************** *** 510,515 **** --- 510,517 ---- (condition-case error-code (progn + (if replace + (goto-char (point-min))) (setq start (point)) (if (or beg end) (jka-compr-partial-uncompress uncompress-program *************** *** 529,534 **** --- 531,541 ---- nil uncompress-args)) (setq size (- (point) start)) + (if replace + (let* ((del-beg (point)) + (del-end (+ del-beg size))) + (delete-region del-beg + (min del-end (point-max))))) (goto-char start) ;; Run the functions that insert-file-contents would. (let ((list after-insert-file-functions)
Technical Details
Message-ID:
<199409150518.BAA07781@mustang.ece.cmu.edu>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!deathstar.cris.com!news1.oakland.edu!vtc.tacom.army.mil!ulowell!europa.eng.gtefsd.com!MathWorks.Com!solaris.cc.vt.edu!uunet!cis.ohio-state.edu!ece.cmu.edu!jkaShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,be6928dd1f7ac02c,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-09-16 14:28:36 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!deathstar.cris.com!news1.oakland.edu!vtc.tacom.army.mil!ulowell!europa.eng.gtefsd.com!MathWorks.Com!solaris.cc.vt.edu!uunet!cis.ohio-state.edu!ece.cmu.edu!jka From: jka@ece.cmu.edu (Jay Adams) Newsgroups: gnu.emacs.bug Subject: 19.26: jka-compr-insert-file-contents and the replace flag Date: 15 Sep 1994 01:22:15 -0400 Organization: GNUs Not Usenet Lines: 45 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <199409150518.BAA07781@mustang.ece.cmu.edu>