Commit 6d3f7c2f authored by Stefan Merten's avatar Stefan Merten
Browse files

Silence `checkdoc-ispell' errors where possible. Fix authors. Improve

comments.  Improve loading of `cl'.

(rst-mode-abbrev-table): Merge definition.
(rst-mode): Make sure `font-lock-defaults' is buffer local.
(rst-define-key, rst-deprecated-keys, rst-call-deprecated): Refactor.
parent 6dbaa1c7
......@@ -125,31 +125,31 @@ to highlight changes in context diffs.
** reStructuredText mode
*** Nearly all keys are rebound making room for more keys and comply
better to usage in other modes. Bindings are described with C-c C-h.
*** Rebind nearly all keys making room for more keys and complying
better to usage in other modes. Describe bindings with C-c C-h.
*** Major revision of indentation. Now works very similarly to other modes.
TAB is your friend.
*** Major revision of indentation working very similar to other
modes. TAB is your friend.
*** Major revision of filling. Works fine with most of
reStructuredText syntax. Auto-filling is also supported.
*** Major revision of filling working fine with most of
reStructuredText syntax. Support auto-filling.
*** Major revision of comment handling.
*** Major revision of fontification. Now works with `jit-lock-mode'.
*** Major revision of fontification working with `jit-lock-mode'.
*** reStructuredText syntax is covered more closely in many cases.
Among other things this improves the experience for Sphinx users.
*** Cover reStructuredText syntax more closely. Improve
the experience for Sphinx users.
*** `rst-insert-list' inserts a new list or continues existing lists.
*** `rst-insert-list' inserts new list or continues existing lists.
*** Customization is extended, corrected and improved.
*** Extend correct and improve customization.
*** Negative prefix argument always works for `rst-adjust'.
*** Window configuration is reset after displaying TOC.
*** Reset window configuration after displaying TOC.
*** There is a package version in `rst-version'.
*** Package version in `rst-version'.
** New `derived-mode' filter for Ibuffer, bound to `/ M'.
`/ m' is now bound to filter by used-mode, which used to be bound to `/ M'.
......
2012-05-29 Stefan Merten <smerten@oekonux.de>
* textmodes/rst.el: Silence `checkdoc-ispell' errors where
possible. Fix authors. Improve comments. Improve loading of
`cl'.
(rst-mode-abbrev-table): Merge definition.
(rst-mode): Make sure `font-lock-defaults' is buffer local.
(rst-define-key, rst-deprecated-keys, rst-call-deprecated): Refactor.
2012-05-29 Ulf Jasper <ulf.jasper@web.de>
 
* calendar/icalendar.el
......@@ -791,6 +801,109 @@
* man.el (Man-unindent): Use text-property-default-nonsticky to
prevent untabify from inheriting face properties (Bug#11408).
 
2012-05-05 Stefan Merten <smerten@oekonux.de>
* textmodes/rst.el: Major merge with upstream development up to
Docutils SVN r7399 / rst.el V1.2.1.
Clarify maintainership and authors.
(rst-extract-version, rst-cvs-header, rst-cvs-rev)
(rst-cvs-timestamp, rst-svn-rev, rst-svn-timestamp)
(rst-official-version, rst-official-cvs-rev, rst-version)
(rst-package-emacs-version-alist): New functions and variables
for version information.
(rst-bullets, rst-uri-schemes, rst-adornment-chars)
(rst-max-inline-length, rst-re-alist-def, rst-re-alist)
(rst-mode-syntax-table, rst-mode): New and corrected functions
and variables representing reStructuredText features.
(rst-re): New function for reStructuredText regexes. Use in
many places.
(rst-deprecated-keys, rst-call-deprecated, rst-define-key)
(rst-mode-map): Rebind keys.
(rst-mode-lazy, rst-font-lock-keywords)
(rst-font-lock-extend-region)
(rst-font-lock-extend-region-internal)
(rst-font-lock-extend-region-extend)
(rst-font-lock-find-unindented-line-limit)
(rst-font-lock-find-unindented-line-match)
(rst-adornment-level, rst-font-lock-adornment-level)
(rst-font-lock-adornment-match)
(rst-font-lock-handle-adornment-pre-match-form)
(rst-font-lock-handle-adornment-matcher): Major revision of
font-locking. Integrate with other code. Use `jit-lock-mode'.
(rst-preferred-adornments, rst-adjust-hook)
(rst-new-adornment-down, rst-preferred-bullets)
(rst-preferred-bullets, rst-indent, rst-indent-width)
(rst-indent-field, rst-indent-literal-normal)
(rst-indent-literal-minimized, rst-indent-comment): Change,
extend and improve customization.
(rst-line-homogeneous-p, rst-line-homogeneous-nodent-p)
(rst-normalize-cursor-position, rst-get-decoration)
(rst-straighten-deco-spacing, rst-re-bullets, rst-re-items)
(rst-rstrip, rst-toc-insert-find-delete-contents)
(rst-shift-fill-region, rst-compute-bullet-tabs)
(rst-debug-print-tabs, rst-debug-mark-found)
(rst-shift-region-guts, rst-shift-region-right)
(rst-shift-region-left, rst-use-char-classes)
(rst-font-lock-keywords-function)
(rst-font-lock-indentation-point)
(rst-font-lock-find-unindented-line-begin)
(rst-font-lock-find-unindented-line-end)
(rst-font-lock-find-unindented-line)
(rst-font-lock-adornment-point, rst-font-lock-level)
(rst-adornment-level-alist): Remove functions and variables.
(rst-compare-adornments, rst-get-adornment-match)
(rst-suggest-new-adornment, rst-get-adornments-around)
(rst-adornment-complete-p, rst-get-next-adornment)
(rst-adjust-adornment, rst-display-adornments-hierarchy)
(rst-straighten-adornments): Standardize function names to
use "adornment" instead of "decoration". Correct callers.
Similar standardizing in many places.
(rst-update-section, rst-adjust, rst-promote-region)
(rst-enumerate-region, rst-bullet-list-region)
(rst-repeat-last-character): Correct use of `interactive'.
(rst-classify-adornment, rst-find-all-adornments)
(rst-get-hierarchy, rst-adjust-adornment, rst-toc-update)
(rst-find-leftmost-column, rst-repeat-last-character):
Refactor functions.
(rst-find-title-line, rst-reset-section-caches)
(rst-get-adornments-around, rst-adjust-adornment-work)
(rst-arabic-to-roman, rst-roman-to-arabic)
(rst-insert-list-pos, rst-insert-list-new-item)
(rst-insert-list-continue, rst-insert-list, rst-forward-line):
New functions.
(rst-all-sections, rst-section-hierarchy)
(rst-arabic-to-roman, rst-initial-enums, rst-initial-items):
New variables.
(rst-toc-return-wincfg, rst-toc-quit-window): Use window
configuration instead of only buffer. Change where necessary.
(rst-line-tabs, rst-compute-tabs, rst-indent-line)
(rst-shift-region, rst-adaptive-fill): New functions for
indentation and filling.
(rst-comment-line-break, rst-comment-indent)
(rst-comment-insert-comment, rst-comment-region)
(rst-uncomment-region): New functions for handling comments.
(rst-compile): Quote shell arguments.
(rst-compile-pdf-preview, rst-compile-slides-preview):
Delete temporary files after use.
2012-05-05 Glenn Morris <rgm@gnu.org>
 
* calendar/cal-html.el: Optionally include holidays in the output.
......
......@@ -3,7 +3,8 @@
;; Copyright (C) 2003-2012 Free Software Foundation, Inc.
;; Maintainer: Stefan Merten <smerten@oekonux.de>
;; Author: Martin Blais <blais@furius.ca>,
;; Author: Stefan Merten <smerten@oekonux.de>,
;; Martin Blais <blais@furius.ca>,
;; David Goodger <goodger@python.org>,
;; Wei-Wei Guo <wwguocn@gmail.com>
......@@ -25,10 +26,10 @@
;;; Commentary:
;; This package provides major mode rst-mode, which supports documents marked
;; up using the reStructuredText format. Support includes font locking as well
;; as a lot of convenience functions for editing. It does this by defining a
;; Emacs major mode: rst-mode (ReST). This mode is derived from text-mode. This
;; package also contains:
;; up using the reStructuredText format. Support includes font locking as well
;; as a lot of convenience functions for editing. It does this by defining a
;; Emacs major mode: rst-mode (ReST). This mode is derived from text-mode.
;; This package also contains:
;;
;; - Functions to automatically adjust and cycle the section underline
;; adornments;
......@@ -53,12 +54,12 @@
;; http://docutils.sourceforge.net/docs/user/emacs.html
;;
;;
;; There are a number of convenient keybindings provided by rst-mode.
;; There are a number of convenient key bindings provided by rst-mode.
;; For more on bindings, see rst-mode-map below. There are also many variables
;; that can be customized, look for defcustom in this file.
;;
;; If you use the table-of-contents feature, you may want to add a hook to
;; update the TOC automatically everytime you adjust a section title::
;; update the TOC automatically every time you adjust a section title::
;;
;; (add-hook 'rst-adjust-hook 'rst-toc-update)
;;
......@@ -70,7 +71,7 @@
;;
;;
;; Customization is done by customizable variables contained in customization
;; group "rst" and subgroups. Group "rst" is contained in the "wp" group.
;; group "rst" and subgroups. Group "rst" is contained in the "wp" group.
;;
;;; DOWNLOAD
......@@ -95,21 +96,23 @@
;; want automatically enter rst-mode from any file with compatible extensions:
;;
;; (setq auto-mode-alist
;; (append '(("\\.txt$" . rst-mode)
;; ("\\.rst$" . rst-mode)
;; ("\\.rest$" . rst-mode)) auto-mode-alist))
;; (append '(("\\.txt\\'" . rst-mode)
;; ("\\.rst\\'" . rst-mode)
;; ("\\.rest\\'" . rst-mode)) auto-mode-alist))
;;
;;; Code:
(require 'cl)
(eval-when-compile
(require 'cl))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Versions
(defun rst-extract-version (delim-re head-re re tail-re var &optional default)
"Return the version matching RE after regex DELIM-RE and HEAD-RE
and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match"
"Extract the version from a variable according to the given regexes.
Return the version after regex DELIM-RE and HEAD-RE matching RE
and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match."
(if (string-match
(concat delim-re head-re "\\(" re "\\)" tail-re delim-re)
var)
......@@ -117,20 +120,20 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match"
default))
;; Use CVSHeader to really get information from CVS and not other version
;; control systems
;; control systems.
(defconst rst-cvs-header
"$CVSHeader: sm/rst_el/rst.el,v 1.257 2012-04-29 15:01:17 stefan Exp $")
"$CVSHeader: sm/rst_el/rst.el,v 1.257.2.9 2012-05-29 19:53:00 stefan Exp $")
(defconst rst-cvs-rev
(rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+"
" .*" rst-cvs-header "0.0")
"The CVS revision of this file. CVS revision is the development revision.")
"The CVS revision of this file. CVS revision is the development revision.")
(defconst rst-cvs-timestamp
(rst-extract-version "\\$" "CVSHeader: \\S + \\S + "
"[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+" " .*"
rst-cvs-header "1970-01-01 00:00:00")
"The CVS timestamp of this file.")
"The CVS time stamp of this file.")
;; Use LastChanged... to really get information from SVN
;; Use LastChanged... to really get information from SVN.
(defconst rst-svn-rev
(rst-extract-version "\\$" "LastChangedRevision: " "[0-9]+" " "
"$LastChangedRevision: 7399 $")
......@@ -139,9 +142,9 @@ SVN revision is the upstream (docutils) revision.")
(defconst rst-svn-timestamp
(rst-extract-version "\\$" "LastChangedDate: " ".+?+" " "
"$LastChangedDate: 2012-04-29 17:01:05 +0200 (Sun, 29 Apr 2012) $")
"The SVN timestamp of this file.")
"The SVN time stamp of this file.")
;; Maintained by the release process
;; Maintained by the release process.
(defconst rst-official-version
(rst-extract-version "%" "OfficialVersion: " "[0-9]+\\(?:\\.[0-9]+\\)+" " "
"%OfficialVersion: 1.2.1 %")
......@@ -157,8 +160,8 @@ SVN revision is the upstream (docutils) revision.")
(format "%s (development %s [%s])" rst-official-version
rst-cvs-rev rst-cvs-timestamp))
"The version string.
Starts with the current official version. For developer versions
in parentheses follows the development revision and the timestamp.")
Starts with the current official version. For developer versions
in parentheses follows the development revision and the time stamp.")
(defconst rst-package-emacs-version-alist
'(("1.0.0" . "24.0")
......@@ -187,12 +190,12 @@ in parentheses follows the development revision and the timestamp.")
;; Facilities for regular expressions used everywhere
;; The trailing numbers in the names give the number of referenceable regex
;; groups contained in the regex
;; groups contained in the regex.
;; Used to be customizable but really is not customizable but fixed by the reST
;; syntax
;; syntax.
(defconst rst-bullets
;; Sorted so they can form a character class when concatenated
;; Sorted so they can form a character class when concatenated.
'(?- ?* ?+ ?\u2022 ?\u2023 ?\u2043)
"List of all possible bullet characters for bulleted lists.")
......@@ -203,7 +206,7 @@ in parentheses follows the development revision and the timestamp.")
"Supported URI schemes.")
(defconst rst-adornment-chars
;; Sorted so they can form a character class when concatenated
;; Sorted so they can form a character class when concatenated.
'(?\]
?! ?\" ?# ?$ ?% ?& ?' ?\( ?\) ?* ?+ ?, ?. ?/ ?: ?\; ?< ?= ?> ?? ?@ ?\[ ?\\
?^ ?_ ?` ?{ ?| ?} ?~
......@@ -215,45 +218,45 @@ in parentheses follows the development revision and the timestamp.")
"Maximum length of inline markup to recognize.")
(defconst rst-re-alist-def
;; `*-beg' matches * at the beginning of a line
;; `*-end' matches * at the end of a line
;; `*-prt' matches a part of *
;; `*-tag' matches *
;; `*-sta' matches the start of * which may be followed by respective content
;; `*-pfx' matches the delimiter left of *
;; `*-sfx' matches the delimiter right of *
;; `*-hlp' helper for *
;; `*-beg' matches * at the beginning of a line.
;; `*-end' matches * at the end of a line.
;; `*-prt' matches a part of *.
;; `*-tag' matches *.
;; `*-sta' matches the start of * which may be followed by respective content.
;; `*-pfx' matches the delimiter left of *.
;; `*-sfx' matches the delimiter right of *.
;; `*-hlp' helper for *.
;;
;; A trailing number says how many referenceable groups are contained.
`(
;; Horizontal white space (`hws')
(hws-prt "[\t ]")
(hws-tag hws-prt "*") ; Optional sequence of horizontal white space
(hws-sta hws-prt "+") ; Mandatory sequence of horizontal white space
(hws-tag hws-prt "*") ; Optional sequence of horizontal white space.
(hws-sta hws-prt "+") ; Mandatory sequence of horizontal white space.
;; Lines (`lin')
(lin-beg "^" hws-tag) ; Beginning of a possibly indented line
(lin-end hws-tag "$") ; End of a line with optional trailing white space
(linemp-tag "^" hws-tag "$") ; Empty line with optional white space
(lin-beg "^" hws-tag) ; Beginning of a possibly indented line.
(lin-end hws-tag "$") ; End of a line with optional trailing white space.
(linemp-tag "^" hws-tag "$") ; Empty line with optional white space.
;; Various tags and parts
(ell-tag "\\.\\.\\.") ; Ellipsis
(bul-tag ,(concat "[" rst-bullets "]")) ; A bullet
(ltr-tag "[a-zA-Z]") ; A letter enumerator tag
(num-prt "[0-9]") ; A number enumerator part
(num-tag num-prt "+") ; A number enumerator tag
(rom-prt "[IVXLCDMivxlcdm]") ; A roman enumerator part
(rom-tag rom-prt "+") ; A roman enumerator tag
(aut-tag "#") ; An automatic enumerator tag
(dcl-tag "::") ; Double colon
(bul-tag ,(concat "[" rst-bullets "]")) ; A bullet.
(ltr-tag "[a-zA-Z]") ; A letter enumerator tag.
(num-prt "[0-9]") ; A number enumerator part.
(num-tag num-prt "+") ; A number enumerator tag.
(rom-prt "[IVXLCDMivxlcdm]") ; A roman enumerator part.
(rom-tag rom-prt "+") ; A roman enumerator tag.
(aut-tag "#") ; An automatic enumerator tag.
(dcl-tag "::") ; Double colon.
;; Block lead in (`bli')
(bli-sfx (:alt hws-sta "$")) ; Suffix of a block lead-in with *optional*
; immediate content
; immediate content.
;; Various starts
(bul-sta bul-tag bli-sfx) ; Start of a bulleted item
(bul-sta bul-tag bli-sfx) ; Start of a bulleted item.
;; Explicit markup tag (`exm')
(exm-tag "\\.\\.")
......@@ -261,101 +264,101 @@ in parentheses follows the development revision and the timestamp.")
(exm-beg lin-beg exm-sta)
;; Counters in enumerations (`cnt')
(cntany-tag (:alt ltr-tag num-tag rom-tag aut-tag)) ; An arbitrary counter
(cntexp-tag (:alt ltr-tag num-tag rom-tag)) ; An arbitrary explicit counter
(cntany-tag (:alt ltr-tag num-tag rom-tag aut-tag)) ; An arbitrary counter.
(cntexp-tag (:alt ltr-tag num-tag rom-tag)) ; An arbitrary explicit counter.
;; Enumerator (`enm')
(enmany-tag (:alt
(:seq cntany-tag "\\.")
(:seq "(?" cntany-tag ")"))) ; An arbitrary enumerator
(:seq "(?" cntany-tag ")"))) ; An arbitrary enumerator.
(enmexp-tag (:alt
(:seq cntexp-tag "\\.")
(:seq "(?" cntexp-tag ")"))) ; An arbitrary explicit
; enumerator
; enumerator.
(enmaut-tag (:alt
(:seq aut-tag "\\.")
(:seq "(?" aut-tag ")"))) ; An automatic enumerator
(enmany-sta enmany-tag bli-sfx) ; An arbitrary enumerator start
(enmexp-sta enmexp-tag bli-sfx) ; An arbitrary explicit enumerator start
(:seq "(?" aut-tag ")"))) ; An automatic enumerator.
(enmany-sta enmany-tag bli-sfx) ; An arbitrary enumerator start.
(enmexp-sta enmexp-tag bli-sfx) ; An arbitrary explicit enumerator start.
(enmexp-beg lin-beg enmexp-sta) ; An arbitrary explicit enumerator start
; at the beginning of a line
; at the beginning of a line.
;; Items may be enumerated or bulleted (`itm')
(itmany-tag (:alt enmany-tag bul-tag)) ; An arbitrary item tag
(itmany-tag (:alt enmany-tag bul-tag)) ; An arbitrary item tag.
(itmany-sta-1 (:grp itmany-tag) bli-sfx) ; An arbitrary item start, group
; is the item tag
; is the item tag.
(itmany-beg-1 lin-beg itmany-sta-1) ; An arbitrary item start at the
; beginning of a line, group is the
; item tag
; item tag.
;; Inline markup (`ilm')
(ilm-pfx (:alt "^" hws-prt "[-'\"([{<\u2018\u201c\u00ab\u2019/:]"))
(ilm-sfx (:alt "$" hws-prt "[]-'\")}>\u2019\u201d\u00bb/:.,;!?\\]"))
;; Inline markup content (`ilc')
(ilcsgl-tag "\\S ") ; A single non-white character
(ilcast-prt (:alt "[^*\\]" "\\\\.")) ; Part of non-asterisk content
(ilcbkq-prt (:alt "[^`\\]" "\\\\.")) ; Part of non-backquote content
(ilcsgl-tag "\\S ") ; A single non-white character.
(ilcast-prt (:alt "[^*\\]" "\\\\.")) ; Part of non-asterisk content.
(ilcbkq-prt (:alt "[^`\\]" "\\\\.")) ; Part of non-backquote content.
(ilcbkqdef-prt (:alt "[^`\\\n]" "\\\\.")) ; Part of non-backquote
; definition
(ilcbar-prt (:alt "[^|\\]" "\\\\.")) ; Part of non-vertical-bar content
; definition.
(ilcbar-prt (:alt "[^|\\]" "\\\\.")) ; Part of non-vertical-bar content.
(ilcbardef-prt (:alt "[^|\\\n]" "\\\\.")) ; Part of non-vertical-bar
; definition
(ilcast-sfx "[^\t *\\]") ; Suffix of non-asterisk content
(ilcbkq-sfx "[^\t `\\]") ; Suffix of non-backquote content
(ilcbar-sfx "[^\t |\\]") ; Suffix of non-vertical-bar content
(ilcrep-hlp ,(format "\\{0,%d\\}" rst-max-inline-length)) ; Repeat count
; definition.
(ilcast-sfx "[^\t *\\]") ; Suffix of non-asterisk content.
(ilcbkq-sfx "[^\t `\\]") ; Suffix of non-backquote content.
(ilcbar-sfx "[^\t |\\]") ; Suffix of non-vertical-bar content.
(ilcrep-hlp ,(format "\\{0,%d\\}" rst-max-inline-length)) ; Repeat count.
(ilcast-tag (:alt ilcsgl-tag
(:seq ilcsgl-tag
ilcast-prt ilcrep-hlp
ilcast-sfx))) ; Non-asterisk content
ilcast-sfx))) ; Non-asterisk content.
(ilcbkq-tag (:alt ilcsgl-tag
(:seq ilcsgl-tag
ilcbkq-prt ilcrep-hlp
ilcbkq-sfx))) ; Non-backquote content
ilcbkq-sfx))) ; Non-backquote content.
(ilcbkqdef-tag (:alt ilcsgl-tag
(:seq ilcsgl-tag
ilcbkqdef-prt ilcrep-hlp
ilcbkq-sfx))) ; Non-backquote definition
ilcbkq-sfx))) ; Non-backquote definition.
(ilcbar-tag (:alt ilcsgl-tag
(:seq ilcsgl-tag
ilcbar-prt ilcrep-hlp
ilcbar-sfx))) ; Non-vertical-bar content
ilcbar-sfx))) ; Non-vertical-bar content.
(ilcbardef-tag (:alt ilcsgl-tag
(:seq ilcsgl-tag
ilcbardef-prt ilcrep-hlp
ilcbar-sfx))) ; Non-vertical-bar definition
ilcbar-sfx))) ; Non-vertical-bar definition.
;; Fields (`fld')
(fldnam-prt (:alt "[^:\n]" "\\\\:")) ; Part of a field name
(fldnam-tag fldnam-prt "+") ; A field name
(fld-tag ":" fldnam-tag ":") ; A field marker
(fldnam-prt (:alt "[^:\n]" "\\\\:")) ; Part of a field name.
(fldnam-tag fldnam-prt "+") ; A field name.
(fld-tag ":" fldnam-tag ":") ; A field marker.
;; Options (`opt')
(optsta-tag (:alt "[-+/]" "--")) ; Start of an option
(optnam-tag "\\sw" (:alt "-" "\\sw") "*") ; Name of an option
(optarg-tag (:shy "[ =]\\S +")) ; Option argument
(optsep-tag (:shy "," hws-prt)) ; Separator between options
(opt-tag (:shy optsta-tag optnam-tag optarg-tag "?")) ; A complete option
(optsta-tag (:alt "[-+/]" "--")) ; Start of an option.
(optnam-tag "\\sw" (:alt "-" "\\sw") "*") ; Name of an option.
(optarg-tag (:shy "[ =]\\S +")) ; Option argument.
(optsep-tag (:shy "," hws-prt)) ; Separator between options.
(opt-tag (:shy optsta-tag optnam-tag optarg-tag "?")) ; A complete option.
;; Footnotes and citations (`fnc')
(fncnam-prt "[^\]\n]") ; Part of a footnote or citation name
(fncnam-tag fncnam-prt "+") ; A footnote or citation name
(fnc-tag "\\[" fncnam-tag "]") ; A complete footnote or citation tag
(fncnam-prt "[^\]\n]") ; Part of a footnote or citation name.
(fncnam-tag fncnam-prt "+") ; A footnote or citation name.
(fnc-tag "\\[" fncnam-tag "]") ; A complete footnote or citation tag.
(fncdef-tag-2 (:grp exm-sta)
(:grp fnc-tag)) ; A complete footnote or citation definition
; tag; first group is the explicit markup
; tag. First group is the explicit markup
; start, second group is the footnote /
; citation tag
; citation tag.
(fnc-sta-2 fncdef-tag-2 bli-sfx) ; Start of a footnote or citation
; definition; first group is the explicit
; definition. First group is the explicit
; markup start, second group is the
; footnote / citation tag
; footnote / citation tag.
;; Substitutions (`sub')
(sub-tag "|" ilcbar-tag "|") ; A complete substitution tag
(sub-tag "|" ilcbar-tag "|") ; A complete substitution tag.
(subdef-tag "|" ilcbardef-tag "|") ; A complete substitution definition
; tag
; tag.
;; Symbol (`sym')
(sym-tag (:shy "\\sw+" (:shy "\\s_\\sw+") "*"))
......@@ -367,62 +370,62 @@ in parentheses follows the development revision and the timestamp.")
(ado-prt "[" ,(concat rst-adornment-chars) "]")
(adorep3-hlp "\\{3,\\}") ; There must be at least 3 characters because
; otherwise explicit markup start would be
; recognized
; recognized.
(adorep2-hlp "\\{2,\\}") ; As `adorep3-hlp' but when the first of three
; characters is matched differently
; characters is matched differently.
(ado-tag-1-1 (:grp ado-prt)
"\\1" adorep2-hlp) ; A complete adornment, group is the first
; adornment character and MUST be the FIRST
; group in the whole expression
; group in the whole expression.
(ado-tag-1-2 (:grp ado-prt)
"\\2" adorep2-hlp) ; A complete adornment, group is the first
; adornment character and MUST be the
; SECOND group in the whole expression
; SECOND group in the whole expression.
(ado-beg-2-1 "^" (:grp ado-tag-1-2)
lin-end) ; A complete adornment line; first group is the whole
; adornment and MUST be the FIRST group in the whole
; expression; second group is the first adornment
; character
; character.
;; Titles (`ttl')
(ttl-tag "\\S *\\w\\S *") ; A title text
(ttl-beg lin-beg ttl-tag) ; A title text at the beginning of a line
(ttl-tag "\\S *\\w\\S *") ; A title text.
(ttl-beg lin-beg ttl-tag) ; A title text at the beginning of a line.
;; Directives and substitution definitions (`dir')
(dir-tag-3 (:grp exm-sta)
(:grp (:shy subdef-tag hws-sta) "?")
(:grp sym-tag dcl-tag)) ; A directive or substitution definition
; tag; first group is explicit markup
; tag. First group is explicit markup
; start, second group is a possibly
; empty substitution tag, third group is
; the directive tag including the double
; colon
; colon.
(dir-sta-3 dir-tag-3 bli-sfx) ; Start of a directive or substitution
; definition; groups are as in dir-tag-3
; definition. Groups are as in dir-tag-3.
;; Literal block (`lit')
(lit-sta-2 (:grp (:alt "[^.\n]" "\\.[^.\n]") ".*") "?"
(:grp dcl-tag) "$") ; Start of a literal block; first group is
(:grp dcl-tag) "$") ; Start of a literal block. First group is
; any text before the double colon tag which
; may not exist, second group is the double
; colon tag
; colon tag.
;; Comments (`cmt')
(cmt-sta-1 (:grp exm-sta) "[^\[|_\n]"
(:alt "[^:\n]" (:seq ":" (:alt "[^:\n]" "$")))
"*$") ; Start of a comment block; first group is explicit markup
; start
; start.
;; Paragraphs (`par')
(par-tag- (:alt itmany-tag fld-tag opt-tag fncdef-tag-2 dir-tag-3 exm-tag)
) ; Tag at the beginning of a paragraph; there may be groups in
; certain cases
; certain cases.
)
"Definition alist of relevant regexes.
Each entry consists of the symbol naming the regex and an
argument list for `rst-re'.")
;; FIXME: Use `sregex` or `rx` instead of re-inventing the wheel
;; FIXME: Use `sregex` or `rx` instead of re-inventing the wheel.
(defun rst-re (&rest args)
"Interpret ARGS as regular expressions and return a regex string.
Each element of ARGS may be one of the following:
......@@ -433,8 +436,8 @@ A character which is resolved to a quoted regex.
A symbol which is resolved to a string using `rst-re-alist-def'.
A list with a keyword in the car. Each element of the cdr of such
a list is recursively interpreted as ARGS. The results of this
A list with a keyword in the car. Each element of the cdr of such
a list is recursively interpreted as ARGS. The results of this
interpretation are concatenated according to the keyword.
For the keyword `:seq' the results are simply concatenated.
......@@ -446,11 +449,10 @@ For the keyword `:alt' the results form an alternative (\"\\|\")
which is shy-grouped (\"\\(?:...\\)\").
For the keyword `:grp' the results are concatenated and form a
referenceable grouped (\"\\(...\\)\").
referenceable group (\"\\(...\\)\").
After interpretation of ARGS the results are concatenated as for
`:seq'.
"
`:seq'."
(apply 'concat
(mapcar
(lambda (re)
......@@ -484,7 +486,7 @@ After interpretation of ARGS the results are concatenated as for
;; FIXME: Remove circular dependency between `rst-re' and `rst-re-alist'.
(defconst rst-re-alist
;; Shadow global value we are just defining so we can construct it step by
;; step
;; step.
(let (rst-re-alist)
(dolist (re rst-re-alist-def)
(setq rst-re-alist
......@@ -495,96 +497,78 @@ After interpretation of ARGS the results are concatenated as for
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Mode definition.
(defvar rst-deprecated-keys nil
"Alist mapping deprecated keys to the new key to use and the definition.")