emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: view part of file


From: Vitalie Spinu
Subject: Re: feature request: view part of file
Date: Sat, 19 Jan 2013 00:52:50 +0100
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2.91 (gnu/linux)

  >> Vitalie Spinu <address@hidden>
  >> on Sat, 19 Jan 2013 00:30:38 +0100 wrote:

  >> Sam Steingold <address@hidden>
  >> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]