about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-27T17·12+0100
committerVincent Ambo <tazjin@google.com>2019-12-27T18·18+0100
commit12973b8a8bc596f99503ec12869383d0a6bb8221 (patch)
tree604570e5e92bf2870311e9833ceee4e7a34832fa /third_party
parent100f451b0aae7a286a92c9ffd805982d3ecbc1ae (diff)
feat(third_party/notmuch): Display dottime in relative time views r/313
Diffstat (limited to 'third_party')
-rw-r--r--third_party/default.nix7
-rw-r--r--third_party/notmuch/default.nix5
-rw-r--r--third_party/notmuch/dottime.patch35
3 files changed, 46 insertions, 1 deletions
diff --git a/third_party/default.nix b/third_party/default.nix
index e5394752f3..44e96ff706 100644
--- a/third_party/default.nix
+++ b/third_party/default.nix
@@ -63,7 +63,6 @@ let
       nano
       nginx
       nix
-      notmuch
       openssh
       openssl
       parallel
@@ -97,7 +96,13 @@ let
 
 in exposed // {
   callPackage = nixpkgs.lib.callPackageWith exposed;
+
   # Provide the source code of nixpkgs, but do not provide an imported
   # version of it.
   nixpkgsSrc = stableSrc;
+
+  # Packages to be overridden
+  originals = {
+    inherit (nixpkgs) notmuch;
+  };
 }
diff --git a/third_party/notmuch/default.nix b/third_party/notmuch/default.nix
new file mode 100644
index 0000000000..3d45031a82
--- /dev/null
+++ b/third_party/notmuch/default.nix
@@ -0,0 +1,5 @@
+{ pkgs, ... }:
+
+pkgs.third_party.originals.notmuch.overrideAttrs(old: {
+  patches = [ ./dottime.patch ] ++ (if old ? patches then old.patches else []);
+})
diff --git a/third_party/notmuch/dottime.patch b/third_party/notmuch/dottime.patch
new file mode 100644
index 0000000000..147ee3b411
--- /dev/null
+++ b/third_party/notmuch/dottime.patch
@@ -0,0 +1,35 @@
+diff --git a/notmuch-time.c b/notmuch-time.c
+index 2734b36a..b1ec4bdc 100644
+--- a/notmuch-time.c
++++ b/notmuch-time.c
+@@ -50,8 +50,8 @@ notmuch_time_relative_date (const void *ctx, time_t then)
+     time_t delta;
+     char *result;
+ 
+-    localtime_r (&now, &tm_now);
+-    localtime_r (&then, &tm_then);
++    gmtime_r (&now, &tm_now);
++    gmtime_r (&then, &tm_then);
+ 
+     result = talloc_zero_size (ctx, RELATIVE_DATE_MAX);
+     if (result == NULL)
+@@ -79,16 +79,16 @@ notmuch_time_relative_date (const void *ctx, time_t then)
+ 	    delta < DAY)
+ 	{
+ 	    strftime (result, RELATIVE_DATE_MAX,
+-		      "Today %R", &tm_then); /* Today 12:30 */
++		      "Today %k·%M", &tm_then); /* Today 12·30 */
+ 	    return result;
+ 	} else if ((tm_now.tm_wday + 7 - tm_then.tm_wday) % 7 == 1) {
+ 	    strftime (result, RELATIVE_DATE_MAX,
+-		      "Yest. %R", &tm_then); /* Yest. 12:30 */
++		      "Yest. %k·%M", &tm_then); /* Yest. 12·30 */
+ 	    return result;
+ 	} else {
+ 	    if (tm_then.tm_wday != tm_now.tm_wday) {
+ 		strftime (result, RELATIVE_DATE_MAX,
+-			  "%a. %R", &tm_then); /* Mon. 12:30 */
++			  "%a. %k·%M", &tm_then); /* Mon. 12·30 */
+ 		return result;
+ 	    }
+ 	}