Org-mode as notebook for non-programmers - emacs

I'm a non-programmer (except of some Perl and R skills).
I'm starting my Phd this year and considering to have org-mode as a laboratory notebook. However, before I spend time learning it, I have a bunch of questions..
Most importantly, at work I'm working on a different PC than I do at home, but I use both of them for work, so what I need is a seamless connectivity.
So my idea was to store the org file on a cloud, but actually I will have files that are linked in my org-mode file, but those are actually on a server (at work) which I am not allowed to store on my cloud. This means, lets say I've got some data in a spreadsheet and want to link this spreadsheet in my org file. However, on my private PC this file does not exist. How does org-mode deal with that? Is it even possible? I mean, does it complain?
Also, there are folder on my work PC that are locked for me, so installations and stuff is usually done by the IT service. Does emacs than even work? I tried with R and it works, even installing packages from within R, however, Perl does not as executing perl scripts from the terminal requires folders that are locked.
Also, If you can recommend me good sources for getting started I will be pleased :)
Thanks in advance!

I use org-mode for lots of notes. I use different computers also. The most basic thing I do is have the most inexpensive Amazon AWS compute instance (10-15$ a month IIRC). Emacs has this great system called TRAMP mode that allows you to edit remote files as if they are local. So in my .emacs file I have:
(find-file "/ssh:ec2-user#ec2-11-222-3-444.us-west-2.compute.amazonaws.com:~/logs/year/2018/may.org")
so when I startup emacs it grabs this month's org file. I also maintain a separate directory for tasks that span more than one day:
in the may.org file:
** [[../../tasks/something useful.org][something useful]]
then in the directory:
/ssh:ec2-user#ec2-11-222-3-444.us-west-2.compute.amazonaws.com:/home/ec2-user/logs/tasks/something useful.org
This setup seems ok for my basic needs. for your second requirement you might be able to use tramp mode. You can use org-mode's link system and tramp mode together:
[[file+emacs:/ssh:someUser#otherMachine:~/someDir/TextFile.txt][TextFile.txt]]
you will need to have your ssh-keys setup so you don't have to login:
in ~/.bashrc
ssh-add ~/.ssh/my-aws-secret.pem
ultimately to get emacs to do different things on different machines you may have to get down to conditional branching:
from my .emacs file (p is for predicate):
(defun p-is-windows-os ()
(eq system-type 'windows-nt))
(defun p-is-mac-os ()
(eq system-type 'darwin))
(if (p-is-windows-os)
(setq-default ispell-program-name "C:\\Program Files (x86)\\Aspell\\bin\\aspell.exe"))
if its the same OS on both computers, you might be able to do the condition on the network IP or something.
I really like org-mode and emacs in general. But, I am hesitant to recommend them because they are so different/weird from everything else (I'm a programmer, so weird make sense). Whatever you do: backup your data! Let me know if you want more info.

I strongly recommend you look at Dr. John Kitchin materials.
He does computational chemistry, but a lot of his materials are generic enough to be useful (specially those related to paper writing).
http://kitchingroup.cheme.cmu.edu/blog/category/emacs/
he has a very informative youtube channel.
https://www.youtube.com/channel/UCQp2VLAOlvq142YN3JO3y8w
he has also created some packages to improve org. I consider John as the best source of material for a researcher wanting to use org.
I personally use org-mode all the time for my own research.
About using the cloud. Place your org-files in a common directory (e.g. Dropbox) and make sure that you enable
(global-auto-revert-mode t)
This way if a file is changed in one machine, it will be updated automatically in any other emacs running. This will avoid conflicts.
Also, learn to use org-babel. It is absolutely amazing for R. It is the hacker's version of Jupyter Notebook. This is a good tutorial:
https://orgmode.org/worg/org-tutorials/org-R/org-R.html
--dmg

Related

Run Specific Plugins for each Emacs Instance

Is it possible to have only certain plugins run when first starting emacs?
Let's say I develop in Python and also in Ruby. So I want to have one emacs instance running with Python plugins and another running Ruby plugins.
What I'm imagining is I can call rb-emacs or py-emacs from the command line.
So I think part of my solution lies here
http://stackoverflow.com/questions/2112256/emacs-custom-command-line-argument
And then I can alias the emacs call with the custom switches to one of the above
But then, how can I associate a specific plugin with a specific switch?
Am I on the right track with this? Or should I be doing something else entirely?
Edit:
Since my problem does not seem to be clear, I'll try to reiterate here. I'm not worried about long loading times. I'm worried about potential conflicts between plugins. I've used emacs before but only on a basic scale. Now I'd like to go more in depth with plugins. Though I don't fully understand how the plugins work.
Say I have a plugin (or two or three, I don't know how many it might be) for each language I code in. Won't those conflict with each other? Also, I don't want views / windows that are unneeded for that particular language.
You'll just need a different init file for each of your Emacs instances. Then you can create shell aliases for opening Emacs with those init files.
From the Emacs Wiki:
Start Emacs with a specific init file: emacs -q -l ~/my-init-file.el
Then you'll just set up a shell alias like:
alias rb-emacs=emacs -q -l ~/.rb-emacs-init.el
But why do this with separate Emacs processes? If you're concerned about the startup time, you can use lazy loading of packages or Emacs Server with Emacsclient.
I'm voting for "doing something else entirely", but I'm not 100% sure what the problem you're trying to solve is.
In general you can use mode hooks, eval-after-load, and autoload to ensure that you only load a particular elisp library when it is required.
If your problem is that you're forcibly loading everything and it takes too long, then you need to change your code so that you only load things when necessary. See OptimizingEmacsStartup.
If your problem is that you are setting global values for variables that need to have different values for different projects, then you want to be using buffer-local values for them, either via mode hooks, or using directory local variables.
What is the problem you're trying to solve?

Why use org-mobile-push/pull?

I have managed my todo-lists for some years with Emacs Org-mode and really like it.
The files are kept in a WebDAV folder on a server to keep them synced.
However, since I use more and more tablets and smartphones an app to access the files would be great - such as MobileOrg for Android.
But currently I do not understand why I have to use org-mobile-push and pull in emacs and cannot just parse and access my files with an app and edit them in a convenient way, especially when I am a few days not working with Emacs or at my Linux machine at all. Is there a reasonable explanation why the files can't be parsed and viewed without exporting them from Emacs?
MobileOrg needs to interact with Emacs through a directory on a server. The main reason for org-mobile.el to exist is for creating agenda views in a format that can be displayed by MobileOrg, and for integrating notes captured and changes made by MobileOrg back into your Emacs main system. That said, the functions org-mobile-push and org-mobile-pull are purely there to provide a sync mechanism between MobileOrg and your Emacs main system. There is nothing technically stopping you from doing your own parsing and editing the of the files. I suppose that you only have to ensure that the files remain valid Org-Mode file formats and they should work everywhere.

Emacs django-mode does not detect virtualenv

I am new to emacs, but I know how to navigate the basics.
I simply want Django integration with emacs 24 on ubuntu.
Django-mode seems to be the only game in town, but is there a tutorial that is written with more complete steps? A typical use case would be someone who is not an expert in emacs, but wants to add Django support to emacs.
I have virtualenv and virtualenvwrapper all set up properly. But django-mode is not detecting my virtualenv no matter what I do.
I have a great deal of trouble with the quoted paragraph below on Directory local variables as the documentation is poorly written.
Is this file .dir-locals.el optional? Many of his explanations are confusing. Do I need iPython? I would think not, but I'm guessing the python-shell-interpreter is not optional.
I have made a .dir-locals.el file and added my virtualenv path, but django-mode is not detecting my virtualenv. In emacs it says: virtualenv none.
There are also screenshots of a menu bar that allows alot of neat stuff like running ./manage.py collectstatic, etc....but no mention of how to activate the menu. Maybe this is a basic emacs command but I don't know it and would appreciate it if someone could show me how to set up emacs with django.
Are there any other alternatives or is django mode the way to go? Did I miss a huge chunk of documentation (like is it hiding inside emacs)
Thanks!
Directory Local variables Now we have all set there's a really
important topic to talk about and that's Directory Local Variables.
python.el is directory local variables aware and is in favor of
directory based configurations, that's why understanding this topic is
that important. So I suggest you to read the relevant part of the
manual with M-: (info "(emacs)Directory Variables").
The .dir-locals.el is a file which contains an Association List, but
don't let the name scare you, the following is a quite complete
example of what I'm using to open the current project.
((python-mode (python-shell-interpreter . "python")
(python-shell-interpreter-args .
"/home/fgallina/Code/Projects/anue-site/anue/manage.py shell")
(python-shell-prompt-regexp . "In \[[0-9]+\]: ")
(python-shell-prompt-output-regexp . "Out\[[0-9]+\]: ")
(python-shell-completion-setup-code . "from IPython.core.completerlib
import module_completion")
(python-shell-completion-module-string-code .
"';'.join(module_completion('''%s'''))\n")
(python-shell-completion-string-code .
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(python-shell-extra-pythonpaths
"/home/fgallina/Code/Projects/anue-site/anue/apps/")
(python-shell-virtualenv-path . "/home/fgallina/.virtualenvs/anue")))
http://from-the-cloud.com/en/emacs/2013/01/28_emacs-as-a-django-ide-with-python-djangoel.html
There was recent a question at Help-gnu-emacs#gnu.org whose answers pertains to your case also
http://lists.gnu.org/archive/html/help-gnu-emacs/2013-06/msg00425.html
WRT this answer only replace Pymacs by django-mode.
For the moment, just use Emacs as editor. Otherwise see some risk to end up in frustration.
IPython is great to learn Python itself, basically it provides an enhanced interactive shell. On IPython is built Enthought -- a Python Distribution providing scientists with a comprehensive set of tools to perform rigorous data analysis and visualization.
Don't see it related to Django so far.

Password on Emacs Boot Up

I was wondering whether there is a way to ask for a specific password when booting Emacs? I think I can ask for a pre-defined password which I can define in my .emacs file but I dont know how? I'm mainly interested to do this in an x- or graphical environment..
btw, I do know that the .emacs file can be seen and etc..but in my case it's not an issue.
I use epg to keep encrypted data in file. Then it simply loaded as normal emacs lisp file, as in my config. EPG will automatically ask for passphrase, and you can analyze return code of load function to determine, was loading successful or not
If I understand correctly, you are in a situation where multiple people share the same account on a computer -- that is, not only will they run the same emacs binary, they also have the same home directory where Emacs searches for the .emacs file.
It seems like you not only want to prevent others from reading the .emacs file, you actually don't want them to be able to run emacs at all.
Unfortunately for you, Emacs can be started with -q or -Q in which case the .emacs file is not evaluated at all. Thus any "protection" that relies on your .emacs file can easily be circumvented.
How about restricting access to the emacs binary instead? Maybe make it only executable for members of a certain Unix group (which of course is pointless if multiple people share the same account), or something along those lines. But note that this will not prevent them from installing their own local copy of Emacs.

How can I get emacs to chmod new files to executable if they have a certain extension?

I often write small perl scripts to solve various problem of to explore perl behavior.
I use templates for .pl files which is nice. it autopopulates the basics into my buffer.
A small annoyance is that whenever I do this, before running it, I have to
chmod ugo+x
Can I get emacs to do this automagically for me (based on the file extension)?
Of the solutions on the page to which Trey has linked, by far the best is:
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
I've been using this for many years and have almost never needed to make a script executable by hand in that time.
How about the solutions offered on this page, they key off the fact that the file begins with #!. There's also a package that does this, shebang.el (which I happen to use). You could easily change the code to make the condition that the file name extension be .pl, but looking for #! is probably more generic.