summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el10
-rw-r--r--lisp/textmodes/bibtex.el112
-rw-r--r--lisp/textmodes/css-mode.el225
-rw-r--r--lisp/textmodes/dns-mode.el2
-rw-r--r--lisp/textmodes/enriched.el23
-rw-r--r--lisp/textmodes/fill.el21
-rw-r--r--lisp/textmodes/flyspell.el23
-rw-r--r--lisp/textmodes/ispell.el184
-rw-r--r--lisp/textmodes/mhtml-mode.el2
-rw-r--r--lisp/textmodes/nroff-mode.el10
-rw-r--r--lisp/textmodes/page-ext.el101
-rw-r--r--lisp/textmodes/paragraphs.el3
-rw-r--r--lisp/textmodes/refill.el3
-rw-r--r--lisp/textmodes/reftex-ref.el2
-rw-r--r--lisp/textmodes/reftex-vars.el6
-rw-r--r--lisp/textmodes/remember.el10
-rw-r--r--lisp/textmodes/rst.el55
-rw-r--r--lisp/textmodes/sgml-mode.el40
-rw-r--r--lisp/textmodes/tex-mode.el25
-rw-r--r--lisp/textmodes/texinfmt.el2
-rw-r--r--lisp/textmodes/texinfo.el5
21 files changed, 529 insertions, 335 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index af7bcc77cdf..940a78ae92d 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -351,13 +351,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 +1198,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 +1400,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 ()
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 6294b8026ce..57e5ef8017a 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.
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 62dca463ae3..31ce638b316 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -32,12 +32,14 @@
;;; Code:
-(require 'eww)
(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
@@ -808,6 +810,7 @@ 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)
+ (define-key map "\C-c\C-f" 'css-cycle-color-format)
map)
"Keymap used in `css-mode'.")
@@ -898,7 +901,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 "\\)\\|"
@@ -938,11 +941,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)
@@ -952,11 +957,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)
@@ -968,7 +973,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.
@@ -1039,9 +1048,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.
@@ -1203,7 +1218,8 @@ for determining whether point is within a selector."
(pcase (cons kind token)
(`(:elem . basic) css-indent-offset)
(`(:elem . arg) 0)
- (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467).
+ ;; "" stands for BOB (bug#15467).
+ (`(:list-intro . ,(or `";" `"" `":-property")) t)
(`(:before . "{")
(when (or (smie-rule-hanging-p) (smie-rule-bolp))
(smie-backward-sexp ";")
@@ -1385,6 +1401,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 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).
@@ -1423,7 +1604,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)
@@ -1520,12 +1707,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 7223d525fa2..87ae35d17be 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)
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index b9d247132dc..f2065cbff90 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 8422f0e1dd2..08e975f2355 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 4d7a18969e6..37f2245eded 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)
@@ -506,9 +514,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
@@ -985,6 +990,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 +1160,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 e77bc7e1128..87bcb5d651a 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -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)
@@ -814,16 +817,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))
@@ -1180,6 +1173,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.
@@ -1202,9 +1201,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.
@@ -1412,80 +1413,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))
;;; **********************************************************************
@@ -1827,11 +1826,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)
@@ -3705,9 +3702,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
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index b99f788156c..552fcd38b04 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -22,6 +22,7 @@
;;; Code:
(eval-and-compile
+ (require 'cl-lib)
(require 'flyspell)
(require 'sgml-mode))
(require 'js)
@@ -364,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 9c846292f1e..51a9f5820d8 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 61f02190065..92fce4d364b 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-2018 Free Software
;; Foundation, Inc.
@@ -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,23 +259,19 @@
(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
@@ -311,19 +304,21 @@ With arg (prefix if interactive), move that many pages."
(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))
@@ -415,9 +410,9 @@ Point is left in the body of page."
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
@@ -463,25 +458,27 @@ 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-m" '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 [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"
"Default page delimiter.")
@@ -512,6 +509,9 @@ resets the page-delimiter to the original value."
;;; 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 +573,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 +643,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 +696,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 +716,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
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 3e2784ca953..ee812566b9a 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -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
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index 1252afe4172..229d6a24ddd 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -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-ref.el b/lisp/textmodes/reftex-ref.el
index 98fb8f5d700..eb8d98c84be 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -314,7 +314,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
(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 11dbb8d5705..e7fe8ffe660 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1030,7 +1030,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 +1042,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 7f4c9b0b24a..83bfc79d6a4 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 b1b4f1073eb..126804fdab2 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)
@@ -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 eb6ebf52807..470f4a348ac 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -76,6 +76,8 @@ a DOCTYPE or an XML declaration."
:version "22.1"
:group 'sgml)
+(defvaralias 'sgml-transformation 'sgml-transformation-function)
+
(defcustom sgml-transformation-function 'identity
"Default value for `skeleton-transformation-function' in SGML mode."
:type 'function
@@ -92,7 +94,6 @@ a DOCTYPE or an XML declaration."
(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'.
@@ -618,7 +619,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 `/'.
@@ -940,9 +941,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
@@ -1241,8 +1239,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)
@@ -1250,14 +1251,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][0-9a-fA-F]+\\)\\)\\)\\([][<>&;\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)
@@ -2232,6 +2242,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'."
@@ -2363,9 +2376,6 @@ 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
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index c65b3b3ea2d..8b0677754f3 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -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" ())
@@ -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)
@@ -2996,7 +2995,7 @@ There might be text before point."
(lambda (x)
(pcase (car-safe x)
(`font-lock-syntactic-face-function
- (cons (car x) 'doctex-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 d6f451a1ab5..e89da6527cb 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -2447,7 +2447,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 c2ceee6e6b7..ff723a4fb94 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -596,9 +596,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 +610,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.