unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Hong Xu <hong@topbug.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24694@debbugs.gnu.org, rpluim@gmail.com
Subject: bug#24694: Document url--allow-chars for external use?
Date: Sat, 12 Oct 2019 11:23:48 -0700	[thread overview]
Message-ID: <3e23aa8b-248b-8416-206e-eadff0d75a31@topbug.net> (raw)
In-Reply-To: <835zkunx9o.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

On 10/12/19 2:11 AM, Eli Zaretskii wrote:
> 
> I have a couple of minor comments:

I've attached an update.


> 
> The log message should specify each file with leading directories
> starting from the root of the Emacs tree.  E.g., url-util.el should be
> shown as lisp/url/url-util.el.

Done.

> 
> Also, please always mention the bug number in the log message.

Done.

> 
>> +allowed characters.  Otherwise, ALLOWED-CHARS should be either a
>> +vector whose Nth element is non-nil if character N is allowed or
>> +a list of allowed chars.                                     ^
> 
> Please insert a comma where indicated, it will make the sentence
> easier to read.

I swapped the two choices (the shorter one goes first) and hopefully this will be easier to read. Also updated the doc in url.texi.

[-- Attachment #2: 0001-Make-url-hexify-string-accept-a-list-of-allowed-char.patch --]
[-- Type: text/x-patch, Size: 2965 bytes --]

From 01bb6f74a4e91534a253bffab0457a27f6cb6111 Mon Sep 17 00:00:00 2001
From: Hong Xu <hong@topbug.net>
Date: Fri, 11 Oct 2019 19:17:23 -0700
Subject: [PATCH] Make url-hexify-string accept a list of allowed chars
 (bug#26469)

* lisp/url/url-util.el (url-hexify-string): Accept a list of allowed
chars.
* doc/misc/url.texi (URI Encoding): Update url-hexify-string doc and
index improvements.
---
 doc/misc/url.texi    |  8 ++++++--
 lisp/url/url-util.el | 10 +++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index e72d9bfe3d2e..79dead185dd0 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -221,6 +221,7 @@ URI Encoding
 @section URI Encoding
 
 @cindex percent encoding
+@findex url-generic-parse-url
   The @code{url-generic-parse-url} parser does not obey RFC 3986 in
 one respect: it allows non-@acronym{ASCII} characters in URI strings.
 
@@ -233,6 +234,7 @@ URI Encoding
 @acronym{ASCII} characters must also be percent encoded when they
 appear in URI components.)
 
+@findex url-encode-url
   The function @code{url-encode-url} can be used to convert a URI
 string containing arbitrary characters to one that is properly
 percent-encoded in accordance with RFC 3986.
@@ -244,6 +246,8 @@ URI Encoding
 previously uppercase.
 @end defun
 
+@findex url-hexify-string
+@findex url-unhex-string
   To convert between a string containing arbitrary characters and a
 percent-encoded all-@acronym{ASCII} string, use the functions
 @code{url-hexify-string} and @code{url-unhex-string}:
@@ -263,8 +267,8 @@ URI Encoding
 argument is @code{nil}, the allowed characters are those specified as
 @dfn{unreserved characters} by RFC 3986 (see the variable
 @code{url-unreserved-chars}).  Otherwise, @var{allowed-chars} should
-be a vector whose @var{n}-th element is non-@code{nil} if character
-@var{n} is allowed.
+be either a list of allowed chars, or a vector whose Nth element is
+non-nil if character N is allowed.
 @end defun
 
 @defun url-unhex-string string &optional allow-newlines
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index a390723e73dc..e5b09d5a29db 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -395,9 +395,13 @@ url-hexify-string
 
 The allowed characters are specified by ALLOWED-CHARS.  If this
 argument is nil, the list `url-unreserved-chars' determines the
-allowed characters.  Otherwise, ALLOWED-CHARS should be a vector
-whose Nth element is non-nil if character N is allowed."
-  (unless allowed-chars
+allowed characters.  Otherwise, ALLOWED-CHARS should be either a
+list of allowed chars, or a vector whose Nth element is non-nil
+if character N is allowed.
+"
+  (if allowed-chars
+      (unless (vectorp allowed-chars)
+        (setq allowed-chars (url--allowed-chars allowed-chars)))
     (setq allowed-chars (url--allowed-chars url-unreserved-chars)))
   (mapconcat (lambda (byte)
 	       (if (aref allowed-chars byte)
-- 
2.20.1


  reply	other threads:[~2019-10-12 18:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 18:24 bug#24694: Document url--allow-chars for external use? Hong Xu
2016-10-14 19:02 ` Eli Zaretskii
2016-10-14 19:36   ` Hong Xu
2016-12-01 21:28   ` Hong Xu
2019-10-04 19:31     ` Hong Xu
2019-10-11 12:38       ` Eli Zaretskii
2019-10-11 14:32         ` Robert Pluim
2019-10-12  2:21           ` Hong Xu
2019-10-12  9:11             ` Eli Zaretskii
2019-10-12 18:23               ` Hong Xu [this message]
2019-10-14  4:47                 ` Lars Ingebrigtsen

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=3e23aa8b-248b-8416-206e-eadff0d75a31@topbug.net \
    --to=hong@topbug.net \
    --cc=24694@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rpluim@gmail.com \
    /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).