Skip to content

Commit

Permalink
use less wasteful cl-find-if for finding monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed May 15, 2017
1 parent b24f5a4 commit cf3a388
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions helm-frame.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@
;; (setq helm-split-window-preferred-function '@helm-frame/window)

;;; code:
(require 'cl-lib)

(defun helm-frame--half (number) "Return half a NUMBER." (/ number 2))

(defun helm-frame--current-monitor (&optional frame)
"Get the current monitor.
If FRAME is provided, then get display that frame is on."
(let (current-monitor)
(dolist (monitor (display-monitor-attributes-list) current-monitor)
(if
(member (or frame (window-frame)) (assoc 'frames monitor))
(setq current-monitor monitor)))))
(cl-find-if
(lambda (monitor)
(member (or frame (window-frame)) (assoc 'frames monitor)))
(display-monitor-attributes-list)))

(defun helm-frame--monitor-pixel-width (&optional monitor)
"Return pixel width of MONITOR."
Expand All @@ -62,7 +61,6 @@ If FRAME is provided, then get display that frame is on."
(- half-monitor-width half-frame-width)
(- half-monitor-height half-frame-height))))


(defun helm-frame--frame-named (name)
"Return frame called NAME."
(interactive
Expand Down

0 comments on commit cf3a388

Please sign in to comment.