summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/css-mode.el1
-rw-r--r--lisp/textmodes/refill.el14
-rw-r--r--lisp/textmodes/sgml-mode.el40
-rw-r--r--lisp/textmodes/tex-mode.el14
-rw-r--r--lisp/textmodes/texinfo.el2
5 files changed, 34 insertions, 37 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index b9e4da59e18..d50aadef25b 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -37,7 +37,6 @@
"Cascading Style Sheets (CSS) editing mode."
:group 'languages)
-(eval-when-compile (require 'cl))
(defun css-extract-keyword-list (res)
(with-temp-buffer
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index cb7e9ff0b88..d6b355bdd0d 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -83,8 +83,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
-
(defgroup refill nil
"Refilling paragraphs on changes."
:group 'fill)
@@ -169,8 +167,8 @@ complex processing.")
"Post-command function to do refilling (conditionally)."
(when refill-doit ; there was a change
;; There's probably scope for more special cases here...
- (case this-command
- (self-insert-command
+ (pcase this-command
+ (`self-insert-command
;; Treat self-insertion commands specially, since they don't
;; always reset `refill-doit' -- for self-insertion commands that
;; *don't* cause a refill, we want to leave it turned on so that
@@ -180,9 +178,9 @@ complex processing.")
;; newline, covered below).
(refill-fill-paragraph-at refill-doit)
(setq refill-doit nil)))
- ((quoted-insert fill-paragraph fill-region) nil)
- ((newline newline-and-indent open-line indent-new-comment-line
- reindent-then-newline-and-indent)
+ ((or `quoted-insert `fill-paragraph `fill-region) nil)
+ ((or `newline `newline-and-indent `open-line `indent-new-comment-line
+ `reindent-then-newline-and-indent)
;; Don't zap what was just inserted.
(save-excursion
(beginning-of-line) ; for newline-and-indent
@@ -196,7 +194,7 @@ complex processing.")
(save-restriction
(narrow-to-region (line-beginning-position) (point-max))
(refill-fill-paragraph-at refill-doit))))
- (t
+ (_
(refill-fill-paragraph-at refill-doit)))
(setq refill-doit nil)))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index aed4ecb4e3e..5bcd87ede68 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -35,7 +35,7 @@
(eval-when-compile
(require 'skeleton)
(require 'outline)
- (require 'cl))
+ (require 'cl-lib))
(defgroup sgml nil
"SGML editing mode."
@@ -1192,7 +1192,7 @@ You might want to turn on `auto-fill-mode' to get better results."
;; Parsing
-(defstruct (sgml-tag
+(cl-defstruct (sgml-tag
(:constructor sgml-make-tag (type start end name)))
type start end name)
@@ -1272,7 +1272,7 @@ Leave point at the beginning of the tag."
(throw 'found (sgml-parse-tag-backward limit))))
(point))))
(goto-char (1+ tag-start))
- (case (char-after)
+ (pcase (char-after)
(?! (setq tag-type 'decl)) ; declaration
(?? (setq tag-type 'pi)) ; processing-instruction
(?% (setq tag-type 'jsp)) ; JSP tags
@@ -1280,7 +1280,7 @@ Leave point at the beginning of the tag."
(forward-char 1)
(setq tag-type 'close
name (sgml-parse-tag-name)))
- (t ; open or empty tag
+ (_ ; open or empty tag
(setq tag-type 'open
name (sgml-parse-tag-name))
(if (or (eq ?/ (char-before (- tag-end 1)))
@@ -1405,19 +1405,19 @@ If FULL is non-nil, parse back to the beginning of the buffer."
Depending on context, inserts a matching close-tag, or closes
the current start-tag or the current comment or the current cdata, ..."
(interactive)
- (case (car (sgml-lexical-context))
- (comment (insert " -->"))
- (cdata (insert "]]>"))
- (pi (insert " ?>"))
- (jsp (insert " %>"))
- (tag (insert " />"))
- (text
+ (pcase (car (sgml-lexical-context))
+ (`comment (insert " -->"))
+ (`cdata (insert "]]>"))
+ (`pi (insert " ?>"))
+ (`jsp (insert " %>"))
+ (`tag (insert " />"))
+ (`text
(let ((context (save-excursion (sgml-get-context))))
(if context
(progn
(insert "</" (sgml-tag-name (car (last context))) ">")
(indent-according-to-mode)))))
- (otherwise
+ (_
(error "Nothing to close"))))
(defun sgml-empty-tag-p (tag-name)
@@ -1442,9 +1442,9 @@ LCON is the lexical context, if any."
(save-excursion (goto-char (cdr lcon)) (looking-at "<!--")))
(setq lcon (cons 'comment (+ (cdr lcon) 2))))
- (case (car lcon)
+ (pcase (car lcon)
- (string
+ (`string
;; Go back to previous non-empty line.
(while (and (> (point) (cdr lcon))
(zerop (forward-line -1))
@@ -1455,7 +1455,7 @@ LCON is the lexical context, if any."
(goto-char (cdr lcon))
(1+ (current-column))))
- (comment
+ (`comment
(let ((mark (looking-at "--")))
;; Go back to previous non-empty line.
(while (and (> (point) (cdr lcon))
@@ -1474,11 +1474,11 @@ LCON is the lexical context, if any."
(current-column)))
;; We don't know how to indent it. Let's be honest about it.
- (cdata nil)
+ (`cdata nil)
;; We don't know how to indent it. Let's be honest about it.
- (pi nil)
+ (`pi nil)
- (tag
+ (`tag
(goto-char (1+ (cdr lcon)))
(skip-chars-forward "^ \t\n") ;Skip tag name.
(skip-chars-forward " \t")
@@ -1488,7 +1488,7 @@ LCON is the lexical context, if any."
(goto-char (1+ (cdr lcon)))
(+ (current-column) sgml-basic-offset)))
- (text
+ (`text
(while (looking-at "</")
(forward-sexp 1)
(skip-chars-forward " \t"))
@@ -1536,7 +1536,7 @@ LCON is the lexical context, if any."
(+ (current-column)
(* sgml-basic-offset (length context)))))))
- (otherwise
+ (_
(error "Unrecognized context %s" (car lcon)))
))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 43005a03415..a0e282c6fcc 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -31,7 +31,7 @@
;; Pacify the byte-compiler
(eval-when-compile
(require 'compare-w)
- (require 'cl)
+ (require 'cl-lib)
(require 'skeleton))
(defvar font-lock-comment-face)
@@ -1543,8 +1543,8 @@ Puts point on a blank line between them."
(save-excursion
(let ((pt (point)))
(skip-chars-backward "^ {}\n\t\\\\")
- (case (char-before)
- ((nil ?\s ?\n ?\t ?\}) nil)
+ (pcase (char-before)
+ ((or `nil ?\s ?\n ?\t ?\}) nil)
(?\\
;; TODO: Complete commands.
nil)
@@ -1793,7 +1793,7 @@ Mark is left at original location."
(if (not (eq (char-syntax (preceding-char)) ?/))
(progn
;; Don't count single-char words.
- (unless (looking-at ".\\>") (incf count))
+ (unless (looking-at ".\\>") (cl-incf count))
(forward-char 1))
(let ((cmd
(buffer-substring-no-properties
@@ -2861,10 +2861,10 @@ There might be text before point."
(cons (append (car font-lock-defaults) '(doctex-font-lock-keywords))
(mapcar
(lambda (x)
- (case (car-safe x)
- (font-lock-syntactic-face-function
+ (pcase (car-safe x)
+ (`font-lock-syntactic-face-function
(cons (car x) 'doctex-font-lock-syntactic-face-function))
- (t x)))
+ (_ x)))
(cdr font-lock-defaults))))
(set (make-local-variable 'syntax-propertize-function)
(syntax-propertize-rules doctex-syntax-propertize-rules)))
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 31af2e72699..4e7715dcea9 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -32,7 +32,7 @@
;;; Code:
-(eval-when-compile (require 'tex-mode) (require 'cl))
+(eval-when-compile (require 'tex-mode))
(defvar outline-heading-alist)
(defgroup texinfo nil