Skip to content

Add var to filter saved frames on bookmark-frames #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion burly.el
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ See Info node `(elisp)Window Parameters'."
:value-type (choice (const :tag "Not saved" nil)
(const :tag "Saved" writable))))

(defcustom burly-ignore-frame-predicates '(burly-childframe-p)
"List of predicates that filters frames for saving on `burly-bookmark-frames'.
Predicate functions must take an optional FRAME argument, and `nil' means current frame.

If any of the predicates is not `nil' for a frame, then the frame is not saved."
:type 'list)

;;;; Commands

;;;###autoload
Expand Down Expand Up @@ -164,7 +171,7 @@ a project."
(interactive
(list (completing-read "Save Burly bookmark: " (burly-bookmark-names)
nil nil burly-bookmark-prefix)))
(let ((record (list (cons 'url (burly-frames-url))
(let ((record (list (cons 'url (burly-frames-url (cl-remove-if-not burly-save-frame-p (frame-list))))
(cons 'handler #'burly-bookmark-handler))))
(bookmark-store name record nil)))

Expand Down Expand Up @@ -233,6 +240,16 @@ a project."

;;;;; Frames

(defun burly-childframe-p (&optional frame)
"Return non-nil if FRAME is a childframe. If FRAME is `nil', check for current frame."
(frame-parameter frame 'parent-frame))

(defun burly-save-frame-p (&optional frame)
"Return non-nil if FRAME should be saved by burly. If FRAME is `nil', check for current frame.

This internally uses `burly-ignore-frame-predicates'."
(cl-notany (lambda (pred) (funcall pred frame)) burly-ignore-frame-predicates))

;; Looks like frameset.el should make this pretty easy.

(require 'frameset)
Expand Down