diff options
| author | Juanma Barranquero | 2014-03-16 04:47:31 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2014-03-16 04:47:31 +0100 |
| commit | 57348c4d22dda72bf630fe02c679c6acdbe9c85d (patch) | |
| tree | 0fe4b508c0e2c8180a03ea69f5a1a11ddc0a7a5e /lisp/textmodes | |
| parent | 7ea9a62b8e563b5bbc5b8fa3d2fedab9f2a35030 (diff) | |
| download | emacs-57348c4d22dda72bf630fe02c679c6acdbe9c85d.tar.gz emacs-57348c4d22dda72bf630fe02c679c6acdbe9c85d.zip | |
lisp/textmodes/rst.el: Implement missing but documented functionality.
(rst-arabic-to-roman, rst-roman-to-arabic):
Implement inserting into current buffer, documented in their docstrings.
(rst-define-key, rst-compare-adornments, rst-insert-list-new-item)
(rst-section-tree-point, rst-forward-section, rst-indent)
(rst-compute-tabs, rst-font-lock-find-unindented-line-end)
(rst-font-lock-find-unindented-line-limit, rst-adornment-level)
(rst-font-lock-handle-adornment-pre-match-form)
(rst-repeat-last-character): Reflow docstrings.
(rst-preferred-adornments, rst-update-section, rst-find-title-line)
(rst-adjust-adornment-work, rst-initial-items, rst-insert-list)
(rst-toc-insert-style, rst-toc-insert-node, rst-goto-section)
(rst-compile, rst-imenu-convert-cell, rst-imenu-create-index):
Fix docstring typos.
(rst-all-sections, rst-section-hierarchy, rst-adjust): Doc fixes.
(rst-uncomment-region, rst-font-lock-find-unindented-line-match)
(rst-font-lock-handle-adornment-matcher): Mark unused arguments.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/rst.el | 146 |
1 files changed, 69 insertions, 77 deletions
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index 516431006f6..d4a3438ce97 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el | |||
| @@ -608,8 +608,8 @@ After interpretation of ARGS the results are concatenated as for | |||
| 608 | (defun rst-define-key (keymap key def &rest deprecated) | 608 | (defun rst-define-key (keymap key def &rest deprecated) |
| 609 | "Bind like `define-key' but add deprecated key definitions. | 609 | "Bind like `define-key' but add deprecated key definitions. |
| 610 | KEYMAP, KEY, and DEF are as in `define-key'. DEPRECATED key | 610 | KEYMAP, KEY, and DEF are as in `define-key'. DEPRECATED key |
| 611 | definitions should be in vector notation. These are defined as | 611 | definitions should be in vector notation. These are defined |
| 612 | well but give an additional message." | 612 | as well but give an additional message." |
| 613 | (define-key keymap key def) | 613 | (define-key keymap key def) |
| 614 | (when deprecated | 614 | (when deprecated |
| 615 | (let* ((command-name (symbol-name def)) | 615 | (let* ((command-name (symbol-name def)) |
| @@ -994,10 +994,10 @@ for modes derived from Text mode, like Mail mode." | |||
| 994 | 994 | ||
| 995 | A list consisting of lists of the form (CHARACTER STYLE INDENT). | 995 | A list consisting of lists of the form (CHARACTER STYLE INDENT). |
| 996 | CHARACTER is the character used. STYLE is one of the symbols | 996 | CHARACTER is the character used. STYLE is one of the symbols |
| 997 | OVER-AND-UNDER or SIMPLE. INDENT is an integer giving the wanted | 997 | `over-and-under' or `simple'. INDENT is an integer giving the |
| 998 | indentation for STYLE OVER-AND-UNDER. CHARACTER and STYLE are | 998 | wanted indentation for STYLE `over-and-under'. CHARACTER and |
| 999 | always used when a section adornment is described. In other | 999 | STYLE are always used when a section adornment is described. |
| 1000 | places t instead of a list stands for a transition. | 1000 | In other places, t instead of a list stands for a transition. |
| 1001 | 1001 | ||
| 1002 | This sequence is consulted to offer a new adornment suggestion | 1002 | This sequence is consulted to offer a new adornment suggestion |
| 1003 | when we rotate the underlines at the end of the existing | 1003 | when we rotate the underlines at the end of the existing |
| @@ -1034,8 +1034,8 @@ style." | |||
| 1034 | (defun rst-compare-adornments (ado1 ado2) | 1034 | (defun rst-compare-adornments (ado1 ado2) |
| 1035 | "Compare adornments. | 1035 | "Compare adornments. |
| 1036 | Return true if both ADO1 and ADO2 adornments are equal, | 1036 | Return true if both ADO1 and ADO2 adornments are equal, |
| 1037 | according to restructured text semantics (only the character and | 1037 | according to restructured text semantics (only the character |
| 1038 | the style are compared, the indentation does not matter)." | 1038 | and the style are compared, the indentation does not matter)." |
| 1039 | (and (eq (car ado1) (car ado2)) | 1039 | (and (eq (car ado1) (car ado2)) |
| 1040 | (eq (cadr ado1) (cadr ado2)))) | 1040 | (eq (cadr ado1) (cadr ado2)))) |
| 1041 | 1041 | ||
| @@ -1091,9 +1091,9 @@ better match." | |||
| 1091 | (defun rst-update-section (char style &optional indent) | 1091 | (defun rst-update-section (char style &optional indent) |
| 1092 | "Unconditionally update the style of a section adornment. | 1092 | "Unconditionally update the style of a section adornment. |
| 1093 | 1093 | ||
| 1094 | Do this using the given character CHAR, with STYLE 'simple | 1094 | Do this using the given character CHAR, with STYLE `simple' |
| 1095 | or 'over-and-under, and with indent INDENT. If the STYLE | 1095 | or `over-and-under', and with indent INDENT. If the STYLE |
| 1096 | is 'simple, whitespace before the title is removed (indent | 1096 | is `simple', whitespace before the title is removed (indent |
| 1097 | is always assumed to be 0). | 1097 | is always assumed to be 0). |
| 1098 | 1098 | ||
| 1099 | If there are existing overline and/or underline from the | 1099 | If there are existing overline and/or underline from the |
| @@ -1270,8 +1270,8 @@ point is on a suitable title line use it. | |||
| 1270 | If no title line is found return nil. | 1270 | If no title line is found return nil. |
| 1271 | 1271 | ||
| 1272 | Otherwise return as `rst-classify-adornment' does. However, if | 1272 | Otherwise return as `rst-classify-adornment' does. However, if |
| 1273 | the title line has no syntactically valid adornment STYLE is nil | 1273 | the title line has no syntactically valid adornment, STYLE is nil |
| 1274 | in the first element. If there is no adornment around the title | 1274 | in the first element. If there is no adornment around the title, |
| 1275 | CHARACTER is also nil and match groups for overline and underline | 1275 | CHARACTER is also nil and match groups for overline and underline |
| 1276 | are nil." | 1276 | are nil." |
| 1277 | (save-excursion | 1277 | (save-excursion |
| @@ -1325,15 +1325,15 @@ are nil." | |||
| 1325 | 1325 | ||
| 1326 | (defvar rst-all-sections nil | 1326 | (defvar rst-all-sections nil |
| 1327 | "All section adornments in the buffer as found by `rst-find-all-adornments'. | 1327 | "All section adornments in the buffer as found by `rst-find-all-adornments'. |
| 1328 | t when no section adornments were found.") | 1328 | Set to t when no section adornments were found.") |
| 1329 | (make-variable-buffer-local 'rst-all-sections) | 1329 | (make-variable-buffer-local 'rst-all-sections) |
| 1330 | 1330 | ||
| 1331 | ;; FIXME: If this variable is set to a different value font-locking of section | 1331 | ;; FIXME: If this variable is set to a different value font-locking of section |
| 1332 | ;; headers is wrong. | 1332 | ;; headers is wrong. |
| 1333 | (defvar rst-section-hierarchy nil | 1333 | (defvar rst-section-hierarchy nil |
| 1334 | "Section hierarchy in the buffer as determined by `rst-get-hierarchy'. | 1334 | "Section hierarchy in the buffer as determined by `rst-get-hierarchy'. |
| 1335 | t when no section adornments were found. Value depends on | 1335 | Set to t when no section adornments were found. |
| 1336 | `rst-all-sections'.") | 1336 | Value depends on `rst-all-sections'.") |
| 1337 | (make-variable-buffer-local 'rst-section-hierarchy) | 1337 | (make-variable-buffer-local 'rst-section-hierarchy) |
| 1338 | 1338 | ||
| 1339 | (rst-testcover-add-1value 'rst-reset-section-caches) | 1339 | (rst-testcover-add-1value 'rst-reset-section-caches) |
| @@ -1502,8 +1502,8 @@ REVERSE-DIRECTION is used to reverse the cycling order." | |||
| 1502 | 1502 | ||
| 1503 | Adjust/rotate the section adornment for the section title around | 1503 | Adjust/rotate the section adornment for the section title around |
| 1504 | point or promote/demote the adornments inside the region, | 1504 | point or promote/demote the adornments inside the region, |
| 1505 | depending on if the region is active. This function is meant to | 1505 | depending on whether the region is active. This function is meant |
| 1506 | be invoked possibly multiple times, and can vary its behavior | 1506 | to be invoked possibly multiple times, and can vary its behavior |
| 1507 | with a positive PFXARG (toggle style), or with a negative | 1507 | with a positive PFXARG (toggle style), or with a negative |
| 1508 | PFXARG (alternate behavior). | 1508 | PFXARG (alternate behavior). |
| 1509 | 1509 | ||
| @@ -1609,7 +1609,7 @@ The adornments consist in | |||
| 1609 | 1609 | ||
| 1610 | 1. a CHARACTER | 1610 | 1. a CHARACTER |
| 1611 | 1611 | ||
| 1612 | 2. a STYLE which can be either of 'simple' or 'over-and-under'. | 1612 | 2. a STYLE which can be either `simple' or `over-and-under'. |
| 1613 | 1613 | ||
| 1614 | 3. an INDENT (meaningful for the over-and-under style only) | 1614 | 3. an INDENT (meaningful for the over-and-under style only) |
| 1615 | which determines how many characters and over-and-under | 1615 | which determines how many characters and over-and-under |
| @@ -1652,8 +1652,8 @@ Case 2: Incomplete Adornment | |||
| 1652 | 1652 | ||
| 1653 | If the current line does have an existing adornment, but the | 1653 | If the current line does have an existing adornment, but the |
| 1654 | adornment is incomplete, that is, the underline/overline does | 1654 | adornment is incomplete, that is, the underline/overline does |
| 1655 | not extend to exactly the end of the title line (it is either too | 1655 | not extend to exactly the end of the title line (it is either |
| 1656 | short or too long), we simply extend the length of the | 1656 | too short or too long), we simply extend the length of the |
| 1657 | underlines/overlines to fit exactly the section title. | 1657 | underlines/overlines to fit exactly the section title. |
| 1658 | 1658 | ||
| 1659 | If TOGGLE-STYLE we toggle the style of the adornment as well. | 1659 | If TOGGLE-STYLE we toggle the style of the adornment as well. |
| @@ -1922,7 +1922,7 @@ in order to adapt it to our preferred style." | |||
| 1922 | Obviously, NUM must be greater than zero. Don't blame me, blame the | 1922 | Obviously, NUM must be greater than zero. Don't blame me, blame the |
| 1923 | Romans, I mean \"what have the Romans ever _done_ for /us/?\" (with | 1923 | Romans, I mean \"what have the Romans ever _done_ for /us/?\" (with |
| 1924 | apologies to Monty Python). | 1924 | apologies to Monty Python). |
| 1925 | If optional prefix ARG is non-nil, insert in current buffer." | 1925 | If optional ARG is non-nil, insert in current buffer." |
| 1926 | (let ((map rst-arabic-to-roman) | 1926 | (let ((map rst-arabic-to-roman) |
| 1927 | res) | 1927 | res) |
| 1928 | (while (and map (> num 0)) | 1928 | (while (and map (> num 0)) |
| @@ -1931,13 +1931,13 @@ If optional prefix ARG is non-nil, insert in current buffer." | |||
| 1931 | (setq res (concat res (cdar map)) | 1931 | (setq res (concat res (cdar map)) |
| 1932 | num (- num (caar map))) | 1932 | num (- num (caar map))) |
| 1933 | (setq map (cdr map)))) | 1933 | (setq map (cdr map)))) |
| 1934 | res)) | 1934 | (if arg (insert (or res "")) res))) |
| 1935 | 1935 | ||
| 1936 | (defun rst-roman-to-arabic (string &optional arg) | 1936 | (defun rst-roman-to-arabic (string &optional arg) |
| 1937 | "Convert STRING of Roman numerals to an Arabic number. | 1937 | "Convert STRING of Roman numerals to an Arabic number. |
| 1938 | 1938 | ||
| 1939 | If STRING contains a letter which isn't a valid Roman numeral, the rest | 1939 | If STRING contains a letter which isn't a valid Roman numeral, |
| 1940 | of the string from that point onwards is ignored. | 1940 | the rest of the string from that point onwards is ignored. |
| 1941 | 1941 | ||
| 1942 | Hence: | 1942 | Hence: |
| 1943 | MMD == 2500 | 1943 | MMD == 2500 |
| @@ -1951,7 +1951,7 @@ If optional ARG is non-nil, insert in current buffer." | |||
| 1951 | (setq res (+ res (caar map)) | 1951 | (setq res (+ res (caar map)) |
| 1952 | string (replace-match "" nil t string)) | 1952 | string (replace-match "" nil t string)) |
| 1953 | (setq map (cdr map)))) | 1953 | (setq map (cdr map)))) |
| 1954 | res)) | 1954 | (if arg (insert res) res))) |
| 1955 | ;================================================= | 1955 | ;================================================= |
| 1956 | 1956 | ||
| 1957 | (defun rst-find-pfx-in-region (beg end pfx-re) | 1957 | (defun rst-find-pfx-in-region (beg end pfx-re) |
| @@ -2020,20 +2020,20 @@ Other situations are just ignored and left to users themselves." | |||
| 2020 | ;; FIXME: Isn't this a `defconst'? | 2020 | ;; FIXME: Isn't this a `defconst'? |
| 2021 | (defvar rst-initial-items | 2021 | (defvar rst-initial-items |
| 2022 | (append (mapcar 'char-to-string rst-bullets) rst-initial-enums) | 2022 | (append (mapcar 'char-to-string rst-bullets) rst-initial-enums) |
| 2023 | "List of initial items. It's collection of bullets and enumerations.") | 2023 | "List of initial items. It's a collection of bullets and enumerations.") |
| 2024 | 2024 | ||
| 2025 | (defun rst-insert-list-new-item () | 2025 | (defun rst-insert-list-new-item () |
| 2026 | "Insert a new list item. | 2026 | "Insert a new list item. |
| 2027 | 2027 | ||
| 2028 | User is asked to select the item style first, for example (a), i), +. Use TAB | 2028 | User is asked to select the item style first, for example (a), i), +. |
| 2029 | for completion and choices. | 2029 | Use TAB for completion and choices. |
| 2030 | 2030 | ||
| 2031 | If user selects bullets or #, it's just added with position arranged by | 2031 | If user selects bullets or #, it's just added with position arranged by |
| 2032 | `rst-insert-list-pos'. | 2032 | `rst-insert-list-pos'. |
| 2033 | 2033 | ||
| 2034 | If user selects enumerations, a further prompt is given. User need to input a | 2034 | If user selects enumerations, a further prompt is given. User need to |
| 2035 | starting item, for example 'e' for 'A)' style. The position is also arranged by | 2035 | input a starting item, for example 'e' for 'A)' style. The position is |
| 2036 | `rst-insert-list-pos'." | 2036 | also arranged by `rst-insert-list-pos'." |
| 2037 | (interactive) | 2037 | (interactive) |
| 2038 | ;; FIXME: Make this comply to `interactive' standards. | 2038 | ;; FIXME: Make this comply to `interactive' standards. |
| 2039 | (let* ((itemstyle (completing-read | 2039 | (let* ((itemstyle (completing-read |
| @@ -2140,7 +2140,7 @@ for completion and choices. | |||
| 2140 | The position of the new list is arranged according to whether or not the | 2140 | The position of the new list is arranged according to whether or not the |
| 2141 | current line and the previous line are blank lines. | 2141 | current line and the previous line are blank lines. |
| 2142 | 2142 | ||
| 2143 | 2. When continuing a list, one thing need to be noticed: | 2143 | 2. When continuing a list, one thing needs to be noticed: |
| 2144 | 2144 | ||
| 2145 | List style alphabetical list, such as 'a.', and roman numerical list, such as | 2145 | List style alphabetical list, such as 'a.', and roman numerical list, such as |
| 2146 | 'i.', have some overlapping items, for example 'v.' The function can deal with | 2146 | 'i.', have some overlapping items, for example 'v.' The function can deal with |
| @@ -2271,13 +2271,11 @@ without UNPROCESSED." | |||
| 2271 | "Return section containing POINT by returning the closest node in TREE. | 2271 | "Return section containing POINT by returning the closest node in TREE. |
| 2272 | TREE is a section tree as returned by `rst-section-tree' | 2272 | TREE is a section tree as returned by `rst-section-tree' |
| 2273 | consisting of (NODE CHILD...) entries. POINT defaults to the | 2273 | consisting of (NODE CHILD...) entries. POINT defaults to the |
| 2274 | current point. A NODE must have the structure (IGNORED MARKER | 2274 | current point. A NODE must have the structure (IGNORED MARKER...). |
| 2275 | ...). | ||
| 2276 | 2275 | ||
| 2277 | Return (PATH NODE CHILD...). NODE is the node where POINT is in | 2276 | Return (PATH NODE CHILD...). NODE is the node where POINT is in |
| 2278 | if any. PATH is a list of nodes from the top of the tree down to | 2277 | if any. PATH is a list of nodes from the top of the tree down to |
| 2279 | and including NODE. List of CHILD are the children of NODE if | 2278 | and including NODE. List of CHILD are the children of NODE if any." |
| 2280 | any." | ||
| 2281 | (setq point (or point (point))) | 2279 | (setq point (or point (point))) |
| 2282 | (let ((cur (car tree)) | 2280 | (let ((cur (car tree)) |
| 2283 | (children (cdr tree))) | 2281 | (children (cdr tree))) |
| @@ -2318,10 +2316,10 @@ Also used for formatting insertion, when numbering is disabled." | |||
| 2318 | "Insertion style for table-of-contents. | 2316 | "Insertion style for table-of-contents. |
| 2319 | Set this to one of the following values to determine numbering and | 2317 | Set this to one of the following values to determine numbering and |
| 2320 | indentation style: | 2318 | indentation style: |
| 2321 | - plain: no numbering (fixed indentation) | 2319 | - `plain': no numbering (fixed indentation) |
| 2322 | - fixed: numbering, but fixed indentation | 2320 | - `fixed': numbering, but fixed indentation |
| 2323 | - aligned: numbering, titles aligned under each other | 2321 | - `aligned': numbering, titles aligned under each other |
| 2324 | - listed: numbering, with dashes like list items (EXPERIMENTAL)" | 2322 | - `listed': numbering, with dashes like list items (EXPERIMENTAL)" |
| 2325 | :type '(choice (const plain) | 2323 | :type '(choice (const plain) |
| 2326 | (const fixed) | 2324 | (const fixed) |
| 2327 | (const aligned) | 2325 | (const aligned) |
| @@ -2384,7 +2382,7 @@ The TOC is inserted indented at the current column." | |||
| 2384 | 2382 | ||
| 2385 | (defun rst-toc-insert-node (node level indent pfx) | 2383 | (defun rst-toc-insert-node (node level indent pfx) |
| 2386 | "Insert tree node NODE in table-of-contents. | 2384 | "Insert tree node NODE in table-of-contents. |
| 2387 | Recursive function that does printing of the inserted toc. | 2385 | Recursive function that does printing of the inserted TOC. |
| 2388 | LEVEL is the depth level of the sections in the tree. | 2386 | LEVEL is the depth level of the sections in the tree. |
| 2389 | INDENT is the indentation string. PFX is the prefix numbering, | 2387 | INDENT is the indentation string. PFX is the prefix numbering, |
| 2390 | that includes the alignment necessary for all the children of | 2388 | that includes the alignment necessary for all the children of |
| @@ -2611,7 +2609,7 @@ brings the cursor in that section." | |||
| 2611 | ;; paragraph. | 2609 | ;; paragraph. |
| 2612 | (defun rst-goto-section (&optional kill) | 2610 | (defun rst-goto-section (&optional kill) |
| 2613 | "Go to the section the current line describes. | 2611 | "Go to the section the current line describes. |
| 2614 | If KILL a toc buffer is destroyed." | 2612 | If KILL a TOC buffer is destroyed." |
| 2615 | (interactive) | 2613 | (interactive) |
| 2616 | (let ((pos (rst-toc-mode-find-section))) | 2614 | (let ((pos (rst-toc-mode-find-section))) |
| 2617 | (when kill | 2615 | (when kill |
| @@ -2682,8 +2680,8 @@ EVENT is the input event." | |||
| 2682 | 2680 | ||
| 2683 | (defun rst-forward-section (&optional offset) | 2681 | (defun rst-forward-section (&optional offset) |
| 2684 | "Skip to the next reStructuredText section title. | 2682 | "Skip to the next reStructuredText section title. |
| 2685 | OFFSET specifies how many titles to skip. Use a negative OFFSET to move | 2683 | OFFSET specifies how many titles to skip. Use a negative OFFSET |
| 2686 | backwards in the file (default is to use 1)." | 2684 | to move backwards in the file (default is to use 1)." |
| 2687 | (interactive) | 2685 | (interactive) |
| 2688 | (rst-reset-section-caches) | 2686 | (rst-reset-section-caches) |
| 2689 | (let* (;; Default value for offset. | 2687 | (let* (;; Default value for offset. |
| @@ -2848,10 +2846,9 @@ first of a paragraph." | |||
| 2848 | (defgroup rst-indent nil "Settings for indentation in reStructuredText. | 2846 | (defgroup rst-indent nil "Settings for indentation in reStructuredText. |
| 2849 | 2847 | ||
| 2850 | In reStructuredText indentation points are usually determined by | 2848 | In reStructuredText indentation points are usually determined by |
| 2851 | preceding lines. Sometimes the syntax allows arbitrary | 2849 | preceding lines. Sometimes the syntax allows arbitrary indentation |
| 2852 | indentation points such as where to start the first line | 2850 | points such as where to start the first line following a directive. |
| 2853 | following a directive. These indentation widths can be customized | 2851 | These indentation widths can be customized here." |
| 2854 | here." | ||
| 2855 | :group 'rst | 2852 | :group 'rst |
| 2856 | :package-version '(rst . "1.1.0")) | 2853 | :package-version '(rst . "1.1.0")) |
| 2857 | 2854 | ||
| @@ -2957,11 +2954,11 @@ and not from inner alignment points." | |||
| 2957 | 2954 | ||
| 2958 | (defun rst-compute-tabs (pt) | 2955 | (defun rst-compute-tabs (pt) |
| 2959 | "Build the list of possible tabs for all lines above. | 2956 | "Build the list of possible tabs for all lines above. |
| 2960 | Search backwards from point PT to build the list of possible | 2957 | Search backwards from point PT to build the list of possible tabs. |
| 2961 | tabs. Return a list of tabs sorted by likeliness to continue | 2958 | Return a list of tabs sorted by likeliness to continue writing |
| 2962 | writing like `rst-line-tabs'. Nearer lines have generally a | 2959 | like `rst-line-tabs'. Nearer lines have generally a higher |
| 2963 | higher likeliness than farther lines. Return nil if no tab is found | 2960 | likeliness than farther lines. Return nil if no tab is found in |
| 2964 | in the text above." | 2961 | the text above." |
| 2965 | (save-excursion | 2962 | (save-excursion |
| 2966 | (goto-char pt) | 2963 | (goto-char pt) |
| 2967 | (let (leftmost ; Leftmost column found so far. | 2964 | (let (leftmost ; Leftmost column found so far. |
| @@ -3136,7 +3133,7 @@ Region is from from BEG to END. Uncomment if ARG." | |||
| 3136 | (indent-line-to ind) | 3133 | (indent-line-to ind) |
| 3137 | (insert (comment-string-strip comment-start t t)))))) | 3134 | (insert (comment-string-strip comment-start t t)))))) |
| 3138 | 3135 | ||
| 3139 | (defun rst-uncomment-region (beg end &optional arg) | 3136 | (defun rst-uncomment-region (beg end &optional _arg) |
| 3140 | "Uncomment the current region. | 3137 | "Uncomment the current region. |
| 3141 | Region is from BEG to END. ARG is ignored" | 3138 | Region is from BEG to END. ARG is ignored" |
| 3142 | (save-excursion | 3139 | (save-excursion |
| @@ -3774,8 +3771,7 @@ point is not moved." | |||
| 3774 | 3771 | ||
| 3775 | (defvar rst-font-lock-find-unindented-line-end nil | 3772 | (defvar rst-font-lock-find-unindented-line-end nil |
| 3776 | "End of the match as determined by `rst-font-lock-find-unindented-line-limit'. | 3773 | "End of the match as determined by `rst-font-lock-find-unindented-line-limit'. |
| 3777 | Also used as a trigger for | 3774 | Also used as a trigger for `rst-font-lock-find-unindented-line-match'.") |
| 3778 | `rst-font-lock-find-unindented-line-match'.") | ||
| 3779 | 3775 | ||
| 3780 | (defun rst-font-lock-find-unindented-line-limit (ind-pnt) | 3776 | (defun rst-font-lock-find-unindented-line-limit (ind-pnt) |
| 3781 | "Find the next unindented line relative to indentation at IND-PNT. | 3777 | "Find the next unindented line relative to indentation at IND-PNT. |
| @@ -3783,8 +3779,7 @@ Return this point, the end of the buffer or nil if nothing found. | |||
| 3783 | If IND-PNT is `next' take the indentation from the next line if | 3779 | If IND-PNT is `next' take the indentation from the next line if |
| 3784 | this is not empty and indented more than the current one. If | 3780 | this is not empty and indented more than the current one. If |
| 3785 | IND-PNT is non-nil but not a number take the indentation from the | 3781 | IND-PNT is non-nil but not a number take the indentation from the |
| 3786 | next non-empty line if this is indented more than the current | 3782 | next non-empty line if this is indented more than the current one." |
| 3787 | one." | ||
| 3788 | (setq rst-font-lock-find-unindented-line-begin ind-pnt) | 3783 | (setq rst-font-lock-find-unindented-line-begin ind-pnt) |
| 3789 | (setq rst-font-lock-find-unindented-line-end | 3784 | (setq rst-font-lock-find-unindented-line-end |
| 3790 | (save-excursion | 3785 | (save-excursion |
| @@ -3824,12 +3819,11 @@ one." | |||
| 3824 | (or (rst-forward-indented-block nil (point-max)) | 3819 | (or (rst-forward-indented-block nil (point-max)) |
| 3825 | (point-max)))))) | 3820 | (point-max)))))) |
| 3826 | 3821 | ||
| 3827 | (defun rst-font-lock-find-unindented-line-match (limit) | 3822 | (defun rst-font-lock-find-unindented-line-match (_limit) |
| 3828 | "Set the match found earlier if match were found. | 3823 | "Set the match found earlier if match were found. |
| 3829 | Match has been found by | 3824 | Match has been found by `rst-font-lock-find-unindented-line-limit' |
| 3830 | `rst-font-lock-find-unindented-line-limit' the first time called | 3825 | the first time called or no match is found. Return non-nil if |
| 3831 | or no match is found. Return non-nil if match was found. LIMIT | 3826 | match was found. LIMIT is not used but mandated by the caller." |
| 3832 | is not used but mandated by the caller." | ||
| 3833 | (when rst-font-lock-find-unindented-line-end | 3827 | (when rst-font-lock-find-unindented-line-end |
| 3834 | (set-match-data | 3828 | (set-match-data |
| 3835 | (list rst-font-lock-find-unindented-line-begin | 3829 | (list rst-font-lock-find-unindented-line-begin |
| @@ -3850,10 +3844,9 @@ Either section level of the current adornment or t for a transition.") | |||
| 3850 | 3844 | ||
| 3851 | (defun rst-adornment-level (key) | 3845 | (defun rst-adornment-level (key) |
| 3852 | "Return section level for adornment KEY. | 3846 | "Return section level for adornment KEY. |
| 3853 | KEY is the first element of the return list of | 3847 | KEY is the first element of the return list of `rst-classify-adornment'. |
| 3854 | `rst-classify-adornment'. If KEY is not a cons return it. If KEY is found | 3848 | If KEY is not a cons return it. If KEY is found in the hierarchy return |
| 3855 | in the hierarchy return its level. Otherwise return a level one | 3849 | its level. Otherwise return a level one beyond the existing hierarchy." |
| 3856 | beyond the existing hierarchy." | ||
| 3857 | (if (not (consp key)) | 3850 | (if (not (consp key)) |
| 3858 | key | 3851 | key |
| 3859 | (let* ((hier (rst-get-hierarchy)) | 3852 | (let* ((hier (rst-get-hierarchy)) |
| @@ -3875,9 +3868,8 @@ as a trigger for `rst-font-lock-handle-adornment-matcher'.") | |||
| 3875 | (defun rst-font-lock-handle-adornment-pre-match-form (ado ado-end) | 3868 | (defun rst-font-lock-handle-adornment-pre-match-form (ado ado-end) |
| 3876 | "Determine limit for adornments. | 3869 | "Determine limit for adornments. |
| 3877 | Determine all things necessary for font-locking section titles | 3870 | Determine all things necessary for font-locking section titles |
| 3878 | and transitions and put the result to | 3871 | and transitions and put the result to `rst-font-lock-adornment-match' |
| 3879 | `rst-font-lock-adornment-match' and | 3872 | and `rst-font-lock-adornment-level'. ADO is the complete adornment |
| 3880 | `rst-font-lock-adornment-level'. ADO is the complete adornment | ||
| 3881 | matched. ADO-END is the point where ADO ends. Return the point | 3873 | matched. ADO-END is the point where ADO ends. Return the point |
| 3882 | where the whole adorned construct ends. | 3874 | where the whole adorned construct ends. |
| 3883 | 3875 | ||
| @@ -3892,7 +3884,7 @@ Called as a PRE-MATCH-FORM in the sense of `font-lock-keywords'." | |||
| 3892 | (goto-char (nth 1 ado-data)) ; Beginning of construct. | 3884 | (goto-char (nth 1 ado-data)) ; Beginning of construct. |
| 3893 | (nth 2 ado-data)))) ; End of construct. | 3885 | (nth 2 ado-data)))) ; End of construct. |
| 3894 | 3886 | ||
| 3895 | (defun rst-font-lock-handle-adornment-matcher (limit) | 3887 | (defun rst-font-lock-handle-adornment-matcher (_limit) |
| 3896 | "Set the match found earlier if match were found. | 3888 | "Set the match found earlier if match were found. |
| 3897 | Match has been found by | 3889 | Match has been found by |
| 3898 | `rst-font-lock-handle-adornment-pre-match-form' the first time | 3890 | `rst-font-lock-handle-adornment-pre-match-form' the first time |
| @@ -3989,7 +3981,7 @@ string)) to be used for converting the document." | |||
| 3989 | (defun rst-compile (&optional use-alt) | 3981 | (defun rst-compile (&optional use-alt) |
| 3990 | "Compile command to convert reST document into some output file. | 3982 | "Compile command to convert reST document into some output file. |
| 3991 | Attempts to find configuration file, if it can, overrides the | 3983 | Attempts to find configuration file, if it can, overrides the |
| 3992 | options. There are two commands to choose from, with USE-ALT, | 3984 | options. There are two commands to choose from; with USE-ALT, |
| 3993 | select the alternative tool-set." | 3985 | select the alternative tool-set." |
| 3994 | (interactive "P") | 3986 | (interactive "P") |
| 3995 | ;; Note: maybe we want to check if there is a Makefile too and not do anything | 3987 | ;; Note: maybe we want to check if there is a Makefile too and not do anything |
| @@ -4094,7 +4086,7 @@ buffer, if the region is not selected." | |||
| 4094 | a)) | 4086 | a)) |
| 4095 | 4087 | ||
| 4096 | (defun rst-imenu-convert-cell (elt adornments) | 4088 | (defun rst-imenu-convert-cell (elt adornments) |
| 4097 | "Convert a cell ELT in a tree returned from `rst-section-tree' to imenu index. | 4089 | "Convert a cell ELT in a tree returned from `rst-section-tree' to Imenu index. |
| 4098 | ADORNMENTS is used as hint information for conversion." | 4090 | ADORNMENTS is used as hint information for conversion." |
| 4099 | (let* ((kar (car elt)) | 4091 | (let* ((kar (car elt)) |
| 4100 | (kdr (cdr elt)) | 4092 | (kdr (cdr elt)) |
| @@ -4128,7 +4120,7 @@ ADORNMENTS is used as hint information for conversion." | |||
| 4128 | ;; FIXME: Document title and subtitle need to be handled properly. They should | 4120 | ;; FIXME: Document title and subtitle need to be handled properly. They should |
| 4129 | ;; get an own "Document" top level entry. | 4121 | ;; get an own "Document" top level entry. |
| 4130 | (defun rst-imenu-create-index () | 4122 | (defun rst-imenu-create-index () |
| 4131 | "Create index for imenu. | 4123 | "Create index for Imenu. |
| 4132 | Return as described for `imenu--index-alist'." | 4124 | Return as described for `imenu--index-alist'." |
| 4133 | (rst-reset-section-caches) | 4125 | (rst-reset-section-caches) |
| 4134 | (let ((tree (rst-section-tree)) | 4126 | (let ((tree (rst-section-tree)) |
| @@ -4190,8 +4182,8 @@ This is useful for filling list item paragraphs." | |||
| 4190 | ;; be useful for creating separators. | 4182 | ;; be useful for creating separators. |
| 4191 | (defun rst-repeat-last-character (use-next) | 4183 | (defun rst-repeat-last-character (use-next) |
| 4192 | "Fill the current line using the last character on the current line. | 4184 | "Fill the current line using the last character on the current line. |
| 4193 | Fill up to the length of the preceding line or up to | 4185 | Fill up to the length of the preceding line or up to `fill-column' if preceding |
| 4194 | `fill-column' if preceding line is empty. | 4186 | line is empty. |
| 4195 | 4187 | ||
| 4196 | If USE-NEXT, use the next line rather than the preceding line. | 4188 | If USE-NEXT, use the next line rather than the preceding line. |
| 4197 | 4189 | ||