Skip to content
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

Add support for buffer-local monitors #6

Open
GuiltyDolphin opened this issue Jun 17, 2017 · 0 comments
Open

Add support for buffer-local monitors #6

GuiltyDolphin opened this issue Jun 17, 2017 · 0 comments

Comments

@GuiltyDolphin
Copy link
Owner

GuiltyDolphin commented Jun 17, 2017

Sometimes you may want a monitor to only be enabled in a particular buffer, but not others. For this we could use a concept of 'buffer-local' monitors, allowing them to be enabled/disabled on a per-buffer basis.

Things to think about

  • What would 'buffer-local' monitors mean for certain types of monitor such as timers? Should we even allow this?
    • We may want to restrict the types of monitors that can be buffer local.

Syntax

For instances:

(defvar my-monitor-instance
  (monitor 'my-monitor
    ...
    :buffer-local t)

For monitors (defaults instances to buffer-local):

(define-monitor 'my-example-monitor
  "My monitor...."
  ...
  :buffer-local t)

Possible approaches

  1. Tracking buffers

We could potentially track every buffer a monitor (instance) is enabled in by adding information to the variable.

We would have a special monitor (or hook) that would run when switching buffers, look at the enabled monitor instances then disable any that aren't supposed to be enabled in the current buffer.

We would also need to look through any disabled instances to see if any monitors should be enabled.

We would have a mechanism for specifying a monitor may be enabled globally.

Disadvantages: we would effectively need to look through every (non-global?) monitor instance every time we switch buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant