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

Make sure the presentation frame shows the intended buffer #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kqr
Copy link

@kqr kqr commented Jun 19, 2019

I have an after-make-frame-functions hook that switches new frames to
the scratch buffer, which broke epresent: it only ever showed an empty
presentation!

My current workaround is to define advice around epresent--get-frame which gets
the current buffer, calls epresent--get-frame, and then switches to the buffer,
as such:

(define-advice epresent--get-frame
      (:around (actual-get-frame &rest args) epresent-frame-set-buffer)
    (let ((presentation-buffer (current-buffer)))
      (apply actual-get-frame args)
      (switch-to-buffer presentation-buffer)
      epresent--frame))

I realised, however, that epresent-run already gets the correct buffer – it just
doesn't switch to it after creating the frame! So that's what this fix
implements.

I have an after-make-frame-functions hook that switches new frames to
the *scratch* buffer, which broke epresent: it only ever showed an empty
presentation!

My current workaround is to define advice around epresent--get-frame which gets
the current buffer, calls epresent--get-frame, and then switches to the buffer,
as such:

(define-advice epresent--get-frame
      (:around (actual-get-frame &rest args) epresent-frame-set-buffer)
    (let ((presentation-buffer (current-buffer)))
      (apply actual-get-frame args)
      (switch-to-buffer presentation-buffer)
      epresent--frame))

I realised, however, that epresent-run already gets the correct buffer – it just
doesn't switch to it after creating the frame! So that's what this fix
implements.
@kqr
Copy link
Author

kqr commented Jun 19, 2019

Separately, one of the reasons this was hard to debug was that the "EPresent can
only be used from Org Mode" check happens /not/ just before presentation is about
to start, but rather just after the command is invoked. This has the potential
of hiding multiple errors, and better practise would be to have the precondition
check as close as possible to the thing where the precondition actually applies.

That said, in this specific case, it would only guard against this particular error,
I think, and that is why I have left the precondition where it is.

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

Successfully merging this pull request may close these issues.

2 participants