Difference between revisions of "Emacs Lisp Cheat Sheet"

From WikEmacs
Jump to navigation Jump to search
(→‎List: seq.el)
 
(55 intermediate revisions by 3 users not shown)
Line 30: Line 30:
  
 
==Standard Library==
 
==Standard Library==
 
+
Including function, ''variable'', <ins>command</ins>, <span style="color:grey">option</span>, <span style="color:grey;font-style:italic">macro</span>, <ins><span style="color:grey">Special Form</span></ins>
 
=== Number ===
 
=== Number ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
Emacs supports two numeric data types: '''integers''' and '''floating point numbers'''
 +
{| class="wikitable"
 +
|+ Number related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Integer Basics || ''most-positive-fixnum'' ''most-negative-fixnum''
 +
|-
 +
| Floating Point Basics || logb float-e float-pi
 +
|-
 +
| Type Predicate Test || floatp integerp numberp wholenump zerop
 +
|-
 +
| Comparison || = eql /= < <= > >= max min abs
 +
|-
 +
| Conversions || float truncate floor ceiling round
 +
|-
 +
| Arithmetic Operations || 1+ 1- + - * / % mod
 +
|-
 +
| Rounding Operations || ffloor fceiling ftruncate fround
 +
|-
 +
| Bitwise Operations || lsh ash logand logior logxor lognot
 +
|-
 +
| Mathematical Functions || sin cos tan asin acos atan exp log log10 expt sqrt
 +
|-
 +
| Random Numbers || random
 +
|}
  
=== Character ===
+
=== String and Character ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
A '''string''' in Emacs Lisp is an array that contains an ordered sequence of '''characters'''
 +
{| class="wikitable"
 +
|+ String and Character related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Predicates for Strings || stringp string-or-null-p char-or-string-p
 +
|-
 +
| Creating Strings || make-string string substring substring-no-properties concat split-string split-string-default-separators
 +
|-
 +
| Modifying Strings || store-substring clear-string
 +
|-
 +
| Comparison || char-equal string= string-equal string< string-lessp compare-strings assoc-string
 +
|-
 +
| Conversion || number-to-string string-to-number char-to-string string-to-char
 +
|-
 +
| Formatting Strings || format
 +
|-
 +
| Case Conversion || downcase upcase capitalize upcase-initials
 +
|-
 +
| The Case Table || case-table-p set-standard-case-table standard-case-table current-case-table set-case-table with-case-table ''ascii-case-table'' set-case-syntax-pair set-case-syntax-delims set-case-syntax describe-buffer-case-table
 +
|}
  
=== String ===
+
Tip: you can also use a modern string manipulation library with  [https://github.com/magnars/s.el '''s.el''']
  
 
=== List ===
 
=== List ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
'''Lists''' are built up from cons cells
 +
{| class="wikitable"
 +
|+ List related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| List-related Predicates || consp atom listp nlistp null
 +
|-
 +
| List Elements || car cdr car-safe cdr-safe pop nth nthcdr last safe-length caar cadr cadr cadr butlast nbutlast
 +
|-
 +
| Building Lists || cons list make-list append reverse copy-tree number-sequence
 +
|-
 +
| List Variables || push add-to-list add-to-ordered-list
 +
|-
 +
| Modifying Lists || setcar setcdr nconc nreverse sort
 +
|-
 +
| Sets And Lists || memq delq remq memql member delete remove member-ignore-case delete-dups
 +
|-
 +
| Association Lists || assoc rassoc sassq rassq assoc-default copy-alist assq-delete-all rassq-delete-all
 +
|-
 +
| Rings || make-ring ring-p ring-size ring-length ring-elements ring-copy ring-empty-p ring-ref ring-insert ring-remove ring-insert-at-beginning
 +
|}
 +
 +
 +
Tip: you can benefit from a modern list manipulation api with [https://github.com/magnars/dash.el '''dash.el'''] and the newer [https://github.com/NicolasPetton/seq.el seq.el], that iterates over all sequences (lists, vectors, strings) (but does not have anaphoric macros).
  
 
=== Vector ===
 
=== Vector ===
 +
 +
see [https://github.com/NicolasPetton/seq.el seq.el] that iterates over sequences, and so vectors.
 +
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Vector related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Vector Functions || vectorp vector make-vector vconcat
 +
|-
 +
| Bool-vectors || make-bool-vector bool-vector-p
 +
|}
  
 
=== Sequence ===
 
=== Sequence ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
'''sequence''' type is the union of two other Lisp types: '''lists''' and '''arrays'''. While array has four types, all one-dimensional: '''strings''', '''vectors''', '''bool-vectors''', '''char-tables'''.
 +
 +
See [https://github.com/NicolasPetton/seq.el seq.el] that iterates over sequences.
 +
 +
{| class="wikitable"
 +
|+ Sequence related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Sequence Functions || sequencep length elt copy-sequence
 +
|-
 +
| Array Functions || arrayp aref aset fillarray
 +
|-
 +
| Char-Tables || make-char-table char-table-p char-table-subtype char-table-parent set-char-table-parent char-table-extra-slot set-char-table-extra-slot char-table-range set-char-table-range map-char-table
 +
|}
  
 
=== Hash Tables ===
 
=== Hash Tables ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Hash Tables related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Creating Hash || make-hash-table makehash
 +
|-
 +
| Hash Access || gethash puthash remhash clrhash maphash
 +
|-
 +
| Defining Hash || define-hash-table-test sxhashsxhash
 +
|-
 +
| Other Hash || hash-table-p copy-hash-table hash-table-count hash-table-test hash-table-weakness hash-table-rehash-size hash-table-rehash-threshold hash-table-size
 +
|}
  
 
=== Symbols ===
 
=== Symbols ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Symbols related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Predicates for symbols || symbolp
 +
|-
 +
| Creating Symbols || symbol-name make-symbol intern intern-soft ''obarray'' mapatoms unintern
 +
|-
 +
| Property Lists || symbol-plist setplist get put plist-get plist-put lax-plist-get lax-plist-put plist-member
 +
|}
  
 
=== Minibuffer ===
 
=== Minibuffer ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
A '''minibuffer''' is a special buffer that Emacs commands use to read arguments more complicated than the single numeric prefix argument.
 +
{| class="wikitable"
 +
|+ Minibuffer related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Text from Minibuffer || read-from-minibuffer read-string read-regexp minibuffer-allow-text-properties minibuffer-local-map read-no-blanks-input minibuffer-local-ns-map
 +
|-
 +
| Object from Minibuffer || read-minibuffer eval-minibuffer edit-and-eval-command
 +
|-
 +
| Minibuffer History || add-to-history ''history-add-new-input'' ''history-length'' ''history-delete-duplicates'' ''minibuffer-history'' ''query-replace-history'' ''file-name-history'' ''buffer-name-history'' ''regexp-history'' ''extended-command-history'' ''shell-command-history'' ''read-expression-history''
 +
|-
 +
| Basic Completion || try-completion all-completions test-completion completion-boundaries ''completion-ignore-case'' ''completion-regexp-list'' lazy-completion-table completion-in-region
 +
|-
 +
| Minibuffer Completion || completing-read
 +
|-
 +
| Completion Commands ||minibuffer-completion-table minibuffer-completion-predicate minibuffer-completion-confirm minibuffer-confirm-exit-commands minibuffer-complete-word minibuffer-complete minibuffer-complete-and-exit minibuffer-completion-help display-completion-list completion-auto-help minibuffer-local-completion-map minibuffer-local-must-match-map minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map
 +
|-
 +
| High-Level Completion || read-buffer read-buffer-function read-buffer-completion-ignore-case read-command read-variable read-color
 +
|-
 +
| Reading File Names || read-file-name read-file-name-function read-file-name-completion-ignore-case read-directory-name insert-default-directory read-shell-command minibuffer-local-shell-command-map
 +
|-
 +
| Completion Styles || completion-styles completion-styles-alist
 +
|-
 +
| Programmed Completion || completion-table-dynamic completion-annotate-function
 +
|-
 +
| Yes-or-No Queries || y-or-n-p y-or-n-p-with-timeout yes-or-no-p
 +
|-
 +
| Multiple Queries || map-y-or-n-p
 +
|-
 +
| Reading a Password || read-passwd
 +
|-
 +
| Minibuffer Commands || exit-minibuffer self-insert-and-exit previous-history-element next-history-element previous-matching-history-element next-matching-history-element
 +
|-
 +
| Minibuffer Contents || minibuffer-prompt minibuffer-prompt-end minibuffer-prompt-width minibuffer-contents minibuffer-contents-no-properties minibuffer-completion-contents delete-minibuffer-contents
 +
|-
 +
| Minibuffer Windows || active-minibuffer-window minibuffer-window set-minibuffer-window window-minibuffer-p minibuffer-window-active-p
 +
|-
 +
| Recursive Mini || minibuffer-depth enable-recursive-minibuffers
 +
|-
 +
| Minibuffer Miscellany || minibufferp minibuffer-setup-hook minibuffer-exit-hook minibuffer-help-form minibuffer-scroll-window minibuffer-selected-window max-mini-window-height
 +
|}
  
 
=== Keymaps ===
 
=== Keymaps ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Keymaps related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Key Sequences || kbd
 +
|-
 +
| Format of Keymaps || keymapp
 +
|-
 +
| Creating Keymaps || make-sparse-keymap make-keymap copy-keymap
 +
|-
 +
| Inheritance and Keymaps || keymap-parent set-keymap-parent
 +
|-
 +
| Prefix Keys || define-prefix-command
 +
|-
 +
| Active Keymaps || current-active-maps key-binding
 +
|-
 +
| Controlling the Active Keymaps || global-map current-global-map current-local-map current-minor-mode-maps use-global-map use-local-map minor-mode-map-alist minor-mode-overriding-map-alist overriding-local-map overriding-terminal-local-map overriding-local-map-menu-flag special-event-map emulation-mode-map-alists
 +
|-
 +
| Functions for Key Lookup || lookup-key undefined local-key-binding global-key-binding minor-mode-key-binding meta-prefix-char
 +
|-
 +
| Changing Key Bindings || define-key substitute-key-definition suppress-keymap
 +
|-
 +
| Remapping Commands || command-remapping
 +
|-
 +
| Translation Keymaps || input-decode-map local-function-key-map key-translation-map
 +
|-
 +
| Key Binding Commands || global-set-key global-unset-key local-set-key local-unset-key
 +
|-
 +
| Scanning Keymaps || accessible-keymaps map-keymap where-is-internal describe-bindings
 +
|-
 +
| Menu Keymaps || keymap-prompt
 +
|-
 +
| Menus and the Keyboard || menu-prompt-more-char
 +
|-
 +
| Menu Bar || menu-bar-final-items menu-bar-update-hook
 +
|-
 +
| Tool Bar || tool-bar-map tool-bar-add-item tool-bar-add-item-from-menu tool-bar-local-item-from-menu auto-resize-tool-bars auto-raise-tool-bar-buttons tool-bar-button-margin tool-bar-button-relief tool-bar-border
 +
|-
 +
| Modifying Menus || define-key-after
 +
|}
  
 
=== File ===
 
