From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15483 invoked from network); 7 Sep 2020 17:29:05 -0000 Received: from lists1.math.uh.edu (129.7.128.208) by inbox.vuxu.org with ESMTPUTF8; 7 Sep 2020 17:29:05 -0000 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.94) (envelope-from ) id 1kFKwR-00CXAP-0B; Mon, 07 Sep 2020 12:28:31 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kFKwM-00CX8Y-Gd for ding@lists.math.uh.edu; Mon, 07 Sep 2020 12:28:26 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kFKwK-007PBj-PH for ding@lists.math.uh.edu; Mon, 07 Sep 2020 12:28:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References :Message-ID:Date:Subject:From:To:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ClxuRiruoCmHsQFYvB+PzvU6jlgST7/1ngWEUVKeNFw=; b=LYXcBPTGVa9ZMPhtaedP5Aesoc pXPE64msGdqyyuJQg4cVeLvTJvD8788ytFVwOOP/052zimq7nB4AnlUoL0vI+m6NGSWBaj/51SHeS M+okFxW24DqBDTiS9xa45qHU74F2BmB5XicTYUBN55VMWw4Ce7jwMHVQlEY5HnHVPoYw=; Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214] helo=ciao.gmane.io) by quimby with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFKwD-0001kZ-R2 for ding@gnus.org; Mon, 07 Sep 2020 19:28:20 +0200 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kFKwD-0009RY-DE for ding@gnus.org; Mon, 07 Sep 2020 19:28:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: =?utf-8?Q?Adam_Sj=C3=B8gren?= Subject: Re: GitLab integration take two, light edition Date: Mon, 07 Sep 2020 19:28:11 +0200 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87sgbtzec4.fsf@tullinup.koldfront.dk> References: <87k0xi79qt.fsf@tullinup.koldfront.dk> <87wo1hffz0.fsf@ericabrahamsen.net> <87d02yss6h.fsf@tullinup.koldfront.dk> <87tuwashjf.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cancel-Lock: sha1:CY0RXyDRdRXiRwzGNy5HvG/CWC8= OpenPGP: id=476630590A231909B0A0961A49D0746121BDE416; url=https://asjo.koldfront.dk/gpg.asc Mail-Follow-Up-To: never X-Face: )qY&CseJ?.:=8F#^~GcSA?F=9eu'{KAFfL1C3/A&:nE?PW\i65"ba0NS)97,Q(^@xk}n4Ou rPuR#V8I(J_@~H($[ym:`K_+]*kjvW>xH5jbgLBVFGXY:(#4P>zVBklLbdL&XxL\M)%T}3S/IS9lMJ ^St'=VZBR Precedence: bulk Eric writes: > `mapconcat' is what you're looking for there, something like: Yes, exactly what I needed - thanks! This is what I have ended up with, so far, also showing Milestone, Labels and State: (defun asjo-article-treat-gitlab () "Show thumbsup on GitLab comments" (when (and gnus-treat-type (string= gnus-treat-type "text/html")) (let ((project-id (gnus-fetch-field "X-GitLab-Project-Id")) (issue-iid (gnus-fetch-field "X-GitLab-Issue-IID")) (message-id (gnus-fetch-field "Message-ID"))) (when (and project-id issue-iid message-id) (let ((issue (ghub-request "GET" (format "/projects/%s/issues/%s" project-id issue-iid) nil :auth 'nngitlab :host "gitlab.example.org/api/v4" :username "asjo" :forge 'gitlab))) (let ((milestone (cdr (or (assoc "milestone" issue) '("default" . nil)))) (state (cdr (or (assoc-string "state" issue) '("default" . "unknown")))) (labels (cdr (or (assoc-string "labels" issue) '("default" . nil))))) (widen) (message-goto-eoh) (when milestone (insert "GitLab-Milestone: " (cdr (or (assoc-string "title" milestone) '("default" . "unknown"))) "\n")) (when labels (insert "GitLab-Labels: " (mapconcat 'identity labels ", ") "\n")) (insert "GitLab-State: " state "\n") (string-match "> No, I just don't know (e)lisp, neither the vocabulary of functions nor >> the idioms :-) > > Could have fooled me, you do pretty well with bug-hunting on this list! That's just experience, which is much easier than knowledge. > mapconcat takes a third argument, the string to insert between all the > elements. ... and that was just what I needed! Thanks! Adam -- "the interview is very good, this man is smart and Adam Sjรธgren does not ask us idiot questions." asjo@koldfront.dk