diff options
| author | Andreas Schwab <schwab@linux-m68k.org> | 2026-02-08 12:34:02 +0100 |
|---|---|---|
| committer | Andreas Schwab <schwab@linux-m68k.org> | 2026-02-08 13:21:28 +0100 |
| commit | 7586a5474cd6c1ea8510b5a8178c74160cc783d0 (patch) | |
| tree | 2f877c506430d61461df7025fb20fc71160faea4 /lib-src | |
| parent | 78fc5e2833925d1065f8ce9590440e6fd3192a48 (diff) | |
Extend emacs server protocol for empty arguments
An empty argument is represented by &0. On the receiving side, &0 is
replaced by nothing.
* lisp/server.el (server-unquote-arg): Replace "&0" by nothing.
(server-quote-arg): Produce "&0" for an empty string.
* lib-src/emacsclient.c (quote_argument): Produce "&0" for an
empty string.
(unquote_argument): Replace "&0" by nothing. (Bug#80356)
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 4f3215ea6b1..ba08d7dd6d3 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -867,8 +867,10 @@ send_to_emacs (HSOCKET s, const char *data) static void quote_argument (HSOCKET s, const char *str) { - char *copy = xmalloc (strlen (str) * 2 + 1); + char *copy = xmalloc (strlen (str) * 2 + 3); char *q = copy; + if (*str == '\0') + *q++ = '&', *q++ = '0'; if (*str == '-') *q++ = '&', *q++ = *str++; for (; *str; str++) @@ -910,6 +912,8 @@ unquote_argument (char *str) c = ' '; else if (c == 'n') c = '\n'; + else if (c == '0') + continue; } *q++ = c; } |
