emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] function to cycle through specific org files?


From: Kaushal Modi
Subject: Re: [O] function to cycle through specific org files?
Date: Mon, 19 Oct 2015 07:15:46 -0400

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" <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]