emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Xebar Saram <zeltakc@gmail.com>
Cc: org mode <emacs-orgmode@gnu.org>
Subject: Re: function to cycle through specific org files?
Date: Mon, 19 Oct 2015 07:05:38 -0400	[thread overview]
Message-ID: <m2si572k59.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAOQHXPr91sp+psYH6Dh9QAmQQj-5eqEmENch_s+Dtoe8zmA5ag@mail.gmail.com>

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

  reply	other threads:[~2015-10-19 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19  5:35 function to cycle through specific org files? Xebar Saram
2015-10-19 11:05 ` John Kitchin [this message]
2015-10-19 11:15   ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2si572k59.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=zeltakc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).