summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el13
-rw-r--r--lisp/textmodes/bib-mode.el2
-rw-r--r--lisp/textmodes/bibtex.el116
-rw-r--r--lisp/textmodes/conf-mode.el16
-rw-r--r--lisp/textmodes/css-mode.el298
-rw-r--r--lisp/textmodes/dns-mode.el13
-rw-r--r--lisp/textmodes/enriched.el23
-rw-r--r--lisp/textmodes/fill.el21
-rw-r--r--lisp/textmodes/flyspell.el34
-rw-r--r--lisp/textmodes/ispell.el211
-rw-r--r--lisp/textmodes/less-css-mode.el4
-rw-r--r--lisp/textmodes/mhtml-mode.el5
-rw-r--r--lisp/textmodes/nroff-mode.el10
-rw-r--r--lisp/textmodes/page-ext.el211
-rw-r--r--lisp/textmodes/page.el62
-rw-r--r--lisp/textmodes/paragraphs.el53
-rw-r--r--lisp/textmodes/picture.el14
-rw-r--r--lisp/textmodes/refbib.el2
-rw-r--r--lisp/textmodes/refill.el11
-rw-r--r--lisp/textmodes/reftex-cite.el4
-rw-r--r--lisp/textmodes/reftex-global.el9
-rw-r--r--lisp/textmodes/reftex-parse.el2
-rw-r--r--lisp/textmodes/reftex-ref.el4
-rw-r--r--lisp/textmodes/reftex-vars.el61
-rw-r--r--lisp/textmodes/remember.el10
-rw-r--r--lisp/textmodes/rst.el57
-rw-r--r--lisp/textmodes/sgml-mode.el232
-rw-r--r--lisp/textmodes/table.el156
-rw-r--r--lisp/textmodes/tex-mode.el65
-rw-r--r--lisp/textmodes/texinfmt.el15
-rw-r--r--lisp/textmodes/texinfo.el38
-rw-r--r--lisp/textmodes/texnfo-upd.el4
-rw-r--r--lisp/textmodes/text-mode.el37
-rw-r--r--lisp/textmodes/tildify.el16
-rw-r--r--lisp/textmodes/underline.el2
35 files changed, 1108 insertions, 723 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 885a4ee67ec..19d1df6d51c 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -3,7 +3,6 @@
;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
;; Author: Tomas Abrahamsson <tab@lysator.liu.se>
-;; Maintainer: Tomas Abrahamsson <tab@lysator.liu.se>
;; Keywords: mouse
;; Version: 1.2.6
;; Release-date: 6-Aug-2004
@@ -351,13 +350,12 @@ Example:
(defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil)
"If in X Windows, use this pointer shape while drawing with the mouse.")
+(defvaralias 'artist-text-renderer 'artist-text-renderer-function)
(defcustom artist-text-renderer-function 'artist-figlet
"Function for doing text rendering."
:group 'artist-text
:type 'symbol)
-(defvaralias 'artist-text-renderer 'artist-text-renderer-function)
-
(defcustom artist-figlet-program "figlet"
"Program to run for `figlet'."
@@ -1199,7 +1197,7 @@ PREV-OP-ARG are used when invoked recursively during the build-up."
;;;###autoload
(define-minor-mode artist-mode
"Toggle Artist mode.
-With argument ARG, turn Artist mode on if ARG is positive.
+
Artist lets you draw lines, squares, rectangles and poly-lines,
ellipses and circles with your mouse and/or keyboard.
@@ -1401,7 +1399,10 @@ Keymap summary
(artist-mode-exit))
(t
;; Turn mode on
- (artist-mode-init))))
+ (artist-mode-init)
+ (let ((font (face-attribute 'default :font)))
+ (when (and (fontp font) (not (font-get font :spacing)))
+ (message "The default font isn't monospaced, so the drawings in this buffer may look odd"))))))
;; Init and exit
(defun artist-mode-init ()
@@ -2893,7 +2894,7 @@ Returns a list of strings."
dir-list)
(mapcar
(lambda (file)
- (replace-regexp-in-string "\.flf\\'" "" file))
+ (replace-regexp-in-string "\\.flf\\'" "" file))
result))))
(defun artist-figlet-choose-font ()
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index 81dfb6c99c0..7a5d3ef7758 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -198,7 +198,7 @@ named by variable `unread-bib-file'."
(defvar bib-capitalize-title-stop-words
(concat
- "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|"
+ "the\\|and\\|of\\|is\\|a\\|an\\|for\\|in\\|to\\|on\\|at\\|"
"by\\|with\\|that\\|its")
"Words not to be capitalized in a title (unless the first word).")
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index b9ff7a57988..a560c2b097f 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1038,6 +1038,9 @@ See `bibtex-generate-autokey' for details."
:type '(repeat (cons (regexp :tag "Old")
(string :tag "New"))))
+(defvaralias 'bibtex-autokey-name-case-convert
+ 'bibtex-autokey-name-case-convert-function)
+
(defcustom bibtex-autokey-name-case-convert-function 'downcase
"Function called for each name to perform case conversion.
See `bibtex-generate-autokey' for details."
@@ -1049,8 +1052,6 @@ See `bibtex-generate-autokey' for details."
(function :tag "Conversion function")))
(put 'bibtex-autokey-name-case-convert-function 'safe-local-variable
(lambda (x) (memq x '(upcase downcase capitalize identity))))
-(defvaralias 'bibtex-autokey-name-case-convert
- 'bibtex-autokey-name-case-convert-function)
(defcustom bibtex-autokey-name-length 'infty
"Number of characters from name to incorporate into key.
@@ -1113,6 +1114,9 @@ Case is significant. See `bibtex-generate-autokey' for details."
:group 'bibtex-autokey
:type '(repeat regexp))
+(defvaralias 'bibtex-autokey-titleword-case-convert
+ 'bibtex-autokey-titleword-case-convert-function)
+
(defcustom bibtex-autokey-titleword-case-convert-function 'downcase
"Function called for each titleword to perform case conversion.
See `bibtex-generate-autokey' for details."
@@ -1122,8 +1126,6 @@ See `bibtex-generate-autokey' for details."
(const :tag "Capitalize" capitalize)
(const :tag "Upcase" upcase)
(function :tag "Conversion function")))
-(defvaralias 'bibtex-autokey-titleword-case-convert
- 'bibtex-autokey-titleword-case-convert-function)
(defcustom bibtex-autokey-titleword-abbrevs nil
"Determines exceptions to the usual abbreviation mechanism.
@@ -1354,6 +1356,8 @@ Set this variable before loading BibTeX mode."
;; The Key `C-c&' is reserved for reftex.el
(define-key km "\t" 'bibtex-find-text)
(define-key km "\n" 'bibtex-next-field)
+ (define-key km [remap forward-paragraph] 'bibtex-next-entry)
+ (define-key km [remap backward-paragraph] 'bibtex-previous-entry)
(define-key km "\M-\t" 'completion-at-point)
(define-key km "\C-c\"" 'bibtex-remove-delimiters)
(define-key km "\C-c{" 'bibtex-remove-delimiters)
@@ -1413,6 +1417,8 @@ Set this variable before loading BibTeX mode."
("Moving inside an Entry"
["End of Field" bibtex-find-text t]
["Next Field" bibtex-next-field t]
+ ["Next entry" bibtex-next-entry t]
+ ["Previous entry" bibtex-previous-entry t]
["Beginning of Entry" bibtex-beginning-of-entry t]
["End of Entry" bibtex-end-of-entry t]
"--"
@@ -2343,7 +2349,8 @@ Formats current entry according to variable `bibtex-entry-format'."
(when (memq 'sort-fields format)
(goto-char (point-min))
(let ((beg-fields (save-excursion (bibtex-beginning-first-field)))
- (fields-alist (bibtex-parse-entry))
+ (fields-alist (bibtex-parse-entry
+ nil (not (memq 'opts-or-alts format))))
bibtex-help-message elt)
(delete-region beg-fields (point))
(dolist (field default-field-list)
@@ -2365,7 +2372,8 @@ Formats current entry according to variable `bibtex-entry-format'."
(end-text (copy-marker (bibtex-end-of-text-in-field bounds) t))
(empty-field (equal "" (bibtex-text-in-field-bounds bounds t)))
(field-name (buffer-substring-no-properties beg-name end-name))
- (opt-alt (and (string-match "\\`\\(OPT\\|ALT\\)" field-name)
+ (opt-alt (and (memq 'opts-or-alts format)
+ (string-match "\\`\\(OPT\\|ALT\\)" field-name)
(not (and bibtex-no-opt-remove-re
(string-match bibtex-no-opt-remove-re
field-name)))))
@@ -2932,7 +2940,7 @@ for parsing BibTeX keys. If parsing fails, try to set this variable to nil."
(if verbose
(bibtex-progress-message 'done))
;; successful operation --> return `bibtex-reference-keys'
- (setq bibtex-reference-keys ref-keys)))))))
+ (setq bibtex-reference-keys (nreverse ref-keys))))))))
(defun bibtex-parse-strings (&optional add abortable)
"Set `bibtex-strings' to the string definitions in the whole buffer.
@@ -3639,20 +3647,20 @@ When called interactively with a prefix arg, query for a value of ENTRY-TYPE."
(mapc 'bibtex-make-field required)
(mapc 'bibtex-make-optional-field optional)))))
-(defun bibtex-parse-entry (&optional content)
+(defun bibtex-parse-entry (&optional content keep-opt-alt)
"Parse entry at point, return an alist.
The alist elements have the form (FIELD . TEXT), where FIELD can also be
the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\"
-TEXT may be nil. Remove \"OPT\" and \"ALT\" from FIELD.
-Move point to the end of the last field.
-If optional arg CONTENT is non-nil extract content of text fields."
+TEXT may be nil. Move point to the end of the last field.
+If optional arg CONTENT is non-nil extract content of text fields.
+Remove \"OPT\" and \"ALT\" from FIELD unless KEEP-OPT-ALT is non-nil."
(let (alist bounds)
(when (looking-at bibtex-entry-maybe-empty-head)
(push (cons "=type=" (bibtex-type-in-head)) alist)
(push (cons "=key=" (bibtex-key-in-head)) alist)
(goto-char (match-end 0))
(while (setq bounds (bibtex-parse-field))
- (push (cons (bibtex-name-in-field bounds t)
+ (push (cons (bibtex-name-in-field bounds (not keep-opt-alt))
(bibtex-text-in-field-bounds bounds content))
alist)
(goto-char (bibtex-end-of-field bounds))))
@@ -3846,11 +3854,13 @@ Return the new location of point."
(re-search-forward "[\n\C-m]" nil 'end (1- arg))
(forward-line (1- arg))))
-(defun bibtex-reposition-window ()
+(defun bibtex-reposition-window (&optional pos)
"Make the current BibTeX entry visible.
If entry is smaller than `window-body-height', entry is centered in window.
-Otherwise display the beginning of entry."
+Otherwise display the beginning of entry.
+Optional arg POS is the position of the BibTeX entry to use."
(interactive)
+ (if pos (goto-char pos))
(let ((pnt (point))
(beg (line-number-at-pos (bibtex-beginning-of-entry)))
(end (line-number-at-pos (bibtex-end-of-entry))))
@@ -3869,9 +3879,10 @@ Otherwise display the beginning of entry."
(goto-char pnt)))))
(defun bibtex-mark-entry ()
- "Put mark at beginning, point at end of current BibTeX entry."
+ "Put mark at beginning, point at end of current BibTeX entry.
+Activate mark in Transient Mark mode."
(interactive)
- (push-mark (bibtex-beginning-of-entry) :activate t)
+ (push-mark (bibtex-beginning-of-entry) t t)
(bibtex-end-of-entry))
(defun bibtex-count-entries (&optional count-string-entries)
@@ -4058,8 +4069,7 @@ for a crossref key, t otherwise."
(message "Key `%s' is current entry" crossref-key)
(if eqb (select-window (split-window))
(pop-to-buffer buffer))
- (goto-char pos)
- (bibtex-reposition-window)
+ (bibtex-reposition-window pos)
(beginning-of-line)
(if (and eqb (> pnt pos) (not noerror))
(error "The referencing entry must precede the crossrefed entry!"))))
@@ -4107,9 +4117,14 @@ A prefix arg negates the value of `bibtex-search-entry-globally'."
(if (cdr (assoc-string key bibtex-reference-keys))
(setq found (bibtex-search-entry key)))))
(cond ((and found display)
- (switch-to-buffer buffer)
- (goto-char found)
- (bibtex-reposition-window))
+ ;; If possible, reuse the window displaying BUFFER.
+ (let ((window (get-buffer-window buffer t)))
+ (if window
+ (progn
+ (select-frame-set-input-focus (window-frame window))
+ (select-window window))
+ (switch-to-buffer buffer)))
+ (bibtex-reposition-window found))
(found (set-buffer buffer))
(display (message "Key `%s' not found" key)))
found)
@@ -4441,6 +4456,24 @@ is as in `bibtex-enclosing-field'. It is t for interactive calls."
(goto-char (match-beginning 0)))
(bibtex-find-text begin nil bibtex-help-message)))
+(defun bibtex-next-entry (&optional arg)
+ "Move point ARG entries forward.
+ARG defaults to one. Called interactively, ARG is the prefix
+argument."
+ (interactive "p")
+ (bibtex-end-of-entry)
+ (when (re-search-forward bibtex-entry-maybe-empty-head nil t (or arg 1))
+ (goto-char (match-beginning 0))))
+
+(defun bibtex-previous-entry (&optional arg)
+ "Move point ARG entries backward.
+ARG defaults to one. Called interactively, ARG is the prefix
+argument."
+ (interactive "p")
+ (bibtex-beginning-of-entry)
+ (when (re-search-backward bibtex-entry-maybe-empty-head nil t (or arg 1))
+ (goto-char (match-beginning 0))))
+
(defun bibtex-find-text (&optional begin noerror help comma)
"Move point to end of text of current BibTeX field or entry head.
With optional prefix BEGIN non-nil, move point to its beginning.
@@ -4925,23 +4958,26 @@ If mark is active reformat entries in region, if not in whole buffer."
(cond (read-options
(if use-previous-options
bibtex-reformat-previous-options
- (setq bibtex-reformat-previous-options
- (delq nil
- (mapcar (lambda (option)
- (if (y-or-n-p (car option)) (cdr option)))
- `(("Realign entries (recommended)? " . realign)
- ("Remove empty optional and alternative fields? " . opts-or-alts)
- ("Remove delimiters around pure numerical fields? " . numerical-fields)
- (,(concat (if bibtex-comma-after-last-field "Insert" "Remove")
- " comma at end of entry? ") . last-comma)
- ("Replace double page dashes by single ones? " . page-dashes)
- ("Delete whitespace at the beginning and end of fields? " . whitespace)
- ("Inherit booktitle? " . inherit-booktitle)
- ("Force delimiters? " . delimiters)
- ("Unify case of entry types and field names? " . unify-case)
- ("Enclose parts of field entries by braces? " . braces)
- ("Replace parts of field entries by string constants? " . strings)
- ("Sort fields? " . sort-fields)))))))
+ (let (answers)
+ (map-y-or-n-p
+ #'car
+ (lambda (option)
+ (push (cdr option) answers))
+ `(("Realign entries (recommended)? " . realign)
+ ("Remove empty optional and alternative fields? " . opts-or-alts)
+ ("Remove delimiters around pure numerical fields? " . numerical-fields)
+ (,(concat (if bibtex-comma-after-last-field "Insert" "Remove")
+ " comma at end of entry? ") . last-comma)
+ ("Replace double page dashes by single ones? " . page-dashes)
+ ("Delete whitespace at the beginning and end of fields? " . whitespace)
+ ("Inherit booktitle? " . inherit-booktitle)
+ ("Force delimiters? " . delimiters)
+ ("Unify case of entry types and field names? " . unify-case)
+ ("Enclose parts of field entries by braces? " . braces)
+ ("Replace parts of field entries by string constants? " . strings)
+ ("Sort fields? " . sort-fields))
+ '("formatting action" "formatting actions" "perform"))
+ (setq bibtex-reformat-previous-options (nreverse answers)))))
;; Do not include required-fields because `bibtex-reformat'
;; cannot handle the error messages of `bibtex-format-entry'.
;; Use `bibtex-validate' to check for required fields.
@@ -5059,7 +5095,7 @@ entries from minibuffer."
(list beg end
(lambda (s p a)
(cond
- ((eq a 'metadata) `(metadata (category . bibtex-key)))
+ ((eq a 'metadata) '(metadata (category . bibtex-key)))
(t (let ((completion-ignore-case nil))
(complete-with-action
a (bibtex-global-key-alist) s p)))))
@@ -5077,7 +5113,7 @@ entries from minibuffer."
(list beg end
(lambda (s p a)
(cond
- ((eq a 'metadata) `(metadata (category . bibtex-string)))
+ ((eq a 'metadata) '(metadata (category . bibtex-string)))
(t (let ((completion-ignore-case t))
(complete-with-action a compl s p)))))
:exit-function (bibtex-complete-string-cleanup compl))))))
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index ff0f56ebbb8..3b3d5d4ff20 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -1,4 +1,4 @@
-;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files
+;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files -*- lexical-binding: t; -*-
;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
@@ -135,7 +135,7 @@ not align (only setting space according to `conf-assignment-space')."
(modify-syntax-entry ?_ "_" table)
(modify-syntax-entry ?- "_" table)
(modify-syntax-entry ?. "_" table)
- (modify-syntax-entry ?\' "\"" table)
+ (modify-syntax-entry ?' "\"" table)
(modify-syntax-entry ?\; "<" table)
(modify-syntax-entry ?\n ">" table)
(modify-syntax-entry ?\r ">" table)
@@ -194,7 +194,7 @@ not align (only setting space according to `conf-assignment-space')."
(1 'font-lock-variable-name-face)
(2 'font-lock-constant-face nil t))
;; section { ... } (do this last because some assign ...{...)
- ("^[ \t]*\\([^=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
+ ("^[ \t]*\\([^#=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
"Keywords to highlight in Conf mode.")
(defvar conf-javaprop-font-lock-keywords
@@ -230,7 +230,7 @@ This variable is best set in the file local variables, or through
(put 'conf-space-keywords 'safe-local-variable 'stringp)
(defvar conf-space-font-lock-keywords
- `(;; [section] (do this first because it may look like a parameter)
+ '(;; [section] (do this first because it may look like a parameter)
("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
;; section { ... } (do this first because it looks like a parameter)
("^[ \t]*\\(.+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face)
@@ -243,7 +243,7 @@ This variable is best set in the file local variables, or through
"Keywords to highlight in Conf Space mode.")
(defvar conf-colon-font-lock-keywords
- `(;; [section] (do this first because it may look like a parameter)
+ '(;; [section] (do this first because it may look like a parameter)
("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
;; var: val
("^[ \t]*\\(.+?\\)[ \t]*:"
@@ -281,10 +281,10 @@ whitespace.")
;; If anybody can figure out how to get the same effect by configuring
;; `align', I'd be glad to hear.
(defun conf-align-assignments (&optional arg)
- (interactive "P")
"Align the assignments in the buffer or active region.
In Transient Mark mode, if the mark is active, operate on the
contents of the region. Otherwise, operate on the whole buffer."
+ (interactive "P")
(setq arg (if arg
(prefix-numeric-value arg)
conf-assignment-column))
@@ -323,7 +323,7 @@ contents of the region. Otherwise, operate on the whole buffer."
(defun conf-quote-normal (arg)
"Set the syntax of \\=' and \" to punctuation.
-With prefix arg, only do it for \\=' if 1, or only for \" if 2.
+With prefix ARG, only do it for \\=' if 1, or only for \" if 2.
This only affects the current buffer. Some conf files use quotes
to delimit strings, while others allow quotes as simple parts of
the assigned value. In those files font locking will be wrong,
@@ -442,7 +442,7 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
(run-mode-hooks 'conf-mode-hook)))
(defun conf-mode-initialize (comment &optional font-lock)
- "Initializations for sub-modes of conf-mode.
+ "Initializations for sub-modes of `conf-mode'.
COMMENT initializes `comment-start' and `comment-start-skip'.
The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS."
(set (make-local-variable 'comment-start) comment)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 67a0c9f7a57..b0653bce81c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -34,9 +34,12 @@
(require 'cl-lib)
(require 'color)
+(require 'eww)
+(require 'imenu)
(require 'seq)
(require 'sgml-mode)
(require 'smie)
+(require 'thingatpt)
(eval-when-compile (require 'subr-x))
(defgroup css nil
@@ -109,7 +112,6 @@
("bottom" length percentage "auto")
("caption-side" "top" "bottom")
("clear" "none" "left" "right" "both")
- ("clip" shape "auto")
("content" "normal" "none" string uri counter "attr()"
"open-quote" "close-quote" "no-open-quote" "no-close-quote")
("counter-increment" identifier integer "none")
@@ -372,6 +374,31 @@
("orphans" integer)
("widows" integer)
+ ;; CSS Masking Module Level 1
+ ;; (https://www.w3.org/TR/css-masking-1/#property-index)
+ ("clip-path" clip-source basic-shape geometry-box "none")
+ ("clip-rule" "nonzero" "evenodd")
+ ("mask-image" mask-reference)
+ ("mask-mode" masking-mode)
+ ("mask-repeat" repeat-style)
+ ("mask-position" position)
+ ("mask-clip" geometry-box "no-clip")
+ ("mask-origin" geometry-box)
+ ("mask-size" bg-size)
+ ("mask-composite" compositing-operator)
+ ("mask" mask-layer)
+ ("mask-border-source" "none" image)
+ ("mask-border-mode" "luminance" "alpha")
+ ("mask-border-slice" number percentage "fill")
+ ("mask-border-width" length percentage number "auto")
+ ("mask-border-outset" length number)
+ ("mask-border-repeat" "stretch" "repeat" "round" "space")
+ ("mask-border" mask-border-source mask-border-slice
+ mask-border-width mask-border-outset mask-border-repeat
+ mask-border-mode)
+ ("mask-type" "luminance" "alpha")
+ ("clip" "rect()" "auto")
+
;; CSS Multi-column Layout Module
;; (https://www.w3.org/TR/css3-multicol/#property-index)
;; "break-after", "break-before", and "break-inside" are left out
@@ -649,14 +676,17 @@ further value candidates, since that list would be infinite.")
(attachment "scroll" "fixed" "local")
(auto-repeat "repeat()")
(auto-track-list line-names fixed-size fixed-repeat auto-repeat)
+ (basic-shape "inset()" "circle()" "ellipse()" "polygon()")
(bg-image image "none")
(bg-layer bg-image position repeat-style attachment box)
(bg-size length percentage "auto" "cover" "contain")
(box "border-box" "padding-box" "content-box")
+ (clip-source uri)
(color
"rgb()" "rgba()" "hsl()" "hsla()" named-color "transparent"
"currentColor")
(common-lig-values "common-ligatures" "no-common-ligatures")
+ (compositing-operator "add" "subtract" "intersect" "exclude")
(contextual-alt-values "contextual" "no-contextual")
(counter "counter()" "counters()")
(discretionary-lig-values
@@ -682,6 +712,7 @@ further value candidates, since that list would be infinite.")
(generic-family
"serif" "sans-serif" "cursive" "fantasy" "monospace")
(generic-voice "male" "female" "child")
+ (geometry-box shape-box "fill-box" "stroke-box" "view-box")
(gradient
linear-gradient radial-gradient repeating-linear-gradient
repeating-radial-gradient)
@@ -702,6 +733,12 @@ further value candidates, since that list would be infinite.")
(line-width length "thin" "medium" "thick")
(linear-gradient "linear-gradient()")
(margin-width "auto" length percentage)
+ (mask-layer
+ mask-reference masking-mode position bg-size repeat-style
+ geometry-box "no-clip" compositing-operator)
+ (mask-reference "none" image mask-source)
+ (mask-source uri)
+ (masking-mode "alpha" "luminance" "auto")
(named-color . ,(mapcar #'car css--color-map))
(number "calc()")
(numeric-figure-values "lining-nums" "oldstyle-nums")
@@ -717,7 +754,7 @@ further value candidates, since that list would be infinite.")
(repeating-linear-gradient "repeating-linear-gradient()")
(repeating-radial-gradient "repeating-radial-gradient()")
(shadow "inset" length color)
- (shape "rect()")
+ (shape-box box "margin-box")
(single-animation-direction
"normal" "reverse" "alternate" "alternate-reverse")
(single-animation-fill-mode "none" "forwards" "backwards" "both")
@@ -807,6 +844,21 @@ cannot be completed sensibly: `custom-ident',
(defvar css-mode-map
(let ((map (make-sparse-keymap)))
(define-key map [remap info-lookup-symbol] 'css-lookup-symbol)
+ ;; `info-complete-symbol' is not used.
+ (define-key map [remap complete-symbol] 'completion-at-point)
+ (define-key map "\C-c\C-f" 'css-cycle-color-format)
+ (easy-menu-define css-menu map "CSS mode menu"
+ '("CSS"
+ :help "CSS-specific features"
+ ["Reformat block" fill-paragraph
+ :help "Reformat declaration block or fill comment at point"]
+ ["Cycle color format" css-cycle-color-format
+ :help "Cycle color at point between different formats"]
+ "-"
+ ["Describe symbol" css-lookup-symbol
+ :help "Display documentation for a CSS symbol"]
+ ["Complete symbol" completion-at-point
+ :help "Complete symbol before point"]))
map)
"Keymap used in `css-mode'.")
@@ -821,7 +873,7 @@ cannot be completed sensibly: `custom-ident',
(css--uri-re (1 "|") (2 "|"))))
(defconst css-escapes-re
- "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
+ "\\\\\\(?:[^\000-\037\177]\\|[[:xdigit:]]+[ \n\t\r\f]?\\)")
(defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
(defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
(defconst css-ident-re ;; (concat css-nmstart-re css-nmchar-re "*")
@@ -854,7 +906,7 @@ cannot be completed sensibly: `custom-ident',
(,(concat "@" css-ident-re) (0 font-lock-builtin-face))
;; Selectors.
;; Allow plain ":root" as a selector.
- ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
+ ("^[ \t]*\\(:root\\)[\n \t]*{" (1 'css-selector keep))
;; FIXME: attribute selectors don't work well because they may contain
;; strings which have already been highlighted as f-l-string-face and
;; thus prevent this highlighting from being applied (actually now that
@@ -877,7 +929,7 @@ cannot be completed sensibly: `custom-ident',
"\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
css-pseudo-element-ids)
t)
- "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
+ "\\|::" (regexp-opt css-pseudo-element-ids t) "\\)"
"\\(?:([^)]+)\\)?"
(if (not sassy)
"[^:{}()\n]*"
@@ -897,7 +949,7 @@ cannot be completed sensibly: `custom-ident',
;; No face.
nil)))
;; Variables.
- (,(concat "--" css-ident-re) (0 font-lock-variable-name-face))
+ (,(concat (rx symbol-start) "--" css-ident-re) (0 font-lock-variable-name-face))
;; Properties. Again, we don't limit ourselves to css-property-ids.
(,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
"\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
@@ -937,11 +989,13 @@ cannot be completed sensibly: `custom-ident',
"Skip blanks and comments."
(while (forward-comment 1)))
-(cl-defun css--rgb-color ()
+(cl-defun css--rgb-color (&optional include-alpha)
"Parse a CSS rgb() or rgba() color.
Point should be just after the open paren.
Returns a hex RGB color, or nil if the color could not be recognized.
-This recognizes CSS-color-4 extensions."
+This recognizes CSS-color-4 extensions.
+When INCLUDE-ALPHA is non-nil, the alpha component is included in
+the returned hex string."
(let ((result '())
(iter 0))
(while (< iter 4)
@@ -951,11 +1005,11 @@ This recognizes CSS-color-4 extensions."
(let* ((is-percent (match-beginning 1))
(str (match-string (if is-percent 1 2)))
(number (string-to-number str)))
- (when is-percent
- (setq number (* 255 (/ number 100.0))))
- ;; Don't push the alpha.
- (when (< iter 3)
- (push (min (max 0 (truncate number)) 255) result))
+ (if is-percent
+ (setq number (* 255 (/ number 100.0)))
+ (when (and include-alpha (= iter 3))
+ (setq number (* number 255))))
+ (push (min (max 0 (round number)) 255) result)
(goto-char (match-end 0))
(css--color-skip-blanks)
(cl-incf iter)
@@ -967,7 +1021,11 @@ This recognizes CSS-color-4 extensions."
(css--color-skip-blanks)))
(when (looking-at ")")
(forward-char)
- (apply #'format "#%02x%02x%02x" (nreverse result)))))
+ (apply #'format
+ (if (and include-alpha (= (length result) 4))
+ "#%02x%02x%02x%02x"
+ "#%02x%02x%02x")
+ (nreverse result)))))
(cl-defun css--hsl-color ()
"Parse a CSS hsl() or hsla() color.
@@ -1021,10 +1079,10 @@ This recognizes CSS-color-4 extensions."
(regexp-opt (mapcar #'car css--color-map) 'symbols)
"\\|"
;; Short hex. css-color-4 adds alpha.
- "\\(#[0-9a-fA-F]\\{3,4\\}\\b\\)"
+ "\\(#[[:xdigit:]]\\{3,4\\}\\b\\)"
"\\|"
;; Long hex. css-color-4 adds alpha.
- "\\(#\\(?:[0-9a-fA-F][0-9a-fA-F]\\)\\{3,4\\}\\b\\)"
+ "\\(#\\(?:[[:xdigit:]][[:xdigit:]]\\)\\{3,4\\}\\b\\)"
"\\|"
;; RGB.
"\\(\\_<rgba?(\\)"
@@ -1038,9 +1096,15 @@ This recognizes CSS-color-4 extensions."
STR is the incoming CSS hex color.
This function simply drops any transparency."
;; Either #RGB or #RRGGBB, drop the "A" or "AA".
- (if (> (length str) 5)
- (substring str 0 7)
- (substring str 0 4)))
+ (substring str 0 (if (> (length str) 5) 7 4)))
+
+(defun css--hex-alpha (hex)
+ "Return the alpha component of CSS color HEX.
+HEX can either be in the #RGBA or #RRGGBBAA format. Return nil
+if the color doesn't have an alpha component."
+ (cl-case (length hex)
+ (5 (string (elt hex 4)))
+ (9 (substring hex 7 9))))
(defun css--named-color (start-point str)
"Check whether STR, seen at point, is CSS named color.
@@ -1200,19 +1264,20 @@ for determining whether point is within a selector."
(defun css-smie-rules (kind token)
(pcase (cons kind token)
- (`(:elem . basic) css-indent-offset)
- (`(:elem . arg) 0)
- (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
- (`(:before . "{")
+ ('(:elem . basic) css-indent-offset)
+ ('(:elem . arg) 0)
+ ;; "" stands for BOB (bug#15467).
+ (`(:list-intro . ,(or ";" "" ":-property")) t)
+ ('(:before . "{")
(when (or (smie-rule-hanging-p) (smie-rule-bolp))
(smie-backward-sexp ";")
(unless (eq (char-after) ?\{)
(smie-indent-virtual))))
- (`(:before . "(")
+ ('(:before . "(")
(cond
((smie-rule-hanging-p) (smie-rule-parent 0))
((not (smie-rule-bolp)) 0)))
- (`(:after . ":-property")
+ ('(:after . ":-property")
(when (smie-rule-hanging-p)
css-indent-offset))))
@@ -1384,6 +1449,171 @@ tags, classes and IDs."
(progn (insert ": ;")
(forward-char -1))))))))))
+(defun css--color-to-4-dpc (hex)
+ "Convert the CSS color HEX to four digits per component.
+CSS colors use one or two digits per component for RGB hex
+values. Convert the given color to four digits per component.
+
+Note that this function handles CSS colors specifically, and
+should not be mixed with those in color.el."
+ (let ((six-digits (= (length hex) 7)))
+ (apply
+ #'concat
+ `("#"
+ ,@(seq-mapcat
+ (apply-partially #'make-list (if six-digits 2 4))
+ (seq-partition (seq-drop hex 1) (if six-digits 2 1)))))))
+
+(defun css--format-hex (hex)
+ "Format a CSS hex color by shortening it if possible."
+ (let ((parts (seq-partition (seq-drop hex 1) 2)))
+ (if (and (>= (length hex) 6)
+ (seq-every-p (lambda (p) (eq (elt p 0) (elt p 1))) parts))
+ (apply #'string
+ (cons ?# (mapcar (lambda (p) (elt p 0)) parts)))
+ hex)))
+
+(defun css--named-color-to-hex ()
+ "Convert named CSS color at point to hex format.
+Return non-nil if a conversion was made.
+
+Note that this function handles CSS colors specifically, and
+should not be mixed with those in color.el."
+ (save-excursion
+ (unless (or (looking-at css--colors-regexp)
+ (eq (char-before) ?#))
+ (backward-word))
+ (when (member (word-at-point) (mapcar #'car css--color-map))
+ (looking-at css--colors-regexp)
+ (let ((color (css--compute-color (point) (match-string 0))))
+ (replace-match (css--format-hex color)))
+ t)))
+
+(defun css--format-rgba-alpha (alpha)
+ "Return ALPHA component formatted for use in rgba()."
+ (let ((a (string-to-number (format "%.2f" alpha))))
+ (if (or (= a 0)
+ (= a 1))
+ (format "%d" a)
+ (string-remove-suffix "0" (number-to-string a)))))
+
+(defun css--hex-to-rgb ()
+ "Convert CSS hex color at point to RGB format.
+Return non-nil if a conversion was made.
+
+Note that this function handles CSS colors specifically, and
+should not be mixed with those in color.el."
+ (save-excursion
+ (unless (or (eq (char-after) ?#)
+ (eq (char-before) ?\())
+ (backward-sexp))
+ (when-let* ((hex (when (looking-at css--colors-regexp)
+ (and (eq (elt (match-string 0) 0) ?#)
+ (match-string 0))))
+ (rgb (css--hex-color hex)))
+ (seq-let (r g b)
+ (mapcar (lambda (x) (round (* x 255)))
+ (color-name-to-rgb (css--color-to-4-dpc rgb)))
+ (replace-match
+ (if-let* ((alpha (css--hex-alpha hex))
+ (a (css--format-rgba-alpha
+ (/ (string-to-number alpha 16)
+ (float (- (expt 16 (length alpha)) 1))))))
+ (format "rgba(%d, %d, %d, %s)" r g b a)
+ (format "rgb(%d, %d, %d)" r g b))
+ t))
+ t)))
+
+(defun css--rgb-to-named-color-or-hex ()
+ "Convert CSS RGB color at point to a named color or hex format.
+Convert to a named color if the color at point has a name, else
+convert to hex format. Return non-nil if a conversion was made.
+
+Note that this function handles CSS colors specifically, and
+should not be mixed with those in color.el."
+ (save-excursion
+ (when-let* ((open-paren-pos (nth 1 (syntax-ppss))))
+ (when (save-excursion
+ (goto-char open-paren-pos)
+ (looking-back "rgba?" (- (point) 4)))
+ (goto-char (nth 1 (syntax-ppss)))))
+ (when (eq (char-before) ?\))
+ (backward-sexp))
+ (skip-chars-backward "rgba")
+ (when (looking-at css--colors-regexp)
+ (let* ((start (match-end 0))
+ (color (save-excursion
+ (goto-char start)
+ (css--rgb-color t))))
+ (when color
+ (kill-sexp)
+ (kill-sexp)
+ (let ((named-color (seq-find (lambda (x) (equal (cdr x) color))
+ css--color-map)))
+ (insert (if named-color
+ (car named-color)
+ (css--format-hex color))))
+ t)))))
+
+(defun css-cycle-color-format ()
+ "Cycle the color at point between different CSS color formats.
+Supported formats are by name (if possible), hexadecimal, and
+rgb()/rgba()."
+ (interactive)
+ (or (css--named-color-to-hex)
+ (css--hex-to-rgb)
+ (css--rgb-to-named-color-or-hex)
+ (message "It doesn't look like a color at point")))
+
+(defun css--join-nested-selectors (selectors)
+ "Join a list of nested CSS selectors."
+ (let ((processed '())
+ (prev nil))
+ (dolist (sel selectors)
+ (cond
+ ((seq-contains-p sel ?&)
+ (setq sel (replace-regexp-in-string "&" prev sel))
+ (pop processed))
+ ;; Unless this is the first selector, separate this one and the
+ ;; previous one by a space.
+ (processed
+ (push " " processed)))
+ (push sel processed)
+ (setq prev sel))
+ (apply #'concat (nreverse processed))))
+
+(defun css--prev-index-position ()
+ (when (nth 7 (syntax-ppss))
+ (goto-char (comment-beginning)))
+ (forward-comment (- (point)))
+ (when (search-backward "{" (point-min) t)
+ (if (re-search-backward "}\\|;\\|{" (point-min) t)
+ (forward-char)
+ (goto-char (point-min)))
+ (forward-comment (point-max))
+ (save-excursion (re-search-forward "[^{;]*"))))
+
+(defun css--extract-index-name ()
+ (save-excursion
+ (let ((res (list (match-string-no-properties 0))))
+ (condition-case nil
+ (while t
+ (goto-char (nth 1 (syntax-ppss)))
+ (if (re-search-backward "}\\|;\\|{" (point-min) t)
+ (forward-char)
+ (goto-char (point-min)))
+ (forward-comment (point-max))
+ (when (save-excursion
+ (re-search-forward "[^{;]*"))
+ (push (match-string-no-properties 0) res)))
+ (error
+ (css--join-nested-selectors
+ (mapcar
+ (lambda (s)
+ (string-trim
+ (replace-regexp-in-string "[\n ]+" " " s)))
+ res)))))))
+
;;;###autoload
(define-derived-mode css-mode prog-mode "CSS"
"Major mode to edit Cascading Style Sheets (CSS).
@@ -1391,7 +1621,7 @@ tags, classes and IDs."
This mode provides syntax highlighting, indentation, completion,
and documentation lookup for CSS.
-Use `\\[complete-symbol]' to complete CSS properties, property values,
+Use `\\[completion-at-point]' to complete CSS properties, property values,
pseudo-elements, pseudo-classes, at-rules, bang-rules, and HTML
tags, classes and IDs. Completion candidates for HTML class
names and IDs are found by looking through open HTML mode
@@ -1422,7 +1652,13 @@ be used to fill comments.
(append css-electric-keys electric-indent-chars))
(setq-local font-lock-fontify-region-function #'css--fontify-region)
(add-hook 'completion-at-point-functions
- #'css-completion-at-point nil 'local))
+ #'css-completion-at-point nil 'local)
+ ;; The default "." creates ambiguity with class selectors.
+ (setq-local imenu-space-replacement " ")
+ (setq-local imenu-prev-index-position-function
+ #'css--prev-index-position)
+ (setq-local imenu-extract-index-name-function
+ #'css--extract-index-name))
(defvar comment-continue)
@@ -1519,12 +1755,8 @@ be used to fill comments.
(defun css-current-defun-name ()
"Return the name of the CSS section at point, or nil."
(save-excursion
- (let ((max (max (point-min) (- (point) 1600)))) ; approx 20 lines back
- (when (search-backward "{" max t)
- (skip-chars-backward " \t\r\n")
- (beginning-of-line)
- (if (looking-at "^[ \t]*\\([^{\r\n]*[^ {\t\r\n]\\)")
- (match-string-no-properties 1))))))
+ (when (css--prev-index-position)
+ (css--extract-index-name))))
;;; SCSS mode
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 5344d6127fe..06e944815a7 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -45,6 +45,8 @@
;;; Code:
+(eval-when-compile (require 'cl-lib))
+
(defgroup dns-mode nil
"DNS master file mode configuration."
:group 'data)
@@ -112,9 +114,9 @@
"26.1" 'set)
(defcustom dns-mode-font-lock-keywords
- `((,(concat "^$" (regexp-opt dns-mode-control-entities))
+ `((,(concat "^\\$" (regexp-opt dns-mode-control-entities))
0 ,dns-mode-control-entity-face)
- ("^$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
+ ("^\\$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
(,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face)
(,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
"Font lock keywords used to highlight text in DNS master file mode."
@@ -178,9 +180,8 @@ Turning on DNS mode runs `dns-mode-hook'."
(set (make-local-variable 'comment-start) ";")
(set (make-local-variable 'comment-end) "")
(set (make-local-variable 'comment-start-skip) ";+ *")
- (unless (featurep 'xemacs)
- (set (make-local-variable 'font-lock-defaults)
- '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))))
+ (set (make-local-variable 'font-lock-defaults)
+ '(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))
(add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
nil t)
(easy-menu-add dns-mode-menu dns-mode-map))
@@ -290,9 +291,9 @@ Examples:
(skip-syntax-backward " ")
(skip-syntax-backward "w_.")
(re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?")
- (kill-new (match-string 0))
(let ((address (match-string 1))
(prefix-length (match-string 2)))
+ (kill-new (match-string 0))
(when prefix-length
(setq prefix-length (string-to-number (substring prefix-length 1)))
(if negate-prefix
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index d4e2f788ee3..e89ffead9e8 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -120,9 +120,11 @@ expression, which is evaluated to get the string to insert.")
;; The following are not part of the standard:
(FUNCTION (enriched-decode-foreground "x-color")
(enriched-decode-background "x-bg-color")
- (enriched-decode-display-prop "x-display"))
+ (enriched-decode-display-prop "x-display")
+ (enriched-decode-charset "x-charset"))
(read-only (t "x-read-only"))
(display (nil enriched-handle-display-prop))
+ (charset (nil enriched-handle-charset-prop))
(unknown (nil format-annotate-value))
; (font-size (2 "bigger") ; unimplemented
; (-2 "smaller"))
@@ -208,10 +210,6 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
These are files with embedded formatting information in the MIME standard
text/enriched format.
-With a prefix argument ARG, enable the mode if ARG is positive,
-and disable it otherwise. If called from Lisp, enable the mode
-if ARG is omitted or nil.
-
Turning the mode on or off runs `enriched-mode-hook'.
More information about Enriched mode is available in the file
@@ -492,6 +490,21 @@ Return value is \(begin end name positive-p), or nil if none was found."
(list from to 'face (list ':background color))
(message "Warning: no color specified for <x-bg-color>")
nil))
+
+(defun enriched-decode-charset (from to &optional cset)
+ (let ((cs (when (stringp cset)
+ (condition-case ()
+ (car (read-from-string cset))
+ (error nil)))))
+ (unless cs
+ (message "Warning: invalid <x-charset> parameter %s" cset))
+ (list from to 'charset cs)))
+
+(defun enriched-handle-charset-prop (old new)
+ "Return a list of annotations for a change in the `charset' property."
+ (cons (and old (list (list "x-charset" (symbol-name old))))
+ (and new (list (list "x-charset" (symbol-name new))))))
+
;;; Handling the `display' property.
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index c5975bb721b..c285491a305 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -129,10 +129,11 @@ if it would act as a paragraph-starter on the second line."
:type 'regexp
:group 'fill)
-(defcustom adaptive-fill-function nil
- "Function to call to choose a fill prefix for a paragraph, or nil.
-A nil value means the function has not determined the fill prefix."
- :type '(choice (const nil) function)
+(defcustom adaptive-fill-function #'ignore
+ "Function to call to choose a fill prefix for a paragraph.
+A nil return value means the function has not determined the fill prefix."
+ :version "27.1"
+ :type 'function
:group 'fill)
(defvar fill-indent-according-to-mode nil ;Screws up CC-mode's filling tricks.
@@ -339,6 +340,18 @@ places."
(and (memq (preceding-char) '(?\t ?\s))
(eq (char-syntax (following-char)) ?w)))))))
+(defun fill-polish-nobreak-p ()
+ "Return nil if Polish style allows breaking the line at point.
+This function may be used in the `fill-nobreak-predicate' hook.
+It is almost the same as `fill-single-char-nobreak-p', with the
+exception that it does not require the one-letter word to be
+preceded by a space. This blocks line-breaking in cases like
+\"(a jednak)\"."
+ (save-excursion
+ (skip-chars-backward " \t")
+ (backward-char 2)
+ (looking-at "[^[:alpha:]]\\cl")))
+
(defun fill-single-char-nobreak-p ()
"Return non-nil if a one-letter word is before point.
This function is suitable for adding to the hook `fill-nobreak-predicate',
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 042f432d635..bfe912308e9 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -68,6 +68,12 @@ Detection of repeated words is not implemented in
:group 'flyspell
:type 'boolean)
+(defcustom flyspell-case-fold-duplications t
+ "Non-nil means Flyspell matches duplicate words case-insensitively."
+ :group 'flyspell
+ :type 'boolean
+ :version "27.1")
+
(defcustom flyspell-mark-duplications-exceptions
'((nil . ("that" "had")) ; Common defaults for English.
("\\`francais" . ("nous" "vous")))
@@ -324,14 +330,16 @@ If this variable is nil, all regions are treated as small."
;;* (lambda () (setq flyspell-generic-check-word-predicate */
;;* 'mail-mode-flyspell-verify))) */
;;*---------------------------------------------------------------------*/
+
+(define-obsolete-variable-alias 'flyspell-generic-check-word-p
+ 'flyspell-generic-check-word-predicate "25.1")
+
(defvar flyspell-generic-check-word-predicate nil
"Function providing per-mode customization over which words are flyspelled.
Returns t to continue checking, nil otherwise.
Flyspell mode sets this variable to whatever is the `flyspell-mode-predicate'
property of the major mode name.")
(make-variable-buffer-local 'flyspell-generic-check-word-predicate)
-(define-obsolete-variable-alias 'flyspell-generic-check-word-p
- 'flyspell-generic-check-word-predicate "25.1")
;;*--- mail mode -------------------------------------------------------*/
(put 'mail-mode 'flyspell-mode-predicate 'mail-mode-flyspell-verify)
@@ -415,9 +423,10 @@ like <img alt=\"Some thing.\">."
(defun flyspell-generic-progmode-verify ()
"Used for `flyspell-generic-check-word-predicate' in programming modes."
- ;; (point) is next char after the word. Must check one char before.
- (let ((f (get-text-property (- (point) 1) 'face)))
- (memq f flyspell-prog-text-faces)))
+ (unless (eql (point) (point-min))
+ ;; (point) is next char after the word. Must check one char before.
+ (let ((f (get-text-property (1- (point)) 'face)))
+ (memq f flyspell-prog-text-faces))))
;; Records the binding of M-TAB in effect before flyspell was activated.
(defvar flyspell--prev-meta-tab-binding)
@@ -506,9 +515,6 @@ See also `flyspell-duplicate-distance'."
;;;###autoload
(define-minor-mode flyspell-mode
"Toggle on-the-fly spell checking (Flyspell mode).
-With a prefix argument ARG, enable Flyspell mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Flyspell mode is a buffer-local minor mode. When enabled, it
spawns a single Ispell process and checks each word. The default
@@ -924,7 +930,7 @@ Mostly we check word delimiters."
(or (string= "" ispell-otherchars)
(not (looking-at ispell-otherchars)))
(or flyspell-consider-dash-as-word-delimiter-flag
- (not (looking-at "\\-")))
+ (not (looking-at "-")))
2)))))
(format " because : %S\n"
(cond
@@ -942,7 +948,7 @@ Mostly we check word delimiters."
(or (string= "" ispell-otherchars)
(not (looking-at ispell-otherchars)))
(or flyspell-consider-dash-as-word-delimiter-flag
- (not (looking-at "\\-")))))))
+ (not (looking-at "-")))))))
;; Yes because we have reached or typed a word delimiter.
'separator)
((not (integerp flyspell-delay))
@@ -985,6 +991,11 @@ Mostly we check word delimiters."
(let ((command this-command)
;; Prevent anything we do from affecting the mark.
deactivate-mark)
+ (if (and (eq command 'transpose-chars)
+ flyspell-pre-point)
+ (save-excursion
+ (goto-char (- flyspell-pre-point 1))
+ (flyspell-word)))
(if (flyspell-check-pre-word-p)
(save-excursion
'(flyspell-debug-signal-pre-word-checked)
@@ -1150,7 +1161,8 @@ spell-check."
(- (save-excursion
(skip-chars-backward " \t\n\f")))))
(p (when (>= bound (point-min))
- (flyspell-word-search-backward word bound t))))
+ (flyspell-word-search-backward
+ word bound flyspell-case-fold-duplications))))
(and p (/= p start)))))
;; yes, this is a doublon
(flyspell-highlight-incorrect-region start end 'doublon)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 237997d41d7..9dfa9f3c448 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2,7 +2,7 @@
;; Copyright (C) 1994-1995, 1997-2019 Free Software Foundation, Inc.
-;; Author: Ken Stevens <k.stevens@ieee.org>
+;; Author: Ken Stevens <k.stevens@ieee.org>
;; This file is part of GNU Emacs.
@@ -320,18 +320,21 @@ The following values are supported:
:type 'boolean
:group 'ispell)
+(defvaralias 'ispell-format-word 'ispell-format-word-function)
+
(defcustom ispell-format-word-function (function upcase)
"Formatting function for displaying word being spell checked.
The function must take one string argument and return a string."
:type 'function
:group 'ispell)
-(defvaralias 'ispell-format-word 'ispell-format-word-function)
+;; FIXME framepop.el last updated c 2003 (?),
+;; probably something else replaces it these days.
(defcustom ispell-use-framepop-p nil
"When non-nil ispell uses framepop to display choices in a dedicated frame.
You can set this variable to dynamically use framepop if you are in a
window system by evaluating the following on startup to set this variable:
- (and window-system (condition-case () (require \\='framepop) (error nil)))"
+ (and (display-graphic-p) (require \\='framepop nil t))"
:type 'boolean
:group 'ispell)
@@ -815,16 +818,6 @@ See `ispell-buffer-with-debug' for an example of use."
;; because otherwise this file gets autoloaded every time Emacs starts
;; so that it can set up the menus and determine keyboard equivalents.
-;;;###autoload
-(defvar ispell-menu-map nil "Key map for ispell menu.")
-;; Redo menu when loading ispell to get dictionary modifications
-(setq ispell-menu-map nil)
-
-;;; Set up dictionary
-;;;###autoload
-(defvar ispell-menu-map-needed
- (unless ispell-menu-map 'reload))
-
(defvar ispell-library-directory (condition-case ()
(ispell-check-version)
(error nil))
@@ -1193,6 +1186,12 @@ dictionary from that list was found."
;; Parse and set values for default dictionary.
(setq hunspell-default-dict (or hunspell-multi-dict
(car hunspell-default-dict)))
+ ;; If hunspell-default-dict is nil, ispell-parse-hunspell-affix-file
+ ;; will barf with an error message that doesn't help users figure
+ ;; out what is wrong. Produce an error message that points to the
+ ;; root cause of the problem.
+ (or hunspell-default-dict
+ (error "Can't find Hunspell dictionary with a .aff affix file"))
(setq hunspell-default-dict-entry
(ispell-parse-hunspell-affix-file hunspell-default-dict))
;; Create an alist of found dicts with only names, except for default dict.
@@ -1215,9 +1214,11 @@ Internal use.")
(with-output-to-string
(with-current-buffer
standard-output
- (apply 'ispell-call-process
- (replace-regexp-in-string "enchant\\(-[0-9]\\)?$" "enchant-lsmod\\1"
- ispell-program-name) nil t nil args))))
+ (apply #'ispell-call-process
+ (replace-regexp-in-string "enchant\\(-[0-9]\\)?\\'"
+ "enchant-lsmod\\1"
+ ispell-program-name)
+ nil t nil args))))
(defun ispell--get-extra-word-characters (&optional lang)
"Get the extra word characters for LANG as a character class.
@@ -1272,7 +1273,6 @@ aspell is used along with Emacs).")
(defun ispell-set-spellchecker-params ()
"Initialize some spellchecker parameters when changed or first used."
(unless (eq ispell-last-program-name ispell-program-name)
- (setq ispell-last-program-name ispell-program-name)
(ispell-kill-ispell t)
(if (and (condition-case ()
(progn
@@ -1387,7 +1387,8 @@ aspell is used along with Emacs).")
(nth 7 adict)))
adict)
tmp-dicts-alist :test #'equal))
- (setq ispell-dictionary-alist tmp-dicts-alist))))
+ (setq ispell-dictionary-alist tmp-dicts-alist)))
+ (setq ispell-last-program-name ispell-program-name))
(defun ispell-valid-dictionary-list ()
"Return a list of valid dictionaries.
@@ -1425,80 +1426,78 @@ The variable `ispell-library-directory' defines their location."
(push name dict-list)))
dict-list))
-;; Define commands in menu in opposite order you want them to appear.
;;;###autoload
-(if ispell-menu-map-needed
- (progn
- (setq ispell-menu-map (make-sparse-keymap "Spell"))
- (define-key ispell-menu-map [ispell-change-dictionary]
- `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary
- :help ,(purecopy "Supply explicit dictionary file name")))
- (define-key ispell-menu-map [ispell-kill-ispell]
- `(menu-item ,(purecopy "Kill Process")
- (lambda () (interactive) (ispell-kill-ispell nil 'clear))
- :enable (and (boundp 'ispell-process) ispell-process
- (eq (ispell-process-status) 'run))
- :help ,(purecopy "Terminate Ispell subprocess")))
- (define-key ispell-menu-map [ispell-pdict-save]
- `(menu-item ,(purecopy "Save Dictionary")
- (lambda () (interactive) (ispell-pdict-save t t))
- :help ,(purecopy "Save personal dictionary")))
- (define-key ispell-menu-map [ispell-customize]
- `(menu-item ,(purecopy "Customize...")
- (lambda () (interactive) (customize-group 'ispell))
- :help ,(purecopy "Customize spell checking options")))
- (define-key ispell-menu-map [ispell-help]
- ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ?
- `(menu-item ,(purecopy "Help")
- (lambda () (interactive) (describe-function 'ispell-help))
- :help ,(purecopy "Show standard Ispell keybindings and commands")))
- (define-key ispell-menu-map [flyspell-mode]
- `(menu-item ,(purecopy "Automatic spell checking (Flyspell)")
- flyspell-mode
- :help ,(purecopy "Check spelling while you edit the text")
- :button (:toggle . (bound-and-true-p flyspell-mode))))
- (define-key ispell-menu-map [ispell-complete-word]
- `(menu-item ,(purecopy "Complete Word") ispell-complete-word
- :help ,(purecopy "Complete word at cursor using dictionary")))
- (define-key ispell-menu-map [ispell-complete-word-interior-frag]
- `(menu-item ,(purecopy "Complete Word Fragment")
- ispell-complete-word-interior-frag
- :help ,(purecopy "Complete word fragment at cursor")))))
-
-;;;###autoload
-(if ispell-menu-map-needed
- (progn
- (define-key ispell-menu-map [ispell-continue]
- `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue
- :enable (and (boundp 'ispell-region-end)
- (marker-position ispell-region-end)
- (equal (marker-buffer ispell-region-end)
- (current-buffer)))
- :help ,(purecopy "Continue spell checking last region")))
- (define-key ispell-menu-map [ispell-word]
- `(menu-item ,(purecopy "Spell-Check Word") ispell-word
- :help ,(purecopy "Spell-check word at cursor")))
- (define-key ispell-menu-map [ispell-comments-and-strings]
- `(menu-item ,(purecopy "Spell-Check Comments")
- ispell-comments-and-strings
- :help ,(purecopy "Spell-check only comments and strings")))))
-
+(defconst ispell-menu-map
+ ;; Use `defconst' so as to redo the menu when loading ispell, like the
+ ;; previous code did.
+
+ ;; Define commands in menu in opposite order you want them to appear.
+ (let ((map (make-sparse-keymap "Spell")))
+ (define-key map [ispell-change-dictionary]
+ `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary
+ :help ,(purecopy "Supply explicit dictionary file name")))
+ (define-key map [ispell-kill-ispell]
+ `(menu-item ,(purecopy "Kill Process")
+ (lambda () (interactive) (ispell-kill-ispell nil 'clear))
+ :enable (and (boundp 'ispell-process) ispell-process
+ (eq (ispell-process-status) 'run))
+ :help ,(purecopy "Terminate Ispell subprocess")))
+ (define-key map [ispell-pdict-save]
+ `(menu-item ,(purecopy "Save Dictionary")
+ (lambda () (interactive) (ispell-pdict-save t t))
+ :help ,(purecopy "Save personal dictionary")))
+ (define-key map [ispell-customize]
+ `(menu-item ,(purecopy "Customize...")
+ (lambda () (interactive) (customize-group 'ispell))
+ :help ,(purecopy "Customize spell checking options")))
+ (define-key map [ispell-help]
+ ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ?
+ `(menu-item ,(purecopy "Help")
+ (lambda () (interactive) (describe-function 'ispell-help))
+ :help ,(purecopy "Show standard Ispell keybindings and commands")))
+ (define-key map [flyspell-mode]
+ `(menu-item ,(purecopy "Automatic spell checking (Flyspell)")
+ flyspell-mode
+ :help ,(purecopy "Check spelling while you edit the text")
+ :button (:toggle . (bound-and-true-p flyspell-mode))))
+ (define-key map [ispell-complete-word]
+ `(menu-item ,(purecopy "Complete Word") ispell-complete-word
+ :help ,(purecopy "Complete word at cursor using dictionary")))
+ (define-key map [ispell-complete-word-interior-frag]
+ `(menu-item ,(purecopy "Complete Word Fragment")
+ ispell-complete-word-interior-frag
+ :help ,(purecopy "Complete word fragment at cursor")))
+
+ (define-key map [ispell-continue]
+ `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue
+ :enable (and (boundp 'ispell-region-end)
+ (marker-position ispell-region-end)
+ (equal (marker-buffer ispell-region-end)
+ (current-buffer)))
+ :help ,(purecopy "Continue spell checking last region")))
+ (define-key map [ispell-word]
+ `(menu-item ,(purecopy "Spell-Check Word") ispell-word
+ :help ,(purecopy "Spell-check word at cursor")))
+ (define-key map [ispell-comments-and-strings]
+ `(menu-item ,(purecopy "Spell-Check Comments")
+ ispell-comments-and-strings
+ :help ,(purecopy "Spell-check only comments and strings")))
+
+ (define-key map [ispell-region]
+ `(menu-item ,(purecopy "Spell-Check Region") ispell-region
+ :enable mark-active
+ :help ,(purecopy "Spell-check text in marked region")))
+ (define-key map [ispell-message]
+ `(menu-item ,(purecopy "Spell-Check Message") ispell-message
+ :visible (eq major-mode 'mail-mode)
+ :help ,(purecopy "Skip headers and included message text")))
+ (define-key map [ispell-buffer]
+ `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer
+ :help ,(purecopy "Check spelling of selected buffer")))
+ map)
+ "Key map for ispell menu.")
;;;###autoload
-(if ispell-menu-map-needed
- (progn
- (define-key ispell-menu-map [ispell-region]
- `(menu-item ,(purecopy "Spell-Check Region") ispell-region
- :enable mark-active
- :help ,(purecopy "Spell-check text in marked region")))
- (define-key ispell-menu-map [ispell-message]
- `(menu-item ,(purecopy "Spell-Check Message") ispell-message
- :visible (eq major-mode 'mail-mode)
- :help ,(purecopy "Skip headers and included message text")))
- (define-key ispell-menu-map [ispell-buffer]
- `(menu-item ,(purecopy "Spell-Check Buffer") ispell-buffer
- :help ,(purecopy "Check spelling of selected buffer")))
- (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))
-
+(fset 'ispell-menu-map (symbol-value 'ispell-menu-map))
;;; **********************************************************************
@@ -1791,11 +1790,15 @@ You can set this variable in hooks in your init file -- eg:
(defun ispell-accept-output (&optional timeout-secs timeout-msecs)
- "Wait for output from Ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
+ "Wait for output from Ispell process, or for TIMEOUT-SECS + TIMEOUT-MSECS.
+\(The TIMEOUT-MSECS argument is obsolete and should be avoided.)
If asynchronous subprocesses are not supported, call function `ispell-filter'
and pass it the output of the last Ispell invocation."
(if ispell-async-processp
- (accept-process-output ispell-process timeout-secs timeout-msecs)
+ (let ((timeout (if timeout-msecs
+ (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+ timeout-secs)))
+ (accept-process-output ispell-process timeout))
(if (null ispell-process)
(error "No Ispell process to read output from!")
(let ((buf ispell-output-buffer)
@@ -1840,11 +1843,9 @@ Only works for Aspell and Enchant."
(setq default-directory defdir)
(insert string)
(if (not (memq cmd cmds-to-defer))
- (let (coding-system-for-read coding-system-for-write status)
- (if (and (boundp 'enable-multibyte-characters)
- enable-multibyte-characters)
- (setq coding-system-for-read (ispell-get-coding-system)
- coding-system-for-write (ispell-get-coding-system)))
+ (let* ((coding-system-for-read (ispell-get-coding-system))
+ (coding-system-for-write coding-system-for-read)
+ status)
(set-buffer output-buf)
(erase-buffer)
(set-buffer session-buf)
@@ -2972,6 +2973,9 @@ With CLEAR, buffer session localwords are cleaned."
(message "Ispell process killed")
nil))
+(defvar ispell-change-dictionary-hook nil
+ "Hook run after changing dictionary.")
+
;; ispell-change-dictionary is set in some people's hooks. Maybe this should
;; call ispell-init-process rather than wait for a spell checking command?
@@ -2997,7 +3001,8 @@ By just answering RET you can find out what the current dictionary is."
(ispell-internal-change-dictionary)
(message "Using %s dictionary"
(or (and (not arg) ispell-local-dictionary)
- ispell-dictionary "default")))
+ ispell-dictionary "default"))
+ (run-hooks 'ispell-change-dictionary-hook))
((equal dict (or (and (not arg) ispell-local-dictionary)
ispell-dictionary "default"))
;; Specified dictionary is the default already. Could reload
@@ -3019,7 +3024,8 @@ By just answering RET you can find out what the current dictionary is."
(setq ispell-buffer-session-localwords nil)
(message "%s Ispell dictionary set to %s"
(if arg "Global" "Local")
- dict))))
+ dict)
+ (run-hooks 'ispell-change-dictionary-hook))))
(defun ispell-internal-change-dictionary ()
"Update the dictionary and the personal dictionary used by Ispell.
@@ -3474,7 +3480,7 @@ Returns the sum SHIFT due to changes in word replacements."
;; Error in tex mode when a potential math mode change exists.
(if (and replace (listp replace) (= 2 (length replace)))
(if (and (eq ispell-parser 'tex)
- (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$"
+ (string-match "[\\][]()[]\\|\\\\begin\\|\\$"
(regexp-quote string)))
(error
"Don't start query replace on a line with math characters"
@@ -3718,9 +3724,6 @@ available on the net."
;;;###autoload
(define-minor-mode ispell-minor-mode
"Toggle last-word spell checking (Ispell minor mode).
-With a prefix argument ARG, enable Ispell minor mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Ispell minor mode is a buffer-local minor mode. When enabled,
typing SPC or RET warns you if the previous word is incorrectly
@@ -4018,7 +4021,7 @@ You can bind this to the key C-c i in GNUS or mail by adding to
(defun ispell-non-empty-string (string)
(if (or (not string) (string-equal string ""))
- "\\'\\`" ; An unmatchable string if string is null.
+ regexp-unmatchable
(regexp-quote string)))
diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el
index b4c7f28985d..4077789eb12 100644
--- a/lisp/textmodes/less-css-mode.el
+++ b/lisp/textmodes/less-css-mode.el
@@ -194,10 +194,10 @@ directory by default."
;; - custom faces.
(defconst less-css-font-lock-keywords
'(;; Variables
- ("@[a-z_-][a-z-_0-9]*" . font-lock-variable-name-face)
+ ("@[a-z_-][a-z_0-9-]*" . font-lock-variable-name-face)
("&" . font-lock-preprocessor-face)
;; Mixins
- ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" .
+ ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z_0-9-]*\\)[ \t]*;" .
(1 font-lock-keyword-face))))
(defvar less-css-mode-syntax-table
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 17298ccf5f7..7de24c783f0 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -21,7 +21,9 @@
;;; Code:
-(eval-and-compile (require 'sgml-mode))
+(eval-and-compile
+ (require 'cl-lib)
+ (require 'sgml-mode))
(require 'js)
(require 'css-mode)
(require 'prog-mode)
@@ -363,7 +365,6 @@ Code inside a <script> element is indented using the rules from
`js-mode'; and code inside a <style> element is indented using
the rules from `css-mode'."
(setq-local indent-line-function #'mhtml-indent-line)
- (setq-local parse-sexp-lookup-properties t)
(setq-local syntax-propertize-function #'mhtml-syntax-propertize)
(setq-local font-lock-fontify-region-function
#'mhtml--submode-fontify-region)
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index e5cc39d54f6..f33d4df4d19 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -298,9 +298,6 @@ automatically inserts the matching closing request after point."
(define-minor-mode nroff-electric-mode
"Toggle automatic nroff request pairing (Nroff Electric mode).
-With a prefix argument ARG, enable Nroff Electric mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Nroff Electric mode is a buffer-local minor mode, for use with
`nroff-mode'. When enabled, Emacs checks for an nroff request at
@@ -328,13 +325,6 @@ otherwise off."
(kill-buffer viewbuf))
(Man-getpage-in-background file)))
-;; Old names that were not namespace clean.
-(define-obsolete-function-alias 'count-text-lines 'nroff-count-text-lines "22.1")
-(define-obsolete-function-alias 'forward-text-line 'nroff-forward-text-line "22.1")
-(define-obsolete-function-alias 'backward-text-line 'nroff-backward-text-line "22.1")
-(define-obsolete-function-alias 'electric-nroff-newline 'nroff-electric-newline "22.1")
-(define-obsolete-function-alias 'electric-nroff-mode 'nroff-electric-mode "22.1")
-
(provide 'nroff-mode)
;;; nroff-mode.el ends here
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index a9199fffe0d..582b2625b3c 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -1,4 +1,4 @@
-;;; page-ext.el --- extended page handling commands
+;;; page-ext.el --- extended page handling commands -*- lexical-binding:t -*-
;; Copyright (C) 1990-1991, 1993-1994, 2001-2019 Free Software
;; Foundation, Inc.
@@ -47,12 +47,12 @@
;; New page handling commands:
-;; next-page C-x C-p C-n
-;; previous-page C-x C-p C-p
-;; search-pages C-x C-p C-s
-;; add-new-page C-x C-p C-a
-;; sort-pages-buffer C-x C-p s
-;; set-page-delimiter C-x C-p C-l
+;; pages-next-page C-x C-p C-n
+;; pages-previous-page C-x C-p C-p
+;; pages-search C-x C-p C-s
+;; pages-add-new-page C-x C-p C-a
+;; pages-sort-buffer C-x C-p s
+;; pages-set-delimiter C-x C-p C-l
;; pages-directory C-x C-p C-d
;; pages-directory-for-addresses C-x C-p d
;; pages-directory-goto C-c C-c
@@ -156,11 +156,11 @@
;; George Lakoff
;; OBI (On line text collection.)
-;; The `C-x C-p s' (sort-pages-buffer) command sorts the entries in the
+;; The `C-x C-p s' (pages-sort-buffer) command sorts the entries in the
;; buffer alphabetically.
-;; You may use any of the page commands, including the `next-page',
-;; `previous-page', `add-new-page', `mark-page', and `search-pages'
+;; You may use any of the page commands, including the `pages-next-page',
+;; `pages-previous-page', `pages-add-new-page', `mark-page', and `pages-search'
;; commands.
;; You may use either the `C-x C-p d' (pages-directory-for-addresses)
@@ -171,7 +171,7 @@
;; and type `C-c C-c' (pages-directory-goto) to go to the entry to
;; which it refers in the pages buffer.
-;; You can type `C-c C-p C-a' (add-new-page) to add a new entry in the
+;; You can type `C-c C-p C-a' (pages-add-new-page) to add a new entry in the
;; pages buffer or address file. This is the same command you use to
;; add a new entry when you are in the pages buffer or address file.
@@ -243,18 +243,15 @@
(defcustom pages-directory-buffer-narrowing-p t
"If non-nil, `pages-directory-goto' narrows pages buffer to entry."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
(defcustom pages-directory-for-adding-page-narrowing-p t
"If non-nil, `add-new-page' narrows page buffer to new entry."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
(defcustom pages-directory-for-adding-new-page-before-current-page-p t
"If non-nil, `add-new-page' inserts new page before current page."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
;;; Addresses related variables
@@ -262,83 +259,86 @@
(defcustom pages-addresses-file-name "~/addresses"
"Standard name for file of addresses. Entries separated by page-delimiter.
Used by `pages-directory-for-addresses' function."
- :type 'file
- :group 'pages)
+ :type 'file)
(defcustom pages-directory-for-addresses-goto-narrowing-p t
"If non-nil, `pages-directory-goto' narrows addresses buffer to entry."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
(defcustom pages-directory-for-addresses-buffer-keep-windows-p t
"If nil, `pages-directory-for-addresses' deletes other windows."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
(defcustom pages-directory-for-adding-addresses-narrowing-p t
"If non-nil, `add-new-page' narrows addresses buffer to new entry."
- :type 'boolean
- :group 'pages)
+ :type 'boolean)
;;; Key bindings for page handling functions
-(global-unset-key "\C-x\C-p")
-
-(defvar ctl-x-ctl-p-map (make-sparse-keymap)
+(defvar pages--ctl-x-ctl-p-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-n" #'pages-next-page)
+ (define-key map "\C-p" #'pages-previous-page)
+ (define-key map "\C-a" #'pages-add-new-page)
+ (define-key map "\C-m" #'mark-page)
+ (define-key map "\C-s" #'pages-search)
+ (define-key map "s" #'pages-sort-buffer)
+ (define-key map "\C-l" #'pages-set-delimiter)
+ (define-key map "\C-d" #'pages-directory)
+ (define-key map "d" #'pages-directory-for-addresses)
+ map)
"Keymap for subcommands of C-x C-p, which are for page handling.")
-(define-key ctl-x-map "\C-p" 'ctl-x-ctl-p-prefix)
-(fset 'ctl-x-ctl-p-prefix ctl-x-ctl-p-map)
-
-(define-key ctl-x-ctl-p-map "\C-n" 'next-page)
-(define-key ctl-x-ctl-p-map "\C-p" 'previous-page)
-(define-key ctl-x-ctl-p-map "\C-a" 'add-new-page)
-(define-key ctl-x-ctl-p-map "\C-m" 'mark-page)
-(define-key ctl-x-ctl-p-map "\C-s" 'search-pages)
-(define-key ctl-x-ctl-p-map "s" 'sort-pages-buffer)
-(define-key ctl-x-ctl-p-map "\C-l" 'set-page-delimiter)
-(define-key ctl-x-ctl-p-map "\C-d" 'pages-directory)
-(define-key ctl-x-ctl-p-map "d" 'pages-directory-for-addresses)
+;; FIXME: Merely loading a package shouldn't have this kind of side-effects!
+(global-unset-key "\C-x\C-p")
+(define-key ctl-x-map "\C-p" #'pages-ctl-x-ctl-p-prefix)
+(define-obsolete-function-alias 'ctl-x-ctl-p-prefix 'pages-ctl-x-ctl-p-prefix "27.1")
+(defalias 'pages-ctl-x-ctl-p-prefix pages--ctl-x-ctl-p-map)
;;; Page movement function definitions
-(defun next-page (&optional count)
+(define-obsolete-function-alias 'next-page #'pages-next-page "27.1")
+(defun pages-next-page (&optional count)
"Move to the next page bounded by the `page-delimiter' variable.
With arg (prefix if interactive), move that many pages."
(interactive "p")
(or count (setq count 1))
(widen)
;; Cannot use forward-page because of problems at page boundaries.
- (while (and (> count 0) (not (eobp)))
- (if (re-search-forward page-delimiter nil t)
- nil
- (goto-char (point-max)))
- (setq count (1- count)))
- ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries.
- ;; The first page boundary we reach is the top of the current page,
- ;; which doesn't count.
- (while (and (< count 1) (not (bobp)))
- (if (re-search-backward page-delimiter nil t)
- (goto-char (match-beginning 0))
- (goto-char (point-min)))
- (setq count (1+ count)))
+ (if (>= count 0)
+ (while (and (> count 0) (not (eobp)))
+ (if (re-search-forward page-delimiter nil t)
+ nil
+ (goto-char (point-max)))
+ (setq count (1- count)))
+ ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries.
+ ;; The first page boundary we reach is the top of the current page,
+ ;; which doesn't count.
+ (while (and (< count 1) (not (bobp)))
+ (if (re-search-backward page-delimiter nil t)
+ (when (= count 0)
+ (goto-char (match-end 0)))
+ (goto-char (point-min)))
+ (setq count (1+ count))))
(narrow-to-page)
(goto-char (point-min))
(recenter 0))
-(defun previous-page (&optional count)
+(define-obsolete-function-alias 'previous-page #'pages-previous-page "27.1")
+(defun pages-previous-page (&optional count)
"Move to the previous page bounded by the `page-delimiter' variable.
With arg (prefix if interactive), move that many pages."
(interactive "p")
(or count (setq count 1))
- (next-page (- count)))
+ (pages-next-page (- count)))
;;; Adding and searching pages
-(defun add-new-page (header-line)
+(define-obsolete-function-alias 'add-new-page #'pages-add-new-page "27.1")
+(defun pages-add-new-page (header-line)
"Insert new page. Prompt for header line.
If point is in the pages directory buffer, insert the new page in the
@@ -391,7 +391,8 @@ Point is left in the body of page."
(defvar pages-last-search nil
"Value of last regexp searched for. Initially, nil.")
-(defun search-pages (regexp)
+(define-obsolete-function-alias 'search-pages #'pages-search "27.1")
+(defun pages-search (regexp)
"Search for REGEXP, starting from point, and narrow to page it is in."
(interactive (list
(read-string
@@ -407,17 +408,16 @@ Point is left in the body of page."
;;; Sorting pages
-(autoload 'sort-subr "sort" "Primary function for sorting." t nil)
-
-(defun sort-pages-in-region (reverse beg end)
+(define-obsolete-function-alias 'sort-pages-in-region #'pages-sort-region "27.1")
+(defun pages-sort-region (reverse beg end)
"Sort pages in region alphabetically. Prefix arg means reverse order.
Called from a program, there are three arguments:
REVERSE (non-nil means reverse order), BEG and END (region to sort)."
-;;; This sort function handles ends of pages differently than
-;;; `sort-pages' and works better with lists of addresses and similar
-;;; files.
+ ;; This sort function handles ends of pages differently than
+ ;; `sort-pages' and works better with lists of addresses and similar
+ ;; files.
(interactive "P\nr")
(save-restriction
@@ -444,7 +444,8 @@ REVERSE (non-nil means reverse order), BEG and END (region to sort)."
(goto-char (match-beginning 0))
(goto-char (point-max))))))))
-(defun sort-pages-buffer (&optional reverse)
+(define-obsolete-function-alias 'sort-pages-buffer #'pages-sort-buffer "27.1")
+(defun pages-sort-buffer (&optional reverse)
"Sort pages alphabetically in buffer. Prefix arg means reverse order.
\(Non-nil arg if not interactive.)"
@@ -453,7 +454,7 @@ REVERSE (non-nil means reverse order), BEG and END (region to sort)."
(widen)
(let ((beginning (point-min))
(end (point-max)))
- (sort-pages-in-region reverse beginning end)))
+ (pages-sort-region reverse beginning end)))
;;; Pages directory ancillary definitions
@@ -463,30 +464,33 @@ REVERSE (non-nil means reverse order), BEG and END (region to sort)."
\(This regular expression may be used to select only those pages that
contain matches to the regexp.)")
-(defvar pages-buffer nil
+(defvar-local pages-buffer nil
"The buffer for which the pages-directory function creates the directory.")
(defvar pages-directory-prefix "*Directory for:"
"Prefix of name of temporary buffer for pages-directory.")
-(defvar pages-pos-list nil
+(defvar-local pages-pos-list nil
"List containing the positions of the pages in the pages-buffer.")
(defvar pages-target-buffer)
+(define-obsolete-variable-alias 'pages-directory-map
+ 'pages-directory-mode-map "26.1")
(defvar pages-directory-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-c" 'pages-directory-goto)
- (define-key map "\C-c\C-p\C-a" 'add-new-page)
- (define-key map [mouse-2] 'pages-directory-goto-with-mouse)
+ (define-key map "\C-c\C-c" #'pages-directory-goto)
+ (define-key map "\C-m" #'pages-directory-goto)
+ (define-key map "\C-c\C-p\C-a" #'pages-add-new-page)
+ (define-key map [mouse-2] #'pages-directory-goto)
map)
"Keymap for the pages-directory-buffer.")
-(defvaralias 'pages-directory-map 'pages-directory-mode-map)
-(defvar original-page-delimiter "^\f"
+(defvar pages-original-delimiter "^\f"
"Default page delimiter.")
-(defun set-page-delimiter (regexp reset-p)
+(define-obsolete-function-alias 'set-page-delimiter #'pages-set-delimiter "27.1")
+(defun pages-set-delimiter (regexp reset-p &optional interactively)
"Set buffer local value of page-delimiter to REGEXP.
Called interactively with a prefix argument, reset `page-delimiter' to
its original value.
@@ -496,22 +500,22 @@ resets the page-delimiter to the original value."
(interactive
(if current-prefix-arg
- (list original-page-delimiter "^\f")
- (list (read-string "Set page-delimiter to regexp: " page-delimiter)
- nil)))
- (make-local-variable 'original-page-delimiter)
- (make-local-variable 'page-delimiter)
- (setq original-page-delimiter
- (or original-page-delimiter page-delimiter))
- (if (not reset-p)
- (setq page-delimiter regexp)
- (setq page-delimiter original-page-delimiter))
- (if (called-interactively-p 'interactive)
+ (list pages-original-delimiter t t)
+ (list (read-regexp "Set page-delimiter to regexp: " page-delimiter)
+ nil t)))
+ (setq-local pages-original-delimiter
+ (or pages-original-delimiter page-delimiter))
+ (setq-local page-delimiter
+ (if (not reset-p) regexp pages-original-delimiter))
+ (if interactively
(message "The value of `page-delimiter' is now: %s" page-delimiter)))
;;; Pages directory main definitions
+(defvar pages-buffer-original-position)
+(defvar pages-buffer-original-page)
+
(defun pages-directory
(pages-list-all-headers-p count-lines-p &optional regexp)
"Display a directory of the page headers in a temporary buffer.
@@ -573,7 +577,6 @@ directory for only the accessible portion of the buffer."
(let ((pages-target-buffer (current-buffer))
(pages-directory-buffer
(concat pages-directory-prefix " " (buffer-name)))
- (linenum 1)
(pages-buffer-original-position (point))
(pages-buffer-original-page 0))
@@ -644,10 +647,6 @@ directory for only the accessible portion of the buffer."
1
pages-buffer-original-page))))
-(defvar pages-buffer-original-position)
-(defvar pages-buffer-original-page)
-(defvar pages-buffer-original-page)
-
(defun pages-copy-header-and-position (count-lines-p)
"Copy page header and its position to the Pages Directory.
Only arg non-nil, count lines in page and insert before header.
@@ -701,16 +700,13 @@ Used by `pages-directory' function."
Move point to one of the lines in this buffer, then use \\[pages-directory-goto] to go
to the same line in the pages buffer."
- (make-local-variable 'pages-buffer)
- (make-local-variable 'pages-pos-list)
- (make-local-variable 'pages-directory-buffer-narrowing-p))
+ )
-(defun pages-directory-goto ()
+(defun pages-directory-goto (&optional event)
"Go to the corresponding line in the pages buffer."
-
-;;; This function is mostly a copy of `occur-mode-goto-occurrence'
-
- (interactive)
+ ;; This function is mostly a copy of `occur-mode-goto-occurrence'
+ (interactive (list last-nonmenu-event))
+ (if event (mouse-set-point event))
(if (or (not pages-buffer)
(not (buffer-name pages-buffer)))
(progn
@@ -724,18 +720,13 @@ to the same line in the pages buffer."
(narrowing-p pages-directory-buffer-narrowing-p))
(pop-to-buffer pages-buffer)
(widen)
- (if end-of-directory-p
- (goto-char (point-max))
- (goto-char (marker-position pos)))
+ (goto-char (if end-of-directory-p
+ (point-max)
+ (marker-position pos)))
(if narrowing-p (narrow-to-page))))
-(defun pages-directory-goto-with-mouse (event)
- "Go to the corresponding line under the mouse pointer in the pages buffer."
- (interactive "e")
- (with-current-buffer (window-buffer (posn-window (event-end event)))
- (save-excursion
- (goto-char (posn-point (event-end event)))
- (pages-directory-goto))))
+(define-obsolete-function-alias 'pages-directory-goto-with-mouse
+ #'pages-directory-goto "26.1")
;;; The `pages-directory-for-addresses' function and ancillary code
@@ -774,8 +765,8 @@ directory."
;; by RJC, 2006 Jun 11: including this causes failure; it results in
;; the message "Buffer in which pages were found is deleted"
;; (pages-directory-address-mode)
- (setq pages-directory-buffer-narrowing-p
- pages-directory-for-addresses-goto-narrowing-p)
+ (setq-local pages-directory-buffer-narrowing-p
+ pages-directory-for-addresses-goto-narrowing-p)
(or pages-directory-for-addresses-buffer-keep-windows-p
(delete-other-windows))
(save-excursion
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 220ef2d7fd6..a42fc6e0538 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -1,4 +1,4 @@
-;;; page.el --- page motion commands for Emacs
+;;; page.el --- page motion commands for Emacs -*- lexical-binding: t; -*-
;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
@@ -38,8 +38,7 @@ A page boundary is any line whose beginning matches the regexp
;; In case the page-delimiter matches the null string,
;; don't find a match without moving.
(if (bolp) (forward-char 1))
- (if (re-search-forward page-delimiter nil t)
- nil
+ (unless (re-search-forward page-delimiter nil t)
(goto-char (point-max)))
(setq count (1- count)))
(while (and (< count 0) (not (bobp)))
@@ -126,39 +125,50 @@ thus showing a page other than the one point was originally in."
(point)))))
(put 'narrow-to-page 'disabled t)
-(defun count-lines-page ()
- "Report number of lines on current page, and how many are before or after point."
- (interactive)
+(defun page--count-lines-page ()
+ "Return a list of line counts on the current page.
+The list is on the form (TOTAL BEFORE AFTER), where TOTAL is the
+total number of lines on the current page, while BEFORE and AFTER
+are the number of lines on the current page before and after
+point, respectively."
(save-excursion
- (let ((opoint (point)) beg end
- total before after)
+ (let ((opoint (point)))
(forward-page)
(beginning-of-line)
- (or (looking-at page-delimiter)
- (end-of-line))
- (setq end (point))
- (backward-page)
- (setq beg (point))
- (setq total (count-lines beg end)
- before (count-lines beg opoint)
- after (count-lines opoint end))
- (message "Page has %d lines (%d + %d)" total before after))))
+ (unless (looking-at page-delimiter)
+ (end-of-line))
+ (let ((end (point)))
+ (backward-page)
+ (list (count-lines (point) end)
+ (count-lines (point) opoint)
+ (count-lines opoint end))))))
-(defun what-page ()
- "Print page and line number of point."
+(defun count-lines-page ()
+ "Report number of lines on current page, and how many are before or after point."
(interactive)
+ (pcase-let ((`(,total ,before ,after) (page--count-lines-page)))
+ (message (ngettext "Page has %d line (%d + %d)"
+ "Page has %d lines (%d + %d)" total)
+ total before after)))
+
+(defun page--what-page ()
+ "Return a list of the page and line number of point."
(save-restriction
(widen)
(save-excursion
(let ((count 1)
- (opoint (point)))
- (goto-char (point-min))
- (while (re-search-forward page-delimiter opoint t)
- (if (= (match-beginning 0) (match-end 0))
- (forward-char 1))
- (setq count (1+ count)))
- (message "Page %d, line %d" count (line-number-at-pos opoint))))))
+ (opoint (point)))
+ (goto-char (point-min))
+ (while (re-search-forward page-delimiter opoint t)
+ (when (= (match-beginning 0) (match-end 0))
+ (forward-char))
+ (setq count (1+ count)))
+ (list count (line-number-at-pos opoint))))))
+(defun what-page ()
+ "Print page and line number of point."
+ (interactive)
+ (apply #'message (cons "Page %d, line %d" (page--what-page))))
;;; Place `provide' at end of file.
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 40ad64b846e..3762010985f 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -1,4 +1,4 @@
-;;; paragraphs.el --- paragraph and sentence parsing
+;;; paragraphs.el --- paragraph and sentence parsing -*- lexical-binding: t -*-
;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2019 Free Software
;; Foundation, Inc.
@@ -36,9 +36,6 @@
(put 'use-hard-newlines 'permanent-local t)
(define-minor-mode use-hard-newlines
"Toggle distinguishing between hard and soft newlines.
-With a prefix argument ARG, enable the feature if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-it if ARG is omitted or nil.
When enabled, the functions `newline' and `open-line' add the
text-property `hard' to newlines that they insert, and a line is
@@ -168,7 +165,7 @@ to obtain the value of this variable."
:type '(choice regexp (const :tag "Use default value" nil)))
(put 'sentence-end 'safe-local-variable 'string-or-null-p)
-(defcustom sentence-end-base "[.?!…‽][]\"'”’)}]*"
+(defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*"
"Regexp matching the basic end of a sentence, not including following space."
:group 'paragraphs
:type 'string
@@ -211,6 +208,9 @@ This is desirable in modes where blank lines are the paragraph delimiters."
:type 'boolean)
(put 'paragraph-ignore-fill-prefix 'safe-local-variable 'booleanp)
+;; Silence the compiler.
+(defvar multiple-lines)
+
(defun forward-paragraph (&optional arg)
"Move forward to end of paragraph.
With argument ARG, do it ARG times;
@@ -401,15 +401,15 @@ it marks the next ARG paragraphs after the ones already marked."
(defun kill-paragraph (arg)
"Kill forward to end of paragraph.
-With arg N, kill forward to Nth end of paragraph;
-negative arg -N means kill backward to Nth start of paragraph."
+With ARG N, kill forward to Nth end of paragraph;
+negative ARG -N means kill backward to Nth start of paragraph."
(interactive "p")
(kill-region (point) (progn (forward-paragraph arg) (point))))
(defun backward-kill-paragraph (arg)
"Kill back to start of paragraph.
-With arg N, kill back to Nth start of paragraph;
-negative arg -N means kill forward to Nth end of paragraph."
+With ARG N, kill back to Nth start of paragraph;
+negative ARG -N means kill forward to Nth end of paragraph."
(interactive "p")
(kill-region (point) (progn (backward-paragraph arg) (point))))
@@ -424,6 +424,7 @@ the current paragraph with the one containing the mark."
(transpose-subr 'forward-paragraph arg))
(defun start-of-paragraph-text ()
+ "Move to the start of the current paragraph."
(let ((opoint (point)) npoint)
(forward-paragraph -1)
(setq npoint (point))
@@ -439,6 +440,7 @@ the current paragraph with the one containing the mark."
(start-of-paragraph-text))))))
(defun end-of-paragraph-text ()
+ "Move to the end of the current paragraph."
(let ((opoint (point)))
(forward-paragraph 1)
(if (eq (preceding-char) ?\n) (forward-char -1))
@@ -450,7 +452,7 @@ the current paragraph with the one containing the mark."
(defun forward-sentence (&optional arg)
"Move forward to next end of sentence. With argument, repeat.
-With negative argument, move backward repeatedly to start of sentence.
+When ARG is negative, move backward repeatedly to start of sentence.
The variable `sentence-end' is a regular expression that matches ends of
sentences. Also, every paragraph boundary terminates sentences as well."
@@ -486,37 +488,46 @@ sentences. Also, every paragraph boundary terminates sentences as well."
(setq arg (1- arg)))
(constrain-to-field nil opoint t)))
-(defun repunctuate-sentences ()
+(defun repunctuate-sentences (&optional no-query)
"Put two spaces at the end of sentences from point to the end of buffer.
-It works using `query-replace-regexp'."
+It works using `query-replace-regexp'.
+If optional argument NO-QUERY is non-nil, make changes without
+asking for confirmation."
(interactive)
- (query-replace-regexp "\\([]\"')]?\\)\\([.?!]\\)\\([]\"')]?\\) +"
- "\\1\\2\\3 "))
+ (let ((regexp "\\([]\"')]?\\)\\([.?!]\\)\\([]\"')]?\\) +")
+ (to-string "\\1\\2\\3 "))
+ (if no-query
+ (while (re-search-forward regexp nil t)
+ (replace-match to-string))
+ (query-replace-regexp regexp to-string))))
(defun backward-sentence (&optional arg)
- "Move backward to start of sentence. With arg, do it arg times.
-See `forward-sentence' for more information."
+ "Move backward to start of sentence.
+With ARG, do it ARG times. See `forward-sentence' for more
+information."
(interactive "^p")
(or arg (setq arg 1))
(forward-sentence (- arg)))
(defun kill-sentence (&optional arg)
"Kill from point to end of sentence.
-With arg, repeat; negative arg -N means kill back to Nth start of sentence."
+With ARG, repeat; negative ARG -N means kill back to Nth start of
+sentence."
(interactive "p")
(kill-region (point) (progn (forward-sentence arg) (point))))
(defun backward-kill-sentence (&optional arg)
"Kill back from point to start of sentence.
-With arg, repeat, or kill forward to Nth end of sentence if negative arg -N."
+With ARG, repeat, or kill forward to Nth end of sentence if
+negative ARG -N."
(interactive "p")
(kill-region (point) (progn (backward-sentence arg) (point))))
(defun mark-end-of-sentence (arg)
- "Put mark at end of sentence. Arg works as in `forward-sentence'.
-If this command is repeated, it marks the next ARG sentences after the
-ones already marked."
+ "Put mark at end of sentence.
+ARG works as in `forward-sentence'. If this command is repeated,
+it marks the next ARG sentences after the ones already marked."
(interactive "p")
(push-mark
(save-excursion
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index aed531e7694..bc85372de68 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -387,7 +387,8 @@ Interactively, ARG is the numeric argument, and defaults to 1."
\\[picture-set-tab-stops] and \\[picture-tab-search].
The syntax for this variable is like the syntax used inside of `[...]'
in a regular expression--but without the `[' and the `]'.
-It is NOT a regular expression, any regexp special characters will be quoted.
+It is NOT a regular expression, and should follow the usual
+rules for the contents of a character alternative.
It defines a set of \"interesting characters\" to look for when setting
\(or searching for) tab stops, initially \"!-~\" (all printing characters).
For example, suppose that you are editing a table which is formatted thus:
@@ -425,7 +426,7 @@ stops computed are displayed in the minibuffer with `:' at each stop."
(if arg
(setq tabs (or (default-value 'tab-stop-list)
(indent-accumulate-tab-stops (window-width))))
- (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
+ (let ((regexp (concat "[ \t]+[" picture-tab-chars "]")))
(beginning-of-line)
(let ((bol (point)))
(end-of-line)
@@ -433,8 +434,8 @@ stops computed are displayed in the minibuffer with `:' at each stop."
(skip-chars-forward " \t")
(setq tabs (cons (current-column) tabs)))
(if (null tabs)
- (error "No characters in set %s on this line"
- (regexp-quote picture-tab-chars))))))
+ (error "No characters in set [%s] on this line"
+ picture-tab-chars)))))
(setq tab-stop-list tabs)
(let ((blurb (make-string (1+ (nth (1- (length tabs)) tabs)) ?\ )))
(while tabs
@@ -455,12 +456,13 @@ If no such character is found, move to beginning of line."
(progn
(beginning-of-line)
(skip-chars-backward
- (concat "^" (regexp-quote picture-tab-chars))
+ (concat "^" (replace-regexp-in-string
+ "\\\\" "\\\\" picture-tab-chars nil t))
(point-min))
(not (bobp))))
(move-to-column target))
(if (re-search-forward
- (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")
+ (concat "[ \t]+[" picture-tab-chars "]")
(line-end-position)
'move)
(setq target (1- (current-column)))
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index f8013c73bb2..3ba52e61ea6 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -137,7 +137,7 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
(defvar r2b-capitalize-title-stop-words
(concat
- "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|"
+ "the\\|and\\|of\\|is\\|a\\|an\\|for\\|in\\|to\\|on\\|at\\|"
"by\\|with\\|that\\|its")
"Words not to be capitalized in a title (unless the first word).")
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index 5e577e4b279..e597ba866c4 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -169,7 +169,7 @@ complex processing.")
(when refill-doit ; there was a change
;; There's probably scope for more special cases here...
(pcase this-command
- (`self-insert-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
@@ -179,9 +179,9 @@ complex processing.")
;; newline, covered below).
(refill-fill-paragraph-at refill-doit)
(setq refill-doit nil)))
- ((or `quoted-insert `fill-paragraph `fill-region) nil)
- ((or `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
+ 'default-indent-new-line 'reindent-then-newline-and-indent)
;; Don't zap what was just inserted.
(save-excursion
(beginning-of-line) ; for newline-and-indent
@@ -213,9 +213,6 @@ complex processing.")
;;;###autoload
(define-minor-mode refill-mode
"Toggle automatic refilling (Refill mode).
-With a prefix argument ARG, enable Refill mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
Refill mode is a buffer-local minor mode. When enabled, the
current paragraph is refilled as you edit. Self-inserting
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 851e46ca2d5..5b42b25f772 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -172,7 +172,7 @@ If RETURN is non-nil, just return the entry and restore point."
(if item
(progn (end-of-line)
(re-search-forward
- "\\\\bibitem\\|\\end{thebibliography}")
+ "\\\\bibitem\\|\\\\end{thebibliography}")
(1- (match-beginning 0)))
(progn (forward-list 1) (point)))
(error (min (point-max) (+ 300 (point)))))))
@@ -447,7 +447,7 @@ If FIELD is empty try \"editor\" field."
(setq names (reftex-get-bib-field "editor" entry)))
(while (string-match "\\band\\b[ \t]*" names)
(setq names (replace-match "\n" nil t names)))
- (while (string-match "[\\.a-zA-Z\\-]+\\.[ \t]*\\|,.*\\|[{}]+" names)
+ (while (string-match "[-.a-zA-Z]+\\.[ \t]*\\|,.*\\|[{}]+" names)
(setq names (replace-match "" nil t names)))
(while (string-match "^[ \t]+\\|[ \t]+$" names)
(setq names (replace-match "" nil t names)))
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index cdff2f479fa..6103c6c0206 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -27,6 +27,8 @@
(eval-when-compile (require 'cl-lib))
(provide 'reftex-global)
(require 'reftex)
+
+(declare-function fileloop-continue "fileloop")
;;;
;;;###autoload
@@ -98,8 +100,11 @@ No active TAGS table is required."
(unless to
(setq to (read-string (format "Replace regexp %s with: " from))))
(reftex-access-scan-info current-prefix-arg)
- (tags-query-replace from to (or delimited current-prefix-arg)
- (list 'reftex-all-document-files))))
+ (fileloop-initialize-replace
+ from to (reftex-all-document-files)
+ (if (equal from (downcase from)) nil 'default)
+ (or delimited current-prefix-arg))
+ (fileloop-continue)))
(defvar TeX-master)
(defvar isearch-next-buffer-function)
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 2f9b7268fc8..005816e9659 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -1000,7 +1000,7 @@ OPT-ARGS is a list of argument numbers which are optional."
(eq (following-char) ?\{))
(cl-incf cnt)))
(if (and (= n cnt)
- (> (skip-chars-forward "{\\[") 0))
+ (> (skip-chars-forward "{[") 0))
(reftex-context-substring)
nil))))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index ca1d2b2df8d..3ec96aa67db 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -308,13 +308,13 @@ also applies `reftex-translate-to-ascii-function' to the string."
;; Replace %escapes in a label prefix
(save-match-data
(let (letter (num 0) replace)
- (while (string-match "\\%\\([a-zA-Z]\\)" prefix num)
+ (while (string-match "%\\([a-zA-Z]\\)" prefix num)
(setq letter (match-string 1 prefix))
(setq replace
(save-match-data
(cond
((equal letter "f")
- (file-name-base))
+ (file-name-base (buffer-file-name)))
((equal letter "F")
(let ((masterdir (file-name-directory (reftex-TeX-master-file)))
(file (file-name-sans-extension (buffer-file-name))))
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index 017f5a32126..a9d5819f4b6 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -202,8 +202,8 @@ distribution. Mixed-case symbols are convenience aliases.")
(harvard "The Harvard package"
((?\C-m . "\\cite[]{%l}")
(?p . "\\cite[]{%l}")
- (?t . "\\citeasnoun{%l}")
- (?n . "\\citeasnoun{%l}")
+ (?t . "\\citeasnoun[]{%l}")
+ (?n . "\\citeasnoun[]{%l}")
(?s . "\\possessivecite{%l}")
(?e . "\\citeaffixed{%l}{?}")
(?y . "\\citeyear{%l}")
@@ -891,21 +891,58 @@ DOWNCASE t: Downcase words before using them."
;; so this list mustn't get any more items.
(defconst reftex-label-regexps '("\\\\label{\\([^}]*\\)}"))
(defcustom reftex-label-regexps
- '(;; Normal \\label{foo} labels
+ `(;; Normal \\label{foo} labels
"\\\\label{\\(?1:[^}]*\\)}"
;; keyvals [..., label = {foo}, ...] forms used by ctable,
- ;; listings, minted, ...
- "\\[[^][]\\{0,2000\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+ ;; listings, breqn, ...
+ ,(concat
+ ;; Make sure we search only for optional arguments of
+ ;; environments/macros and don't match any other [. ctable
+ ;; provides a macro called \ctable, listings/breqn have
+ ;; environments. Start with a backslash and a group for names
+ "\\\\\\(?:"
+ ;; begin, optional spaces and opening brace
+ "begin[[:space:]]*{"
+ ;; Build a regexp for env names
+ (regexp-opt '("lstlisting" "dmath" "dseries" "dgroup" "darray"))
+ ;; closing brace, optional spaces
+ "}[[:space:]]*"
+ ;; Now for macros
+ "\\|"
+ ;; Build a regexp for macro names; currently only \ctable
+ (regexp-opt '("ctable"))
+ ;; Close the group for names
+ "\\)"
+ ;; Match the opening [ and the following chars
+ "\\[[^][]*"
+ ;; Allow nested levels of chars enclosed in braces
+ "\\(?:{[^}{]*"
+ "\\(?:{[^}{]*"
+ "\\(?:{[^}{]*}[^}{]*\\)*"
+ "}[^}{]*\\)*"
+ "}[^][]*\\)*"
+ ;; Match the label key
+ "\\<label[[:space:]]*=[[:space:]]*"
+ ;; Match the label value; braces around the value are
+ ;; optional.
+ "{?\\(?1:[^] ,}\r\n\t%]+\\)}?"
+ ;; We are done. Just search until the next closing bracket
+ "[^]]*\\]"))
"List of regexps matching \\label definitions.
The default value matches usual \\label{...} definitions and
-keyval style [..., label = {...}, ...] label definitions. It is
-assumed that the regexp group 1 matches the label text, so you
-have to define it using \\(?1:...\\) when adding new regexps.
+keyval style [..., label = {...}, ...] label definitions. The
+regexp for keyval style explicitly looks for environments
+provided by the packages \"listings\" (\"lstlisting\"),
+\"breqn\" (\"dmath\", \"dseries\", \"dgroup\", \"darray\") and
+the macro \"\\ctable\" provided by the package of the same name.
+
+It is assumed that the regexp group 1 matches the label text, so
+you have to define it using \\(?1:...\\) when adding new regexps.
When changed from Lisp, make sure to call
`reftex-compile-variables' afterwards to make the change
effective."
- :version "25.1"
+ :version "27.1"
:set (lambda (symbol value)
(set symbol value)
(when (fboundp 'reftex-compile-variables)
@@ -1030,7 +1067,9 @@ This is used to string together whole reference sets, like
("Hyperref" "hyperref"
(("\\autoref" ?a) ("\\autopageref" ?u)))
("Cleveref" "cleveref"
- (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D))))
+ (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D)))
+ ("AMSmath" "amsmath"
+ (("\\eqref" ?e))))
"Alist of reference styles.
Each element is a list of the style name, the name of the LaTeX
package associated with the style or t for any package, and an
@@ -1040,7 +1079,7 @@ the macro type is being prompted for. (See also
`reftex-ref-macro-prompt'.) The keys, represented as characters,
have to be unique."
:group 'reftex-referencing-labels
- :version "24.3"
+ :version "27.1"
:type '(alist :key-type (string :tag "Style name")
:value-type (group (choice :tag "Package"
(const :tag "Any package" t)
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index b9c08b8797e..67ecd3ced81 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -402,11 +402,19 @@ exists) might be changed."
:type 'string
:group 'remember)
+(defcustom remember-time-format "%a %b %d %H:%M:%S %Y"
+ "The format for time stamp, passed to `format-time-string'.
+The default emulates `current-time-string' for backward compatibility."
+ :type 'string
+ :group 'remember
+ :version "27.1")
+
(defun remember-append-to-file ()
"Remember, with description DESC, the given TEXT."
(let* ((text (buffer-string))
(desc (remember-buffer-desc))
- (remember-text (concat "\n" remember-leader-text (current-time-string)
+ (remember-text (concat "\n" remember-leader-text
+ (format-time-string remember-time-format)
" (" desc ")\n\n" text
(save-excursion (goto-char (point-max))
(if (bolp) nil "\n"))))
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 7b9b618e4a4..ba5d7e4f46f 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -112,27 +112,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Support for `testcover'
-(when (and (boundp 'testcover-1value-functions)
- (boundp 'testcover-compose-functions))
- ;; Below `lambda' is used in a loop with varying parameters and is thus not
- ;; 1valued.
- (setq testcover-1value-functions
- (delq 'lambda testcover-1value-functions))
- (add-to-list 'testcover-compose-functions 'lambda))
-
-(defun rst-testcover-defcustom ()
- "Remove all customized variables from `testcover-module-constants'.
-This seems to be a bug in `testcover': `defcustom' variables are
-considered constants. Revert it with this function after each `defcustom'."
- (when (boundp 'testcover-module-constants)
- (setq testcover-module-constants
- (delq nil
- (mapcar
- #'(lambda (sym)
- (if (not (plist-member (symbol-plist sym) 'standard-value))
- sym))
- testcover-module-constants)))))
-
(defun rst-testcover-add-compose (fun)
"Add FUN to `testcover-compose-functions'."
(when (boundp 'testcover-compose-functions)
@@ -246,7 +225,7 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match."
"The SVN revision of this file.
SVN revision is the upstream (docutils) revision.")
(defconst rst-svn-timestamp
- (rst-extract-version "\\$" "LastChangedDate: " ".+?+" " "
+ (rst-extract-version "\\$" "LastChangedDate: " ".+" " "
"$LastChangedDate: 2017-01-08 10:54:35 +0100 (Sun, 08 Jan 2017) $")
"The SVN time stamp of this file.")
@@ -817,6 +796,9 @@ Return ADO if so or signal an error otherwise."
;; Public class methods
+(define-obsolete-variable-alias
+ 'rst-preferred-decorations 'rst-preferred-adornments "rst 1.0.0")
+
(defvar rst-preferred-adornments) ; Forward declaration.
(defun rst-Hdr-preferred-adornments ()
@@ -1344,7 +1326,6 @@ This inherits from Text mode.")
The hook for `text-mode' is run before this one."
:group 'rst
:type '(hook))
-(rst-testcover-defcustom)
;; Pull in variable definitions silencing byte-compiler.
(require 'newcomment)
@@ -1430,9 +1411,6 @@ highlighting.
;;;###autoload
(define-minor-mode rst-minor-mode
"Toggle ReST minor mode.
-With a prefix argument ARG, enable ReST minor mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
When ReST minor mode is enabled, the ReST mode keybindings
are installed on top of the major mode bindings. Use this
@@ -1503,8 +1481,6 @@ for modes derived from Text mode, like Mail mode."
:group 'rst
:version "21.1")
-(define-obsolete-variable-alias
- 'rst-preferred-decorations 'rst-preferred-adornments "rst 1.0.0")
;; FIXME: Default must match suggestion in
;; http://sphinx-doc.org/rest.html#sections for Python documentation.
(defcustom rst-preferred-adornments '((?= over-and-under 1)
@@ -1541,7 +1517,6 @@ file."
(const :tag "Underline only" simple))
(integer :tag "Indentation for overline and underline type"
:value 0))))
-(rst-testcover-defcustom)
;; FIXME: Rename this to `rst-over-and-under-default-indent' and set default to
;; 0 because the effect of 1 is probably surprising in the few cases
@@ -1558,7 +1533,6 @@ found in the buffer are to be used but the indentation for
over-and-under adornments is inconsistent across the buffer."
:group 'rst-adjust
:type '(integer))
-(rst-testcover-defcustom)
(defun rst-new-preferred-hdr (seen prev)
;; testcover: ok.
@@ -1997,7 +1971,6 @@ b. a negative numerical argument, which generally inverts the
:group 'rst-adjust
:type '(hook)
:package-version '(rst . "1.1.0"))
-(rst-testcover-defcustom)
(defcustom rst-new-adornment-down nil
"Controls level of new adornment for section headers."
@@ -2006,7 +1979,6 @@ b. a negative numerical argument, which generally inverts the
(const :tag "Same level as previous one" nil)
(const :tag "One level down relative to the previous one" t))
:package-version '(rst . "1.1.0"))
-(rst-testcover-defcustom)
(defun rst-adjust-adornment (pfxarg)
"Call `rst-adjust-section' interactively.
@@ -2429,7 +2401,6 @@ also arranged by `rst-insert-list-new-tag'."
:tag (char-to-string char) char))
rst-bullets)))
:package-version '(rst . "1.1.0"))
-(rst-testcover-defcustom)
(defun rst-insert-list-continue (ind tag tab prefer-roman)
;; testcover: ok.
@@ -2666,7 +2637,6 @@ section headers at all."
Also used for formatting insertion, when numbering is disabled."
:type 'integer
:group 'rst-toc)
-(rst-testcover-defcustom)
(defcustom rst-toc-insert-style 'fixed
"Insertion style for table-of-contents.
@@ -2681,19 +2651,16 @@ indentation style:
(const aligned)
(const listed))
:group 'rst-toc)
-(rst-testcover-defcustom)
(defcustom rst-toc-insert-number-separator " "
"Separator that goes between the TOC number and the title."
:type 'string
:group 'rst-toc)
-(rst-testcover-defcustom)
(defcustom rst-toc-insert-max-level nil
"If non-nil, maximum depth of the inserted TOC."
:type '(choice (const nil) integer)
:group 'rst-toc)
-(rst-testcover-defcustom)
(defconst rst-toc-link-keymap
(let ((map (make-sparse-keymap)))
@@ -3158,35 +3125,30 @@ These indentation widths can be customized here."
"Indentation when there is no more indentation point given."
:group 'rst-indent
:type '(integer))
-(rst-testcover-defcustom)
(defcustom rst-indent-field 3
"Indentation for first line after a field or 0 to always indent for content."
:group 'rst-indent
:package-version '(rst . "1.1.0")
:type '(integer))
-(rst-testcover-defcustom)
(defcustom rst-indent-literal-normal 3
"Default indentation for literal block after a markup on an own line."
:group 'rst-indent
:package-version '(rst . "1.1.0")
:type '(integer))
-(rst-testcover-defcustom)
(defcustom rst-indent-literal-minimized 2
"Default indentation for literal block after a minimized markup."
:group 'rst-indent
:package-version '(rst . "1.1.0")
:type '(integer))
-(rst-testcover-defcustom)
(defcustom rst-indent-comment 3
"Default indentation for first line of a comment."
:group 'rst-indent
:package-version '(rst . "1.1.0")
:type '(integer))
-(rst-testcover-defcustom)
;; FIXME: Must consider other tabs:
;; * Line blocks
@@ -3636,7 +3598,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-block-face
"customize the face `rst-block' instead."
"24.1")
@@ -3651,7 +3612,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-external-face
"customize the face `rst-external' instead."
"24.1")
@@ -3666,7 +3626,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-definition-face
"customize the face `rst-definition' instead."
"24.1")
@@ -3683,7 +3642,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
"Directives and roles."
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-directive-face
"customize the face `rst-directive' instead."
"24.1")
@@ -3698,7 +3656,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-comment-face
"customize the face `rst-comment' instead."
"24.1")
@@ -3713,7 +3670,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-emphasis1-face
"customize the face `rst-emphasis1' instead."
"24.1")
@@ -3727,7 +3683,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
"Double emphasis."
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-emphasis2-face
"customize the face `rst-emphasis2' instead."
"24.1")
@@ -3742,7 +3697,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-literal-face
"customize the face `rst-literal' instead."
"24.1")
@@ -3757,7 +3711,6 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
:version "24.1"
:group 'rst-faces
:type '(face))
-(rst-testcover-defcustom)
(make-obsolete-variable 'rst-reference-face
"customize the face `rst-reference' instead."
"24.1")
@@ -3840,7 +3793,6 @@ of your own."
(const :tag "transitions" t)
(const :tag "section title adornment" nil))
:value-type (face)))
-(rst-testcover-defcustom)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -4337,7 +4289,6 @@ string)) to be used for converting the document."
(string :tag "Options"))))
:group 'rst-compile
:package-version "1.2.0")
-(rst-testcover-defcustom)
;; FIXME: Must be defcustom.
(defvar rst-compile-primary-toolset 'html
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index c9724e0e3f7..d8210037c6d 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -46,8 +46,7 @@
(defcustom sgml-basic-offset 2
"Specifies the basic indentation level for `sgml-indent-line'."
- :type 'integer
- :group 'sgml)
+ :type 'integer)
(defcustom sgml-attribute-offset 0
"Specifies a delta for attribute indentation in `sgml-indent-line'.
@@ -65,16 +64,16 @@ When 2, attribute indentation looks like this:
</element>"
:version "25.1"
:type 'integer
- :safe 'integerp
- :group 'sgml)
+ :safe 'integerp)
(defcustom sgml-xml-mode nil
"When non-nil, tag insertion functions will be XML-compliant.
It is set to be buffer-local when the file has
a DOCTYPE or an XML declaration."
:type 'boolean
- :version "22.1"
- :group 'sgml)
+ :version "22.1")
+
+(defvaralias 'sgml-transformation 'sgml-transformation-function)
(defcustom sgml-transformation-function 'identity
"Default value for `skeleton-transformation-function' in SGML mode."
@@ -87,17 +86,14 @@ a DOCTYPE or an XML declaration."
(and (derived-mode-p 'sgml-mode)
(not sgml-xml-mode)
(setq skeleton-transformation-function val))))
- (buffer-list)))
- :group 'sgml)
+ (buffer-list))))
(put 'sgml-transformation-function 'variable-interactive
"aTransformation function: ")
-(defvaralias 'sgml-transformation 'sgml-transformation-function)
(defcustom sgml-mode-hook nil
"Hook run by command `sgml-mode'.
`text-mode-hook' is run first."
- :group 'sgml
:type 'hook)
;; The official handling of "--" is complicated in SGML, and
@@ -206,8 +202,7 @@ This takes effect when first loading the `sgml-mode' library.")
(defcustom sgml-name-8bit-mode nil
"When non-nil, insert non-ASCII characters as named entities."
- :type 'boolean
- :group 'sgml)
+ :type 'boolean)
(defvar sgml-char-names
[nil nil nil nil nil nil nil nil
@@ -277,8 +272,7 @@ Currently, only Latin-1 characters are supported.")
The file name of current buffer file name will be appended to this,
separated by a space."
:type 'string
- :version "21.1"
- :group 'sgml)
+ :version "21.1")
(defvar sgml-saved-validate-command nil
"The command last used to validate in this buffer.")
@@ -287,8 +281,7 @@ separated by a space."
;; so use a small distance here.
(defcustom sgml-slash-distance 1000
"If non-nil, is the maximum distance to search for matching `/'."
- :type '(choice (const nil) integer)
- :group 'sgml)
+ :type '(choice (const nil) integer))
(defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*")
(defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*")
@@ -300,8 +293,7 @@ Any terminating `>' or `/' is not matched.")
(defface sgml-namespace
'((t (:inherit font-lock-builtin-face)))
- "`sgml-mode' face used to highlight the namespace part of identifiers."
- :group 'sgml)
+ "`sgml-mode' face used to highlight the namespace part of identifiers.")
(defvar sgml-namespace-face 'sgml-namespace)
;; internal
@@ -337,6 +329,30 @@ Any terminating `>' or `/' is not matched.")
(defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
"Rules for highlighting SGML code. See also `sgml-tag-face-alist'.")
+(defun sgml-font-lock-syntactic-face (state)
+ "`font-lock-syntactic-face-function' for `sgml-mode'."
+ ;; Don't use string face outside of tags.
+ (cond ((and (nth 9 state) (nth 3 state)) font-lock-string-face)
+ ((nth 4 state) font-lock-comment-face)))
+
+(defvar-local sgml--syntax-propertize-ppss nil)
+
+(defun sgml--syntax-propertize-ppss (pos)
+ "Return PPSS at POS, fixing the syntax of any lone `>' along the way."
+ (cl-assert (>= pos (car sgml--syntax-propertize-ppss)))
+ (let ((ppss (parse-partial-sexp (car sgml--syntax-propertize-ppss) pos -1
+ nil (cdr sgml--syntax-propertize-ppss))))
+ (while (eq -1 (car ppss))
+ (put-text-property (1- (point)) (point)
+ 'syntax-table (string-to-syntax "."))
+ ;; Hack attack: rather than recompute the ppss from
+ ;; (car sgml--syntax-propertize-ppss), we manually "fix it".
+ (setcar ppss 0)
+ (setq ppss (parse-partial-sexp (point) pos -1 nil ppss)))
+ (setcdr sgml--syntax-propertize-ppss ppss)
+ (setcar sgml--syntax-propertize-ppss pos)
+ ppss))
+
(eval-and-compile
(defconst sgml-syntax-propertize-rules
(syntax-propertize-precompile-rules
@@ -347,21 +363,50 @@ Any terminating `>' or `/' is not matched.")
("--[ \t\n]*\\(>\\)" (1 "> b"))
("\\(<\\)[?!]" (1 (prog1 "|>"
(sgml-syntax-propertize-inside end))))
- ;; Quotes outside of tags should not introduce strings.
- ;; Be careful to call `syntax-ppss' on a position before the one we're
- ;; going to change, so as not to need to flush the data we just computed.
- ("[\"']" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
- (goto-char (match-end 0)))
- (string-to-syntax ".")))))))
+ ;; Quotes outside of tags should not introduce strings which end up
+ ;; hiding tags. We used to test every quote and mark it as "."
+ ;; if it's outside of tags, but there are too many quotes and
+ ;; the resulting number of calls to syntax-ppss made it too slow
+ ;; (bug#33887), so we're now careful to leave alone any pair
+ ;; of quotes that doesn't hold a < or > char, which is the vast majority:
+ ;; either they're both within a tag (or a comment), in which case it's
+ ;; indeed correct to leave them as is, or they're both outside of tags, in
+ ;; which case they arguably should have punctuation syntax, but it is
+ ;; harmless to let them have string syntax because they won't "hide" any
+ ;; tag or comment from us (and we use the
+ ;; font-lock-syntactic-face-function to make sure those spurious "strings
+ ;; within text" aren't highlighted as strings).
+ ("\\([\"']\\)[^\"'<>]*"
+ (1 (if (eq (char-after) (char-after (match-beginning 0)))
+ ;; Fast-track case.
+ (forward-char 1)
+ ;; Point has moved to the end of the text we matched after the
+ ;; quote, but this risks overlooking a match to one of the other
+ ;; regexp in the rules. We could just (goto-char (match-end 1))
+ ;; to solve this, but that would be too easy, so instead we
+ ;; only move back enough to avoid skipping comment ender, which
+ ;; happens to be the only one that we could have overlooked.
+ (when (eq (char-after) ?>)
+ (skip-chars-backward "-"))
+ ;; Be careful to call `syntax-ppss' on a position before the one
+ ;; we're going to change, so as not to need to flush the data we
+ ;; just computed.
+ (if (zerop (save-excursion
+ (car (sgml--syntax-propertize-ppss
+ (match-beginning 0)))))
+ (string-to-syntax ".")))))
+ )))
(defun sgml-syntax-propertize (start end)
"Syntactic keywords for `sgml-mode'."
- (goto-char start)
- (with-syntax-table (or syntax-ppss-table (syntax-table))
- (sgml-syntax-propertize-inside end)
- (funcall
- (syntax-propertize-rules sgml-syntax-propertize-rules)
- start end)))
+ (setq sgml--syntax-propertize-ppss (cons start (syntax-ppss start)))
+ (cl-assert (>= (cadr sgml--syntax-propertize-ppss) 0))
+ (sgml-syntax-propertize-inside end)
+ (funcall
+ (syntax-propertize-rules sgml-syntax-propertize-rules)
+ start end)
+ ;; Catch any '>' after the last quote.
+ (sgml--syntax-propertize-ppss end))
(defun sgml-syntax-propertize-inside (end)
(let ((ppss (syntax-ppss)))
@@ -417,8 +462,7 @@ The attribute alist is made up as
ATTRIBUTERULE is a list of optionally t (no value when no input) followed by
an optional alist of possible values."
:type '(repeat (cons (string :tag "Tag Name")
- (repeat :tag "Tag Rule" sexp)))
- :group 'sgml)
+ (repeat :tag "Tag Rule" sexp))))
(put 'sgml-tag-alist 'risky-local-variable t)
(defcustom sgml-tag-help
@@ -430,8 +474,7 @@ an optional alist of possible values."
("!entity" . "Entity (macro) declaration"))
"Alist of tag name and short description."
:type '(repeat (cons (string :tag "Tag Name")
- (string :tag "Description")))
- :group 'sgml)
+ (string :tag "Description"))))
(defvar sgml-empty-tags nil
"List of tags whose !ELEMENT definition says EMPTY.")
@@ -457,7 +500,7 @@ an optional alist of possible values."
nil t)
(string-match "X\\(HT\\)?ML" (match-string 3))))))
-(defvar v2) ; free for skeleton
+(with-no-warnings (defvar v2)) ; free for skeleton
(defun sgml-comment-indent-new-line (&optional soft)
(let ((comment-start "-- ")
@@ -549,7 +592,7 @@ Do \\[describe-key] on the following bindings to discover what they do.
;; This is desirable because SGML discards a newline that appears
;; immediately after a start tag or immediately before an end tag.
(setq-local paragraph-start (concat "[ \t]*$\\|\
-[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
+\[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
(setq-local paragraph-separate (concat paragraph-start "$"))
(setq-local adaptive-fill-regexp "[ \t]*")
(add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t)
@@ -567,7 +610,9 @@ Do \\[describe-key] on the following bindings to discover what they do.
(setq font-lock-defaults '((sgml-font-lock-keywords
sgml-font-lock-keywords-1
sgml-font-lock-keywords-2)
- nil t))
+ nil t nil
+ (font-lock-syntactic-face-function
+ . sgml-font-lock-syntactic-face)))
(setq-local syntax-propertize-function #'sgml-syntax-propertize)
(setq-local syntax-ppss-table sgml-tag-syntax-table)
(setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
@@ -616,7 +661,7 @@ Behaves electrically if `sgml-quick-keys' is non-nil."
(delete-char -1)
(sgml-close-tag))
(t
- (sgml-slash-matching arg))))
+ (insert-char ?/ arg))))
(defun sgml-slash-matching (arg)
"Insert `/' and display any previous matching `/'.
@@ -772,8 +817,16 @@ If QUIET, do not print a message when there are no attributes for TAG."
(symbolp (car (car alist))))
(setq car (car alist)
alist (cdr alist)))
- (or quiet
- (message "No attributes configured."))
+ (unless (or alist quiet)
+ (message "No attributes configured."))
+ (when alist
+ ;; Add class and id attributes if a) the element has any
+ ;; other attributes configured, and b) they're not already
+ ;; present.
+ (unless (assoc-string "class" alist)
+ (setq alist (cons '("class") alist)))
+ (unless (assoc-string "id" alist)
+ (setq alist (cons '("id") alist))))
(if (stringp (car alist))
(progn
(insert (if (eq (preceding-char) ?\s) "" ?\s)
@@ -893,7 +946,7 @@ Return non-nil if we skipped over matched tags."
(condition-case err
(save-excursion
(goto-char end)
- (skip-chars-backward "[:alnum:]-_.:")
+ (skip-chars-backward "-[:alnum:]_.:")
(if (and ;; (<= (point) beg) ; This poses problems for downcase-word.
(or (eq (char-before) ?<)
(and (eq (char-before) ?/)
@@ -901,7 +954,7 @@ Return non-nil if we skipped over matched tags."
(null (get-char-property (point) 'text-clones)))
(let* ((endp (eq (char-before) ?/))
(cl-start (point))
- (cl-end (progn (skip-chars-forward "[:alnum:]-_.:") (point)))
+ (cl-end (progn (skip-chars-forward "-[:alnum:]_.:") (point)))
(match
(if endp
(when (sgml-skip-tag-backward 1) (forward-char 1) t)
@@ -918,7 +971,8 @@ Return non-nil if we skipped over matched tags."
(equal (buffer-substring cl-start cl-end)
(buffer-substring (point)
(save-excursion
- (skip-chars-forward "[:alnum:]-_.:")
+ (skip-chars-forward
+ "-[:alnum:]_.:")
(point))))
(or (not endp) (eq (char-after cl-end) ?>)))
(when clones
@@ -938,9 +992,6 @@ Return non-nil if we skipped over matched tags."
(define-minor-mode sgml-electric-tag-pair-mode
"Toggle SGML Electric Tag Pair mode.
-With a prefix argument ARG, enable the mode if ARG is positive,
-and disable it otherwise. If called from Lisp, enable the mode
-if ARG is omitted or nil.
SGML Electric Tag Pair mode is a buffer-local minor mode for use
with `sgml-mode' and related major modes. When enabled, editing
@@ -1239,8 +1290,11 @@ See `sgml-tag-alist' for info about attribute rules."
(defun sgml-quote (start end &optional unquotep)
"Quote SGML text in region START ... END.
-Only &, < and > are quoted, the rest is left untouched.
-With prefix argument UNQUOTEP, unquote the region."
+Only &, <, >, ' and \" characters are quoted, the rest is left
+untouched. This is sufficient to use quoted text as SGML argument.
+
+With prefix argument UNQUOTEP, unquote the region. All numeric entities,
+\"amp\", \"lt\", \"gt\" and \"quot\" named entities are unquoted."
(interactive "r\nP")
(save-restriction
(narrow-to-region start end)
@@ -1248,14 +1302,23 @@ With prefix argument UNQUOTEP, unquote the region."
(if unquotep
;; FIXME: We should unquote other named character references as well.
(while (re-search-forward
- "\\(&\\(amp\\|\\(l\\|\\(g\\)\\)t\\)\\)[][<>&;\n\t \"%!'(),/=?]"
+ "\\(&\\(amp\\|quot\\|lt\\|gt\\|#\\([0-9]+\\|[xX][[:xdigit:]]+\\)\\)\\)\\([][<>&;\n\t \"%!'(),/=?]\\|$\\)"
nil t)
- (replace-match (if (match-end 4) ">" (if (match-end 3) "<" "&")) t t
- nil (if (eq (char-before (match-end 0)) ?\;) 0 1)))
- (while (re-search-forward "[&<>]" nil t)
+ (replace-match
+ (string
+ (or (cdr (assq (char-after (match-beginning 2))
+ '((?a . ?&) (?q . ?\") (?l . ?<) (?g . ?>))))
+ (let ((num (match-string 3)))
+ (if (or (eq ?x (aref num 0)) (eq ?X (aref num 0)))
+ (string-to-number (substring num 1) 16)
+ (string-to-number num 10)))))
+ t t nil (if (eq (char-before (match-end 0)) ?\;) 0 1)))
+ (while (re-search-forward "[&<>\"']" nil t)
(replace-match (cdr (assq (char-before) '((?& . "&amp;")
(?< . "&lt;")
- (?> . "&gt;"))))
+ (?> . "&gt;")
+ (?\" . "&#34;")
+ (?' . "&#39;"))))
t t)))))
(defun sgml-pretty-print (beg end)
@@ -1512,12 +1575,12 @@ Depending on context, inserts a matching close-tag, or closes
the current start-tag or the current comment or the current cdata, ..."
(interactive)
(pcase (car (sgml-lexical-context))
- (`comment (insert " -->"))
- (`cdata (insert "]]>"))
- (`pi (insert " ?>"))
- (`jsp (insert " %>"))
- (`tag (insert " />"))
- (`text
+ ('comment (insert " -->"))
+ ('cdata (insert "]]>"))
+ ('pi (insert " ?>"))
+ ('jsp (insert " %>"))
+ ('tag (insert " />"))
+ ('text
(let ((context (save-excursion (sgml-get-context))))
(if context
(progn
@@ -1550,7 +1613,7 @@ LCON is the lexical context, if any."
(pcase (car lcon)
- (`string
+ ('string
;; Go back to previous non-empty line.
(while (and (> (point) (cdr lcon))
(zerop (forward-line -1))
@@ -1561,7 +1624,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))
@@ -1580,11 +1643,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 (+ (cdr lcon) sgml-attribute-offset))
(skip-chars-forward "^ \t\n") ;Skip tag name.
(skip-chars-forward " \t")
@@ -1594,7 +1657,7 @@ LCON is the lexical context, if any."
(goto-char (+ (cdr lcon) sgml-attribute-offset))
(+ (current-column) sgml-basic-offset)))
- (`text
+ ('text
(while (looking-at "</")
(sgml-forward-sexp 1)
(skip-chars-forward " \t"))
@@ -1710,7 +1773,6 @@ Currently just returns (EMPTY-TAGS UNCLOSED-TAGS)."
(defcustom html-mode-hook nil
"Hook run by command `html-mode'.
`text-mode-hook' and `sgml-mode-hook' are run first."
- :group 'sgml
:type 'hook
:options '(html-autoview-mode))
@@ -1742,6 +1804,7 @@ This takes effect when first loading the library.")
(define-key map "\C-c\C-ci" 'html-image)
(when html-quick-keys
(define-key map "\C-c-" 'html-horizontal-rule)
+ (define-key map "\C-cd" 'html-div)
(define-key map "\C-co" 'html-ordered-list)
(define-key map "\C-cu" 'html-unordered-list)
(define-key map "\C-cr" 'html-radio-buttons)
@@ -1749,7 +1812,8 @@ This takes effect when first loading the library.")
(define-key map "\C-cl" 'html-list-item)
(define-key map "\C-ch" 'html-href-anchor)
(define-key map "\C-cn" 'html-name-anchor)
- (define-key map "\C-ci" 'html-image))
+ (define-key map "\C-ci" 'html-image)
+ (define-key map "\C-cs" 'html-span))
(define-key map "\C-c\C-s" 'html-autoview-mode)
(define-key map "\C-c\C-v" 'browse-url-of-buffer)
(define-key map [menu-bar html] (cons "HTML" menu-map))
@@ -1950,7 +2014,7 @@ This takes effect when first loading the library.")
("dd" ,(not sgml-xml-mode))
("del" nil ("cite") ("datetime"))
("dfn")
- ("div")
+ ("div" \n ("id") ("class"))
("dl" (nil \n
( "Term: "
"<dt>" str (if sgml-xml-mode "</dt>")
@@ -2230,6 +2294,9 @@ buffer's tick counter (as produced by `buffer-modified-tick'),
and the CDR is the list of class names found in the buffer.")
(make-variable-buffer-local 'html--buffer-ids-cache)
+(declare-function libxml-parse-html-region "xml.c"
+ (start end &optional base-url discard-comments))
+
(defun html-current-buffer-classes ()
"Return a list of class names used in the current buffer.
The result is cached in `html--buffer-classes-cache'."
@@ -2361,18 +2428,14 @@ The third `match-string' will be the used in the menu.")
(define-minor-mode html-autoview-mode
"Toggle viewing of HTML files on save (HTML Autoview mode).
-With a prefix argument ARG, enable HTML Autoview mode if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil.
HTML Autoview mode is a buffer-local minor mode for use with
`html-mode'. If enabled, saving the file automatically runs
`browse-url-of-buffer' to view it."
nil nil nil
- :group 'sgml
(if html-autoview-mode
- (add-hook 'after-save-hook 'browse-url-of-buffer nil t)
- (remove-hook 'after-save-hook 'browse-url-of-buffer t)))
+ (add-hook 'after-save-hook #'browse-url-of-buffer nil t)
+ (remove-hook 'after-save-hook #'browse-url-of-buffer t)))
(define-skeleton html-href-anchor
@@ -2437,16 +2500,16 @@ HTML Autoview mode is a buffer-local minor mode for use with
(define-skeleton html-ordered-list
"HTML ordered list tags."
nil
- "<ol>" \n
+ \n "<ol>" \n
"<li>" _ (if sgml-xml-mode "</li>") \n
- "</ol>")
+ "</ol>" > \n)
(define-skeleton html-unordered-list
"HTML unordered list tags."
nil
- "<ul>" \n
+ \n "<ul>" \n
"<li>" _ (if sgml-xml-mode "</li>") \n
- "</ul>")
+ "</ul>" > \n)
(define-skeleton html-list-item
"HTML list item tag."
@@ -2457,8 +2520,17 @@ HTML Autoview mode is a buffer-local minor mode for use with
(define-skeleton html-paragraph
"HTML paragraph tag."
nil
- (if (bolp) nil ?\n)
- "<p>" _ (if sgml-xml-mode "</p>"))
+ \n "<p>" _ (if sgml-xml-mode "</p>"))
+
+(define-skeleton html-div
+ "HTML div tag."
+ nil
+ "<div>" > \n _ \n "</div>" >)
+
+(define-skeleton html-span
+ "HTML span tag."
+ nil
+ "<span>" > _ "</span>")
(define-skeleton html-checkboxes
"Group of connected checkbox inputs."
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index bed8b2fef27..1f185e0f216 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -590,7 +590,7 @@
;; attempt of implementing the table feature to Emacs. This greatly
;; motivated me to follow through to its completion.
;;
-;; Kenichi Handa <handa@etl.go.jp> kindly guided me through to
+;; Kenichi Handa <handa@gnu.org> kindly guided me through to
;; overcome many technical issues while I was struggling with quail
;; related internationalization problems.
;;
@@ -882,7 +882,7 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
(push '(table-mode-indicator (table-fixed-width-mode " Fixed-Table" " Table"))
minor-mode-alist))
-(defconst table-source-languages '(html latex cals)
+(defconst table-source-languages '(html latex cals wiki mediawiki)
"Supported source languages.")
(defvar table-source-info-plist nil
"General storage for temporary information used while generating source.")
@@ -930,16 +930,16 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
;; refill the table cache. If the command were not listed fast
;; typing can cause unwanted cache refill.
(defconst table-cell-bindings
- '(([(control i)] . table-forward-cell)
- ([(control I)] . table-backward-cell)
+ '(([(control ?i)] . table-forward-cell)
+ ([(control ?I)] . table-backward-cell)
([tab] . table-forward-cell)
([(shift backtab)] . table-backward-cell) ; for HPUX console keyboard
([(shift iso-lefttab)] . table-backward-cell) ; shift-tab on a microsoft natural keyboard and redhat linux
([(shift tab)] . table-backward-cell)
([backtab] . table-backward-cell) ; for terminals (e.g., xterm)
([return] . *table--cell-newline)
- ([(control m)] . *table--cell-newline)
- ([(control j)] . *table--cell-newline-and-indent)
+ ([(control ?m)] . *table--cell-newline)
+ ([(control ?j)] . *table--cell-newline-and-indent)
([mouse-3] . *table--present-cell-popup-menu)
([(control ?>)] . table-widen-cell)
([(control ?<)] . table-narrow-cell)
@@ -1202,35 +1202,13 @@ This is always set to nil at the entry to `table-with-cache-buffer' before execu
:help "Move point backward by cell(s)"])
))
-;; XEmacs causes an error when encountering unknown keywords in the
-;; menu definition. Specifically the :help keyword is new in Emacs 21
-;; and causes error for the XEmacs function `check-menu-syntax'. IMHO
-;; it is unwise to generate an error for unknown keywords because it
-;; kills the nice backward compatible extensibility of keyword use.
-;; Unknown keywords should be quietly ignore so that future extension
-;; does not cause a problem in the old implementation. Sigh...
-(when (featurep 'xemacs)
- (defun table--tweak-menu-for-xemacs (menu)
- (cond
- ((listp menu)
- (mapcar #'table--tweak-menu-for-xemacs menu))
- ((vectorp menu)
- (let ((len (length menu)))
- (dotimes (i len)
- ;; replace :help with something harmless.
- (if (eq (aref menu i) :help) (aset menu i :included)))))))
- (mapcar #'table--tweak-menu-for-xemacs
- (list table-global-menu table-cell-menu))
- (defvar mark-active t))
-
;; register table menu under global tools menu
(unless table-disable-menu
- (easy-menu-define table-global-menu-map nil "Table global menu" table-global-menu)
- (if (featurep 'xemacs)
- (progn
- (easy-menu-add-item nil '("Tools") table-global-menu-map))
- (easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--")
- (easy-menu-add-item (current-global-map) '("menu-bar" "tools") table-global-menu-map)))
+ (easy-menu-define table-global-menu-map nil
+ "Table global menu" table-global-menu)
+ (easy-menu-add-item (current-global-map) '("menu-bar" "tools") "--")
+ (easy-menu-add-item (current-global-map)
+ '("menu-bar" "tools") table-global-menu-map))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -1310,8 +1288,8 @@ the last cache point coordinate."
;; set up the update timer unless it is explicitly inhibited.
(unless table-inhibit-update
(table--update-cell)))))
-(if (or (featurep 'xemacs)
- (null (fboundp 'font-lock-add-keywords))) nil
+(if (null (fboundp 'font-lock-add-keywords))
+ nil
;; Color it as a keyword.
(font-lock-add-keywords
'emacs-lisp-mode
@@ -2046,8 +2024,6 @@ plain text and loses all the table specific features."
(erase-buffer)
(table--insert-rectangle rectangle)))))
(restore-buffer-modified-p modified-flag))
- (if (featurep 'xemacs)
- (table--warn-incompatibility))
cell)))
;;;###autoload
@@ -3077,7 +3053,11 @@ CALS (DocBook DTD):
(table-put-source-info 'row-type (if (zerop table-cals-thead-rows) "tbody" "thead"))
(set-marker-insertion-type (table-get-source-info 'colspec-marker) nil) ;; insert after
(insert (format " <%s valign=\"top\">\n" (table-get-source-info 'row-type))))
- )))
+ ((eq language 'mediawiki)
+ (insert (format
+ "<!-- This HTML table template is generated by Emacs %s -->\n"
+ emacs-version))
+ (insert "{|\n")))))
(defun table--generate-source-epilogue (dest-buffer language _col-list _row-list)
"Generate and insert source epilogue into DEST-BUFFER."
@@ -3094,7 +3074,8 @@ CALS (DocBook DTD):
(dolist (col (sort (table-get-source-info 'colnum-list) '<))
(insert (format " <colspec colnum=\"%d\" colname=\"c%d\"/>\n" col col))))
(insert (format " </%s>\n </tgroup>\n</table>\n" (table-get-source-info 'row-type))))
- )))
+ ((eq language 'mediawiki)
+ (insert "|}\n")))))
(defun table--generate-source-scan-rows (dest-buffer language _origin-cell col-list row-list)
"Generate and insert source rows into DEST-BUFFER."
@@ -3106,7 +3087,11 @@ CALS (DocBook DTD):
(insert " <tr>\n"))
((eq language 'cals)
(insert " <row>\n"))
- ))
+ ((eq language 'wiki)
+ (insert "|"))
+ ((and (eq language 'mediawiki)
+ (> (table-get-source-info 'current-row) 1))
+ (insert "|-\n"))))
(table--generate-source-cells-in-a-row dest-buffer language col-list row-list)
(with-current-buffer dest-buffer
(cond
@@ -3116,7 +3101,9 @@ CALS (DocBook DTD):
(insert " </row>\n")
(unless (/= (table-get-source-info 'current-row) table-cals-thead-rows)
(insert (format " </%s>\n" (table-get-source-info 'row-type)))
- (insert (format " <%s valign=\"top\">\n" (table-put-source-info 'row-type "tbody")))))))
+ (insert (format " <%s valign=\"top\">\n" (table-put-source-info 'row-type "tbody")))))
+ ((eq language 'wiki)
+ (insert "|\n"))))
(table-put-source-info 'current-row (1+ (table-get-source-info 'current-row)))
(setq row-list (cdr row-list))))
@@ -3185,7 +3172,8 @@ CALS (DocBook DTD):
(not (memq valign '(top none))))
(insert " valign=\"" (symbol-name valign) "\""))
(insert ">\n"))
- ))
+ ((memq language '(wiki mediawiki))
+ (insert "|"))))
(table--generate-source-cell-contents dest-buffer language cell)
(with-current-buffer dest-buffer
(cond
@@ -3193,7 +3181,10 @@ CALS (DocBook DTD):
(insert (format" </%s>\n" (table-get-source-info 'cell-type))))
((eq language 'cals)
(insert " </entry>\n"))
- ))
+ ((eq language 'wiki)
+ (insert "|"))
+ ((eq language 'mediawiki)
+ (insert ?\n))))
(table-forward-cell 1 t)
(table-put-source-info 'current-column (table-get-source-info 'next-column))
))))
@@ -3232,11 +3223,12 @@ CALS (DocBook DTD):
(with-current-buffer dest-buffer
(let ((beg (point)))
(insert cell-contents)
- (indent-rigidly beg (point)
- (cond
- ((eq language 'html) 6)
- ((eq language 'cals) 10)))
- (insert ?\n)))))
+ (when (memq language '(html cals))
+ (indent-rigidly beg (point)
+ (cond
+ ((eq language 'html) 6)
+ ((eq language 'cals) 10)))
+ (insert ?\n))))))
(defun table--cell-horizontal-char-p (c)
"Test if character C is one of the horizontal characters"
@@ -3878,9 +3870,7 @@ converts a table into plain text without frames. It is a companion to
;; Add menu for table cells.
(unless table-disable-menu
(easy-menu-define table-cell-menu-map table-cell-map
- "Table cell menu" table-cell-menu)
- (if (featurep 'xemacs)
- (easy-menu-add table-cell-menu)))
+ "Table cell menu" table-cell-menu))
(run-hooks 'table-cell-map-hook))
;; Create the keymap after running the user init file so that the user
@@ -4093,7 +4083,7 @@ When the optional parameter NOW is nil it only sets up the update
timer. If it is non-nil the function copies the contents of the cell
cache buffer into the designated cell in the table buffer."
(if (null table-update-timer) nil
- (table--cancel-timer table-update-timer)
+ (cancel-timer table-update-timer)
(setq table-update-timer nil))
(if (or (not now)
(and (boundp 'quail-converting)
@@ -4136,7 +4126,7 @@ cache buffer into the designated cell in the table buffer."
(defun table--update-cell-widened (&optional now)
"Update the contents of the cells that are affected by widening operation."
(if (null table-widen-timer) nil
- (table--cancel-timer table-widen-timer)
+ (cancel-timer table-widen-timer)
(setq table-widen-timer nil))
(if (not now)
(setq table-widen-timer
@@ -4175,7 +4165,7 @@ cache buffer into the designated cell in the table buffer."
(defun table--update-cell-heightened (&optional now)
"Update the contents of the cells that are affected by heightening operation."
(if (null table-heighten-timer) nil
- (table--cancel-timer table-heighten-timer)
+ (cancel-timer table-heighten-timer)
(setq table-heighten-timer nil))
(if (not now)
(setq table-heighten-timer
@@ -4270,10 +4260,6 @@ cdr is the history symbol."
(read-from-minibuffer
(format "%s (default %s): " (car prompt-history) default)
"" nil nil (cdr prompt-history) default))
- (and (featurep 'xemacs)
- (equal (car (symbol-value (cdr prompt-history))) "")
- (set (cdr prompt-history)
- (cdr (symbol-value (cdr prompt-history)))))
(car (symbol-value (cdr prompt-history))))
(defun table--buffer-substring-and-trim (beg end)
@@ -4584,10 +4570,7 @@ of line."
(defun table--untabify (beg end)
"Wrapper to raw untabify."
- (untabify beg end)
- (if (featurep 'xemacs)
- ;; Cancel strange behavior of xemacs
- (message "")))
+ (untabify beg end))
(defun table--multiply-string (string multiplier)
"Multiply string and return it."
@@ -5208,9 +5191,7 @@ instead of the current buffer and returns the OBJECT."
(defun table--update-cell-face ()
"Update cell face according to the current mode."
- (if (featurep 'xemacs)
- (set-face-property 'table-cell 'underline table-fixed-width-mode)
- (set-face-inverse-video 'table-cell table-fixed-width-mode)))
+ (set-face-inverse-video 'table-cell table-fixed-width-mode))
(table--update-cell-face)
@@ -5263,27 +5244,12 @@ This feature is disabled when `table-disable-incompatibility-warning'
is non-nil. The warning is done only once per session for each item."
(unless (and table-disable-incompatibility-warning
(not (called-interactively-p 'interactive)))
- (cond ((and (featurep 'xemacs)
- (not (get 'table-disable-incompatibility-warning 'xemacs)))
- (put 'table-disable-incompatibility-warning 'xemacs t)
- (display-warning 'table
- "
-*** Warning ***
-
-Table package mostly works fine under XEmacs, however, due to the
-peculiar implementation of text property under XEmacs, cell splitting
-and any undo operation of table exhibit some known strange problems,
-such that a border characters dissolve into adjacent cells. Please be
-aware of this.
-
-"
- :warning))
- ((and (boundp 'flyspell-mode)
- flyspell-mode
- (not (get 'table-disable-incompatibility-warning 'flyspell)))
- (put 'table-disable-incompatibility-warning 'flyspell t)
- (display-warning 'table
- "
+ (when (and (boundp 'flyspell-mode)
+ flyspell-mode
+ (not (get 'table-disable-incompatibility-warning 'flyspell)))
+ (put 'table-disable-incompatibility-warning 'flyspell t)
+ (display-warning 'table
+ "
*** Warning ***
Flyspell minor mode is known to be incompatible with this table
@@ -5291,8 +5257,7 @@ package. The flyspell version 1.5d at URL `http://kaolin.unice.fr/~serrano'
works better than the previous versions however not fully compatible.
"
- :warning))
- )))
+ :warning))))
(defun table--cell-blank-str (&optional n)
"Return blank table cell string of length N."
@@ -5338,7 +5303,6 @@ Current buffer must already be set to the cache buffer."
(setq justify (or justify table-cell-info-justify))
(and justify
(not (eq justify 'left))
- (not (featurep 'xemacs))
(set-marker-insertion-type marker-point t))
(table--remove-eol-spaces (point-min) (point-max))
(if table-fixed-width-mode
@@ -5486,19 +5450,7 @@ It returns COLUMN unless STR contains some wide characters."
(defun table--set-timer (seconds func args)
"Generic wrapper for setting up a timer."
- (if (featurep 'xemacs)
- ;; the picky xemacs refuses to accept zero
- (add-timeout (if (zerop seconds) 0.01 seconds) func args nil)
- ;;(run-at-time seconds nil func args)))
- ;; somehow run-at-time causes strange problem under Emacs 20.7
- ;; this problem does not show up under Emacs 21.0.90
- (run-with-idle-timer seconds nil func args)))
-
-(defun table--cancel-timer (timer)
- "Generic wrapper for canceling a timer."
- (if (featurep 'xemacs)
- (disable-timeout timer)
- (cancel-timer timer)))
+ (run-with-idle-timer seconds nil func args))
(defun table--get-last-command ()
"Generic wrapper for getting the real last command."
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 479bcbe975a..91c580adec4 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -251,7 +251,7 @@ Normally set to either `plain-tex-mode' or `latex-mode'."
:type 'boolean
:group 'tex
:version "23.1")
-(put 'tex-fontify-script 'safe-local-variable 'booleanp)
+(put 'tex-fontify-script 'safe-local-variable #'booleanp)
(defcustom tex-font-script-display '(-0.2 0.2)
"How much to lower and raise subscript and superscript content.
@@ -601,9 +601,9 @@ An alternative value is \" . \", if you use a font with a narrow period."
(list (concat slash citations opt arg) 3 'font-lock-constant-face)
;;
;; Text between `` quotes ''.
- (cons (concat (regexp-opt `("``" "\"<" "\"`" "<<" "«") t)
+ (cons (concat (regexp-opt '("``" "\"<" "\"`" "<<" "«") t)
"[^'\">{]+" ;a bit pessimistic
- (regexp-opt `("''" "\">" "\"'" ">>" "»") t))
+ (regexp-opt '("''" "\">" "\"'" ">>" "»") t))
'font-lock-string-face)
;;
;; Command names, special and general.
@@ -670,7 +670,7 @@ An alternative value is \" . \", if you use a font with a narrow period."
(defvar tex-verbatim-environments
'("verbatim" "verbatim*"))
(put 'tex-verbatim-environments 'safe-local-variable
- (lambda (x) (null (delq t (mapcar #'stringp x)))))
+ (lambda (x) (not (memq nil (mapcar #'stringp x)))))
(eval-when-compile
(defconst tex-syntax-propertize-rules
@@ -713,9 +713,6 @@ An alternative value is \" . \", if you use a font with a narrow period."
(define-minor-mode latex-electric-env-pair-mode
"Toggle Latex Electric Env Pair mode.
-With a prefix argument ARG, enable the mode if ARG is positive,
-and disable it otherwise. If called from Lisp, enable it if ARG
-is omitted or nil.
Latex Electric Env Pair mode is a buffer-local minor mode for use
with `latex-mode'. When enabled, typing a \\begin or \\end tag
@@ -1173,7 +1170,7 @@ subshell is initiated, `tex-shell-hook' is run."
(setq-local fill-indent-according-to-mode t)
(add-hook 'completion-at-point-functions
#'latex-complete-data nil 'local)
- (add-hook 'flymake-diagnostic-functions 'tex-chktex nil t)
+ (add-hook 'flymake-diagnostic-functions #'tex-chktex nil t)
(setq-local outline-regexp latex-outline-regexp)
(setq-local outline-level #'latex-outline-level)
(setq-local forward-sexp-function #'latex-forward-sexp)
@@ -1264,8 +1261,8 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
(setq-local comment-start-skip
"\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")
(setq-local parse-sexp-ignore-comments t)
- (setq-local compare-windows-whitespace 'tex-categorize-whitespace)
- (setq-local facemenu-add-face-function 'tex-facemenu-add-face-function)
+ (setq-local compare-windows-whitespace #'tex-categorize-whitespace)
+ (setq-local facemenu-add-face-function #'tex-facemenu-add-face-function)
(setq-local facemenu-end-add-face "}")
(setq-local facemenu-remove-face-function t)
(setq-local font-lock-defaults
@@ -1594,7 +1591,7 @@ Puts point on a blank line between them."
(defvar latex-complete-bibtex-cache nil)
(define-obsolete-function-alias 'latex-string-prefix-p
- 'string-prefix-p "24.3")
+ #'string-prefix-p "24.3")
(defvar bibtex-reference-key)
(declare-function reftex-get-bibfile-list "reftex-cite.el" ())
@@ -1659,7 +1656,7 @@ Puts point on a blank line between them."
(let ((pt (point)))
(skip-chars-backward "^ {}\n\t\\\\")
(pcase (char-before)
- ((or `nil ?\s ?\n ?\t ?\}) nil)
+ ((or 'nil ?\s ?\n ?\t ?\}) nil)
(?\\
;; TODO: Complete commands.
nil)
@@ -2112,7 +2109,7 @@ If NOT-ALL is non-nil, save the `.dvi' file."
(delete-file (concat dir (car list))))
(setq list (cdr list))))))
-(add-hook 'kill-emacs-hook 'tex-delete-last-temp-files)
+(add-hook 'kill-emacs-hook #'tex-delete-last-temp-files)
;;
;; Machinery to guess the command that the user wants to execute.
@@ -2171,7 +2168,7 @@ IN can be either a string (with the same % escapes in it) indicating
OUT describes the output file and is either a %-escaped string
or nil to indicate that there is no output file.")
-(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.3")
+(define-obsolete-function-alias 'tex-string-prefix-p #'string-prefix-p "24.3")
(defun tex-guess-main-file (&optional all)
"Find a likely `tex-main-file'.
@@ -2266,9 +2263,11 @@ FILE is typically the output DVI or PDF file."
(> (save-excursion
;; Usually page numbers are output as [N], but
;; I've already seen things like
- ;; [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
- (or (re-search-backward "\\[[0-9]+\\({[^}]*}\\)?\\]"
- nil t)
+ ;; [N{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}]
+ ;; as well as [N.N] (e.g. with 'acmart' style).
+ (or (re-search-backward
+ "\\[[0-9]+\\({[^}]*}\\|\\.[0-9]+\\)?\\]"
+ nil t)
(point-min)))
(save-excursion
(or (re-search-backward "Rerun" nil t)
@@ -2804,9 +2803,19 @@ Runs the shell command defined by `tex-show-queue-command'."
(defvar tex-indent-basic 2)
(defvar tex-indent-item tex-indent-basic)
(defvar tex-indent-item-re "\\\\\\(bib\\)?item\\>")
-(defvar latex-noindent-environments '("document"))
-(put 'latex-noindent-environments 'safe-local-variable
- (lambda (x) (null (delq t (mapcar #'stringp x)))))
+(defcustom latex-noindent-environments '("document")
+ "Environments whose content is not indented by `tex-indent-basic'."
+ :type '(repeat string)
+ :safe (lambda (x) (not (memq nil (mapcar #'stringp x))))
+ :group 'tex-file
+ :version "27.1")
+
+(defcustom latex-noindent-commands '("emph" "footnote")
+ "Commands for which `tex-indent-basic' should not be used."
+ :type '(repeat string)
+ :safe (lambda (x) (not (memq nil (mapcar #'stringp x))))
+ :group 'tex-file
+ :version "27.1")
(defvar tex-latex-indent-syntax-table
(let ((st (make-syntax-table tex-mode-syntax-table)))
@@ -2913,9 +2922,17 @@ There might be text before point."
(current-column)
;; We're the first element after a hanging brace.
(goto-char up-list-pos)
- (+ (if (and (looking-at "\\\\begin *{\\([^\n}]+\\)")
+ (+ (if (if (eq (char-after) ?\{)
+ (save-excursion
+ (skip-chars-backward " \t")
+ (let ((end (point)))
+ (skip-chars-backward "a-zA-Z")
+ (and (eq (char-before) ?\\)
+ (member (buffer-substring (point) end)
+ latex-noindent-commands))))
+ (and (looking-at "\\\\begin *{\\([^\n}]+\\)")
(member (match-string 1)
- latex-noindent-environments))
+ latex-noindent-environments)))
0 tex-indent-basic)
indent (latex-find-indent 'virtual))))
;; We're now at the "beginning" of a line.
@@ -2995,8 +3012,8 @@ There might be text before point."
(mapcar
(lambda (x)
(pcase (car-safe x)
- (`font-lock-syntactic-face-function
- (cons (car x) 'doctex-font-lock-syntactic-face-function))
+ ('font-lock-syntactic-face-function
+ (cons (car x) #'doctex-font-lock-syntactic-face-function))
(_ x)))
(cdr font-lock-defaults))))
(setq-local syntax-propertize-function
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index 0e65b1c4e20..3c32037c3ef 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -3,7 +3,7 @@
;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2019 Free Software
;; Foundation, Inc.
-;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org>
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: maint, tex, docs
;; This file is part of GNU Emacs.
@@ -552,13 +552,7 @@ if large. You can use `Info-split' to do this manually."
(defvar texinfo-accent-commands
(concat
- "@^\\|"
- "@`\\|"
- "@'\\|"
- "@\"\\|"
- "@,\\|"
- "@=\\|"
- "@~\\|"
+ "@[\"',=^`~]\\|"
"@OE{\\|"
"@oe{\\|"
"@AA{\\|"
@@ -1292,8 +1286,7 @@ otherwise, insert URL-TITLE followed by URL in parentheses."
;; if url-title
(if (nth 1 args)
(insert (nth 1 args) " (" (nth 0 args) ")")
- (insert "`" (nth 0 args) "'"))
- (goto-char texinfo-command-start)))
+ (insert "`" (nth 0 args) "'"))))
;;; Section headings
@@ -2447,7 +2440,7 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image."
(defun texinfo-format-option ()
"Insert \\=` ... \\=' around arg unless inside a table; in that case, no quotes."
;; `looking-at-backward' not available in v. 18.57, 20.2
- (if (not (search-backward "" ; searched-for character is a control-H
+ (if (not (search-backward "\^H"
(line-beginning-position)
t))
(insert "`" (texinfo-parse-arg-discard) "'")
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index f6aa8727410..71cdcab57ef 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -470,6 +470,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
(define-key map "\C-c\C-cu" 'texinfo-insert-@uref)
(define-key map "\C-c\C-ct" 'texinfo-insert-@table)
(define-key map "\C-c\C-cs" 'texinfo-insert-@samp)
+ (define-key map "\C-c\C-cr" 'texinfo-insert-dwim-@ref)
(define-key map "\C-c\C-cq" 'texinfo-insert-@quotation)
(define-key map "\C-c\C-co" 'texinfo-insert-@noindent)
(define-key map "\C-c\C-cn" 'texinfo-insert-@node)
@@ -596,9 +597,9 @@ value of `texinfo-mode-hook'."
(setq-local require-final-newline mode-require-final-newline)
(setq-local indent-tabs-mode nil)
(setq-local paragraph-separate
- (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
+ (concat "@[a-zA-Z]*[ \n]\\|"
paragraph-separate))
- (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|"
+ (setq-local paragraph-start (concat "@[a-zA-Z]*[ \n]\\|"
paragraph-start))
(setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
(setq-local fill-column 70)
@@ -610,7 +611,6 @@ value of `texinfo-mode-hook'."
(setq font-lock-defaults
'(texinfo-font-lock-keywords nil nil nil backward-paragraph))
(setq-local syntax-propertize-function texinfo-syntax-propertize-function)
- (setq-local parse-sexp-lookup-properties t)
(setq-local add-log-current-defun-function #'texinfo-current-defun-name)
;; Outline settings.
@@ -826,6 +826,38 @@ Leave point after `@node'."
"Insert the string `@quotation' in a Texinfo buffer."
\n "@quotation" \n _ \n)
+(define-skeleton texinfo-insert-dwim-@ref
+ "Insert appropriate `@pxref{...}', `@xref{}', or `@ref{}' command.
+
+Looks at text around point to decide what to insert; an unclosed
+preceding open parenthesis results in '@pxref{}', point at the
+beginning of a sentence or at (point-min) yields '@xref{}', any
+other location (including inside a word), will result in '@ref{}'
+at the nearest previous whitespace or beginning-of-line. A
+numeric argument says how many words the braces should surround.
+The default is not to surround any existing words with the
+braces."
+ nil
+ (cond
+ ;; parenthesis
+ ((looking-back "([^)]*" (point-at-bol 0))
+ "@pxref{")
+ ;; beginning of sentence or buffer
+ ((or (looking-back (sentence-end) (point-at-bol 0))
+ (= (point) (point-min)))
+ "@xref{")
+ ;; bol or eol
+ ((looking-at "^\\|$")
+ "@ref{")
+ ;; inside word
+ ((not (eq (char-syntax (char-after)) ? ))
+ (skip-syntax-backward "^ " (point-at-bol))
+ "@ref{")
+ ;; everything else
+ (t
+ "@ref{"))
+ _ "}")
+
(define-skeleton texinfo-insert-@samp
"Insert a `@samp{...}' command in a Texinfo buffer.
A numeric argument says how many words the braces should surround.
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index 8c6e23eae4a..134f82b14e0 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -3,7 +3,7 @@
;; Copyright (C) 1989-1992, 2001-2019 Free Software Foundation, Inc.
;; Author: Robert J. Chassell
-;; Maintainer: bug-texinfo@gnu.org
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: maint, tex, docs
;; This file is part of GNU Emacs.
@@ -642,7 +642,7 @@ appears in the texinfo file."
"Return description field of old menu line as string.
Point must be located just after the node name. Point left before description.
Single argument, END-OF-MENU, is position limiting search."
- (skip-chars-forward "[:.,\t\n ]+")
+ (skip-chars-forward ":.,\t\n ")
;; don't copy a carriage return at line beginning with asterisk!
;; don't copy @detailmenu or @end menu or @ignore as descriptions!
;; do copy a description that begins with an `@'!
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 931faadb5bb..e676a5dae20 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -1,4 +1,4 @@
-;;; text-mode.el --- text mode, and its idiosyncratic commands
+;;; text-mode.el --- text mode, and its idiosyncratic commands -*- lexical-binding: t -*-
;; Copyright (C) 1985, 1992, 1994, 2001-2019 Free Software Foundation,
;; Inc.
@@ -38,8 +38,8 @@
:group 'text)
(defvar text-mode-variant nil
- "Non-nil if this buffer's major mode is a variant of Text mode.
-Use (derived-mode-p \\='text-mode) instead.")
+ "Non-nil if this buffer's major mode is a variant of Text mode.")
+(make-obsolete-variable 'text-mode-variant 'derived-mode-p "27.1")
(defvar text-mode-syntax-table
(let ((st (make-syntax-table)))
@@ -104,10 +104,8 @@ You can thus get the full benefit of adaptive filling
(see the variable `adaptive-fill-mode').
\\{text-mode-map}
Turning on Text mode runs the normal hook `text-mode-hook'."
- (set (make-local-variable 'text-mode-variant) t)
- (set (make-local-variable 'require-final-newline)
- mode-require-final-newline)
- (set (make-local-variable 'indent-line-function) 'indent-relative))
+ (setq-local text-mode-variant t)
+ (setq-local require-final-newline mode-require-final-newline))
(define-derived-mode paragraph-indent-text-mode text-mode "Parindent"
"Major mode for editing text, with leading spaces starting a paragraph.
@@ -131,14 +129,12 @@ Turning on Paragraph-Indent minor mode runs the normal hook
:initial-value nil
;; Change the definition of a paragraph start.
(let ((ps-re "[ \t\n\f]\\|"))
- (if (eq t (compare-strings ps-re nil nil
- paragraph-start nil (length ps-re)))
+ (if (string-prefix-p ps-re paragraph-start)
(if (not paragraph-indent-minor-mode)
- (set (make-local-variable 'paragraph-start)
- (substring paragraph-start (length ps-re))))
+ (setq-local paragraph-start
+ (substring paragraph-start (length ps-re))))
(if paragraph-indent-minor-mode
- (set (make-local-variable 'paragraph-start)
- (concat ps-re paragraph-start)))))
+ (setq-local paragraph-start (concat ps-re paragraph-start)))))
;; Change the indentation function.
(if paragraph-indent-minor-mode
(add-function :override (local 'indent-line-function)
@@ -154,7 +150,7 @@ Turning on Paragraph-Indent minor mode runs the normal hook
(defun text-mode-hook-identify ()
"Mark that this mode has run `text-mode-hook'.
This is how `toggle-text-mode-auto-fill' knows which buffers to operate on."
- (set (make-local-variable 'text-mode-variant) t))
+ (setq-local text-mode-variant t))
(defun toggle-text-mode-auto-fill ()
"Toggle whether to use Auto Fill in Text mode and related modes.
@@ -163,8 +159,8 @@ both existing buffers and buffers that you subsequently create."
(interactive)
(let ((enable-mode (not (memq 'turn-on-auto-fill text-mode-hook))))
(if enable-mode
- (add-hook 'text-mode-hook 'turn-on-auto-fill)
- (remove-hook 'text-mode-hook 'turn-on-auto-fill))
+ (add-hook 'text-mode-hook #'turn-on-auto-fill)
+ (remove-hook 'text-mode-hook #'turn-on-auto-fill))
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(if (or (derived-mode-p 'text-mode) text-mode-variant)
@@ -214,15 +210,14 @@ The argument NLINES says how many lines to center."
(while (not (eq nlines 0))
(save-excursion
(let ((lm (current-left-margin))
- line-length)
+ space)
(beginning-of-line)
(delete-horizontal-space)
(end-of-line)
(delete-horizontal-space)
- (setq line-length (current-column))
- (if (> (- fill-column lm line-length) 0)
- (indent-line-to
- (+ lm (/ (- fill-column lm line-length) 2))))))
+ (setq space (- fill-column lm (current-column)))
+ (if (> space 0)
+ (indent-line-to (+ lm (/ space 2))))))
(cond ((null nlines)
(setq nlines 0))
((> nlines 0)
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index cf33d44ed3c..ccbc2b086c6 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -261,7 +261,9 @@ Call CALLBACK on each region outside of environment to ignore. Stop scanning
the region as soon as CALLBACK returns nil. Environments to ignore are
defined by deprecated `tildify-ignored-environments-alist'. CALLBACK may be
called on portions of the buffer outside of [BEG END)."
- (let ((pairs (tildify--pick-alist-entry tildify-ignored-environments-alist)))
+ (let ((pairs (with-suppressed-warnings ((obsolete tildify--pick-alist-entry))
+ (tildify--pick-alist-entry
+ tildify-ignored-environments-alist))))
(if pairs
(tildify-foreach-ignore-environments pairs callback beg end)
(funcall callback beg end))))
@@ -355,7 +357,9 @@ replacements done and response is one of symbols: t (all right), nil
(goto-char beg)
(let ((regexp tildify-pattern)
(match-number 1)
- (tilde (or (tildify--pick-alist-entry tildify-string-alist)
+ (tilde (or (with-suppressed-warnings ((obsolete
+ tildify--pick-alist-entry))
+ (tildify--pick-alist-entry tildify-string-alist))
tildify-space-string))
(end-marker (copy-marker end))
answer
@@ -365,7 +369,9 @@ replacements done and response is one of symbols: t (all right), nil
(message-log-max nil)
(count 0))
;; For the time being, tildify-pattern-alist overwrites tildify-pattern
- (let ((alist (tildify--pick-alist-entry tildify-pattern-alist)))
+ (let ((alist (with-suppressed-warnings ((obsolete
+ tildify--pick-alist-entry))
+ (tildify--pick-alist-entry tildify-pattern-alist))))
(when alist
(setq regexp (car alist) match-number (cadr alist))))
(while (and (not quit)
@@ -491,7 +497,9 @@ representation for current major mode, the `tildify-space-string' buffer-local
variable will be set to the representation."
nil " ~" nil
(when tildify-mode
- (let ((space (tildify--pick-alist-entry tildify-string-alist)))
+ (let ((space (with-suppressed-warnings ((obsolete
+ tildify--pick-alist-entry))
+ (tildify--pick-alist-entry tildify-string-alist))))
(if (not (string-equal " " (or space tildify-space-string)))
(when space
(setq tildify-space-string space))
diff --git a/lisp/textmodes/underline.el b/lisp/textmodes/underline.el
index e0bfd24557b..6d359f1d69b 100644
--- a/lisp/textmodes/underline.el
+++ b/lisp/textmodes/underline.el
@@ -1,4 +1,4 @@
-;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
+;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs -*- lexical-binding: t -*-
;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.