From d398c4a846493fe2537862b35d02bc3581cc7b95 Mon Sep 17 00:00:00 2001 From: Friedrich Delgado Friedrichs Date: Sun, 26 Oct 2008 16:13:20 +0100 Subject: [PATCH] escape carets from groupname and windowname, safe for compilation --- primitives.lisp | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/primitives.lisp b/primitives.lisp index 01da193..9e01bb0 100644 --- a/primitives.lisp +++ b/primitives.lisp @@ -716,9 +716,27 @@ do: (setf output (concatenate 'string output (string (car cur))) cur (cdr cur))))))) +(defun escape-carets (string) + (if (> (length string) 0) + (let ((pos (position #\^ string))) + (if pos + (concat (subseq string 0 (+ 1 pos)) + "^" + (escape-carets (subseq string (+ 1 pos)))) + string)) + string)) + +(defun return-escaped-carets (fun) + (lambda (&rest args) + (let ((string (apply fun args))) + (escape-carets string)))) + +(defun window-name-no-carets (window) + (escape-carets (window-name window))) + (defvar *window-formatters* '((#\n window-number) (#\s fmt-window-status) - (#\t window-name) + (#\t window-name-no-carets) (#\c window-class) (#\i window-res) (#\r window-role) @@ -755,9 +773,12 @@ characters.") (defvar *window-info-format* "%wx%h %n (%t)" "The format used in the info command. @xref{*window-format*} for formatting details.") +(defun group-name-no-carets (group) + (escape-carets (group-name group))) + (defvar *group-formatters* '((#\n group-number) (#\s fmt-group-status) - (#\t group-name)) + (#\t group-name -no-carets)) "An alist of characters and formatter functions. The character can be used as a format character in @var{*group-format*}. When the character is encountered in the string, the corresponding function is called -- 1.5.6.5