Emacs on MS Windows and Opening Files
Working mostly in the MS Windows environment i keep notes, project records in org and these files have multiple links to documents, images, saved mails etc and most are stored with hyperlinks (though i may now be migrating to attachments) but when it comes to opening the links then it takes a little extra work. When using helm and initiating links by C-c C-l
and choosing file
this allows me to select files from a list and use completion support to narrow down the list of files. However the file+sys
option does not, so i always chose file
, used helm to help find it, insert the link and then edit it to add the +sys part.
Well not anymore, i stumbled upon the following code;
https://stackoverflow.com/questions/11553123/linking-to-files-on-windows-network-share
emacs-lisp code snippet start
(mapc (lambda (file-name-matcher)
(add-to-list 'org-file-apps
(cons file-name-matcher 'default) 'append))
(list "\\.doc\\'"
"\\.xls\\'"
"\\.ppt\\'"))
emacs-lisp code snippet end
adding this to my dotemacs file means files open without the need for the file+sys
making my life much easier, my modified version adds more file formats
emacs-lisp code snippet start
(mapc (lambda (file-name-matcher)
(add-to-list 'org-file-apps
(cons file-name-matcher 'default) 'append))
(list "\\.doc\\'"
"\\.docx\\'"
"\\.xls\\'"
"\\.xlsx\\'"
"\\.ppt\\'"
"\\.pptx\\'"
"\\.msg\\'"))
emacs-lisp code snippet end
Now i can work with attachments because i’ve also found out how to add per file folder setting for attachments so by this i mean each org file i have is saved with its project name ie
- project_a
- project_b
before i’d create a directory and then manually copy in my files for linking to, now with this at the end of my org files under the heading local variables;
org code snippet start
# local variables:
# org-attach-direction: "project_a/"
# end:
org code snippet end
if i add an attachment the folder if it does not exist is created and the file is stored within it.