From 8f6b6da8ecdcd37ecbb83778d35baa02d68621a3 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 9 May 2012 02:57:18 +0200 Subject: [PATCH] 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. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/rst.el | 41 ++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30e5ac3c7eb..e2bc5619419 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2012-05-09 Juanma Barranquero + * 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. diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el index a9f280be1db..1fefe6e2e28 100644 --- a/lisp/textmodes/rst.el +++ b/lisp/textmodes/rst.el @@ -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." -- 2.39.2