Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7F02E429E4E for ; Sun, 29 Jan 2012 23:15:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RxiPwJoOtxGI for ; Sun, 29 Jan 2012 23:15:01 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E1C41431FBC for ; Sun, 29 Jan 2012 23:15:00 -0800 (PST) Received: by wibhi8 with SMTP id hi8so3322964wib.26 for ; Sun, 29 Jan 2012 23:14:59 -0800 (PST) Received: by 10.180.90.194 with SMTP id by2mr2148704wib.5.1327907699746; Sun, 29 Jan 2012 23:14:59 -0800 (PST) Received: from localhost ([109.131.39.11]) by mx.google.com with ESMTPS id dr5sm49669065wib.0.2012.01.29.23.14.59 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 Jan 2012 23:14:59 -0800 (PST) From: Pieter Praet To: David Edmondson Subject: [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Date: Mon, 30 Jan 2012 08:12:53 +0100 Message-Id: <1327907574-12760-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <1327397873-20596-1-git-send-email-dme@dme.org> References: <1327397873-20596-1-git-send-email-dme@dme.org> Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Mon, 30 Jan 2012 07:15:01 -0000 * emacs/notmuch-show.el (notmuch-show-get-message-id): Add optional arg BARE. When non-nil, return a Message-Id without quotes and prefix, thus obviating the need to strip them off again in various places. (notmuch-show-stash-message-id-stripped): Update wrt changes in `notmuch-show-get-message-id'. --- emacs/notmuch-show.el | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 84ac624..b13d088 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1216,9 +1216,14 @@ Some useful entries are: (notmuch-show-get-message-properties)))) (plist-get props prop))) -(defun notmuch-show-get-message-id () - "Return the message id of the current message." - (concat "id:\"" (notmuch-show-get-prop :id) "\"")) +(defun notmuch-show-get-message-id (&optional bare) + "Return the Message-Id of the current message. + +If optional argument BARE is non-nil, return +the Message-Id without prefix and quotes." + (if bare + (notmuch-show-get-prop :id) + (concat "id:\"" (notmuch-show-get-prop :id) "\""))) ;; dme: Would it make sense to use a macro for many of these? @@ -1618,7 +1623,7 @@ buffer." (defun notmuch-show-stash-message-id-stripped () "Copy message ID of current message (sans `id:' prefix) to kill-ring." (interactive) - (notmuch-common-do-stash (substring (notmuch-show-get-message-id) 4 -1))) + (notmuch-common-do-stash (notmuch-show-get-message-id t))) (defun notmuch-show-stash-subject () "Copy Subject field of current message to kill-ring." -- 1.7.8.1