From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: function to cycle through specific org files? Date: Mon, 19 Oct 2015 07:05:38 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo8GA-0007Tk-Vp for emacs-orgmode@gnu.org; Mon, 19 Oct 2015 07:05:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo8G5-0005zq-Ue for emacs-orgmode@gnu.org; Mon, 19 Oct 2015 07:05:46 -0400 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:36667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo8G5-0005zb-QK for emacs-orgmode@gnu.org; Mon, 19 Oct 2015 07:05:41 -0400 Received: by qkca6 with SMTP id a6so6666775qkc.3 for ; Mon, 19 Oct 2015 04:05:41 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Xebar Saram Cc: org mode 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-") 'my-next-file) (global-set-key (kbd "s-") '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