Org-mode under Linux / Windows 7: How to include in agenda view same files — which reside on different places, depending on OS
我的办公室PC在Windows 7下运行,我的笔记本在Linux(openSuse 12.1)下运行。我想在org-mode的议程视图中包含某个文件" foo.org "。在Windows 7下,路径为T:/123-12/foo.org;在Linux下,路径为?/ Documents / Projects / 12-123-Projectname / foo.org
两台计算机上都有一个相同的文件" Projects.org ",其中包含我的项目以及所有计划,截止日期,铃声和口哨声。但是此文件Projects.org太大,我需要将内容交换到项目文件夹。该文件每天在两台计算机之间同步,当然两个项目也将同步。
如何在两台计算机的议程视图中包括foo.org,并在主文件" Project.org "中添加一个条目?如果是Linux / if Windows 7,是否有可能进行切换?还是可以通过符号链接来完成?
1.通过pmr编辑为https://stackoverflow.com/a/11611956/1171221的答案
我可以在每个操作系统上添加许多文件吗?例如:
1 2 3 4 | (setq org-agenda-files (if (eq system-type 'windows-nt) '("windows-path1/file1.org""windows-path2/file1.org""windows-path3/foo7.org") '("unix-path1/file1.org" "unix-path2/file2.org" "unix-path3/foo7.org"))) |
?谢谢您的友好帮助。坦白说,为每个新的" file-xy.org "更改.emacs文件很麻烦,但这似乎是org.el的设计。
关于您的答案的第二个想法:自然地,我在Linux和Windows上使用了不同的\\ .emacs \\ ,. emacs文件无法同步。我要么必须将此定义外包(可以将其以某种方式放入我的大project.org中?)到可以同步的文件中,要么,嗯,我必须添加任何其他" foo-xy .org "手动添加到相应的.emacs文件,而我不需要操作系统之间的区别。
2.编辑:解决方案
pmrs \\'的答案和评论是关键。我需要一个文件来提供Windows和Linux之间的切换。但是我在这两台机器上的.emacs文件沿不同的方向增长,因此需要花费太多精力来对齐它们。
作为另一个可以在两台机器之间保持同步的文件,我编写了我的第一个lisp文件:AW-org-agenda-files.el,基本上看起来像这样:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ;;; AW-org-agenda-files.el --- *.org-Dateien mit TODOs in agenda-view einbeziehen ;; Copyright: AW ;; Maintainer: AW ;; Keywords: customisation of Orgmode ;; Package: emacs (setq org-agenda-files (if (eq system-type 'windows-nt) '("u:/Emacs/whatever.org""u:/Emacs/Client1.org""u:/Emacs/Client2.org" "u:/Emacs/Privat.org""t:/222-2012/file.org") '("~/Dokumente/Technik-u-Dokus/Emacs/whatever.org" "~/Dokumente/Technik-u-Dokus/Emacs/Client1.org""~/Dokumente/Technik-u-Dokus/Emacs/Client2.org""~/Dokumente/RA-win/2012-222-name/file.org") )) (provide 'AW-org-agenda-files) ;;; end |
用于生成议程的文件存储在
变量
根据平台使用
1 2 3 4 | (setq org-agenda-files (if (eq system-type 'windows-nt) '("windows-path/file.org") '("unix-path/file.org"))) |
有关更多信息:C-h v系统类型RET
一种替代解决方案是为系统之间的路径差异创建变量,并为列出所有文件的变量创建变量。就您而言(忽略不遵循相同模式的最终文件):
1 2 3 4 5 6 | (defvar my/org-windows"u:/Emacs") (defvar my/org-linux"~/Dokumente/Technik-u-Dokus/Emacs") (defvar my/org-agenda-files '("whatever.org" "Client1.org" "Client2.org" "Privat.org")) |
然后您只需
1 2 3 4 5 6 | (mapcar (lambda (i) (expand-file-name i (if (eq system-type 'windows-nt) my/org-windows my/org-linux))) my/org-agenda-files) |
这不适用于具有其他路径的任何文件,但是如果路径集有限,则可以为每个位置定义一组变量,然后只需要更新该文件夹中的实际文件列表即可。铅>