- C-cz : switch to listener
- C-co : cycle between code, tests and docs factor files
+ - C-cs : switch to other factor buffer (M-x fuel-switch-to-buffer)
+ - C-x4s : switch to other factor buffer in other window
+ - C-x5s : switch to other factor buffer in other frame
- M-. : edit word at point in Emacs (see fuel-edit-word-method custom var)
- M-, : go back to where M-. was last invoked
(pop-tag-mark)
(error "No previous location for find word or vocab invokation")))
+(defvar fuel-edit--buffer-history nil)
+
+(defun fuel-switch-to-buffer (&optional method)
+ "Switch to any of the existing Factor buffers, with completion."
+ (interactive)
+ (let ((buffer (completing-read "Factor buffer: "
+ (remove (buffer-name)
+ (mapcar 'buffer-name (buffer-list)))
+ '(lambda (s) (string-match "\\.factor$" s))
+ t
+ nil
+ fuel-edit--buffer-history)))
+ (cond ((eq method 'window) (switch-to-buffer-other-window buffer))
+ ((eq method 'frame) (switch-to-buffer-other-frame buffer))
+ (t (switch-to-buffer buffer)))))
+
+(defun fuel-switch-to-buffer-other-window ()
+ "Switch to any of the existing Factor buffers, in other window."
+ (interactive)
+ (fuel-switch-to-buffer 'window))
+
+(defun fuel-switch-to-buffer-other-frame ()
+ "Switch to any of the existing Factor buffers, in other frame."
+ (interactive)
+ (fuel-switch-to-buffer 'frame))
+
\f
(provide 'fuel-edit)
;;; fuel-edit.el ends here
(fuel-mode--key-1 ?l 'fuel-run-file)
(fuel-mode--key-1 ?r 'fuel-eval-region)
(fuel-mode--key-1 ?z 'run-factor)
+(fuel-mode--key-1 ?s 'fuel-switch-to-buffer)
+(define-key fuel-mode-map "\C-x4s" 'fuel-switch-to-buffer-other-window)
+(define-key fuel-mode-map "\C-x5s" 'fuel-switch-to-buffer-other-frame)
(define-key fuel-mode-map "\C-\M-x" 'fuel-eval-definition)
(define-key fuel-mode-map "\C-\M-r" 'fuel-eval-extended-region)