all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8706: 24.0.50; [PATCH] Function to build a URL query-string
@ 2011-05-20 18:37 Ian Eure
  2011-05-23 14:36 ` Ted Zlatanov
  0 siblings, 1 reply; 25+ messages in thread
From: Ian Eure @ 2011-05-20 18:37 UTC (permalink / raw)
  To: 8706

This patch adds a url-build-query-string method, which performs the opposite job of url-parse-query-string. I find myself needing this method in many projects, and having it in url-util.el seems beneficial.

--- url-util.el.orig	2011-05-20 11:32:42.000000000 -0700
+++ url-util.el	2011-05-20 11:32:15.000000000 -0700
@@ -281,6 +281,20 @@
 	  (setq retval (cons (list key val) retval)))))
     retval))
 
+;;;###autoload
+(defun url-build-query-string (query)
+  "Build a query-string.
+
+Given a QUERY in the form:
+'((key1 val1)
+  (key2 val2))
+
+This will return a string `key1=val1&key2=val2'. Keys may be strings
+or symbols; if they are symbols, the string name will be used."
+
+  (c-concat-separated
+   (mapcar (lambda (pair) (apply 'format "%s=%s" pair)) query) "&"))
+
 (defun url-unhex (x)
   (if (> x ?9)
       (if (>= x ?a)





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-05-15  8:54 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-20 18:37 bug#8706: 24.0.50; [PATCH] Function to build a URL query-string Ian Eure
2011-05-23 14:36 ` Ted Zlatanov
     [not found]   ` <87zkmaopfs.fsf@lifelogs.com>
2011-05-25 16:32     ` Ian Eure
2011-05-25 20:31       ` Ted Zlatanov
2011-06-07 17:07         ` Ian Eure
2011-06-07 18:12           ` Stefan Monnier
2011-06-07 18:58           ` Ted Zlatanov
2011-06-11  1:15             ` Ted Zlatanov
2011-06-11  6:32               ` Deniz Dogan
2011-06-11 10:29                 ` Ted Zlatanov
2011-06-14  1:15               ` Ted Zlatanov
2011-06-14  1:29                 ` Ian Eure
2011-06-14 16:14                   ` Glenn Morris
2011-06-14 16:27                     ` Glenn Morris
2011-06-14 16:56                     ` Ted Zlatanov
2011-06-14 16:57                       ` Ian Eure
2012-04-12 19:31                         ` Lars Magne Ingebrigtsen
2012-04-12 19:34                           ` Lars Magne Ingebrigtsen
2012-04-15 23:51                             ` Ted Zlatanov
2012-04-16  0:58                               ` Glenn Morris
2012-04-18 22:37                                 ` Glenn Morris
2012-05-13 19:31                 ` Lars Magne Ingebrigtsen
2012-05-15  8:54                   ` Ted Zlatanov
2011-05-26  0:02       ` Stefan Monnier
2011-05-26 14:33         ` Ted Zlatanov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.