From 3b246fa9d04caae33874ab85d5b5b6f99289df2e Mon Sep 17 00:00:00 2001 From: blais Date: Mon, 14 Nov 2005 19:18:01 +0000 Subject: [PATCH] - Added default bindings for rst-compile - Added constants for paragraph-{start,separate} - Fixed bug with rst-toc when the file was empty. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils@4050 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- tools/editors/emacs/rst.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/editors/emacs/rst.el b/tools/editors/emacs/rst.el index c9f597753..692bf5075 100644 --- a/tools/editors/emacs/rst.el +++ b/tools/editors/emacs/rst.el @@ -205,6 +205,8 @@ (define-key rst-prefix-map "r" 'rst-shift-region-right) (define-key rst-prefix-map "l" 'rst-shift-region-left) (define-key rst-prefix-map "u" 'rst-toc-insert-update) +(define-key rst-prefix-map "c" 'rst-compile) +(define-key rst-prefix-map "C" (lambda () (interactive) (rst-compile t))) (defun rst-text-mode-bindings () "Default text mode hook for rest." @@ -238,6 +240,20 @@ "con" ".. contents::\n..\n " nil 0) +;; Paragraph separation customization. Set those to replace the default values +;; of text-mode. These will work better in restructuredtext documents and should +;; not affect filling for other documents too much. Set it up like this: +;; +;; (setq paragraph-start rst-paragraph-start +;; paragraph-separate rst-paragraph-separate) +(defvar rst-paragraph-separate + "\f\\|>*[ \t]*$" + "Extra parapraph-separate patterns to add for text-mode.") + +(defvar rst-paragraph-start + "\f\\|>*[ \t]*$\\|>*[ \t]*[-+*] \\|>*[ \t]*[0-9]+\\. " + "Extra parapraph-start patterns to add for text-mode.") + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1286,8 +1302,9 @@ child. This has advantages later in processing the graph." (let ((ndeco (cadr decos)) node children) + ;; If the next decoration matches our level - (when (= (car ndeco) lev) + (when (and ndeco (= (car ndeco) lev)) ;; Pop the next decoration and create the current node with it (setcdr decos (cddr decos)) (setq node (cdr ndeco)) ) @@ -1324,7 +1341,7 @@ child. This has advantages later in processing the graph." (let* ((curpoint (or point (point)))) ;; Check if we are before the current node. - (if (>= curpoint (cadar node)) + (if (and (cadar node) (>= curpoint (cadar node))) ;; Iterate all the children, looking for one that might contain the ;; current section. -- 2.11.4.GIT