From 28b889404a73093ace55868e28fa41cdb5d4a3fb Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 May 2020 10:52:03 -0700 Subject: add notmuch-slurp-debbug-at-point Signed-off-by: Sean Whitton --- debian/changelog | 7 +++++++ mailscripts.el | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 11aa2dc..6565a39 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +mailscripts (0.20-2) UNRELEASED; urgency=medium + + * mailscripts.el: + - new command: notmuch-slurp-debbug-at-point + + -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 + mailscripts (0.20-1) unstable; urgency=medium * imap-dl: Fix failure when python3-gssapi isn't installed (Closes: #955011). diff --git a/mailscripts.el b/mailscripts.el index 2280f5a..3e5b3b5 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -1,10 +1,10 @@ ;;; mailscripts.el --- functions to access tools in the mailscripts package ;; Author: Sean Whitton -;; Version: 0.20 +;; Version: 0.21 ;; Package-Requires: (notmuch projectile) -;; Copyright (C) 2018, 2019 Sean Whitton +;; Copyright (C) 2018, 2019, 2020 Sean Whitton ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ (require 'notmuch) (require 'projectile) +(require 'thingatpt) (defgroup mailscripts nil "Customisation of functions in the mailscripts package.") @@ -55,6 +56,16 @@ If NO-OPEN, don't open the thread." (unless no-open (notmuch-show (concat "Bug#" bug)))) +;;;###autoload +(defun notmuch-slurp-debbug-at-point () + "Slurp Debian bug with bug number at point and open the thread in notmuch." + (interactive) + (save-excursion + ;; the bug number might be prefixed with a # or 'Bug#'; try + ;; skipping over those to see if there's a number afterwards + (skip-chars-forward "#bBug" (+ 4 (point))) + (notmuch-slurp-debbug (number-to-string (number-at-point))))) + ;;;###autoload (defun notmuch-slurp-this-debbug () "When viewing a Debian bug in notmuch, download any missing messages." -- cgit v1.2.3 From 73f4786d9315c5e40e88f8f34fb221ba4fbe5355 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 May 2020 10:59:34 -0700 Subject: notmuch-slurp-this-debbug: if fail to extract bug number, prompt Signed-off-by: Sean Whitton --- debian/changelog | 2 ++ mailscripts.el | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6565a39..a38fe6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ mailscripts (0.20-2) UNRELEASED; urgency=medium * mailscripts.el: - new command: notmuch-slurp-debbug-at-point + - notmuch-slurp-this-debbug: if fail to extract bug number from + subject line, prompt user for one -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 diff --git a/mailscripts.el b/mailscripts.el index 3e5b3b5..36f5732 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -71,8 +71,10 @@ If NO-OPEN, don't open the thread." "When viewing a Debian bug in notmuch, download any missing messages." (interactive) (let ((subject (notmuch-show-get-subject))) - (when (string-match "Bug#\\([0-9]+\\):" subject) - (notmuch-slurp-debbug (match-string 1 subject) t)) + (notmuch-slurp-debbug + (if (string-match "Bug#\\([0-9]+\\):" subject) + (match-string 1 subject) + (read-string "Bug number: ")) t) (notmuch-refresh-this-buffer))) ;;;###autoload -- cgit v1.2.3 From ce481dee7327c6ee4809370658009ee29994adcb Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 May 2020 11:07:19 -0700 Subject: notmuch-slurp-debbug: invoke notmuch to find the thread-id Signed-off-by: Sean Whitton --- debian/changelog | 4 ++++ mailscripts.el | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index a38fe6d..7363245 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,10 @@ mailscripts (0.20-2) UNRELEASED; urgency=medium - new command: notmuch-slurp-debbug-at-point - notmuch-slurp-this-debbug: if fail to extract bug number from subject line, prompt user for one + - notmuch-slurp-debbug: invoke notmuch to determine the thread-id + rather than passing the search query directly to `notmuch-show'. + That is not how `notmuch-show' is meant to be called and can result + in strange behaviour. -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 diff --git a/mailscripts.el b/mailscripts.el index 36f5732..50e3b89 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -54,7 +54,15 @@ If NO-OPEN, don't open the thread." (interactive "sBug number: ") (call-process-shell-command (concat "notmuch-slurp-debbug " bug)) (unless no-open - (notmuch-show (concat "Bug#" bug)))) + (let* ((search (concat "Bug#" bug)) + (thread-id (car (process-lines notmuch-command + "search" + "--output=threads" + "--limit=1" + "--format=text" + "--format-version=4" search)))) + (notmuch-show thread-id nil nil nil + (concat "*notmuch-show-" search "*"))))) ;;;###autoload (defun notmuch-slurp-debbug-at-point () -- cgit v1.2.3 From e8a3fc95ee5087f2e71a251922fc9fb161e1f25b Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 May 2020 12:00:33 -0700 Subject: correct changelog version number Signed-off-by: Sean Whitton --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7363245..c9dc58f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mailscripts (0.20-2) UNRELEASED; urgency=medium +mailscripts (0.21-1) UNRELEASED; urgency=medium * mailscripts.el: - new command: notmuch-slurp-debbug-at-point -- cgit v1.2.3 From a2b41d9119b955af788464aa61242b629ba2106a Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Wed, 27 May 2020 10:32:39 -0400 Subject: d/control: add Homepage field If mailscripts ever grows a proper webpage that's not just a Vcs, we can change the Homepage: field to point to it at that time. In the meantime, point to the most visible web resource available to the project. It's redundant with the Vcs-Browser: field, but this is still useful for anyone who is searching just the Homepage: fields for information about the projects in debian. Signed-off-by: Daniel Kahn Gillmor --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 739d073..3a549a3 100644 --- a/debian/control +++ b/debian/control @@ -19,6 +19,7 @@ Build-Depends: python3-pgpy , Vcs-Git: https://git.spwhitton.name/mailscripts Vcs-Browser: https://git.spwhitton.name/mailscripts +Homepage: https://git.spwhitton.name/mailscripts Package: elpa-mailscripts Architecture: all -- cgit v1.2.3 From 0fe5b72c4c4b5a3a0772eaaba11a412e1a978398 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 27 May 2020 11:49:36 -0700 Subject: changelog Signed-off-by: Sean Whitton --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index c9dc58f..6af78cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ mailscripts (0.21-1) UNRELEASED; urgency=medium rather than passing the search query directly to `notmuch-show'. That is not how `notmuch-show' is meant to be called and can result in strange behaviour. + * Add a Homepage: to the Debian packaging metadata (Closes: #961664). + Thanks to Daniel Kahn Gillmor for the patch. -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 -- cgit v1.2.3 From c770a0427dfd725c1227cde021b0d6fa9c795300 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 1 Jun 2020 08:17:37 -0700 Subject: mbox-extract-patch: ensure a blank line before block of trailers Signed-off-by: Sean Whitton --- debian/changelog | 2 ++ mbox-extract-patch | 2 ++ 2 files changed, 4 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6af78cf..2f1d317 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ mailscripts (0.21-1) UNRELEASED; urgency=medium rather than passing the search query directly to `notmuch-show'. That is not how `notmuch-show' is meant to be called and can result in strange behaviour. + * mbox-extract-patch: When inserting trailers, ensure there is a blank + line before the block of trailers. * Add a Homepage: to the Debian packaging metadata (Closes: #961664). Thanks to Daniel Kahn Gillmor for the patch. diff --git a/mbox-extract-patch b/mbox-extract-patch index 276895b..3b80fd1 100755 --- a/mbox-extract-patch +++ b/mbox-extract-patch @@ -178,6 +178,8 @@ package Mail::Message { } } + $lines[$i - 1] =~ /^$/ or unshift @new_ts, "\n"; + splice @lines, $i, 0, @new_ts; my $body = Mail::Message::Body->new( charset => "PERL", -- cgit v1.2.3 From 9df79d8f0565f0e28d588e2da1c40bc0910b5e70 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 1 Jun 2020 10:11:21 -0700 Subject: don't try to insert a blank line if trailers are at top of message Signed-off-by: Sean Whitton --- mbox-extract-patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbox-extract-patch b/mbox-extract-patch index 3b80fd1..31e6ceb 100755 --- a/mbox-extract-patch +++ b/mbox-extract-patch @@ -178,7 +178,7 @@ package Mail::Message { } } - $lines[$i - 1] =~ /^$/ or unshift @new_ts, "\n"; + $i == 0 or $lines[$i - 1] =~ /^$/ or unshift @new_ts, "\n"; splice @lines, $i, 0, @new_ts; my $body = Mail::Message::Body->new( -- cgit v1.2.3 From 42e8b6cb2ccdbc7a91b322383c1f3b20d745e095 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 1 Jun 2020 10:12:02 -0700 Subject: release mailscripts 0.21 (-1 to Debian unstable) Signed-off-by: Sean Whitton --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2f1d317..c467894 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mailscripts (0.21-1) UNRELEASED; urgency=medium +mailscripts (0.21-1) unstable; urgency=medium * mailscripts.el: - new command: notmuch-slurp-debbug-at-point @@ -13,7 +13,7 @@ mailscripts (0.21-1) UNRELEASED; urgency=medium * Add a Homepage: to the Debian packaging metadata (Closes: #961664). Thanks to Daniel Kahn Gillmor for the patch. - -- Sean Whitton Sat, 23 May 2020 10:49:57 -0700 + -- Sean Whitton Mon, 01 Jun 2020 10:11:47 -0700 mailscripts (0.20-1) unstable; urgency=medium -- cgit v1.2.3