=== File ===
 +
 +
'''See''': [https://github.com/rejeep/f.el f.el], a modern library for working with files and directories.
 +
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ File related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Visiting Files || find-file find-file-literally find-file-noselect find-file-other-window find-file-read-only view-file find-file-wildcards find-file-hook find-file-not-found-functions find-file-literally create-file-buffer after-find-file
 +
|-
 +
| Saving Buffers || save-buffer save-some-buffers write-file write-file-functions write-contents-functions before-save-hook after-save-hook file-precious-flag require-final-newline
 +
|-
 +
| Reading from Files || insert-file-contents insert-file-contents-literally
 +
|-
 +
| Writing to Files || append-to-file write-region with-temp-file
 +
|-
 +
| File Locks || file-locked-p lock-buffer unlock-buffer ask-user-about-lock
 +
|-
 +
| Information about Files || file-exists-p file-readable-p file-executable-p file-writable-p file-accessible-directory-p access-file file-ownership-preserved-p file-newer-than-file-p file-symlink-p file-directory-p file-regular-p file-truename file-chase-links file-modes file-nlinks file-attributes locate-file executable-find
 +
|-
 +
| Changing Files || add-name-to-file rename-file copy-file make-symbolic-link delete-file set-file-modes set-default-file-modes default-file-modes read-file-modes file-modes-symbolic-to-number set-file-times
 +
|-
 +
| File Names || file-name-directory file-name-nondirectory file-name-sans-versions file-name-extension file-name-sans-extension file-name-absolute-p file-relative-name file-name-as-directory directory-file-name abbreviate-file-name expand-file-name default-directory substitute-in-file-name make-temp-file make-temp-name temporary-file-directory small-temporary-file-directory file-name-all-completions file-name-completion completion-ignored-extensions convert-standard-filename
 +
|-
 +
| Contents of Directories || directory-files directory-files-and-attributes file-expand-wildcards insert-directory insert-directory-program
 +
|-
 +
| Create/Delete Dirs || make-directory copy-directory delete-directory
 +
|-
 +
| Magic File Names || inhibit-file-name-handlers inhibit-file-name-operation find-file-name-handler file-local-copy file-remote-p unhandled-file-name-directory
 +
|-
 +
| Format Conversion || format-alist buffer-file-format format-write-file format-find-file format-insert-file buffer-auto-save-file-format write-region-annotate-functions write-region-post-annotation-function after-insert-file-functions
 +
|}
  
 
=== Buffer ===
 
=== Buffer ===
 +
<!-- TODO: need to format variable, command, etc -->
 
'''buffer''' is a lisp object containing text to be edited
 
'''buffer''' is a lisp object containing text to be edited
 
{| class="wikitable"
 
{| class="wikitable"
Line 86: Line 336:
  
 
=== Windows ===
 
=== Windows ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Windows related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Basic Windows || windowp
 +
|-
 +
| Splitting Windows || split-window split-window-vertically split-window-keep-point split-window-horizontally one-window-p
 +
|-
 +
| Deleting Windows || window-live-p delete-window delete-other-windows delete-windows-on
 +
|-
 +
| Selecting Windows || selected-window select-window save-selected-window with-selected-window get-lru-window get-largest-window get-window-with-predicate
 +
|-
 +
| Cyclic Window Ordering || next-window previous-window other-window walk-windows window-list
 +
|-
 +
| Buffers and Windows || set-window-buffer buffer-display-count window-buffer get-buffer-window get-buffer-window-list buffer-display-time
 +
|-
 +
| Displaying Buffers || switch-to-buffer switch-to-buffer-other-window pop-to-buffer replace-buffer-in-windows
 +
|-
 +
| Choosing Window || display-buffer display-buffer-reuse-frames pop-up-windows split-window-preferred-function split-window-sensibly split-height-threshold split-width-threshold even-window-heights pop-up-frames pop-up-frame-function pop-up-frame-alist special-display-buffer-names special-display-regexps special-display-p special-display-function special-display-popup-frame special-display-frame-alist same-window-buffer-names same-window-regexps same-window-p display-buffer-function
 +
|-
 +
| Dedicated Windows || window-dedicated-p set-window-dedicated-p
 +
|-
 +
| Window Point || window-point set-window-point window-point-insertion-type
 +
|-
 +
| Window Start and End || window-start window-end set-window-start pos-visible-in-window-p window-line-height
 +
|-
 +
| Textual Scrolling || scroll-up scroll-down scroll-other-window other-window-scroll-buffer scroll-margin scroll-conservatively scroll-down-aggressively scroll-up-aggressively scroll-step scroll-preserve-screen-position next-screen-context-lines recenter
 +
|-
 +
| Vertical Scrolling || window-vscroll set-window-vscroll auto-window-vscroll
 +
|-
 +
| Horizontal Scrolling || scroll-left scroll-right window-hscroll set-window-hscroll
 +
|-
 +
| Size of Window || window-height window-body-height window-full-height-p window-width window-full-width-p window-edges window-inside-edges window-pixel-edges window-inside-pixel-edges
 +
|-
 +
| Resizing Windows || enlarge-window enlarge-window-horizontally shrink-window shrink-window-horizontally adjust-window-trailing-edge fit-window-to-buffer shrink-window-if-larger-than-buffer window-size-fixed window-min-height window-min-width balance-windows balance-windows-area
 +
|-
 +
| Coordinates and Windows || window-at coordinates-in-window-p
 +
|-
 +
| Window Tree || window-tree
 +
|-
 +
| Window Configurations || current-window-configuration set-window-configuration save-window-excursion window-configuration-p compare-window-configurations window-configuration-frame
 +
|-
 +
| Window Parameters || window-parameter window-parameters set-window-parameter
 +
|-
 +
| Window Hooks || window-scroll-functions window-size-change-functions window-configuration-change-hook
 +
 +
|}
  
 
=== Frames ===
 
=== Frames ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Frames related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Creating Frames || make-frame before-make-frame-hook after-make-frame-functions frame-inherited-parameters
 +
|-
 +
| Multiple Terminals || terminal-name terminal-list get-device-terminal delete-terminal delete-terminal-functions make-frame-on-display x-display-list x-open-connection x-close-connection
 +
|-
 +
| Frame Parameters || frame-parameter frame-parameters modify-frame-parameters set-frame-parameter modify-all-frames-parameters initial-frame-alist minibuffer-frame-alist default-frame-alist blink-cursor-alist cursor-in-non-selected-windows set-frame-position frame-height frame-width frame-pixel-height frame-pixel-width frame-char-height frame-char-width set-frame-size set-frame-height set-frame-width x-parse-geometry
 +
|-
 +
| Terminal Parameters || terminal-parameters terminal-parameter set-terminal-parameter
 +
|-
 +
| Frame Titles || frame-title-format icon-title-format multiple-frames
 +
|-
 +
| Deleting Frames || delete-frame frame-live-p
 +
|-
 +
| Finding All Frames || frame-list visible-frame-list next-frame previous-frame
 +
|-
 +
| Frames and Windows || window-frame frame-first-window frame-selected-window set-frame-selected-window
 +
|-
 +
| Minibuffers and Frames || default-minibuffer-frame
 +
|-
 +
| Input Focus || selected-frame select-frame-set-input-focus select-frame handle-switch-frame redirect-frame-focus focus-follows-mouse
 +
|-
 +
| Visibility of Frames || make-frame-visible make-frame-invisible iconify-frame frame-visible-p
 +
|-
 +
| Raising and Lowering || raise-frame lower-frame minibuffer-auto-raise
 +
|-
 +
| Frame Configurations || current-frame-configuration set-frame-configuration
 +
|-
 +
| Mouse Tracking || track-mouse
 +
|-
 +
| Mouse Position || mouse-position mouse-position-function set-mouse-position mouse-pixel-position set-mouse-pixel-position
 +
|-
 +
| Pop-Up Menus || x-popup-menu
 +
|-
 +
| Dialog Boxes || x-popup-dialog
 +
|-
 +
| Pointer Shape || void-text-area-pointer x-pointer-shape x-sensitive-text-pointer-shape
 +
|-
 +
| Window System Selections || x-set-selection x-get-selection x-get-cut-buffer x-set-cut-buffer selection-coding-system x-select-enable-clipboard
 +
|-
 +
| Color Names || color-defined-p defined-colors color-supported-p color-gray-p color-values
 +
|-
 +
| Text Terminal Colors || tty-color-define tty-color-clear tty-color-alist tty-color-approximate tty-color-translate
 +
|-
 +
| Resources || x-get-resource x-resource-class x-resource-name inhibit-x-resources
 +
|-
 +
| Display Feature Testing || display-popup-menus-p display-graphic-p display-mouse-p display-color-p display-grayscale-p display-supports-face-attributes-p display-selections-p display-images-p display-screens display-pixel-height display-pixel-width display-mm-height display-mm-width display-mm-dimensions-alist display-backing-store display-save-under display-planes display-visual-class display-color-cells x-server-version x-server-vendor
 +
|}
  
