27

They changed the template system in orgmode 9.2. The new mechanism is called structured template. The command org-insert-structure-template bound to C-c C-, gives you a list of #+begin_-#+end_ pairs that narrows down while you type and you can use completion. But, you can also get the old easy template system back, either by adding (require 'org-tempo) to ...


6

There are a couple of options for this, to me the easiest way is grouping templates using the built-in mechanism. My way to use capture templates is based in memory muscle rather than digging a long menu, so how the menu is displayed should be concise in case I don't recall what key was for something. I do call capture using F12, then if I want to insert a ...


4

You could use this version of the function: (defun journal-entry () (interactive) (let* ((daily-name (format-time-string "%Y-%m-%d)")) (journal-path "~/Dropbox (Personal)/journal/") (journal-file (concat journal-path daily-name ".md"))) (find-file journal-file) (unless (file-exists-p journal-file) (insert "JOURNAL" "\n" ...


4

You can use the templating system of org-mode. If you insert the following lines at the end of your init.el file: (add-to-list 'org-structure-template-alist '("P" "#+TITLE:\n#+OPTIONS: html-postamble:nil whn:nil toc:nil nav:nil\n#+HTML_HEAD:\n#+HTML_HEAD_EXTRA:\n\n? ")) After you restart emacs or source your init.el file, you only have to ...


4

You'll want to take a look at Agenda Views, Org-Mode Capture Templates and / or YASnippet. With Org-Mode you can set up capture templates for various tasks and for different target locations, and consolidate all that information in Agenda Views. Morever you can quickly store notes with little interruption to your workflow. There's a wealth of information ...


4

See standard library auto-insert.el, which is part of Emacs. To use it, customize options auto-insert and auto-insert-directory, then do this: (add-hook 'find-file-hook 'auto-insert) auto-insert is a variable defined in autoinsert.el. Its value is not-modified Documentation: Controls automatic insertion into newly found empty files. ...


3

At @Drew's suggestion, here's a short example of combining YASnippet and auto-insert to achieve dynamic or interactive boilerplate. From my ~/.emacs.d/init.el: ;;{{{ yasnippet & auto-insert (use-package yasnippet :config (add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets") (yas-global-mode 1)) (defun nega/yas-cmake-bp () (interactive) (yas-...


2

Try adding :empty-lines 0 to each template's set of properties. Zero is in fact the default value, so it would be strange if this was the solution, but maybe worth a try.


2

You may want to check out this example wherein the author suggests this define-skeleton: (define-skeleton org-skeleton "In-buffer settings info for a emacs-org file." "Title: " "#+TITLE:" str " \n" "#+AUTHOR: Your Name\n" "#+email: your-email@server.com\n" "#+INFOJS_OPT: \n" "#+BABEL: :session *R* :cache yes :results output graphics :exports ...


2

You can't do this with the t%^ template format strings. You can however call org-set-property when your template is constructed using the %(func) syntax. When called interactively org-set-property prompts for both the property and the value. Here's a simple example: (setq org-capture-templates '(("P" "Property" entry "* %? %(call-interactively #'...


2

You can specify a vector of actions for each entry in auto-insert-alist. This way you can insert the contents of the template file with the first action and then use a function that searches the new file for special elisp forms that are to be replaced with their evaluated results. Below you find the source code for one such function. You just wrap your code ...


2

As described by Tobias, I had to (require 'org-tempo) in .emacs. Additionally, I had to remove any customization to org-structure-template-alist or revert it to standard. Then, C-c C-, triggers Org-Select menu for structure feature selection and <s triggers the usual src block directly. For org-version 9.3.7, emacs 26.3


1

This solved my problem: http://bald.cat/slimhtml I hope this can also be of use to others. It allows one to define classes and ids etc while still in the org buffer.


1

This seems to do the required trick. Found the jk-org-insert-time-stamp function here: https://emacs.stackexchange.com/a/27323/20123 . * PROJ %(progn (defun jk-org-insert-time-stamp (time-string) (interactive "sTime: ") (let ((default-time (apply 'encode-time (decode-time)))) (org-insert-time-stamp (apply 'encode-time (org-read-date-analyze ...


1

I found the solution although I must admit, I still don’t see, why this problem never occured in Org outlines I typed in directly: The custom-set-variable is called org-adapt-indentation and it has to be set to nil. In other words, after I added: '(org-adapt-indentation nil) to my .emacs file I finally got rid of the white space (actually the indentation) ...


1

You are looking for org-capture-before-finalize-hook. (defcustom org-capture-before-finalize-hook nil "Hook that is run right before a capture process is finalized. The capture buffer is still current when this hook runs and it is widened to the entire buffer." :group 'org-capture :version "24.1" :type 'hook)


1

Maybe not exactly what you are expecting as not in .emacs file, but in another Org file, the solution I use for a long time is to use #+SETUPFILE: In your .org files: #+SETUPFILE: path_to_your_setup/setupFile.org #+TITLE: My Org document In the path_to_your_setup/ directory (your project root for instance), my setupFile.org is: #+OPTIONS: H:3 toc:t num:...


1

I don't know how much elisp you know, so I'll post this for whoever can use it. I have not tested this code, but here's another defun (modelled after the one above) that will copy N of your favorite templates into a new project directory, creating xxx_main.tex, xxx_coverpage.tex, etc. There are more flexible and sophisticated ways of doing this, but I just ...


1

It seems to me that you could do all that with some elisp programming. It doesn't sound too hard to me (mostly some keys bound to defuns that will copy / open / insert / write-out the files that you are talking about. Maybe with a comint call to the operating system, if need be. For example, here's my code that I use for fetching / inserting various code, ...


1

Library header2.el is generally for file headers, which use only code comments (see automatic file headers). But it really is about adding and updating (including automatically) boilerplate text that you define. That text need not be comment text. And it can be mode-specific or be applied conditionally in any other way.


Only top voted, non community-wiki answers of a minimum length are eligible