From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: feature request: view part of file Date: Sat, 19 Jan 2013 15:47:43 +0200 Message-ID: <83622tqo74.fsf@gnu.org> References: <87lijrszn0.fsf@gnu.org> <87y5npeg4p.fsf@gnu.org> <877gnakr1d.fsf@gmail.com> <8738xykq0d.fsf@gmail.com> <83boclr7bu.fsf@gnu.org> <50FA7310.5070809@cs.ucla.edu> <838v7pqwcs.fsf@gnu.org> <50FA95FE.2090105@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1358603260 2332 80.91.229.3 (19 Jan 2013 13:47:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Jan 2013 13:47:40 +0000 (UTC) Cc: sds@gnu.org, spinuvit@gmail.com, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 19 14:47:58 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TwYm6-0002qC-DC for ged-emacs-devel@m.gmane.org; Sat, 19 Jan 2013 14:47:58 +0100 Original-Received: from localhost ([::1]:44558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwYlp-0001jU-Ln for ged-emacs-devel@m.gmane.org; Sat, 19 Jan 2013 08:47:41 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwYlm-0001jB-2m for emacs-devel@gnu.org; Sat, 19 Jan 2013 08:47:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwYlj-0002wM-AT for emacs-devel@gnu.org; Sat, 19 Jan 2013 08:47:38 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:44090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwYlj-0002wD-2b; Sat, 19 Jan 2013 08:47:35 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MGV00F00KTZJJ00@a-mtaout22.012.net.il>; Sat, 19 Jan 2013 15:47:33 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGV00FQ3KZ9JX00@a-mtaout22.012.net.il>; Sat, 19 Jan 2013 15:47:33 +0200 (IST) In-reply-to: <50FA95FE.2090105@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156472 Archived-At: > Date: Sat, 19 Jan 2013 04:47:58 -0800 > From: Paul Eggert > CC: sds@gnu.org, spinuvit@gmail.com, emacs-devel@gnu.org > > It's a good idea for a couple of reasons. First, the old code > mishandled things if the file was renamed by some other process > between the time that Emacs opened it and the time that > file-regular-p invoked stat on it. Second, the typical GNU style > is that the behavior of a program should not depend on the type of > output device. > > I looked at the old change you mentioned, and it appears that > there was a problem on DOS_NT with invoking lseek (fd, 0, SEEK_END) when > FD is not a regular file. Here's a patch that should avoid this problem: Thanks. I think this should go in, with one caveat: > + open_flags = O_WRONLY | O_BINARY | O_CREAT; > + open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC; > + if (NUMBERP (append)) > + offset = file_offset (append); > + else if (!NILP (append)) > + open_flags |= O_APPEND; We cannot use O_TRUNC if the APPEND argument is non-nil, can we? Or did I misunderstand something?