New answers tagged

2 votes

Buffer name in the status bar / mode-line is too long. How do I trucate it?

When in the org-mode buffer do, M-: and enter the following when prompted (setq mode-line-buffer-identification '(-12 "%b")) You will see the buffer name truncated to a width of 12. ...
1 vote
Accepted

Control font and color in spans of org-mode text?

To get this Level-based fontification of list items + Ad-hoc emphasis with org-extra-emphasis do this Install org-extra-emphasis. Use `org-extra-emphasis’ , when you need more Emphasis Markers in ...
1 vote
Accepted

How to start scratch buffer with olivetti, org-mode and exotica theme altogether?

Presuming you've already installed olivetti and exotica-theme, I would write a function that does steps 1, 2, and 3, and then call it towards the end of your initialization file. (defun my/initial-...
  • 351
1 vote

How to get JSON response only from an ob-restclient block

I know it has been a long time since this was asked, but in the current version of ob-restclient (20220819.2228), I am able to show only results by using the :jq option: #+begin_src restclient :...
0 votes

org capture datetree: active timestamp for the day heading

You might want to try customizing the option org-datetree-add-timestamp to t. That will not make the date you want active, but it will add an active timestamp to the entry on the next line: that ...
  • 21.2k
0 votes

Automatically Mark risky file-local-variable safe?

Took me a while to figure it out, but you can mark particular values for a variable as safe. You can set the option using the handy menu (Options->Customize Emacs->Specific-Option and search for ...
  • 197
1 vote

org-mode datetree forward one day in the future

You could also navigate to the day (tomorrow) in the Agenda view and press k for bringing up the capture templates. The date from the Agenda will be used then for the datetree.
  • 111
2 votes
Accepted

Highlight org headline text only if org-level is less than 3 and has-children

To get this MY-ORG-LEVEL is 2 MY-ORG-LEVEL is 3 do this Copy the snippet below to my-fontify-headline.el (require 'org) (require 'ox) (add-hook 'org-mode-hook (defun my-org-mode-hook () (...
2 votes
Accepted

format old file to org-indent-mode

I roughly made two functions that add or remove hard indentations. (defun org-add-hard-indentation (arg) (interactive "p") (save-excursion (beginning-of-buffer) (while (...
  • 36
2 votes

How to visit the source code block of the noweb-ref at point?

I would recommend that you name your source blocks with #+name: foo e.g.: #+name: globals #+begin_src elisp globals #+end_src #+name: aliases #+begin_src elisp aliases #+end_src #+name: bar #+...
  • 21.2k
0 votes

Org-mode checkbox, How do i extract the checked values?

Here's a more general solution for getting checked box values from NAME. (defun get-checkbox (name) (let (items) (org-element-map (org-element-parse-buffer) 'plain-list (lambda (...
  • 3,549
1 vote

How to visit the source code block of the noweb-ref at point?

@NickD's answer is more standards compliant given that it utilizes orgmode's internal mechanism. Meanwhile, I had also put together a function that will visit the noweb-ref without the necessity of ...
  • 123
1 vote
Accepted

Highlight org-level-color-stars-only from org-level-2 onwards

There are too many moving parts in face customization .... I have added comments in the code for what the arg n means. (NOTE: The param n is not the level, but n is the regex group.) You can compare ...
0 votes

Org-mode checkbox, How do i extract the checked values?

Are you new to org-mode? Project 1 [x] module 1 [x] module 2 [] module 3 [x] module 4 This is not at all a checklist ... You need to take sometime to read the manual, and the habit of ...
0 votes

Org-mode checkbox, How do i extract the checked values?

This response has to be read in conjuction with https://emacs.stackexchange.com/a/73824/31220 Copy the below snippet to todo.json Put your cursor on #+begin_src emacs-lisp ... and do C-c C-c. Ensure ...
0 votes

Org-mode checkbox, How do i extract the checked values?

I am assuming that you aren't comfortable with elisp, but can work with javascript. The snippet below gets you from elisp to json. How you manipulate that resulting structure to a form that fits your ...
1 vote
Accepted

How to remap org-capture-templates keybindings?

There are two things going on here: How to open a particular template from lisp How to bind a function to C-i. For the first, note that org-capture takes an optional argument to set the template. ...
0 votes

In orgmode, how to add html attributes to a link inside a header?

You can't. Org mode syntax DOES NOT ALLOW one to apply attributes to a span of text in the middle of a paragraph. That is, attributes can be added only to the whole paragraph (via +attr_*:) and to ...
0 votes

Get description of an org-mode link

There exists (org-link-display-format s), which replaces all links in s with there description. For your case you than just need to add the brackets where you want them: (concat "[[" (org-...
  • 101
1 vote

orgmode: link to id doesn't work

The org-id file associations are stored in org-id-locations-file. You should be able to refresh them using org-id-update-id-locations, which will rescan all agenda files, all associated archives, all ...
  • 11
0 votes

Automatically remove tag

You can use the org-after-tags-change-hook hook to remove TAG1 conditionally. (defun remove-tag-if (&optional remove-tag1) (let ((tags (org-get-tags nil 'local))) (when (or (and remove-tag1 (...
  • 3,549
1 vote
Accepted

Org-cycle with TAB from isearch without RET

If you want TAB to exit Isearch and do its regular (non-Isearch) thing, then just bind it in isearch-mode-map to isearch-exit (the same function RET is bound to): (define-key isearch-mode-map (kbd &...
  • 71k
0 votes

Automatically remove tag

Partial answer: how to remove a tag (defun ndk/remove-tag () (org-set-tags (delete "tag1" (org-get-tags)))) This needs to be applied while at the appropriate headline.
  • 21.2k
0 votes

Org-cycle with TAB from isearch without RET

Instead of isearch, you should be using org-occur. See (info "(org) Sparse Trees") or Sparse Trees (The Org Manual) org-occur (C-c / r or C-c / /) Prompts for a regexp (see Regular ...
6 votes
Accepted

Is it possible to create an Emacs package for the below mentioned use case with little Elisp knowledge?

Here is something that you can experiment with .... Do emacs -Q Copy the below snippet to todo.org C-x C-f todo.org Move to the Tasks headline and do C-c C-x C-c Using column view and you will see ...
0 votes

How to set heading and TODO fonts?

Instead of :font, use :family Instead of using custom-theme-set-faces to set TODO font, use org-todo-keyword-faces. Example: (setq org-todo-keyword-faces '( ("BACKLOG" . (:...
0 votes

Noweb references in sh blocks breaks the syntax highlighting

I liked @Dreammm's idea of using the « and » characters but didn't like having to declare file local variables. I also did not want to always use « and ». I just overwrote the org-babel-noweb-wrap ...
  • 113
1 vote

How can I change the menu-entry key for an Orgmode export mode?

A little spelunking in the source code goes a long way. If you check the source for org-export-define-derived-backend (you can do this by typing C-h f and then typing the name of the function) you ...
  • 12.6k
0 votes

Trouble creating a .py file in emacs

This message is likely due to LSP being installed. You can read more about it here. You are using some preconfigured distribution (like e.g. Doom emacs)? Then it is wise to mention and add a tag for ...
  • 2,565
0 votes

Help getting two R plots into a Beamer slide

Editing the code on the relevant slide to the following seems to have worked. #+begin_src R :exports results :session "*R*" :file figures/beta-posterior-trace.pdf plot(beta) #+end_src #+...
  • 157
0 votes

How to retrieve a node's headline/title for a known org-id?

There are many ways to approach this, but starting from org-id-get-with-outline-path-completion the first thing I can come up with is using (defun insert-id-link () (interactive) (let ((id (org-id-...
  • 2,565
0 votes

Issue when expanding clojure source blocks

I got what I wanted to work by changing the text expand function to (defun org-babel-expand-body:text (body params) (replace-regexp-in-string (regexp-quote "\n") "\\n" (org-trim ...
  • 1
1 vote
Accepted

Help getting two R plots into a Beamer slide

Checking the produced .tex file shows that the two plots on the last page are produced by this code: \begin{column}{.5\columnwidth} \begin{center} \includegraphics[width=0.9\linewidth]{figures7/beta-...
  • 21.2k
0 votes
Accepted

Is there a way to search tag header without agenda in org-mode?

Assuming that you want to search for tags in the current buffer only, you can do C-c \ (bound to org-match-sparse-tree) with a match expression as argument, as defined in Matching tags and properties ...
  • 21.2k
0 votes

How can I see a list of DONE tasks in org-agenda sorted by closed date?

In the agenda dispatcher view (i.e. after C-c a if you have customized the setting as the manual suggests - or after M-x org-agenda), select m` for a query to match tags/properties/todo and specify ...
  • 21.2k
2 votes

How to set a variable on a single buffer?

[Not an answer: just a summary and linearization of the comments, which are pretty confusing as they stand and mostly deal with a different problem.] The way to set a local variable is as described ...
  • 21.2k
3 votes
Accepted

How to set a variable on a single buffer?

eval: is a special form in the Local Variables section that evaluates the given Elisp-form. That is not what you want. The actual syntax for setting file local variables is: MAYBE_COMMENT ...
  • 30.8k
0 votes

How to auto-format the source code block in org-mode

Here's a more modern way of doing this: (defvar orig-command (lookup-key org-mode-map (kbd "TAB"))) (define-key org-mode-map (kbd "TAB") 'my/org-indent-dwim) (defun my/org-indent-...
  • 178
3 votes
Accepted

How to share context between two code blocks work using sessions?

The :session argument only applies to languages that support interactive sessions. orgmode cannot create an interactive session for compiled languages, and I think crystal is a compiled language. I ...
  • 20.7k
0 votes
Accepted

Change width of filename column in Org-Agenda Week view

As per @NickD's suggestion, tweaking the agenda part of org-agenda-prefix-format did the job. (setq org-agenda-prefix-format '((agenda . " %i %-20:c%?-12t% s") ;; '%-20' sets 20 char field ...
  • 11
1 vote
Accepted

Table of content in Beamer without slide numbering

You can add \pretocmd{\tableofcontents}{\thispagestyle{empty}}{}{} to your preamble to automatically suppress the footline on the outline frame. To make it look as if the outline frame would not ...
0 votes

How to show remaining task effort in org-mode's column view

You would have to use the following specifier %(expression) from the documentation of org-agenda-prefix-format. the expression would calculate the difference between the clocksum and the effort ...
1 vote
Accepted

Custom agenda view for tasks without dates and with/ without specific tag

This is what I've used in the past: (setq org-agenda-custom-commands '(("d" "Undated tasks" tags-todo "tagA" ((org-agenda-skip-function '(org-agenda-skip-...
  • 3,549
1 vote
Accepted

How to export an org file into browser bookmarks?

Install org-bookmarks-extractor package from Melpa and restart Emacs. From the org file used to manage the bookmarks do M-x org-bookmarks-extractor-extract to export the bookmarks into a Netscape ...
2 votes
Accepted

Emacs visibility not working

What is the value of org-startup-folded? I'm guessing it's the default value of showeverything. That's the default in order not to surprise new users ("I added all this stuff to my file and now I ...
  • 21.2k
1 vote
Accepted

make describe-function link to org file for "tangled" lisp functions

Thanks to @NickD and the magic of :filter-return advice, this turns out to be super simple: we write a function that akes the file name that find-lisp-object-file-name returns, and for those that came ...
  • 349
0 votes
Accepted

How to change the default source directory for org-attach?

The easiest approach seems to be to temporarily set the function read-file-name to look in the target folder. This can be done with the excellent noflet package: (defun azr/org-attach () "Org-...
  • 3
7 votes
Accepted

Why I can't fold (org-cycle) in non-GUI?

I'll try to answer why pressing the Tab key leads to different results when you're using the Emacs GUI vs. Emacs in a terminal. org-cycle is bound to both <tab> and TAB (at least in my and ...
  • 2,036
1 vote
Accepted

How to split long python code into multiple code-blocks in org-mode? (indentation)

<<noweb>> blocks are indented: #+BEGIN_SRC def main(): <<foo>> #+END_SRC And then #+NAME: foo #+BEGIN_SRC print("hello, world") #+END_SRC Does this help?
  • 3,948
1 vote
Accepted

How to tangle single SRC block into multiple output files?

You can have a global (or regional) :prologue that inserts common text at the front of blocks, :epilogue that inserts common text at the end of blocks, or use the more verbose <<noweb>> ...
  • 3,948

Top 50 recent answers are included