Org mode: Table Data ⇒ Code ⇒ Results

Quick example of how to use table data in a source block with Bash:

#+name: data
| 1 |
| 2 |
| 3 |
| 4 |

#+name: code
#+begin_src sh :var arg=data :results output
printf "%s\n" "${arg[@]}"
#+end_src

#+RESULTS: code
#+begin_EXAMPLE
1
2
3
4
#+end_EXAMPLE

Here is how the block expands using org-babel-expand-src-block:

unset arg
declare -a arg=( '1' '2' '3' '4' )
printf "%s\n" "${arg[@]}"

Choosing Between Code and Verbatim Markup In Org Mode

Its helped me to standardize my approach to marking up techie language. Keeping it simple the content is either programming stuff or everything else tech related. Sufficiently vauge you see: I write down examples to keep it straight in my head. Here you go:

Continue reading “Choosing Between Code and Verbatim Markup In Org Mode”

Configuring A Simple-Modeline

Customizing your Mode-Line is one step forward on every Emacser’s right of passage. Whether you use the informative yet quiet built-in Mode-Line or the visually stunning doom-modeline: you are finding the right porridge for you. Here is my choice―a simple halfway between those two―simple-modeline.

Its so great that I copied and pasted the options here. Alternately run customize or open simple-modeline-segments.el and occur simple-modeline-segment on it. Yup, that great.

Read on for the variable info

You Gotta Try Using ~describe-symbol~

You gotta try out using describe-symbol because it is usually what you really want from describe-function and describe-variable.

The most useful part is that it instantly teaches you when there are both a variable and a function with the same name. Sometimes it is surprising and better to know right away. For example M-x describe-symbol RET emacs-version RET:

emacs-version is an interactive compiled Lisp function in ‘version.el’.

(emacs-version &optional HERE)

Display the version of Emacs that is running in this session.
With a prefix argument, insert the Emacs version string at point
instead of displaying it.
If called from Lisp, by default return the version string; but
if the optional argument HERE is non-nil, insert the string at
point instead.

Don’t use this function in programs to choose actions according
to the system configuration; look at ‘system-configuration’ instead.

  Probably introduced at or before Emacs version 19.20.

―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

emacs-version is a variable defined in ‘C source code’.

Its value is "28.1"

Version numbers of this version of Emacs.
This has the form: MAJOR.MINOR[.MICRO], where MAJOR/MINOR/MICRO are integers.
MICRO is only present in unreleased development versions,
and is not especially meaningful.  Prior to Emacs 26.1, an extra final
component .BUILD is present.  This is now stored separately in
‘emacs-build-number’.

  Probably introduced at or before Emacs version 19.20.

Automatically open read-only files in View mode

When you open read-only files in Emacs, you probably won’t want to attempt to save them. Emacs will warn you if you try and help you deal with it. However, most of the time, it is interruptive to your flow to deal with it—most of the time, we never want to modify read-only files.

In that case, View mode will make it easier for you:

Toggle View mode, a minor mode for viewing text but not editing it.

When View mode is enabled, commands that do not change the buffer contents are available as usual. Kill commands save text but do not delete it from the buffer. Most other commands beep and tell the user that the buffer is read-only.

Enable it automatically with

(setq view-read-only t)

Via EmacsWiki!