]> Sergey Matveev's repositories - nnn.git/commitdiff
Update NNN_NOWAIT changes
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 19 Sep 2017 14:25:02 +0000 (19:55 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 19 Sep 2017 14:25:02 +0000 (19:55 +0530)
README.md
nnn.1
nnn.c

index 5540e6965ca47f90bcacecb70165a46a5fb3c090..4c0319d8a81ee3bd57b82ac844b2363e3f000a72 100644 (file)
--- a/README.md
+++ b/README.md
@@ -45,6 +45,8 @@ Noice is Not Noice, a noicer fork...
   - [file copy, move, delete](#file-copy-move-delete)
   - [boost chdir prompt](#boost-chdir-prompt)
   - [set idle timeout](#set-idle-timeout)
+- [Troubleshooting](#troubleshooting)
+  - [nnn blocks on opening files](#nnn-blocks-on-opening-files)
 - [Why fork?](#why-fork)
 - [Mentions](#mentions)
 - [Developers](#developers)
@@ -333,7 +335,7 @@ Start `nnn` and use <kbd>^K</kbd> to copy the absolute path (from `/`) of the fi
 
 The default color for directories is blue. Option `-c` accepts color codes from 0 to 7 to use a different color:
 
-0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta, 6-cyan, 7-white
+    0-black, 1-red, 2-green, 3-yellow, 4-blue, 5-magenta, 6-cyan, 7-white
 
 Any other value disables colored directories.
 
@@ -353,11 +355,13 @@ Any other value disables colored directories.
 
 The terminal screensaver is disabled by default. To set the wait time in seconds, use environment variable `NNN_IDLE_TIMEOUT`.
 
-#### open file in new process and make the nnn not block
+### Troubleshooting
 
-The desktop file opener should take care of opening files in new processes without causing `nnn` to block.
-If `nnn` does block/freeze when a file is open, then set the environment variable `NNN_NOWAIT` to any
-non-zero value.
+#### nnn blocks on opening files
+
+Ideally nnn should not block. Unfortunately, sometimes even the same desktop opener behaves differently on different Linux desktop environments. If `nnn` does block when a file is open, set the environment variable `NNN_NOWAIT` to any non-zero value. For example,
+
+    export NNN_NOWAIT=1
 
 ### Why fork?
 
diff --git a/nnn.1 b/nnn.1
index 13d7c35168199095174457ac2edda733f1ea4871..e239f73c8908ff07fe188231a74ef890a7fad92b 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -181,19 +181,19 @@ when dealing with the !, e and p commands respectively.
 \fBNNN_BMS:\fR bookmark string as \fIkey:location\fR pairs (max 10) separated by
 \fI;\fR:
 .Bd -literal
-        export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
+    export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
 .Ed
 .Pp
 \fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text
 files.
 .Bd -literal
-        export NNN_USE_EDITOR=1
+    export NNN_USE_EDITOR=1
 .Ed
 .Pp
 \fBNNN_DE_FILE_MANAGER:\fR set to a desktop file manager to open the current
 directory with. E.g.:
 .Bd -literal
-        export NNN_DE_FILE_MANAGER=thunar
+    export NNN_DE_FILE_MANAGER=thunar
 .Ed
 .Pp
 \fBNNN_IDLE_TIMEOUT:\fR set idle timeout (in seconds) to invoke terminal
@@ -201,17 +201,16 @@ screensaver.
 .Pp
 \fBNNN_COPIER:\fR set to a clipboard copier script. For example, on Linux:
 .Bd -literal
-        -------------------------------------
-        #!/bin/sh
+    -------------------------------------
+    #!/bin/sh
 
-        echo -n $1 | xsel --clipboard --input
-        -------------------------------------
+    echo -n $1 | xsel --clipboard --input
+    -------------------------------------
 .Ed
 .Pp
-\fBNNN_NOWAIT:\fR make nnn not block while a file is open. Only necessary if
-nnn is blocking while a file is open.
+\fBNNN_NOWAIT:\fR necessary only if nnn blocks while a file is open.
 .Bd -literal
-       export NNN_NOWAIT=1
+    export NNN_NOWAIT=1
 .Ed
 .Sh KNOWN ISSUES
 If you are using urxvt you might have to set backspacekey to DEC.
diff --git a/nnn.c b/nnn.c
index 1b1ba40898587e1540417fb2e439f1947b5045e3..8eda2b37d8ff0369a490702afa870bad5f8694e1 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -222,7 +222,7 @@ static char *player;
 static char *copier;
 static char *editor;
 static char *desktop_manager;
-static char nowait;
+static char nowait = F_NOTRACE;
 static blkcnt_t ent_blocks;
 static blkcnt_t dir_blocks;
 static ulong num_files;
@@ -2865,7 +2865,7 @@ main(int argc, char *argv[])
        copier = getenv("NNN_COPIER");
 
        /* Get nowait flag */
-       nowait = F_NOTRACE | (getenv("NNN_NOWAIT") ? F_NOWAIT : 0);
+       nowait |= getenv("NNN_NOWAIT") ? F_NOWAIT : 0;
 
        signal(SIGINT, SIG_IGN);