The code is too complex, I rewrote it from scratch, please see the Torus repository.
What has been done :
- Change buffer by name with mtorus-switch-to-marker
- Inspired by mtorus-switch-to-ring
- Both functions work well with Helm
- Persistent torus : save buffers filenames of the torus to a file with mtorus-save-torus
- In the previous version, only buffer names were saved, which is not sufficient to restore files located in multiple directories
- Added remassoc : needed by mtorus-delete-ring
(require 'mtorus)
(mtorus-init)
;; (mtorus-install-suggested-bindings)
(global-set-key (kbd "s-t c") 'mtorus-new-ring)
(global-set-key (kbd "s-t m") 'mtorus-rename-ring)
(global-set-key (kbd "s-t D") 'mtorus-delete-ring)
(global-set-key (kbd "<S-s-insert>") 'mtorus-new-ring)
(global-set-key (kbd "s-t a") 'mtorus-add-current-pos-to-current-ring)
(global-set-key (kbd "s-t u") 'mtorus-update-current-marker)
(global-set-key (kbd "s-t d") 'mtorus-delete-current-marker-from-current-ring)
(global-set-key (kbd "<s-insert>") 'mtorus-add-current-pos-to-current-ring)
(global-set-key (kbd "<s-delete>") 'mtorus-update-current-marker)
(global-set-key (kbd "<S-s-delete>") 'mtorus-delete-current-marker-from-current-ring)
(global-set-key (kbd "s-t l") 'mtorus-describe-current-ring)
(global-set-key (kbd "s-t n") 'mtorus-cycle-marker-next)
(global-set-key (kbd "s-t p") 'mtorus-cycle-marker-previous)
(global-set-key (kbd "<C-prior>") 'mtorus-cycle-marker-previous)
(global-set-key (kbd "<C-next>") 'mtorus-cycle-marker-next)
(global-set-key (kbd "s-t N") 'mtorus-cycle-ring-next)
(global-set-key (kbd "s-t P") 'mtorus-cycle-ring-previous)
(global-set-key (kbd "<C-home>") 'mtorus-cycle-ring-previous)
(global-set-key (kbd "<C-end>") 'mtorus-cycle-ring-next)
(global-set-key (kbd "s-SPC") 'mtorus-switch-to-ring)
(global-set-key (kbd "s-t S") 'mtorus-switch-to-ring)
(global-set-key (kbd "s-=") 'mtorus-switch-to-marker)
(global-set-key (kbd "s-t s") 'mtorus-switch-to-marker)
(global-set-key (kbd "s-t w") 'mtorus-save-torus)
(global-set-key (kbd "s-t r") 'mtorus-read-torus)
(setq mtorus-switch-to-marker-when-cycling-p t)
(setq mtorus-update-marker-when-cycling-markers-p t)
(setq mtorus-update-marker-when-cycling-rings-p t)
(setq mtorus-switch-when-deleting-p t)
(setq mtorus-file-name "~/racine/plugin/data/mtorus/mtorus.el")
;; (setq mtorus-save-on-exit t)
;; (mtorus-read-torus)
I try to be mindful when I code, but some bugs might remain, so be careful.