Emacs orgmode Todo item automatically generates property drawer - emacs

I use Emacs org-mode to organise my todo list. Recently I found under each todo item it automatically generates a property drawer containing a key ID and the corresponding value, something like this:
** TODO meeting XXX
SCHEDULED: <2014-07-12 Sat 14:00>
:PROPERTIES:
:ID: 46673B08-F9D9-4966-B70A-A2ADBC2ADE0E
:END:
Entered on [2014-07-08 Tue 20:40]
I have no idea how this property drawer is generated, and I did not have it before. If delete it, next time I start Emacs to read the file, it will come back again. What would I do?

Would you have used MobileOrg? If yes, that's the culprit (and that clutter is something more that keeps me away from using MobileOrg ATM).

Posting your configuration file would definitely help diagnose what's causing this. For some, this is the desired behavior of the org-id package, which is explained in Handling Links in the Org-mode Manual:
The library org-id.el must first be loaded, either through org-customize by enabling org-id in org-modules, or by adding (require 'org-id) in your .emacs.
An init.el / .emacs file that enables this functionality, might for example, include the following:
;; Use global IDs
(require 'org-id)
(setq org-id-link-to-org-use-id t)
;; Update ID file .org-id-locations on startup
(org-id-update-id-locations)
Additionally, you could check your .emacs.d directory to see if there is a .org-id-locations file, which is generated by the org-id package.
To disable this behavior, you should remove all org-id package related code from your configuration files.
It's likely that this behavior occurs every time you use (org-store-link), commonly bound to C-l l. You might also want to check out Assign IDs to every entry in Org-mode

Related

org-mode: Possible to save Agenda Global TODO list order?

I'm new to org-mode and wondering if after editing the order of items in the Global TODO List, if you can save that preferred order.
I've tried C-x C-s but that doesn't seem to do anything. Thanks in advance!
It isn't possible to save this. The footnote for
org-agenda-drag-line-forward in the manual
((info "(org) Agenda commands")) says
(2) Moving agenda lines does not persist after an agenda refresh and
does not modify the contributing ‘.org’ files
The command doesn't save any information to make this persist. I
think reordering the original Org file and setting
org-agenda-sorting-strategy is the only way to get sorting changes to persist across agenda calls.

reference unique id across emacs org-mode files

I have several .org files, and I'd like to be able to create links between them using an ID. I am using DOIs as unique identifiers. I can link within a file by using properties:
* Paper 1
:PROPERTIES:
:CUSTOM_ID: 10.1088/0953-8984/23/21/213001
:END:
* Paper 2
:PROPERTIES:
:CUSTOM_ID: 10.1038/nphys2935
See also [[#10.1088/0953-8984/23/21/213001]]
Is there a way to make the custom_id global, so I can reference it from another file?
I think that org-id is what I need to go further, but I've found the documentation a little confusing. I tried adding the following lines in my .emacs
;; Use global IDs
(require 'org-id)
(setq org-id-link-to-org-use-id use-existing)
;; Update ID file .org-id-locations on startup
(org-id-update-id-locations)
but the file .emacs.d/.org-id-locations only has nil.
It seems like global links won't be automatically generated (Assign IDs to every entry in Org-mode). I tried (with cursor on the heading) to use M-x org-id-get-create, but this does not seem to do anything.
EDIT: (Based on helpful comment)
Within one session, I can store and create links using M-x org-store-link while on the heading (Paper 1 in my example above). Then I can use M-x org-insert-link, and type the ID to insert the link. The link looks like [[id:10.1088/0953-8984/23/21/213001][Paper 1]]. But I am running into two problems: (1) I'd like the ids to be stored automatically. (2) The links don't work when I close and re-open the file.
EDIT: A related question:
https://emacs.stackexchange.com/questions/2186/have-org-modes-exported-html-use-custom-id-when-linking-to-sub-sections-in-toc
So here's the solution I came up with.
In my .emacs configuration, I have kept the same settings as in my question:
(require 'org-id)
(setq org-id-link-to-org-use-id use-existing)
;; Update ID file on startup
(org-id-update-id-locations)
The files need to be part of the agenda list (or added to the list of additional files using org-id-extra-files (See org-id documentation))
Use ID instead of CUSTOM_ID in the PROPERTIES drawer:
* Paper 1
:PROPERTIES:
:ID: 10.1088/0953-8984/23/21/213001
:END:
Each ID needs to be created (if necessary; in my case I already have them), and a link added to the ID file (links are stored in .emacs.d/.org-id-locations). This is done using org-id-get-create: with the cursor on the heading, call it using
M-x org-id-get-create
Link to an ID using [[id:10.1088/0953-8984/23/21/213001][Paper 1]].
I have to think a little bit more about when I'd like the ID to be created; I can automate the process by tying the ID storing to another function that I'll do to all the headings.

Is it possible to prevent emacs from creating " .#files " [duplicate]

When I modify a buffer, Emacs automatically creates a temporary symlink in the same directory as the file being edited (e.g. foo.c):
.#foo.c -> user#host.12345:1296583136
where '12345' is Emacs' PID (I don't know what the last number means).
Why does Emacs create these links, and how do I prevent it from doing that?
Note that I have turned off auto save mode (M-x auto-save-mode) and disabled backup files (M-x set-variable -> make-backup-files -> nil). When I save a modified buffer, or undo the changes to it, the symlink disappears.
In particular, I'm trying to prevent Emacs from creating these links because they cause the directory timestamp to be modified, which causes our build system to rebuild an entire module instead of compiling and linking for one changed file :/
Thanks for any input!
Update: In order to prevent Emacs from creating interlocking files permanently, you can change src/filelock.c and build a custom binary:
void
lock_file (fn)
Lisp_Object fn;
{
return;
// Unused code below...
}
Update 2: Arne's answer is correct. It's now possible to disable lock files in the latest Emacs (24.3.1), by adding this to your .emacs file:
(setq create-lockfiles nil)
Update: Emacs 24.3 has been released with full support for this new setting!
In the current trunk of emacs, you can simply customize the variable create-lockfiles:
C-h v create-lockfiles
Documentation:
Non-nil means use lockfiles to avoid editing collisions.
In your init file, you can set
(setq create-lockfiles nil)
Get it via
bzr branch bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk
make
src/emacs
(I found out about this, because I decided to get active and just add an option like that myself… :) )
The symbolic link is emacs' file interlocking system: the symbolic link indicates that an instance of emacs is editing this file. If another instance tries to edit the same file, emacs will issue a warning. See http://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html
This has nothing to do with auto-save.
I cannot find how to modify or disable file locking from within emacs.

emacs color-theme by buffer

I'm in love with emacs. I don't believe there is anything one can't do with enough effort!
I have just fine working scripts/extensions installed that could be relevant to get my point:
org-mode (with a CAPTURE-TEMPLATE named "Journal")
color-theme (emacswiki)
theme-changer (github)
color-theme-buffer-local (github)
emacs-version: "GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-03-25 on roseapple, modified by Debian"
Whats already working fine
When I'm starting a journal-entry trough my defined shortcut, what happens is the following:
emacs opens a new buffer("CAPTURE-journal.org") in a new window
I edit it
with another keystroke the entry gets refiled to my defined journal.org file
the buffer and the window are then closed automatically
I continue working on the file I worked before
What I want it to do additionally:
the "CAPTURE-journal.org"-buffer in the new window should have a unique color-theme, lets say color-theme-retro-orange
My .emacs with the code snippet I believe should be relevant.
I have no idea how to tackle this task. Where does one begin editing? Are even all tools needed for this listed above?
Seen from scratch: you need a list with color-themes
(setq my-themes (list "color-theme-retro-orange" "second-theme" "third...))
than you need a pointer, storing position used last.
See Emacs Lisp Intro chapter of kill-ring-save
When finished, bind that function at a suitable place, where-from your buffer is opened, resp. load it with the stuff mentioned by OP.
Or create a minor-mode, which will all new buffers provide with this.

Emacs how to auto-complete words of include files on C?

How can I make Emacs to complete words that are in C include files ?
#include <stdio.h>
int main(){
print//<-- this is where I want it to complete printf
What's the simplest way? (something simpler than Cedet)
First generate tags for the source and include files you'd like to be able to autocomplete for. See my blogpost for tips on using tags if you didn't use tag tables before.
Now if you have a TAGS table that includes the stdio.h, then you can autocomplete 'printf' using the command `complete-tag'.
Perhaps bind `complete-tag' to a key:
(global-set-key [f3] 'complete-tag)
Unlike complete-tag, dabbrev-expand, or hippie-expand (which does dabbrev-expand like things), the CEDET suite does exactly what the question describes. When asked to perform a completion, it looks and sees that you have included stdio.h, and then looks there for possible completions.
CEDET does a lot of other things related to completion as well which will provide very focused and correct suggestions, not just vaguely similar suggestions. A side affect is that CEDET takes more effort to setup. You need to teach it where you include files are, for example, and sometimes how to deal with macros, and what the project you are working on is like.
There is more detail on this here:
link text
You might want to try out M-/ (dabbrev-expand). This command attempts to complete the identifier immediately preceding the point (ie, where your cursor is) using the contents of the current buffer and then the contents of other buffers of the same mode. If the first completion offered isn't the one you want, just keep typing M-/. If you have the habit of keeping a single emacs session open continuously (which, if you don't have, you should really acquire), and have a handful of files from the current project open, you're quite likely to be able to find an the expansion you want for any particular prefix.
So, to answer you're original question, M-/ will find the printf completion you're looking for if (a) you've used printf anywhere else in the buffer you're editing, or (b) it appears in any other .c or .h file you have open in emacs.
You might also try hippie-expand, which has additional options regarding where it looks for completion information. I bind M-/ to hippie-expand, and then modified the order of the elements in hippie-expand-try-functions-list as follows:
(global-set-key (kbd "M-/") 'hippie-expand)
(setq hippie-expand-try-functions-list '(try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol))
This makes hippie-expand act like the normal M-/ at first, but repeated presses will yield more possible expansions.