summaryrefslogtreecommitdiff
path: root/mailscripts.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-05 16:42:01 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-05 16:42:01 -0700
commita527e341c147cc6b952ba35f08ce4e116dc200af (patch)
tree9be6e21fc8b304c9aca0560a32aab35ab3fef5bf /mailscripts.el
parent5e5d198de86e71687677b9312c0ae6fc238b0fbd (diff)
parent7b3d79afdaca217183b9715cfb40979a16cafd89 (diff)
downloadmailscripts-a527e341c147cc6b952ba35f08ce4e116dc200af.tar.gz
Merge tag 'debian/0.23-1' into buster-bpo
mailscripts release 0.23-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear] # gpg: Signature made Thu 28 Jan 2021 04:37:17 PM MST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
Diffstat (limited to 'mailscripts.el')
-rw-r--r--mailscripts.el67
1 files changed, 52 insertions, 15 deletions
diff --git a/mailscripts.el b/mailscripts.el
index 50e3b89..8dc5875 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -1,8 +1,8 @@
;;; mailscripts.el --- functions to access tools in the mailscripts package
;; Author: Sean Whitton <spwhitton@spwhitton.name>
-;; Version: 0.21
-;; Package-Requires: (notmuch projectile)
+;; Version: 0.23
+;; Package-Requires: (notmuch)
;; Copyright (C) 2018, 2019, 2020 Sean Whitton
@@ -21,8 +21,8 @@
;;; Code:
+(require 'cl-lib)
(require 'notmuch)
-(require 'projectile)
(require 'thingatpt)
(defgroup mailscripts nil
@@ -46,6 +46,23 @@ Note that this does not prevent the creation of new branches."
:type 'boolean
:group 'mailscripts)
+(defcustom mailscripts-project-library 'projectile
+ "Which project management library to use to choose from known projects.
+
+Some mailscripts functions allow selecting the repository to
+which patches will be applied from the list of projects already
+known to Emacs. There is more than one popular library for
+maintaining a list of known projects, however, so this variable
+must be set to the one you use.
+
+Once there is a more fully-featured version of project.el
+included in the latest stable release of GNU Emacs, the default
+value of this variable may change, so if you wish to continue
+using Projectile, you should explicitly customize this."
+ :type '(choice (const :tag "project.el" project)
+ (const :tag "Projectile" projectile))
+ :group 'mailscripts)
+
;;;###autoload
(defun notmuch-slurp-debbug (bug &optional no-open)
"Slurp Debian bug with bug number BUG and open the thread in notmuch.
@@ -123,10 +140,16 @@ threads to the notmuch-extract-patch(1) command."
"*notmuch-apply-thread-series*")))
;;;###autoload
-(defun notmuch-extract-thread-patches-projectile ()
- "Like `notmuch-extract-thread-patches', but use projectile to choose the repo."
+(define-obsolete-function-alias
+ 'notmuch-extract-thread-patches-projectile
+ 'notmuch-extract-thread-patches-to-project
+ "mailscripts 0.22")
+
+;;;###autoload
+(defun notmuch-extract-thread-patches-to-project ()
+ "Like `notmuch-extract-thread-patches', but choose repo from known projects."
(interactive)
- (mailscripts--projectile-repo-and-branch
+ (mailscripts--project-repo-and-branch
'notmuch-extract-thread-patches
(when current-prefix-arg
(prefix-numeric-value current-prefix-arg))))
@@ -157,10 +180,16 @@ git-format-patch(1)."
mm-handle))))
;;;###autoload
-(defun notmuch-extract-message-patches-projectile ()
- "Like `notmuch-extract-message-patches', but use projectile to choose the repo."
+(define-obsolete-function-alias
+ 'notmuch-extract-message-patches-projectile
+ 'notmuch-extract-message-patches-to-project
+ "mailscripts 0.22")
+
+;;;###autoload
+(defun notmuch-extract-message-patches-to-project ()
+ "Like `notmuch-extract-message-patches', but choose repo from known projects."
(interactive)
- (mailscripts--projectile-repo-and-branch 'notmuch-extract-message-patches))
+ (mailscripts--project-repo-and-branch 'notmuch-extract-message-patches))
(defun mailscripts--check-out-branch (branch)
(if (string= branch "")
@@ -173,12 +202,20 @@ git-format-patch(1)."
(concat mailscripts-extract-patches-branch-prefix branch)
branch))))))
-(defun mailscripts--projectile-repo-and-branch (f &rest args)
- (let ((repo (projectile-completing-read
- "Select projectile project: " projectile-known-projects))
- (branch (completing-read
- "Branch name (or leave blank to apply to current HEAD): "
- nil)))
+(defun mailscripts--project-repo-and-branch (f &rest args)
+ (let ((repo (cl-case mailscripts-project-library
+ ('project
+ (require 'project)
+ (project-prompt-project-dir))
+ ('projectile
+ (require 'projectile)
+ (projectile-completing-read
+ "Select Projectile project: " projectile-known-projects))
+ (nil
+ (user-error
+ "Please customize variable `mailscripts-project-library'."))))
+ (branch (read-from-minibuffer
+ "Branch name (or leave blank to apply to current HEAD): ")))
(apply f repo branch args)))
(provide 'mailscripts)