[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] master e9af1e68: Fix preview-latex to work with desktop.e
From: |
auctex-commit |
Subject: |
[AUCTeX-diffs] master e9af1e68: Fix preview-latex to work with desktop.el again |
Date: |
Thu, 5 May 2022 01:35:46 -0400 (EDT) |
branch: master
commit e9af1e68fb464a45369e19ff85162c49467c87e6
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Fix preview-latex to work with desktop.el again
* preview.el.in (): Don't use obsolete variable
`desktop-buffer-misc-functions'.
(): Just use `desktop-buffer-mode-handlers' which all supported
Emacsens now have.
Use autoload cookie instead of `eval-after-load'.
(desktop-buffer-preview): Add autoload cookie so that it's available
before preview.el is loaded.
(LaTeX-preview-setup): Don't use `desktop-buffer-misc' because it
isn't available (It's now lexically scoped variable in
`desktop-create-buffer'. In addition, `LaTeX-preview-setup' isn't
called anyway during `desktop-buffer-misc' is bound.).
---
preview.el.in | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/preview.el.in b/preview.el.in
index a995485d..96c57066 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -2328,11 +2328,6 @@ kept."
(and save-info
(cons 'preview (cons timestamp (nreverse save-info))))))))
-(eval-after-load "desktop"
- '(add-hook
- 'desktop-buffer-misc-functions
- #'desktop-buffer-preview-misc-data))
-
(defvar preview-temp-dirs nil
"List of top level temporary directories in use from preview.
Any directory not in this list will be cleared out by preview
@@ -2388,6 +2383,18 @@ BUFFER-MISC is the appropriate data to be used."
(preview-buffer-restore-internal
buffer-misc))))))
+;; Add autoload cookies explicitly for desktop.el.
+;; <Background> preview-latex doesn't conform to the following
+;; assumptions of desktop.el:
+;; (1) The file associated with the major mode by autoload has defun
+;; of handler, which restores the state of the buffer.
+;; (2) The file has suitable `add-to-list' form also for
+;; `desktop-buffer-mode-handlers' to register the entry of the
+;; handler.
+;; This isn't the case here because the file associated with
+;; `latex-mode' is tex-mode.el, neither preview.el nor latex.el. Thus
+;; we include both of them as explicit autoloads in preview-latex.el.
+;;;###autoload
(defun desktop-buffer-preview (file-name _buffer-name misc)
"Hook function for restoring persistent previews into a buffer."
(when (and file-name (file-readable-p file-name))
@@ -2398,18 +2405,9 @@ BUFFER-MISC is the appropriate data to be used."
buf)
buf))))
-(eval-after-load "desktop"
- '(if (boundp 'desktop-buffer-mode-handlers)
- (add-to-list 'desktop-buffer-mode-handlers
- '(latex-mode . desktop-buffer-preview))
- (defvar desktop-buffer-file-name)
- (defvar desktop-buffer-name)
- (defvar desktop-buffer-misc)
- (add-hook 'desktop-buffer-handlers (lambda ()
- (desktop-buffer-preview
- desktop-buffer-file-name
- desktop-buffer-name
- desktop-buffer-misc)))))
+;;;###autoload
+(add-to-list 'desktop-buffer-mode-handlers
+ '(latex-mode . desktop-buffer-preview))
(defcustom preview-auto-cache-preamble 'ask
"Whether to generate a preamble cache format automatically.
@@ -3115,9 +3113,7 @@ to add the preview functionality."
`(menu-item "Preview at point" preview-at-point
:image ,preview-tb-icon
:help "Preview on/off at point"
- :vert-only t)))
- (if (boundp 'desktop-buffer-misc)
- (preview-buffer-restore desktop-buffer-misc))))
+ :vert-only t)))))
(defun preview-clean-subdir (dir)
"Cleans out a temporary DIR with preview image files."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] master e9af1e68: Fix preview-latex to work with desktop.el again,
auctex-commit <=