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 27006 invoked from network); 6 Sep 2020 18:00:03 -0000 Received: from lists1.math.uh.edu (129.7.128.208) by inbox.vuxu.org with ESMTPUTF8; 6 Sep 2020 18:00:03 -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 1kEywZ-00CKMj-Dz; Sun, 06 Sep 2020 12:59:11 -0500 Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kEywT-00CKKk-R5 for ding@lists.math.uh.edu; Sun, 06 Sep 2020 12:59:05 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kEywQ-0075oU-GA for ding@lists.math.uh.edu; Sun, 06 Sep 2020 12:59:05 -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=wzHBkfs8OmwK6BtvznokW9x/GYmDk2fZPcxa5TDzWUk=; b=GRtkG1Bm2Fg0bK7N1Vo2yUbHRZ PDMdkNmgd1pOJ3vV4ZUB7uEzOO9dPrk3kyjXDUGfLpVessvupW0/VgDx2Se+PIpbL+8nQo2Y+mpaD 29H8/jBaosRwZh9sGRAYopPhpcK5JVZ/OUjGVK1wYF3kCqK2wrbE0J8fRpLY6bGKuAsI=; 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 1kEywH-0004Kg-WE for ding@gnus.org; Sun, 06 Sep 2020 19:58:57 +0200 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kEywH-000146-Db for ding@gnus.org; Sun, 06 Sep 2020 19:58:53 +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: Sun, 06 Sep 2020 19:58:46 +0200 Organization: koldfront - analysis & revolution, Copenhagen, Denmark Message-ID: <87d02yss6h.fsf@tullinup.koldfront.dk> References: <87k0xi79qt.fsf@tullinup.koldfront.dk> <87wo1hffz0.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:J240xW3YPMv6Qdp0+jbKjt6FnAY= 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: > I don't have any experience doing this so I'm also shooting in the dark > but... Appreciated! > It looks like the dynamic variable `gnus-treat-type' is bound while > `gnus-part-display-hook' is being run, so you should be able to examine > that to see if you're currently displaying "text/html" or what have you > (it could also be nil) and only run your function once. Cool - I will check that out. Ok, so now I can run it once, and I also figured out how to add a header. Thanks for the push! > Another approach would be to add your function to > `gnus-treatment-function-alist'. Yeah, making a "real" treatment would probably be the correctest (I've heard that's a word) way to go. >> Also, the request actually returns a list of the various emojis, which >> ideally would be iterated over, and added to the header instead of the >> hardcoded thumbs up. >> >> Oh, and the ghub-request errors out with a 404 when there are no emojis >> (funky API design), which really ought to insert an empty GitLab-Emoji: >> fake header instead of just being ignored. > > These two issues shouldn't be hard, right? What is the actual elisp > return value of `ghub-request'? It's just a list of lists of conses, so if only I could remember which is which of car and cadr, it would indeed be easy. This is what I have currently: (defun adsj-article-treat-gitlab () "Show thumbsup on GitLab comments" (when (and gnus-treat-type (string= gnus-treat-type "text/html")) ;;; (gnus-with-article-buffer (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 project-id (string-match " Is it more complicated than that for some reason? No, I just don't know (e)lisp, neither the vocabulary of functions nor the idioms :-) > (I'd also be curious to see where you gave up with the actual Gitlab > API -- do you have a relevant link you can share?) What made me give up was that I found a comment about the value of last_activity_[something] not being updated. I can't find it again currently. Best regards, Adam -- Interviewer: "So you don't fear Linux?" Adam Sjøgren Bill: "Oh - I - you know - my job is to fear asjo@koldfront.dk everything."