Force helm posframe to respect min-(width|height)
And enable solaire-mode if available, and unused in origin buffer (to make it easier to see posframe over non-solaire-mode buffers).
This commit is contained in:
parent
e127819d88
commit
3b4fd56cac
2 changed files with 36 additions and 13 deletions
|
@ -16,17 +16,40 @@ bottom, which is easier on the eyes on big displays."
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +helm-posframe-display (buffer &optional _resume)
|
(defun +helm-posframe-display (buffer &optional _resume)
|
||||||
"TODO"
|
"TODO"
|
||||||
(require 'posframe)
|
|
||||||
(setq helm--buffer-in-new-frame-p t)
|
(setq helm--buffer-in-new-frame-p t)
|
||||||
|
(let ((solaire-p (bound-and-true-p solaire-mode))
|
||||||
|
(params (copy-sequence +helm-posframe-parameters)))
|
||||||
|
(let-alist params
|
||||||
|
(require 'posframe)
|
||||||
(posframe-show
|
(posframe-show
|
||||||
(setq +helm--posframe-buffer buffer)
|
(setq +helm--posframe-buffer buffer)
|
||||||
:position (point)
|
:position (point)
|
||||||
:poshandler +helm-posframe-handler
|
:poshandler +helm-posframe-handler
|
||||||
:override-parameters +helm-posframe-parameters)
|
:width
|
||||||
|
(max (cl-typecase .width
|
||||||
|
(integer .width)
|
||||||
|
(float (truncate (* (frame-width) .width)))
|
||||||
|
(function (funcall .width))
|
||||||
|
(t 0))
|
||||||
|
.min-width)
|
||||||
|
:height
|
||||||
|
(max (cl-typecase .height
|
||||||
|
(integer .height)
|
||||||
|
(float (truncate (* (frame-height) .height)))
|
||||||
|
(function (funcall .height))
|
||||||
|
(t 0))
|
||||||
|
.min-height)
|
||||||
|
:override-parameters
|
||||||
|
(dolist (p '(width height min-width min-height) params)
|
||||||
|
(setq params (delq (assq p params) params)))))
|
||||||
|
;;
|
||||||
(unless (or (null +helm-posframe-text-scale)
|
(unless (or (null +helm-posframe-text-scale)
|
||||||
(= +helm-posframe-text-scale 0))
|
(= +helm-posframe-text-scale 0))
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(text-scale-set +helm-posframe-text-scale))))
|
(when (and (featurep 'solaire-mode)
|
||||||
|
(not solaire-p))
|
||||||
|
(solaire-mode +1))
|
||||||
|
(text-scale-set +helm-posframe-text-scale)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +helm|posframe-cleanup ()
|
(defun +helm|posframe-cleanup ()
|
||||||
|
|
|
@ -26,10 +26,10 @@ be negative.")
|
||||||
|
|
||||||
(defvar +helm-posframe-parameters
|
(defvar +helm-posframe-parameters
|
||||||
'((internal-border-width . 8)
|
'((internal-border-width . 8)
|
||||||
(min-width . 80)
|
|
||||||
(min-height . 16)
|
|
||||||
(width . 0.5)
|
(width . 0.5)
|
||||||
(height . 0.55))
|
(height . 0.35)
|
||||||
|
(min-width . 80)
|
||||||
|
(min-height . 16))
|
||||||
"TODO")
|
"TODO")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue