aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2012-05-09 02:57:18 +0200
committerJuanma Barranquero2012-05-09 02:57:18 +0200
commit8f6b6da8ecdcd37ecbb83778d35baa02d68621a3 (patch)
treea3d8e1bb59e8a16382c5653de6bc8dd14e9b16f1
parent4824146aa85b7e0cdfe9cab024d2137c98b85174 (diff)
downloademacs-8f6b6da8ecdcd37ecbb83778d35baa02d68621a3.tar.gz
emacs-8f6b6da8ecdcd37ecbb83778d35baa02d68621a3.zip
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.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/textmodes/rst.el41
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 @@
12012-05-09 Juanma Barranquero <lekktu@gmail.com> 12012-05-09 Juanma Barranquero <lekktu@gmail.com>
2 2
3 * textmodes/rst.el: Silence byte-compiler warnings.
4 (rst-re-alist, rst-reset-section-caches): Move around.
5 (rst-re): Use `characterp', not `char-valid-p'.
6 (font-lock-beg, font-lock-end): Declare.
7
3 * progmodes/idlw-shell.el (specs): Remove reference to deleted 8 * progmodes/idlw-shell.el (specs): Remove reference to deleted
4 variable `idlwave-shell-activate-alt-keybindings' and simplify. 9 variable `idlwave-shell-activate-alt-keybindings' and simplify.
5 10
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.")
422Each entry consists of the symbol naming the regex and an 422Each entry consists of the symbol naming the regex and an
423argument list for `rst-re'.") 423argument list for `rst-re'.")
424 424
425(defconst rst-re-alist
426 ;; Shadow global value we are just defining so we can construct it step by
427 ;; step
428 (let (rst-re-alist)
429 (dolist (re rst-re-alist-def)
430 (setq rst-re-alist
431 (nconc rst-re-alist
432 (list (list (car re) (apply 'rst-re (cdr re)))))))
433 rst-re-alist)
434 "Alist mapping symbols from `rst-re-alist-def' to regex strings.")
435
425;; FIXME: Use `sregex` or `rx` instead of re-inventing the wheel 436;; FIXME: Use `sregex` or `rx` instead of re-inventing the wheel
426(defun rst-re (&rest args) 437(defun rst-re (&rest args)
427 "Interpret ARGS as regular expressions and return a regex string. 438 "Interpret ARGS as regular expressions and return a regex string.
@@ -459,7 +470,7 @@ After interpretation of ARGS the results are concatenated as for
459 re) 470 re)
460 ((symbolp re) 471 ((symbolp re)
461 (cadr (assoc re rst-re-alist))) 472 (cadr (assoc re rst-re-alist)))
462 ((char-valid-p re) 473 ((characterp re)
463 (regexp-quote (char-to-string re))) 474 (regexp-quote (char-to-string re)))
464 ((listp re) 475 ((listp re)
465 (let ((nested 476 (let ((nested
@@ -481,17 +492,6 @@ After interpretation of ARGS the results are concatenated as for
481 (error "Unknown object type for building regex: %s" re)))) 492 (error "Unknown object type for building regex: %s" re))))
482 args))) 493 args)))
483 494
484(defconst rst-re-alist
485 ;; Shadow global value we are just defining so we can construct it step by
486 ;; step
487 (let (rst-re-alist)
488 (dolist (re rst-re-alist-def)
489 (setq rst-re-alist
490 (nconc rst-re-alist
491 (list (list (car re) (apply 'rst-re (cdr re)))))))
492 rst-re-alist)
493 "Alist mapping symbols from `rst-re-alist-def' to regex strings.")
494
495 495
496;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 496;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
497;; Mode definition. 497;; Mode definition.
@@ -1186,7 +1186,7 @@ are nil."
1186 ((looking-at (rst-re 'ttl-beg)) 1186 ((looking-at (rst-re 'ttl-beg))
1187 ;; Try to use the underline 1187 ;; Try to use the underline
1188 (let ((r (rst-classify-adornment 1188 (let ((r (rst-classify-adornment
1189 (buffer-substring-no-properties 1189 (buffer-substring-no-properties
1190 (line-beginning-position 2) (line-end-position 2)) 1190 (line-beginning-position 2) (line-end-position 2))
1191 (line-end-position 2)))) 1191 (line-end-position 2))))
1192 (if r 1192 (if r
@@ -1199,12 +1199,6 @@ are nil."
1199;; current section adornment in a buffer local cache. Thus they can be used for 1199;; current section adornment in a buffer local cache. Thus they can be used for
1200;; font-locking and manipulation commands. 1200;; font-locking and manipulation commands.
1201 1201
1202(defun rst-reset-section-caches ()
1203 "Reset all section cache variables.
1204Should be called by interactive functions which deal with sections."
1205 (setq rst-all-sections nil
1206 rst-section-hierarchy nil))
1207
1208(defvar rst-all-sections nil 1202(defvar rst-all-sections nil
1209 "All section adornments in the buffer as found by `rst-find-all-adornments'. 1203 "All section adornments in the buffer as found by `rst-find-all-adornments'.
1210t when no section adornments were found.") 1204t when no section adornments were found.")
@@ -1218,6 +1212,12 @@ t when no section adornments were found. Value depends on
1218`rst-all-sections'.") 1212`rst-all-sections'.")
1219(make-variable-buffer-local 'rst-section-hierarchy) 1213(make-variable-buffer-local 'rst-section-hierarchy)
1220 1214
1215(defun rst-reset-section-caches ()
1216 "Reset all section cache variables.
1217Should be called by interactive functions which deal with sections."
1218 (setq rst-all-sections nil
1219 rst-section-hierarchy nil))
1220
1221(defun rst-find-all-adornments () 1221(defun rst-find-all-adornments ()
1222 "Return all the section adornments in the current buffer. 1222 "Return all the section adornments in the current buffer.
1223Return a list of (LINE . ADORNMENT) with ascending LINE where 1223Return a list of (LINE . ADORNMENT) with ascending LINE where
@@ -3571,6 +3571,9 @@ details check the Rst Faces Defaults group."
3571 ) 3571 )
3572 "Keywords to highlight in rst mode.") 3572 "Keywords to highlight in rst mode.")
3573 3573
3574(defvar font-lock-beg)
3575(defvar font-lock-end)
3576
3574(defun rst-font-lock-extend-region () 3577(defun rst-font-lock-extend-region ()
3575 "Extend the region `font-lock-beg' / `font-lock-end' iff it may 3578 "Extend the region `font-lock-beg' / `font-lock-end' iff it may
3576be in the middle of a multiline construct and return non-nil if so." 3579be in the middle of a multiline construct and return non-nil if so."