summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el9
-rw-r--r--lisp/textmodes/bib-mode.el2
-rw-r--r--lisp/textmodes/bibtex.el21
-rw-r--r--lisp/textmodes/conf-mode.el14
-rw-r--r--lisp/textmodes/css-mode.el63
-rw-r--r--lisp/textmodes/enriched.el3
-rw-r--r--lisp/textmodes/etc-authors-mode.el135
-rw-r--r--lisp/textmodes/fill.el12
-rw-r--r--lisp/textmodes/flyspell.el57
-rw-r--r--lisp/textmodes/ispell.el83
-rw-r--r--lisp/textmodes/makeinfo.el7
-rw-r--r--lisp/textmodes/mhtml-mode.el2
-rw-r--r--lisp/textmodes/page-ext.el2
-rw-r--r--lisp/textmodes/picture.el14
-rw-r--r--lisp/textmodes/refbib.el2
-rw-r--r--lisp/textmodes/refill.el2
-rw-r--r--lisp/textmodes/reftex-cite.el14
-rw-r--r--lisp/textmodes/reftex-dcr.el21
-rw-r--r--lisp/textmodes/reftex-global.el6
-rw-r--r--lisp/textmodes/reftex-index.el18
-rw-r--r--lisp/textmodes/reftex-parse.el20
-rw-r--r--lisp/textmodes/reftex-ref.el10
-rw-r--r--lisp/textmodes/reftex-toc.el6
-rw-r--r--lisp/textmodes/reftex-vars.el25
-rw-r--r--lisp/textmodes/reftex.el9
-rw-r--r--lisp/textmodes/rst.el8
-rw-r--r--lisp/textmodes/sgml-mode.el52
-rw-r--r--lisp/textmodes/table.el27
-rw-r--r--lisp/textmodes/tex-mode.el160
-rw-r--r--lisp/textmodes/texinfmt.el24
-rw-r--r--lisp/textmodes/texinfo.el77
-rw-r--r--lisp/textmodes/texnfo-upd.el8
-rw-r--r--lisp/textmodes/text-mode.el25
-rw-r--r--lisp/textmodes/tildify.el4
34 files changed, 659 insertions, 283 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index d9a83c566b4..25f0c35aa5d 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1277,7 +1277,7 @@ Drawing with keys
\\[artist-key-set-point] Does one of the following:
For lines/rectangles/squares: sets the first/second endpoint
- For poly-lines: sets a point (use C-u \\[artist-key-set-point] to set last point)
+ For poly-lines: sets a point (use \\[universal-argument] \\[artist-key-set-point] to set last point)
When erase characters: toggles erasing
When cutting/copying: Sets first/last endpoint of rect/square
When pasting: Pastes
@@ -2840,9 +2840,8 @@ Returns a list of strings."
(if (memq system-type '(windows-nt ms-dos))
(artist-figlet-get-font-list-windows)
(artist-figlet-get-font-list)))
- (font (completing-read (concat "Select font (default "
- artist-figlet-default-font
- "): ")
+ (font (completing-read (format-prompt "Select font"
+ artist-figlet-default-font)
(mapcar
(lambda (font) (cons font font))
avail-fonts))))
@@ -4891,7 +4890,7 @@ If optional argument STATE is positive, turn borders on."
(+ window-y window-start-y))))
(defun artist--adjust-x (x)
- "Adjust the X position wrt. `display-line-numbers-mode'."
+ "Adjust the X position with regards to `display-line-numbers-mode'."
(let ((adjust (line-number-display-width)))
(if (= adjust 0)
x
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index e2fd3ecaa42..a429aae7f70 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -137,7 +137,7 @@ with the cdr.")
(defcustom bib-auto-capitalize t
- "True to automatically capitalize appropriate fields in Bib mode."
+ "Non-nil to automatically capitalize appropriate fields in Bib mode."
:type 'boolean)
(defconst bib-capitalized-fields "%[AETCBIJR]")
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 31186fb4fac..c06e8bfa1bb 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -113,7 +113,7 @@ page-dashes Change double dashes in page field to single dash
whitespace Delete whitespace at the beginning and end of fields.
inherit-booktitle If entry contains a crossref field and the booktitle
field is empty, set the booktitle field to the content
- of the title field of the crossreferenced entry.
+ of the title field of the cross-referenced entry.
realign Realign entries, so that field texts and perhaps equal
signs (depending on the value of
`bibtex-align-at-equal-sign') begin in the same column.
@@ -1228,9 +1228,9 @@ See `bibtex-generate-autokey' for details."
:type 'integer)
(defcustom bibtex-autokey-use-crossref t
- "If non-nil use fields from crossreferenced entry if necessary.
+ "If non-nil use fields from cross-referenced entry if necessary.
If this variable is non-nil and some field has no entry, but a
-valid crossref entry, the field from the crossreferenced entry is used.
+valid crossref entry, the field from the cross-referenced entry is used.
See `bibtex-generate-autokey' for details."
:group 'bibtex-autokey
:type 'boolean)
@@ -1569,8 +1569,8 @@ Set this variable before loading BibTeX mode."
km)
"Keymap used in BibTeX mode.")
-(easy-menu-define
- bibtex-edit-menu bibtex-mode-map "BibTeX-Edit Menu in BibTeX mode"
+(easy-menu-define bibtex-edit-menu bibtex-mode-map
+ "BibTeX-Edit Menu in BibTeX mode."
'("BibTeX-Edit"
("Moving inside an Entry"
["End of Field" bibtex-find-text t]
@@ -2975,7 +2975,7 @@ The year part:
`bibtex-autokey-year-length' digits (useful values are 2 and 4).
2. If both the year and date fields are absent, but the entry has a
valid crossref field and `bibtex-autokey-use-crossref' is
- non-nil, use the date or year field of the crossreferenced entry
+ non-nil, use the date or year field of the cross-referenced entry
instead.
The title part
@@ -3962,7 +3962,7 @@ Optional arg COMMA is as in `bibtex-enclosing-field'. It is t for
interactive calls."
(interactive (list nil t))
(unless field (setq field (car (bibtex-find-text-internal nil nil comma))))
- (if (string-match "@" field)
+ (if (string-search "@" field)
(cond ((bibtex-string= field "@string")
(message "String definition"))
((bibtex-string= field "@preamble")
@@ -4317,8 +4317,6 @@ for a crossref key, t otherwise."
(eqb (goto-char pos))
(t (set-buffer buffer) (goto-char pos)))
pos))
-;; backward compatibility
-(defalias 'bibtex-find-crossref 'bibtex-search-crossref)
(defun bibtex-dist (pos beg end)
"Return distance between POS and region delimited by BEG and END."
@@ -4381,8 +4379,6 @@ A prefix arg negates the value of `bibtex-search-entry-globally'."
(if display (bibtex-reposition-window)))
(display (message "Key `%s' not found" key)))
pnt)))
-;; backward compatibility
-(defalias 'bibtex-find-entry 'bibtex-search-entry)
(defun bibtex-prepare-new-entry (index)
"Prepare a new BibTeX entry with index INDEX.
@@ -5608,5 +5604,8 @@ If APPEND is non-nil, append ENTRIES to those already displayed."
(setq buffer-read-only t)
(goto-char (point-min)))
+(define-obsolete-function-alias 'bibtex-find-crossref #'bibtex-search-crossref "29.1")
+(define-obsolete-function-alias 'bibtex-find-entry #'bibtex-search-entry "29.1")
+
(provide 'bibtex)
;;; bibtex.el ends here
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 5f34ae152d1..30f8fd0ca91 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -417,12 +417,18 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
;; To tell the difference between those two cases where the function
;; might be called, we check `delay-mode-hooks'.
;; (inspired from tex-mode.el)
+(defvar conf-mode--recursing nil)
(advice-add 'conf-mode :around
(lambda (orig-fun)
"Redirect to one of the submodes when called directly."
- (funcall (if delay-mode-hooks orig-fun (conf--guess-mode)))))
-
-
+ ;; The file may have "mode: conf" in the local variable
+ ;; block, in which case we'll be called recursively
+ ;; infinitely. Inhibit that.
+ (let ((conf-mode--recursing conf-mode--recursing))
+ (funcall (if (or delay-mode-hooks conf-mode--recursing)
+ orig-fun
+ (setq conf-mode--recursing t)
+ (conf--guess-mode))))))
(defun conf-mode-initialize (comment &optional font-lock)
"Initializations for sub-modes of `conf-mode'.
@@ -609,7 +615,7 @@ For details see `conf-mode'. Example:
(conf-mode-initialize "!"))
(defun conf-toml-recognize-section (limit)
- "Font-lock helper function for conf-toml-mode.
+ "Font-lock helper function for `conf-toml-mode'.
Handles recognizing TOML section names, like [section],
\[[section]], or [something.\"else\".section]."
(save-excursion
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 61a2f6b3bc0..e5017a68f78 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -57,7 +57,7 @@
"Identifiers for pseudo-classes.")
(defconst css-pseudo-element-ids
- '("after" "before" "first-letter" "first-line")
+ '("after" "before" "first-letter" "first-line" "selection")
"Identifiers for pseudo-elements.")
(defconst css-at-ids
@@ -274,12 +274,13 @@
("color" color)
("opacity" alphavalue)
- ;; CSS Containment Module Level 1
- ;; (https://www.w3.org/TR/css-contain-1/#property-index)
- ("contain" "none" "strict" "content" "size" "layout" "paint")
+ ;; CSS Containment Module Level 2
+ ;; (https://www.w3.org/TR/css-contain-2/#property-index)
+ ("contain" "none" "strict" "content" "size" "layout" "style" "paint")
+ ("content-visibility" "visible" "auto" "hidden")
- ;; CSS Grid Layout Module Level 1
- ;; (https://www.w3.org/TR/css-grid-1/#property-index)
+ ;; CSS Grid Layout Module Level 2
+ ;; (https://www.w3.org/TR/css-grid-2/#property-index)
("grid" grid-template grid-template-rows "auto-flow" "dense"
grid-auto-columns grid-auto-rows grid-template-columns)
("grid-area" grid-line)
@@ -298,17 +299,32 @@
("grid-template" "none" grid-template-rows grid-template-columns
line-names string track-size line-names explicit-track-list)
("grid-template-areas" "none" string)
- ("grid-template-columns" "none" track-list auto-track-list)
- ("grid-template-rows" "none" track-list auto-track-list)
-
- ;; CSS Flexible Box Layout Module Level 1
- ;; (https://www.w3.org/TR/css-flexbox-1/#property-index)
- ("align-content" "flex-start" "flex-end" "center" "space-between"
- "space-around" "stretch")
- ("align-items" "flex-start" "flex-end" "center" "baseline"
- "stretch")
- ("align-self" "auto" "flex-start" "flex-end" "center" "baseline"
- "stretch")
+ ("grid-template-columns" "none" track-list auto-track-list "subgrid")
+ ("grid-template-rows" "none" track-list auto-track-list "subgrid")
+
+ ;; CSS Box Alignment Module Level 3
+ ;; (https://www.w3.org/TR/css-align-3/#property-index)
+ ("align-content"
+ baseline-position content-distribution overflow-position content-position)
+ ("align-items"
+ "normal" "stretch" baseline-position overflow-position self-position)
+ ("align-self"
+ "auto" "normal" "stretch"
+ baseline-position overflow-position self-position)
+ ("justify-content" "normal"
+ content-distribution overflow-position content-position "left" "right")
+ ("justify-items"
+ "normal" "stretch" baseline-position overflow-position self-position
+ "left" "right" "legacy")
+ ("justify-self"
+ "auto" "normal" "stretch" baseline-position overflow-position self-position
+ "left" "right")
+ ("place-content" align-content justify-content)
+ ("place-items" align-items justify-items)
+ ("place-self" justify-self align-self)
+
+ ;; CSS Flexible Box Layout Module Level 2
+ ;; (https://www.w3.org/TR/css-flexbox-2/#property-index)
("flex" "none" flex-grow flex-shrink flex-basis)
("flex-basis" "auto" "content" width)
("flex-direction" "row" "row-reverse" "column" "column-reverse")
@@ -316,8 +332,6 @@
("flex-grow" number)
("flex-shrink" number)
("flex-wrap" "nowrap" "wrap" "wrap-reverse")
- ("justify-content" "flex-start" "flex-end" "center"
- "space-between" "space-around")
("order" integer)
;; CSS Fonts Module Level 3
@@ -757,6 +771,13 @@ further value candidates, since that list would be infinite.")
(padding-width length percentage)
(position
"left" "center" "right" "top" "bottom" percentage length)
+ (baseline-position "left" "right" "baseline")
+ (content-distribution
+ "space-between" "space-around" "space-evenly" "stretch")
+ (overflow-position "unsafe" "safe")
+ (content-position "center" "start" "end" "flex-start" "flex-end")
+ (self-position
+ "center" "start" "end" "self-start" "self-end" "flex-start" "flex-end")
(radial-gradient "radial-gradient()")
(relative-size "larger" "smaller")
(repeat-style
@@ -1135,7 +1156,7 @@ by `css--colors-regexp'. START-POINT is the start of the color,
and MATCH is the string matched by the regexp.
This function will either return the color, as a hex RGB string;
-or `nil' if no color could be recognized. When this function
+or nil if no color could be recognized. When this function
returns, point will be at the end of the recognized color."
(cond
((eq (aref match 0) ?#)
@@ -1149,7 +1170,7 @@ returns, point will be at the end of the recognized color."
(defcustom css-fontify-colors t
"Whether CSS colors should be fontified using the color as the background.
-When non-`nil', a text representing CSS color will be fontified
+When non-nil, a text representing CSS color will be fontified
such that its background is the color itself. E.g., #ff0000 will
be fontified with a red background."
:version "26.1"
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index 877658a5a55..4a5a5ab3677 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -34,7 +34,7 @@
;; A separate file, enriched.txt, contains further documentation and other
;; important information about this code. It also serves as an example
;; file in text/enriched format. It should be in the etc directory of your
-;; emacs distribution.
+;; Emacs distribution.
;;; Code:
@@ -191,6 +191,7 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
(define-key map "\C-x\t" #'increase-left-margin)
(define-key map "\C-c[" #'set-left-margin)
(define-key map "\C-c]" #'set-right-margin)
+ (define-key map "\M-o" #'facemenu-keymap)
map)
"Keymap for Enriched mode.")
diff --git a/lisp/textmodes/etc-authors-mode.el b/lisp/textmodes/etc-authors-mode.el
new file mode 100644
index 00000000000..8b5fefd3b7d
--- /dev/null
+++ b/lisp/textmodes/etc-authors-mode.el
@@ -0,0 +1,135 @@
+;;; etc-authors-mode.el --- font-locking for etc/AUTHORS -*- lexical-binding: t -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <stefan@marxist.se>
+;; Keywords: internal
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Major mode to display the etc/AUTHORS file from the Emacs
+;; distribution. Provides some basic font locking and not much else.
+
+;;; Code:
+
+(defgroup etc-authors-mode nil
+ "Display the \"etc/AUTHORS\" file from the Emacs distribution."
+ :version "28.1"
+ :group 'internal)
+
+(defface etc-authors-default '((t :inherit variable-pitch))
+ "Default face used to display the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+ :version "28.1")
+
+(defface etc-authors-author '((((class color) (min-colors 88) (background light))
+ :foreground "midnight blue"
+ :weight bold :height 1.05
+ :inherit variable-pitch)
+ (((class color) (min-colors 88) (background dark))
+ :foreground "cyan"
+ :weight bold :height 1.05
+ :inherit variable-pitch)
+ (((supports :weight bold) (supports :height 1.05))
+ :weight bold :height 1.05
+ :inherit variable-pitch)
+ (((supports :weight bold))
+ :weight bold :inherit variable-pitch)
+ (t :inherit variable-pitch))
+ "Face used for the author in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+ :version "28.1")
+
+(defface etc-authors-descriptor '((((class color) (min-colors 88) (background light))
+ :foreground "sienna" :inherit variable-pitch)
+ (((class color) (min-colors 88) (background dark))
+ :foreground "peru" :inherit variable-pitch)
+ (t :inherit variable-pitch))
+ "Face used for the description text in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+ :version "28.1")
+
+(defface etc-authors-other-files '((t :inherit etc-authors-descriptor))
+ "Face used for the \"other files\" text in the \"etc/AUTHORS\" file.
+See also `etc-authors-mode'."
+ :version "28.1")
+
+(defconst etc-authors--author-re
+ (rx bol (group (not (any blank "\n")) (+? (not (any ":" "\n")))) ":")
+ "Regexp matching an author in \"etc/AUTHORS\".")
+
+(defvar etc-authors-mode-font-lock-keywords
+ `((,etc-authors--author-re
+ 1 'etc-authors-author)
+ (,(rx (or "wrote"
+ (seq (? "and ") (or "co-wrote" "changed"))))
+ 0 'etc-authors-descriptor)
+ (,(rx "and " (+ digit) " other files")
+ 0 'etc-authors-other-files)
+ (,(rx bol (not space) (+ not-newline) eol)
+ 0 'etc-authors-default)))
+
+(defun etc-authors-mode--hide-local-variables ()
+ "Hide local variables in \"etc/AUTHORS\". Used by `etc-authors-mode'."
+ (narrow-to-region (point-min)
+ (save-excursion
+ (goto-char (point-min))
+ ;; Obfuscate to avoid this being interpreted
+ ;; as a local variable section itself.
+ (if (re-search-forward "^Local\sVariables:$" nil t)
+ (progn (forward-line -1) (point))
+ (point-max)))))
+
+(defun etc-authors-next-author (&optional arg)
+ "Move point to the next author in \"etc/AUTHORS\".
+With a prefix arg ARG, move point that many authors forward."
+ (interactive "p" etc-authors-mode)
+ (if (< 0 arg)
+ (progn
+ (when (looking-at etc-authors--author-re)
+ (forward-line 1))
+ (re-search-forward etc-authors--author-re nil t arg))
+ (when (looking-at etc-authors--author-re)
+ (forward-line -1))
+ (re-search-backward etc-authors--author-re nil t (abs arg)))
+ (goto-char (line-beginning-position)))
+
+(defun etc-authors-prev-author (&optional arg)
+ "Move point to the previous author in \"etc/AUTHORS\".
+With a prefix arg ARG, move point that many authors backward."
+ (interactive "p" etc-authors-mode)
+ (etc-authors-next-author (- arg)))
+
+(defvar etc-authors-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "n" #'etc-authors-next-author)
+ (define-key map "p" #'etc-authors-prev-author)
+ map)
+ "Keymap for `etc-authors-mode'.")
+
+;;;###autoload
+(define-derived-mode etc-authors-mode special-mode "Authors View"
+ "Major mode for viewing \"etc/AUTHORS\" from the Emacs distribution.
+Provides some basic font locking and not much else."
+ (setq-local font-lock-defaults
+ '(etc-authors-mode-font-lock-keywords nil nil ((?_ . "w"))))
+ (setq font-lock-multiline nil)
+ (etc-authors-mode--hide-local-variables))
+
+(provide 'etc-authors-mode)
+;;; etc-authors-mode.el ends here
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index f394171fb6c..73d76a8ac67 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -396,12 +396,8 @@ and `fill-nobreak-invisible'."
(save-excursion
(skip-chars-backward " ")
(and (eq (preceding-char) ?.)
- (looking-at " \\([^ ]\\|$\\)"))))
- ;; Another approach to the same problem.
- (save-excursion
- (skip-chars-backward " ")
- (and (eq (preceding-char) ?.)
- (not (progn (forward-char -1) (looking-at (sentence-end))))))
+ ;; There's something more after the space.
+ (looking-at " [^ \n]"))))
;; Don't split a line if the rest would look like a new paragraph.
(unless use-hard-newlines
(save-excursion
@@ -768,7 +764,7 @@ space does not end a sentence, so don't break a line there."
(setq first nil
linebeg (+ (point) (length actual-fill-prefix))))
(move-to-column (current-fill-column))
- (if (when (< (point) to)
+ (if (when (and (< (point) to) (< linebeg to))
;; Find the position where we'll break the line.
;; Use an immediately following space, if any.
;; However, note that `move-to-column' may overshoot
@@ -1064,7 +1060,7 @@ than line breaks untouched, and fifth arg TO-EOP non-nil means
to keep filling to the end of the paragraph (or next hard newline,
if variable `use-hard-newlines' is on).
-Return the fill-prefix used for filling the last paragraph.
+Return the `fill-prefix' used for filling the last paragraph.
If `sentence-end-double-space' is non-nil, then period followed by one
space does not end a sentence, so don't break a line there."
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 836d889a1cf..1d450b50012 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -442,22 +442,6 @@ like <img alt=\"Some thing.\">."
map)
"Minor mode keymap for Flyspell mode--for the whole buffer.")
-;; correct on mouse 3
-(defun flyspell--set-use-mouse-3-for-menu (var value)
- (set-default var value)
- (if value
- (progn (define-key flyspell-mouse-map [mouse-2] nil)
- (define-key flyspell-mouse-map [down-mouse-3] 'flyspell-correct-word))
- (define-key flyspell-mouse-map [mouse-2] 'flyspell-correct-word)
- (define-key flyspell-mouse-map [down-mouse-3] nil)))
-
-(defcustom flyspell-use-mouse-3-for-menu nil
- "Non-nil means to bind `mouse-3' to `flyspell-correct-word'.
-If this is set, also unbind `mouse-2'."
- :type 'boolean
- :set 'flyspell--set-use-mouse-3-for-menu
- :version "28.1")
-
;; dash character machinery
(defvar-local flyspell-consider-dash-as-word-delimiter-flag nil
"Non-nil means that the `-' char is considered as a word delimiter.")
@@ -486,6 +470,13 @@ See also `flyspell-duplicate-distance'."
(defvar flyspell-overlay nil)
+(defun flyspell-context-menu (_menu _click)
+ "Context menu for `context-menu-mode'."
+ ;; TODO: refactor `flyspell-correct-word' and related functions to return
+ ;; a keymap menu where every menu item is bound to a lambda that calls
+ ;; `flyspell-do-correct' with an argument that is a correct word.
+ 'flyspell-correct-word)
+
;;*---------------------------------------------------------------------*/
;;* flyspell-mode ... */
;;*---------------------------------------------------------------------*/
@@ -537,10 +528,7 @@ in your init file.
:group 'flyspell
(if flyspell-mode
(condition-case err
- (progn
- (when flyspell-use-mouse-3-for-menu
- (flyspell--set-use-mouse-3-for-menu 'flyspell-use-mouse-3-for-menu t))
- (flyspell-mode-on (called-interactively-p 'interactive)))
+ (flyspell-mode-on (called-interactively-p 'interactive))
(error (message "Error enabling Flyspell mode:\n%s" (cdr err))
(flyspell-mode -1)))
(flyspell-mode-off)))
@@ -558,7 +546,7 @@ in your init file.
(custom-add-option 'text-mode-hook 'turn-on-flyspell)
(defvar flyspell-buffers nil
- "For remembering buffers running flyspell")
+ "For remembering buffers running flyspell.")
(make-obsolete-variable 'flyspell-buffers "not used." "28.1")
;;*---------------------------------------------------------------------*/
@@ -656,8 +644,7 @@ are both non-nil."
show-msg)
(let* ((binding (where-is-internal 'flyspell-auto-correct-word
nil 'non-ascii))
- (mouse-button (if flyspell-use-mouse-3-for-menu
- "Mouse-3" "Mouse-2")))
+ (mouse-button (if context-menu-mode "Mouse-3" "Mouse-2")))
(message (format-message
"Welcome to Flyspell. Use %s to correct words."
(if binding
@@ -715,8 +702,8 @@ has been used, the current word is not checked."
;;* has to be spell checked. */
;;*---------------------------------------------------------------------*/
(defvar flyspell-pre-buffer nil "Buffer current before `this-command'.")
-(defvar flyspell-pre-point nil "Point before running `this-command'")
-(defvar flyspell-pre-column nil "Column before running `this-command'")
+(defvar flyspell-pre-point nil "Point before running `this-command'.")
+(defvar flyspell-pre-column nil "Column before running `this-command'.")
(defvar flyspell-pre-pre-buffer nil)
(defvar flyspell-pre-pre-point nil)
(make-variable-buffer-local 'flyspell-pre-point) ;Why?? --Stef
@@ -1759,7 +1746,7 @@ FLYSPELL-BUFFER."
;;* flyspell-overlay-p ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-overlay-p (o)
- "Return true if O is an overlay used by flyspell."
+ "Return non-nil if O is an overlay used by flyspell."
(and (overlayp o) (overlay-get o 'flyspell-overlay)))
;;*---------------------------------------------------------------------*/
@@ -1820,13 +1807,15 @@ for the overlay."
(overlay-put overlay 'mouse-face mouse-face)
(overlay-put overlay 'flyspell-overlay t)
(overlay-put overlay 'evaporate t)
- (overlay-put overlay 'help-echo (concat (if flyspell-use-mouse-3-for-menu
- "mouse-3"
- "mouse-2") ": correct word at point"))
- ;; If misspelled text has a 'keymap' property, let that remain in
- ;; effect for the bindings that flyspell-mouse-map doesn't override.
- (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
- (overlay-put overlay 'keymap flyspell-mouse-map)
+ (overlay-put overlay 'help-echo
+ (concat (if context-menu-mode "mouse-3" "mouse-2")
+ ": correct word at point"))
+ (if context-menu-mode
+ (overlay-put overlay 'context-menu-function 'flyspell-context-menu)
+ ;; If misspelled text has a 'keymap' property, let that remain in
+ ;; effect for the bindings that flyspell-mouse-map doesn't override.
+ (set-keymap-parent flyspell-mouse-map (get-char-property beg 'keymap))
+ (overlay-put overlay 'keymap flyspell-mouse-map))
(when (eq face 'flyspell-incorrect)
(and (stringp flyspell-before-incorrect-word-string)
(overlay-put overlay 'before-string
@@ -1872,7 +1861,7 @@ is itself incorrect, but suspiciously repeated."
;;* flyspell-highlight-duplicate-region ... */
;;*---------------------------------------------------------------------*/
(defun flyspell-highlight-duplicate-region (beg end poss)
- "Set up an overlay on a duplicate misspelled word, in the buffer from BEG to END.
+ "Set up overlay on duplicate misspelled word, in the buffer from BEG to END.
POSS is a list of possible spelling/correction lists,
as returned by `ispell-parse-output'."
(let ((inhibit-read-only t))
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 0a82bf5a2d4..0a3a49d868a 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -60,7 +60,7 @@
;; `a': Accept word for this session.
;; `A': Accept word and place in buffer-local dictionary.
;; `r': Replace word with typed-in value. Rechecked.
-;; `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
+;; `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
;; `?': Show these commands
;; `x': Exit spelling buffer. Move cursor to original point.
;; `X': Exit spelling buffer. Leaves cursor at the current point, and permits
@@ -250,16 +250,15 @@ Always stores Fcc copy of message when nil."
Should probably be \"-Ei\"."
:type 'string)
-(defcustom ispell-look-command
- (cond ((file-exists-p "/bin/look") "/bin/look")
- ((file-exists-p "/usr/local/bin/look") "/usr/local/bin/look")
- ((file-exists-p "/usr/bin/look") "/usr/bin/look")
- (t "look"))
+(defcustom ispell-look-command (executable-find "look")
"Name of the look command for search processes.
This must be an absolute file name."
- :type 'file)
+ :type '(choice (const :tag "None" nil)
+ file)
+ :version "28.1")
-(defcustom ispell-look-p (file-exists-p ispell-look-command)
+(defcustom ispell-look-p (and ispell-look-command
+ (file-exists-p ispell-look-command))
"Non-nil means use `look' rather than `grep'.
Default is based on whether `look' seems to be available."
:type 'boolean)
@@ -398,6 +397,10 @@ re-start Emacs."
(const :tag "default" nil))
(coding-system :tag "Coding System"))))
+(defcustom ispell-help-timeout 5
+ "The number of seconds to display the help text."
+ :type 'number
+ :version "28.1")
(defvar ispell-dictionary-base-alist
'((nil ; default
@@ -621,7 +624,7 @@ this would require some extra guessing in `ispell-aspell-find-dictionary'.")
("svenska" "sv_SE")
("hebrew" "he_IL"))
"Alist with known matching locales for standard dict names in
- `ispell-dictionary-base-alist'.")
+`ispell-dictionary-base-alist'.")
;;; **********************************************************************
@@ -649,11 +652,7 @@ Otherwise returns the library directory name, if that is defined."
result libvar status ispell-program-version)
(with-temp-buffer
- (setq status (ispell-call-process
- ispell-program-name nil t nil
- (let ((case-fold-search
- (memq system-type '(ms-dos windows-nt))))
- "-vv")))
+ (setq status (ispell-call-process ispell-program-name nil t nil "-vv"))
(goto-char (point-min))
(if interactivep
;; Report version information of ispell
@@ -735,8 +734,7 @@ Otherwise returns the library directory name, if that is defined."
result))
(defmacro ispell-with-safe-default-directory (&rest body)
- "Execute the forms in BODY with a reasonable
-`default-directory'."
+ "Execute the forms in BODY with a reasonable `default-directory'."
(declare (indent 0) (debug t))
`(let ((default-directory default-directory))
(unless (file-accessible-directory-p default-directory)
@@ -763,8 +761,7 @@ See `ispell-buffer-with-debug' for an example of use."
(let ((ispell-debug-buffer (get-buffer-create "*ispell-debug*")))
(with-current-buffer ispell-debug-buffer
(if append
- (insert
- (format "-----------------------------------------------\n"))
+ (insert "-----------------------------------------------\n")
(erase-buffer)))
ispell-debug-buffer))
@@ -1043,7 +1040,11 @@ did."
Invoke this command before you want to start Hunspell for the first time
with a particular combination of dictionaries. The first dictionary
-in the list must have an affix file where Hunspell affix files are kept."
+in the list must have an affix file where Hunspell affix files are kept.
+
+If you invoke this from Lisp, make sure to precede it with
+a call to `ispell-set-spellchecker-params', as `ispell-change-dictionary'
+calls it only when invoked interactively."
(interactive "sMulti-dictionary combination: ")
;; Make sure the first dictionary in the list is known to us.
(let ((first-dict (car (split-string dict "," t))))
@@ -2462,7 +2463,7 @@ SPC: Accept word this time.
(with-current-buffer buffer
(insert (concat help-1 "\n" help-2 "\n" help-3)))
(ispell-display-buffer buffer)
- (sit-for 5)
+ (sit-for ispell-help-timeout)
(kill-buffer "*Ispell Help*"))
(unwind-protect
(let ((resize-mini-windows 'grow-only))
@@ -2472,7 +2473,7 @@ SPC: Accept word this time.
;;(set-minibuffer-window (selected-window))
(enlarge-window 2)
(insert (concat help-1 "\n" help-2 "\n" help-3))
- (sit-for 5))
+ (sit-for ispell-help-timeout))
(erase-buffer)))))))
(define-obsolete-function-alias 'lookup-words 'ispell-lookup-words "24.4")
@@ -2501,7 +2502,7 @@ if defined."
"Customize `ispell-alternate-dictionary' to set yours.")))
(let* ((process-connection-type ispell-use-ptys-p)
- (wild-p (string-match "\\*" word))
+ (wild-p (string-search "*" word))
(look-p (and ispell-look-p ; Only use look for an exact match.
(or ispell-have-new-look (not wild-p))))
(prog (if look-p ispell-look-command ispell-grep-command))
@@ -2530,7 +2531,7 @@ if defined."
;; `grep' returns status 1 and no output when word not found, which
;; is a perfectly normal thing.
(if (stringp status)
- (error "error: %s exited with signal %s"
+ (error "Error: %s exited with signal %s"
(file-name-nondirectory prog) status)
;; Else collect words into `results' in FIFO order.
(goto-char (point-max))
@@ -2564,7 +2565,7 @@ if defined."
(continue t)
end)
(while continue
- (setq end (string-match "\n" output start)) ; get text up to the newline.
+ (setq end (string-search "\n" output start)) ; get text up to the newline.
;; If we get out of sync and ispell-filter-continue is asserted when we
;; are not continuing, treat the next item as a separate list. When
;; ispell-filter-continue is asserted, ispell-filter *should* always be a
@@ -2736,11 +2737,11 @@ Optional third arg SHIFT is an offset to apply based on previous corrections."
(if (eq type ?#)
(setq count 0) ; no misses for type #
(setq count (string-to-number output) ; get number of misses.
- output (substring output (1+ (string-match " " output 1)))))
+ output (substring output (1+ (string-search " " output 1)))))
(setq offset (string-to-number output))
(setq output (if (eq type ?#) ; No miss or guess list.
nil
- (substring output (1+ (string-match " " output 1)))))
+ (substring output (1+ (string-search " " output 1)))))
(while output
(let ((end (string-match ", \\|\\($\\)" output))) ; end of miss/guess.
(setq cur-count (1+ cur-count))
@@ -2923,7 +2924,14 @@ Keeps argument list for future Ispell invocations for no async support."
;; But first wait to see if some more output is going to arrive.
;; Otherwise we get cool errors like "Can't open ".
(sleep-for 1)
- (ispell-accept-output 3)
+ ;; Only call `ispell-accept-output' if the Ispell process
+ ;; is alive, to avoid showing an unhelpful error message
+ ;; about a missing process, instead of the error which
+ ;; reports why the Ispell process died.
+ (when (if ispell-async-processp
+ (process-live-p ispell-process)
+ ispell-process)
+ (ispell-accept-output 3))
(error "%s" (mapconcat #'identity ispell-filter "\n"))))
(setq ispell-filter nil) ; Discard version ID line
(let ((extended-char-mode (ispell-get-extended-character-mode)))
@@ -3636,8 +3644,7 @@ sequence inside of a word.
Standard ispell choices are then available."
;; FIXME: completion-at-point-function.
(interactive "P")
- (let ((cursor-location (point))
- (case-fold-search-val case-fold-search)
+ (let ((case-fold-search-val case-fold-search)
(word (ispell-get-word nil "\\*")) ; force "previous-word" processing.
start end possibilities replacement)
(setq start (car (cdr word))
@@ -3674,18 +3681,12 @@ Standard ispell choices are then available."
(ispell-add-per-file-word-list word))
(replacement ; REPLACEMENT WORD
(delete-region start end)
- (setq word (if (atom replacement) replacement (car replacement))
- cursor-location (+ (- (length word) (- end start))
- cursor-location))
- (insert word)
- (if (not (atom replacement)) ; recheck spelling of replacement.
- (progn
- (goto-char cursor-location)
- (ispell-word nil t)))))
+ (insert (if (atom replacement) replacement (car replacement)))
+ (unless (atom replacement) ; recheck spelling of replacement.
+ (ispell-word nil t))))
(if (get-buffer ispell-choices-buffer)
(kill-buffer ispell-choices-buffer))))
- (ispell-pdict-save ispell-silently-savep)
- (goto-char cursor-location)))
+ (ispell-pdict-save ispell-silently-savep)))
;;;###autoload
@@ -4081,7 +4082,7 @@ Includes LaTeX/Nroff modes and extended character mode."
(ispell-send-string "+\n~tex\n"))
((string-match "nroff-mode" string)
(ispell-send-string "-\n~nroff\n"))
- ((string-match "~" string) ; Set extended character mode.
+ ((string-search "~" string) ; Set extended character mode.
(ispell-send-string (concat string "\n")))
(t (message "Invalid Ispell Parsing argument!")
(sit-for 2))))))))
@@ -4090,7 +4091,7 @@ Includes LaTeX/Nroff modes and extended character mode."
;; Can kill the current ispell process
(defun ispell-buffer-local-dict (&optional no-reload)
- "Initializes local dictionary and local personal dictionary.
+ "Initialize local dictionary and local personal dictionary.
If optional NO-RELOAD is non-nil, do not reload any dictionary.
When a dictionary is defined in the buffer (see variable
`ispell-dictionary-keyword'), it will override the local setting
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index 13367a09bcf..6b9b3f3e9de 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -175,10 +175,9 @@ command to gain use of `next-error'."
'makeinfo-compilation-sentinel-region)))))))
(defun makeinfo-next-error (_arg _reset)
- "This function is used to disable `next-error' if the user has
-used `makeinfo-region'. Since the compilation process is used on
-a temporary file in that case, calling `next-error' would give
-nonsensical results."
+ "This is used to disable `next-error' if the user has used `makeinfo-region'.
+Since the compilation process is used on a temporary file in that
+case, calling `next-error' would give nonsensical results."
(error "Use `makeinfo-buffer' to gain use of the `next-error' command"))
;; Actually run makeinfo. COMMAND is the command to run. If
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 25905385685..936732153ae 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -19,6 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+;;; Commentary:
+
;;; Code:
(eval-when-compile (require 'cl-lib))
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index 87c91e8f1b7..558d6b81d77 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -257,7 +257,7 @@
;;; Addresses related variables
(defcustom pages-addresses-file-name "~/addresses"
- "Standard name for file of addresses. Entries separated by page-delimiter.
+ "Standard name for file of addresses. Entries separated by `page-delimiter'.
Used by `pages-directory-for-addresses' function."
:type 'file)
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 1368af01bac..cb7f275ea6f 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -449,8 +449,8 @@ If no such character is found, move to beginning of line."
(progn
(beginning-of-line)
(skip-chars-backward
- (concat "^" (replace-regexp-in-string
- "\\\\" "\\\\" picture-tab-chars nil t))
+ (concat "^" (string-replace
+ "\\" "\\\\" picture-tab-chars))
(point-min))
(not (bobp))))
(move-to-column target))
@@ -514,7 +514,7 @@ Interactively, reads the register using `register-read-with-preview'."
(move-to-column column t))))
(defun picture-yank-rectangle (&optional insertp)
- "Overlay rectangle saved by \\[picture-clear-rectangle]
+ "Overlay rectangle saved by \\[picture-clear-rectangle].
The rectangle is positioned with upper left corner at point, overwriting
existing text. With prefix argument, the rectangle is inserted instead,
shifting existing text. Leaves mark at one corner of rectangle and
@@ -699,10 +699,10 @@ afterwards settable by these commands:
Move southwest (sw) after insertion: \\[picture-movement-sw]
Move southeast (se) after insertion: \\[picture-movement-se]
- Move westnorthwest (wnw) after insertion: C-u \\[picture-movement-nw]
- Move eastnortheast (ene) after insertion: C-u \\[picture-movement-ne]
- Move westsouthwest (wsw) after insertion: C-u \\[picture-movement-sw]
- Move eastsoutheast (ese) after insertion: C-u \\[picture-movement-se]
+ Move westnorthwest (wnw) after insertion: \\[universal-argument] \\[picture-movement-nw]
+ Move eastnortheast (ene) after insertion: \\[universal-argument] \\[picture-movement-ne]
+ Move westsouthwest (wsw) after insertion: \\[universal-argument] \\[picture-movement-sw]
+ Move eastsoutheast (ese) after insertion: \\[universal-argument] \\[picture-movement-se]
The current direction is displayed in the mode line. The initial
direction is right. Whitespace is inserted and tabs are changed to
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index 084b17c676b..ce556be00db 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -195,7 +195,7 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
(sit-for 0))))
(defun r2b-match (exp)
- "Returns string matched in current buffer."
+ "Return string matched in current buffer."
(buffer-substring (match-beginning exp) (match-end exp)))
(defcustom r2b-out-buf-name "*Out*"
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index 0a0e4cc444c..b2ebbd5f375 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -153,7 +153,7 @@ regardless of the number of after-change calls from commands doing
complex processing.")
(defun refill-after-change-function (_beg end _len)
- "Function for `after-change-functions' which just sets `refill-doit'."
+ "Set `refill-doit'. Used by `after-change-functions'."
(unless undo-in-progress
(setq refill-doit end)))
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 650d11d4aca..e1475934ddb 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -30,11 +30,11 @@
;;; Variables and constants
(defvar reftex-cite-regexp-hist nil
- "The history list of regular expressions used for citations")
+ "The history list of regular expressions used for citations.")
(defconst reftex-citation-prompt
"Select: [n]ext [p]revious [r]estrict [ ]full_entry [q]uit RET [?]Help+more"
- "Prompt and help string for citation selection")
+ "Prompt and help string for citation selection.")
(defconst reftex-citation-help
" n / p Go to next/previous entry (Cursor motion works as well).
@@ -221,7 +221,7 @@ Return list with entries."
(if (string-match "\\`[ \t]*\\'" (or first-re ""))
(user-error "Empty regular expression"))
(if (string-match first-re "")
- (user-error "Regular expression matches the empty string."))
+ (user-error "Regular expression matches the empty string"))
(save-excursion
(save-window-excursion
@@ -628,7 +628,7 @@ If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.
FORMAT-KEY can be used to pre-select a citation format.
-When called with a `C-u' prefix, prompt for optional arguments in
+When called with a \\[universal-argument] prefix, prompt for optional arguments in
cite macros. When called with a numeric prefix, make that many
citations. When called with point inside the braces of a `\\cite'
command, it will add another key, ignoring the value of
@@ -718,7 +718,7 @@ While entering the regexp, completion on knows citation keys is possible.
(insert string))
;; Reposition cursor?
- (when (string-match "\\?" string)
+ (when (string-search "?" string)
(search-backward "?")
(delete-char 1))
@@ -814,7 +814,7 @@ in order to only add another reference in the same cite command."
(interactive)
(reftex-citation nil ?t))
-(defvar reftex-select-bib-map)
+(defvar reftex-select-bib-mode-map)
(defvar reftex--found-list)
(defun reftex-offer-bib-menu ()
"Offer bib menu and return list of selected items."
@@ -870,7 +870,7 @@ in order to only add another reference in the same cite command."
(reftex-select-item
reftex-citation-prompt
reftex-citation-help
- reftex-select-bib-map
+ reftex-select-bib-mode-map
nil
'reftex-bibtex-selection-callback nil))
(setq key (car rtn)
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index a21dd3362b0..ee26d911a5d 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -32,17 +32,20 @@
;;;###autoload
(defun reftex-view-crossref (&optional arg auto-how fail-quietly)
- "View cross reference of macro at point. Point must be on the KEY
-argument. When at a `\\ref' macro, show corresponding `\\label'
-definition, also in external documents (`xr'). When on a label, show
-a locations where KEY is referenced. Subsequent calls find additional
-locations. When on a `\\cite', show the associated `\\bibitem' macro or
-the BibTeX database entry. When on a `\\bibitem', show a `\\cite' macro
-which uses this KEY. When on an `\\index', show other locations marked
-by the same index entry.
+ "View cross reference of macro at point.
+
+Point must be on the KEY argument. When at a `\\ref' macro, show
+corresponding `\\label' definition, also in external
+documents (`xr'). When on a label, show a locations where KEY is
+referenced. Subsequent calls find additional locations. When on
+a `\\cite', show the associated `\\bibitem' macro or the BibTeX
+database entry. When on a `\\bibitem', show a `\\cite' macro
+which uses this KEY. When on an `\\index', show other locations
+marked by the same index entry.
+
To define additional cross referencing items, use the option
`reftex-view-crossref-extra'. See also `reftex-view-crossref-from-bibtex'.
-With one or two C-u prefixes, enforce rescanning of the document.
+With one or two \\[universal-argument] prefixes, enforce rescanning of the document.
With argument 2, select the window showing the cross reference.
AUTO-HOW is only for the automatic crossref display and is handed through
to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index 3b7518e5c3f..b90c21339cc 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -338,17 +338,17 @@ Also checks if buffers visiting the files are in read-only mode."
(while (setq file (pop files))
(unless (file-exists-p file)
(ding)
- (or (y-or-n-p (format "No such file %s. Continue? " file))
+ (or (y-or-n-p (format "No such file %s. Continue?" file))
(error "Abort")))
(unless (file-writable-p file)
(ding)
- (or (y-or-n-p (format "No write access to %s. Continue? " file))
+ (or (y-or-n-p (format "No write access to %s. Continue?" file))
(error "Abort")))
(when (and (setq buf (find-buffer-visiting file))
(with-current-buffer buf
buffer-read-only))
(ding)
- (or (y-or-n-p (format "Buffer %s is read-only. Continue? "
+ (or (y-or-n-p (format "Buffer %s is read-only. Continue?"
(buffer-name buf)))
(error "Abort"))))))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 28cc7db2dcd..9d9eab4d7b5 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -38,8 +38,8 @@
"Put selection or the word near point into the default index macro.
This uses the information in `reftex-index-default-macro' to make an index
entry. The phrase indexed is the current selection or the word near point.
-When called with one `C-u' prefix, let the user have a chance to edit the
-index entry. When called with 2 `C-u' as prefix, also ask for the index
+When called with one \\[universal-argument] prefix, let the user have a chance to edit the
+index entry. When called with 2 \\[universal-argument] as prefix, also ask for the index
macro and other stuff.
When called inside TeX math mode as determined by the `texmathp.el' library
which is part of AUCTeX, the string is first processed with the
@@ -462,7 +462,7 @@ _ ^ Add/Remove parent key (to make this item a subitem).
"Display a buffer with an index compiled from the current document.
When the document has multiple indices, first prompts for the correct one.
When index support is turned off, offer to turn it on.
-With one or two `C-u' prefixes, rescan document first.
+With one or two \\[universal-argument] prefixes, rescan document first.
With prefix 2, restrict index to current document section.
With prefix 3, restrict index to region."
@@ -842,7 +842,7 @@ The function will go to the section where the entry at point was defined."
(reftex-display-index nil nil 'redo))
(defun reftex-index-restrict-to-section (&optional force)
- "Restrict index to entries defined in same document sect. as entry at point."
+ "Restrict index to entries defined in same document section as entry at point."
;; Optional FORCE means, even if point is not on an index entry.
(interactive)
(let* ((data (get-text-property (point) :data))
@@ -934,8 +934,8 @@ When index is restricted, select the previous section as restriction criterion."
(t nil))))
(defun reftex-index-analyze-entry (data)
- ;; This splits the index context so that key, attribute and visual
- ;; values are accessible individually.
+ "Split index context so that key, attribute and visual
+values are accessible individually."
(interactive)
(let* ((arg (nth 5 data))
(context (nth 2 data))
@@ -1150,7 +1150,7 @@ When index is restricted, select the previous section as restriction criterion."
;; Some constants and variables
(defconst reftex-index-phrases-comment-regexp "^[ \t]*%.*"
- "Regular expression to match comment lines in phrases buffer")
+ "Regular expression to match comment lines in phrases buffer.")
(defconst reftex-index-phrases-macrodef-regexp
"^\\(>>>INDEX_MACRO_DEFINITION:\\)[ \t]+\\(\\S-\\)\\( *\t[ \t]*\\)\\([^\t]*[^ \t]\\)\\( *\t[ \t]*\\)\\(\\S-+\\)"
"Regular expression to match macro definition lines the phrases buffer.")
@@ -1666,7 +1666,7 @@ this function repeatedly."
(repeat
(princ (format " Index entry: %s\n" phrase)))
(t
- (princ (format " Index key: <<Given by the match>>\n"))))
+ (princ " Index key: <<Given by the match>>\n")))
(princ (format " Example: %s\n" example))
(terpri)
(princ (format "Total matches: %s in %s\n"
@@ -2068,7 +2068,7 @@ both ends."
(defun reftex-index-phrases-replace-space (pos)
"If there is a space at POS, replace it with a newline char.
-Does not do a save-excursion."
+Does not do a `save-excursion'."
(when (equal (char-after pos) ?\ )
(goto-char pos)
(delete-char 1)
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 0157f8443aa..b8c75cb21b6 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -345,7 +345,17 @@ of master file."
;; Find external document specifications
(goto-char 1)
- (while (re-search-forward "[\n\r][ \t]*\\\\externaldocument\\(\\[\\([^]]*\\)\\]\\)?{\\([^}]+\\)}" nil t)
+ (while (re-search-forward
+ (concat "[\n\r][ \t]*"
+ ;; Support \externalcitedocument macro
+ "\\\\external\\(?:cite\\)?document"
+ ;; The optional prefix
+ "\\(\\[\\([^]]*\\)\\]\\)?"
+ ;; The 2nd opt. arg can only be nocite
+ "\\(?:\\[nocite\\]\\)?"
+ ;; Mandatory file argument
+ "{\\([^}]+\\)}")
+ nil t)
(push (list 'xr-doc (reftex-match-string 2)
(reftex-match-string 3))
docstruct))
@@ -435,7 +445,8 @@ This function also makes sure the old toc markers do not point anywhere."
;;;###autoload
(defun reftex-section-info (file)
"Return a section entry for the current match.
-Careful: This function expects the match-data to be still in place!"
+Careful: This function expects the `match-data' to still be in
+place!"
(let* ((marker (set-marker (make-marker) (1- (match-beginning 3))))
(macro (reftex-match-string 3))
(prefix (save-match-data
@@ -494,7 +505,8 @@ will rescan the entire document."
;;;###autoload
(defun reftex-index-info (file)
"Return an index entry for the current match.
-Careful: This function expects the match-data to be still in place!"
+Careful: This function expects the `match-data' to still be in
+place!"
(catch 'exit
(let* ((macro (reftex-match-string 10))
(bom (match-beginning 10))
@@ -757,7 +769,7 @@ if the information is exact (t) or approximate (nil)."
(while (and (setq tail (memq (assq 'toc (cdr tail)) tail))
(setq entry (car tail))
(>= (nth 5 entry) level))
- (setq star (string-match "\\*" (nth 6 entry))
+ (setq star (string-search "*" (nth 6 entry))
context (nth 2 entry)
section-number
(reftex-section-number (nth 5 entry) star))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 611102ecbac..15d86b359cc 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -230,7 +230,7 @@ This function is controlled by the settings of reftex-insert-label-flags."
(symbol-value reftex-docstruct-symbol)))
(ding)
(if (y-or-n-p
- (format-message "Label `%s' exists. Use anyway? " label))
+ (format-message "Label `%s' exists. Use anyway?" label))
(setq valid t)))
;; Label is ok
@@ -415,7 +415,7 @@ reftex-label. Rescanning of the buffer can also be requested from the
label selection menu.
The function returns the selected label or nil.
If NO-INSERT is non-nil, do not insert \\ref command, just return label.
-When called with 2 C-u prefix args, disable magic word recognition."
+When called with 2 \\[universal-argument] prefix args, disable magic word recognition."
(interactive)
@@ -533,7 +533,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
(cons (cdr cell) (- (match-end 0) (match-end 1)))
nil)))
-(defvar reftex-select-label-map)
+(defvar reftex-select-label-mode-map)
(defun reftex-offer-label-menu (typekey)
;; Offer a menu with the appropriate labels.
(let* ((buf (current-buffer))
@@ -605,7 +605,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
(reftex-select-item
reftex-select-label-prompt
reftex-select-label-help
- reftex-select-label-map
+ reftex-select-label-mode-map
offset
'reftex-show-label-location follow))
(setq key (car rtn)
@@ -798,7 +798,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
(push (cons (current-buffer) buffer-invisibility-spec)
reftex-buffers-with-changed-invisibility)
(setq buffer-invisibility-spec nil))
- ((string-match "\r" (buffer-substring beg end))
+ ((string-search "\r" (buffer-substring beg end))
;; Invisible with selective display. We need to copy it.
(let ((string (buffer-substring-no-properties beg end)))
(switch-to-buffer "*RefTeX Context Copy*")
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index b5643491338..b5f53ba86e7 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -180,7 +180,7 @@ z Jump to a specific section (e.g. '3 z' goes to section 3).")
(defun reftex-toc (&optional _rebuild reuse)
;; FIXME: Get rid of the `rebuild' argument.
"Show the table of contents for the current document.
-When called with a raw C-u prefix, rescan the document first."
+When called with a raw \\[universal-argument] prefix, rescan the document first."
;; The REUSE argument means, search all visible frames for a window
;; displaying the toc window. If yes, reuse this window.
@@ -856,10 +856,10 @@ label prefix determines the wording of a reference."
(label (car toc)) newlabel)
(if (not (stringp label))
(error "This is not a label entry"))
- (setq newlabel (read-string (format "Rename label \"%s\" to:" label)))
+ (setq newlabel (read-string (format "Rename label \"%s\" to: " label)))
(if (assoc newlabel (symbol-value reftex-docstruct-symbol))
(if (not (y-or-n-p
- (format-message "Label `%s' exists. Use anyway? " label)))
+ (format-message "Label `%s' exists. Use anyway? " newlabel)))
(error "Abort")))
(save-excursion
(save-window-excursion
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index 96065ee69e1..d57a7678553 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -263,7 +263,7 @@ distribution. Mixed-case symbols are convenience aliases.")
(defgroup reftex nil
"LaTeX label and citation support."
:tag "RefTeX"
- :link '(url-link :tag "Home Page"
+ :link '(url-link :tag "Website"
"https://www.gnu.org/software/auctex/reftex.html")
:link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el")
:link '(custom-manual "(reftex)Top")
@@ -330,7 +330,8 @@ select the nearest entry with the correct new level."
"The maximum level of toc entries which will be included in the TOC.
Section headings with a bigger level will be ignored. In RefTeX, chapters
are level 1, sections are level 2 etc.
-This variable can be changed from within the *toc* buffer with the `t' key."
+This variable can be changed from within the *toc* buffer with \
+\\<reftex-toc-mode-map>\\[reftex-toc-max-level]."
:group 'reftex-table-of-contents-browser
:type 'integer)
@@ -433,8 +434,8 @@ This flag can be toggled from within the *toc* buffer with the `f' key."
:type 'boolean)
(defcustom reftex-revisit-to-follow nil
- "Non-nil means, follow-mode will revisit files if necessary.
-If nil, follow-mode will be suspended for stuff in unvisited files."
+ "Non-nil means, `follow-mode' will revisit files if necessary.
+If nil, `follow-mode' will be suspended for stuff in unvisited files."
:group 'reftex-table-of-contents-browser
:group 'reftex-referencing-labels
:type 'boolean)
@@ -1208,7 +1209,7 @@ path."
:type '(repeat (file)))
(defcustom reftex-sort-bibtex-matches 'reverse-year
- "Sorting of the entries found in BibTeX databases by reftex-citation.
+ "Sorting of the entries found in BibTeX databases by `reftex-citation'.
Possible values:
nil Do not sort entries.
`author' Sort entries by author name.
@@ -1292,7 +1293,7 @@ prompt for values. Possible values are:
nil Never prompt for optional arguments
t Always prompt
-maybe Prompt only if `reftex-citation' was called with C-u prefix arg
+maybe Prompt only if `reftex-citation' was called with \\[universal-argument] prefix arg
Unnecessary empty optional arguments are removed before insertion into
the buffer. See `reftex-cite-cleanup-optional-args'."
@@ -1364,7 +1365,7 @@ should return the string to insert into the buffer."
:type '(choice (const nil) function))
(defcustom reftex-select-bib-mode-hook nil
- "Mode hook for reftex-select-bib-mode."
+ "Mode hook for `reftex-select-bib-mode'."
:group 'reftex-citation-support
:type 'hook)
@@ -1694,8 +1695,8 @@ entries and for BibTeX database files with live associated buffers."
"Non-nil means, echoed information for cite macros is cached.
The information displayed in the echo area for cite macros is
cached and even saved along with the parsing information. The
-cache survives document scans. In order to clear it, use M-x
-reftex-reset-mode <RET>."
+cache survives document scans. In order to clear it, use
+\\[reftex-reset-mode]."
:group 'reftex-viewing-cross-references
:type 'boolean)
@@ -1840,7 +1841,7 @@ upon the variable `reftex-initialize-temporary-buffers'."
(defcustom reftex-initialize-temporary-buffers nil
"Non-nil means do initializations even when visiting file temporarily.
-When nil, RefTeX may turn off find-file hooks and other stuff to briefly
+When nil, RefTeX may turn off `find-file' hooks and other stuff to briefly
visit a file.
When t, the full default initializations are done (find-file-hook etc.).
Instead of t or nil, this variable may also be a list of hook functions to
@@ -1861,11 +1862,11 @@ of the regular expressions in this list, that file is not parsed by RefTeX."
(defcustom reftex-enable-partial-scans nil
"Non-nil means, re-parse only 1 file when asked to re-parse.
-Re-parsing is normally requested with a `C-u' prefix to many RefTeX commands,
+Re-parsing is normally requested with a \\[universal-argument] prefix to many RefTeX commands,
or with the `r' key in menus. When this option is t in a multifile document,
we will only parse the current buffer, or the file associated with the label
or section heading near point in a menu. Requesting re-parsing of an entire
-multifile document then requires a `C-u C-u' prefix or the capital `R' key
+multifile document then requires a \\[universal-argument] \\[universal-argument] prefix or the capital `R' key
in menus."
:group 'reftex-optimizations-for-large-documents
:type 'boolean)
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index c732299361c..f7424b60b36 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1,4 +1,5 @@
;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX -*- lexical-binding: t; -*-
+
;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@science.uva.nl>
@@ -813,7 +814,7 @@ This enforces rescanning the buffer on next use."
(setq wordlist (nthcdr 4 entry)))
(if (and (stringp fmt)
- (string-match "@" fmt))
+ (string-search "@" fmt))
;; Special syntax for specifying a label format
(setq fmt (split-string fmt "@+"))
(setq fmt (list "\\label{%s}" fmt)))
@@ -1207,7 +1208,7 @@ Valid actions are: readable, restore, read, kill, write."
(if (file-writable-p file)
(with-temp-file file
(message "Writing parse file %s" (abbreviate-file-name file))
- (insert (format ";; RefTeX parse info file\n"))
+ (insert ";; RefTeX parse info file\n")
(insert (format ";; File: %s\n" master))
(insert (format ";; User: %s (%s)\n\n"
(user-login-name) (user-full-name)))
@@ -1930,7 +1931,7 @@ When DIE is non-nil, throw an error if file not found."
(defun reftex-convert-string (string split-re invalid-re dot keep-fp
nwords maxchar invalid abbrev sep
ignore-words &optional downcase)
- "Convert a string (a sentence) to something shorter.
+ "Convert STRING (a sentence) to something shorter.
SPLIT-RE is the regular expression used to split the string into words.
INVALID-RE matches characters which are invalid in the final string.
DOT t means add dots to abbreviated words.
@@ -2139,7 +2140,7 @@ IGNORE-WORDS List of words which should be removed from the string."
(make-variable-buffer-local 'reftex-isearch-minor-mode)
(easy-menu-define reftex-mode-menu reftex-mode-map
- "Menu used in RefTeX mode"
+ "Menu used in RefTeX mode."
`("Ref"
["Table of Contents" reftex-toc t]
["Recenter TOC" reftex-toc-recenter t]
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 1471be0ecd6..ed1d721f82c 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -2444,7 +2444,7 @@ PREFER-ROMAN roman numbering is preferred over using letters."
tab))
;; FIXME: At least the continuation may be folded into
-;; `newline-and-indent`. However, this may not be wanted by everyone so
+;; 'newline-and-indent'. However, this may not be wanted by everyone so
;; it should be possible to switch this off.
(defun rst-insert-list (&optional prefer-roman)
;; testcover: ok.
@@ -2915,7 +2915,7 @@ error if there is no working link at the given position."
(pop-to-buffer (marker-buffer mrkr))
(goto-char mrkr)
;; FIXME: Should be a customizable number of lines from beginning or end of
- ;; window just like the argument to `recenter`. It would be ideal if
+ ;; window just like the argument to 'recenter'. It would be ideal if
;; the adornment is always completely visible.
(recenter 5)))
@@ -2995,7 +2995,7 @@ burying it."
(define-derived-mode rst-toc-mode special-mode "ReST-TOC"
"Major mode for output from \\[rst-toc], the table-of-contents for the document.
\\{rst-toc-mode-map}"
- ;; FIXME: `revert-buffer-function` must be defined so `revert-buffer` works
+ ;; FIXME: 'revert-buffer-function' must be defined so 'revert-buffer' works
;; as expected for a special mode. In particular the referred buffer
;; needs to be rescanned and the TOC must be updated accordingly.
;; FIXME: Should contain the name of the buffer this is the toc of.
@@ -3217,7 +3217,7 @@ Return a list of tabs sorted by likeliness to continue writing
like `rst-line-tabs'. Nearer lines have generally a higher
likeliness than farther lines. Return nil if no tab is found in
the text above."
- ;; FIXME: See test `indent-for-tab-command-BUGS`.
+ ;; FIXME: See test 'indent-for-tab-command-BUGS'.
(save-excursion
(goto-char pt)
(let (leftmost ; Leftmost column found so far.
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index fda00ec367e..dedc3882199 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -440,7 +440,8 @@ These have to be run via `sgml-syntax-propertize'"))
;; internal
(defvar sgml-face-tag-alist ()
- "Alist of face and tag name for facemenu.")
+ "Alist of face and tag name for facemenu.
+The tag name can be a string or a list of strings.")
(defvar sgml-tag-face-alist ()
"Tag names and face or list of faces to fontify with when invisible.
@@ -528,11 +529,13 @@ an optional alist of possible values."
(comment-indent-new-line soft)))
(defun sgml-mode-facemenu-add-face-function (face _end)
- (let ((tag-face (cdr (assq face sgml-face-tag-alist))))
+ "Add \"face\" tags with `facemenu-keymap' commands."
+ (let ((tag-face (ensure-list (cdr (assq face sgml-face-tag-alist)))))
(cond (tag-face
(setq tag-face (funcall skeleton-transformation-function tag-face))
- (setq facemenu-end-add-face (concat "</" tag-face ">"))
- (concat "<" tag-face ">"))
+ (setq facemenu-end-add-face
+ (mapconcat (lambda (f) (concat "</" f ">")) (reverse tag-face) ""))
+ (mapconcat (lambda (f) (concat "<" f ">")) tag-face ""))
((and (consp face)
(consp (car face))
(null (cdr face))
@@ -1208,7 +1211,7 @@ and move to the line in the SGML document that caused it."
(compilation-start command))
(defsubst sgml-at-indentation-p ()
- "Return true if point is at the first non-whitespace character on the line."
+ "Return t if point is at the first non-whitespace character on the line."
(save-excursion
(skip-chars-backward " \t")
(bolp)))
@@ -1835,6 +1838,7 @@ This takes effect when first loading the library.")
(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 "\M-o" 'facemenu-keymap)
map)
"Keymap for commands for use in HTML mode.")
@@ -1867,6 +1871,7 @@ This takes effect when first loading the library.")
(defvar html-face-tag-alist
'((bold . "strong")
(italic . "em")
+ (bold-italic . ("strong" "em"))
(underline . "u")
(mode-line . "rev"))
"Value of `sgml-face-tag-alist' for HTML mode.")
@@ -2372,10 +2377,11 @@ can also view with a browser to see what happens:
have <h1>Very Major Headlines</h1> through <h6>Very Minor Headlines</h6>
<hr> Parts can be separated with horizontal rules.
-<p>Paragraphs only need an opening tag. Line breaks and multiple spaces are
-ignored unless the text is <pre>preformatted.</pre> Text can be marked as
-<strong>bold</strong>, <em>italic</em> or <u>underlined</u> using the normal M-o
-or Edit/Text Properties/Face commands.
+<p>Paragraphs only need an opening tag. Line breaks and multiple
+spaces are ignored unless the text is <pre>preformatted.</pre>
+Text can be marked as <strong>bold</strong>, <em>italic</em> or
+<u>underlined</u> using the facemenu M-o or Edit/Text
+Properties/Face commands.
Pages can have <a name=\"SOMENAME\">named points</a> and can link other points
to them with <a href=\"#SOMENAME\">see also somename</a>. In the same way <a
@@ -2409,6 +2415,8 @@ To work around that, do:
(setq-local css-id-list-function #'html-current-buffer-ids))
(setq imenu-create-index-function 'html-imenu-index)
+ (yank-media-handler 'text/html #'html-mode--html-yank-handler)
+ (yank-media-handler "image/.*" #'html-mode--image-yank-handler)
(setq-local sgml-empty-tags
;; From HTML-4.01's loose.dtd, parsed with
@@ -2424,6 +2432,30 @@ To work around that, do:
;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
)
+(defun html-mode--html-yank-handler (_type html)
+ (save-restriction
+ (insert html)
+ (ignore-errors
+ (sgml-pretty-print (point-min) (point-max)))))
+
+(defun html-mode--image-yank-handler (type image)
+ (let ((file (read-file-name (format "Save %s image to: " type))))
+ (when (file-directory-p file)
+ (user-error "%s is a directory"))
+ (when (and (file-exists-p file)
+ (not (yes-or-no-p (format "%s exists; overwrite?" file))))
+ (user-error "%s exists"))
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert image)
+ (write-region (point-min) (point-max) file))
+ (insert (format "<img src=%S>\n" (file-relative-name file)))
+ (insert-image
+ (create-image file (mailcap-mime-type-to-extension type) nil
+ :max-width 200
+ :max-height 200)
+ " ")))
+
(defvar html-imenu-regexp
"\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"
"A regular expression matching a head line to be added to the menu.
@@ -2614,7 +2646,7 @@ HTML Autoview mode is a buffer-local minor mode for use with
"</nav>")
(define-skeleton html-html5-template
- "Initial HTML5 template"
+ "Initial HTML5 template."
nil
"<!DOCTYPE html>" \n
"<html lang=\"en\">" \n
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 2dd52b87b79..fef5ad2c7ac 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -61,7 +61,7 @@
;; holders. Amazingly there have been no direct support for WYSIWYG
;; table editing tasks in Emacs. Many people must have experienced
;; manipulating existing overwrite-mode and picture-mode for this task
-;; and only dreamed of having such a lisp package which supports this
+;; and only dreamed of having such a Lisp package which supports this
;; specific task directly. Certainly, I have been one of them. The
;; most difficult part of dealing with table editing in Emacs probably
;; is how to realize localized rectangular editing effect. Emacs has
@@ -860,7 +860,7 @@ cell to cache and cache to cell.")
This is always set to nil at the entry to `table-with-cache-buffer' before
executing body forms.")
(defvar-local table-mode-indicator nil
- "For mode line indicator")
+ "For mode line indicator.")
;; This is not a real minor-mode but placed in the minor-mode-alist
;; so that we can show the indicator on the mode line handy.
(unless (assq table-mode-indicator minor-mode-alist)
@@ -1190,7 +1190,7 @@ executing body forms.")
;; register table menu under global tools menu
(easy-menu-define table-global-menu-map nil
- "Table global menu" table-global-menu)
+ "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)
@@ -2368,7 +2368,9 @@ table's rectangle structure."
"Move point forward to the beginning of the next cell.
With argument ARG, do it ARG times;
a negative argument ARG = -N means move backward N cells.
-Do not specify NO-RECOGNIZE and UNRECOGNIZE. They are for internal use only.
+
+Do not specify NO-RECOGNIZE and UNRECOGNIZE. They are for
+internal use only.
Sample Cell Traveling Order (In Irregular Table Cases)
@@ -2399,8 +2401,7 @@ You can actually try how it works in this buffer. Press
+--+ |4 | |4 | +--+ |5 +--+--+6 | |3 +--+--+4 | |5 | |6 |
|5 +--+ | | +--+5 | | |7 |8 | | | |5 |6 | | | | | |
| |6 | | | |6 | | +--+--+--+--+ +--+--+--+--+ +--+-----+--+
-+--+--+--+ +--+--+--+
-"
++--+--+--+ +--+--+--+"
;; After modifying this function, test against the above tables in
;; the doc string. It is quite tricky. The tables above do not
;; mean to cover every possible cases of cell layout, of course.
@@ -2915,8 +2916,7 @@ LaTeX:
CALS (DocBook DTD):
URL `https://www.oasis-open.org/html/a502.htm'
- URL `https://www.oreilly.com/catalog/docbook/chapter/book/table.html#AEN114751'
-"
+ URL `https://www.oreilly.com/catalog/docbook/chapter/book/table.html#AEN114751'"
(interactive
(let* ((_ (unless (table--probe-cell) (error "Table not found here")))
(completion-ignore-case t)
@@ -3206,7 +3206,7 @@ CALS (DocBook DTD):
(insert ?\n))))))
(defun table--cell-horizontal-char-p (c)
- "Test if character C is one of the horizontal characters"
+ "Test if character C is one of the horizontal characters."
(memq c (string-to-list table-cell-horizontal-chars)))
(defun table--generate-source-scan-lines (dest-buffer _language origin-cell tail-cell col-list row-list)
@@ -3625,8 +3625,7 @@ independently.
By applying `table-release', which does the opposite process, the
contents become once again plain text. `table-release' works as
-companion command to `table-capture' this way.
-"
+companion command to `table-capture' this way."
(interactive
(let ((col-delim-regexp)
(row-delim-regexp))
@@ -4535,7 +4534,7 @@ grow into."
(defun table--untabify-line (&optional from)
"Untabify current line.
-Unlike save-excursion this guarantees preserving the cursor location
+Unlike `save-excursion' this guarantees preserving the cursor location
even when the point is on a tab character which is to be removed.
Optional FROM narrows the subject operation from this point to the end
of line."
@@ -5074,7 +5073,7 @@ signals error if the optional ABORT-ON-ERROR is non-nil."
(defun table--insert-rectangle (rectangle)
"Insert text of RECTANGLE with upper left corner at point.
-Same as insert-rectangle except that mark operation is eliminated."
+Same as `insert-rectangle' except that mark operation is eliminated."
(let ((lines rectangle)
(insertcolumn (current-column))
(first t))
@@ -5290,7 +5289,7 @@ Current buffer must already be set to the cache buffer."
(set-marker marker-point nil)))
(defun table--fill-region-strictly (beg end)
- "Fill region strictly so that no line exceeds fill-column.
+ "Fill region strictly so that no line exceeds `fill-column'.
When a word exceeds fill-column the word is chopped into pieces. The
chopped location is indicated with table-word-continuation-char."
(or (and (markerp beg) (markerp end))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index ababd775d5f..5fba93c76eb 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1014,12 +1014,18 @@ says which mode to use."
(tex-common-initialization))
(advice-add 'tex-mode :around #'tex--redirect-to-submode)
+(defvar tex-mode--recursing nil)
(defun tex--redirect-to-submode (orig-fun)
"Redirect to one of the submodes when called directly."
- (funcall (if delay-mode-hooks
- ;; We're called from one of the children already.
- orig-fun
- (tex--guess-mode))))
+ ;; The file may have "mode: tex" in the local variable
+ ;; block, in which case we'll be called recursively
+ ;; infinitely. Inhibit that.
+ (let ((tex-mode--recursing tex-mode--recursing))
+ (funcall (if (or delay-mode-hooks tex-mode--recursing)
+ ;; We're called from one of the children already.
+ orig-fun
+ (setq tex-mode--recursing t)
+ (tex--guess-mode)))))
;; The following three autoloaded aliases appear to conflict with
;; AUCTeX. However, even though AUCTeX uses the mixed case variants
@@ -1426,20 +1432,22 @@ on the line for the invalidity you want to see."
;; Skip "Mismatches:" header line.
(forward-line 1)
(setq num-matches (1+ num-matches))
- (insert-buffer-substring buffer start end)
- (let ((text-end (point-marker))
- (inhibit-read-only t)
- text-beg)
- (forward-char (- start end))
- (setq text-beg (point-marker))
- (insert (format "%3d: " linenum))
- (add-text-properties
- text-beg (- text-end 1)
- '(mouse-face highlight
- help-echo
- "mouse-2: go to this invalidity"))
- (put-text-property text-beg (- text-end 1)
- 'occur-target tem))))))))
+ (let ((inhibit-read-only t))
+ (insert-buffer-substring buffer start end)
+ (let ((text-end (point-marker))
+ text-beg)
+ (forward-char (- start end))
+ (setq text-beg (point-marker))
+ (insert (format "%3d: " linenum))
+ (add-text-properties
+ text-beg (- text-end 1)
+ '(mouse-face highlight
+ help-echo
+ "mouse-2: go to this invalidity"))
+ (put-text-property (point) (- text-end 1)
+ 'occur-match t)
+ (put-text-property text-beg text-end
+ 'occur-target tem)))))))))
(with-current-buffer standard-output
(let ((no-matches (zerop num-matches))
(inhibit-read-only t))
@@ -2070,7 +2078,7 @@ Return the process in which TeX is running."
(let* ((cmd (eval command t))
(proc (tex-shell-proc))
(buf (process-buffer proc))
- (star (string-match "\\*" cmd))
+ (star (string-search "*" cmd))
(string
(concat
(if (null file)
@@ -2345,7 +2353,7 @@ FILE is typically the output DVI or PDF file."
collect (cons char (shell-quote-argument file))))
(defun tex-format-cmd (format fspec)
- "Like `format-spec' but adds user-specified args to the command.
+ "Like `format-spec' but add user-specified args to the command.
Only applies the FSPEC to the args part of FORMAT."
(setq fspec (tex--quote-spec fspec))
(if (not (string-match "\\([^ /\\]+\\) " format))
@@ -2449,7 +2457,7 @@ Only applies the FSPEC to the args part of FORMAT."
(default (tex-compile-default fspec)))
(list default-directory
(completing-read
- (format "Command [%s]: " (tex-summarize-command default))
+ (format-prompt "Command" (tex-summarize-command default))
(mapcar (lambda (x)
(list (tex-format-cmd (eval (car x) t) fspec)))
tex-compile-commands)
@@ -2472,7 +2480,7 @@ Only applies the FSPEC to the args part of FORMAT."
(defun tex-start-tex (command file &optional dir)
"Start a TeX run, using COMMAND on FILE."
- (let* ((star (string-match "\\*" command))
+ (let* ((star (string-search "*" command))
(compile-command
(if star
(concat (substring command 0 star)
@@ -2531,7 +2539,10 @@ The value of `tex-command' specifies the command to use to run TeX."
(file-name-as-directory (expand-file-name tex-directory)))
(tex-out-file (expand-file-name (concat tex-zap-file ".tex")
zap-directory))
- (main-file (expand-file-name (tex-main-file)))
+ ;; We may be running from an unsaved buffer, in which case
+ ;; there's no point in guessing for a main file name.
+ (main-file (and buffer-file-name
+ (expand-file-name (tex-main-file))))
(ismain (string-equal main-file (buffer-file-name)))
already-output)
;; Don't delete temp files if we do the same buffer twice in a row.
@@ -2540,9 +2551,11 @@ The value of `tex-command' specifies the command to use to run TeX."
(let ((default-directory zap-directory)) ; why?
;; We assume the header is fully contained in tex-main-file.
;; We use f-f-ns so we get prompted about any changes on disk.
- (with-current-buffer (find-file-noselect main-file)
- (setq already-output (tex-region-header tex-out-file
- (and ismain beg))))
+ (if (not main-file)
+ (setq already-output 0)
+ (with-current-buffer (find-file-noselect main-file)
+ (setq already-output (tex-region-header tex-out-file
+ (and ismain beg)))))
;; Write out the specified region (but don't repeat anything
;; already written in the header).
(write-region (if ismain
@@ -2771,7 +2784,7 @@ so normally SUFFIX starts with one."
;; Not found, so split on first period.
(concat (file-name-directory file-name)
(substring file 0
- (string-match "\\." file))
+ (string-search "." file))
suffix)))
" "))
@@ -3335,7 +3348,6 @@ There might be text before point."
("\\oplus" . ?⊕)
("\\oslash" . ?⊘)
("\\otimes" . ?⊗)
- ("\\par" . ?
)
("\\parallel" . ?∥)
("\\partial" . ?∂)
("\\perp" . ?⊥)
@@ -3442,7 +3454,7 @@ There might be text before point."
("\\varprime" . ?′)
("\\varpropto" . ?∝)
("\\varrho" . ?ϱ)
- ("\\varsigma" ?ς)
+ ("\\varsigma" . ?ς)
("\\vartriangleleft" . ?⊲)
("\\vartriangleright" . ?⊳)
("\\vdash" . ?⊢)
@@ -3457,7 +3469,97 @@ There might be text before point."
("\\Bbb{P}" . ?ℙ) ; Also sometimes \mathbb.
("\\Bbb{Q}" . ?ℚ)
("\\Bbb{R}" . ?ℝ)
+ ("\\Bbb{T}" . ?𝕋)
("\\Bbb{Z}" . ?ℤ)
+ ("\\mathbb{N}" . ?ℕ) ; AMS commands for blackboard bold
+ ("\\mathbb{P}" . ?ℙ) ; Also sometimes \mathbb.
+ ("\\mathbb{Q}" . ?ℚ)
+ ("\\mathbb{R}" . ?ℝ)
+ ("\\mathbb{T}" . ?𝕋)
+ ("\\mathbb{Z}" . ?ℤ)
+ ("\\pm" . ?±)
+ ("\\|" . ?‖)
+ ("\\varkappa" . ?ϰ)
+ ;; caligraphic
+ ("\\mathcal{A}" . ?𝒜)
+ ("\\mathcal{B}" . ?ℬ)
+ ("\\mathcal{C}" . ?𝒞)
+ ("\\mathcal{D}" . ?𝒟)
+ ("\\mathcal{E}" . ?ℰ)
+ ("\\mathcal{F}" . ?ℱ)
+ ("\\mathcal{G}" . ?𝒢)
+ ("\\mathcal{H}" . ?ℋ)
+ ("\\mathcal{I}" . ?ℐ)
+ ("\\mathcal{J}" . ?𝒥)
+ ("\\mathcal{K}" . ?𝒦)
+ ("\\mathcal{L}" . ?ℒ)
+ ("\\mathcal{M}" . ?ℳ)
+ ("\\mathcal{N}" . ?𝒩)
+ ("\\mathcal{O}" . ?𝒪)
+ ("\\mathcal{P}" . ?𝒫)
+ ("\\mathcal{Q}" . ?𝒬)
+ ("\\mathcal{R}" . ?ℛ)
+ ("\\mathcal{S}" . ?𝒮)
+ ("\\mathcal{T}" . ?𝒯)
+ ("\\mathcal{U}" . ?𝒰)
+ ("\\mathcal{V}" . ?𝒱)
+ ("\\mathcal{W}" . ?𝒲)
+ ("\\mathcal{X}" . ?𝒳)
+ ("\\mathcal{Y}" . ?𝒴)
+ ("\\mathcal{Z}" . ?𝒵)
+ ;; fractur
+ ("\\mathfrak{A}" . ?𝔄)
+ ("\\mathfrak{B}" . ?𝔅)
+ ("\\mathfrak{C}" . ?ℭ)
+ ("\\mathfrak{D}" . ?𝔇)
+ ("\\mathfrak{E}" . ?𝔈)
+ ("\\mathfrak{F}" . ?𝔉)
+ ("\\mathfrak{G}" . ?𝔊)
+ ("\\mathfrak{H}" . ?ℌ)
+ ("\\mathfrak{I}" . ?ℑ)
+ ("\\mathfrak{J}" . ?𝔍)
+ ("\\mathfrak{K}" . ?𝔎)
+ ("\\mathfrak{L}" . ?𝔏)
+ ("\\mathfrak{M}" . ?𝔐)
+ ("\\mathfrak{N}" . ?𝔑)
+ ("\\mathfrak{O}" . ?𝔒)
+ ("\\mathfrak{P}" . ?𝔓)
+ ("\\mathfrak{Q}" . ?𝔔)
+ ("\\mathfrak{R}" . ?ℜ)
+ ("\\mathfrak{S}" . ?𝔖)
+ ("\\mathfrak{T}" . ?𝔗)
+ ("\\mathfrak{U}" . ?𝔘)
+ ("\\mathfrak{V}" . ?𝔙)
+ ("\\mathfrak{W}" . ?𝔚)
+ ("\\mathfrak{X}" . ?𝔛)
+ ("\\mathfrak{Y}" . ?𝔜)
+ ("\\mathfrak{Z}" . ?ℨ)
+ ("\\mathfrak{a}" . ?𝔞)
+ ("\\mathfrak{b}" . ?𝔟)
+ ("\\mathfrak{c}" . ?𝔠)
+ ("\\mathfrak{d}" . ?𝔡)
+ ("\\mathfrak{e}" . ?𝔢)
+ ("\\mathfrak{f}" . ?𝔣)
+ ("\\mathfrak{g}" . ?𝔤)
+ ("\\mathfrak{h}" . ?𝔥)
+ ("\\mathfrak{i}" . ?𝔦)
+ ("\\mathfrak{j}" . ?𝔧)
+ ("\\mathfrak{k}" . ?𝔨)
+ ("\\mathfrak{l}" . ?𝔩)
+ ("\\mathfrak{m}" . ?𝔪)
+ ("\\mathfrak{n}" . ?𝔫)
+ ("\\mathfrak{o}" . ?𝔬)
+ ("\\mathfrak{p}" . ?𝔭)
+ ("\\mathfrak{q}" . ?𝔮)
+ ("\\mathfrak{r}" . ?𝔯)
+ ("\\mathfrak{s}" . ?𝔰)
+ ("\\mathfrak{t}" . ?𝔱)
+ ("\\mathfrak{u}" . ?𝔲)
+ ("\\mathfrak{v}" . ?𝔳)
+ ("\\mathfrak{w}" . ?𝔴)
+ ("\\mathfrak{x}" . ?𝔵)
+ ("\\mathfrak{y}" . ?𝔶)
+ ("\\mathfrak{z}" . ?𝔷)
("--" . ?–)
("---" . ?—)
("\\ordfeminine" . ?ª)
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index 977f3bab6ce..550994cd7b6 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -932,9 +932,9 @@ commands."
"Text of the copyright notice and copying permissions.")
(defun texinfo-copying ()
- "Copy the copyright notice and copying permissions from the Texinfo file,
-as indicated by the @copying ... @end copying command;
-insert the text with the @insertcopying command."
+ "Copy the copyright notice and copying permissions from Texinfo file.
+This is indicated by the \"@copying ... @end copying\" command;
+insert the text with the \"@insertcopying\" command."
(let ((beg (progn (beginning-of-line) (point)))
(end (progn (re-search-forward "^@end copying[ \t]*\n") (point))))
(setq texinfo-copying-text
@@ -944,8 +944,8 @@ insert the text with the @insertcopying command."
(delete-region beg end)))
(defun texinfo-insertcopying ()
- "Insert the copyright notice and copying permissions from the Texinfo file,
-which are indicated by the @copying ... @end copying command."
+ "Insert the copyright notice and copying permissions from Texinfo file.
+This is indicated by the \"@copying ... @end copying\" command."
(insert (concat "\n" texinfo-copying-text)))
(put 'begin 'texinfo-format 'texinfo-format-begin)
@@ -1618,7 +1618,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.")
(if (and (symbolp (car (cdr (car texinfo-stack))))
(> 1 (length (symbol-name (car (cdr (car texinfo-stack)))))))
(error
- "@enumerate: Use a number or letter, eg: 1, A, a, 3, B, or d." ))
+ "@enumerate: Use a number or letter, eg: 1, A, a, 3, B, or d"))
(texinfo-discard-line-with-args)
(setq fill-column (- fill-column 5)))
@@ -1705,7 +1705,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.")
(if (or (equal ?\[ (string-to-char enumerating-symbol))
(equal ?\{ (string-to-char enumerating-symbol)))
(error
- "Too many items in enumerated list; alphabet ends at Z."))
+ "Too many items in enumerated list; alphabet ends at Z"))
(insert ?\b (format "%3s. " enumerating-symbol) ?\n)
(setcar (cdr (car texinfo-stack))
(make-symbol
@@ -1714,7 +1714,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.")
(string-to-char enumerating-symbol))))))
(t
(error
- "@enumerate: Use a number or letter, eg: 1, A, a, 3, B or d." )))
+ "@enumerate: Use a number or letter, eg: 1, A, a, 3, B or d")))
(forward-line -1)))
(put 'alphaenumerate 'texinfo-item 'texinfo-alphaenumerate-item)
@@ -2032,7 +2032,7 @@ commands that are defined in texinfo.tex for printed output.
;; Case 3: Trouble
(t
(error
- "You probably need to specify column widths for @multitable correctly.")))
+ "You probably need to specify column widths for @multitable correctly")))
;; Check whether columns fit on page.
(let ((desired-columns
(+
@@ -2044,7 +2044,7 @@ commands that are defined in texinfo.tex for printed output.
(apply #'+ texinfo-multitable-width-list))))
(if (> desired-columns fill-column)
(error
- "Multi-column table width, %d chars, is greater than page width, %d chars."
+ "Multi-column table width, %d chars, is greater than page width, %d chars"
desired-columns fill-column)))
texinfo-multitable-width-list))
@@ -2546,7 +2546,9 @@ If used within a line, follow `@bullet' with braces."
"smalllisp"
"\\)")
"Regexp specifying end of environments in which @kbd does not put `...'
-around argument. (See `texinfo-format-kbd-regexp')")
+around argument.
+
+See `texinfo-format-kbd-regexp'.")
(put 'kbd 'texinfo-format 'texinfo-format-kbd)
(defun texinfo-format-kbd ()
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 11d60e1eb03..71db33bae35 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -350,7 +350,7 @@ and also to be turned into Info files with \\[makeinfo-buffer] or
the `makeinfo' program. These files must be written in a very restricted and
modified version of TeX input format.
- Editing commands are like text-mode except that the syntax table is
+ Editing commands are like `text-mode' except that the syntax table is
set up so expression commands skip Texinfo bracket groups. To see
what the Info version of a region of the Texinfo file will look like,
use \\[makeinfo-region], which runs `makeinfo' on the current region.
@@ -378,15 +378,15 @@ updating menus and node pointers. These functions
Here are the functions:
- texinfo-update-node \\[texinfo-update-node]
- texinfo-every-node-update \\[texinfo-every-node-update]
- texinfo-sequential-node-update
+ `texinfo-update-node' \\[texinfo-update-node]
+ `texinfo-every-node-update' \\[texinfo-every-node-update]
+ `texinfo-sequential-node-update'
- texinfo-make-menu \\[texinfo-make-menu]
- texinfo-all-menus-update \\[texinfo-all-menus-update]
- texinfo-master-menu
+ `texinfo-make-menu' \\[texinfo-make-menu]
+ `texinfo-all-menus-update' \\[texinfo-all-menus-update]
+ `texinfo-master-menu'
- texinfo-indent-menu-description (column &optional region-p)
+ `texinfo-indent-menu-description' (column &optional region-p)
The `texinfo-column-for-description' variable specifies the column to
which menu descriptions are indented.
@@ -411,13 +411,13 @@ 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 "@[a-zA-Z]*[ \n]\\|"
- paragraph-separate))
(setq-local paragraph-start (concat "@[a-zA-Z]*[ \n]\\|"
paragraph-start))
+ (setq-local fill-paragraph-function 'texinfo--fill-paragraph)
(setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
(setq-local fill-column 70)
+ (setq-local beginning-of-defun-function #'texinfo--beginning-of-defun)
+ (setq-local end-of-defun-function #'texinfo--end-of-defun)
(setq-local comment-start "@c ")
(setq-local comment-start-skip "@c +\\|@comment +")
(setq-local words-include-escapes t)
@@ -457,6 +457,58 @@ value of `texinfo-mode-hook'."
prevent-filling
(concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
+(defvar texinfo-fillable-commands '("@noindent")
+ "A list of commands that can be filled.")
+
+(defun texinfo--fill-paragraph (justify)
+ "Function to fill a paragraph in `texinfo-mode'."
+ (let ((command-re "\\(@[a-zA-Z]+\\)[ \t\n]"))
+ (catch 'no-fill
+ (save-restriction
+ ;; First check whether we're on a command line that can be
+ ;; filled by itself.
+ (or
+ (save-excursion
+ (beginning-of-line)
+ (when (looking-at command-re)
+ (let ((command (match-string 1)))
+ (if (member command texinfo-fillable-commands)
+ (progn
+ (narrow-to-region (point) (progn (forward-line 1) (point)))
+ t)
+ (throw 'no-fill nil)))))
+ ;; We're not on such a line, so fill the region.
+ (save-excursion
+ (let ((regexp (concat command-re "\\|^[ \t]*$\\|\f")))
+ (narrow-to-region
+ (if (re-search-backward regexp nil t)
+ (progn
+ (forward-line 1)
+ (point))
+ (point-min))
+ (if (re-search-forward regexp nil t)
+ (match-beginning 0)
+ (point-max)))
+ (goto-char (point-min)))))
+ ;; We've now narrowed to the region we want to fill.
+ (let ((fill-paragraph-function nil)
+ (adaptive-fill-mode nil))
+ (fill-paragraph justify))))
+ t))
+
+(defun texinfo--beginning-of-defun (&optional arg)
+ "Go to the previous @node line."
+ (while (and (> arg 0)
+ (re-search-backward "^@node " nil t))
+ (setq arg (1- arg))))
+
+(defun texinfo--end-of-defun ()
+ "Go to the start of the next @node line."
+ (when (looking-at-p "@node")
+ (forward-line))
+ (if (re-search-forward "^@node " nil t)
+ (goto-char (match-beginning 0))
+ (goto-char (point-max))))
;;; Insert string commands
@@ -806,7 +858,8 @@ temporary file before the region itself. The buffer's header is all lines
between the strings defined by `tex-start-of-header' and `tex-end-of-header'
inclusive. The header must start in the first 100 lines.
-The value of `texinfo-tex-trailer' is appended to the temporary file after the region."
+The value of `texinfo-tex-trailer' is appended to the temporary
+file after the region."
(interactive "r")
(require 'tex-mode)
(let ((tex-command texinfo-tex-command)
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index f56f197c502..6862da60464 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -894,10 +894,10 @@ be updated first using `texinfo-make-menu' or
`texinfo-all-menus-update', which see. Alternatively, invoke
this function with a prefix argument, see below.
-Non-nil, non-numeric argument (C-u prefix, if interactive) means
+Non-nil, non-numeric argument (\\[universal-argument] prefix, if interactive) means
first update all existing menus in the buffer (incorporating
descriptions from pre-existing menus) before it constructs the
-master menu. If the argument is numeric (e.g., \"C-u 2\"),
+master menu. If the argument is numeric (e.g., \"\\[universal-argument] 2\"),
update all existing nodes as well, by calling
`texinfo-update-node' on the entire file. Warning: do NOT
invoke with a numeric argument if your Texinfo file uses @node
@@ -1508,7 +1508,7 @@ will be at some level higher in the Texinfo file. The fourth argument
'normal
'no-pointer))
(t
- (error "texinfo-find-pointer: lack proper arguments")))))
+ (error "texinfo-find-pointer: Lack proper arguments")))))
(defun texinfo-pointer-name (kind)
"Return the node name preceding the section command.
@@ -1676,7 +1676,7 @@ or `Up' pointer."
'normal
'no-pointer))
(t
- (error "texinfo-sequential-find-pointer: lack proper arguments")))))
+ (error "texinfo-sequential-find-pointer: Lack proper arguments")))))
;;; Inserting `@node' lines
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 74c6d412a65..478cf62268f 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -95,6 +95,28 @@ inherit all the commands defined in this map.")
:style toggle
:selected (memq 'turn-on-auto-fill text-mode-hook)]))
+(defun text-mode-context-menu (menu click)
+ "Populate MENU with text selection commands at CLICK."
+
+ (when (thing-at-mouse click 'word)
+ (define-key-after menu [select-region mark-word]
+ `(menu-item "Word"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'word))
+ :help "Mark the word at click for a subsequent cut/copy")
+ 'mark-whole-buffer))
+ (define-key-after menu [select-region mark-sentence]
+ `(menu-item "Sentence"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'sentence))
+ :help "Mark the sentence at click for a subsequent cut/copy")
+ 'mark-whole-buffer)
+ (define-key-after menu [select-region mark-paragraph]
+ `(menu-item "Paragraph"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'paragraph))
+ :help "Mark the paragraph at click for a subsequent cut/copy")
+ 'mark-whole-buffer)
+
+ menu)
+
(define-derived-mode text-mode nil "Text"
"Major mode for editing text written for humans to read.
@@ -104,7 +126,8 @@ You can thus get the full benefit of adaptive filling
\\{text-mode-map}
Turning on Text mode runs the normal hook `text-mode-hook'."
(setq-local text-mode-variant t)
- (setq-local require-final-newline mode-require-final-newline))
+ (setq-local require-final-newline mode-require-final-newline)
+ (add-hook 'context-menu-functions 'text-mode-context-menu 10 t))
(define-derived-mode paragraph-indent-text-mode text-mode "Parindent"
"Major mode for editing text, with leading spaces starting a paragraph.
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index 01e2ad72d88..2a4c8cff8f0 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -67,7 +67,7 @@ matching the white space). The pattern is matched case-sensitive regardless of
the value of `case-fold-search' setting."
:version "25.1"
:type 'regexp
- :safe t)
+ :safe #'stringp)
(defcustom tildify-pattern-alist ()
"Alist specifying where to insert hard spaces.
@@ -112,7 +112,7 @@ If nil, current major mode has no way to represent a hard space."
" ")
(const :tag "No-break space (U+00A0)" "\u00A0")
(string :tag "Custom string"))
- :safe t)
+ :safe #'string-or-null-p)
(defcustom tildify-string-alist ()
"Alist specifying what is a hard space in the current major mode.