The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

Looks like outline-hide-body does exactly what you want: Hide all body lines in buffer, leaving all headings visible. Note that this does not hide the lines preceding the first heading line. So after creating the sparse tree use M-x outline-hide-body RET. Or create a custom command that calls org-occur and hides the body lines afterwards: (defun my-org-...


0

I often use (C-c |) to convert tab separated areas, so you could perhaps simply replace the colon character with a tab and use that. Or wrap some elisp around (org-table-convert-region BEG0 END0 &optional SEPARATOR) Initially I wondered if what you really want is to use the powerful (and I mean to learn this for myself still) Emacs Org's Column View, ...


0

Use C-c C-j (org-goto) for that functionality.


1

For me, grep gives a single answer: (defun org-agenda-convert-date () (interactive) (org-agenda-check-type t 'agenda) (let ((day (get-text-property (min (1- (point-max)) (point)) 'day)) date s) (unless day (user-error "Don't know which date to convert")) (setq date (calendar-gregorian-from-absolute day)) (setq s (concat ...


7

You can attach something to org-ctrl-c-ctrl-c-final-hook: Hook for functions attaching themselves to ‘C-c C-c’. This can be used to add additional functionality to the C-c C-c key which executes context-dependent commands. This hook is run after any other test, while ‘org-ctrl-c-ctrl-c-hook’ is run before the first test. To add something to a ...


0

All right, so I fixed my issue by force recompiling of all the packages. I think things got messed up after a recent updated of packages. Along with issues with org agenda, I was also seeing issues with org html export. I ran the following function: (byte-recompile-directory package-user-dir nil 'force)


0

The following approach works for the full subtree describing the key-bindings for all major-modes at once (if the structure of your document is really as you indicated in the question): narrow to the subtree in question: C-x n s Type C-<home> to go to the beginning of buffer. query replace with M-C-% ^\([[:alnum:] ]+\):\( .*\)$ RET |\1|\2| RET. In ...


0

For the :, a simple M-x query-replace will quickly get you the | between the two columns. For the | at the beginning and end, M-x query-replace-regexp should do: replace ^ with | for the beginning of the line replace $ with | for the end of the line Once you've got all the | inserted, pressing tab anywhere in the table will line up all the columns.


1

The obvious response is that you can bound org-next-visible-heading and org-previous-visible-heading with whatever key you like, but arrow keys are busy ones in the org keymap. Supossing that you want to completely override up and down keys when org-mode is your major mode, this, in your init file, will do it. (define-key org-mode-keymap (kbd "<down>"...


2

Use a plain timestamp rather than a scheduled or deadline timestamp.


3

I know that major modes should usually define the variable -mode, i.e., org-mode should be a defined variable. Not quite: a major mode should set the variable mode-name to the "pretty name" for the mode (i.e., the one that will appear in the modeline), and the variable major-mode to the major mode's command symbol (i.e., org-mode in this case). You can test ...


2

Change plain to entry. See org manual template elements: type The type of entry, a symbol. Valid values are: ‘entry’ An Org mode node, with a headline. Will be filed as the child of the target entry or as a top-level entry. The target file should be an Org file. ... ‘plain’ Text to be ...


0

This sounds like a job for "inline tasks" (FAQ entry: https://orgmode.org/worg/org-faq.html#list-item-as-todo). There's another answer here that shows them, including choosing to export or not to export via "OPTIONS": https://emacs.stackexchange.com/a/34504/737 -- I suggest you upvote that one rather than this one if that helps, since I'm not reproducing ...


0

You can retain folding by avoiding using a section at all and instead use a drawer. The contents of the drawer will still be exported but the drawer name will not.


3

You can use the executable org source blocks from the answer to another question. Write your aside into that org source block. That gives your the possibility to structure your aside and to include almost everything that is possible in org mode into the aside. With the :exports header argument you can freely export the source code of the org source block (...


0

Here's a command that does that until it finds an empty line: (defun indent-children () (interactive) (save-excursion (while (looking-at ".*[^\n[:space:]]") (forward-line 1) (indent-to 2))))


0

If you only want to modify a part of your text select the relevant region otherwise put point at the beginning of the first line. Replace the empty string at the line-beginning with the string consisting of one star and one space C-M-% ^ RET *⎵ RET (thereby the char ⎵ stands for a space). Select the lines below the first one and demote the headings with M-...


2

One can configure ediff-filtered-filters such that it replaces multiple leading stars with one leading star and call ediff-buffers. The following Elisp function my-org-ediff does that for you. Just copy the Elisp code to your init file, restart Emacs, and use my-org-ediff for diffing org files in the way you want it. (defvar ediff-filtered-filters) (defun ...


2

You can do an ediff-buffers-wordwise and type #h \*+ to ignore words consisting of stars. If you advance to the next diff by pressing SPC ediff will skip words only differing in the number of stars.


2

If you are content to use diff on the bash command line and are not looking for a pure emacs solution, you can use process substitution to pass into diff slightly modified files: diff <(sed -E 's/^\*+/*/' file1.org) <(sed -E 's/^\*+/*/' file2.org) Each sed command outputs its input file unchanged, except that a string of one or more asterisks at the ...


1

How about modifying the last line of your custom diary sexp so that it becomes an and statement that checks to ensure that the DATE is not a member of your excluded dates?: (and [YOUR-SEXP-RESULT-THAT-IS-NON-NIL] (not (member DATE '((2 28 2017) (5 1 2017) (5 31 2017))))) Granted, of course, you will ...


1

You might try org-save-outline-visibility. It sounds like it should do what you want. From the documentation (C-h f org-save-outline-visibility RET): Save and restore outline visibility around BODY. If USE-MARKERS is non-nil, use markers for the positions. This means that the buffer may change while running BODY, but it also means that the buffer should ...


1

There's a function org-table-convert-region: org-table-convert-region is an interactive autoloaded compiled Lisp function in ‘org-table.el’. (org-table-convert-region BEG0 END0 &optional SEPARATOR) Convert region to a table. The region goes from BEG0 to END0, but these borders will be moved slightly, to make sure a beginning of line in the first line ...


1

try (setq mac-right-option-modifier 'none) ;; unbind right key for accented input Though for my mac you use shift and 3 to get the '#' sign. But in any case it is good to keep one of the 'option' keys free for modifiers.


2

This seems to work on a few examples I have tried: (defvar-local last-mode nil "Buffer-local variable to store last mode in.") (defun toggle-org-mode () "Toggle the mode between the current mode and `org-mode'." (interactive) (make-local-variable 'last-mode) (put 'last-mode 'permanent-local t) (if (eq major-mode 'org-mode) (progn (...


0

This is what I use: ("p" "Pick a file" entry (function myOrg-captureFile)) for my org-capture-template with (defun myOrg-captureFile () "pick a file for capture and file the stuff" (interactive "P") (let* ((file (read-file-name "Enter file name: ")) (heading (read-string "Heading "))) (find-file file) (goto-char 0) ...


1

To include only Closed: ... use: (org-agenda-start-with-log-mode '(closed)) To show the past 14 days offset the start day: (org-agenda-start-day "-14d") This results in: (add-to-list 'org-agenda-custom-commands '("W" "Weekly review" agenda "" ((org-agenda-start-day "-14d") (org-agenda-span 14) ...


0

M-x org-table-follow-field-mode should not only allow to view but remote-edit as well, while being in the org-mode in your file. So you can do various things with tables and cells easily such as swap columns, without loosing the cell-editing in sight. With keybinding, I press that key whenever I am inside table and want to activate this mode. Now only, ...


0

Since I never use <> as brackets in org mode documents, I have these two lines in my org mode hook function: (modify-syntax-entry ?< ".") (modify-syntax-entry ?> ".") No need to play around with properties etc. Of course, if you use XML or HTML, you may wish to avoid this.


0

Yes, it is in fact possible to link directly to a help page, which should serve the purpose of linking to a function. Although it's not yet documented on https://orgmode.org/org.html#External-Links, the help: link type works, at least since 2016. For example, [[help:org-link-parameters]] links to the function where the help: link (and many of the other ...


1

#+begin_src clojure :results pp (+ 1 4) #+end_src #+RESULTS: : 5 #+begin_src clojure :results output (print "Hello World!") #+end_src #+RESULTS: : Hello World! So we have to specify the output.


2

To toggle whether or not the search will consider similar and equivalent characters as a match, type M-s '. Source : https://www.gnu.org/software/emacs/manual/html_node/emacs/Special-Isearch.html


1

This issue has now been fixed in the latest git version of Emacs thanks to help from Eli Zaretskii.


1

Finally, this has been implemented in the package org-sidebar:


0

This is what I use for evince on Linux (a modified version of lawlist's answer): (org-add-link-type "pdf" 'org-pdf-open nil) (defun org-pdf-open (link) "Where page number is 105, the link should look like: [[pdf:/path/to/file.pdf#page=105][My description.]]" (let* ((path+page (split-string link "#page=")) (pdf-file (car path+page)) ...


0

Another way to solve this problem is to name the input as an EXAMPLE or a QUOTE block if the input is truly static. Something like this: #+NAME: some-json #+BEGIN_QUOTE {"label": "Hello json"} #+END_QUOTE or an EXAMPLE if you prefer: #+NAME: some-json-2 #+BEGIN_EXAMPLE {"label": "ehlo json"} #+END_EXAMPLE then reference those named blocks in the code ...


0

adding the following into my init file solved the issue (set-language-environment 'utf-8) (setq locale-coding-system 'utf-8) ;; set the default encoding system (prefer-coding-...


0

For email in text format, g will prompt you for the url you want to visit, which you select by number. (The numbers appear next to the link in the message). For emails in html format, put your cursor on the url you want to visit and type M-RET. Please, find more info about Mu4e keybindings here. You may also be interested by opening the whole email in the ...


0

You should make sure that your terminal font supports UTF, or whatever you've decided to use for your bullet. This works for me in terminal with Inconsolata. You might want to check out nerd fonts in case you're having trouble finding something that will properly display (use-package org-bullets :hook (org-mode . org-bullets-mode) :config (setq org-...


1

You added org-save-all-org-buffers as :after advice of org-deadline. The documentation of org-save-all-org-buffers says that it is an interactive function without arguments. But org-deadline has one obligatory argument which is deduced from the prefix-arg in interactive calls. So you advise an interactive function with an interactive function. The ...


0

Please tend a close attention to what docs say: org-get-priority-function is a variable defined in ‘org.el’. Its value is nil Documentation: Function to extract the priority from a string. The string is normally the headline. If this is nil Org computes the priority from the priority cookie like [#A] in the headline. It returns an integer, increasing by ...


0

I do the following and it seems to work for headings that are not the top-level: ** not a top heading :PROPERTIES: :CATEGORY: category_name :END: *** TODO this will be in agenda with category_name


1

You might be looking for org-narrow-to-subtree and/or org-toggle-narrow-to-subtree Anyway, in your code it looks like you're calling org-cycle over the LOGBOOK, cycling will only affect it, not the subtree. This code snippet will help you keeping the folding state: (defun org-try-merging-last-clock-out () "Try to merge the latest clock-out, and catch ...


1

Delaying by one or multiple days Here is a function inspired by org-shiftright, the function bound to the key S-RIGHT (find it with C-h k S-RIGHT), which on a timestamp calls org-timestamp-up-day, which itself calls org-timestamp-change. It binds the function to C-c d. Place this in your init file, such as ~/.emacs: (defun org-delay-scheduled (&...


1

Here are a few approaches. * testing conditional execution This is an example on how to use the Unix command =touch=. #+begin_src sh :exports code touch main.c touch lib.c #+end_src #+RESULTS: After you execute those commands, you should see in your working directory the following files: #+name: tree-results #+begin_src sh :results output :exports ...


1

Just do the conversion into standard iso format and calc-eval in Elisp: | date | delta | |------------+-------| | 2018/12/28 | 0 | | 2018/12/31 | 3 | #+TBLFM: $2='(if (= @# 2) 0 (calc-eval (concat "<" (substitute ?- ?/ $1) ">-<" (substitute ?- ?/ @-1$1) ">") )); %.0f You can cleanup the code by defining the following lisp ...


1

What's happening is that org-babel-python-evaluate-session sends an extra newline when the indentation level goes down, this causes the interpreter to close out the top-level block. What I've done is just commented out that bit (forgive the wonky indentation, my file as received from elpa mixes tabs and spaces) ob-python.el (defun org-babel-python-...


-1

As of 2019 you can supply the append option to the :output header to do this: #+BEGIN_SRC language/mode :output append :tangle /path/to/file.ext your code here #+END_SRC Hope this helps.


0

Native solution From the documentation of org-clock-into-drawer (see it with C-h f org-clock-into-drawer): Non-nil when clocking info should be wrapped into a drawer. When non-nil, clocking info will be inserted into the same drawer as log notes (see variable ‘org-log-into-drawer’), if it exists, or "LOGBOOK" otherwise. If necessary, the drawer will be ...


1

Building on @Heikki's answer, I coded the functions below. The main benefit is that I call this function automatically after clocking out and it merges if the time discrepancy is zero, so I don't need to move point to the last clock-out line. If called interactively, it prompts the user to approve a merge where the discrepancy is not zero and shows the time ...


Top 50 recent answers are included