Hacker News new | past | comments | ask | show | jobs | submit login

Yes. You execute the org-babel-load-file function in your real init.el, while keeping almost all of your config in that org file.



Mostly this article, in addition to hearing about how good emacs is from various others, I want to try emacs. On that note, what you're saying sounds really useful - my .vimrc file is organized by folds to due to it's size. However, as a ~30min old emacs user, I have no idea how do do what you said. For example, is there a way to 'org-babel-load-file' when I open my init.el? When I try it by pressing M-x org-babel-load-file then typing ~/.emacs.d/init.el, I get a message "Wrong type argument: stringp, nil"

edit: would you mind posting a sample of your init.el file so I can see how you organize it?


This is the line in my .init file:

    (org-babel-load-file "/path/to/config/emacsconfig.org")

Here's a snippet of the org file:

    * Behavior
    ** Make Unique Buffer Names
    
    When two files of the same names are open, make the buffer names nicer.
    
    #+BEGIN_SRC emacs-lisp
      (require 'uniquify)
      (setq uniquify-buffer-name-style 'reverse)
      (setq uniquify-separator "/")
      (setq uniquify-after-kill-buffer-p t)
      (setq uniquify-ignore-buffers-re "^\\*")
    #+END_SRC
    
    
    ** Prevent Shell Prompt from going to the bottom of buffer
    #+BEGIN_SRC emacs-lisp
      ;; Prevent shell prompt from always going to the bottom of the window!
      (remove-hook 'comint-output-filter-functions
                   'comint-postoutput-scroll-to-bottom)
    #+END_SRC
If you think entering #+BEGIN_SRC emacs-lisp is tedious, put the following in your config:

    *** Emacs Template for Source Code Blocks
    
    I just type <se at the beginning of a line and it gives a source block
    of Emacs lisp
    
    #+BEGIN_SRC emacs-lisp
    ;; Make a template for emacs lisp.
    (setq org-structure-template-alist 
          (cons '("se" "#+BEGIN_SRC emacs-lisp \n?\n#+END_SRC\n" "<src
      lang=\"emacs-lisp\">\n?\n</src>") 
         org-structure-template-alist))
    #+END_SRC
As the comment describes, now in any org file, at the beginning of a line, type "<se" and hit TAB, and it will expand it for you.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: