Samuel W. Flint преди 8 години
родител
ревизия
fec0485788
променени са 1 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 10 3
      buffer-layers.el

+ 10 - 3
buffer-layers.el

@@ -120,9 +120,16 @@
 (define-key buffer-layer-map (kbd "u") #'unload-buffer-layer)
 (define-key buffer-layer-map (kbd "U") #'unload-all-buffer-layers)
 
-(global-set-key (kbd "C-x L") buffer-layer-map)
-
-(add-hook 'kill-emacs-hook #'unload-all-buffer-layers)
+(define-minor-mode buffer-layer-mode
+  "A mode for managing layers of buffers."
+  :lighter " BLM" :global t :variable buffer-layer-mode-p
+  (if buffer-layer-mode-p
+      (progn
+        (define-key ctl-x-map (kbd "L") buffer-layer-map)
+        (add-hook 'kill-emacs-hook #'unload-all-buffer-layers))
+    (progn
+      (define-key ctl-x-map (kbd "L") nil)
+      (remove-hook 'kill-emacs-hook #'unload-all-buffer-layers))))
 
 (provide 'buffer-layers)