From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mekeor Melire Newsgroups: gmane.emacs.bugs Subject: bug#67615: [PATCH v4] * lisp/info.el (Info-url-alist): New option mapping manuals to URLs. Date: Tue, 19 Dec 2023 23:08:29 +0000 Message-ID: <878r5pzsxy.fsf@posteo.de> References: <87plzmsuge.fsf@posteo.de> <87leaast8s.fsf@posteo.de> <87sf4ii8oi.fsf@posteo.de> <87o7f6hsfj.fsf@posteo.de> <87y1e5tumu.fsf@posteo.de> <83fs0byanf.fsf@gnu.org> <87y1e3ei0t.fsf@posteo.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8996"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii To: 67615@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 20 00:16:31 2023 Return-path: Envelope-to: geb-bug-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 1rFjKA-00027J-R5 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Dec 2023 00:16:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rFjJj-000727-Bt; Tue, 19 Dec 2023 18:16:03 -0500 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 1rFjJf-00071v-UI for bug-gnu-emacs@gnu.org; Tue, 19 Dec 2023 18:15:59 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rFjJf-0005IL-L6 for bug-gnu-emacs@gnu.org; Tue, 19 Dec 2023 18:15:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rFjJi-0006H7-AP for bug-gnu-emacs@gnu.org; Tue, 19 Dec 2023 18:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mekeor Melire Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Dec 2023 23:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67615 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67615-submit@debbugs.gnu.org id=B67615.170302772319233 (code B ref 67615); Tue, 19 Dec 2023 23:16:02 +0000 Original-Received: (at 67615) by debbugs.gnu.org; 19 Dec 2023 23:15:23 +0000 Original-Received: from localhost ([127.0.0.1]:37929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFjJ4-0004yh-Ap for submit@debbugs.gnu.org; Tue, 19 Dec 2023 18:15:23 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:43257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rFjJ1-0004bA-Is for 67615@debbugs.gnu.org; Tue, 19 Dec 2023 18:15:20 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 49210240103 for <67615@debbugs.gnu.org>; Wed, 20 Dec 2023 00:15:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1703027710; bh=SRSVtdUBU26SELV6jb6EMfzmQhwgSpvENAI9KN+uGnU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=BZPogdM8pQevhj83IVSkHr0XjUNnLZr1dkuG7V8tOvglzp+gZxyleSIu8HwbT50UN EMK1sbHbd6F2Gkst/GJDCTmLBcareQxhWqbmXtRQPUXVeM7NPDHymmSSE+zxlfoPlf EKwn0prUozFZTuvtYxXlx42IjvoAINKl4fQx7kFJxOHC4P9Ex+bhbu7fcS9xO59FBj TYx/GvCLPoqFu9SIZBo6u6xVURMsWZRhBetkJPmTc03ppJAB2MQLCMuZN1oi2uSkqS cg+2QslG3R/bslAlxNhoi2zH6RrfCNurCcx6rZ+bHBMktO8a6Zj+4UbagPxfDONo/G xdAak+gFzESuw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Svsws3604z6tsB; Wed, 20 Dec 2023 00:15:09 +0100 (CET) In-reply-to: <87y1e3ei0t.fsf@posteo.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276544 Archived-At: --=-=-= Content-Type: text/plain Hello again :) Firstly, I'm happy to announce that my FSF-copyright-assignment is done. Secondly, I'd like to re-share the same version of the patch from my last e-mail. Perhaps it was forgotten, perhaps because I did not choose a new subject line. (I did so for this e-mail.) So here it is again. I'd appreciate a review or even a commit/merge if it's done. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-info.el-Info-url-alist-New-option-mapping-manua.patch >From a30f11d1112a08a32f3da7adce37d8e09b390041 Mon Sep 17 00:00:00 2001 From: Mekeor Melire Date: Mon, 4 Dec 2023 16:37:37 +0100 Subject: [PATCH] * lisp/info.el (Info-url-alist): New option mapping manuals to URLs. --- etc/NEWS | 9 +++++ lisp/info.el | 102 ++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 90 insertions(+), 21 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 29f4e5c0b66..cd1d3b1c060 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -356,6 +356,15 @@ respectively, in addition to the existing translations 'C-x 8 / e' and * Changes in Specialized Modes and Packages in Emacs 30.1 +** Info + +--- +*** New user option 'Info-url-alist'. +This user option associates manual-names with URLs. It affects the +'Info-goto-node-web' command. By default, associations for all +Emacs-included manuals are set. Further associations can be added for +arbitrary Info manuals. + +++ ** New command 'lldb'. Run the LLDB debugger, analogous to the 'gud-gdb' command. Note that diff --git a/lisp/info.el b/lisp/info.el index 51e9eb72edf..4ee62c1e729 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -213,6 +213,53 @@ Info-additional-directory-list These directories are searched after those in `Info-directory-list'." :type '(repeat directory)) +(defcustom Info-url-alist + '((("auth" "autotype" "bovine" "calc" "ccmode" "cl" "dbus" "dired-x" + "ebrowse" "ede" "ediff" "edt" "efaq" "efaq-w32" "eglot" "eieio" + "eintr" "elisp" "emacs" "emacs-gnutls" "emacs-mime" "epa" "erc" + "ert" "eshell" "eudc" "eww" "flymake" "forms" "gnus" + "htmlfontify" "idlwave" "ido" "info" "mairix-el" "message" + "mh-e" "modus-themes" "newsticker" "nxml-mode" "octave-mode" + "org" "pcl-cvs" "pgg" "rcirc" "reftex" "remember" "sasl" "sc" + "semantic" "ses" "sieve" "smtpmail" "speedbar" "srecode" + "todo-mode" "tramp" "transient" "url" "use-package" "vhdl-mode" + "vip" "viper" "vtable" "widget" "wisent" "woman") . + "https://www.gnu.org/software/emacs/manual/html_node/%m/%e")) + "Alist telling `Info-mode' where manuals are accessible online. + +Each element of this list should have the form (MANUALs +. URL-SPEC). MANUALS represents the name of one or more manuals. +It can either be a string or a list of strings. URL-SPEC can be +a string in which the substring \"%m\" will be expanded to the +manual-name, \"%n\" to the node-name, and \"%e\" to the +URL-encoded node-name with a `.html' suffix. (The URL-encoding +of the node-name mimics GNU Texinfo, as documented at Info +node `(texinfo)HTML Xref Node Name Expansion'.) Alternatively, +URL-SPEC can be a function which is given manual-name, node-name +and URL-encoded node-name as arguments, and is expected to return +the corresponding URL as a string. + +This variable particularly affects the command +`Info-goto-node-web', which see. + +The default value of this variable refers to the official, +HTTPS-accessible HTML-representations of all manuals that Emacs +includes. These URLs refer to the most recently released version +of Emacs, disregarding the version of the running Emacs. In +other words, the content of your local Info node and the +associated online node may differ. The resource represented by +the generated URL may even be not found by the gnu.org server." + :version "30.1" + :type '(alist + :tag "Mapping from manual-name(s) to URL-specification" + :key-type (choice + (string :tag "A single manual-name") + (repeat :tag "List of manual-names" string)) + :value-type (choice + (string :tag "URL-specification string") + (function + :tag "URL-specification function")))) + (defcustom Info-scroll-prefer-subnodes nil "If non-nil, \\\\[Info-scroll-up] in a menu visits subnodes. @@ -1807,33 +1854,46 @@ Info-goto-node-web (Info-url-for-node (format "(%s)%s" filename node))))) (defun Info-url-for-node (node) - "Return a URL for NODE, a node in the GNU Emacs or Elisp manual. -NODE should be a string on the form \"(manual)Node\". Only emacs -and elisp manuals are supported." + "Return the URL corresponding to NODE. + +NODE should be a string of the form \"(manual)Node\"." (unless (string-match "\\`(\\(.+\\))\\(.+\\)\\'" node) - (error "Invalid node name %s" node)) - (let ((manual (match-string 1 node)) - (node (match-string 2 node))) - (unless (member manual '("emacs" "elisp")) - (error "Only emacs/elisp manuals are supported")) - ;; Encode a bunch of characters the way that makeinfo does. - (setq node - (mapconcat (lambda (ch) - (if (or (< ch 32) ; ^@^A-^Z^[^\^]^^^- + (error "Invalid node-name %s" node)) + ;; Use `if-let*' instead of `let*' so we check if an association was + ;; found. + (if-let* ((manual (match-string 1 node)) + (node (match-string 2 node)) + (association (seq-find + (lambda (pair) + (seq-contains (ensure-list (car pair)) + manual #'string-equal-ignore-case)) + Info-url-alist)) + (url-spec (cdr association)) + (encoded-node + ;; Reproduce GNU Texinfo's way of URL-encoding. + ;; (info "(texinfo) HTML Xref Node Name Expansion") + (if (equal node "Top") + "" + (url-hexify-string + (string-replace " " "-" + (mapconcat + (lambda (ch) + (if (or (< ch 32) ; ^@^A-^Z^[^\^]^^^- (<= 33 ch 47) ; !"#$%&'()*+,-./ (<= 58 ch 64) ; :;<=>?@ (<= 91 ch 96) ; [\]_` (<= 123 ch 127)) ; {|}~ DEL (format "_00%x" ch) - (char-to-string ch))) - node - "")) - (concat "https://www.gnu.org/software/emacs/manual/html_node/" - manual "/" - (and (not (equal node "Top")) - (concat - (url-hexify-string (string-replace " " "-" node)) - ".html"))))) + (char-to-string ch))) + node "")))))) + (cond + ((stringp url-spec) + (format-spec url-spec + `((?m . ,manual) (?n . ,node) (?e . ,encoded-node)))) + ((functionp url-spec) + (funcall url-spec manual node encoded-node)) + (t (error "URL-specification neither string nor function"))) + (error "No URL-specification associated with manual-name `%s'"))) (defvar Info-read-node-completion-table) -- 2.41.0 --=-=-=--