branch: elpa/pcmpl-args commit 1a1f5f5eab276a8998ea6b856402d9157c4290e9 Author: Jonathan Waltman <jonathan.walt...@gmail.com> Commit: Jonathan Waltman <jonathan.walt...@gmail.com>
Fix annotation display width on ttys --- pcmpl-args.el | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pcmpl-args.el b/pcmpl-args.el index 7c11f30f5f..95a28b5db3 100644 --- a/pcmpl-args.el +++ b/pcmpl-args.el @@ -1322,18 +1322,16 @@ but returns METADATA when requested." (complete-with-action action table string pred))))) (defun pcmpl-args-guess-display-width () - (or (let* ((comps-buf (get-buffer "*Completions*")) - (comps-win (or (and comps-buf (get-buffer-window comps-buf)) - (next-window)))) - (when comps-win - (window-width comps-win))) - ;; Completions will be displayed in a new window. - (save-excursion - (save-window-excursion - (let ((config (current-window-configuration))) - (unwind-protect - (window-width (split-window-sensibly)) - (set-window-configuration config))))))) + (save-excursion + (save-window-excursion + (let ((config (current-window-configuration))) + (unwind-protect + (let ((buff (get-buffer "*Completions*"))) + (prog1 (1- (window-width + (display-buffer (get-buffer-create "*Completions*")))) + (unless buff + (kill-buffer "*Completions*")))) + (set-window-configuration config)))))) (defun pcmpl-args-make-completion-annotator (table-or-function) (let ((width (pcmpl-args-guess-display-width)))