m00natic / vlfi

View Large Files in Emacs
457 stars 25 forks source link

Problems opening large file using emacslient file argument #42

Open stef204 opened 6 years ago

stef204 commented 6 years ago

version: 20180201.1454 (Emacs 26) How do I setup the batch size to a lower value than default, on a permanent basis?

m00natic commented 6 years ago
(setq vlf-batch-size 2000               ;your preferred batch size
      vlf-tune-enabled nil              ;disable auto tuning so batch size stays the same
      vlf-batch-size-remote 2000) ;optionally change remote file batch size, very small by default

That should do it.

stef204 commented 6 years ago

Thanks.

Tried it; and it produces errors when opening file with emacsclient using: emacsclient somelargefile.txt (so on server buffers.)

It asks me if I want to open it with vlf (I set it up that way), and when I press "v", It seems to kill the frame and I get back to the command line prompt with "ERROR".

The file does seem to be opened by the server though: if I then just run emacsclient (with no argument) and look at the buffers, there is one for somelargefile.txt

Here is the backtrace

Note: It does not misbehave if I open the file with client already open, using Ctrl-x Ctrl-f BUT it does trigger the debug-on-error and backtrace given above in that case.

Note: it does not misbehave if I use emacsclient -n somelargefile.txt

m00natic commented 6 years ago

Thanks, I'm able to reproduce this. The problem seems to be throwing error in the abort-if-file-too-large around advice. This is done to in order to abort the normal file open procedure immediately and open with VLF instead. I'll try to find more civilized way to do this. Until then take the workaround, start emacsclient with no file argument and open the (large) file from there.

stef204 commented 6 years ago

OK, I can also use emacsclient -n somelargefile.txt for the time being. Thanks for looking into this. Happy to test any potential fix, provide feedback, etc.

stef204 commented 6 years ago

Hi, just a nudge to see if any progress on fixing this issue. Thanks.

JohnLunzer commented 5 years ago

Another nudge. I am using emacsclient almost exclusively.

nicholascarroll commented 2 years ago

In fact, emacsclient exits badly even when vlf is not installed. It asks: "really open? (y)es or (n)o or (l)iterally" Choosing either (n) or (l) will kill your shell.

So I am using a workaround: I check filesizes in bash before letting emacs open the file(s). I use this function in my .bashrc:

function e () 
{ 
    if [[ $# -gt 0 ]] && [[ -n $(find $@ -type f -size +10M 2>/dev/null) ]]; then
        emacs -nw $@;
    else
        emacsclient -t $@;
    fi
}