aboutsummaryrefslogtreecommitdiff
path: root/perspective.el
diff options
context:
space:
mode:
authorGiap Tran <txgvnn@gmail.com>2022-05-21 22:31:25 +0700
committerGiap Tran <txgvnn@gmail.com>2022-05-21 22:35:59 +0700
commitfab0243cf84c0d4edcc01026d7363c7a4587fbb7 (patch)
treef3619bc229973dc7e7bef14ac085c8c8ea610ae6 /perspective.el
parent4e38680793585a907ae46b148697030c2b552a00 (diff)
feat: compatible with xref in emacs29
Diffstat (limited to 'perspective.el')
-rw-r--r--perspective.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/perspective.el b/perspective.el
index 31d36b1..5ac3d39 100644
--- a/perspective.el
+++ b/perspective.el
@@ -2208,16 +2208,22 @@ were merged in from a previous call to `persp-merge'."
;; xref is not available in Emacs 24, so be careful:
(with-eval-after-load 'xref
(defvar persp--xref-marker-ring (make-hash-table :test 'equal))
+ (if (boundp 'xref--history)
+ (defun persp--set-xref-marker-ring ()
+ "Set xref--history per persp."
+ (let ((persp-curr-name (persp-name (persp-curr))))
+ (unless (gethash persp-curr-name persp--xref-marker-ring)
+ (puthash persp-curr-name (cons nil nil)
+ persp--xref-marker-ring))
+ (setq xref--history (gethash persp-curr-name persp--xref-marker-ring))))
+ (defun persp--set-xref-marker-ring ()
+ "Set xref--marker-ring per persp."
+ (let ((persp-curr-name (persp-name (persp-curr))))
+ (unless (gethash persp-curr-name persp--xref-marker-ring)
+ (puthash persp-curr-name (make-ring xref-marker-ring-length)
+ persp--xref-marker-ring))
+ (setq xref--marker-ring (gethash persp-curr-name persp--xref-marker-ring))))))
- (defun persp--set-xref-marker-ring ()
- "Set xref--marker-ring per persp."
- (defvar xref-marker-ring-length)
- (defvar xref--marker-ring)
- (let ((persp-curr-name (persp-name (persp-curr))))
- (unless (gethash persp-curr-name persp--xref-marker-ring)
- (puthash persp-curr-name (make-ring xref-marker-ring-length)
- persp--xref-marker-ring))
- (setq xref--marker-ring (gethash persp-curr-name persp--xref-marker-ring)))))
;;; --- done