Comments
Patch
@@ -213,25 +213,27 @@ should be. Returns a cons cell `(tags-per-line width)'."
(cond
((integerp notmuch-column-control)
(max 1
- (/ (- (window-width) notmuch-hello-indent)
+ (/ (notmuch-hello-available-width)
;; Count is 9 wide (8 digits plus space), 1 for the space
;; after the name.
(+ 9 1 (max notmuch-column-control widest)))))
((floatp notmuch-column-control)
- (let* ((available-width (- (window-width) notmuch-hello-indent))
- (proposed-width (max (* available-width notmuch-column-control) widest)))
- (floor available-width proposed-width)))
+ (let ((proposed-width (max
+ (* (notmuch-hello-available-width)
+ notmuch-column-control)
+ widest)))
+ (floor (notmuch-hello-available-width) proposed-width)))
(t
(max 1
- (/ (- (window-width) notmuch-hello-indent)
+ (/ (notmuch-hello-available-width)
;; Count is 9 wide (8 digits plus space), 1 for the space
;; after the name.
(+ 9 1 widest)))))))
(cons tags-per-line (/ (max 1
- (- (window-width) notmuch-hello-indent
+ (- (notmuch-hello-available-width)
;; Count is 9 wide (8 digits plus
;; space), 1 for the space after the
;; name.
@@ -458,7 +460,7 @@ Complete list of currently available key bindings:
(widget-create 'editable-field
;; Leave some space at the start and end of the
;; search boxes.
- :size (max 8 (- (window-width) notmuch-hello-indent
+ :size (max 8 (- (notmuch-hello-available-width)
(length "Search: ")))
:action (lambda (widget &rest ignore)
(notmuch-hello-search (widget-value widget))))
@@ -481,12 +483,13 @@ Complete list of currently available key bindings:
;; Don't let the search boxes be
;; less than 8 characters wide.
:size (max 8
- (- (window-width)
+ (-
+ (notmuch-hello-available-width)
;; Leave some space
;; at the start and
;; end of the
;; boxes.
- (* 2 notmuch-hello-indent)
+ notmuch-hello-indent
;; 1 for the space
;; before the
;; `[save]' button. 6
@@ -540,7 +543,7 @@ Complete list of currently available key bindings:
(widget-insert "Edit saved searches with the `edit' button.\n"))
(widget-insert "Hit RET or click on a saved search or tag name to view matching threads.\n")
(widget-insert "`=' refreshes this screen. `s' jumps to the search box. `q' to quit.\n")
- (let ((fill-column (- (window-width) notmuch-hello-indent)))
+ (let ((fill-column (notmuch-hello-available-width)))
(center-region start (point))))
(widget-setup)
@@ -558,6 +561,11 @@ Complete list of currently available key bindings:
(interactive)
(notmuch-hello))
+(defun notmuch-hello-available-width ()
+ (let ((left-margin (or (car (window-margins)) 0))
+ (right-margin (or (cadr (window-margins)) 0)))
+ (- (window-width) left-margin right-margin notmuch-hello-indent)))
+
;;
(provide 'notmuch-hello)