From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Thomas Newsgroups: gmane.emacs.help Subject: Re: Browsing Github using eww Date: Sat, 03 Aug 2024 03:22:54 +0530 Message-ID: <865xsiy4ll.fsf@gmx.net> References: <86sevvt4nq.fsf@gmx.net> <87msm2vd07.fsf@gmail.com> <86jzh6tral.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14994"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 02 23:53:38 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sa0DS-0003lN-7O for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 02 Aug 2024 23:53:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sa0Cy-000862-80; Fri, 02 Aug 2024 17:53:08 -0400 Original-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 1sa0Cw-00081Y-Hd for help-gnu-emacs@gnu.org; Fri, 02 Aug 2024 17:53:06 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sa0Cu-0005Bm-GB for help-gnu-emacs@gnu.org; Fri, 02 Aug 2024 17:53:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722635579; x=1723240379; i=jimjoe@gmx.net; bh=qtMqfM/8gyORDqOln1p03qDc7U5Fm31nRmwLZBYOX1k=; h=X-UI-Sender-Class:From:To:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=NMT+NeGZGR9gDddFizabMlCuAJvRVdyl4EXWqmd0d4LgcGE9UqIL8O7fRdGQRV7r BQfpD9iGl1rxn1bCtnK41aAjlsLug8bR62IWCCvRhpJq7pUUn0+doDsvNe5zchfHQ FMC+YN/M7TAReDDST6Nk7sXzwVMPQ522upsG7WrBx5auf+TXWgVeCq+O3cPInx8kK hcmUT4jted3bntf5r64MFtH1OvxKzHJW9+XuVArVCvq8zmx8n//ckIDNG26/vYPaw qg6XbSUfNyx4EF7xbvG3wUl8MmYqmZ4Mb9S4w4GJiPeUtnqzVnVNjpDzKKG0VTaHU 8lCGXueLvJ8VTsbSdw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from user-Inspiron-3493 ([59.92.171.143]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N2mBa-1s6Pcl1FBE-00rgPn for ; Fri, 02 Aug 2024 23:52:59 +0200 In-Reply-To: <87msluoh4y.fsf@> (=?utf-8?Q?=22Bj=C3=B6rn?= Bidar"'s message of "Fri, 02 Aug 2024 22:32:13 +0300") X-Provags-ID: V03:K1:w7AuWcwXtDi46odQjDTF/jr2tf5LKHFiefHeHDfjxBOdt66q5x7 vUB+zJeVl0QHN+kORnYjhF7YNDPI0o3x9lw9MPA/RF/L+fPdB+thGEQDZZDAe+PDsw0eNrQ HJ9cnZxc5qUXebJ6o8ftCwgbqmIDZpxOfwmc8s9iPul6bFR4l5Mo7egyEFHJSyWcT1wxPly buLNJpB+S8edz8XqXTvjg== UI-OutboundReport: notjunk:1;M01:P0:asdgsOme+/c=;vqVzZPOj7RdC7L3uHO5Z+AF4acb TA+G1hNNMy000NX/Yh2Q+CcTvCUTzyE3YB0BwcQj9g8RJaW6dj3hVWulIxTtk0TorYq86AAx0 deoK5J9J2xIvi8T4vE1N+Q6N0eJTvApRigDZoK5VINvTn1bjZX5aAZjvzZIrMaEKqFoMOvdn+ 4/pYaXeik7b33Ge1QVgkuQf179fAJlUodFvKmW88q2Sc4gvZpK+5dAW7sZmUL+ngTfkUoWdtd XzZfDp7fGhi1DqqfXtqIHB9kMbHyAvNxu4YAcOfsAww9Vk3gjBzFcfBmC6hhLf0Dsf+LV1ICS 4lTKtOcDFm98XP6a/CjS2rQrgyFxPUsRhrpv2yXOqDDo9JJgxqk+dL1Y14F4NvzblYIjnWKIP gDo645ghTXHQMH6k5bTa5ZKm5pePnTCzkRJH4Ek2oTQ69mrfCfgSnyjAq0pCBAuN8obKOH3Dr Knr/eFzD5D0wF0RHVu3OMuxYwDyWXKxnvfCIFGlIR84p3pUQ/MOoO1FZa5Du6AUC+CSihwKEl 603uGn+aKtrl8cDjr3gJpQgQx4EQ5vJ7c4eszlGt/uFqBx4TyY5Dvn9s5qp0ag/Xmu89YwgVZ VZYXmyMmJ4dBE3P5MQy06kIR+TxU5Cbq5gLRDh+TQpHGUol0dGxscrBEL48kZwtnAw0C+/lHj PG69w+NJbreSSAxjpzivZ4eVarX7H3nEpQ2pWs5lQcFaXwukN8IKQ2N1OHtRQsq39+NRfjBnW VkyVSfEbjpwqpuzf6wqmYeZ7xYTgH/9UN7j7rcYOPy88bHKGcequeqxgdN0KowXukgL6uQsT Received-SPF: pass client-ip=212.227.15.15; envelope-from=jimjoe@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147505 Archived-At: Bj=C3=B6rn Bidar wrote: > James Thomas writes: > >> tpeplt wrote: >> >>> James Thomas writes: >>> >>>> I had, by now, accumulated the following hacks: >>>> >>>> ...for this, but I've realized that the latter, for e.g. may not be >>>> necessary: refreshing the page 3-4 times gets a version with the files >>>> list shown. >>>> >>>> So I was wondering if someone out there has something better (simpler, >>>> cheaper, more reliable) to share. Or know of anyone maybe compiling any >>>> such workarounds - for others like Gitlab as well? >>>> >>> >>> 1. This is not a direct answer to your question, but you might try look= ing >>> through the Emacs Lisp packages that you can install via the >>> =E2=80=98list-packages=E2=80=99 command. >> >> I see that all of them use either the gh cli or an API token. Thank you >> for the suggestion, but my current setup seems simpler for now. > > Did you try Epkg? It uses Emacsmirror tracks packages from multiple > sources for packages including those on Github. > > It does only require SQLite support either using the builtin support or > the one provided by EmacsSQL. I see that, but I think you misunderstand me: I was talking about github.com itself not being easily accessible for browsing, even for repos not related to Emacs. Anyway I'm using my 'cleaned-up' hacks for the time being, which works well enough (for now): --8<---------------cut here---------------start------------->8--- ;; Add this to the end of eww-url-transformers. (defun eww-redirect-github (url) "Redirect github.com automatically." (replace-regexp-in-string "^https://\\(github.com/\\(.*?\\)/blob\\)/.*" "= raw.githubusercontent.com/\\2" url t nil 1)) (defun shr-tag-script (dom) (condition-case nil (when-let ((url (eww-current-url)) (_ (string-prefix-p "https://github.com/" url)) (_ (string=3D "application/json" (dom-attr dom 'type))) (_ (string=3D "react-app.embeddedData" (dom-attr dom 'data-targe= t))) (start (point))) (seq-map (lambda (i) (shr-ensure-newline) (shr-tag-a (dom-node 'a (list (cons 'href (replace-regexp-in-string "https://github.com/[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_.]+/tree/= [a-zA-Z0-9-_.]+/\\(.+\\)" (gethash "path" i) url t t 1))) (gethash "name" i)))) (gethash "items" (gethash "tree" (gethash "payload" (json-parse-string (car (dom-children dom))))))) ) (wrong-type-argument nil))) --8<---------------cut here---------------end--------------->8--- Adapting the code 'search results' page is one thing left to do... Regards, James