=== Positons ===
+
=== Positions ===
 +
A '''position''' is the index of a character in the text of a buffer.
 +
{| class="wikitable"
 +
|+ Positions related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Point || point point-min point-max buffer-end buffer-size
 +
|-
 +
| rowspan="7" | Motion || <ins>goto-char</ins> <ins>forward-char</ins> <ins>backward-char</ins>
 +
|-
 +
| <ins>forward-word</ins> <ins>backward-word</ins> <span style="color:grey">words-include-escapes</span> ''inhibit-field-text-motion''
 +
|-
 +
| <ins>beginning-of-buffer</ins> <ins>end-of-buffer</ins>
 +
|-
 +
| <ins>beginning-of-line</ins> line-beginning-position <ins>end-of-line</ins> line-end-position <ins>forward-line</ins> count-lines line-number-at-pos
 +
|-
 +
| vertical-motion count-screen-lines <ins>move-to-window-line</ins> compute-motion
 +
|-
 +
| <ins>forward-list</ins> <ins>backward-list</ins> <ins>up-list</ins> <ins>down-list</ins> <ins>forward-sexp</ins> <ins>backward-sexp</ins> <ins>beginning-of-defun</ins> <ins>end-of-defun</ins> <span style="color:grey">defun-prompt-regexp</span> <span style="color:grey">open-paren-in-column-0-is-defun-start</span> ''beginning-of-defun-function'' ''end-of-defun-function''
 +
|-
 +
| skip-chars-forward skip-chars-backward
 +
|-
 +
| Excursions || <ins><span style="color:grey">save-excursion</span></ins>
 +
|-
 +
| Narrowing || <ins>narrow-to-region</ins> <ins>narrow-to-page</ins> <ins>widen</ins> <ins><span style="color:grey">save-restriction</span></ins>
 +
|}
  
 
=== Marker ===
 
=== Marker ===
 +
A '''marker''' is a Lisp object used to specify a position in a buffer relative to the surrounding text.
 +
{| class="wikitable"
 +
|+ Marker related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Predicates on Markers || markerp integer-or-marker-p number-or-marker-p
 +
|-
 +
| Creating Markers || make-marker point-marker point-min-marker point-max-marker copy-marker
 +
|-
 +
| Information from Markers || marker-position marker-buffer buffer-has-markers-at
 +
|-
 +
| Marker Insertion Types || set-marker-insertion-type marker-insertion-type
 +
|-
 +
| Moving Markers || set-marker move-marker
 +
|-
 +
| The Mark || mark mark-marker set-mark push-mark pop-mark <span style="color:grey">transient-mark-mode</span> <span style="color:grey">mark-even-if-inactive</span> ''deactivate-mark'' deactivate-mark ''mark-active'' ''activate-mark-hook'' ''deactivate-mark-hook'' handle-shift-selection ''mark-ring'' <span style="color:grey">mark-ring-max</span>
 +
|-
 +
| The Region || region-beginning region-end use-region-p
 +
|}
  
=== Text (unfinished) ===
+
=== Text ===
 +
<!-- TODO: need to format variable, command, etc -->
 
'''Text''' is manipulated through '''Buffer''' object with '''point''' and '''marker'''.  
 
'''Text''' is manipulated through '''Buffer''' object with '''point''' and '''marker'''.  
 
{| class="wikitable"
 
{| class="wikitable"
Line 113: Line 511:
 
|-
 
|-
 
| User-Level Deletion Commands || delete-horizontal-space delete-indentation fixup-whitespace just-one-space delete-blank-lines  
 
| User-Level Deletion Commands || delete-horizontal-space delete-indentation fixup-whitespace just-one-space delete-blank-lines  
 +
|-
 +
| The Kill Ring || kill-region kill-read-only-ok copy-region-as-kill
 +
insert-for-yank insert-buffer-substring-as-yank yank yank-pop yank-undo-function current-kill kill-new kill-append interprogram-paste-function interprogram-cut-function kill-ring kill-ring-yank-pointer kill-ring-max
 +
|-
 +
| Undo || buffer-undo-list undo-boundary undo-in-progress primitive-undo
 +
|-
 +
| Maintaining Undo Lists || buffer-enable-undo buffer-disable-undo undo-limit undo-strong-limit undo-outer-limit undo-ask-before-discard
 +
|-
 +
| Filling || fill-paragraph fill-region fill-individual-paragraphs fill-individual-varying-indent fill-region-as-paragraph justify-current-line default-justification current-justification sentence-end-double-space sentence-end-without-period sentence-end-without-space fill-paragraph-function fill-forward-paragraph-function use-hard-newlines
 +
|-
 +
| Margins || fill-prefix fill-column set-left-margin set-right-margin current-left-margin current-fill-column move-to-left-margin delete-to-left-margin indent-to-left-margin left-margin fill-nobreak-predicate
 +
|-
 +
| Adaptive Fill || adaptive-fill-mode fill-context-prefix adaptive-fill-regexp adaptive-fill-first-line-regexp adaptive-fill-function
 +
|-
 +
| Auto Filling || auto-fill-function normal-auto-fill-function auto-fill-chars
 +
|-
 +
| Sorting || sort-subr sort-fold-case sort-regexp-fields sort-regexp-fields sort-paragraphs sort-pages sort-fields sort-numeric-fields sort-numeric-base sort-columns
 +
|-
 +
| Columns || current-column move-to-column
 +
|-
 +
| Indentation || current-indentation indent-to indent-tabs-mode indent-line-function indent-according-to-mode indent-for-tab-command newline-and-indent reindent-then-newline-and-indent indent-region indent-region-function indent-rigidly indent-code-rigidly indent-relative indent-relative-maybe tab-to-tab-stop tab-stop-list back-to-indentation backward-to-indentation forward-to-indentation
 +
|-
 +
| Case || capitalize-region downcase-region upcase-region capitalize-word downcase-word upcase-word
 +
|-
 +
| Text Properties || get-text-property get-char-property get-char-property-and-overlay char-property-alias-alist text-properties-at default-text-properties put-text-property add-text-properties remove-text-properties remove-list-of-text-properties set-text-properties propertize next-property-change previous-property-change next-single-property-change previous-single-property-change next-char-property-change previous-char-property-change next-single-char-property-change previous-single-char-property-change text-property-any text-property-not-all inhibit-point-motion-hooks show-help-function text-property-default-nonsticky insert-and-inherit insert-before-markers-and-inherit buffer-access-fontify-functions buffer-access-fontified-property mouse-on-link-p field-beginning field-end field-string field-string-no-properties delete-field constrain-to-field
 +
|-
 +
| Substituting || subst-char-in-region translate-region
 +
|-
 +
| Transposition || transpose-regions
 +
|-
 +
| Registers || register-alist get-register set-register view-register insert-register
 +
|-
 +
| Base 64 || base64-encode-region base64-encode-string base64-decode-region base64-decode-string
 +
|-
 +
| MD5 Checksum || md5
 +
|-
 +
| Atomic Change || prepare-change-group activate-change-group accept-change-group cancel-change-group
 +
|-
 +
| Change Hooks || before-change-functions after-change-functions combine-after-change-calls first-change-hook inhibit-modification-hooks
 +
|}
 +
 +
=== Searching and Matching ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+Searching and Matching related function and ''Variable''
 +
|-
 +
| Category || Function ''Variable''
 +
|-
 +
| String Search || search-forward search-backward word-search-forward word-search-forward-lax word-search-backward word-search-backward-lax
 +
|-
 +
| Searching and Case || Case-independent or case-significant searching.
 +
case-fold-search case-replace
 +
|-
 +
| Regular Expressions || regexp-quote regexp-opt regexp-opt-depth
 +
|-
 +
| Regexp Search || re-search-forward re-search-backward string-match string-match-p looking-at looking-back looking-at-p search-spaces-regexp
 +
|-
 +
| POSIX Regexps || posix-search-forward posix-search-backward posix-looking-at posix-string-match
 +
|-
 +
| Match Data || replace-match match-substitute-replacement match-string match-string-no-properties match-beginning match-end match-data set-match-data save-match-data
 +
|-
 +
| Search and Replace || replace-regexp-in-string perform-replace query-replace-map
 +
|-
 +
| Standard Regexps || page-delimiter paragraph-separate paragraph-start sentence-end sentence-end
 
|}
 
