How to convert arguments list to string of each on new line in Emacs Lisp?
I want to get list to :var into
emacs-lisp code block in Emacs Org-mode and to output just each of list item on new line. In
ruby it looks as simple as
#+BEGIN_SRC ruby [1,2,3,4]*"\n" #+END_SRC
But cannot realise how to do it in Emacs lisp code block.
Something like this?
#+BEGIN_SRC emacs-lisp (mapconcat #'number-to-string '(1 2 3 4) "\n") #+END_SRC #+RESULTS: : 1 : 2 : 3 : 4
See also questions close to this topic
Emacs lisp - correct way to wrap function
Hi I need to wrap a function, what is the best practice to achieve this? Here's currently my working implmentation:
(defun my-counsel-projectile-find-file (&optional arg) "Jump to a project's file using completion. Wraps `counsel-projectile-find-file' to be compatible with `puspose-mode'" (interactive "P") (let ((purpose--active-p nil)) (counsel-projectile-find-file arg)) )
In this case I'm wrapping the
How to open an indirect buffer in a new frame in a single call in emacs?
There are a couple of functions to open a buffer in a new frame (
switch-to-buffer-other-frame), but how do I create an indirect buffer in a new frame (in a single call, that is)?
Where is the "org" folder located in emacs?
Simple question: I was wondering where the org-7.8.03 folder is in emacs?
Setting org-agenda-time-grid arguments
The following setting for the org-agenda cause an error while agenda is called.
(setq org-agenda-time-grid '((daily today remove-match) (0700 0800 0900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200) "......" "----------------" ))
Although I have modified the order of arguments, which has changed recently in org-mode version 9.1, I get the error "+: Wrong type argument: integer-or-marker-p, 870.0".
Internal links and targets in results of org-mode code blocks linking, e.g., to the results of other code blocks
I am using org-mode to write software documentation, where API documentation of functions, variables etc. is automatically extracted from doc-strings of the code (which happens to be in Common Lisp). This documentation is then exported to HTML (I happen to do this via reStructuredText with ox-rst and Sphinx). It works largely like using Sphinx directly with Python, but with all features of org-mode, like executable code blocks.
Just to briefly show the principle, I am demonstrating the approach below somewhat simplified with Emacs Lisp. I have a code block that extracts the documentation of a function (with Common Lisp's format and using :results output raw I avoid surrounding double-quotes in the result, but for simplicity I leave them in in the brief demo below).
#+name: function-doc #+begin_src emacs-lisp :results output raw :exports results :var name='list (print (documentation name)) #+end_src
I then call that code block with the function I want to document, and during export this call is replaced with the resulting documentation.
The resulting documentation for map that is automatically inserted into the exported file happens to be the following.
"Map a FUNCTION across one or more SEQUENCEs, returning a sequence. TYPE is the sequence type to return. (fn TYPE FUNCTION SEQUENCE...)"
I can use org-mode formatting in my doc-strings, and such formatting is exported as expected.
Now comes my question. I would like to use links to API entries (e.g., the documentation of a function) within both the doc-strings of other functions, variables etc. and from within the main text (i.e., the text that is not automatically inserted). Automatically inserting targets with the name of the function is easy, I just need to extend my code block function-doc above accordingly. However, these targets are not found during the export process. Even if I have the target to the documentation of MY-FUNCTION automatically added with the code block function-doc above, when I insert the org-mode link [[MY-FUNCTION]] to that function, org-mode interrupts the export with the following error.
user-error: Unable to resolve link: "MY-FUNCTION"
Is there any way around this limitation? Is there any way that targets in the results of org-mode code blocks can be "seen" by org-mode during the export process?
I already tried various workarounds, but without success so far. For example, I tried to use org-mode macros instead of code blocks, but it is very tricky to have multi-line macro results (the tricks reported at Define org mode macro with line breaks where not sufficient for me). I was looking for a way to turn the error message about unresolved links into a warning, but all I found was the option to mark broken links as shown below. Any way to export and just ignoring (seemingly) broken links?
I also considered to first automatically export my org file to an org with all the code block results already inserted, so that org-mode could see all the targets for the links, but obviously exporting an org file to org mode is also not possible with (seemingly) broken links.
Any help? Thanks a lot!
Enabling font weight and colour in RESULTS block of org-babel
Is there any way to enable font weight and colours in the
For example, calling
--coloroption renders font weights and colours as expected in the shell, but not when rendered within the
#+BEGIN_SRC shell ls --color ~/ #+END_SRC #+RESULTS: | Applications | | Desktop | | Documents | | Downloads | | Library | ...
Another example is the
chalk, which appears in the
#+RESULTSblock as plaintext:
#+BEGIN_SRC js const chalk = require('chalk'); console.log(chalk.red('Hello world!')); #+END_SRC #+RESULTS: : Hello world! : undefined