Commit 8f6b6da8 authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

lisp/textmodes/rst.el: Silence byte-compiler warnings.

(rst-re-alist, rst-reset-section-caches): Move around.
(rst-re): Use `characterp', not `char-valid-p'.
(font-lock-beg, font-lock-end): Declare.
parent 4824146a
2012-05-09 Juanma Barranquero <lekktu@gmail.com>
* textmodes/rst.el: Silence byte-compiler warnings.
(rst-re-alist, rst-reset-section-caches): Move around.
(rst-re): Use `characterp', not `char-valid-p'.
(font-lock-beg, font-lock-end): Declare.
* progmodes/idlw-shell.el (specs): Remove reference to deleted
variable `idlwave-shell-activate-alt-keybindings' and simplify.
......
......@@ -422,6 +422,17 @@ in parentheses follows the development revision and the timestamp.")
Each entry consists of the symbol naming the regex and an
argument list for `rst-re'.")
(defconst rst-re-alist
;; Shadow global value we are just defining so we can construct it step by
;; step
(let (rst-re-alist)
(dolist (re rst-re-alist-def)
(setq rst-re-alist
(nconc rst-re-alist
(list (list (car re) (apply 'rst-re (cdr re)))))))
rst-re-alist)
"Alist mapping symbols from `rst-re-alist-def' to regex strings.")
;; 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.
......@@ -459,7 +470,7 @@ After interpretation of ARGS the results are concatenated as for
re)
((symbolp re)
(cadr (assoc re rst-re-alist)))
((char-valid-p re)
((characterp re)
(regexp-quote (char-to-string re)))
((listp re)
(let ((nested
......@@ -481,17 +492,6 @@ After interpretation of ARGS the results are concatenated as for
(error "Unknown object type for building regex: %s" re))))
args)))
(defconst rst-re-alist
;; Shadow global value we are just defining so we can construct it step by
;; step
(let (rst-re-alist)
(dolist (re rst-re-alist-def)
(setq rst-re-alist
(nconc rst-re-alist
(list (list (car re) (apply 'rst-re (cdr re)))))))
rst-re-alist)
"Alist mapping symbols from `rst-re-alist-def' to regex strings.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Mode definition.
......@@ -1186,7 +1186,7 @@ are nil."
((looking-at (rst-re 'ttl-beg))
;; Try to use the underline
(let ((r (rst-classify-adornment
(buffer-substring-no-properties
(buffer-substring-no-properties
(line-beginning-position 2) (line-end-position 2))
(line-end-position 2))))
(if r
......@@ -1199,12 +1199,6 @@ are nil."
;; current section adornment in a buffer local cache. Thus they can be used for
;; font-locking and manipulation commands.
(defun rst-reset-section-caches ()
"Reset all section cache variables.
Should be called by interactive functions which deal with sections."
(setq rst-all-sections nil
rst-section-hierarchy nil))
(defvar rst-all-sections nil
"All section adornments in the buffer as found by `rst-find-all-adornments'.
t when no section adornments were found.")
......@@ -1218,6 +1212,12 @@ t when no section adornments were found. Value depends on
`rst-all-sections'.")
(make-variable-buffer-local 'rst-section-hierarchy)
(defun rst-reset-section-caches ()
"Reset all section cache variables.
Should be called by interactive functions which deal with sections."
(setq rst-all-sections nil
rst-section-hierarchy nil))
(defun rst-find-all-adornments ()
"Return all the section adornments in the current buffer.
Return a list of (LINE . ADORNMENT) with ascending LINE where
......@@ -3571,6 +3571,9 @@ details check the Rst Faces Defaults group."
)
"Keywords to highlight in rst mode.")
(defvar font-lock-beg)
(defvar font-lock-end)
(defun rst-font-lock-extend-region ()
"Extend the region `font-lock-beg' / `font-lock-end' iff it may
be in the middle of a multiline construct and return non-nil if so."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment