From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [PATCH 05/16] New optional argument: Merge user table with default table Date: Sun, 13 Feb 2011 13:01:07 +0100 Message-ID: <1297598478-9925-6-git-send-email-dmaus@ictsoc.de> References: <87d3mwvqwq.fsf@gnu.org> Return-path: Received: from [140.186.70.92] (port=43975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoaeL-0003n5-Ep for emacs-orgmode@gnu.org; Sun, 13 Feb 2011 07:01:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoaeI-00070P-Oe for emacs-orgmode@gnu.org; Sun, 13 Feb 2011 07:01:57 -0500 Received: from mail.app1.xlhost.de ([213.202.242.114]:48908 helo=mysql1.xlhost.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoaeI-0006zf-G0 for emacs-orgmode@gnu.org; Sun, 13 Feb 2011 07:01:54 -0500 In-Reply-To: <87d3mwvqwq.fsf@gnu.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org, bastien.guerry@wikimedia.fr Cc: David Maus * org.el (org-link-escape): New optional argument. Merge user table with default table. --- lisp/org.el | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cafb673..a29d429 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8554,14 +8554,22 @@ This is the list that is used for internal purposes.") "List of escapes for characters that are problematic in links. This is the list that is used before handing over to the browser.") -(defun org-link-escape (text &optional table) +(defun org-link-escape (text &optional table merge) "Return percent escaped representation of TEXT. TEXT is a string with the text to escape. Optional argument TABLE is a list with characters that should be -escaped. When nil, `org-link-escape-chars' is used." +escaped. When nil, `org-link-escape-chars' is used. +If optional argument MERGE is set, merge TABLE into +`org-link-escape-chars'." (if (and org-url-encoding-use-url-hexify (not table)) (url-hexify-string text) - (setq table (or table org-link-escape-chars)) + (cond + ((and table merge) + (mapc (lambda (defchr) + (unless (member defchr table) + (setq table (cons defchr table)))) org-link-escape-chars)) + ((null table) + (setq table org-link-escape-chars))) (mapconcat (lambda (char) (if (or (member char table) -- 1.7.2.3