emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Michael Brand <michael.ch.brand@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Encoding Problem in export?
Date: Sat, 16 Nov 2013 21:43:02 +0100	[thread overview]
Message-ID: <87y54ohycp.fsf@gmail.com> (raw)
In-Reply-To: <CALn3zohotvk1Z52mD_QhKZOosc+ZRe1P1FX2AsmRVAVhe7XtqQ@mail.gmail.com> (Michael Brand's message of "Sat, 16 Nov 2013 16:16:04 +0100")

Hello,

Michael Brand <michael.ch.brand@gmail.com> writes:

> I would like to ask you to review the attached patch so I can change
> it when necessary before I git push it.

Sure.

> -	    (browse-url (concat type ":" (org-link-escape-browser path))))
> +	    ;; see `ert-deftest'
> +	    ;; `test-org/org-link-escape-chars-browser'
> +	    (browse-url
> +	     (if (fboundp 'url-encode-url)
> +		 (url-encode-url (concat type ":" path))
> +	       (org-link-escape-browser (concat type ":" path)))))

IMO, the following is nicer:

(funcall (if (fboundp 'url-encode-url) #'url-encode-url #'org-link-escape-browser)
         (concat type ":" path))

Also, it's better to document this in the source code rather than in the
test suite. Also, you could add, as a reminder, that we can remove
`org-link-escape-browser' altogether once we drop support for Emacs 23.

> -	    (browse-url (concat org-doi-server-url
> -				(org-link-escape-browser path))))
> +	    ;; see `ert-deftest'
> +	    ;; `test-org/org-link-escape-chars-browser'
> +	    (browse-url
> +	     (if (fboundp 'url-encode-url)
> +		 (url-encode-url (concat org-doi-server-url path))
> +	       (org-link-escape-browser (concat org-doi-server-url path)))))

Ditto.

> -  (should
> -   (string=
> -    "http://some.host.com/form?&id=blah%2Bblah25"
> -    (org-link-unescape
> -     (org-link-escape "http://some.host.com/form?&id=blah%2Bblah25")))))
> +  (let ((a "http://some.host.com/form?&id=blah%2Bblah25"))
> +    (should (string= a (org-link-unescape (org-link-escape a))))))

No need to change this. Moreover, I tend to prefer `should' outside the
sexp because it is easier to debug, when needed (`should' is quite
opaque when stepping through the function).

> +    ;; This is the behavior of `org-open-at-point' when used together
> +    ;; with an Emacs 24.3 or later where `url-encode-url' is available
> +    (when (fboundp 'url-encode-url)
> +      ;; "query="-space as plus sign
> +      (should (string= (concat query "%2Bsubject:%22Release+8.2%22")
> +		       (url-encode-url (concat query plus))))
> +      ;; "query="-space as space
> +      (should (string= (concat query "%2Bsubject:%22Release%208.2%22")
> +		       (url-encode-url (concat query space)))))

You are testing `url-encode-url' here, not an Org function. Is it really
required?


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2013-11-16 20:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 23:17 Encoding Problem in export? Robert Eckl
2013-07-23 23:35 ` Nicolas Goaziou
2013-07-24  1:50   ` Robert Eckl
2013-07-24  7:34     ` Nicolas Goaziou
2013-07-24  8:46       ` Robert Eckl
2013-07-24  9:16         ` Nicolas Goaziou
2013-07-24 10:27           ` Robert Eckl
2013-07-24  9:39       ` Nick Dokos
2013-07-24 11:09         ` Nicolas Goaziou
2013-07-25  4:05           ` David Maus
2013-07-25 21:46             ` Nicolas Goaziou
2013-07-26  4:03               ` David Maus
2013-07-26 10:20                 ` Nicolas Goaziou
2013-07-27  7:23                   ` David Maus
2013-07-27 11:09                     ` Nicolas Goaziou
2013-07-28  8:36                       ` Jambunathan K
2013-07-28  8:54                         ` Jambunathan K
2013-07-28 11:16                         ` David Maus
2013-07-28 11:22                         ` Nicolas Goaziou
2013-07-29  6:59                           ` Jambunathan K
2013-11-16 15:16       ` Michael Brand
2013-11-16 20:43         ` Nicolas Goaziou [this message]
2013-11-17 11:06           ` Michael Brand
2013-11-17 11:46             ` Nicolas Goaziou
2013-11-17 11:51               ` Michael Brand

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87y54ohycp.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=michael.ch.brand@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/org-mode.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).