New answers tagged

0

Answering my own question here. I suspected that org-refile was the way to go (thanks @lawlist), but I couldn't get it to refile a tree at the topmost (i.e., headline) level. I turns out that I need to do this: (setq org-refile-use-outline-path 'file) That allows me to refile at the top level.


0

This function maps through all headings with todo state ✔ and inserts the todo state and tags as described (as long as I have understood it correctly): (defun my-org-prepare-for-markdown-export (&optional _backend) "Insert a line below all headings with todo state ✔. The line has the following format: tags: #✔ , #tag1 , #tag2 , ... Existing org tags ...


0

It seems there's no way for org to do this right now. But I've sent a patch to the org-mode mailing list; the change to org-clock.el is quite simple: https://lists.gnu.org/archive/html/emacs-orgmode/2020-01/msg00175.html


0

I found a way to do this, I'll post for anyone who has the same issue in the future. The method I found is using both a python source block and a latex source block. #+name: gradient_potential_py #+BEGIN_SRC python :exports none :results output :cache yes from sympy import symbols, diff, latex x, y = symbols('x y') U = x * y print(latex(diff(U, y)), end='...


1

Look at org-collector http://orgmode.org/worg/org-contrib/org-collector.html. This collects properties in a table, where you can then do calculations.


0

I have tested this in Emacs 28.0.50. Emacs displays the line you have given in the same colors regardless of whether org-hide-emphasis-markers is set to t or nil. Hence, org-code and org-verbatim are given priority over the foreground color of org-level-1. (They are shown in grey not blue.) With org-hide-emphasis-markers set to t what is not visible are the ...


0

This is a hack, but you can mostly get the numbering right by making the first section unnumbered. In other words, this source file: * Foo :PROPERTIES: :UNNUMBERED: t :END: * Bar * Baz will result in this table of contents: Foo 1. Bar 2. Baz It's not super ideal, but it's the best I've been able to do without hacking the org-mode source code.


2

If a region is active org-md-export-as-markdown exports the region only. So we have to loop through each headline set the active region export the region to a markdown buffer and finally use the title to save it (defun my-org-export-each-headline-to-markdown (&optional scope) "Export each headline to a markdown file with the title as filename. If ...


0

Given a timestamp of 2019-12-12, you can specify ++15d (note the double plus) to move forward to 2019-12-27, then you can specify ++1m to move forward to 2020-01-27. See the section of the manual entitled The date/time prompt: With a single plus or minus, the date is always relative to today. With a double plus or minus, it is relative to the default date....


7

One option is to check the source. M-x find-library outline You'll find in the header comments: ;; Copyright (C) 1986, 1993-1995, 1997, 2000-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. M-x find-library org ;; Copyright (C) 2004-2019 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. So, both are ...


3

You are setting your deadline incorrectly. The normal way of setting a deadline is as follows: * MY-TEST :GENERAL: DEADLINE: <2020-01-13 Mon> Your entry should thus look like this: * TODO TEST :GENERAL: DEADLINE: <2020-01-13 Fri> :PROPERTIES: :ADDED: [2020-01-14 Tue 16:47] :END: DEADLINE is not an ordinary org property.


3

That is one of the main pillars of babel. Give the C source block a name if you want to use in the variable assignments of another source block. You input the result of the C source block to another source block by the :var header argument. The python source blocks are described at https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html. ...


1

It looks like this works out-of-the box with Emacs 26.3 and Orgmode 9.1.9. Source blocks and code snippets are not highlighted by flyspell with that Orgmode version. Maybe, you should just update. To address the general problem: You can ignore corrections proposed by flyspell by adding a function to flyspell-incorrect-hook. This hook already exists since ...


1

Check the current font face at point, if it's org-verbatim or org-code, then set the predicate's return value to nil. So Emacs knows the word at point is NOT a typo. Here is the function to test font face at point, (defun font-belongs-to (pos fonts) "Current font at POS belongs to FONTS." (let* ((fontfaces (get-text-property pos 'face))) (when (not ...


1

C-c C-c evaluates the code which adds the function to the hook, but the hook is not run: you need to close the file and reopen it in order for the hook to run. Or you can add this to the code block: (run-hooks 'org-mode-hook) That will run the hook, which will do the local-set-key to set the mouse click to your function.


0

As a comment to the answer by wing (but not enough reputation points to comment), org-emphasis-alist is a customizable variable so that it can be customized via the customization menu. It is found in the Org group under the subgroup Org Appearance. Modifications applied via the customization menu should be persistent over sessions.


1

There is an org-mode FAQ about this here. The recommendation is to use a command to generate a separate task for each day. That might seem heavyweight, though the FAQ suggests reading this blog post for the pros of this approach. Since the task only shows up on the agenda once (it regenerates every time it is completed), the impact of the infinite ...


2

The following code renames the buffer to the value of #+TITLE: when you open the Org file. This is the most simple version. It does not update the buffer name when you add or change the title. But in that case you can call org+-buffer-name-to-title directly if you really need it. (defun org+-buffer-name-to-title () "Rename buffer to value of #+TITLE:." (...


1

The documentation says that org-file-apps should be a list of cons cells but you have supplied a single cell instead. Solution: one more set of parens: (setq org-file-apps '(("\\.xlsx\\'" . "excel %s"))) You now have a list containing a single cons cell and org-file-apps should be happy.


0

Try usimng ipython blocks instead of python (#+BEGIN_SRC ipython) and add the following line to your first source block: %matplotlib inline Note - I'm not sure if this will work with Spacemacs, but it is what scimax is all about. I used Spacemacs for about 6 months for python and jupyter notebooks before I switched to scimax for org-mode and never looked ...


0

I'm not sure how this is specific to Org. If you write a script that changes state dependent on current state, and don't unchange/reset the state elsewhere in the script, and repeatedly run the script, the state will be changed each time you run it. What about cd ${project_root}/mygitproject?, where ${project_root} is absolute? If you use the absolute path, ...


0

Why not set the variable org-scheduled-delay-days?


0

I ended up finding the following solution. I found a base solution on reddit that adds a "fake" language to babel as follows: (add-to-list 'org-src-lang-modes '("latex-macros" . latex)) (defvar org-babel-default-header-args:latex-macros '((:results . "raw") (:exports . "results"))) (defun prefix-all-lines (pre body) (with-temp-buffer (insert ...


0

Change the leading apostrophe to a backquote on the template list. It will work then, no lambda needed!


2

When I evaluate the inline src block: src_sh[:results value :exports code]{git --version} I get the following in my org mode buffer: src_sh[:results value :exports code]{git --version} {{{results(=git version 2.24.1=)}}} If you get the same thing, then the only thing you have to do is define a macro that will do what you want: #+MACRO: results returning ...


0

Another trick is to find the bounds of what you want to clear, and then move to the END and keep deleting the previous character until the value of point is smaller than the value of START. You may also want to preserve metadata information by setting the optional argument to a non-nil value. (defun clear-subtree (&optional metadata) (let (start) (...


0

It is actually explained in the docs that it is possible to simply override the enforcement of todo dependencies by using the C-c C-t command with triple prefix argument: C-u C-u C-u.


2

Your setting is incorrect, C-h v org-capture-templates: When using several keys, keys using the same prefix key must be together in the list and preceded by a 2-element entry explaining the prefix key, for example ("b" "Templates for marking stuff to buy") so you need to put something like ("p" "Project Tasks") right before your "pn" template, for ...


0

Please refer to this answer for all the gory details. The default post set of characters in org-emphasis-regexp-components is -[:space:].,:!?;'\")}\\[ i.e. dash, the :space: character class, period, comma, colon, exclamation mark, question mark, semicolon, single quote, double quote, closing paren, closing brace, backslash or opening square bracket. Any of ...


1

As you have found out, adding a space between the em-dash and the slash renders the italics properly (both in the buffer, if you use a font that has a slanted version; and in the exported file, be that PDF or HTML or ...). The reason that works is the setting of org-emphasis-regexp-components. This is a complex variable: it is a list of various parts which ...


0

As you might know, org-mode files are plaintext-based and heading depth is determined by the number of * characters in front of it This means you can simply insert a * in front of all headings you want to be demoted in plaintext instead of relying on org-mode functions. You don't even need to exit org-mode for that. The easiest way to do this I know of is ...


2

This issue is related to recent changes in org-mode (i.e. org 9.3). In the latest change log they mentioned that: :file header argument no longer assume "file" :results The "file" :results value is now mandatory for a code block returning a link to a file. The :file or :file-ext header arguments no longer imply a "file" result is expected. So, one ...


1

I have not found a builtin way to accomplish this "easily", so I wrote the following two functions which can manually be invoked to change the status of all todo states in a subtree to CANCELLED and back. You can use undo right after cancelling to reset it but this won't work some days later, therefore the uncancel-function. IMPORTANT: This includes ALL ...


0

Following @lawlist's comments, C-h k <M-LEFT> on an org-capture buffer shows that the key is bound through org-mode-map. I overrode the keybinding of M-LEFT to a function that checks if the current buffer is an Org-capture buffer: (defun my-org-is-buffer-org-capture() "Checks if the current buffer is an org-capture buffer." (string-match-p (regexp-...


2

I think you need to put a name on the block like this: * Heading Some text ** Subheading some text #+name: Lorem #+BEGIN_PROSE Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. #+END_PROSE some text * Heading with link to Lorem Here is the link: [[Lorem]].


2

I ended up doing it in Python and I display it in the terminal. Code at https://gist.github.com/rougier/d559fbd766da14540e8eb47435a5782d


1

Just insert a dedicated target <<lorem>> at the place where you would like to jump to with [[lorem]]. It's clear that John Kitchin's solution works with blocks. What I meant is: * Heading Some text [[lorem]] ** Subheading some text #+BEGIN_PROSE Lorem <<lorem>> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ...


0

In the mean time I discovered some inf-... file on my system. (i.e. inf-lisp.el). From the contents of the file I found that the file defines an inferior lisp mode so that I understand that an inf-... file defines an optional inferior mode that can be used by the extension.


1

This jumps to the first heading with property ID1 set to VALUE in the current buffer: (goto-char (org-with-wide-buffer (org-find-property "ID1" "VALUE"))) Found that function from looking at the source of org-find-entry-with-id.


0

This will work whether you are currently in the Agenda buffer or not: (defun my-org-mode-autosave-settings () (add-hook 'auto-save-hook 'org-save-all-org-buffers nil nil)) (add-hook 'org-mode-hook 'my-org-mode-autosave-settings) This is based on Karim's and Sigma's answers.


0

I am answering my question that I asked long time ago. A new package which name orq-ql is also lead us to desired situation. Additionally provides many like filtering, ordering etc on-the-fly. You can use code block at below, also interactive M-x org-ql-view allow us some default filtering methods. (org-ql-view "Today")


0

[Collecting the comment interactions into an answer; thanks to @dangorn for discovering this solution] You are using an outdated version of Org that did not yet support #+SUBTITLE (if you check the value of org-latex-subtitle-format with C-h v org-latex-subtitle-format RET it will be undefined). To fix, update your Org Mode (see MELPA and use-package).


0

Adding this in your init.el should do the trick: (advice-add 'org-meta-return :before #'expand-abbrev) (advice-add 'org-meta-return :before #'org-insert-heading-respect-content)


0

There is no command that I am aware of. But one can adapt the code of org-move-item-down to that task: (defun org+-kill-list-item (&optional delete) "Kill list item at POINT. Delete if DELETE is non-nil. In interactive calls DELETE is the prefix arg." (interactive "P") (unless (org-at-item-p) (error "Not at an item")) (let* ((col (current-...


0

Turns out org-mode provides a function to retrieve existing refile targets, which means if it's OK to set org-refile-targets, we can just let org-mode do the hard work of creating the RFLOC variable. This means the code I need is just the following. I go through the generated refile targets and I find the one heading that matches what I am looking for - in ...


0

The org-tab-first-hook hook runs as the first action when TAB is pressed, so you need a function that checks if (1) the point is inside a src block and (2) the language is not found. If both conditions are true, indent to column 4. To insert 4 spaces literally, change the indent-to expression to (insert (make-string 4 ?\s)). (add-hook 'org-tab-first-hook ...


0

You can also customize the variable org-activate-links with a local value by putting this line at the beginning of the file: ;; -*- mode: org; org-activate-links: '(angle plain radio tag date footnote); -*-


1

You must escape such constructs in example blocks. The Literal Examples section of the manual states: There is one limitation, however. You must insert a comma right before lines starting with either ‘*’, ‘,*’, ‘#+’ or ‘,#+’, as those may be interpreted as outlines nodes or some other special syntax. Org transparently strips these additional commas ...


0

Somewhat hard to find, but you can just use foo \under foo or foo\under{}foo.


1

I figured it out. Removing +org-cycle-only-current-subtree-h from the org-tab-first-hook list of hooks restores 3-state cycling: (setq org-tab-first-hook (delete '+org-cycle-only-current-subtree-h org-tab-first-hook))


Top 50 recent answers are included