|}
 +
 +
=== Processes ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ Processes related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Process Predicate || processp
 +
|-
 +
| Subprocess Creation || exec-suffixes exec-directory exec-path
 +
|-
 +
| Shell Arguments || shell-quote-argument split-string-and-unquote combine-and-quote-strings
 +
|-
 +
| Synchronous Processes || call-process process-file process-file-side-effects call-process-region call-process-shell-command process-file-shell-command shell-command-to-string process-lines
 +
|-
 +
| Asynchronous Processes || start-process start-file-process start-process-shell-command start-file-process-shell-command process-connection-type
 +
|-
 +
| Deleting Processes || delete-exited-processes delete-process
 +
|-
 +
| Process Information || list-processes process-list get-process process-command process-contact process-id process-name process-status process-type process-exit-status process-tty-name process-coding-system set-process-coding-system process-get process-put process-plist set-process-plist
 +
|-
 +
| Input to Processes || process-send-string process-send-region process-send-eof process-running-child-p
 +
|-
 +
| Signals to Processes || interrupt-process kill-process quit-process stop-process continue-process signal-process
 +
|-
 +
| Output from Processes || process-adaptive-read-buffering process-buffer process-mark set-process-buffer get-buffer-process set-process-filter process-filter accept-process-output
 +
|-
 +
| Sentinels || set-process-sentinel process-sentinel waiting-for-user-input-p
 +
|-
 +
| Query Before Exit || process-query-on-exit-flag set-process-query-on-exit-flag process-kill-without-query
 +
|-
 +
| System Processes || list-system-processes process-attributes
 +
|-
 +
| Transaction Queues || tq-create tq-enqueue tq-close
 +
|-
 +
| Network || open-network-stream
 +
|-
 +
| Datagrams || process-datagram-address set-process-datagram-address
 +
|-
 +
| Low-Level Network || make-network-process set-network-process-option
 +
|-
 +
| Misc Network || network-interface-list network-interface-info format-network-address
 +
|-
 +
| Serial Ports || serial-term make-serial-process serial-process-configure
 +
|-
 +
| Byte Packing || bindat-unpack bindat-get-field bindat-length bindat-pack bindat-ip-to-string
 +
|}
 +
 +
=== System Interface ===
 +
<!-- TODO: need to format variable, command, etc -->
 +
{| class="wikitable"
 +
|+ System Interface related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Starting Up || inhibit-startup-screen initial-buffer-choice inhibit-startup-echo-area-message initial-scratch-message site-run-file inhibit-default-init before-init-hook after-init-hook emacs-startup-hook user-init-file user-emacs-directory term-file-prefix term-setup-hook command-line command-line-processed command-switch-alist command-line-args command-line-args-left command-line-functions
 +
|-
 +
| Getting Out || kill-emacs kill-emacs-query-functions kill-emacs-hook suspend-emacs suspend-hook suspend-resume-hook suspend-tty resume-tty controlling-tty-p suspend-frame
 +
|-
 +
| System Environment || system-configuration system-type system-name mail-host-address getenv setenv process-environment initial-environment path-separator parse-colon-path invocation-name invocation-directory
 +
installation-directory load-average emacs-pid emacs-pid
 +
|-
 +
| User Identification || init-file-user user-mail-address user-login-name user-real-login-name user-full-name user-real-uid user-uid
 +
|-
 +
| Time of Day || current-time-string current-time current-time-zone set-time-zone-rule float-time
 +
|-
 +
| Time Conversion || decode-time encode-time
 +
|-
 +
| Time Parsing || date-to-time format-time-string seconds-to-time format-seconds
 +
|-
 +
| Processor Run Time || emacs-uptime get-internal-run-time emacs-init-time
 +
|-
 +
| Time Calculations || time-less-p time-subtract time-add time-to-days time-to-day-in-year date-leap-year-p
 +
|-
 +
| Timers || run-at-time timer-max-repeats with-timeout cancel-timer
 +
|-
 +
| Idle Timers || run-with-idle-timer current-idle-time
 +
|-
 +
| Terminal Input || set-input-mode current-input-mode recent-keys open-dribble-file
 +
|-
 +
| Terminal Output || baud-rate send-string-to-terminal open-termscript
 +
|-
 +
| Sound Output || play-sound play-sound-file play-sound-functions
 +
|-
 +
| X11 Keysyms || system-key-alist x-alt-keysym x-meta-keysym x-hyper-keysym x-super-keysym
 +
|-
 +
| Batch Mode || noninteractive
 +
|-
 +
| Session Management || emacs-save-session-functions
 +
|}
 +
 +
=== Display ===
 +
<!-- TODO: need to format variable, command, etc -->
 
[[Category:Emacs Lisp]]
 
