Function: rst-mode
rst-mode is an autoloaded, interactive and byte-compiled function
defined in rst.el.gz.
Signature
(rst-mode)
Documentation
Major mode for editing reStructuredText documents.
Turning on rst-mode calls the normal hooks text-mode-hook
and rst-mode-hook. This mode also supports font-lock
highlighting.
C-= rst-adjust
C-M-a rst-backward-section
C-M-e rst-forward-section
C-M-h rst-mark-section
C-c 1 rst-deprecated-compile
C-c 2 rst-deprecated-compile-alt-toolset
C-c 3 rst-deprecated-compile-pseudo-region
C-c 4 rst-deprecated-compile-pdf-preview
C-c 5 rst-deprecated-compile-slides-preview
C-c C-= rst-adjust
C-c C-a <t> rst-deprecated-adjust
C-c C-a C-a rst-adjust
C-c C-a C-d rst-display-hdr-hierarchy
C-c C-a C-h describe-prefix-bindings
C-c C-a C-s rst-straighten-sections
C-c C-b rst-deprecated-bullet-list-region
C-c C-c C-a rst-compile-alt-toolset
C-c C-c C-c rst-compile
C-c C-c C-h describe-prefix-bindings
C-c C-c C-p rst-compile-pdf-preview
C-c C-c C-s rst-compile-slides-preview
C-c C-c C-x rst-compile-pseudo-region
C-c C-d rst-deprecated-line-block-region
C-c C-e rst-deprecated-enumerate-region
C-c C-f rst-deprecated-toc-follow-link
C-c C-h describe-prefix-bindings
C-c C-l <t> rst-deprecated-shift-region
C-c C-l C-b rst-bullet-list-region
C-c C-l C-c rst-convert-bullets-to-enumeration
C-c C-l C-e rst-enumerate-region
C-c C-l C-h describe-prefix-bindings
C-c C-l C-s rst-straighten-bullets-region
C-c C-l TAB rst-insert-list
C-c C-n rst-deprecated-backward-section
C-c C-p rst-deprecated-forward-section
C-c C-r <t> rst-deprecated-shift-region
C-c C-r <tab> rst-shift-region
C-c C-r C-h describe-prefix-bindings
C-c C-r C-l rst-line-block-region
C-c C-s rst-deprecated-straighten-sections
C-c C-t C-h describe-prefix-bindings
C-c C-t C-j rst-toc-follow-link
C-c C-t C-t rst-toc
C-c C-t C-u rst-toc-update
C-c C-t TAB rst-toc-insert
C-c C-u rst-deprecated-toc-update
C-c C-v rst-deprecated-convert-bullets-to-enumeration
C-c C-w rst-deprecated-straighten-bullets-region
C-c RET rst-deprecated-mark-section
C-c TAB rst-deprecated-toc-insert
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
;; Use rst-mode for *.rst and *.rest files. Many ReStructured-Text files
;; use *.txt, but this is too generic to be set as a default.
;;;###autoload (add-to-list 'auto-mode-alist '("\\.re?st\\'" . rst-mode))
;;;###autoload
(define-derived-mode rst-mode text-mode "ReST"
"Major mode for editing reStructuredText documents.
\\<rst-mode-map>
Turning on `rst-mode' calls the normal hooks `text-mode-hook'
and `rst-mode-hook'. This mode also supports font-lock
highlighting.
\\{rst-mode-map}"
:abbrev-table rst-mode-abbrev-table
:syntax-table rst-mode-syntax-table
:group 'rst
;; Paragraph recognition.
(setq-local paragraph-separate
(rst-re '(:alt
"\f"
lin-end)))
(setq-local paragraph-start
(rst-re '(:alt
"\f"
lin-end
(:seq hws-tag par-tag- bli-sfx))))
;; Indenting and filling.
(setq-local indent-line-function #'rst-indent-line)
(setq-local adaptive-fill-mode t)
(setq-local adaptive-fill-regexp (rst-re 'hws-tag 'par-tag- "?" 'hws-tag))
(setq-local adaptive-fill-function #'rst-adaptive-fill)
(setq-local fill-paragraph-handle-comment nil)
;; Comments.
(setq-local comment-start ".. ")
(setq-local comment-start-skip (rst-re 'lin-beg 'exm-tag 'bli-sfx))
(setq-local comment-continue " ")
(setq-local comment-multi-line t)
(setq-local comment-use-syntax nil)
;; reStructuredText has not really a comment ender but nil is not really a
;; permissible value.
(setq-local comment-end "")
(setq-local comment-end-skip nil)
;; Commenting in reStructuredText is very special so use our own set of
;; functions.
(setq-local comment-line-break-function #'rst-comment-line-break)
(setq-local comment-indent-function #'rst-comment-indent)
(setq-local comment-insert-comment-function #'rst-comment-insert-comment)
(setq-local comment-region-function #'rst-comment-region)
(setq-local uncomment-region-function #'rst-uncomment-region)
;; Imenu and which function.
;; FIXME: Check documentation of `which-function' for alternative ways to
;; determine the current function name.
(setq-local imenu-create-index-function #'rst-imenu-create-index)
;; Font lock.
(setq-local font-lock-defaults
'(rst-font-lock-keywords
t nil nil nil
(font-lock-multiline . t)
(font-lock-mark-block-function . mark-paragraph)))
(add-hook 'font-lock-extend-region-functions
#'rst-font-lock-extend-region nil t)
;; Text after a changed line may need new fontification.
(setq-local jit-lock-contextually t)
;; Indentation is not deterministic.
(setq-local electric-indent-inhibit t))