emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: Xebar Saram <zeltakc@gmail.com>, emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: function to cycle through specific org files?
Date: Mon, 19 Oct 2015 07:15:46 -0400	[thread overview]
Message-ID: <CAFyQvY3oPmJzQ0PgUe=n+LyM-muo7noPLC95ksXzrE9bvQU36Q@mail.gmail.com> (raw)
In-Reply-To: <m2si572k59.fsf@andrew.cmu.edu>

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

In the event those org files are part of your org agenda, there is an
inbuilt command to do that: org-cycle-agenda-files

C-'     (org-cycle-agenda-files)
C-,    Cycle through agenda file list, visiting one file after the other.

http://orgmode.org/manual/Agenda-files.html
On Oct 19, 2015 7:06 AM, "John Kitchin" <jkitchin@andrew.cmu.edu> wrote:

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2662 bytes --]

      reply	other threads:[~2015-10-19 11:15 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
2015-10-19 11:15   ` Kaushal Modi [this message]

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='CAFyQvY3oPmJzQ0PgUe=n+LyM-muo7noPLC95ksXzrE9bvQU36Q@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --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).