From 421273de0c33da276dd8c1bfb19fe902e999521d Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Wed, 15 Feb 2023 21:25:37 +0100
Subject: Add --sort=none

---
 man/feh.pre   | 9 +++++++--
 src/options.c | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/man/feh.pre b/man/feh.pre
index 1899800..af1def1 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -792,9 +792,9 @@ in paused mode.
 .
 Sort file list according to image parameters.
 Allowed sort types are:
-.Cm name , filename , dirname , mtime , width , height , pixels , size , format .
+.Cm name , none , filename , dirname , mtime , width , height , pixels , size , format .
 For sort modes other than
-.Cm name , filename , dirname ,
+.Cm name , none , filename , dirname ,
 or
 .Cm mtime ,
 a preload run is
@@ -822,6 +822,11 @@ you can use
 .Cm --version-sort
 to sort numbers naturally, so that e.g. 10.jpg comes after 2.jpg.
 .
+.Pp
+.
+.Cm none
+is the default; you can specify it explicitly to discard a sort mode that has
+been specified at an earlier point in the command line arguments.
 .It Cm -| , --start-at Ar filename
 .
 Start the filelist at
diff --git a/src/options.c b/src/options.c
index d3524f7..80f13b6 100644
--- a/src/options.c
+++ b/src/options.c
@@ -537,6 +537,8 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
 		case OPTION_sort:
 			if (!strcasecmp(optarg, "name"))
 				opt.sort = SORT_NAME;
+			else if (!strcasecmp(optarg, "none"))
+				opt.sort = SORT_NONE;
 			else if (!strcasecmp(optarg, "filename"))
 				opt.sort = SORT_FILENAME;
 			else if (!strcasecmp(optarg, "dirname"))
-- 
cgit v1.2.3