this feels kind of hacky, but it seems to do what you want: (setq my-files '("a.org" "b.org" "c.org"))
(defun my-next-file () (interactive) (let ((f (pop my-files))) (add-to-list 'my-files f t) (find-file f))) (defun my-previous-file () (interactive) (let* ((r-my-files (reverse my-files)) (f (pop r-my-files))) (add-to-list 'r-my-files f t) (setq my-files (reverse r-my-files)) (find-file f))) (global-set-key (kbd "s-<right>") 'my-next-file) (global-set-key (kbd "s-<left>") 'my-previous-file) the my-files var is not saved, so the order will not persist when you close emacs. Xebar Saram writes: > Hi all > > I know this should be easy (for anyone that knows elisp that is :)). how > does one create a function that cycles up/down through a list of pre > defined buffers/files? > for example i want to cycle (ie open and show in the emacs window) through: > A.org B.org C.org > i want to use ie A-left and A-right to open (if not already) and cycle > through these files. any one has such a system? > > best > > Z -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu