unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: 60190@debbugs.gnu.org
Subject: bug#60190: 29.0.50; Improve `Info-goto-node-web'
Date: Mon, 19 Dec 2022 04:02:47 -0300	[thread overview]
Message-ID: <CADs++6gKrrgC74b=pM2Wfv_EKN0DJ6Nih-KtmPmaOA5nToWLtg@mail.gmail.com> (raw)
In-Reply-To: <87a63jdi8r.fsf@mbork.pl>

On Mon, 19 Dec 2022 at 03:24, Marcin Borkowski <mbork@mbork.pl> wrote:
>
> Hi all,
>
> I am extremely happy because of `Info-goto-node-web', but it would be
> even better if two changes were made.
>
> 1. It could work in "An Introduction to Programming in Emacs Lisp" and
> Org mode manual, too.
>
> 2. It could put the URL on the kill ring when called with a prefix
> argument.
>
> I would code these myself, but I changed jobs since I signed the FSF
> paperwork long time ago, and I don't want to contribute to Emacs since
> then because it could be a legal gray area then.  I think these two
> changes are pretty low hanging fruit anyway.
>
> Thanks!
>
> PS. Please CC me on any replies to this request - I'm no longer
> subscribed to the bug-gnu-emacs list.


Hi Marcin and all,
what about this?

  (defvar Info-url-base
    '(("emacs"  . "http://www.gnu.org/software/emacs/manual/html_node/emacs/")
      ("elisp"  . "http://www.gnu.org/software/emacs/manual/html_node/elisp/")
      ("eintr"  .
"http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/")
      ("efaq"   . "https://www.gnu.org/software/emacs/manual/html_node/efaq/")
      ("cl"     . "http://www.gnu.org/software/emacs/manual/html_node/cl/")
      ("eshell" . "https://www.gnu.org/software/emacs/manual/html_node/eshell/")
      ("org"    . "http://www.gnu.org/software/emacs/manual/html_node/org/")))

  (defun Info-get-base-url (manual)
    (alist-get manual Info-url-base nil nil 'equal))

  (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."
    (unless (string-match "\\`(\\(.+\\))\\(.+\\)\\'" node)
      (error "Invalid node name %s" node))
    (let* ((manual (match-string 1 node))
           (node (match-string 2 node))
           (base-url (Info-get-base-url manual))) ; <- new
      ;; Old:
      ;; (unless (member manual '("emacs" "elisp"))
      ;;   (error "Only emacs/elisp manuals are supported"))
      ;; New:
      (if (not base-url)
          (error "Unsupported manual"))
      ;;
      ;; Encode a bunch of characters the way that makeinfo does.
      (setq node
            (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 base-url                    ; new
              (url-hexify-string (string-replace " " "-" node))
              ".html")))

Now the fruit hangs a little bit lower...
Cheers =),
  Eduardo Ochs
  http://angg.twu.net/eepitch.html





  reply	other threads:[~2022-12-19  7:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19  6:23 bug#60190: 29.0.50; Improve `Info-goto-node-web' Marcin Borkowski
2022-12-19  7:02 ` Eduardo Ochs [this message]
2022-12-19 12:31   ` Eli Zaretskii
2022-12-19 15:05     ` Eduardo Ochs
2022-12-19 15:27       ` Eli Zaretskii
2022-12-20  4:44         ` Stefan Kangas
2022-12-20 14:02           ` Eli Zaretskii
2022-12-20 15:20             ` Eduardo Ochs
2022-12-20 15:33               ` Eli Zaretskii
2022-12-21  1:05             ` Stefan Kangas
2022-12-21 12:04               ` Eli Zaretskii
2022-12-19 17:23 ` Drew Adams
2022-12-19 19:24   ` Marcin Borkowski
2022-12-19 20:33     ` Drew Adams
2022-12-20  6:00       ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADs++6gKrrgC74b=pM2Wfv_EKN0DJ6Nih-KtmPmaOA5nToWLtg@mail.gmail.com' \
    --to=eduardoochs@gmail.com \
    --cc=60190@debbugs.gnu.org \
    --cc=mbork@mbork.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).