From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Encoding Problem in export? Date: Sat, 16 Nov 2013 21:43:02 +0100 Message-ID: <87y54ohycp.fsf@gmail.com> References: <87bo5s27ey.fsf@sachwertpartner.de> <877ggg7suh.fsf@gmail.com> <51EF32F4.9030309@gmx.de> <87txjk5s2q.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vhmhe-0005Td-BH for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 15:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhmhZ-0001Ju-0m for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 15:42:50 -0500 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:47815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhmhY-0001Jo-Or for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 15:42:44 -0500 Received: by mail-ea0-f178.google.com with SMTP id d10so1403463eaj.23 for ; Sat, 16 Nov 2013 12:42:43 -0800 (PST) In-Reply-To: (Michael Brand's message of "Sat, 16 Nov 2013 16:16:04 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Brand Cc: Org Mode Hello, Michael Brand 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