1

I am trying to make emacs start on the folder where all my orgfiles are saved. I achieved this in my windows machine by changing the "Start In" field of the shortcut properties, as suggested in this SO question.

However I haven't been able to make the changes in my .emacs file have any effect on this matter on my ubuntu machine. I am still left in my home folder when emacs is opened. I have tried several options such as the ones here and here. For clarity I'll write them below:

;; Efforts to change default emacs folder
;;(cd (concat (getenv "HOME") "/Dropbox/orgs/"))
;;(cd "~/Dropbox/orgs/")
;;(setq default-directory (concat (getenv "HOME") "/Dropbox/orgs/"))
;;(setq default-directory "~/Dropbox/orgs/")
;;(add-hook 'find-file-hook #'(lambda () (setq default-directory (expand-file-name "~/Dropbox/orgs/"))))

Any tips on how can I go about this? I am using GNU Emacs 24.5.1.

5
  • 1
    Please clarify what you mean by "have any effect". E.g. with the (setq default-directory "~/Dropbox/orgs/"), what failed to behave like you expected?
    – Stefan
    Commented Dec 9, 2017 at 15:12
  • @Stefan thanks for giving it a look. I have edited the question as i was not clear. But basically I am sill left in my home folder no matter which method I tried to use to make emacs open in ~/Dropbox/orgs/ as default (or after C+x C+f)
    – brodoll
    Commented Dec 9, 2017 at 21:54
  • 2
    maybe have a look here: superuser.com/questions/249525/… Commented Dec 9, 2017 at 22:10
  • @PicaudVincent Thanks for the link. That was definitely the answer. None of the alternatives I tried worked since the startup screen changed "default directory back to the one where the welcome screen files are to be found". After adding (setq inhibit-startup-screen t)to my .emacs file they worked. I don't know the course of action here, if you'd like to make it an answer I'll gladly accept. I don't think it is a duplicate since the other question was on super user..
    – brodoll
    Commented Dec 10, 2017 at 16:43
  • 1
    @brodoll that's very kind of you. I have written my answer with the right link. I all cases I am happy it solved your problem, thanks for the feedback Commented Dec 10, 2017 at 17:00

1 Answer 1

3

According to https://superuser.com/a/478766/770454, one must disable startup-screen:

(setq inhibit-startup-screen t)

I think that the default welcome screen with the links to the tutorial etc, changes the default directory back to the one where the welcome screen files are to be found.

1
  • 1
    really helpful!
    – yanpengl
    Commented Oct 31, 2022 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.