diff options
| author | Paul Nelson <ultrono@gmail.com> | 2025-04-06 22:52:19 +0200 |
|---|---|---|
| committer | Paul Nelson <ultrono@gmail.com> | 2025-04-06 22:52:19 +0200 |
| commit | 2fe6cb676bc620ee20c64a8d24be71e98b376d47 (patch) | |
| tree | 6d8ec18dbdb1b505e4244820ca039058a84e17bb | |
| parent | 85c60d708b4a8b5bd5a4f0801559b215a4e6f768 (diff) | |
Add convenience function to toggle appropriate follow mode
* README.org (Extensibility): Add new "Convenience" section with a
command that selects and toggles the appropriate follow mode based on
current buffer.
| -rw-r--r-- | README.org | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -51,3 +51,21 @@ Both windows will automatically stay synchronized. * Extensibility The package uses generic functions, making it straightforward to add support for additional document viewing modes. See =doc-view-follow-pdf-tools.el= for an example of how to do this. + +* Convenience + +Since `doc-view-follow-mode` works with document files (PDF, PS, etc.) and `follow-mode` works with text buffers, you might want a single command that applies the appropriate mode based on your current buffer. Here's a function that does so: + +#+begin_src elisp +(defun toggle-some-follow-mode () + "Toggle either `doc-view-follow-mode' or `follow-mode' as appropriate. +In buffers where `doc-view-follow-mode' is supported, toggle that mode. +Otherwise, toggle the standard `follow-mode'." + (interactive) + (if (and (fboundp 'doc-view-follow-supported-p) + (doc-view-follow-supported-p)) + (call-interactively 'doc-view-follow-mode) + (call-interactively 'follow-mode))) + +(keymap-global-set "H-f" 'toggle-some-follow-mode) +#+end_src |
