Sunday, December 15, 2019

Midnight Commander Cheat Sheet

Midnight Commander Cheat Sheet

1 General

On modern keyboards instead of [META] both [ALT] and [ESC] can be used.

Shortcut Description
TAB Jump from one panel to the other
C-u Swap panels
C-r Refresh current pane
C-l Redraw current pane
C-\ Show the directory Hotlist
C-SPACE Show current directory size
M-i Make the other panel show the same directory as the active panel
M-c Quick cd dialog
M-? Search dialog
M-. Toggle "Show Hidden Files" feature
M-, Switch MC layout from left-right to top-bottom
M-t Change panel listing mode: standard, brief, full
M-o Load the directory under the cursor on the other
  panel and move the selection to the next one in the current panel
M-SHIFT-h Show the directory history
M-y Move to the previous directory in the directory history
M-u Move to the next directory in the directory history
SHIFT-F4 Create new file

2 Command Prompt

Shortcut Description
C-o Drop to the console
M-TAB Command prompt auto-completion
M-Enter Copy file/directory name to the prompt
M-a Copy file/directory name to the prompt (full path included)
M-h Show command prompt history
M-p Returns the previous command prompt
M-n Returns the next command prompt
C-x t Copy all your selected files to the prompt
C-x C-t Copy all your selected files to the prompt for the opposing panel
C-x p Copy the current path to the prompt
C-x C-p Copy the current path to the prompt for the opposite panel

3 Files Selection

Shortcut Description
Insert or C-t Select/deselect file
* Invert selection on files
+ Specify file selection options
- Specify file de-selection options

4 File View mode

Shortcut Description
C-f View the next file
C-b View the previous file

Saturday, December 14, 2019

Lisp Expressions vs. Lisp Forms

Lisp Expressions vs. Lisp Forms

1 Lisp Expressions vs. Lisp Forms

1.1 General

During my Lisp studies (Emacs Lisp and Clojure), I often encountered the terms: Lisp "Expression" and Lisp "Form" and I started wondering what is the difference since most literature seems to use both terms interchangeable.

An excerpt from: “Living Clojure” - Carin Meier

"An expression is [Lisp] code that can be evaluated for a result, and a form is a valid expression that can be evaluated"

In other words an expression is a valid input for the LISP `READ` (REPL) while a form is a valid input for both the `READ` and the `EVAL` part of the (REPL).

1.2 Examples

The below is a valid form (valid both for the `READ` and the `EVAL`)

(+ 1 2)

;; => 3

The below (assuming the 'foo' function is not defined) is a valid expression but not a valid form, it can be read but not evaluated since 'foo' is not defined:

(foo 1 2)

;; => Syntax error compiling at (REPL:1:1). Unable to resolve symbol: foo in this context