From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id CDuzCWV6CGXbVwAAG6o9tA:P1 (envelope-from ) for ; Mon, 18 Sep 2023 18:27:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CDuzCWV6CGXbVwAAG6o9tA (envelope-from ) for ; Mon, 18 Sep 2023 18:27:17 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C91C358DFA for ; Mon, 18 Sep 2023 18:27:16 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YfIDrDHj; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695054437; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=U3x7j9me2sTxl6Z2WTWdqSfyIcXEZftlZq6LajxLqHU=; b=hbHN0uZkuVwfr4vpoXJsZcRvx63PWJTpcyKS0hjnA5Y0kZix6qMRiC2OduEpubfD+Nmyb0 d7HQWN39QBvrnIE7Y6tptY5FFA4twJEqL2lSeLoBBP1EfN519PpWzKUuAWYWxVw98LP1O9 ne36rH16GEcU/NeY4bo5+giylZ1wNzkyKPLpmV9hL7C0odbsRk/YWTDwB4WdsJWiKrYfv4 OWnjgg/ts/DDa9e9zEoxvEJZkXywlcMUIfdDzXoGgKrg569cwNKIYwF0lsyUYGOsn3chRP d+n7DBiie3Pw8M8nfrfjiImEE/aJigcEzFgyognhPhuvsXZtFPDL6IZjYEHVVQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YfIDrDHj; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695054437; a=rsa-sha256; cv=none; b=M9W3r3oo7ASc5E/hEfSMuZvD2Qdv1uehQIRTzZbNjjgglFhWq/jiPwkDM8VjN9i/Gwqyqe L68/wNleQ9PgC2y4hJeiQV0qdnlXbUVcBiP9k0Uhfbsa2d0LiTCLxbpBvOp/2Qz/sxPbUf J30P6EGT+HDCgkJakVRECZVqo1zBw/aoCLz3vZ9KS9dW0n44ls/V2oZdj5o6KfoDqVw/Lg i5xaQwBclSLHR7L93PKN23yZaaJnr7N7HNr+6VKn6w0Z+Ja3f1W9lqXsA7vJ622xMG268f aKXBSjVHVqhYaKt7RAsD3/kYClPbsEXoGUiJv2g5KVMXa8qfL2jbUWCUHUgWFg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiH4W-0005Hk-Rs; Mon, 18 Sep 2023 12:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiH4M-0005Ej-Dr for guix-devel@gnu.org; Mon, 18 Sep 2023 12:25:56 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiH4G-0000I4-9n for guix-devel@gnu.org; Mon, 18 Sep 2023 12:25:50 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40472fef044so9431985e9.0 for ; Mon, 18 Sep 2023 09:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695054346; x=1695659146; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=U3x7j9me2sTxl6Z2WTWdqSfyIcXEZftlZq6LajxLqHU=; b=YfIDrDHjvOyTMdV/ejlI+rClPTyTlF+o7qKgy4z33fvWbHijBj65KDvUH2cHgOXnqC Op8f8V+bqR7xcEoKnX/khb7gDmdDfjfk+Yh/IqqUM3S7zVeY7wPGpxMljPqwps6bTNHt /RET5NKtKiMlURVbvXJmiV/4VmE3kS1vQCGDBR5LBsz0hDtVC9Q8xrxIQegL27sxIXzx zphea7zz8hWQQPwKJJWgzcoq4L052z+bxZMMPmIporOsVI4RLp2Wj3ahRPYOcnA7gKys q4evHcABRjrFL8cwX6oQ417LOK8AElnu7Njmonm9HrnXW7Zojgjp1MLqYc5cVO+7guod XtrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695054346; x=1695659146; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=U3x7j9me2sTxl6Z2WTWdqSfyIcXEZftlZq6LajxLqHU=; b=lsE9uDMWDruKAHbOhZdGW9cvtZola53s0eX1gUzm5oBHH34o0sjmtj2vnVzUimE3vI cFp/Tsvqk4uDCfyRiDvhsoXcYb71J96tNMQxCAsy3eSkTM00HEJET8mKNpZacoKQj6UW QMp4pnFwVCGp7sGcbGzXqVRuH8S7LC8KfItFrg1MpCvKGFAckGu0vVN6SUWC0IfiA1aS shirg3Bp3YQ8Uc18hHXDnpKk+CgY5vEoa4CLMi9lXiSk8FngIMMPxy4+AivO52fLBFdD pYzVF8gpFFRq6ubaMh1oyaGQ0NyeaQd+s36vsf5Sw0ShBLZoRx5d3VZLA/N8+nC/pEgf T34g== X-Gm-Message-State: AOJu0YzhFXnczvn8igFPXXC8jz0afW90lMizXasImqJfyo7NDA2/SOmZ QyBMzTLkL7RLo6UBRTxExYaHtKBWXZc= X-Google-Smtp-Source: AGHT+IEhUkaKcIKAGtQ0JjybECHpFqTc3SCMoIa4qmUSdLxueIoGKYoz527CdR03TJon5RLtiiDF6A== X-Received: by 2002:a05:600c:3ba3:b0:401:c392:d28d with SMTP id n35-20020a05600c3ba300b00401c392d28dmr8290895wms.2.1695054346354; Mon, 18 Sep 2023 09:25:46 -0700 (PDT) Received: from pfiuh07 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id m7-20020a05600c280700b003fed630f560sm12792914wmb.36.2023.09.18.09.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 09:25:46 -0700 (PDT) From: Simon Tournier To: Maxim Cournoyer , guix-devel Subject: Notmuch, Debbugs: my helpers (was Re: New section to easily reference Debbugs URLs within Emacs Debbugs) In-Reply-To: <87bke07ccl.fsf@gmail.com> References: <87bke07ccl.fsf@gmail.com> Date: Mon, 18 Sep 2023 18:07:53 +0200 Message-ID: <87sf7bqxba.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -2.61 X-Spam-Score: -2.61 X-Migadu-Queue-Id: C91C358DFA X-TUID: 3UNqtFx36Zfu Hi, On Sun, 17 Sep 2023 at 16:51, Maxim Cournoyer w= rote: > If you use Emacs and Emacs-Debbugs, you may be interested in applying > the settings newly documented in the 'Viewing Bugs within Emacs' section > of the manual; see it at the bottom of info "(guix) The Perfect Setup"). Oh, cool! On Saturday, I discovered =E2=80=99honey-apple=E2=80=99 on IRC and today I = was planning to improve my setup. Perfect timing! :-) BTW, let me share some of my helpers. They are quite simple but it helps me. Maybe it could be useful to others. Well, I read my emails using Emacs-Notmuch but I guess this should be adaptable for Gnus or mu4e. Since I often lag behind, I often have patches in my inbox where I have been CC. I try to keep focused on by an easy triage, so I quickly want to know if this patch is still open or if it is already marked as done. Before opening, or while reading, I just press =E2=80=99C=E2=80=99 and it q= ueries Debbugs (SOAP) and displays the current status. Similarly, sometimes old but still open bug pops up. It is a reply or just a ping and because it is old, I do not necessary have the context. I just press =E2=80=99b=E2=80=99 and it opens Emacs-Debbugs for the issue a= t hand. If there is many messages (that I do not have locally) and say it will need some time to read them, and say I am often reading offline, well I just press =E2=80=99I=E2=80=99 and it downloads all the thread and injects it in= my Guix email folder (and also indexed by notmuch :-)). Last, when reading from Debbugs, I press =E2=80=99R=E2=80=99 for replying. = I like to have https://issues.guix.gnu.org/issue/NNNNN at hand so pressing =E2=80=99R= =E2=80=99 stashes this URL specific to the issue and ready to be pasted. Below the config. :-) --8<---------------cut here---------------start------------->8--- (defun my/notmuch-show-get-debbugs () "Extract Debbugs number. >From an email message, it exracts the number NNNN as in NNNN@debbugs.gnu.org from the fields From/To/CC and it returns a list of integers. If in `notmuch-search-mode', then the returns is nil, so let try to extract from the email subject assuming the pattern bug#NNNN." (let* ((all-mails (seq-reduce (lambda (r f) (let ((s (funcall f))) (if s (append r (split-string s "," t)) r))) (list 'notmuch-show-get-from 'notmuch-show-get-to 'notmuch-show-get-cc) nil)) (debbugs (seq-filter (lambda (x) (string-match-p (regexp-quote "@debbugs.gn= u.org") x)) all-mails)) (numbers (remq nil (mapcar (lambda (x) (let ((n (when (string-match "\\([0-9]+\\)@deb= bugs.gnu.org" x) (match-string 1 x))) (d (when (string-match "\\([0-9]+\\)-don= e@debbugs.gnu.org" x) (match-string 1 x))) (c (when (string-match "\\([0-9]+\\)-clo= se@debbugs.gnu.org" x) (match-string 1 x))) ) (or n d c))) debbugs)))) (or (mapcar 'string-to-number numbers) ;; Let extract from the subject (let* ((subject (notmuch-search-find-subject)) (n (when (and subject (string-match ".*bug#\\([0-9]+\\).*" subject)) (match-string 1 subject)))) (when n (list (string-to-number n)))))))) (defun my/notmuch-debbugs-check () "Send request to Debbugs instance about pending status and report." (interactive) (let* ((number (car (my/notmuch-show-get-debbugs))) (meta (if number (car (debbugs-get-status number)) (user-error "Notmuch: no @debbugs.gnu.org"))) (status (debbugs-get-attribute meta 'pending)) (listify #'(lambda (bug attr) (let ((some (debbugs-get-attribute bug attr))) (if (listp some) some (list some))))) (infos (or (sort (append (funcall listify meta 'tags) (funcall listify meta 'severity)) 'string<) ""))) (message "Status bug#%d: %s %s" number status infos))) (define-key notmuch-tree-mode-map (kbd "C") 'my/notmuch-debbugs-check) (define-key notmuch-search-mode-map (kbd "C") 'my/notmuch-debbugs-check) (define-key notmuch-show-mode-map (kbd "C") #'(lambda () ;; XXXX: For some reason, without wrapping with ;; (lambda () (interactive) ...) ;; it returns: Wrong type argument: commandp (interactive) (my/notmuch-debbugs-check)) (defun my/notmuch-debbugs-open () "Open the current message with Debbugs mode." (interactive) (let ((numbers (my/notmuch-show-get-debbugs))) (if numbers (apply 'debbugs-gnu-bugs numbers) (user-error "Notmuch: no @debbugs.gnu.org")))) (define-key notmuch-tree-mode-map (kbd "b") ;rebind `notmuch-show-resend-= message' 'my/notmuch-debbugs-open) (define-key notmuch-search-mode-map (kbd "b") ;rebind `notmuch-show-resen= d-message' 'my/notmuch-debbugs-open) (define-key notmuch-show-mode-map (kbd "b") ;rebind `notmuch-show-resend-= message' 'my/notmuch-debbugs-open) (define-key gnus-summary-mode-map "I" ;rebind `gnus-summary-increase-scor= e' #'(lambda () "Import thread to Notmuch." (interactive) ;; XXXX: Is `debbugs-get-status' using caching? (let* ((meta (car (debbugs-get-status debbugs-gnu-bug-number))) (inbox (car (debbugs-get-attribute meta 'package))) ;match w= ith `piem-inboxes' (raw (debbugs-get-attribute meta 'msgid)) (msgid (replace-regexp-in-string "<\\|>" "" raw))) (piem-inject-thread-into-maildir msgid inbox) (notmuch-command-to-string "new" "--no-hooks") (notmuch-tag (concat "id:" msgid) (list "+Later")) (message "Imported %s from %s using %s." debbugs-gnu-bug-number i= nbox msgid)))) (define-key gnus-article-mode-map "R" #'(lambda () "Start composing a reply mail to the current message. The original article will be yanked, see `gnus-summary-wide-reply-with-orig= inal'." (interactive) (let* ((all-mails (seq-reduce (lambda (r f) (let ((s (funcall 'message-fetch-field f))) (if s (append r (split-string s "," t)) r))) (list "from" "to" "cc") nil)) (debbugs (seq-filter (lambda (x) (string-match-p (regexp-quote "@debbug= s.gnu.org") x)) all-mails)) (numbers (remq nil (mapcar (lambda (x) (let ((n (when (string-match "\\([0-9]+\\)= @debbugs.gnu.org" x) (match-string 1 x))) (d (when (string-match "\\([0-9]+\\)= -done@debbugs.gnu.org" x) (match-string 1 x)))) (if n n d))) debbugs))) (number (if numbers (progn (unless (=3D 1 (length numbers)) (user-error "Bang! Not a Debbugs message")) (when (> 1 (length numbers)) (message "Consider only %s" (car numbers))) (car numbers)) "")) (url (concat "https://issues.guix.gnu.org/issue/" number))) (kill-new url) (gnus-summary-wide-reply-with-original nil) (message "Stashed: %s" url)))) --8<---------------cut here---------------end--------------->8--- Cheers, simon