[[Category:Emacs Lisp]]
 +
{| class="wikitable"
 +
|+ Display related function and ''Variable''
 +
|-
 +
| Category || Functions ''Variable''
 +
|-
 +
| Refresh Screen || redraw-frame redraw-display no-redraw-on-reenter
 +
|-
 +
| Forcing Redisplay || redisplay force-window-update redisplay-dont-pause redisplay-preemption-period
 +
|-
 +
| Truncation || truncate-lines truncate-partial-width-windows wrap-prefix line-prefix cache-long-line-scans
 +
|-
 +
| The Echo Area || message with-temp-message message-or-box message-box display-message-or-buffer current-message make-progress-reporter progress-reporter-update progress-reporter-force-update progress-reporter-done dotimes-with-progress-reporter message-log-max cursor-in-echo-area echo-area-clear-hook echo-keystrokes message-truncate-lines cursor-in-echo-area echo-area-clear-hook echo-keystrokes message-truncate-lines
 +
|-
 +
| Warnings || display-warning lwarn warn warning-levels warning-prefix-function warning-series warning-fill-prefix warning-type-format warning-minimum-level warning-minimum-log-level warning-suppress-types warning-suppress-log-types
 +
|-
 +
| Invisible Text || buffer-invisibility-spec add-to-invisibility-spec remove-from-invisibility-spec invisible-p
 +
|-
 +
|  Selective Display || selective-display selective-display-ellipses
 +
|-
 +
|  Temporary Displays || with-output-to-temp-buffer temp-buffer-show-function temp-buffer-setup-hook temp-buffer-show-hook momentary-string-display
 +
|-
 +
| Overlays || overlayp make-overlay overlay-start overlay-end overlay-buffer delete-overlay move-overlay remove-overlays copy-overlay overlay-recenter overlay-get overlay-put overlay-properties overlays-at overlays-in next-overlay-change previous-overlay-change
 +
|-
 +
| Width || char-width string-width truncate-string-to-width
 +
|-
 +
| rowspan="11" | Faces || facep defface
 +
|-
 +
|frame-background-mode
 +
|-
 +
| font-family-list underline-minimum-offset x-bitmap-file-path bitmap-spec-p
 +
|-
 +
| set-face-attribute face-attribute face-attribute-relative-p face-all-attributes merge-face-attribute set-face-foreground set-face-background set-face-stipple set-face-font set-face-bold-p set-face-italic-p set-face-underline-p set-face-inverse-video-p
 +
|-
 +
| invert-face face-remapping-alist face-remap-add-relative face-remap-remove-relative face-remap-set-base face-remap-reset-base
 +
|-
 +
| make-face face-list copy-face face-id face-documentation face-equal face-differs-from-default-p define-obsolete-face-alias
 +
|-
 +
| fontification-functions
 +
|-
 +
| face-font-family-alternatives face-font-selection-order face-font-registry-alternatives
 +
|-
 +
| scalable-fonts-allowed face-font-rescale-alist x-list-fonts x-family-fonts font-list-limit
 +
|-
 +
| create-fontset-from-fontset-spec set-fontset-font char-displayable-p
 +
|-
 +
| fontp font-at font-spec font-put find-font list-fonts font-get font-face-attributes font-xlfd-name
 +
|-
 +
| Fringes || fringes-outside-margins left-fringe-width right-fringe-width set-window-fringes window-fringes indicate-empty-lines indicate-buffer-boundaries fringe-indicator-alist overflow-newline-into-fringe fringe-cursor-alist fringe-bitmaps-at-pos define-fringe-bitmap destroy-fringe-bitmap set-fringe-bitmap-face overlay-arrow-string overlay-arrow-position overlay-arrow-variable-list
 +
|-
 +
| Scroll Bars || frame-current-scroll-bars set-window-scroll-bars window-scroll-bars scroll-bar-mode window-current-scroll-bars scroll-bar-width
 +
|-
 +
| Display Property || left-margin-width right-margin-width set-window-margins window-margins
 +
|-
 +
| Images || image-types image-library-alist image-type-available-p image-mask-p create-image defimage find-image image-load-path image-load-path-for-library insert-image insert-sliced-image put-image remove-images image-size max-image-size image-refresh clear-image-cache image-cache-eviction-delay
 +
|-
 +
| Buttons || define-button-type make-button insert-button make-text-button insert-text-button button-start button-end button-get button-put button-activate button-label button-type button-has-type-p button-at button-type-put button-type-get button-type-subtype-p push-button forward-button backward-button next-button previous-button
 +
|-
 +
| Abstract Display || ewoc-create ewoc-buffer ewoc-get-hf ewoc-set-hf ewoc-enter-first ewoc-enter-last ewoc-enter-before ewoc-enter-after ewoc-prev ewoc-next ewoc-nth ewoc-data ewoc-set-data ewoc-locate ewoc-location ewoc-goto-prev ewoc-goto-next ewoc-goto-node ewoc-refresh ewoc-invalidate ewoc-delete ewoc-filter ewoc-collect ewoc-map
 +
|-
 +
| Blinking || blink-paren-function blink-matching-paren blink-matching-paren-distance blink-matching-delay blink-matching-open
 +
|-
 +
| Usual Display || ctl-arrow tab-width
 +
|-
 +
| Display Tables || make-display-table display-table-slot set-display-table-slot describe-display-table describe-current-display-table window-display-table set-window-display-table buffer-display-table standard-display-table make-glyph-code glyph-char glyph-face glyph-table create-glyph
 +
|-
 +
| Beeping || ding beep visible-bell ring-bell-function
 +
|-
 +
| Window Systems || window-system initial-window-system window-system window-setup-hook
 +
|}
 +
 +
== Third party libraries ==
 +
 +
=== s.el, a string manipulation library ===
 +
 +
