Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Mode hook problem of interleave #40

Closed
Yevgnen opened this issue Dec 12, 2016 · 1 comment
Closed

Mode hook problem of interleave #40

Yevgnen opened this issue Dec 12, 2016 · 1 comment
Assignees

Comments

@Yevgnen
Copy link
Contributor

Yevgnen commented Dec 12, 2016

Hi,

Looking in the definition of interleave-mode, it should be a buffer local minor mode. But if one wants to add hooks for interleave-mode, for example,

    (add-hook 'interleave-mode-hook (lambda () (print (buffer-file-name)))))

can see that when enabling interleave-mode, it prints the pdf buffer file name, while prints the org buffer file name when disabling. That's a bit strange as we enable the mode in an org buffer while disable it by interleave-quit in a pdf buffer. Anyway, shouldn't these two be the same(as the mode is buffer local)? If not, there may be issues when people trying to add hooks for interleave-mode. But personally, I think defining an interleave-mode minor mode maybe is not really necessary. Thanks !

@rudolfochrist rudolfochrist self-assigned this Dec 12, 2016
@rudolfochrist
Copy link
Owner

That's a bit strange as we enable the mode in an org buffer while disable it by interleave-quit in a pdf buffer.

Actually not. In both cases we're switching buffers before run-hooks is called. If you want to reference the buffers, please use interleave-org-buffer and interleave-pdf-buffer. Admittedly, both variables aren't really good documented. I'll fix this soon.

  • Fix documentation.

Anyway, shouldn't these two be the same(as the mode is buffer local)? If not, there may be issues when people trying to add hooks for interleave-mode.

The mode is indeed buffer-local, but I'm afraid buffer-file-name doesn't care. It returns the file name for the active buffer, whether this is the one you wanted or not.

But personally, I think defining an interleave-mode minor mode maybe is not really necessary.

OK. This needs some more thinking. How would you define keybindings that doesn't affect other keybindings of other modes?

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

No branches or pull requests

2 participants