From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 84A486DE01EA for ; Tue, 10 Jan 2017 10:15:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.591 X-Spam-Level: X-Spam-Status: No, score=0.591 tagged_above=-999 required=5 tests=[AWL=0.611, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X577jIAnMN_l for ; Tue, 10 Jan 2017 10:15:31 -0800 (PST) Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by arlo.cworth.org (Postfix) with ESMTPS id D767E6DE01CE for ; Tue, 10 Jan 2017 10:15:30 -0800 (PST) Received: by mail-lf0-f66.google.com with SMTP id j75so15409782lfe.3 for ; Tue, 10 Jan 2017 10:15:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=NMOyhCqq8z64WKSWa1Fvtqnjr0VttoXQ6Ob3uxDd/tU=; b=2R7xxiqJWGgXQjyJlxWAe/oEquyioFwkq0trvxkHv7YRpk0aO3w8w3/5jdVKji3Jeh t71VNJ9lzoM/flG543PWg3bUhRYMw4CyUieJwk7yuQcEsxzXWg+LsxVvyXAwybjSMtqV Xg+UAvikCz8rY/KZ9JyV30A1hBqyKuNMxKIa6glgN90ot4knpxoUxj2P8zftp+h4t6gg YtnpnKvOw/41g9C/SoNEZcX9txJBr+sCs4+4gT5AOXClv42a6qj0KwBg8LNUTeFefYm+ 1DDsH/me/Qq8D79p8q6QQWT5m24u2vzmjQmAsLHj0CBSQgYvm0lDOI46Vy3+Le5yrF3z zokw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NMOyhCqq8z64WKSWa1Fvtqnjr0VttoXQ6Ob3uxDd/tU=; b=GCu5crl7JM63kCTfOC1PyP0yJbT0MWRhOXeG+T3PTVIs9v6LtaLz+fQL6JW3uT586K pkrzyRoLLkpHAckMwsbOtO/cHZYfq2FBIs6Ns2cYhz8VlceqCk1nVeVdSlLp7KvjUiWs FQkiYAkpAkwMD9HBGJ8RnHGYBsuIHzSbf0kJEv7SPi0+QzI2llRhNYRvHFDMm0WaWiHk mMPlnnhLCF2ZBeBFVU/wPuorT5e+O6cbhzyei8rN7Rk/+jpu9ObWLgK58n9IZbQ1uYEG 34VKwqHzhNXbiAkR/jTzCvUzgwDfxqcWCwcbNCwa3hnYD9FMv50Pt55wDY9hesBHFgad X85Q== X-Gm-Message-State: AIkVDXJ3sRRSPI6KrwReIAWv8UlSOQ64xLrM14RQzKpwSnAK8RegofGnhNH85TFzOUDxPw== X-Received: by 10.25.218.17 with SMTP id r17mr1630411lfg.56.1484072128222; Tue, 10 Jan 2017 10:15:28 -0800 (PST) Received: from localhost (mobile-access-5d6a79-214.dhcp.inet.fi. [93.106.121.214]) by smtp.gmail.com with ESMTPSA id 206sm644826ljf.35.2017.01.10.10.15.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Jan 2017 10:15:27 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH] emacs: add support for stashing formatted timestamp Date: Tue, 10 Jan 2017 20:15:25 +0200 Message-Id: <20170110181525.18269-1-jani@nikula.org> X-Mailer: git-send-email 2.11.0 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 18:15:32 -0000 notmuch-show-stash-date stashes the Date: header of the message verbatim. While that is useful, sometimes more control of the output is desirable. Add support for stashing the message timestamp (as parsed by gmime at the lib level from the Date: header) according to a user customizable format. The user can use this to stash the message date in the preferred format, or perhaps as a date: range query, for example "date:@%s.." to find all messages since the current message. --- emacs/notmuch-show.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 364004b82040..694b6de54104 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -182,6 +182,14 @@ each attachment handler is logged in buffers with names beginning \" *notmuch-part*\". This option requires emacs version at least 24.3 to work.") +(defcustom notmuch-show-stash-timestamp-format "%s" + "Format string for `notmuch-show-stash-timestamp'. + +This is the FORMAT-STRING passed to `format-time-string' for +stashing the current message's timestamp." + :type 'string + :group 'notmuch-show) + (defcustom notmuch-show-stash-mlarchive-link-alist '(("Gmane" . "http://mid.gmane.org/") ("MARC" . "https://marc.info/?i=") @@ -1403,6 +1411,7 @@ reset based on the original query." (let ((map (make-sparse-keymap))) (define-key map "c" 'notmuch-show-stash-cc) (define-key map "d" 'notmuch-show-stash-date) + (define-key map "D" 'notmuch-show-stash-timestamp) (define-key map "F" 'notmuch-show-stash-filename) (define-key map "f" 'notmuch-show-stash-from) (define-key map "i" 'notmuch-show-stash-message-id) @@ -1666,6 +1675,9 @@ current thread." (defun notmuch-show-get-date () (notmuch-show-get-header :Date)) +(defun notmuch-show-get-timestamp () + (notmuch-show-get-prop :timestamp)) + (defun notmuch-show-get-from () (notmuch-show-get-header :From)) @@ -2236,6 +2248,13 @@ thread from search." (interactive) (notmuch-common-do-stash (notmuch-show-get-date))) +(defun notmuch-show-stash-timestamp () + "Copy timestamp of current message to kill-ring, formatted according to `notmuch-show-stash-timestamp-format'." + (interactive) + (notmuch-common-do-stash + (format-time-string notmuch-show-stash-timestamp-format + (seconds-to-time (notmuch-show-get-timestamp))))) + (defun notmuch-show-stash-filename () "Copy filename of current message to kill-ring." (interactive) -- 2.11.0