]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/hydra/lv.el
Merge commit '7783f89cdbb3e3ba57f232552729715148e0b9a1' from hydra
[gnu-emacs-elpa] / packages / hydra / lv.el
index 7b190745dbc55d4742f2884abc81196ba483692f..ee5a739460d5bf7a57125b5fc2915ccd4c5f278e 100644 (file)
@@ -41,7 +41,6 @@
   (if (window-live-p lv-wnd)
       lv-wnd
     (let ((ori (selected-window))
-          (golden-ratio-mode nil)
           buf)
       (prog1 (setq lv-wnd
                    (select-window
@@ -50,7 +49,7 @@
         (if (setq buf (get-buffer "*LV*"))
             (switch-to-buffer buf)
           (switch-to-buffer "*LV*")
-          (setq truncate-lines nil)
+          (set-window-hscroll lv-wnd 0)
           (setq mode-line-format nil)
           (setq cursor-type nil)
           (set-window-dedicated-p lv-wnd t)
 
 (defun lv-message (format-string &rest args)
   "Set LV window contents to (`format' FORMAT-STRING ARGS)."
-  (let ((ori (selected-window))
-        (str (apply #'format format-string args))
-        deactivate-mark)
+  (let* ((ori (selected-window))
+         (str (apply #'format format-string args))
+         (n-lines (cl-count ?\n str))
+         deactivate-mark
+         golden-ratio-mode)
     (select-window (lv-window))
     (unless (string= (buffer-string) str)
       (delete-region (point-min) (point-max))
       (insert str)
+      (setq-local window-min-height n-lines)
+      (setq truncate-lines (> n-lines 1))
       (fit-window-to-buffer nil nil 1))
     (goto-char (point-min))
     (select-window ori)))