unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vitalie Spinu <spinuvit@gmail.com>
To: sds@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: feature request: view part of file
Date: Sat, 19 Jan 2013 00:52:50 +0100	[thread overview]
Message-ID: <8738xykq0d.fsf@gmail.com> (raw)
In-Reply-To: <877gnakr1d.fsf@gmail.com> (Vitalie Spinu's message of "Sat, 19 Jan 2013 00:30:38 +0100")

  >> Vitalie Spinu <spinuvit@gmail.com>
  >> on Sat, 19 Jan 2013 00:30:38 +0100 wrote:

  >> Sam Steingold <sds@gnu.org>
  >> on Thu, 14 Jun 2012 17:29:58 -0400 wrote:

  >> I put vlf.el by Mathias into elpa. I rewrote it almost completely
  >> (bzr still has the original version at revno 233). it works for me.

  VS> It doesn't work for me. vlf-next-batch pops:

  VS>    Debugger entered--Lisp error: (wrong-type-argument file-offset 2048.0)
  VS>      insert-file-contents("/home/vitoshka/test/foo.csv" nil 1024 2048.0)
  VS>      vlf-next-batch(nil)
  VS>      call-interactively(vlf-next-batch nil nil)

So it is really a bug in emacs, insert-file-contents accepts integer
values only, but for big files the size and positions are floats. In my
case 802200060.0. 

It happens because vlf-file-size if float:

╭──────── #143 ─ /home/vitoshka/Dropbox/ELPA/vlf-0.2/vlf.el ──
│           vlf-file-size ((nth 7 (file-attributes file)))
╰──────── #143 ─

and 

╭──────── #102 ─ /home/vitoshka/Dropbox/ELPA/vlf-0.2/vlf.el ──
│         (end (min vlf-file-size (+ vlf-end-pos vlf-batch-size))))
╰──────── #102 ─

returns float which is passed down to insert-file-contents.


So I am stuck here, I just cannot technically access the last piece of
my (700MB) file.

    Thanks, 
    Vitalie


  VS> Would be nice to actually write the batch into a local file and put the
  VS> buffer into the appropriate mode. So if the file is csv I view it in
  VS> csv-mode. Then get a special command to write the contents into the
  VS> original file.

  VS> The dired integration could be improved by making it pop into vlf mode
  VS> whenever the file exceeds some user specified size.

  VS>     Vitalie

  >> I wish I knew how to hook it into files.el, but I don't...

  >> vlf.el has 2 issues:

  >> 1. insert-file-contents hangs emacs (see `vlf-next-batch'):

  >> ;; replacing `erase-buffer' with replace arg to `insert-file-contents'
  >> ;; hangs emacs
  >> (unless append (erase-buffer))
  >> (insert-file-contents buffer-file-name nil vlf-end-pos end)

  >> 2. I have this:

  >> (define-key map [C-+] 'vlf-change-batch-size)

  >> When I do C-+ (by pressing Ctrl, Shift, and the "+=" key to the left of
  >> backspace), I get "C-+ is undefined".
  >> when I do M-x vlf-change-batch-size RET, I get
  >> "You can run the command `vlf-change-batch-size' with <C-+>"
  >> The "+" in both messages is the same character (43, #o53, #x2b).



  reply	other threads:[~2013-01-18 23:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 20:52 feature request: view part of file Sam Steingold
2012-06-13 23:16 ` Stefan Monnier
2012-06-14 16:20   ` Sam Steingold
2012-06-14 16:53     ` Mathias Dahl
2012-06-14 17:32     ` Stephen J. Turnbull
2012-06-14 18:21       ` Paul Eggert
     [not found]     ` <jwvd3517qww.fsf-monnier+emacs@gnu.org>
     [not found]       ` <CABrcCQ5zDfB2tw9DRrwpCZmDqHPc+BB6W5w9ULNU95e_v4yyJw@mail.gmail.com>
     [not found]         ` <87395xu768.fsf@gnu.org>
     [not found]           ` <CABrcCQ6rpG9qhsCO+ZEpTiNqbQRtg-PBeb=q_B5F8YgrGxoWKA@mail.gmail.com>
     [not found]             ` <jwvvcit67sc.fsf-monnier+emacs@gnu.org>
2012-06-14 19:34               ` Sam Steingold
2012-06-14 21:29 ` Sam Steingold
2012-06-18 20:34   ` Štěpán Němec
2012-07-19 17:58     ` Samuel Bronson
2012-07-19 19:38       ` Stephen J. Turnbull
2012-08-04 11:58   ` Andrey Kotlarski
2013-01-18 23:30   ` Vitalie Spinu
2013-01-18 23:52     ` Vitalie Spinu [this message]
2013-01-19  6:54       ` Eli Zaretskii
2013-01-19 10:18         ` Paul Eggert
2013-01-19 10:51           ` Eli Zaretskii
2013-01-19 12:47             ` Paul Eggert
2013-01-19 13:47               ` Eli Zaretskii
2013-01-19 19:00                 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738xykq0d.fsf@gmail.com \
    --to=spinuvit@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).