summaryrefslogtreecommitdiff
path: root/lisp/ibuffer.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2016-04-28 18:51:51 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2016-04-28 18:51:51 +0200
commitf078ef90cbcf479053efd81e1d95e50e64da2e99 (patch)
tree889466ce61d4acf3a4c8db982dc106795890100c /lisp/ibuffer.el
parentc3ac2cbf73516d2414c845087cac8fc7ec1ce5d7 (diff)
downloademacs-f078ef90cbcf479053efd81e1d95e50e64da2e99.tar.gz
Make ibuffer not break on newline-embedded buffer names
* lisp/ibuffer.el (name): When buffer names contain newlines, quote those newlines before displaying (bug#12378).
Diffstat (limited to 'lisp/ibuffer.el')
-rw-r--r--lisp/ibuffer.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index b2ec073dc16..704907a79f7 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1740,7 +1740,13 @@ If point is on a group name, this function operates on that group."
(cond ((zerop bufs) "No buffers")
((= 1 bufs) "1 buffer")
(t (format "%s buffers" bufs))))))
- (propertize (buffer-name) 'font-lock-face (ibuffer-buffer-name-face buffer mark)))
+ (let ((string (propertize (buffer-name)
+ 'font-lock-face
+ (ibuffer-buffer-name-face buffer mark))))
+ (if (not (seq-position string ?\n))
+ string
+ (replace-regexp-in-string
+ "\n" (propertize "^J" 'font-lock-face 'escape-glyph) string))))
(define-ibuffer-column size
(:inline t