Synchronizing files in Emacs

≡放荡痞女 提交于 2019-12-23 04:38:08

问题


I am new to Emacs and I am not very good with computing. However I discovered Emacs few weeks ago and I am absolutely amazed with possibilities that it has. I am looking forward to use it for LaTeX documents editing, some programing, creating my own elisp functions and of course creating plans and notes with org-mode. The main inconvenience for me is that I am using Emacs at several places (my laptop, home and work computers). At work I am unauthorized to install software. If i make some changes in my .emacs file or to-do list I need it to be synchronized everywhere. I am using dropbox but it is a bit annoying because at work I need to download it overwrite older one and etc. I need some practical advice on how can I synchronize some private files, that changes made in one place could be quickly loaded in other place.

P.S. sorry for my poor English :)


回答1:


Emacs is portable by design. There is no dependencies to any platform specific feature.

So, in theory, the problem you describe here boils down to a pure file synchronization problem. And if I got it right the real limitation are the corporate constraints imposed by your company.

I assume that DropBox is tedious to use because you are not allowed to use the application that created the full integration abut that you are limited ot the Web Interface... if this is the case, you may be restricted the same way for all other alternatives.

One option that I suggest in these environments is to install Emacs, or at least your .emacs folder on a USB stick (I like the micro USB sticks that looks like a mouse dongle and is hardly noticeable).

You'll be able to use emacs anywhere, and if you are concerned about backups, you can always implement a manual or automated backup solution on one of the other machine you are using and where you have more access rights.




回答2:


You can use Dropbox for sure, but you might also want to check SugarSync since it allows the option of sharing ANY file on your computer with any other device (and is also accessible online on their website).

My structure is like this:

I have a sugarsynced folder "school" where I have my LaTeX files (and pdf's) and R files that are shared. I make my homework, and in class I usually read my pdf's from my phone. Everything syncs automatically.

For my Emacs files, I use Dropbox: the good thing is that at other computers you can just make sure it looks exactly at the same folders.

You generally would like a structure as:

.../Dropbox/Emacs/.emacs

In my .emacs, you define all load-paths and requires, such as:

 (let ((base "/Username/Dropbox/emacs/.emacs.d/"))
  (add-to-list 'load-path base)
  (dolist (f (directory-files base))
    (let ((name (concat base "/" f)))
      (when (and (file-directory-p name) 
                 (not (equal f ".."))
                 (not (equal f ".")))
        (add-to-list 'load-path name)))))

You should also set a customization file:

(setq custom-file "/path-to-dropbox/.emacs.d/emacs-custom.el")
(load custom-file)

and store backups in a folder:

(setq backup-directory-alist '(("." . "/path-to-dropbox/.emacs.d/backups")))

I would suggest such a structure:

emacs-display.el    (any visual stuff)
macros.el
misc-functions.el
external-plugins.el  (file for loading external packages and adjusts settings)
keybindings.el  (all your keybbindings)

You also set mode association for loading your personal file, for example for LaTeX:

(eval-after-load 'latex '(load "/path-to-dropbox/.emacs.d/personal-emacs-latex"))

In this you can put all the customization for whenever you are using LaTeX.

.../Dropbox/Emacs/.emacs.d

In this folder the actual files stored. It becomes really easy to remove something when it wouldn't work for whatever reason.




回答3:


In terms of the tasks and events with org-mode, one option is synchronization with the Toodledo server -- there are Toodledo applications for most of the popular mobile computing devices. The library is located at the following link:

https://github.com/christopherjwhite/org-toodledo

I have modified the org-toodledo library to make it behave more like Toodledo, and in my .emacs file, I use:

(setq org-todo-keywords '(
  (sequence
  "Active(a)"
  "Next Action(n)"
  "Canceled(c)"
  "Hold(h)"
  "Reference(r)"
  "Delegated(d)"
  "Waiting(w)"
  "Postponed(P)"
  "Someday(s)"
  "Planning(p)"
  "|"
  "None(N)") ))

(setq org-toodledo-status-to-org-map '(
    ("Active" . "Active")
    ("Next Action" . "Next Action")
    ("Reference" . "Reference")
    ("Delegated" . "Delegated")
    ("Waiting" . "Waiting")
    ("Someday" . "Someday")
    ("Planning" . "Planning")
    ("None" . "None")
    ("Hold" . "Hold")
    ("Postponed" . "Postponed")
    ("Canceled" . "Canceled") ))

In addition, wherever "DONE" is mentioned in the org-toodledo library, I changed it to "None" -- which I use for completed tasks / events.

I also modified another area of the code so that I can have five (5) priorities just like Toodledo.



来源:https://stackoverflow.com/questions/13440816/synchronizing-files-in-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!