[https://github.com/magnars/s.el '''s.el'''] is a modern string manipulation api. It's available on [[marmalade]] and [[Melpa]].
 +
 +
=== dash.el, a modern list library ===
 +
 +
[https://github.com/magnars/dash.el '''dash.el'''] is a modern list library for emacs. It's available on [[marmalade]] and [[Melpa]].
 +
 +
=== [https://github.com/phillord/m-buffer-el m-buffer.el], functions for operating over the contents of Emacs buffers ===

Latest revision as of 01:09, 20 January 2017

Special form

special form has its own rule for which arguments are evaluated

Special Form
Purpose Forms
Definition defconst defun defvar
Binding constructs let let* function
Conditional evaluation and cond if or
Sequential evaluation prog1 prog2 progn
Iteration while function
Syntactic extension defmacro
Quoting quote
Assignment setq setq-default
Nonlocal Exits catch condition-case unwind-protect
Save save-current-buffer save-excursion save-restriction save-window-excursion
Other interactive track-mouse with-output-to-temp-buffer

Standard Library

Including function, variable, command, option, macro, Special Form

Number

Emacs supports two numeric data types: integers and floating point numbers

Number related function and Variable
Category Functions Variable
Integer Basics most-positive-fixnum most-negative-fixnum
Floating Point Basics logb float-e float-pi
Type Predicate Test floatp integerp numberp wholenump zerop
Comparison = eql /= < <= > >= max min abs
Conversions float truncate floor ceiling round
Arithmetic Operations 1+ 1- + - * / % mod
Rounding Operations ffloor fceiling ftruncate fround
Bitwise Operations lsh ash logand logior logxor lognot
Mathematical Functions sin cos tan asin acos atan exp log log10 expt sqrt
Random Numbers random

String and Character

A string in Emacs Lisp is an array that contains an ordered sequence of characters

String and Character related function and Variable
Category Functions Variable
Predicates for Strings stringp string-or-null-p char-or-string-p
Creating Strings make-string string substring substring-no-properties concat split-string split-string-default-separators
Modifying Strings store-substring clear-string
Comparison char-equal string= string-equal string< string-lessp compare-strings assoc-string
Conversion number-to-string string-to-number char-to-string string-to-char
Formatting Strings format
Case Conversion downcase upcase capitalize upcase-initials
The Case Table case-table-p set-standard-case-table standard-case-table current-case-table set-case-table with-case-table ascii-case-table set-case-syntax-pair set-case-syntax-delims set-case-syntax describe-buffer-case-table

Tip: you can also use a modern string manipulation library with s.el

List

Lists are built up from cons cells

List related function and Variable
Category Functions Variable
List-related Predicates consp atom listp nlistp null
List Elements car cdr car-safe cdr-safe pop nth nthcdr last safe-length caar cadr cadr cadr butlast nbutlast
Building Lists cons list make-list append reverse copy-tree number-sequence
List Variables push add-to-list add-to-ordered-list
Modifying Lists setcar setcdr nconc nreverse sort
Sets And Lists memq delq remq memql member delete remove member-ignore-case delete-dups
Association Lists assoc rassoc sassq rassq assoc-default copy-alist assq-delete-all rassq-delete-all
Rings make-ring ring-p ring-size ring-length ring-elements ring-copy ring-empty-p ring-ref ring-insert ring-remove ring-insert-at-beginning


Tip: you can benefit from a modern list manipulation api with dash.el and the newer seq.el, that iterates over all sequences (lists, vectors, strings) (but does not have anaphoric macros).

Vector

see seq.el that iterates over sequences, and so vectors.

Vector related function and Variable
Category Functions Variable
Vector Functions vectorp vector make-vector vconcat
Bool-vectors make-bool-vector bool-vector-p

Sequence

sequence type is the union of two other Lisp types: lists and arrays. While array has four types, all one-dimensional: strings, vectors, bool-vectors, char-tables.

See seq.el that iterates over sequences.

Sequence related function and Variable
Category Functions Variable
Sequence Functions sequencep length elt copy-sequence
Array Functions arrayp aref aset fillarray
Char-Tables make-char-table char-table-p char-table-subtype char-table-parent set-char-table-parent char-table-extra-slot set-char-table-extra-slot char-table-range set-char-table-range map-char-table

Hash Tables

Hash Tables related function and Variable
Category Functions Variable
Creating Hash make-hash-table makehash
Hash Access gethash puthash remhash clrhash maphash
Defining Hash define-hash-table-test sxhashsxhash
Other Hash hash-table-p copy-hash-table hash-table-count hash-table-test hash-table-weakness hash-table-rehash-size hash-table-rehash-threshold hash-table-size

Symbols

Symbols related function and Variable
Category Functions Variable
Predicates for symbols symbolp
Creating Symbols symbol-name make-symbol intern intern-soft obarray mapatoms unintern
Property Lists symbol-plist setplist get put plist-get plist-put lax-plist-get lax-plist-put plist-member

Minibuffer

A minibuffer is a special buffer that Emacs commands use to read arguments more complicated than the single numeric prefix argument.

Minibuffer related function and Variable
Category Functions Variable
Text from Minibuffer read-from-minibuffer read-string read-regexp minibuffer-allow-text-properties minibuffer-local-map read-no-blanks-input minibuffer-local-ns-map
Object from Minibuffer read-minibuffer eval-minibuffer edit-and-eval-command
Minibuffer History add-to-history history-add-new-input history-length history-delete-duplicates minibuffer-history query-replace-history file-name-history buffer-name-history regexp-history extended-command-history shell-command-history read-expression-history
Basic Completion try-completion all-completions test-completion completion-boundaries completion-ignore-case completion-regexp-list lazy-completion-table completion-in-region
Minibuffer Completion completing-read
Completion Commands minibuffer-completion-table minibuffer-completion-predicate minibuffer-completion-confirm minibuffer-confirm-exit-commands minibuffer-complete-word minibuffer-complete minibuffer-complete-and-exit minibuffer-completion-help display-completion-list completion-auto-help minibuffer-local-completion-map minibuffer-local-must-match-map minibuffer-local-filename-completion-map minibuffer-local-filename-must-match-map
High-Level Completion read-buffer read-buffer-function read-buffer-completion-ignore-case read-command read-variable read-color
Reading File Names read-file-name read-file-name-function read-file-name-completion-ignore-case read-directory-name insert-default-directory read-shell-command minibuffer-local-shell-command-map
Completion Styles completion-styles completion-styles-alist
Programmed Completion completion-table-dynamic completion-annotate-function
Yes-or-No Queries y-or-n-p y-or-n-p-with-timeout yes-or-no-p
Multiple Queries map-y-or-n-p
Reading a Password read-passwd
Minibuffer Commands exit-minibuffer self-insert-and-exit previous-history-element next-history-element previous-matching-history-element next-matching-history-element
Minibuffer Contents minibuffer-prompt minibuffer-prompt-end minibuffer-prompt-width minibuffer-contents minibuffer-contents-no-properties minibuffer-completion-contents delete-minibuffer-contents
Minibuffer Windows active-minibuffer-window minibuffer-window set-minibuffer-window window-minibuffer-p minibuffer-window-active-p
Recursive Mini minibuffer-depth enable-recursive-minibuffers
Minibuffer Miscellany minibufferp minibuffer-setup-hook minibuffer-exit-hook minibuffer-help-form minibuffer-scroll-window minibuffer-selected-window max-mini-window-height

Keymaps

Keymaps related function and Variable
Category Functions Variable
Key Sequences kbd
Format of Keymaps keymapp
Creating Keymaps make-sparse-keymap make-keymap copy-keymap
Inheritance and Keymaps keymap-parent set-keymap-parent
Prefix Keys define-prefix-command
Active Keymaps current-active-maps key-binding
Controlling the Active Keymaps global-map current-global-map current-local-map current-minor-mode-maps use-global-map use-local-map minor-mode-map-alist minor-mode-overriding-map-alist overriding-local-map overriding-terminal-local-map overriding-local-map-menu-flag special-event-map emulation-mode-map-alists
Functions for Key Lookup lookup-key undefined local-key-binding global-key-binding minor-mode-key-binding meta-prefix-char
Changing Key Bindings define-key substitute-key-definition suppress-keymap
Remapping Commands command-remapping
Translation Keymaps input-decode-map local-function-key-map key-translation-map
Key Binding Commands global-set-key global-unset-key local-set-key local-unset-key
Scanning Keymaps accessible-keymaps map-keymap where-is-internal describe-bindings
Menu Keymaps keymap-prompt
Menus and the Keyboard menu-prompt-more-char
Menu Bar menu-bar-final-items menu-bar-update-hook
Tool Bar tool-bar-map tool-bar-add-item tool-bar-add-item-from-menu tool-bar-local-item-from-menu auto-resize-tool-bars auto-raise-tool-bar-buttons tool-bar-button-margin tool-bar-button-relief tool-bar-border
Modifying Menus define-key-after

File

See: f.el, a modern library for working with files and directories.

File related function and Variable
Category Functions Variable
Visiting Files find-file find-file-literally find-file-noselect find-file-other-window find-file-read-only view-file find-file-wildcards find-file-hook find-file-not-found-functions find-file-literally create-file-buffer after-find-file
Saving Buffers save-buffer save-some-buffers write-file write-file-functions write-contents-functions before-save-hook after-save-hook file-precious-flag require-final-newline
Reading from Files insert-file-contents insert-file-contents-literally
Writing to Files append-to-file write-region with-temp-file
File Locks file-locked-p lock-buffer unlock-buffer ask-user-about-lock
Information about Files file-exists-p file-readable-p file-executable-p file-writable-p file-accessible-directory-p access-file file-ownership-preserved-p file-newer-than-file-p file-symlink-p file-directory-p file-regular-p file-truename file-chase-links file-modes file-nlinks file-attributes locate-file executable-find
Changing Files add-name-to-file rename-file copy-file make-symbolic-link delete-file set-file-modes set-default-file-modes default-file-modes read-file-modes file-modes-symbolic-to-number set-file-times
File Names file-name-directory file-name-nondirectory file-name-sans-versions file-name-extension file-name-sans-extension file-name-absolute-p file-relative-name file-name-as-directory directory-file-name abbreviate-file-name expand-file-name default-directory substitute-in-file-name make-temp-file make-temp-name temporary-file-directory small-temporary-file-directory file-name-all-completions file-name-completion completion-ignored-extensions convert-standard-filename
Contents of Directories directory-files directory-files-and-attributes file-expand-wildcards insert-directory insert-directory-program
Create/Delete Dirs make-directory copy-directory delete-directory
Magic File Names inhibit-file-name-handlers inhibit-file-name-operation find-file-name-handler file-local-copy file-remote-p unhandled-file-name-directory
Format Conversion format-alist buffer-file-format format-write-file format-find-file format-insert-file buffer-auto-save-file-format write-region-annotate-functions write-region-post-annotation-function after-insert-file-functions

Buffer

buffer is a lisp object containing text to be edited

Buffer related function and Variable
Category Functions Variable
Basic bufferp current-buffer set-buffer save-current-buffer with-current-buffer with-temp-buffer
Buffer Names buffer-name rename-buffer get-buffer generate-new-buffer-name
Buffer File Name buffer-file-name buffer-file-name buffer-file-truename buffer-file-number get-file-buffer find-buffer-visting set-visted-file-name list-buffers-directory
Buffer Modification buffer-modified-p set-buffer-modified-p restore-buffer-modified-p not-modified buffer-modified-tick buffer-chars-modified-tick
Buffer Modification Time verify-visited-file-modtime clear-visited-file-modtime visited-file-modtime set-visited-file-modtime ask-user-about-supersession-threat
Read-Only Buffers buffer-read-only inhibit-read-only toggle-read-only barf-if-buffer-read-only
Buffer List buffer-list other-buffer last-buffer bury-buffer unbury-buffer
Creating Buffers get-buffer-creat generate-new-buffer
Killing Buffers kill-buffer kill-buffer-query-function kill-buffer-hook buffer-offer-save buffer-save-without-query buffer-live-p
Indirect Buffers make-indirect-buffer clone-indirect-buffer buffer-base-buffer
Swapping Text Between Two Buffers buffer-swap-text
Buffer Gap gap-position gap-size

Windows

Windows related function and Variable
Category Functions Variable
Basic Windows windowp
Splitting Windows split-window split-window-vertically split-window-keep-point split-window-horizontally one-window-p
Deleting Windows window-live-p delete-window delete-other-windows delete-windows-on
Selecting Windows selected-window select-window save-selected-window with-selected-window get-lru-window get-largest-window get-window-with-predicate
Cyclic Window Ordering next-window previous-window other-window walk-windows window-list
Buffers and Windows set-window-buffer buffer-display-count window-buffer get-buffer-window get-buffer-window-list buffer-display-time
Displaying Buffers switch-to-buffer switch-to-buffer-other-window pop-to-buffer replace-buffer-in-windows
Choosing Window display-buffer display-buffer-reuse-frames pop-up-windows split-window-preferred-function split-window-sensibly split-height-threshold split-width-threshold even-window-heights pop-up-frames pop-up-frame-function pop-up-frame-alist special-display-buffer-names special-display-regexps special-display-p special-display-function special-display-popup-frame special-display-frame-alist same-window-buffer-names same-window-regexps same-window-p display-buffer-function
Dedicated Windows window-dedicated-p set-window-dedicated-p
Window Point window-point set-window-point window-point-insertion-type
Window Start and End window-start window-end set-window-start pos-visible-in-window-p window-line-height
Textual Scrolling scroll-up scroll-down scroll-other-window other-window-scroll-buffer scroll-margin scroll-conservatively scroll-down-aggressively scroll-up-aggressively scroll-step scroll-preserve-screen-position next-screen-context-lines recenter
Vertical Scrolling window-vscroll set-window-vscroll auto-window-vscroll
Horizontal Scrolling scroll-left scroll-right window-hscroll set-window-hscroll
Size of Window window-height window-body-height window-full-height-p window-width window-full-width-p window-edges window-inside-edges window-pixel-edges window-inside-pixel-edges
Resizing Windows enlarge-window enlarge-window-horizontally shrink-window shrink-window-horizontally adjust-window-trailing-edge fit-window-to-buffer shrink-window-if-larger-than-buffer window-size-fixed window-min-height window-min-width balance-windows balance-windows-area
Coordinates and Windows window-at coordinates-in-window-p
Window Tree window-tree
Window Configurations current-window-configuration set-window-configuration save-window-excursion window-configuration-p compare-window-configurations window-configuration-frame
Window Parameters window-parameter window-parameters set-window-parameter
Window Hooks window-scroll-functions window-size-change-functions window-configuration-change-hook

Frames

Frames related function and Variable
Category Functions Variable
Creating Frames make-frame before-make-frame-hook after-make-frame-functions frame-inherited-parameters
Multiple Terminals terminal-name terminal-list get-device-terminal delete-terminal delete-terminal-functions make-frame-on-display x-display-list x-open-connection x-close-connection
Frame Parameters frame-parameter frame-parameters modify-frame-parameters set-frame-parameter modify-all-frames-parameters initial-frame-alist minibuffer-frame-alist default-frame-alist blink-cursor-alist cursor-in-non-selected-windows set-frame-position frame-height frame-width frame-pixel-height frame-pixel-width frame-char-height frame-char-width set-frame-size set-frame-height set-frame-width x-parse-geometry
Terminal Parameters terminal-parameters terminal-parameter set-terminal-parameter
Frame Titles frame-title-format icon-title-format multiple-frames
Deleting Frames delete-frame frame-live-p
Finding All Frames frame-list visible-frame-list next-frame previous-frame
Frames and Windows window-frame frame-first-window frame-selected-window set-frame-selected-window
Minibuffers and Frames default-minibuffer-frame
Input Focus selected-frame select-frame-set-input-focus select-frame handle-switch-frame redirect-frame-focus focus-follows-mouse
Visibility of Frames make-frame-visible make-frame-invisible iconify-frame frame-visible-p
Raising and Lowering raise-frame lower-frame minibuffer-auto-raise
Frame Configurations current-frame-configuration set-frame-configuration
Mouse Tracking track-mouse
Mouse Position mouse-position mouse-position-function set-mouse-position mouse-pixel-position set-mouse-pixel-position
Pop-Up Menus x-popup-menu
Dialog Boxes x-popup-dialog
Pointer Shape void-text-area-pointer x-pointer-shape x-sensitive-text-pointer-shape
Window System Selections x-set-selection x-get-selection x-get-cut-buffer x-set-cut-buffer selection-coding-system x-select-enable-clipboard
Color Names color-defined-p defined-colors color-supported-p color-gray-p color-values
Text Terminal Colors tty-color-define tty-color-clear tty-color-alist tty-color-approximate tty-color-translate
Resources x-get-resource x-resource-class x-resource-name inhibit-x-resources
Display Feature Testing display-popup-menus-p display-graphic-p display-mouse-p display-color-p display-grayscale-p display-supports-face-attributes-p display-selections-p display-images-p display-screens display-pixel-height display-pixel-width display-mm-height display-mm-width display-mm-dimensions-alist display-backing-store display-save-under display-planes display-visual-class display-color-cells x-server-version x-server-vendor

Positions

A position is the index of a character in the text of a buffer.

Positions related function and Variable
Category Functions Variable
Point point point-min point-max buffer-end buffer-size
Motion goto-char forward-char backward-char
forward-word backward-word words-include-escapes inhibit-field-text-motion
beginning-of-buffer end-of-buffer
beginning-of-line line-beginning-position end-of-line line-end-position forward-line count-lines line-number-at-pos
vertical-motion count-screen-lines move-to-window-line compute-motion
forward-list backward-list up-list down-list forward-sexp backward-sexp beginning-of-defun end-of-defun defun-prompt-regexp open-paren-in-column-0-is-defun-start beginning-of-defun-function end-of-defun-function
skip-chars-forward skip-chars-backward
Excursions save-excursion
Narrowing narrow-to-region narrow-to-page widen save-restriction

Marker

A marker is a Lisp object used to specify a position in a buffer relative to the surrounding text.

Marker related function and Variable
Category Functions Variable
Predicates on Markers markerp integer-or-marker-p number-or-marker-p
Creating Markers make-marker point-marker point-min-marker point-max-marker copy-marker
Information from Markers marker-position marker-buffer buffer-has-markers-at
Marker Insertion Types set-marker-insertion-type marker-insertion-type
Moving Markers set-marker move-marker
The Mark mark mark-marker set-mark push-mark pop-mark transient-mark-mode mark-even-if-inactive deactivate-mark deactivate-mark mark-active activate-mark-hook deactivate-mark-hook handle-shift-selection mark-ring mark-ring-max
The Region region-beginning region-end use-region-p

Text

Text is manipulated through Buffer object with point and marker.

Text related function and Variable
Category Function Variable
Near Point char-after char-before following-char preceding-char bobp eobp bolp eolp
Examining Buffer Contents buffer-substring buffer-substring-no-properties buffer-string filter-buffer-substring filter-buffer-substring-function buffer-substring-filters current-word thing-at-point
Comparing Text compare-buffer-substrings
Inserting Text insert insert-before-markers insert-char insert-buffer-substring insert-buffer-substring-no-properties
User-Level Insertion Commands insert-buffer self-insert-command newline overwrite-mode
Deleting Text erase-buffer delete-region delete-and-extract-region delete-char delete-backward-char backwar-delete-char-untabify backward-delete-char-untabify-method
User-Level Deletion Commands delete-horizontal-space delete-indentation fixup-whitespace just-one-space delete-blank-lines
The Kill Ring kill-region kill-read-only-ok copy-region-as-kill

insert-for-yank insert-buffer-substring-as-yank yank yank-pop yank-undo-function current-kill kill-new kill-append interprogram-paste-function interprogram-cut-function kill-ring kill-ring-yank-pointer kill-ring-max

Undo buffer-undo-list undo-boundary undo-in-progress primitive-undo
Maintaining Undo Lists buffer-enable-undo buffer-disable-undo undo-limit undo-strong-limit undo-outer-limit undo-ask-before-discard
Filling fill-paragraph fill-region fill-individual-paragraphs fill-individual-varying-indent fill-region-as-paragraph justify-current-line default-justification current-justification sentence-end-double-space sentence-end-without-period sentence-end-without-space fill-paragraph-function fill-forward-paragraph-function use-hard-newlines
Margins fill-prefix fill-column set-left-margin set-right-margin current-left-margin current-fill-column move-to-left-margin delete-to-left-margin indent-to-left-margin left-margin fill-nobreak-predicate
Adaptive Fill adaptive-fill-mode fill-context-prefix adaptive-fill-regexp adaptive-fill-first-line-regexp adaptive-fill-function
Auto Filling auto-fill-function normal-auto-fill-function auto-fill-chars
Sorting sort-subr sort-fold-case sort-regexp-fields sort-regexp-fields sort-paragraphs sort-pages sort-fields sort-numeric-fields sort-numeric-base sort-columns
Columns current-column move-to-column
Indentation current-indentation indent-to indent-tabs-mode indent-line-function indent-according-to-mode indent-for-tab-command newline-and-indent reindent-then-newline-and-indent indent-region indent-region-function indent-rigidly indent-code-rigidly indent-relative indent-relative-maybe tab-to-tab-stop tab-stop-list back-to-indentation backward-to-indentation forward-to-indentation
Case capitalize-region downcase-region upcase-region capitalize-word downcase-word upcase-word
Text Properties get-text-property get-char-property get-char-property-and-overlay char-property-alias-alist text-properties-at default-text-properties put-text-property add-text-properties remove-text-properties remove-list-of-text-properties set-text-properties propertize next-property-change previous-property-change next-single-property-change previous-single-property-change next-char-property-change previous-char-property-change next-single-char-property-change previous-single-char-property-change text-property-any text-property-not-all inhibit-point-motion-hooks show-help-function text-property-default-nonsticky insert-and-inherit insert-before-markers-and-inherit buffer-access-fontify-functions buffer-access-fontified-property mouse-on-link-p field-beginning field-end field-string field-string-no-properties delete-field constrain-to-field
Substituting subst-char-in-region translate-region
Transposition transpose-regions
Registers register-alist get-register set-register view-register insert-register
Base 64 base64-encode-region base64-encode-string base64-decode-region base64-decode-string
MD5 Checksum md5
Atomic Change prepare-change-group activate-change-group accept-change-group cancel-change-group
Change Hooks before-change-functions after-change-functions combine-after-change-calls first-change-hook inhibit-modification-hooks

Searching and Matching

Searching and Matching related function and Variable
Category Function Variable
String Search search-forward search-backward word-search-forward word-search-forward-lax word-search-backward word-search-backward-lax
Searching and Case Case-independent or case-significant searching.

case-fold-search case-replace

Regular Expressions regexp-quote regexp-opt regexp-opt-depth
Regexp Search re-search-forward re-search-backward string-match string-match-p looking-at looking-back looking-at-p search-spaces-regexp
POSIX Regexps posix-search-forward posix-search-backward posix-looking-at posix-string-match
Match Data replace-match match-substitute-replacement match-string match-string-no-properties match-beginning match-end match-data set-match-data save-match-data
Search and Replace replace-regexp-in-string perform-replace query-replace-map
Standard Regexps page-delimiter paragraph-separate paragraph-start sentence-end sentence-end

Processes

Processes related function and Variable
Category Functions Variable
Process Predicate processp
Subprocess Creation exec-suffixes exec-directory exec-path
Shell Arguments shell-quote-argument split-string-and-unquote combine-and-quote-strings
Synchronous Processes call-process process-file process-file-side-effects call-process-region call-process-shell-command process-file-shell-command shell-command-to-string process-lines
Asynchronous Processes start-process start-file-process start-process-shell-command start-file-process-shell-command process-connection-type
Deleting Processes delete-exited-processes delete-process
Process Information list-processes process-list get-process process-command process-contact process-id process-name process-status process-type process-exit-status process-tty-name process-coding-system set-process-coding-system process-get process-put process-plist set-process-plist
Input to Processes process-send-string process-send-region process-send-eof process-running-child-p
Signals to Processes interrupt-process kill-process quit-process stop-process continue-process signal-process
Output from Processes process-adaptive-read-buffering process-buffer process-mark set-process-buffer get-buffer-process set-process-filter process-filter accept-process-output
Sentinels set-process-sentinel process-sentinel waiting-for-user-input-p
Query Before Exit process-query-on-exit-flag set-process-query-on-exit-flag process-kill-without-query
System Processes list-system-processes process-attributes
Transaction Queues tq-create tq-enqueue tq-close
Network open-network-stream
Datagrams process-datagram-address set-process-datagram-address
Low-Level Network make-network-process set-network-process-option
Misc Network network-interface-list network-interface-info format-network-address
Serial Ports serial-term make-serial-process serial-process-configure
Byte Packing bindat-unpack bindat-get-field bindat-length bindat-pack bindat-ip-to-string

System Interface

System Interface related function and Variable
Category Functions Variable
Starting Up inhibit-startup-screen initial-buffer-choice inhibit-startup-echo-area-message initial-scratch-message site-run-file inhibit-default-init before-init-hook after-init-hook emacs-startup-hook user-init-file user-emacs-directory term-file-prefix term-setup-hook command-line command-line-processed command-switch-alist command-line-args command-line-args-left command-line-functions
Getting Out kill-emacs kill-emacs-query-functions kill-emacs-hook suspend-emacs suspend-hook suspend-resume-hook suspend-tty resume-tty controlling-tty-p suspend-frame
System Environment system-configuration system-type system-name mail-host-address getenv setenv process-environment initial-environment path-separator parse-colon-path invocation-name invocation-directory

installation-directory load-average emacs-pid emacs-pid

User Identification init-file-user user-mail-address user-login-name user-real-login-name user-full-name user-real-uid user-uid
Time of Day current-time-string current-time current-time-zone set-time-zone-rule float-time
Time Conversion decode-time encode-time
Time Parsing date-to-time format-time-string seconds-to-time format-seconds
Processor Run Time emacs-uptime get-internal-run-time emacs-init-time
Time Calculations time-less-p time-subtract time-add time-to-days time-to-day-in-year date-leap-year-p
Timers run-at-time timer-max-repeats with-timeout cancel-timer
Idle Timers run-with-idle-timer current-idle-time
Terminal Input set-input-mode current-input-mode recent-keys open-dribble-file
Terminal Output baud-rate send-string-to-terminal open-termscript
Sound Output play-sound play-sound-file play-sound-functions
X11 Keysyms system-key-alist x-alt-keysym x-meta-keysym x-hyper-keysym x-super-keysym
Batch Mode noninteractive
Session Management emacs-save-session-functions

Display

Display related function and Variable
Category Functions Variable
Refresh Screen redraw-frame redraw-display no-redraw-on-reenter
Forcing Redisplay redisplay force-window-update redisplay-dont-pause redisplay-preemption-period
Truncation truncate-lines truncate-partial-width-windows wrap-prefix line-prefix cache-long-line-scans
The Echo Area message with-temp-message message-or-box message-box display-message-or-buffer current-message make-progress-reporter progress-reporter-update progress-reporter-force-update progress-reporter-done dotimes-with-progress-reporter message-log-max cursor-in-echo-area echo-area-clear-hook echo-keystrokes message-truncate-lines cursor-in-echo-area echo-area-clear-hook echo-keystrokes message-truncate-lines
Warnings display-warning lwarn warn warning-levels warning-prefix-function warning-series warning-fill-prefix warning-type-format warning-minimum-level warning-minimum-log-level warning-suppress-types warning-suppress-log-types
Invisible Text buffer-invisibility-spec add-to-invisibility-spec remove-from-invisibility-spec invisible-p
Selective Display selective-display selective-display-ellipses
Temporary Displays with-output-to-temp-buffer temp-buffer-show-function temp-buffer-setup-hook temp-buffer-show-hook momentary-string-display
Overlays overlayp make-overlay overlay-start overlay-end overlay-buffer delete-overlay move-overlay remove-overlays copy-overlay overlay-recenter overlay-get overlay-put overlay-properties overlays-at overlays-in next-overlay-change previous-overlay-change
Width char-width string-width truncate-string-to-width
Faces facep defface
frame-background-mode
font-family-list underline-minimum-offset x-bitmap-file-path bitmap-spec-p
set-face-attribute face-attribute face-attribute-relative-p face-all-attributes merge-face-attribute set-face-foreground set-face-background set-face-stipple set-face-font set-face-bold-p set-face-italic-p set-face-underline-p set-face-inverse-video-p
invert-face face-remapping-alist face-remap-add-relative face-remap-remove-relative face-remap-set-base face-remap-reset-base
make-face face-list copy-face face-id face-documentation face-equal face-differs-from-default-p define-obsolete-face-alias
fontification-functions
face-font-family-alternatives face-font-selection-order face-font-registry-alternatives
scalable-fonts-allowed face-font-rescale-alist x-list-fonts x-family-fonts font-list-limit
create-fontset-from-fontset-spec set-fontset-font char-displayable-p
fontp font-at font-spec font-put find-font list-fonts font-get font-face-attributes font-xlfd-name
Fringes fringes-outside-margins left-fringe-width right-fringe-width set-window-fringes window-fringes indicate-empty-lines indicate-buffer-boundaries fringe-indicator-alist overflow-newline-into-fringe fringe-cursor-alist fringe-bitmaps-at-pos define-fringe-bitmap destroy-fringe-bitmap set-fringe-bitmap-face overlay-arrow-string overlay-arrow-position overlay-arrow-variable-list
Scroll Bars frame-current-scroll-bars set-window-scroll-bars window-scroll-bars scroll-bar-mode window-current-scroll-bars scroll-bar-width
Display Property left-margin-width right-margin-width set-window-margins window-margins
Images image-types image-library-alist image-type-available-p image-mask-p create-image defimage find-image image-load-path image-load-path-for-library insert-image insert-sliced-image put-image remove-images image-size max-image-size image-refresh clear-image-cache image-cache-eviction-delay
Buttons define-button-type make-button insert-button make-text-button insert-text-button button-start button-end button-get button-put button-activate button-label button-type button-has-type-p button-at button-type-put button-type-get button-type-subtype-p push-button forward-button backward-button next-button previous-button
Abstract Display ewoc-create ewoc-buffer ewoc-get-hf ewoc-set-hf ewoc-enter-first ewoc-enter-last ewoc-enter-before ewoc-enter-after ewoc-prev ewoc-next ewoc-nth ewoc-data ewoc-set-data ewoc-locate ewoc-location ewoc-goto-prev ewoc-goto-next ewoc-goto-node ewoc-refresh ewoc-invalidate ewoc-delete ewoc-filter ewoc-collect ewoc-map
Blinking blink-paren-function blink-matching-paren blink-matching-paren-distance blink-matching-delay blink-matching-open
Usual Display ctl-arrow tab-width
Display Tables make-display-table display-table-slot set-display-table-slot describe-display-table describe-current-display-table window-display-table set-window-display-table buffer-display-table standard-display-table make-glyph-code glyph-char glyph-face glyph-table create-glyph
Beeping ding beep visible-bell ring-bell-function
Window Systems window-system initial-window-system window-system window-setup-hook

Third party libraries

s.el, a string manipulation library

s.el is a modern string manipulation api. It's available on marmalade and Melpa.

dash.el, a modern list library

dash.el is a modern list library for emacs. It's available on marmalade and Melpa.

m-buffer.el, functions for operating over the contents of Emacs buffers