summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el115
-rw-r--r--lisp/textmodes/bib-mode.el21
-rw-r--r--lisp/textmodes/bibtex-style.el5
-rw-r--r--lisp/textmodes/bibtex.el9
-rw-r--r--lisp/textmodes/conf-mode.el83
-rw-r--r--lisp/textmodes/css-mode.el22
-rw-r--r--lisp/textmodes/dns-mode.el26
-rw-r--r--lisp/textmodes/enriched.el61
-rw-r--r--lisp/textmodes/fill.el48
-rw-r--r--lisp/textmodes/flyspell.el56
-rw-r--r--lisp/textmodes/ispell.el148
-rw-r--r--lisp/textmodes/less-css-mode.el10
-rw-r--r--lisp/textmodes/makeinfo.el20
-rw-r--r--lisp/textmodes/mhtml-mode.el2
-rw-r--r--lisp/textmodes/nroff-mode.el54
-rw-r--r--lisp/textmodes/page-ext.el2
-rw-r--r--lisp/textmodes/page.el2
-rw-r--r--lisp/textmodes/paragraphs.el33
-rw-r--r--lisp/textmodes/picture.el28
-rw-r--r--lisp/textmodes/refbib.el27
-rw-r--r--lisp/textmodes/refer.el34
-rw-r--r--lisp/textmodes/refill.el21
-rw-r--r--lisp/textmodes/reftex-auc.el64
-rw-r--r--lisp/textmodes/reftex-cite.el73
-rw-r--r--lisp/textmodes/reftex-dcr.el46
-rw-r--r--lisp/textmodes/reftex-global.el34
-rw-r--r--lisp/textmodes/reftex-index.el259
-rw-r--r--lisp/textmodes/reftex-parse.el19
-rw-r--r--lisp/textmodes/reftex-ref.el40
-rw-r--r--lisp/textmodes/reftex-sel.el207
-rw-r--r--lisp/textmodes/reftex-toc.el114
-rw-r--r--lisp/textmodes/reftex-vars.el124
-rw-r--r--lisp/textmodes/reftex.el198
-rw-r--r--lisp/textmodes/remember.el106
-rw-r--r--lisp/textmodes/rst.el350
-rw-r--r--lisp/textmodes/sgml-mode.el112
-rw-r--r--lisp/textmodes/table.el110
-rw-r--r--lisp/textmodes/tex-mode.el137
-rw-r--r--lisp/textmodes/texinfmt.el176
-rw-r--r--lisp/textmodes/texinfo.el337
-rw-r--r--lisp/textmodes/texnfo-upd.el48
-rw-r--r--lisp/textmodes/text-mode.el59
-rw-r--r--lisp/textmodes/tildify.el19
-rw-r--r--lisp/textmodes/two-column.el59
44 files changed, 1557 insertions, 1961 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index e66adb43e75..d9a83c566b4 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -6,7 +6,7 @@
;; Keywords: mouse
;; Old-Version: 1.2.6
;; Release-date: 6-Aug-2004
-;; Location: http://www.lysator.liu.se/~tab/artist/
+;; Location: https://www.lysator.liu.se/~tab/artist/
;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
;; file on 19/3/2008, and the maintainer agreed that when a bug is filed in
@@ -33,7 +33,7 @@
;; What is artist?
;; ---------------
;;
-;; Artist is an Emacs lisp package that allows you to draw lines,
+;; Artist is an Emacs Lisp package that allows you to draw lines,
;; rectangles and ellipses by using your mouse and/or keyboard. The
;; shapes are made up with the ascii characters |, -, / and \.
;;
@@ -106,13 +106,6 @@
;; If you add a new drawing mode, send it to me, and I would gladly
;; include in the next release!
-;;; Installation:
-
-;; To use artist, put this in your .emacs:
-;;
-;; (autoload 'artist-mode "artist" "Enter artist-mode" t)
-
-
;;; Requirements:
;; Artist requires the `rect' package (which comes with Emacs) to be
@@ -481,50 +474,6 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.")
(defvar artist-arrow-point-1 nil)
(defvar artist-arrow-point-2 nil)
-(defvar artist-menu-map
- (let ((map (make-sparse-keymap)))
- (define-key map [spray-chars]
- '(menu-item "Characters for Spray" artist-select-spray-chars
- :help "Choose characters for sprayed by the spray-can"))
- (define-key map [borders]
- '(menu-item "Draw Shape Borders" artist-toggle-borderless-shapes
- :help "Toggle whether shapes are drawn with borders"
- :button (:toggle . (not artist-borderless-shapes))))
- (define-key map [trimming]
- '(menu-item "Trim Line Endings" artist-toggle-trim-line-endings
- :help "Toggle trimming of line-endings"
- :button (:toggle . artist-trim-line-endings)))
- (define-key map [rubber-band]
- '(menu-item "Rubber-banding" artist-toggle-rubber-banding
- :help "Toggle rubber-banding"
- :button (:toggle . artist-rubber-banding)))
- (define-key map [set-erase]
- '(menu-item "Character to Erase..." artist-select-erase-char
- :help "Choose a specific character to erase"))
- (define-key map [set-line]
- '(menu-item "Character for Line..." artist-select-line-char
- :help "Choose the character to insert when drawing lines"))
- (define-key map [set-fill]
- '(menu-item "Character for Fill..." artist-select-fill-char
- :help "Choose the character to insert when filling in shapes"))
- (define-key map [artist-separator] '(menu-item "--"))
- (dolist (op '(("Vaporize" artist-select-op-vaporize-lines vaporize-lines)
- ("Erase" artist-select-op-erase-rectangle erase-rect)
- ("Spray-can" artist-select-op-spray-set-size spray-get-size)
- ("Text" artist-select-op-text-overwrite text-ovwrt)
- ("Ellipse" artist-select-op-circle circle)
- ("Poly-line" artist-select-op-straight-poly-line spolyline)
- ("Square" artist-select-op-square square)
- ("Rectangle" artist-select-op-rectangle rectangle)
- ("Line" artist-select-op-straight-line s-line)
- ("Pen" artist-select-op-pen-line pen-line)))
- (define-key map (vector (nth 2 op))
- `(menu-item ,(nth 0 op)
- ,(nth 1 op)
- :help ,(format "Draw using the %s style" (nth 0 op))
- :button (:radio . (eq artist-curr-go ',(nth 2 op))))))
- map))
-
(defvar artist-mode-map
(let ((map (make-sparse-keymap)))
(setq artist-mode-map (make-sparse-keymap))
@@ -577,10 +526,50 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.")
(define-key map "\C-c\C-a\C-y" 'artist-select-op-paste)
(define-key map "\C-c\C-af" 'artist-select-op-flood-fill)
(define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report)
- (define-key map [menu-bar artist] (cons "Artist" artist-menu-map))
map)
"Keymap for `artist-mode'.")
+(easy-menu-define artist-menu-map artist-mode-map
+ "Menu for `artist-mode'."
+ `("Artist"
+ ,@(mapcar
+ (lambda (op)
+ `[,(nth 0 op) ,(nth 1 op)
+ :help ,(format "Draw using the %s style" (nth 0 op))
+ :style radio
+ :selected (eq artist-curr-go ',(nth 2 op))])
+ '(("Vaporize" artist-select-op-vaporize-lines vaporize-lines)
+ ("Erase" artist-select-op-erase-rectangle erase-rect)
+ ("Spray-can" artist-select-op-spray-set-size spray-get-size)
+ ("Text" artist-select-op-text-overwrite text-ovwrt)
+ ("Ellipse" artist-select-op-circle circle)
+ ("Poly-line" artist-select-op-straight-poly-line spolyline)
+ ("Square" artist-select-op-square square)
+ ("Rectangle" artist-select-op-rectangle rectangle)
+ ("Line" artist-select-op-straight-line s-line)
+ ("Pen" artist-select-op-pen-line pen-line)))
+ "---"
+ ["Character for Fill..." artist-select-fill-char
+ :help "Choose the character to insert when filling in shapes"]
+ ["Character for Line..." artist-select-line-char
+ :help "Choose the character to insert when drawing lines"]
+ ["Character to Erase..." artist-select-erase-char
+ :help "Choose a specific character to erase"]
+ ["Rubber-banding" artist-toggle-rubber-banding
+ :help "Toggle rubber-banding"
+ :style toggle
+ :selected artist-rubber-banding]
+ ["Trim Line Endings" artist-toggle-trim-line-endings
+ :help "Toggle trimming of line-endings"
+ :style toggle
+ :selected artist-trim-line-endings]
+ ["Draw Shape Borders" artist-toggle-borderless-shapes
+ :help "Toggle whether shapes are drawn with borders"
+ :style toggle
+ :selected (not artist-borderless-shapes)]
+ ["Characters for Spray" artist-select-spray-chars
+ :help "Choose characters for sprayed by the spray-can"]))
+
(defvar artist-replacement-table (make-vector 256 0)
"Replacement table for `artist-replace-char'.")
@@ -1764,13 +1753,6 @@ info-variant-part."
"Call function FN with ARGS, if FN is not nil."
`(if ,fn (funcall ,fn ,@args)))
-(defun artist-uniq (l)
- "Remove consecutive duplicates in list L. Comparison is done with `equal'."
- (cond ((null l) nil)
- ((null (cdr l)) l) ; only one element in list
- ((equal (car l) (car (cdr l))) (artist-uniq (cdr l))) ; first 2 equal
- (t (cons (car l) (artist-uniq (cdr l)))))) ; first 2 are different
-
(defun artist-string-split (str r)
"Split string STR at occurrences of regexp R, returning a list of strings."
(let ((res nil)
@@ -2772,7 +2754,7 @@ to append to the end of the list, when doing free-hand drawing)."
Also, the `artist-key-poly-point-list' is reversed."
(setq artist-key-poly-point-list
- (artist-uniq artist-key-poly-point-list))
+ (seq-uniq artist-key-poly-point-list))
(if (>= (length artist-key-poly-point-list) 2)
@@ -3470,7 +3452,7 @@ The Y-RADIUS must be 0, but the X-RADIUS must not be 0."
(line-char (if artist-line-char-set artist-line-char ?-))
(i 0)
(point-list nil)
- (fill-info nil)
+ ;; (fill-info nil)
(shape-info (make-vector 2 0)))
(while (< i width)
(let* ((line-x (+ left-edge i))
@@ -3483,7 +3465,7 @@ The Y-RADIUS must be 0, but the X-RADIUS must not be 0."
(setq point-list (append point-list (list new-coord)))
(setq i (1+ i))))
(aset shape-info 0 point-list)
- (aset shape-info 1 fill-info)
+ (aset shape-info 1 nil) ;; fill-info
(artist-make-2point-object (artist-make-endpoint x1 y1)
(artist-make-endpoint x-radius y-radius)
shape-info)))
@@ -5383,10 +5365,7 @@ The event, EV, is the mouse event."
(concat "Hello Tomas,\n\n"
"I have a nice bug report on Artist for you! Here it is:")))))
-
-;;
-;; Now provide this minor mode
-;;
+(define-obsolete-function-alias 'artist-uniq #'seq-uniq "28.1")
(provide 'artist)
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index 1e22287d32e..e2fd3ecaa42 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -1,4 +1,4 @@
-;;; bib-mode.el --- major mode for editing bib files
+;;; bib-mode.el --- major mode for editing bib files -*- lexical-binding: t -*-
;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
@@ -29,6 +29,8 @@
;; bibliography file. Keys are automagically inserted as you type,
;; and appropriate keys are presented for various kinds of entries.
+;; FIXME: Fix the namespace use of this library.
+
;;; Code:
(defgroup bib nil
@@ -39,21 +41,19 @@
(defcustom bib-file "~/my-bibliography.bib"
"Default name of file used by `addbib'."
- :type 'file
- :group 'bib)
+ :type 'file)
(defcustom unread-bib-file "~/to-be-read.bib"
"Default name of file used by `unread-bib' in Bib mode."
- :type 'file
- :group 'bib)
+ :type 'file)
(defvar bib-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map text-mode-map)
- (define-key map "\C-M" 'return-key-bib)
- (define-key map "\C-c\C-u" 'unread-bib)
- (define-key map "\C-c\C-@" 'mark-bib)
- (define-key map "\e`" 'abbrev-mode)
+ (define-key map "\C-M" #'return-key-bib)
+ (define-key map "\C-c\C-u" #'unread-bib)
+ (define-key map "\C-c\C-@" #'mark-bib)
+ (define-key map "\e`" #'abbrev-mode)
map))
(defun addbib ()
@@ -138,8 +138,7 @@ with the cdr.")
(defcustom bib-auto-capitalize t
"True to automatically capitalize appropriate fields in Bib mode."
- :type 'boolean
- :group 'bib)
+ :type 'boolean)
(defconst bib-capitalized-fields "%[AETCBIJR]")
diff --git a/lisp/textmodes/bibtex-style.el b/lisp/textmodes/bibtex-style.el
index 66d245f9083..27b2e0e3331 100644
--- a/lisp/textmodes/bibtex-style.el
+++ b/lisp/textmodes/bibtex-style.el
@@ -24,7 +24,6 @@
;; Done: font-lock, imenu, outline, commenting, indentation.
;; Todo: tab-completion.
-;; Bugs:
;;; Code:
@@ -49,7 +48,7 @@
"REVERSE" "SORT" "STRINGS"))
(defconst bibtex-style-functions
- ;; From http://www.eeng.dcu.ie/local-docs/btxdocs/btxhak/btxhak/node4.html.
+ ;; From https://www.eeng.dcu.ie/local-docs/btxdocs/btxhak/btxhak/node4.html.
'("<" ">" "=" "+" "-" "*" ":="
"add.period$" "call.type$" "change.case$" "chr.to.int$" "cite$"
"duplicate$" "empty$" "format.name$" "if$" "int.to.chr$" "int.to.str$"
@@ -70,7 +69,7 @@
(setq-local outline-regexp "^[a-z]")
(setq-local imenu-generic-expression
'((nil "\\<\\(FUNCTION\\|MACRO\\)\\s-+{\\([^}\n]+\\)}" 2)))
- (setq-local indent-line-function 'bibtex-style-indent-line)
+ (setq-local indent-line-function #'bibtex-style-indent-line)
(setq-local parse-sexp-ignore-comments t)
(setq font-lock-defaults
'(bibtex-style-font-lock-keywords nil t
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index a22cd97b309..5cece1aa3c6 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1431,7 +1431,7 @@ If `bibtex-expand-strings' is non-nil, BibTeX strings are expanded
for generating the URL.
Set this variable before loading BibTeX mode.
-The following is a complex example, see URL `http://link.aps.org/'.
+The following is a complex example, see URL `https://link.aps.org/'.
(((\"journal\" . \"\\\\=<\\(PR[ABCDEL]?\\|RMP\\)\\\\=>\")
\"http://link.aps.org/abstract/%s/v%s/p%s\"
@@ -3327,7 +3327,7 @@ Use `bibtex-summary-function' to generate summary."
(message "%s %s" key summary))))))
(defun bibtex-copy-summary-as-kill (&optional arg)
- "Push summery of current BibTeX entry to kill ring.
+ "Push summary of current BibTeX entry to kill ring.
Use `bibtex-summary-function' to generate summary.
If prefix ARG is non-nil push BibTeX entry's URL to kill ring
that is generated by calling `bibtex-url'."
@@ -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")
@@ -5608,8 +5608,5 @@ If APPEND is non-nil, append ENTRIES to those already displayed."
(setq buffer-read-only t)
(goto-char (point-min)))
-
-;; Make BibTeX a Feature
-
(provide 'bibtex)
;;; bibtex.el ends here
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index d88964aa4f0..5f34ae152d1 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -63,8 +63,7 @@ not align (only setting space according to `conf-assignment-space')."
:type 'boolean)
(defvar conf-mode-map
- (let ((map (make-sparse-keymap))
- (menu-map (make-sparse-keymap)))
+ (let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-u" 'conf-unix-mode)
(define-key map "\C-c\C-w" 'conf-windows-mode)
(define-key map "\C-c\C-j" 'conf-javaprop-mode)
@@ -78,52 +77,46 @@ not align (only setting space according to `conf-assignment-space')."
(define-key map "\C-c\"" 'conf-quote-normal)
(define-key map "\C-c'" 'conf-quote-normal)
(define-key map "\C-c\C-a" 'conf-align-assignments)
- (define-key map [menu-bar sh-script] (cons "Conf" menu-map))
- (define-key menu-map [conf-windows-mode]
- '(menu-item "Windows mode"
- conf-windows-mode
- :help "Conf Mode starter for Windows style Conf files"
- :button (:radio . (eq major-mode 'conf-windows-mode))))
- (define-key menu-map [conf-javaprop-mode]
- '(menu-item "Java properties mode"
- conf-javaprop-mode
- :help "Conf Mode starter for Java properties files"
- :button (:radio . (eq major-mode 'conf-javaprop-mode))))
- (define-key menu-map [conf-space-keywords]
- '(menu-item "Space keywords mode..."
- conf-space-keywords
- :help "Enter Conf Space mode using regexp KEYWORDS to match the keywords"
- :button (:radio . (eq major-mode 'conf-space-keywords))))
- (define-key menu-map [conf-ppd-mode]
- '(menu-item "PPD mode"
- conf-ppd-mode
- :help "Conf Mode starter for Adobe/CUPS PPD files"
- :button (:radio . (eq major-mode 'conf-ppd-mode))))
- (define-key menu-map [conf-colon-mode]
- '(menu-item "Colon mode"
- conf-colon-mode
- :help "Conf Mode starter for Colon files"
- :button (:radio . (eq major-mode 'conf-colon-mode))))
- (define-key menu-map [conf-unix-mode]
- '(menu-item "Unix mode"
- conf-unix-mode
- :help "Conf Mode starter for Unix style Conf files"
- :button (:radio . (eq major-mode 'conf-unix-mode))))
- (define-key menu-map [conf-xdefaults-mode]
- '(menu-item "Xdefaults mode"
- conf-xdefaults-mode
- :help "Conf Mode starter for Xdefaults files"
- :button (:radio . (eq major-mode 'conf-xdefaults-mode))))
- (define-key menu-map [c-s0] '("--"))
- (define-key menu-map [conf-quote-normal]
- '(menu-item "Set quote syntax normal" conf-quote-normal
- :help "Set the syntax of \\=' and \" to punctuation"))
- (define-key menu-map [conf-align-assignments]
- '(menu-item "Align assignments" conf-align-assignments
- :help "Align assignments"))
map)
"Local keymap for `conf-mode' buffers.")
+(easy-menu-define conf-mode-menu conf-mode-map
+ "Menu for `conf-mode'."
+ '("Conf"
+ ["Align assignments" conf-align-assignments
+ :help "Align assignments"]
+ ["Set quote syntax normal" conf-quote-normal
+ :help "Set the syntax of \\=' and \" to punctuation"]
+ "---"
+ ["Xdefaults mode" conf-xdefaults-mode
+ :help "Conf Mode starter for Xdefaults files"
+ :style radio
+ :selected (eq major-mode 'conf-xdefaults-mode)]
+ ["Unix mode" conf-unix-mode
+ :help "Conf Mode starter for Unix style Conf files"
+ :style radio
+ :selected (eq major-mode 'conf-unix-mode)]
+ ["Colon mode" conf-colon-mode
+ :help "Conf Mode starter for Colon files"
+ :style radio
+ :selected (eq major-mode 'conf-colon-mode)]
+ ["PPD mode" conf-ppd-mode
+ :help "Conf Mode starter for Adobe/CUPS PPD files"
+ :style radio
+ :selected (eq major-mode 'conf-ppd-mode)]
+ ["Space keywords mode..." conf-space-keywords
+ :help "Enter Conf Space mode using regexp KEYWORDS to match the keywords"
+ :style radio
+ :selected (eq major-mode 'conf-space-keywords)]
+ ["Java properties mode" conf-javaprop-mode
+ :help "Conf Mode starter for Java properties files"
+ :style radio
+ :selected (eq major-mode 'conf-javaprop-mode)]
+ ["Windows mode" conf-windows-mode
+ :help "Conf Mode starter for Windows style Conf files"
+ :style radio
+ :selected (eq major-mode 'conf-windows-mode)]))
+
(defvar conf-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?= "." table)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 622853da456..61a2f6b3bc0 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -427,7 +427,7 @@
"paged-y" "paged-x-controls" "paged-y-controls" "fragments")
;; CSS Text Decoration Module Level 3
- ;; (http://dev.w3.org/csswg/css-text-decor-3/#property-index)
+ ;; (https://dev.w3.org/csswg/css-text-decor-3/#property-index)
("text-decoration" text-decoration-line text-decoration-style
text-decoration-color)
("text-decoration-color" color)
@@ -1307,10 +1307,14 @@ for determining whether point is within a selector."
(let ((pos (point)))
(skip-chars-backward "-[:alnum:]")
(when (eq (char-before) ?\:)
- (list (point) pos
- (if (eq (char-before (- (point) 1)) ?\:)
- css-pseudo-element-ids
- css-pseudo-class-ids))))))
+ (let ((double-colon (eq (char-before (- (point) 1)) ?\:)))
+ (list (- (point) (if double-colon 2 1))
+ pos
+ (nconc
+ (unless double-colon
+ (mapcar (lambda (id) (concat ":" id)) css-pseudo-class-ids))
+ (mapcar (lambda (id) (concat "::" id)) css-pseudo-element-ids))
+ :company-kind (lambda (_) 'function)))))))
(defun css--complete-at-rule ()
"Complete at-rule (statement beginning with `@') at point."
@@ -1318,7 +1322,8 @@ for determining whether point is within a selector."
(let ((pos (point)))
(skip-chars-backward "-[:alnum:]")
(when (eq (char-before) ?\@)
- (list (point) pos css--at-ids)))))
+ (list (point) pos css--at-ids
+ :company-kind (lambda (_) 'keyword))))))
(defvar css--property-value-cache
(make-hash-table :test 'equal :size (length css-property-alist))
@@ -1366,7 +1371,8 @@ the string PROPERTY."
(skip-chars-backward "[:graph:]")
(list (point) end
(append '("inherit" "initial" "unset")
- (css--property-values (car property)))))))))
+ (css--property-values (car property)))
+ :company-kind (lambda (_) 'value)))))))
(defvar css--html-tags (mapcar #'car html-tag-alist)
"List of HTML tags.
@@ -1435,6 +1441,8 @@ tags, classes and IDs."
(list prop-beg prop-end)
(list sel-beg sel-end))
,(completion-table-merge prop-table sel-table)
+ :company-kind
+ ,(lambda (s) (if (test-completion s prop-table) 'property 'keyword))
:exit-function
,(lambda (string status)
(and (eq status 'finished)
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 23a622992ad..2fa5e8de398 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -1,4 +1,4 @@
-;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files
+;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files -*- lexical-binding: t -*-
;; Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc.
@@ -70,23 +70,19 @@
(defface dns-mode-control-entity '((t :inherit font-lock-keyword-face))
"Face used for DNS control entities, e.g. $ORIGIN."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-bad-control-entity '((t :inherit font-lock-warning-face))
"Face used for non-standard DNS control entities, e.g. $FOO."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-type '((t :inherit font-lock-type-face))
"Face used for DNS types, e.g., SOA."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-class '((t :inherit font-lock-constant-face))
"Face used for DNS classes, e.g., IN."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defvar dns-mode-control-entity-face ''dns-mode-control-entity
"Name of face used for control entities, e.g. $ORIGIN.")
@@ -121,8 +117,7 @@
(,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
"Font lock keywords used to highlight text in DNS master file mode."
:version "26.1"
- :type 'sexp
- :group 'dns-mode)
+ :type 'sexp)
(defcustom dns-mode-soa-auto-increment-serial t
"Whether to increment the SOA serial number automatically.
@@ -134,8 +129,7 @@ manually with \\[dns-mode-soa-increment-serial]."
:type '(choice (const :tag "Always" t)
(const :tag "Ask" ask)
(const :tag "Never" nil))
- :safe 'symbolp
- :group 'dns-mode)
+ :safe 'symbolp)
;; Syntax table.
@@ -150,8 +144,8 @@ manually with \\[dns-mode-soa-increment-serial]."
(defvar dns-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial)
- (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles)
+ (define-key map "\C-c\C-s" #'dns-mode-soa-increment-serial)
+ (define-key map "\C-c\C-e" #'dns-mode-ipv6-to-nibbles)
map)
"Keymap for DNS master file mode.")
@@ -183,7 +177,7 @@ Turning on DNS mode runs `dns-mode-hook'."
(setq-local comment-start-skip ";+ *")
(setq-local font-lock-defaults
'(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))
- (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
+ (add-hook 'before-save-hook #'dns-mode-soa-maybe-increment-serial
nil t))
;;;###autoload (defalias 'zone-mode 'dns-mode)
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index fe92d603065..877658a5a55 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -1,4 +1,4 @@
-;;; enriched.el --- read and save files in text/enriched format
+;;; enriched.el --- read and save files in text/enriched format -*- lexical-binding: t; -*-
;; Copyright (C) 1994-1996, 2001-2021 Free Software Foundation, Inc.
@@ -38,7 +38,7 @@
;;; Code:
-(provide 'enriched)
+(require 'facemenu)
;;;
;;; Variables controlling the display
@@ -50,8 +50,7 @@
(defcustom enriched-verbose t
"If non-nil, give status messages when reading and writing files."
- :type 'boolean
- :group 'enriched)
+ :type 'boolean)
;;;
;;; Set up faces & display table
@@ -65,14 +64,12 @@
"Face used for text that must be shown in fixed width.
Currently, Emacs can only display fixed-width fonts, but this may change.
This face is used for text specifically marked as fixed-width, for example
-in text/enriched files."
- :group 'enriched)
+in text/enriched files.")
(defface excerpt
'((t (:slant italic)))
"Face used for text that is an excerpt from another document.
-This is used in Enriched mode for text explicitly marked as an excerpt."
- :group 'enriched)
+This is used in Enriched mode for text explicitly marked as an excerpt.")
(defconst enriched-display-table (or (copy-sequence standard-display-table)
(make-display-table)))
@@ -146,8 +143,7 @@ Any property that is neither on this list nor dealt with by
If you set variables in this hook, you should arrange for them to be restored
to their old values if you leave Enriched mode. One way to do this is to add
them and their old values to `enriched-old-bindings'."
- :type 'hook
- :group 'enriched)
+ :type 'hook)
(defcustom enriched-allow-eval-in-display-props nil
"If non-nil allow to evaluate arbitrary forms in display properties.
@@ -162,8 +158,7 @@ Note, however, that applying unsafe display properties could
execute malicious Lisp code, if that code came from an external source."
:risky t
:type 'boolean
- :version "26.1"
- :group 'enriched)
+ :version "26.1")
(defvar-local enriched-old-bindings nil
"Store old variable values that we change when entering mode.
@@ -186,14 +181,16 @@ The value is a list of \(VAR VALUE VAR VALUE...).")
(defvar enriched-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-m" 'reindent-then-newline-and-indent)
+ ;; FIXME: These newline/reindent bindings might be redundant now
+ ;; that we have `electric-indent-mode' enabled by default.
+ (define-key map "\C-m" #'reindent-then-newline-and-indent)
(define-key map
- [remap newline-and-indent] 'reindent-then-newline-and-indent)
+ [remap newline-and-indent] #'reindent-then-newline-and-indent)
(define-key map "\M-j" 'facemenu-justification-menu)
- (define-key map "\M-S" 'set-justification-center)
- (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-S" #'set-justification-center)
+ (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)
map)
"Keymap for Enriched mode.")
@@ -220,7 +217,7 @@ Commands:
(cond ((null enriched-mode)
;; Turn mode off
(remove-hook 'change-major-mode-hook
- 'enriched-before-change-major-mode 'local)
+ #'enriched-before-change-major-mode 'local)
(setq buffer-file-format (delq 'text/enriched buffer-file-format))
;; restore old variable values
(while enriched-old-bindings
@@ -237,7 +234,7 @@ Commands:
(t ; Turn mode on
(add-hook 'change-major-mode-hook
- 'enriched-before-change-major-mode nil 'local)
+ #'enriched-before-change-major-mode nil 'local)
(add-to-list 'buffer-file-format 'text/enriched)
;; Save old variable values before we change them.
;; These will be restored if we exit Enriched mode.
@@ -250,10 +247,12 @@ Commands:
(make-local-variable 'default-text-properties)
(setq buffer-display-table enriched-display-table)
(use-hard-newlines 1 (if enriched-rerun-flag 'never nil))
- (let ((sticky (plist-get default-text-properties 'front-sticky))
- (p enriched-par-props))
- (dolist (x p)
- (add-to-list 'sticky x))
+ (let* ((sticky
+ (delete-dups
+ (append
+ enriched-par-props
+ (copy-sequence
+ (plist-get default-text-properties 'front-sticky))))))
(if sticky
(setq default-text-properties
(plist-put default-text-properties
@@ -269,7 +268,7 @@ Commands:
(let ((enriched-rerun-flag t))
(enriched-mode 1))))
-(add-hook 'after-change-major-mode-hook 'enriched-after-change-major-mode)
+(add-hook 'after-change-major-mode-hook #'enriched-after-change-major-mode)
(fset 'enriched-mode-map enriched-mode-map)
@@ -347,7 +346,7 @@ the region, and the START and END of each region."
(if orig-buf (set-buffer orig-buf))
(funcall enriched-initial-annotation))))
(enriched-map-property-regions 'hard
- (lambda (v b e)
+ (lambda (v b _e)
(if (and v (= ?\n (char-after b)))
(progn (goto-char b) (insert "\n"))))
(point) nil)
@@ -391,9 +390,11 @@ which can be the value of the `face' text property."
((and (listp face) (eq (car face) :background))
(list (list "x-bg-color" (cadr face))))
((listp face)
- (apply 'append (mapcar 'enriched-face-ans face)))
+ (apply #'append (mapcar #'enriched-face-ans face)))
((let* ((fg (face-attribute face :foreground))
(bg (face-attribute face :background))
+ (weight (face-attribute face :weight))
+ (slant (face-attribute face :slant))
(props (face-font face t))
(ans (cdr (format-annotate-single-property-change
'face nil props enriched-translations))))
@@ -401,6 +402,10 @@ which can be the value of the `face' text property."
(setq ans (cons (list "x-color" fg) ans)))
(unless (eq bg 'unspecified)
(setq ans (cons (list "x-bg-color" bg) ans)))
+ (if (eq weight 'bold)
+ (setq ans (cons (list "bold") ans)))
+ (if (eq slant 'italic)
+ (setq ans (cons (list "italic") ans)))
ans))))
;;;
@@ -533,4 +538,6 @@ the range of text to assign text property SYMBOL with value VALUE."
(list start end 'display prop)
(list start end 'display (list 'disable-eval prop)))))
+(provide 'enriched)
+
;;; enriched.el ends here
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 6681b03913c..f394171fb6c 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -45,14 +45,16 @@ A value of nil means that any change in indentation starts a new paragraph."
(defcustom colon-double-space nil
"Non-nil means put two spaces after a colon when filling."
:type 'boolean)
-(put 'colon-double-space 'safe-local-variable 'booleanp)
+(put 'colon-double-space 'safe-local-variable #'booleanp)
(defcustom fill-separate-heterogeneous-words-with-space nil
"Non-nil means to use a space to separate words of a different kind.
-This will be done with a word in the end of a line and a word in
-the beginning of the next line when concatenating them for
-filling those lines. Whether to use a space depends on how the
-words are categorized."
+For example, when an English word at the end of a line and a CJK word
+at the beginning of the next line are joined into a single line, they
+will be separated by a space if this variable is non-nil.
+Whether to use a space to separate such words also depends on the entry
+in `fill-nospace-between-words-table' for the characters before and
+after the newline."
:type 'boolean
:version "26.1")
@@ -131,6 +133,8 @@ A nil return value means the function has not determined the fill prefix."
(defvar fill-indent-according-to-mode nil ;Screws up CC-mode's filling tricks.
"Whether or not filling should try to use the major mode's indentation.")
+(defvar current-fill-column--has-warned nil)
+
(defun current-fill-column ()
"Return the fill-column to use for this line.
The fill-column to use for a buffer is stored in the variable `fill-column',
@@ -156,7 +160,14 @@ number equals or exceeds the local fill-column - right-margin difference."
(< col fill-col)))
(setq here change
here-col col))
- (max here-col fill-col)))))
+ (max here-col fill-col))
+ ;; This warning was added in 28.1. It should be removed later,
+ ;; and this function changed to never return nil.
+ (unless current-fill-column--has-warned
+ (lwarn '(fill-column) :warning
+ "Setting this variable to nil is obsolete; use `(auto-fill-mode -1)' instead")
+ (setq current-fill-column--has-warned t))
+ most-positive-fixnum)))
(defun canonically-space-region (beg end)
"Remove extra spaces between words in region.
@@ -412,12 +423,12 @@ and `fill-nobreak-invisible'."
;; Register `kinsoku' for scripts HAN, KANA, BOPOMOFO, and CJK-MISC.
;; Also tell that they don't use space between words.
(map-char-table
- #'(lambda (key val)
- (when (memq val '(han kana bopomofo cjk-misc))
- (set-char-table-range fill-find-break-point-function-table
- key 'kinsoku)
- (set-char-table-range fill-nospace-between-words-table
- key t)))
+ (lambda (key val)
+ (when (memq val '(han kana bopomofo cjk-misc))
+ (set-char-table-range fill-find-break-point-function-table
+ key 'kinsoku)
+ (set-char-table-range fill-nospace-between-words-table
+ key t)))
char-script-table)
;; Do the same thing also for full width characters and half
;; width kana variants.
@@ -703,7 +714,8 @@ space does not end a sentence, so don't break a line there."
(or justify (setq justify (current-justification)))
;; Don't let Adaptive Fill mode alter the fill prefix permanently.
- (let ((fill-prefix fill-prefix))
+ (let ((actual-fill-prefix fill-prefix)
+ (fill-prefix fill-prefix))
;; Figure out how this paragraph is indented, if desired.
(when (and adaptive-fill-mode
(or (null fill-prefix) (string= fill-prefix "")))
@@ -717,7 +729,7 @@ space does not end a sentence, so don't break a line there."
(goto-char from)
(beginning-of-line)
- (if (not justify) ; filling disabled: just check indentation
+ (if (not justify) ; filling disabled: just check indentation
(progn
(goto-char from)
(while (< (point) to)
@@ -747,12 +759,14 @@ space does not end a sentence, so don't break a line there."
linebeg)
(while (< (point) to)
;; On the first line, there may be text in the fill prefix
- ;; zone. In that case, don't consider that area when
- ;; trying to find a place to put a line break (bug#45720).
+ ;; zone (when `fill-prefix' is specified externally, and
+ ;; not computed). In that case, don't consider that area
+ ;; when trying to find a place to put a line break
+ ;; (bug#45720).
(if (not first)
(setq linebeg (point))
(setq first nil
- linebeg (+ (point) (length fill-prefix))))
+ linebeg (+ (point) (length actual-fill-prefix))))
(move-to-column (current-fill-column))
(if (when (< (point) to)
;; Find the position where we'll break the line.
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 83dba7177ab..836d889a1cf 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -77,7 +77,7 @@ Detection of repeated words is not implemented in
"A list of exceptions for duplicated words.
It should be a list of (LANGUAGE . EXCEPTION-LIST).
-LANGUAGE is nil, which means the exceptions apply regardless of
+LANGUAGE can be nil, which means the exceptions apply regardless of
the current dictionary, or a regular expression matching the
dictionary name (`ispell-local-dictionary' or
`ispell-dictionary') for which the exceptions should apply.
@@ -401,18 +401,12 @@ like <img alt=\"Some thing.\">."
(let ((f (get-text-property (1- (point)) 'face)))
(memq f flyspell-prog-text-faces))))
-(defvar flyspell--prev-meta-tab-binding nil
- "Records the binding of M-TAB in effect before flyspell was activated.")
-
;;;###autoload
(defun flyspell-prog-mode ()
"Turn on `flyspell-mode' for comments and strings."
(interactive)
(setq flyspell-generic-check-word-predicate
#'flyspell-generic-progmode-verify)
- (setq-local flyspell--prev-meta-tab-binding
- (or (local-key-binding "\M-\t" t)
- (global-key-binding "\M-\t" t)))
(flyspell-mode 1)
(run-hooks 'flyspell-prog-mode-hook))
@@ -1263,14 +1257,27 @@ spell-check."
(t
(setq flyspell-word-cache-result nil)
;; Highlight the location as incorrect,
- ;; including offset specified in POSS.
+ ;; including offset specified in POSS
+ ;; and only for the length of the
+ ;; misspelled word specified by POSS.
(if flyspell-highlight-flag
- (flyspell-highlight-incorrect-region
- (if (and (consp poss)
- (integerp (nth 1 poss)))
- (+ start (nth 1 poss) -1)
- start)
- end poss)
+ (let ((hstart start)
+ (hend end)
+ offset misspelled)
+ (when (consp poss)
+ (setq misspelled (car poss)
+ offset (nth 1 poss))
+ (if (integerp offset)
+ (setq hstart (+ start offset -1)))
+ ;; POSS includes the misspelled
+ ;; word; use that to figure out
+ ;; how many characters to highlight.
+ (if (stringp misspelled)
+ (setq hend
+ (+ hstart
+ (length misspelled)))))
+ (flyspell-highlight-incorrect-region
+ hstart hend poss))
(flyspell-notify-misspell word poss))
nil))))
;; return to original location
@@ -1977,15 +1984,14 @@ spell-check."
(interactive)
;; If we are not in the construct where flyspell should be active,
;; invoke the original binding of M-TAB, if that was recorded.
- (if (and (local-variable-p 'flyspell--prev-meta-tab-binding)
- (commandp flyspell--prev-meta-tab-binding t)
- (functionp flyspell-generic-check-word-predicate)
- (not (funcall flyspell-generic-check-word-predicate))
- (equal (where-is-internal 'flyspell-auto-correct-word nil t)
- [?\M-\t]))
- (call-interactively flyspell--prev-meta-tab-binding)
- (let ((pos (point))
- (old-max (point-max)))
+ (let ((pos (point))
+ (old-max (point-max))
+ (next-cmd (and (functionp flyspell-generic-check-word-predicate)
+ (not (funcall flyspell-generic-check-word-predicate))
+ (let ((flyspell-mode nil))
+ (key-binding (this-command-keys))))))
+ (if next-cmd
+ (command-execute next-cmd)
;; Flush a possibly stale cache from previous invocations of
;; flyspell-auto-correct-word/flyspell-auto-correct-previous-word.
(if (not (memq last-command '(flyspell-auto-correct-word
@@ -2293,8 +2299,8 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
corrects)
'()))
(affix (car (cdr (cdr (cdr poss)))))
- show-affix-info
- (base-menu (let ((save (if (and (consp affix) show-affix-info)
+ ;; show-affix-info
+ (base-menu (let ((save (if nil ;; (and (consp affix) show-affix-info)
(list
(list (concat "Save affix: " (car affix))
'save)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index ea46270508e..67852998f42 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -131,8 +131,7 @@
(defcustom ispell-highlight-p 'block
"Highlight spelling errors when non-nil.
When set to `block', assumes a block cursor with TTY displays."
- :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t)))
(defcustom ispell-lazy-highlight (boundp 'lazy-highlight-cleanup)
"Controls the lazy-highlighting of spelling errors.
@@ -141,7 +140,6 @@ error is highlighted lazily using isearch lazy highlighting (see
`lazy-highlight-initial-delay' and `lazy-highlight-interval')."
:type 'boolean
:group 'lazy-highlight
- :group 'ispell
:version "22.1")
(defcustom ispell-highlight-face (if ispell-lazy-highlight 'isearch 'highlight)
@@ -149,16 +147,14 @@ error is highlighted lazily using isearch lazy highlighting (see
This variable can be set by the user to whatever face they desire.
It's most convenient if the cursor color and highlight color are
slightly different."
- :type 'face
- :group 'ispell)
+ :type 'face)
(defcustom ispell-check-comments t
"Spelling of comments checked when non-nil.
When set to `exclusive', ONLY comments are checked. (For code comments).
Warning! Not checking comments, when a comment start is embedded in strings,
may produce undesired results."
- :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t)))
;;;###autoload
(put 'ispell-check-comments 'safe-local-variable
(lambda (a) (memq a '(nil t exclusive))))
@@ -166,8 +162,7 @@ may produce undesired results."
(defcustom ispell-query-replace-choices nil
"Corrections made throughout region when non-nil.
Uses `query-replace' (\\[query-replace]) for corrections."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-skip-tib nil
"Does not spell check `tib' bibliography references when non-nil.
@@ -177,8 +172,7 @@ Skips any text between strings matching regular expressions
TeX users beware: Any text between [. and .] will be skipped -- even if
that's your whole buffer -- unless you set `ispell-skip-tib' to nil.
That includes the [.5mm] type of number..."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defvar ispell-tib-ref-beginning "[[<]\\."
"Regexp matching the beginning of a Tib reference.")
@@ -189,14 +183,12 @@ That includes the [.5mm] type of number..."
(defcustom ispell-keep-choices-win t
"If non-nil, keep the `*Choices*' window for the entire spelling session.
This minimizes redisplay thrashing."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-choices-win-default-height 2
"The default size of the `*Choices*' window, including the mode line.
Must be greater than 1."
- :type 'integer
- :group 'ispell)
+ :type 'integer)
(defcustom ispell-program-name
(or (executable-find "aspell")
@@ -211,8 +203,7 @@ Must be greater than 1."
:set (lambda (symbol value)
(set-default symbol value)
(if (featurep 'ispell)
- (ispell-set-spellchecker-params)))
- :group 'ispell)
+ (ispell-set-spellchecker-params))))
(defcustom ispell-alternate-dictionary
(cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2")
@@ -224,14 +215,12 @@ Must be greater than 1."
"/usr/share/lib/dict/words")
((file-readable-p "/sys/dict") "/sys/dict"))
"Alternate plain word-list dictionary for spelling help."
- :type '(choice file (const :tag "None" nil))
- :group 'ispell)
+ :type '(choice file (const :tag "None" nil)))
(defcustom ispell-complete-word-dict nil
"Plain word-list dictionary used for word completion if
different from `ispell-alternate-dictionary'."
- :type '(choice file (const :tag "None" nil))
- :group 'ispell)
+ :type '(choice file (const :tag "None" nil)))
(defcustom ispell-message-dictionary-alist nil
"List used by `ispell-message' to select a new dictionary.
@@ -241,29 +230,25 @@ DICTIONARY if `ispell-local-dictionary' is not buffer-local.
E.g. you may use the following value:
((\"^Newsgroups:[ \\t]*de\\\\.\" . \"deutsch8\")
(\"^To:[^\\n,]+\\\\.de[ \\t\\n,>]\" . \"deutsch8\"))"
- :type '(repeat (cons regexp string))
- :group 'ispell)
+ :type '(repeat (cons regexp string)))
(defcustom ispell-message-fcc-skip 50000
"Query before saving Fcc message copy if attachment larger than this value.
Always stores Fcc copy of message when nil."
- :type '(choice integer (const :tag "off" nil))
- :group 'ispell)
+ :type '(choice integer (const :tag "off" nil)))
(defcustom ispell-grep-command
"grep"
"Name of the grep command for search processes."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-grep-options
"-Ei"
"String of options to use when running the program in `ispell-grep-command'.
Should probably be \"-Ei\"."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-look-command
(cond ((file-exists-p "/bin/look") "/bin/look")
@@ -272,36 +257,30 @@ Should probably be \"-Ei\"."
(t "look"))
"Name of the look command for search processes.
This must be an absolute file name."
- :type 'file
- :group 'ispell)
+ :type 'file)
(defcustom ispell-look-p (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
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-have-new-look nil
"Non-nil means use the `-r' option (regexp) when running `look'."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-look-options (if ispell-have-new-look "-dfr" "-df")
"String of command options for `ispell-look-command'."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-use-ptys-p nil
"When non-nil, Emacs uses ptys to communicate with Ispell.
When nil, Emacs uses pipes."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-following-word nil
"Non-nil means `ispell-word' checks the word around or after point.
Otherwise `ispell-word' checks the preceding word."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-help-in-bufferp nil
"Non-nil means display interactive keymap help in a buffer.
@@ -312,21 +291,18 @@ The following values are supported:
for a couple of seconds.
electric Pop up a new buffer and display a long help message there.
User can browse and then exit the help mode."
- :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t)))
(defcustom ispell-quietly nil
"Non-nil means suppress messages in `ispell-word'."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(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)
+ :type 'function)
;; FIXME framepop.el last updated c 2003 (?),
;; use posframe.
@@ -335,21 +311,18 @@ The function must take one string argument and return a string."
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 (display-graphic-p) (require \\='framepop nil t))"
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
;;;###autoload
(defcustom ispell-personal-dictionary nil
"File name of your personal spelling dictionary, or nil.
If nil, the default personal dictionary for your spelling checker is used."
:type '(choice file
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
(defcustom ispell-silently-savep nil
"When non-nil, save personal dictionary without asking for confirmation."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defvar-local ispell-local-dictionary-overridden nil
"Non-nil means the user has explicitly set this buffer's Ispell dictionary.")
@@ -366,8 +339,7 @@ calling \\[ispell-change-dictionary] with that value. This variable
is automatically set when defined in the file with either
`ispell-dictionary-keyword' or the Local Variable syntax."
:type '(choice string
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
;;;###autoload
(put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p)
@@ -376,16 +348,14 @@ is automatically set when defined in the file with either
(defcustom ispell-dictionary nil
"Default dictionary to use if `ispell-local-dictionary' is nil."
:type '(choice string
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
(defcustom ispell-extra-args nil
"If non-nil, a list of extra switches to pass to the Ispell program.
For example, (\"-W\" \"3\") to cause it to accept all 1-3 character
words as correct. See also `ispell-dictionary-alist', which may be used
for language-specific arguments."
- :type '(repeat string)
- :group 'ispell)
+ :type '(repeat string))
@@ -400,8 +370,7 @@ such as \"&amp;\". See `ispell-html-skip-alists' for more details.
This variable affects spell-checking of HTML, XML, and SGML files."
:type '(choice (const :tag "always" t) (const :tag "never" nil)
- (const :tag "use-mode-name" use-mode-name))
- :group 'ispell)
+ (const :tag "use-mode-name" use-mode-name)))
(make-variable-buffer-local 'ispell-skip-html)
@@ -427,8 +396,7 @@ re-start Emacs."
(const "~nroff") (const "~list")
(const "~latin1") (const "~latin3")
(const :tag "default" nil))
- (coding-system :tag "Coding System")))
- :group 'ispell)
+ (coding-system :tag "Coding System"))))
(defvar ispell-dictionary-base-alist
@@ -681,11 +649,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
@@ -1108,7 +1072,7 @@ dictionary from that list was found."
(split-string
(with-temp-buffer
(ispell-call-process ispell-program-name
- null-device
+ nil
t
nil
"-D"
@@ -1239,22 +1203,11 @@ If LANG is omitted, get the extra word characters for the default language."
(split-string
(ispell--call-enchant-lsmod "-list-dicts") " ([^)]+)\n" t))
(found
- (mapcar #'(lambda (lang)
- `(,lang "[[:alpha:]]" "[^[:alpha:]]"
- ,(ispell--get-extra-word-characters lang) t nil nil utf-8))
+ (mapcar (lambda (lang)
+ `(,lang "[[:alpha:]]" "[^[:alpha:]]"
+ ,(ispell--get-extra-word-characters lang) t nil nil utf-8))
dictionaries)))
- ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist
- ;; which have no element in FOUND at all.
- (dolist (dict ispell-dictionary-base-alist)
- (unless (assoc (car dict) found)
- (setq found (nconc found (list dict)))))
- (setq ispell-enchant-dictionary-alist found)
- ;; Add a default entry
- (let ((default-dict
- `(nil "[[:alpha:]]" "[^[:alpha:]]"
- ,(ispell--get-extra-word-characters)
- t nil nil utf-8)))
- (push default-dict ispell-enchant-dictionary-alist))))
+ (setq ispell-enchant-dictionary-alist found)))
;; Set params according to the selected spellchecker
@@ -1277,7 +1230,7 @@ aspell is used along with Emacs).")
(defun ispell-set-spellchecker-params ()
"Initialize some spellchecker parameters when changed or first used."
- (unless (eq ispell-last-program-name ispell-program-name)
+ (unless (equal ispell-last-program-name ispell-program-name)
(ispell-kill-ispell t)
(if (and (condition-case ()
(progn
@@ -1797,10 +1750,12 @@ You can set this variable in hooks in your init file -- eg:
If asynchronous subprocesses are not supported, call function `ispell-filter'
and pass it the output of the last Ispell invocation."
(if ispell-async-processp
- (let ((timeout (if timeout-msecs
- (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
- timeout-secs)))
- (accept-process-output ispell-process timeout))
+ (if (process-live-p ispell-process)
+ (let ((timeout (if timeout-msecs
+ (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+ timeout-secs)))
+ (accept-process-output ispell-process timeout))
+ (error "No Ispell process to read output from!"))
(if (null ispell-process)
(error "No Ispell process to read output from!")
(let ((buf ispell-output-buffer)
@@ -1825,7 +1780,8 @@ Only works for Aspell and Enchant."
(defun ispell-send-string (string)
"Send the string STRING to the Ispell process."
(if ispell-async-processp
- (process-send-string ispell-process string)
+ (if (process-live-p ispell-process)
+ (process-send-string ispell-process string))
;; Asynchronous subprocesses aren't supported on this losing system.
;; We keep all the directives passed to Ispell during the entire
;; session in a buffer, and pass them anew each time we invoke
@@ -2541,7 +2497,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))
@@ -2604,7 +2560,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
@@ -2776,11 +2732,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))
@@ -3776,7 +3732,7 @@ SPC.
For spell-checking \"on the fly\", not just after typing SPC or
RET, use `flyspell-mode'."
- nil " Spell" ispell-minor-keymap)
+ :lighter " Spell" :keymap ispell-minor-keymap)
(defun ispell-minor-check ()
"Check previous word, then continue with the normal binding of this key.
@@ -4121,7 +4077,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))))))))
diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el
index 24ccb3ce980..d374cab27a4 100644
--- a/lisp/textmodes/less-css-mode.el
+++ b/lisp/textmodes/less-css-mode.el
@@ -91,7 +91,7 @@ executable, e.g.: \"~/.gem/ruby/1.8/bin/lessc\"."
"If non-nil, Less buffers are compiled to CSS after each save."
:type 'boolean)
;;;###autoload
-(put 'less-css-compile-at-save 'safe-local-variable 'booleanp)
+(put 'less-css-compile-at-save 'safe-local-variable #'booleanp)
(defcustom less-css-lessc-options '("--no-color")
"Command line options for Less executable.
@@ -107,7 +107,7 @@ using `expand-file-name', so both relative and absolute paths
will work as expected."
:type '(choice (const :tag "Same as Less file" nil) directory))
;;;###autoload
-(put 'less-css-output-directory 'safe-local-variable 'stringp)
+(put 'less-css-output-directory 'safe-local-variable #'stringp)
(defcustom less-css-output-file-name nil
"File name in which to save CSS, or nil to use <name>.css for <name>.less.
@@ -133,7 +133,7 @@ the path is relative, it will be relative to the current
directory by default."
:type '(choice (const nil) file))
;;;###autoload
-(put 'less-css-input-file-name 'safe-local-variable 'stringp)
+(put 'less-css-input-file-name 'safe-local-variable #'stringp)
(make-variable-buffer-local 'less-css-input-file-name)
(defconst less-css-default-error-regex
@@ -211,7 +211,7 @@ directory by default."
(defvar less-css-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-c" 'less-css-compile)
+ (define-key map "\C-c\C-c" #'less-css-compile)
map))
;;;###autoload (add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode))
@@ -226,7 +226,7 @@ Special commands:
(setq-local comment-continue " *")
(setq-local comment-start-skip "/[*/]+[ \t]*")
(setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)")
- (add-hook 'after-save-hook 'less-css-compile-maybe nil t))
+ (add-hook 'after-save-hook #'less-css-compile-maybe nil t))
(provide 'less-css-mode)
;;; less-css-mode.el ends here
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index e48649bae37..13367a09bcf 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -1,4 +1,4 @@
-;;; makeinfo.el --- run makeinfo conveniently
+;;; makeinfo.el --- run makeinfo conveniently -*- lexical-binding: t; -*-
;; Copyright (C) 1991, 1993, 2001-2021 Free Software Foundation, Inc.
@@ -59,16 +59,14 @@
(defcustom makeinfo-run-command "makeinfo"
"Command used to run `makeinfo' subjob.
The name of the file is appended to this string, separated by a space."
- :type 'string
- :group 'makeinfo)
+ :type 'string)
(defcustom makeinfo-options "--fill-column=70"
"String containing options for running `makeinfo'.
Do not include `--footnote-style' or `--paragraph-indent';
the proper way to specify those is with the Texinfo commands
`@footnotestyle' and `@paragraphindent'."
- :type 'string
- :group 'makeinfo)
+ :type 'string)
(require 'texinfo)
@@ -87,6 +85,7 @@ the proper way to specify those is with the Texinfo commands
;;; The `makeinfo' function definitions
+;;;###autoload
(defun makeinfo-region (region-beginning region-end)
"Make Info file from region of current Texinfo file, and switch to it.
@@ -95,7 +94,7 @@ apply to a temporary file, not the original; use the `makeinfo-buffer'
command to gain use of `next-error'."
(interactive "r")
- (let (filename-or-header
+ (let (;; filename-or-header
filename-or-header-beginning
filename-or-header-end)
;; Cannot use `let' for makeinfo-temp-file or
@@ -175,7 +174,7 @@ command to gain use of `next-error'."
t
'makeinfo-compilation-sentinel-region)))))))
-(defun makeinfo-next-error (arg reset)
+(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
@@ -224,6 +223,7 @@ nonsensical results."
(match-string 1)
"Top")))
+;;;###autoload
(defun makeinfo-buffer ()
"Make Info file from current buffer.
@@ -268,6 +268,7 @@ Use the \\[next-error] command to move to the next error
(Info-revert-find-node
makeinfo-output-file-name makeinfo-output-node-name))))
+;;;###autoload
(defun makeinfo-recenter-compilation-buffer (linenum)
"Redisplay `*compilation*' buffer so most recent output can be seen.
The last line of the buffer is displayed on
@@ -286,7 +287,10 @@ line LINE of the window, or centered if LINE is nil."
(pop-to-buffer old-buffer)
)))
-;;; Place `provide' at end of file.
(provide 'makeinfo)
+;; Local Variables:
+;; generated-autoload-file: "texinfo-loaddefs.el"
+;; End:
+
;;; makeinfo.el ends here
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 32542d0400f..25905385685 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -313,7 +313,7 @@ Prefix arg specifies how many times to move (default 1)."
(interactive "P")
(pcase (get-text-property (point) 'mhtml-submode)
('nil (sgml-skip-tag-forward arg))
- (submode (forward-sexp arg))))
+ (_submode (forward-sexp arg))))
;;;###autoload
(define-derived-mode mhtml-mode html-mode
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index e7d852be3c8..94519c3420b 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -46,38 +46,34 @@
:type 'boolean)
(defvar nroff-mode-map
- (let ((map (make-sparse-keymap))
- (menu-map (make-sparse-keymap)))
- (define-key map "\t" 'tab-to-tab-stop)
- (define-key map "\e?" 'nroff-count-text-lines)
- (define-key map "\n" 'nroff-electric-newline)
- (define-key map "\en" 'nroff-forward-text-line)
- (define-key map "\ep" 'nroff-backward-text-line)
- (define-key map "\C-c\C-c" 'nroff-view)
- (define-key map [menu-bar nroff-mode] (cons "Nroff" menu-map))
- (define-key menu-map [nn]
- '(menu-item "Newline" nroff-electric-newline
- :help "Insert newline for nroff mode; special if nroff-electric mode"))
- (define-key menu-map [nc]
- '(menu-item "Count text lines" nroff-count-text-lines
- :help "Count lines in region, except for nroff request lines."))
- (define-key menu-map [nf]
- '(menu-item "Forward text line" nroff-forward-text-line
- :help "Go forward one nroff text line, skipping lines of nroff requests"))
- (define-key menu-map [nb]
- '(menu-item "Backward text line" nroff-backward-text-line
- :help "Go backward one nroff text line, skipping lines of nroff requests"))
- (define-key menu-map [ne]
- '(menu-item "Electric newline mode"
- nroff-electric-mode
- :help "Auto insert closing requests if necessary"
- :button (:toggle . nroff-electric-mode)))
- (define-key menu-map [npm]
- '(menu-item "Preview as man page" nroff-view
- :help "Run man on this file."))
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\t" #'tab-to-tab-stop)
+ (define-key map "\e?" #'nroff-count-text-lines)
+ (define-key map "\n" #'nroff-electric-newline)
+ (define-key map "\en" #'nroff-forward-text-line)
+ (define-key map "\ep" #'nroff-backward-text-line)
+ (define-key map "\C-c\C-c" #'nroff-view)
map)
"Major mode keymap for `nroff-mode'.")
+(easy-menu-define nroff-mode-menu nroff-mode-map
+ "Menu for `nroff-mode'."
+ '("Nroff"
+ ["Preview as man page" nroff-view
+ :help "Run man on this file."]
+ ["Electric newline mode" nroff-electric-mode
+ :help "Auto insert closing requests if necessary"
+ :style toggle
+ :selected nroff-electric-mode]
+ ["Backward text line" nroff-backward-text-line
+ :help "Go backward one nroff text line, skipping lines of nroff requests"]
+ ["Forward text line" nroff-forward-text-line
+ :help "Go forward one nroff text line, skipping lines of nroff requests"]
+ ["Count text lines" nroff-count-text-lines
+ :help "Count lines in region, except for nroff request lines."]
+ ["Newline" nroff-electric-newline
+ :help "Insert newline for nroff mode; special if nroff-electric mode"]))
+
(defvar nroff-mode-syntax-table
(let ((st (copy-syntax-table text-mode-syntax-table)))
;; " isn't given string quote syntax in text-mode but it
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index c3e1fb14bc3..87c91e8f1b7 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -293,7 +293,7 @@ Used by `pages-directory-for-addresses' function."
;; FIXME: Merely loading a package shouldn't have this kind of side-effects!
(global-unset-key "\C-x\C-p")
(define-key ctl-x-map "\C-p" #'pages-ctl-x-ctl-p-prefix)
-(define-obsolete-function-alias 'ctl-x-ctl-p-prefix 'pages-ctl-x-ctl-p-prefix "27.1")
+(define-obsolete-function-alias 'ctl-x-ctl-p-prefix #'pages-ctl-x-ctl-p-prefix "27.1")
(defalias 'pages-ctl-x-ctl-p-prefix pages--ctl-x-ctl-p-map)
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index e1d7fb7431c..b86a2f149de 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -170,8 +170,6 @@ point, respectively."
(interactive)
(apply #'message (cons "Page %d, line %d" (page--what-page))))
-
-;;; Place `provide' at end of file.
(provide 'page)
;;; page.el ends here
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 96edfd6de36..59b15e82a81 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -96,9 +96,8 @@ lines that start paragraphs from lines that separate them.
If the variable `use-hard-newlines' is non-nil, then only lines following a
hard newline are considered to match."
- :group 'paragraphs
:type 'regexp)
-(put 'paragraph-start 'safe-local-variable 'stringp)
+(put 'paragraph-start 'safe-local-variable #'stringp)
;; paragraph-start requires a hard newline, but paragraph-separate does not:
;; It is assumed that paragraph-separate is distinctive enough to be believed
@@ -114,9 +113,8 @@ This is matched against the text at the left margin, which is not necessarily
the beginning of the line, so it should not use \"^\" as an anchor. This
ensures that the paragraph functions will work equally within a region of
text indented by a margin setting."
- :group 'paragraphs
:type 'regexp)
-(put 'paragraph-separate 'safe-local-variable 'stringp)
+(put 'paragraph-separate 'safe-local-variable #'stringp)
(defcustom sentence-end-double-space t
"Non-nil means a single space does not end a sentence.
@@ -128,7 +126,7 @@ regexp describing the end of a sentence, when the value of the variable
`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
:type 'boolean
:group 'fill)
-(put 'sentence-end-double-space 'safe-local-variable 'booleanp)
+(put 'sentence-end-double-space 'safe-local-variable #'booleanp)
(defcustom sentence-end-without-period nil
"Non-nil means a sentence will end without a period.
@@ -140,7 +138,7 @@ regexp describing the end of a sentence, when the value of the variable
`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
:type 'boolean
:group 'fill)
-(put 'sentence-end-without-period 'safe-local-variable 'booleanp)
+(put 'sentence-end-without-period 'safe-local-variable #'booleanp)
(defcustom sentence-end-without-space
"。.?!"
@@ -149,9 +147,8 @@ regexp describing the end of a sentence, when the value of the variable
This value is used by the function `sentence-end' to construct the
regexp describing the end of a sentence, when the value of the variable
`sentence-end' is nil. See Info node `(elisp)Standard Regexps'."
- :group 'paragraphs
:type 'string)
-(put 'sentence-end-without-space 'safe-local-variable 'stringp)
+(put 'sentence-end-without-space 'safe-local-variable #'stringp)
(defcustom sentence-end nil
"Regexp describing the end of a sentence.
@@ -161,16 +158,14 @@ All paragraph boundaries also end sentences, regardless.
The value nil means to use the default value defined by the
function `sentence-end'. You should always use this function
to obtain the value of this variable."
- :group 'paragraphs
:type '(choice regexp (const :tag "Use default value" nil)))
-(put 'sentence-end 'safe-local-variable 'string-or-null-p)
+(put 'sentence-end 'safe-local-variable #'string-or-null-p)
(defcustom sentence-end-base "[.?!…‽][]\"'”’)}»›]*"
"Regexp matching the basic end of a sentence, not including following space."
- :group 'paragraphs
:type 'regexp
:version "25.1")
-(put 'sentence-end-base 'safe-local-variable 'stringp)
+(put 'sentence-end-base 'safe-local-variable #'stringp)
(defun sentence-end ()
"Return the regexp describing the end of a sentence.
@@ -197,20 +192,16 @@ in between. See Info node `(elisp)Standard Regexps'."
(defcustom page-delimiter "^\014"
"Regexp describing line-beginnings that separate pages."
- :group 'paragraphs
:type 'regexp)
-(put 'page-delimiter 'safe-local-variable 'stringp)
+(put 'page-delimiter 'safe-local-variable #'stringp)
(defcustom paragraph-ignore-fill-prefix nil
"Non-nil means the paragraph commands are not affected by `fill-prefix'.
This is desirable in modes where blank lines are the paragraph delimiters."
- :group 'paragraphs
:type 'boolean)
-(put 'paragraph-ignore-fill-prefix 'safe-local-variable 'booleanp)
+(put 'paragraph-ignore-fill-prefix 'safe-local-variable #'booleanp)
;; Silence the compiler.
-(defvar multiple-lines)
-
(defun forward-paragraph (&optional arg)
"Move forward to end of paragraph.
With argument ARG, do it ARG times;
@@ -269,13 +260,13 @@ Returns the count of paragraphs left to move."
;; Search back for line that starts or separates paragraphs.
(if (if fill-prefix-regexp
;; There is a fill prefix; it overrides parstart.
- (let (multiple-lines)
+ (let () ;; multiple-lines
(while (and (progn (beginning-of-line) (not (bobp)))
(progn (move-to-left-margin)
(not (looking-at parsep)))
(looking-at fill-prefix-regexp))
- (unless (= (point) start)
- (setq multiple-lines t))
+ ;; (unless (= (point) start)
+ ;; (setq multiple-lines t))
(forward-line -1))
(move-to-left-margin)
;; This deleted code caused a long hanging-indent line
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 3cb1043545a..1d5d1caeabc 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -37,28 +37,22 @@
(defcustom picture-rectangle-ctl ?+
"Character `picture-draw-rectangle' uses for top left corners."
- :type 'character
- :group 'picture)
+ :type 'character)
(defcustom picture-rectangle-ctr ?+
"Character `picture-draw-rectangle' uses for top right corners."
- :type 'character
- :group 'picture)
+ :type 'character)
(defcustom picture-rectangle-cbr ?+
"Character `picture-draw-rectangle' uses for bottom right corners."
- :type 'character
- :group 'picture)
+ :type 'character)
(defcustom picture-rectangle-cbl ?+
"Character `picture-draw-rectangle' uses for bottom left corners."
- :type 'character
- :group 'picture)
+ :type 'character)
(defcustom picture-rectangle-v ?|
"Character `picture-draw-rectangle' uses for vertical lines."
- :type 'character
- :group 'picture)
+ :type 'character)
(defcustom picture-rectangle-h ?-
"Character `picture-draw-rectangle' uses for horizontal lines."
- :type 'character
- :group 'picture)
+ :type 'character)
;; Picture Movement Commands
@@ -409,8 +403,7 @@ character `\\' in the set it must be preceded by itself: \"\\\\\".
The command \\[picture-tab-search] is defined to move beneath (or to) a
character belonging to this set independent of the tab stops list."
- :type 'string
- :group 'picture)
+ :type 'string)
(defun picture-set-tab-stops (&optional arg)
"Set value of `tab-stop-list' according to context of this line.
@@ -456,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))
@@ -682,8 +675,7 @@ Leaves the region surrounding the rectangle."
(defcustom picture-mode-hook nil
"If non-nil, its value is called on entry to Picture mode.
Picture mode is invoked by the command \\[picture-mode]."
- :type 'hook
- :group 'picture)
+ :type 'hook)
(defvar picture-mode-old-local-map)
(defvar picture-mode-old-mode-name)
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index bff57128c51..084b17c676b 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -1,4 +1,4 @@
-;;; refbib.el --- convert refer-style references to ones usable by Latex bib
+;;; refbib.el --- convert refer-style references to ones usable by Latex bib -*- lexical-binding: t; -*-
;; Copyright (C) 1989, 2001-2021 Free Software Foundation, Inc.
@@ -65,8 +65,7 @@
(defcustom r2b-trace-on nil
"Non-nil means trace conversion."
- :type 'boolean
- :group 'refbib)
+ :type 'boolean)
(defcustom r2b-journal-abbrevs
'(
@@ -83,8 +82,7 @@ letter, even if it really doesn't.
\(\"Ijcai81\" \"ijcai7\")) would expand Aij to the text string
\"Artificial Intelligence\", but would replace Ijcai81 with the
BibTeX macro \"ijcai7\"."
- :type '(repeat (list string string))
- :group 'refbib)
+ :type '(repeat (list string string)))
(defcustom r2b-booktitle-abbrevs
'(
@@ -101,8 +99,7 @@ should be listed as beginning with a capital letter, even if it doesn't.
\(\"Ijcai81\" \"ijcai7\")) would expand Aij to the text string
\"Artificial Intelligence\", but would replace Ijcai81 with the
BibTeX macro \"ijcai7\"."
- :type '(repeat (list string string))
- :group 'refbib)
+ :type '(repeat (list string string)))
(defcustom r2b-proceedings-list
'()
@@ -119,8 +116,7 @@ a conference, and its expansion is the BibTeX macro \"ijcai7\". Then
expansion were \"Proceedings of the Seventh International Conference
on Artificial Intelligence\", then you would NOT need to include Ijcai81
in `r2b-proceedings-list' (although it wouldn't cause an error)."
- :type '(repeat (list string string))
- :group 'refbib)
+ :type '(repeat (list string string)))
(defvar r2b-additional-stop-words
"Some\\|What"
@@ -129,8 +125,7 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
(defcustom r2b-delimit-with-quote t
"If true, then use \" to delimit fields, otherwise use braces."
- :type 'boolean
- :group 'refbib)
+ :type 'boolean)
;**********************************************************
; Utility Functions
@@ -205,13 +200,11 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
(defcustom r2b-out-buf-name "*Out*"
"Name of buffer for output from refer-to-bibtex."
- :type 'string
- :group 'refbib)
+ :type 'string)
(defcustom r2b-log-name "*Log*"
"Name of buffer for logs errors from refer-to-bibtex."
- :type 'string
- :group 'refbib)
+ :type 'string)
(defvar r2b-in-buf nil)
(defvar r2b-out-buf nil)
@@ -418,7 +411,7 @@ title if CAPITALIZE is true. Returns value of VAR."
with a comma and newline; if ABBREVS list is given, then
try to replace the {DATA} with an abbreviation."
(if data
- (let (match nodelim multi-line index)
+ (let (match nodelim index) ;; multi-line
(cond
((and abbrevs (setq match (assoc data abbrevs)))
(if (null (cdr match))
@@ -514,7 +507,7 @@ but not a publisher."
(defun r2b-barf-output ()
"Generate bibtex based on global variables."
- (let ((standard-output r2b-out-buf) (case-fold-search t) match)
+ (let ((standard-output r2b-out-buf) (case-fold-search t)) ;; match
(r2b-trace "...barfing")
(sit-for 0)
diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el
index ae1f7781686..e710180d5f5 100644
--- a/lisp/textmodes/refer.el
+++ b/lisp/textmodes/refer.el
@@ -1,4 +1,4 @@
-;;; refer.el --- look up references in bibliography files
+;;; refer.el --- look up references in bibliography files -*- lexical-binding: t; -*-
;; Copyright (C) 1992, 1996, 2001-2021 Free Software Foundation, Inc.
@@ -91,8 +91,7 @@ the default search path. Since Refer does not know that default path,
it cannot search it. Include that path explicitly in your BIBINPUTS
environment if you really want it searched (which is not likely to
happen anyway)."
- :type '(choice (repeat directory) (const bibinputs) (const texinputs))
- :group 'refer)
+ :type '(choice (repeat directory) (const bibinputs) (const texinputs)))
(defcustom refer-bib-files 'dir
"List of \\.bib files to search for references,
@@ -110,16 +109,14 @@ If `refer-bib-files' is nil, auto or dir, it is setq'd to the appropriate
list of files when it is first used if `refer-cache-bib-files' is t. If
`refer-cache-bib-files' is nil, the list of \\.bib files to use is re-read
each time it is needed."
- :type '(choice (repeat file) (const nil) (const auto) (const dir))
- :group 'refer)
+ :type '(choice (repeat file) (const nil) (const auto) (const dir)))
(defcustom refer-cache-bib-files t
"Variable determining whether the value of `refer-bib-files' should be cached.
If t, initialize the value of refer-bib-files the first time it is used. If
nil, re-read the list of \\.bib files depending on the value of `refer-bib-files'
each time it is needed."
- :type 'boolean
- :group 'refer)
+ :type 'boolean)
(defcustom refer-bib-files-regexp "\\\\bibliography"
"Regexp matching a bibliography file declaration.
@@ -131,8 +128,7 @@ command is expected to specify a file name, or a list of comma-separated file
names, within curly braces.
If a specified file doesn't exist and has no extension, a \\.bib extension
is automatically tried."
- :type 'regexp
- :group 'refer)
+ :type 'regexp)
(make-variable-buffer-local 'refer-bib-files)
(make-variable-buffer-local 'refer-cache-bib-files)
@@ -180,7 +176,7 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
(defun refer-find-entry-internal (keywords continue)
(let ((keywords-list (refer-convert-string-to-list-of-strings keywords))
- (old-buffer (current-buffer))
+ ;; (old-buffer (current-buffer))
(old-window (selected-window))
(new-window (selected-window))
(files (if continue
@@ -188,7 +184,7 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
(setq refer-saved-pos nil)
(refer-get-bib-files)))
(n 0)
- (found nil)
+ ;; (found nil)
(file nil))
;; find window in which to display bibliography file.
;; if a bibliography file is already displayed in a window, use
@@ -249,10 +245,10 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
(forward-paragraph 1)
(setq end (point))
(setq found
- (refer-every (lambda (keyword)
- (goto-char begin)
- (re-search-forward keyword end t))
- keywords-list))
+ (seq-every-p (lambda (keyword)
+ (goto-char begin)
+ (re-search-forward keyword end t))
+ keywords-list))
(if (not found)
(progn
(setq begin end)
@@ -264,12 +260,6 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
(progn (message "Scanning %s... not found" file)
nil))))
-(defun refer-every (pred l)
- (cond ((null l) nil)
- ((funcall pred (car l))
- (or (null (cdr l))
- (refer-every pred (cdr l))))))
-
(defun refer-convert-string-to-list-of-strings (s)
(let ((current (current-buffer))
(temp-buffer (get-buffer-create "*refer-temp*")))
@@ -395,4 +385,6 @@ found on the last `refer-find-entry' or `refer-find-next-entry'."
(setq refer-bib-files files))
files))
+(define-obsolete-function-alias 'refer-every #'seq-every-p "28.1")
+
;;; refer.el ends here
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index 8f4f3c5a231..0a0e4cc444c 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -1,4 +1,4 @@
-;;; refill.el --- `auto-fill' by refilling paragraphs on changes
+;;; refill.el --- `auto-fill' by refilling paragraphs on changes -*- lexical-binding: t -*-
;; Copyright (C) 2000-2021 Free Software Foundation, Inc.
@@ -83,16 +83,11 @@
;;; Code:
-;; Unused.
-;;; (defgroup refill nil
-;;; "Refilling paragraphs on changes."
-;;; :group 'fill)
-
(defvar-local refill-ignorable-overlay nil
"Portion of the most recently filled paragraph not needing filling.
This is used to optimize refilling.")
-(defun refill-adjust-ignorable-overlay (overlay afterp beg end &optional len)
+(defun refill-adjust-ignorable-overlay (overlay afterp beg _end &optional _len)
"Adjust OVERLAY to not include the about-to-be-modified region."
(when (not afterp)
(save-excursion
@@ -157,7 +152,7 @@ ensures refilling is only done once per command that causes a change,
regardless of the number of after-change calls from commands doing
complex processing.")
-(defun refill-after-change-function (beg end len)
+(defun refill-after-change-function (_beg end _len)
"Function for `after-change-functions' which just sets `refill-doit'."
(unless undo-in-progress
(setq refill-doit end)))
@@ -232,9 +227,9 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead."
(kill-local-variable 'refill-saved-state))
(if refill-mode
(progn
- (add-hook 'after-change-functions 'refill-after-change-function nil t)
- (add-hook 'post-command-hook 'refill-post-command-function nil t)
- (add-hook 'pre-command-hook 'refill-pre-command-function nil t)
+ (add-hook 'after-change-functions #'refill-after-change-function nil t)
+ (add-hook 'post-command-hook #'refill-post-command-function nil t)
+ (add-hook 'pre-command-hook #'refill-pre-command-function nil t)
(setq-local refill-saved-state
(mapcar (lambda (s) (cons s (symbol-value s)))
'(fill-paragraph-function auto-fill-function)))
@@ -249,8 +244,8 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead."
(overlay-put refill-ignorable-overlay 'insert-behind-hooks
'(refill-adjust-ignorable-overlay))
(auto-fill-mode 0))
- (remove-hook 'after-change-functions 'refill-after-change-function t)
- (remove-hook 'post-command-hook 'refill-post-command-function t)
+ (remove-hook 'after-change-functions #'refill-after-change-function t)
+ (remove-hook 'post-command-hook #'refill-post-command-function t)
(kill-local-variable 'backward-delete-char-untabify-method)))
(provide 'refill)
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index ae3faec4fdc..977da700fd0 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -1,4 +1,4 @@
-;;; reftex-auc.el --- RefTeX's interface to AUCTeX
+;;; reftex-auc.el --- RefTeX's interface to AUCTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -32,11 +32,12 @@
(optional prompt default &optional complete))
(declare-function TeX-argument-insert "ext:tex"
(name optional &optional prefix))
-(declare-function LaTeX-add-labels "ext:tex" (&rest entries) t)
-(declare-function LaTeX-add-index-entries "ext:tex" (&rest entries) t)
-(declare-function LaTeX-bibitem-list "ext:tex" () t)
-(declare-function LaTeX-index-entry-list "ext:tex" () t)
-(declare-function LaTeX-label-list "ext:tex" () t)
+(declare-function LaTeX-add-labels "ext:latex" (&rest labels) t)
+(declare-function LaTeX-add-index-entries "ext:latex" (&rest index-entries) t)
+(declare-function LaTeX-add-bibitems "ext:latex" (&rest bibitems) t)
+(declare-function LaTeX-bibitem-list "ext:latex" () t)
+(declare-function LaTeX-index-entry-list "ext:latex" () t)
+(declare-function LaTeX-label-list "ext:latex" () t)
(declare-function multi-prompt "ext:multi-prompt"
(separator unique prompt table &optional
mp-predicate require-match initial history))
@@ -82,13 +83,12 @@ What is being used depends upon `reftex-plug-into-AUCTeX'."
(if prompt prompt "Add key")
" (default none): "))
(setq items (multi-prompt "," t prompt (LaTeX-bibitem-list)))))
- (apply 'LaTeX-add-bibitems items)
- (TeX-argument-insert (mapconcat 'identity items reftex-cite-key-separator)
+ (apply #'LaTeX-add-bibitems items)
+ (TeX-argument-insert (mapconcat #'identity items reftex-cite-key-separator)
optional)))
-
;;;###autoload
-(defun reftex-arg-index-tag (optional &optional prompt &rest args)
+(defun reftex-arg-index-tag (optional &optional prompt &rest _args)
"Prompt for an index tag with completion.
This is the name of an index, not the entry."
(let (tag taglist)
@@ -102,13 +102,13 @@ This is the name of an index, not the entry."
(setq taglist
(cdr (assoc 'index-tags
(symbol-value reftex-docstruct-symbol)))
- tag (completing-read prompt (mapcar 'list taglist))))
+ tag (completing-read prompt (mapcar #'list taglist))))
;; Just ask like AUCTeX does.
(setq tag (read-string prompt)))
(TeX-argument-insert tag optional)))
;;;###autoload
-(defun reftex-arg-index (optional &optional prompt &rest args)
+(defun reftex-arg-index (optional &optional prompt &rest _args)
"Prompt for an index entry completing with known entries.
Completion is specific for just one index, if the macro or a tag
argument identify one of multiple indices."
@@ -149,23 +149,27 @@ argument identify one of multiple indices."
;; `reftex-plug-into-AUCTeX'.
(if (reftex-plug-flag 0)
- (setq LaTeX-label-function 'reftex-label)
- (setq LaTeX-label-function nil))
-
- (and (or (reftex-plug-flag 1) (reftex-plug-flag 2))
- (fboundp 'TeX-arg-label)
- (fset 'TeX-arg-label 'reftex-arg-label))
-
- (and (reftex-plug-flag 3)
- (fboundp 'TeX-arg-cite)
- (fset 'TeX-arg-cite 'reftex-arg-cite))
-
- (and (reftex-plug-flag 4)
- (fboundp 'TeX-arg-index-tag)
- (fset 'TeX-arg-index-tag 'reftex-arg-index-tag))
- (and (reftex-plug-flag 4)
- (fboundp 'TeX-arg-index)
- (fset 'TeX-arg-index 'reftex-arg-index)))
+ (if (bound-and-true-p LaTeX-label-function)
+ (add-function :override LaTeX-label-function #'reftex-label)
+ (setq LaTeX-label-function #'reftex-label))
+ (if (eq #'reftex-label (bound-and-true-p LaTeX-label-function))
+ (setq LaTeX-label-function nil)
+ (remove-function LaTeX-label-function #'reftex-label)))
+
+ (if (or (reftex-plug-flag 1) (reftex-plug-flag 2))
+ (advice-add 'TeX-arg-label :override #'reftex-arg-label)
+ (advice-remove 'TeX-arg-label #'reftex-arg-label))
+
+ (if (reftex-plug-flag 3)
+ (advice-add 'TeX-arg-cite :override #'reftex-arg-cite)
+ (advice-remove 'TeX-arg-cite #'reftex-arg-cite))
+
+ (if (reftex-plug-flag 4)
+ (advice-add 'TeX-arg-index-tag :override #'reftex-arg-index-tag)
+ (advice-remove 'TeX-arg-index-tag #'reftex-arg-index-tag))
+ (if (reftex-plug-flag 4)
+ (advice-add 'TeX-arg-index :override #'reftex-arg-index)
+ (advice-remove 'TeX-arg-index #'reftex-arg-index)))
;;;###autoload
(defun reftex-toggle-plug-into-AUCTeX ()
@@ -205,7 +209,7 @@ the label information is recompiled on next use."
(when changed
(put reftex-docstruct-symbol 'reftex-label-alist-style list)))))
;;;###autoload
-(defalias 'reftex-add-to-label-alist 'reftex-add-label-environments)
+(defalias 'reftex-add-to-label-alist #'reftex-add-label-environments)
;;;###autoload
(defun reftex-add-section-levels (entry-list)
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 5579e401790..895064b82f3 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1,4 +1,4 @@
-;;; reftex-cite.el --- creating citations with RefTeX
+;;; reftex-cite.el --- creating citations with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -310,11 +310,11 @@ Return list with entries."
;; Sorting
(cond
((eq 'author reftex-sort-bibtex-matches)
- (sort found-list 'reftex-bib-sort-author))
+ (sort found-list #'reftex-bib-sort-author))
((eq 'year reftex-sort-bibtex-matches)
- (sort found-list 'reftex-bib-sort-year))
+ (sort found-list #'reftex-bib-sort-year))
((eq 'reverse-year reftex-sort-bibtex-matches)
- (sort found-list 'reftex-bib-sort-year-reverse))
+ (sort found-list #'reftex-bib-sort-year-reverse))
(t found-list))))
(defun reftex-bib-sort-author (e1 e2)
@@ -390,7 +390,7 @@ The environment should be located in FILES."
(when (and start end)
(setq entries
(append entries
- (mapcar 'reftex-parse-bibitem
+ (mapcar #'reftex-parse-bibitem
(delete ""
(split-string
(buffer-substring-no-properties
@@ -533,7 +533,7 @@ If FORMAT is non-nil `format' entry accordingly."
"Format a BibTeX ENTRY so that it is nice to look at."
(let*
((auth-list (reftex-get-bib-names "author" entry))
- (authors (mapconcat 'identity auth-list ", "))
+ (authors (mapconcat #'identity auth-list ", "))
(year (reftex-get-bib-field "year" entry))
(title (reftex-get-bib-field "title" entry))
(type (reftex-get-bib-field "&type" entry))
@@ -607,7 +607,7 @@ If FORMAT is non-nil `format' entry accordingly."
(push (substring text 0 (+ 60 (match-beginning 0))) lines)
(setq text (substring text (+ 61 (match-beginning 0)))))
(push text lines)
- (setq text (mapconcat 'identity (nreverse lines) "\n "))
+ (setq text (mapconcat #'identity (nreverse lines) "\n "))
(when (reftex-use-fonts)
(put-text-property 0 (length text) 'face reftex-bib-author-face text))
@@ -676,7 +676,7 @@ While entering the regexp, completion on knows citation keys is possible.
;; All keys go into a single command - we need to trick a little
;; FIXME: Unfortunately, this means that commenting does not work right.
(pop selected-entries)
- (let ((concat-keys (mapconcat 'car selected-entries
+ (let ((concat-keys (mapconcat #'car selected-entries
reftex-cite-key-separator)))
(setq insert-entries
(list (list concat-keys (cons "&key" concat-keys))))))
@@ -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))
@@ -726,7 +726,7 @@ While entering the regexp, completion on knows citation keys is possible.
(when (and reftex-mode
(fboundp 'LaTeX-add-bibitems)
reftex-plug-into-AUCTeX)
- (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries)))
+ (apply #'LaTeX-add-bibitems (mapcar #'car selected-entries)))
;; Produce the cite-view strings
(when (and reftex-mode reftex-cache-cite-echo cite-view)
@@ -749,7 +749,7 @@ While entering the regexp, completion on knows citation keys is possible.
(forward-char 1)))
;; Return the citation key
- (mapcar 'car selected-entries)))
+ (mapcar #'car selected-entries)))
(defun reftex-figure-out-cite-format (arg &optional no-insert format-key)
"Check if there is already a cite command at point and change cite format
@@ -815,15 +815,16 @@ in order to only add another reference in the same cite command."
(reftex-citation nil ?t))
(defvar reftex-select-bib-map)
+(defvar reftex--found-list)
(defun reftex-offer-bib-menu ()
"Offer bib menu and return list of selected items."
(let ((bibtype (reftex-bib-or-thebib))
- found-list rtn key data selected-entries)
+ reftex--found-list rtn key data selected-entries)
(while
(not
(catch 'done
;; Scan bibtex files
- (setq found-list
+ (setq reftex--found-list
(cond
((eq bibtype 'bib)
; ((assq 'bib (symbol-value reftex-docstruct-symbol))
@@ -834,7 +835,7 @@ in order to only add another reference in the same cite command."
;; using thebibliography environment.
(reftex-extract-bib-entries-from-thebibliography
(reftex-uniquify
- (mapcar 'cdr
+ (mapcar #'cdr
(reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))))
(reftex-default-bibliography
@@ -842,7 +843,7 @@ in order to only add another reference in the same cite command."
(reftex-extract-bib-entries (reftex-default-bibliography)))
(t (error "No valid bibliography in this document, and no default available"))))
- (unless found-list
+ (unless reftex--found-list
(error "Sorry, no matches found"))
;; Remember where we came from
@@ -854,11 +855,11 @@ in order to only add another reference in the same cite command."
(delete-other-windows)
(reftex-kill-buffer "*RefTeX Select*")
(switch-to-buffer-other-window "*RefTeX Select*")
- (unless (eq major-mode 'reftex-select-bib-mode)
+ (unless (derived-mode-p 'reftex-select-bib-mode)
(reftex-select-bib-mode))
- (let ((buffer-read-only nil))
+ (let ((inhibit-read-only t))
(erase-buffer)
- (reftex-insert-bib-matches found-list))
+ (reftex-insert-bib-matches reftex--found-list))
(setq buffer-read-only t)
(if (= 0 (buffer-size))
(error "No matches found"))
@@ -881,34 +882,36 @@ in order to only add another reference in the same cite command."
(throw 'done nil))
((eq key ?r)
;; Restrict with new regular expression
- (setq found-list (reftex-restrict-bib-matches found-list))
+ (setq reftex--found-list
+ (reftex-restrict-bib-matches reftex--found-list))
(let ((buffer-read-only nil))
(erase-buffer)
- (reftex-insert-bib-matches found-list))
+ (reftex-insert-bib-matches reftex--found-list))
(goto-char 1))
((eq key ?A)
;; Take all (marked)
(setq selected-entries
(if reftex-select-marked
- (mapcar 'car (nreverse reftex-select-marked))
- found-list))
+ (mapcar #'car (nreverse reftex-select-marked))
+ reftex--found-list))
(throw 'done t))
((eq key ?a)
;; Take all (marked), and push the symbol 'concat
(setq selected-entries
(cons 'concat
(if reftex-select-marked
- (mapcar 'car (nreverse reftex-select-marked))
- found-list)))
+ (mapcar #'car (nreverse reftex-select-marked))
+ reftex--found-list)))
(throw 'done t))
((eq key ?e)
;; Take all (marked), and push the symbol 'concat
- (reftex-extract-bib-file found-list reftex-select-marked)
+ (reftex-extract-bib-file reftex--found-list
+ reftex-select-marked)
(setq selected-entries "BibTeX database file created")
(throw 'done t))
((eq key ?E)
;; Take all (marked), and push the symbol 'concat
- (reftex-extract-bib-file found-list reftex-select-marked
+ (reftex-extract-bib-file reftex--found-list reftex-select-marked
'complement)
(setq selected-entries "BibTeX database file created")
(throw 'done t))
@@ -918,7 +921,7 @@ in order to only add another reference in the same cite command."
(setq selected-entries
(if reftex-select-marked
(cons 'concat
- (mapcar 'car (nreverse reftex-select-marked)))
+ (mapcar #'car (nreverse reftex-select-marked)))
(if data (list data) nil)))
(throw 'done t))
((stringp key)
@@ -971,7 +974,7 @@ in order to only add another reference in the same cite command."
nil)
(cdr (assoc "&entry" x))))
all)))
- (insert (mapconcat 'identity all "\n\n"))
+ (insert (mapconcat #'identity all "\n\n"))
(save-buffer)
(goto-char (point-min))))
@@ -1004,7 +1007,7 @@ in order to only add another reference in the same cite command."
last (nth (1- n) namelist))
(setcdr (nthcdr (- n 2) namelist) nil)
(concat
- (mapconcat 'identity namelist (nth 0 reftex-cite-punctuation))
+ (mapconcat #'identity namelist (nth 0 reftex-cite-punctuation))
(nth 1 reftex-cite-punctuation)
last)))))
@@ -1100,7 +1103,7 @@ in order to only add another reference in the same cite command."
(put reftex-docstruct-symbol 'modified t)))
string))
-(defun reftex-bibtex-selection-callback (data ignore no-revisit)
+(defun reftex-bibtex-selection-callback (data _ignore no-revisit)
"Callback function to be called from the BibTeX selection, in
order to display context. This function is relatively slow and not
recommended for follow mode. It works OK for individual lookups."
@@ -1119,7 +1122,7 @@ recommended for follow mode. It works OK for individual lookups."
; ((assq 'thebib (symbol-value reftex-docstruct-symbol))
(setq bibfile-list
(reftex-uniquify
- (mapcar 'cdr
+ (mapcar #'cdr
(reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))
item t))
@@ -1163,7 +1166,7 @@ recommended for follow mode. It works OK for individual lookups."
"Return a list of BibTeX @string references that appear as values in ALIST."
(reftex-remove-if (lambda (x) (string-match "^\\([\"{]\\|[0-9]+$\\)" x))
;; get list of values, discard keys
- (mapcar 'cdr
+ (mapcar #'cdr
;; remove &key and &type entries
(reftex-remove-if (lambda (pair)
(string-match "^&" (car pair)))
@@ -1186,7 +1189,7 @@ created files in the variables `reftex-create-bibtex-header' or
(interactive "FNew BibTeX file: ")
(let ((keys (reftex-all-used-citation-keys))
(files (reftex-get-bibfile-list))
- file key entries beg end entry string-keys string-entries)
+ key entries beg end entry string-keys string-entries)
(save-current-buffer
(dolist (file files)
(set-buffer (reftex-get-file-buffer-force file 'mark))
@@ -1252,9 +1255,9 @@ created files in the variables `reftex-create-bibtex-header' or
(error "Abort")))
(erase-buffer)
(if reftex-create-bibtex-header (insert reftex-create-bibtex-header "\n\n"))
- (insert (mapconcat 'identity (reverse string-entries) "\n\n"))
+ (insert (mapconcat #'identity (reverse string-entries) "\n\n"))
(if string-entries (insert "\n\n\n"))
- (insert (mapconcat 'identity (reverse entries) "\n\n"))
+ (insert (mapconcat #'identity (reverse entries) "\n\n"))
(if reftex-create-bibtex-footer (insert "\n\n" reftex-create-bibtex-footer))
(goto-char (point-min))
(save-buffer)
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index e517cea2669..a21dd3362b0 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -1,4 +1,4 @@
-;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
+;;; reftex-dcr.el --- viewing cross references and citations with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -132,7 +132,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
((eq bibtype 'thebib)
(setq item t
files (reftex-uniquify
- (mapcar 'cdr
+ (mapcar #'cdr
(reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))))
(reftex-default-bibliography
@@ -161,10 +161,10 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
(shrink-window (1- (- (window-height) size)))
(recenter 0))
;; Arrange restoration
- (add-hook 'pre-command-hook 'reftex-restore-window-conf))
+ (add-hook 'pre-command-hook #'reftex-restore-window-conf))
;; Normal display in other window
- (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
+ (add-hook 'pre-command-hook #'reftex-highlight-shall-die)
(setq pop-win (selected-window))
(select-window win)
(goto-char pos)
@@ -212,13 +212,13 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
(error (set-window-configuration window-conf)
(message "ref: Label %s not found" label)
(error "ref: Label %s not found" label)))) ;; 2nd is line OK
- (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
+ (add-hook 'pre-command-hook #'reftex-highlight-shall-die)
(when (eq how 'tmp-window)
;; Resize window and arrange restoration
(shrink-window (1- (- (window-height) 9)))
(recenter '(4))
- (add-hook 'pre-command-hook 'reftex-restore-window-conf))
+ (add-hook 'pre-command-hook #'reftex-restore-window-conf))
(setq pop-win (selected-window))
(select-window win)
(goto-char pos)
@@ -266,7 +266,7 @@ With argument, actually select the window showing the cross reference."
(defun reftex-restore-window-conf ()
(set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf))
(put 'reftex-auto-view-crossref 'last-window-conf nil)
- (remove-hook 'pre-command-hook 'reftex-restore-window-conf))
+ (remove-hook 'pre-command-hook #'reftex-restore-window-conf))
(defun reftex-echo-ref (label entry docstruct)
;; Display crossref info in echo area.
@@ -320,10 +320,6 @@ With argument, actually select the window showing the cross reference."
(with-current-buffer buf
(run-hooks 'reftex-display-copied-context-hook)))))
-(defvar reftex-use-itimer-in-xemacs nil
- "Non-nil means use the idle timers in XEmacs for crossref display.
-Currently, idle timer restart is broken and we use the post-command-hook.")
-
;;;###autoload
(defun reftex-toggle-auto-view-crossref ()
"Toggle the automatic display of crossref information in the echo area.
@@ -332,36 +328,16 @@ will display info in the echo area."
(interactive)
(if reftex-auto-view-crossref-timer
(progn
- (if (featurep 'xemacs)
- (if reftex-use-itimer-in-xemacs
- (delete-itimer reftex-auto-view-crossref-timer)
- (remove-hook 'post-command-hook 'reftex-start-itimer-once))
- (cancel-timer reftex-auto-view-crossref-timer))
+ (cancel-timer reftex-auto-view-crossref-timer)
(setq reftex-auto-view-crossref-timer nil)
(message "Automatic display of crossref information was turned off"))
(setq reftex-auto-view-crossref-timer
- (if (featurep 'xemacs)
- (if reftex-use-itimer-in-xemacs
- (start-itimer "RefTeX Idle Timer"
- 'reftex-view-crossref-when-idle
- reftex-idle-time reftex-idle-time t)
- (add-hook 'post-command-hook 'reftex-start-itimer-once)
- t)
- (run-with-idle-timer
- reftex-idle-time t 'reftex-view-crossref-when-idle)))
+ (run-with-idle-timer
+ reftex-idle-time t #'reftex-view-crossref-when-idle))
(unless reftex-auto-view-crossref
(setq reftex-auto-view-crossref t))
(message "Automatic display of crossref information was turned on")))
-(defun reftex-start-itimer-once ()
- (and (featurep 'xemacs)
- reftex-mode
- (not (itimer-live-p reftex-auto-view-crossref-timer))
- (setq reftex-auto-view-crossref-timer
- (start-itimer "RefTeX Idle Timer"
- 'reftex-view-crossref-when-idle
- reftex-idle-time nil t))))
-
;;;###autoload
(defun reftex-view-crossref-from-bibtex (&optional arg)
"View location in a LaTeX document which cites the BibTeX entry at point.
@@ -431,7 +407,7 @@ Calling this function several times find successive citation locations."
(put 'reftex-view-regexp-match :cnt (cl-incf cnt))
(reftex-highlight 0 (match-beginning highlight-group)
(match-end highlight-group))
- (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
+ (add-hook 'pre-command-hook #'reftex-highlight-shall-die)
(setq pop-window (selected-window)))
(put 'reftex-view-regexp-match :props nil)
(or cont (set-window-configuration window-conf)))
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index 4d021609019..3b7518e5c3f 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -1,4 +1,4 @@
-;;; reftex-global.el --- operations on entire documents with RefTeX
+;;; reftex-global.el --- operations on entire documents with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -39,7 +39,7 @@ The TAGS file is also immediately visited with `visit-tags-table'."
(reftex-access-scan-info current-prefix-arg)
(let* ((master (reftex-TeX-master-file))
(files (reftex-all-document-files))
- (cmd (format "etags %s" (mapconcat 'shell-quote-argument
+ (cmd (format "etags %s" (mapconcat #'shell-quote-argument
files " "))))
(with-current-buffer (reftex-get-file-buffer-force master)
(message "Running etags to create TAGS file...")
@@ -65,7 +65,7 @@ No active TAGS table is required."
(let* ((files (reftex-all-document-files t))
(cmd (format
"%s %s" grep-cmd
- (mapconcat 'identity files " "))))
+ (mapconcat #'identity files " "))))
(grep cmd)))
;;;###autoload
@@ -160,7 +160,7 @@ No active TAGS table is required."
(when (and (car (car dlist))
(cdr (car dlist)))
(cl-incf cnt)
- (insert (mapconcat 'identity (car dlist) "\n ") "\n"))
+ (insert (mapconcat #'identity (car dlist) "\n ") "\n"))
(pop dlist))
(goto-char (point-min))
(when (= cnt 0)
@@ -208,7 +208,7 @@ one with the `xr' package."
(error "Abort"))
;; Make the translation list
(let* ((re-core (concat "\\("
- (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
+ (mapconcat #'cdr reftex-typekey-to-prefix-alist "\\|")
"\\)"))
(label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))
(search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))
@@ -326,7 +326,7 @@ labels."
file buffer)
(save-current-buffer
(while (setq file (pop files))
- (setq buffer (reftex-get-buffer-visiting file))
+ (setq buffer (find-buffer-visiting file))
(when buffer
(set-buffer buffer)
(save-buffer))))))
@@ -344,7 +344,7 @@ Also checks if buffers visiting the files are in read-only mode."
(ding)
(or (y-or-n-p (format "No write access to %s. Continue? " file))
(error "Abort")))
- (when (and (setq buf (reftex-get-buffer-visiting file))
+ (when (and (setq buf (find-buffer-visiting file))
(with-current-buffer buf
buffer-read-only))
(ding)
@@ -366,10 +366,10 @@ Also checks if buffers visiting the files are in read-only mode."
(goto-char (if isearch-forward (point-min) (point-max))))
(defun reftex-isearch-push-state-function ()
- `(lambda (cmd)
- (reftex-isearch-pop-state-function cmd ,(current-buffer))))
+ (let ((buf (current-buffer)))
+ (lambda (cmd) (reftex-isearch-pop-state-function cmd buf))))
-(defun reftex-isearch-pop-state-function (cmd buffer)
+(defun reftex-isearch-pop-state-function (_cmd buffer)
(switch-to-buffer buffer))
(defun reftex-isearch-isearch-search (string bound noerror)
@@ -451,17 +451,17 @@ With no argument, this command toggles
(if (boundp 'multi-isearch-next-buffer-function)
(set (make-local-variable
'multi-isearch-next-buffer-function)
- 'reftex-isearch-switch-to-next-file)
+ #'reftex-isearch-switch-to-next-file)
(set (make-local-variable 'isearch-wrap-function)
- 'reftex-isearch-wrap-function)
+ #'reftex-isearch-wrap-function)
(set (make-local-variable 'isearch-search-fun-function)
- (lambda () 'reftex-isearch-isearch-search))
+ (lambda () #'reftex-isearch-isearch-search))
(set (make-local-variable 'isearch-push-state-function)
- 'reftex-isearch-push-state-function)
+ #'reftex-isearch-push-state-function)
(set (make-local-variable 'isearch-next-buffer-function)
- 'reftex-isearch-switch-to-next-file))
+ #'reftex-isearch-switch-to-next-file))
(setq reftex-isearch-minor-mode t))))
- (add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))
+ (add-hook 'reftex-mode-hook #'reftex-isearch-minor-mode))
(dolist (crt-buf (buffer-list))
(with-current-buffer crt-buf
(when reftex-mode
@@ -472,7 +472,7 @@ With no argument, this command toggles
(kill-local-variable 'isearch-push-state-function)
(kill-local-variable 'isearch-next-buffer-function))
(setq reftex-isearch-minor-mode nil))))
- (remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)))
+ (remove-hook 'reftex-mode-hook #'reftex-isearch-minor-mode)))
;; Force mode line redisplay.
(set-buffer-modified-p (buffer-modified-p))))
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 5049ffb64b1..28cc7db2dcd 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1,4 +1,4 @@
-;;; reftex-index.el --- index support with RefTeX
+;;; reftex-index.el --- index support with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -30,8 +30,6 @@
(require 'reftex)
;; START remove for XEmacs release
-(defvar mark-active)
-(defvar transient-mark-mode)
(defvar TeX-master)
;; END remove for XEmacs release
@@ -49,7 +47,7 @@ which is part of AUCTeX, the string is first processed with the
(interactive "P")
(let* ((use-default (not (equal arg '(16)))) ; check for double prefix
;; check if we have an active selection
- (active (reftex-region-active-p))
+ (active (region-active-p))
(beg (if active
(region-beginning)
(save-excursion
@@ -89,7 +87,7 @@ which is part of AUCTeX, the string is first processed with the
(reftex-index def-char full-entry def-tag sel)))))
;;;###autoload
-(defun reftex-index (&optional char key tag sel no-insert)
+(defun reftex-index (&optional char key tag sel _no-insert)
"Query for an index macro and insert it along with its arguments.
The index macros available are those defined in `reftex-index-macro' or
by a call to `reftex-add-index-macros', typically from an AUCTeX style file.
@@ -178,7 +176,7 @@ will prompt for other arguments."
(format "default %s" default))
"")))
": ")))
- (tag (completing-read prompt (mapcar 'list index-tags))))
+ (tag (completing-read prompt (mapcar #'list index-tags))))
(if (and default (equal tag "")) (setq tag default))
(reftex-update-default-index tag)
tag))
@@ -239,7 +237,7 @@ will prompt for other arguments."
(format "[^M] %s (the default)\n" default)
"")
(mapconcat (lambda(x)
- (apply 'format "[%c] %s" x))
+ (apply #'format "[%c] %s" x))
tag-alist "\n")))
;; Query the user for an index-tag
(setq rpl (reftex-select-with-char prompt help 3 t))
@@ -278,56 +276,57 @@ will prompt for other arguments."
(defvar reftex-index-mode-map
(let ((map (make-sparse-keymap)))
;; Index map
- (define-key map (if (featurep 'xemacs) [(button2)] [(mouse-2)])
- 'reftex-index-mouse-goto-line-and-hide)
+ (define-key map [(mouse-2)] #'reftex-index-mouse-goto-line-and-hide)
(define-key map [follow-link] 'mouse-face)
(substitute-key-definition
- 'next-line 'reftex-index-next map global-map)
+ #'next-line #'reftex-index-next map global-map)
(substitute-key-definition
- 'previous-line 'reftex-index-previous map global-map)
-
- (define-key map "n" 'reftex-index-next)
- (define-key map "p" 'reftex-index-previous)
- (define-key map "?" 'reftex-index-show-help)
- (define-key map " " 'reftex-index-view-entry)
- (define-key map "\C-m" 'reftex-index-goto-entry-and-hide)
- (define-key map "\C-i" 'reftex-index-goto-entry)
- (define-key map "\C-k" 'reftex-index-kill)
- (define-key map "r" 'reftex-index-rescan)
- (define-key map "R" 'reftex-index-Rescan)
- (define-key map "g" 'revert-buffer)
- (define-key map "q" 'reftex-index-quit)
- (define-key map "k" 'reftex-index-quit-and-kill)
- (define-key map "f" 'reftex-index-toggle-follow)
- (define-key map "s" 'reftex-index-switch-index-tag)
- (define-key map "e" 'reftex-index-edit)
- (define-key map "^" 'reftex-index-level-up)
- (define-key map "_" 'reftex-index-level-down)
- (define-key map "}" 'reftex-index-restrict-to-section)
- (define-key map "{" 'reftex-index-widen)
- (define-key map ">" 'reftex-index-restriction-forward)
- (define-key map "<" 'reftex-index-restriction-backward)
- (define-key map "(" 'reftex-index-toggle-range-beginning)
- (define-key map ")" 'reftex-index-toggle-range-end)
- (define-key map "|" 'reftex-index-edit-attribute)
- (define-key map "@" 'reftex-index-edit-visual)
- (define-key map "*" 'reftex-index-edit-key)
- (define-key map "\C-c=" 'reftex-index-goto-toc)
- (define-key map "c" 'reftex-index-toggle-context)
+ #'previous-line #'reftex-index-previous map global-map)
+
+ (define-key map "n" #'reftex-index-next)
+ (define-key map "p" #'reftex-index-previous)
+ (define-key map "?" #'reftex-index-show-help)
+ (define-key map " " #'reftex-index-view-entry)
+ (define-key map "\C-m" #'reftex-index-goto-entry-and-hide)
+ (define-key map "\C-i" #'reftex-index-goto-entry)
+ (define-key map "\C-k" #'reftex-index-kill)
+ (define-key map "r" #'reftex-index-rescan)
+ (define-key map "R" #'reftex-index-Rescan)
+ (define-key map "g" #'revert-buffer)
+ (define-key map "q" #'reftex-index-quit)
+ (define-key map "k" #'reftex-index-quit-and-kill)
+ (define-key map "f" #'reftex-index-toggle-follow)
+ (define-key map "s" #'reftex-index-switch-index-tag)
+ (define-key map "e" #'reftex-index-edit)
+ (define-key map "^" #'reftex-index-level-up)
+ (define-key map "_" #'reftex-index-level-down)
+ (define-key map "}" #'reftex-index-restrict-to-section)
+ (define-key map "{" #'reftex-index-widen)
+ (define-key map ">" #'reftex-index-restriction-forward)
+ (define-key map "<" #'reftex-index-restriction-backward)
+ (define-key map "(" #'reftex-index-toggle-range-beginning)
+ (define-key map ")" #'reftex-index-toggle-range-end)
+ (define-key map "|" #'reftex-index-edit-attribute)
+ (define-key map "@" #'reftex-index-edit-visual)
+ (define-key map "*" #'reftex-index-edit-key)
+ (define-key map "\C-c=" #'reftex-index-goto-toc)
+ (define-key map "c" #'reftex-index-toggle-context)
;; The capital letters and the exclamation mark
- (cl-loop for key across (concat "!" reftex-index-section-letters) do
- (define-key map (vector (list key))
- (list 'lambda '() '(interactive)
- (list 'reftex-index-goto-letter key))))
+ (mapc (lambda (key)
+ (define-key map (vector (list key))
+ (lambda () (interactive)
+ (reftex-index-goto-letter key))))
+ (concat "!" reftex-index-section-letters))
(easy-menu-define reftex-index-menu map
"Menu for Index buffer"
'("Index"
["Goto section A-Z"
(message "To go to a section, just press any of: !%s"
- reftex-index-section-letters) t]
+ reftex-index-section-letters)
+ t]
["Show Entry" reftex-index-view-entry t]
["Go To Entry" reftex-index-goto-entry t]
["Exit & Go To Entry" reftex-index-goto-entry-and-hide t]
@@ -394,7 +393,7 @@ Press `?' for a summary of important key bindings, or check the menu.
Here are all local bindings.
\\{reftex-index-mode-map}"
- (set (make-local-variable 'revert-buffer-function) 'reftex-index-revert)
+ (set (make-local-variable 'revert-buffer-function) #'reftex-index-revert)
(set (make-local-variable 'reftex-index-restriction-data) nil)
(set (make-local-variable 'reftex-index-restriction-indicator) nil)
(setq mode-line-format
@@ -403,15 +402,9 @@ Here are all local bindings.
" R<" 'reftex-index-restriction-indicator ">"
" -%-"))
(setq truncate-lines t)
- (when (featurep 'xemacs)
- ;; XEmacs needs the call to make-local-hook
- (make-local-hook 'post-command-hook)
- (make-local-hook 'pre-command-hook))
(make-local-variable 'reftex-last-follow-point)
- (when (featurep 'xemacs)
- (easy-menu-add reftex-index-menu reftex-index-mode-map))
- (add-hook 'post-command-hook 'reftex-index-post-command-hook nil t)
- (add-hook 'pre-command-hook 'reftex-index-pre-command-hook nil t))
+ (add-hook 'post-command-hook #'reftex-index-post-command-hook nil t)
+ (add-hook 'pre-command-hook #'reftex-index-pre-command-hook nil t))
(defconst reftex-index-help
" AVAILABLE KEYS IN INDEX BUFFER
@@ -450,7 +443,7 @@ _ ^ Add/Remove parent key (to make this item a subitem).
(match
(cond
((or (not no-revisit)
- (reftex-get-buffer-visiting file))
+ (find-buffer-visiting file))
(switch-to-buffer-other-window
(reftex-get-file-buffer-force file nil))
(goto-char (or pos (point-min)))
@@ -567,7 +560,7 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help
(run-hooks 'reftex-display-copied-context-hook)
(message "Building %s buffer...done." buffer-name)
(setq buffer-read-only t))
- (and locations (apply 'reftex-find-start-point (point) locations))
+ (and locations (apply #'reftex-find-start-point (point) locations))
(if reftex-index-restriction-indicator
(message "Index restricted: <%s>" reftex-index-restriction-indicator))))
@@ -582,7 +575,7 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help
(indent " ")
(context reftex-index-include-context)
(context-indent (concat indent " "))
- (section-chars (mapcar 'identity reftex-index-section-letters))
+ (section-chars (mapcar #'identity reftex-index-section-letters))
(this-section-char 0)
(font (reftex-use-fonts))
(bor (car reftex-index-restriction-data))
@@ -733,9 +726,9 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help
(if reftex-index-follow-mode
(setq reftex-index-follow-mode 1)))
-(defun reftex-index-next (&optional arg)
+(defun reftex-index-next (&optional _arg)
"Move to next selectable item."
- (interactive "p")
+ (interactive "^")
(setq reftex-callback-fwd t)
(or (eobp) (forward-char 1))
(goto-char (or (next-single-property-change (point) :data)
@@ -743,9 +736,9 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help
(unless (get-text-property (point) :data)
(goto-char (or (next-single-property-change (point) :data)
(point)))))
-(defun reftex-index-previous (&optional arg)
+(defun reftex-index-previous (&optional _arg)
"Move to previous selectable item."
- (interactive "p")
+ (interactive "^")
(setq reftex-callback-fwd nil)
(goto-char (or (previous-single-property-change (point) :data)
(point)))
@@ -793,7 +786,7 @@ Label context is only displayed when the labels are there as well."
(or (one-window-p) (delete-window))
(switch-to-buffer (marker-buffer reftex-index-return-marker))
(goto-char (or (marker-position reftex-index-return-marker) (point))))
-(defun reftex-index-goto-toc (&rest ignore)
+(defun reftex-index-goto-toc (&rest _ignore)
"Switch to the table of contents of the current document.
The function will go to the section where the entry at point was defined."
(interactive)
@@ -802,7 +795,7 @@ The function will go to the section where the entry at point was defined."
(switch-to-buffer (marker-buffer reftex-index-return-marker)))
(delete-other-windows)
(reftex-toc))
-(defun reftex-index-rescan (&rest ignore)
+(defun reftex-index-rescan (&rest _ignore)
"Regenerate the *Index* buffer after reparsing file of section at point."
(interactive)
(let ((index-tag reftex-index-tag))
@@ -818,7 +811,7 @@ The function will go to the section where the entry at point was defined."
(reftex-display-index index-tag nil 'redo line)))
(reftex-index-Rescan))
(reftex-kill-temporary-buffers)))
-(defun reftex-index-Rescan (&rest ignore)
+(defun reftex-index-Rescan (&rest _ignore)
"Regenerate the *Index* buffer after reparsing the entire document."
(interactive)
(let ((index-tag reftex-index-tag)
@@ -827,7 +820,7 @@ The function will go to the section where the entry at point was defined."
(reftex-get-file-buffer-force reftex-last-index-file))
(setq current-prefix-arg '(16))
(reftex-display-index index-tag nil 'redo line)))
-(defun reftex-index-revert (&rest ignore)
+(defun reftex-index-revert (&rest _ignore)
"Regenerate the *Index* from the internal lists. No reparsing os done."
(interactive)
(let ((buf (current-buffer))
@@ -840,7 +833,7 @@ The function will go to the section where the entry at point was defined."
(setq current-prefix-arg nil
reftex-last-follow-point 1)
(reftex-display-index index-tag nil 'redo data line)))
-(defun reftex-index-switch-index-tag (&rest ignore)
+(defun reftex-index-switch-index-tag (&rest _ignore)
"Switch to a different index of the same document."
(interactive)
(switch-to-buffer
@@ -865,14 +858,14 @@ The function will go to the section where the entry at point was defined."
reftex-index-restriction-indicator (nth 6 bor) )))
(reftex-index-revert))
-(defun reftex-index-widen (&rest ignore)
+(defun reftex-index-widen (&rest _ignore)
"Show the unrestricted index (all entries)."
(interactive)
(setq reftex-index-restriction-indicator nil
reftex-index-restriction-data nil)
(reftex-index-revert)
(message "Index widened"))
-(defun reftex-index-restriction-forward (&rest ignore)
+(defun reftex-index-restriction-forward (&rest _ignore)
"Restrict to previous section.
When index is currently unrestricted, restrict it to a section.
When index is restricted, select the next section as restriction criterion."
@@ -888,7 +881,7 @@ When index is restricted, select the next section as restriction criterion."
(car (memq (assq 'toc (cdr (memq bor docstruct)))
docstruct))))
(reftex-index-revert))))
-(defun reftex-index-restriction-backward (&rest ignore)
+(defun reftex-index-restriction-backward (&rest _ignore)
"Restrict to next section.
When index is currently unrestricted, restrict it to a section.
When index is restricted, select the previous section as restriction criterion."
@@ -986,7 +979,7 @@ When index is restricted, select the previous section as restriction criterion."
(setq analyze (reftex-index-analyze-entry data)
attr (nth 2 analyze))
(setf (nth 2 analyze) (if (string= attr bor) "" bor))
- (setq new (apply 'concat analyze))
+ (setq new (apply #'concat analyze))
(reftex-index-change-entry
new (if (string= (nth 2 analyze) bor)
"Entry is now START-OF-PAGE-RANGE"
@@ -1002,7 +995,7 @@ When index is restricted, select the previous section as restriction criterion."
(setq analyze (reftex-index-analyze-entry data)
attr (nth 2 analyze))
(setf (nth 2 analyze) (if (string= attr eor) "" eor))
- (setq new (apply 'concat analyze))
+ (setq new (apply #'concat analyze))
(reftex-index-change-entry
new (if (string= (nth 2 analyze) eor)
"Entry is now END-OF-PAGE-RANGE"
@@ -1043,7 +1036,7 @@ When index is restricted, select the previous section as restriction criterion."
(error "Invalid value")
(setf (nth n analyze) npart)))
(t (setf (nth n analyze) (concat initial npart))))
- (setq new (apply 'concat analyze))
+ (setq new (apply #'concat analyze))
;; Change the entry and insert the changed version into the index.
(reftex-index-change-entry
new (if (string= npart "")
@@ -1180,27 +1173,50 @@ This gets refreshed in every phrases command.")
(defvar reftex-index-phrases-files nil
"List of document files relevant for the phrases file.")
-(defvar reftex-index-phrases-font-lock-keywords nil
- "Font lock keywords for reftex-index-phrases-mode.")
-(defvar reftex-index-phrases-font-lock-defaults nil
- "Font lock defaults for reftex-index-phrases-mode.")
+(defvar reftex-index-phrases-font-lock-keywords
+ (list
+ (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face)
+ (list reftex-index-phrases-macrodef-regexp
+ '(1 font-lock-type-face)
+ '(2 font-lock-keyword-face)
+ '(3 'secondary-selection)
+ '(4 font-lock-function-name-face)
+ '(5 'secondary-selection)
+ '(6 font-lock-string-face))
+ (list reftex-index-phrases-phrase-regexp1
+ '(1 font-lock-keyword-face)
+ '(2 'secondary-selection)
+ '(3 font-lock-string-face)
+ '(4 'secondary-selection))
+ (list reftex-index-phrases-phrase-regexp2
+ '(1 font-lock-keyword-face)
+ '(2 'secondary-selection)
+ '(3 font-lock-string-face)
+ '(4 'secondary-selection)
+ '(5 font-lock-function-name-face))
+ '("^\t$" . 'secondary-selection))
+ "Font lock keywords for `reftex-index-phrases-mode'.")
+(defvar reftex-index-phrases-font-lock-defaults
+ '((reftex-index-phrases-font-lock-keywords)
+ nil t nil beginning-of-line)
+ "Font lock defaults for `reftex-index-phrases-mode'.")
(define-obsolete-variable-alias
'reftex-index-phrases-map 'reftex-index-phrases-mode-map "24.1")
(defvar reftex-index-phrases-mode-map
(let ((map (make-sparse-keymap)))
;; Keybindings and Menu for phrases buffer
- (define-key map "\C-c\C-c" 'reftex-index-phrases-save-and-return)
- (define-key map "\C-c\C-x" 'reftex-index-this-phrase)
- (define-key map "\C-c\C-f" 'reftex-index-next-phrase)
- (define-key map "\C-c\C-r" 'reftex-index-region-phrases)
- (define-key map "\C-c\C-a" 'reftex-index-all-phrases)
- (define-key map "\C-c\C-d" 'reftex-index-remaining-phrases)
- (define-key map "\C-c\C-s" 'reftex-index-sort-phrases)
- (define-key map "\C-c\C-n" 'reftex-index-new-phrase)
- (define-key map "\C-c\C-m" 'reftex-index-phrases-set-macro-key)
- (define-key map "\C-c\C-i" 'reftex-index-phrases-info)
- (define-key map "\C-c\C-t" 'reftex-index-find-next-conflict-phrase)
- (define-key map "\C-i" 'self-insert-command)
+ (define-key map "\C-c\C-c" #'reftex-index-phrases-save-and-return)
+ (define-key map "\C-c\C-x" #'reftex-index-this-phrase)
+ (define-key map "\C-c\C-f" #'reftex-index-next-phrase)
+ (define-key map "\C-c\C-r" #'reftex-index-region-phrases)
+ (define-key map "\C-c\C-a" #'reftex-index-all-phrases)
+ (define-key map "\C-c\C-d" #'reftex-index-remaining-phrases)
+ (define-key map "\C-c\C-s" #'reftex-index-sort-phrases)
+ (define-key map "\C-c\C-n" #'reftex-index-new-phrase)
+ (define-key map "\C-c\C-m" #'reftex-index-phrases-set-macro-key)
+ (define-key map "\C-c\C-i" #'reftex-index-phrases-info)
+ (define-key map "\C-c\C-t" #'reftex-index-find-next-conflict-phrase)
+ (define-key map "\C-i" #'self-insert-command)
(easy-menu-define reftex-index-phrases-menu map
"Menu for Phrases buffer"
@@ -1295,7 +1311,7 @@ If the buffer is non-empty, delete the old header first."
reftex-key-to-index-macro-alist)))
(macro-alist
(sort (copy-sequence reftex-index-macro-alist)
- (lambda (a b) (equal (car a) default-macro))))
+ (lambda (a _b) (equal (car a) default-macro))))
macro entry key repeat)
(if master (set (make-local-variable 'TeX-master)
@@ -1311,9 +1327,7 @@ If the buffer is non-empty, delete the old header first."
(beginning-of-line 2))
(while (looking-at "^[ \t]*$")
(beginning-of-line 2))
- (if (featurep 'xemacs)
- (zmacs-activate-region)
- (setq mark-active t))
+ (activate-mark)
(if (yes-or-no-p "Delete and rebuild header? ")
(delete-region (point-min) (point))))
@@ -1336,7 +1350,6 @@ If the buffer is non-empty, delete the old header first."
(if repeat "t" "nil"))))
(insert "%---------------------------------------------------------------------\n\n\n")))
-(defvar TeX-master)
(defun reftex-index-phrase-tex-master (&optional dir)
"Return the name of the master file associated with a phrase buffer."
(if (and (boundp 'TeX-master)
@@ -1387,41 +1400,8 @@ Here are all local bindings.
:syntax-table reftex-index-phrases-syntax-table
(set (make-local-variable 'font-lock-defaults)
reftex-index-phrases-font-lock-defaults)
- (when (featurep 'xemacs)
- (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-mode-map))
(set (make-local-variable 'reftex-index-phrases-marker) (make-marker)))
-;; (add-hook 'reftex-index-phrases-mode-hook 'turn-on-font-lock)
-
-;; Font Locking stuff
-(let ((ss (if (featurep 'xemacs) 'secondary-selection ''secondary-selection)))
- (setq reftex-index-phrases-font-lock-keywords
- (list
- (cons reftex-index-phrases-comment-regexp 'font-lock-comment-face)
- (list reftex-index-phrases-macrodef-regexp
- '(1 font-lock-type-face)
- '(2 font-lock-keyword-face)
- (list 3 ss)
- '(4 font-lock-function-name-face)
- (list 5 ss)
- '(6 font-lock-string-face))
- (list reftex-index-phrases-phrase-regexp1
- '(1 font-lock-keyword-face)
- (list 2 ss)
- '(3 font-lock-string-face)
- (list 4 ss))
- (list reftex-index-phrases-phrase-regexp2
- '(1 font-lock-keyword-face)
- (list 2 ss)
- '(3 font-lock-string-face)
- (list 4 ss)
- '(5 font-lock-function-name-face))
- (cons "^\t$" ss)))
- (setq reftex-index-phrases-font-lock-defaults
- '((reftex-index-phrases-font-lock-keywords)
- nil t nil beginning-of-line))
- (put 'reftex-index-phrases-mode 'font-lock-defaults
- reftex-index-phrases-font-lock-defaults) ; XEmacs
- )
+;; (add-hook 'reftex-index-phrases-mode-hook #'turn-on-font-lock)
(defun reftex-index-next-phrase (&optional arg)
"Index the next ARG phrases in the phrases buffer."
@@ -1561,9 +1541,7 @@ index the new part without having to go over the unchanged parts again."
(unwind-protect
(progn
;; Hide the region highlighting
- (if (featurep 'xemacs)
- (zmacs-deactivate-region)
- (deactivate-mark))
+ (deactivate-mark)
(delete-other-windows)
(reftex-index-visit-phrases-buffer)
(reftex-index-all-phrases))
@@ -1593,7 +1571,7 @@ index the new part without having to go over the unchanged parts again."
(if (and text (stringp text))
(insert text)))
-(defun reftex-index-find-next-conflict-phrase (&optional arg)
+(defun reftex-index-find-next-conflict-phrase (&optional _arg)
"Find the next a phrase which is has conflicts in the phrase buffer.
The command helps to find possible conflicts in the phrase indexing process.
It searches downward from point for a phrase which is repeated elsewhere
@@ -1601,7 +1579,7 @@ in the buffer, or which is a subphrase of another phrase. If such a
phrase is found, the phrase info is displayed.
To check the whole buffer, start at the beginning and continue by calling
this function repeatedly."
- (interactive "P")
+ (interactive)
(if (catch 'exit
(while (re-search-forward reftex-index-phrases-phrase-regexp12 nil t)
(goto-char (match-beginning 3))
@@ -1743,6 +1721,8 @@ information about the currently selected macro."
(if repeat "with" "without")))
(error "Abort")))))
+(defvar reftex--chars-first)
+
(defun reftex-index-sort-phrases (&optional chars-first)
"Sort the phrases lines in the buffer alphabetically.
Normally, this looks only at the phrases. With a prefix arg CHARS-FIRST,
@@ -1762,19 +1742,18 @@ it first compares the macro identifying chars and then the phrases."
(if end (setq end (progn (goto-char end) (end-of-line) (point))))
;; Take the lines, sort them and re-insert.
(if (and beg end)
- (progn
+ (let ((reftex--chars-first chars-first))
(message "Sorting lines...")
(let* ((lines (split-string (buffer-substring beg end) "\n"))
- (lines1 (sort lines 'reftex-compare-phrase-lines)))
+ (lines1 (sort lines #'reftex-compare-phrase-lines)))
(message "Sorting lines...done")
(let ((inhibit-quit t)) ;; make sure we do not lose lines
(delete-region beg end)
- (insert (mapconcat 'identity lines1 "\n"))))
+ (insert (mapconcat #'identity lines1 "\n"))))
(goto-char (point-max))
(re-search-backward (concat "^" (regexp-quote line) "$") nil t))
(error "Cannot find phrases lines to sort"))))
-(defvar chars-first)
(defun reftex-compare-phrase-lines (a b)
"The comparison function used for sorting."
(let (ca cb pa pb c-p p-p)
@@ -1798,7 +1777,7 @@ it first compares the macro identifying chars and then the phrases."
p-p (string< pa pb))
;; Do the right comparison, based on the value of `chars-first'
;; `chars-first' is bound locally in the calling function
- (if chars-first
+ (if reftex--chars-first
(if (string= ca cb) p-p c-p)
(if (string= pa pb) c-p p-p)))))
;; If line a does not match, the answer we return determines
@@ -1830,14 +1809,14 @@ With optional arg ALLOW-NEWLINE, allow single newline between words."
(defun reftex-index-simplify-phrase (phrase)
"Make phrase single spaces and single line."
- (mapconcat 'identity (split-string phrase) " "))
+ (mapconcat #'identity (split-string phrase) " "))
(defun reftex-index-phrases-find-dup-re (phrase &optional sub)
"Return a regexp which matches variations of PHRASE (with additional space).
When SUB ins non-nil, the regexp will also match when PHRASE is a subphrase
of another phrase. The regexp works lonly in the phrase buffer."
(concat (if sub "^\\S-?\t\\([^\t\n]*" "^\\S-?\t")
- (mapconcat 'regexp-quote (split-string phrase) " +")
+ (mapconcat #'regexp-quote (split-string phrase) " +")
(if sub "[^\t\n]*\\)\\([\t\n]\\|$\\)" " *\\([\t\n]\\|$\\)")))
(defun reftex-index-make-replace-string (macro-fmt match index-key
@@ -1870,7 +1849,7 @@ Treats the logical `and' for index phrases."
(unless (stringp reftex-index-phrases-restrict-file)
(widen))
(goto-char (point-min))
- (apply 'reftex-query-index-phrase args))))))
+ (apply #'reftex-query-index-phrase args))))))
(reftex-unhighlight 0)
(set-window-configuration win-conf))))
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 98c61f56b48..9def10cee05 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -1,4 +1,4 @@
-;;; reftex-parse.el --- parser functions for RefTeX
+;;; reftex-parse.el --- parser functions for RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -143,7 +143,7 @@ When allowed, do only a partial scan from FILE."
(car (push (list 'is-multi is-multi) docstruct)))))
(setcdr entry (cons is-multi nil)))
(and reftex--index-tags
- (setq reftex--index-tags (sort reftex--index-tags 'string<)))
+ (setq reftex--index-tags (sort reftex--index-tags #'string<)))
(let ((index-tag-cell (assq 'index-tags docstruct)))
(if index-tag-cell
(setcdr index-tag-cell reftex--index-tags)
@@ -160,10 +160,10 @@ When allowed, do only a partial scan from FILE."
nil))
allxr))
(alist (delq nil alist))
- (allprefix (delq nil (mapcar 'car alist)))
+ (allprefix (delq nil (mapcar #'car alist)))
(regexp (if allprefix
(concat "\\`\\("
- (mapconcat 'identity allprefix "\\|")
+ (mapconcat #'identity allprefix "\\|")
"\\)")
"\\\\\\\\\\\\"))) ; this will never match
(push (list 'xr alist regexp) docstruct)))
@@ -209,7 +209,7 @@ of master file."
(catch 'exit
(setq file-found (reftex-locate-file file "tex" master-dir))
(if (and (not file-found)
- (setq buf (reftex-get-buffer-visiting file)))
+ (setq buf (find-buffer-visiting file)))
(setq file-found (buffer-file-name buf)))
(unless file-found
@@ -384,8 +384,9 @@ of master file."
(concat
;; "\\(\\`\\|[\n\r]\\)[^%]*\\\\\\("
"\\(^\\)[^%\n\r]*\\\\\\("
- (mapconcat 'identity reftex-bibliography-commands "\\|")
- "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)") nil t))
+ (mapconcat #'identity reftex-bibliography-commands "\\|")
+ "\\)\\(\\[.+?\\]\\)?{[ \t]*\\([^}]+\\)")
+ nil t))
(setq files
(append files
(split-string (reftex-match-string 4)
@@ -532,7 +533,7 @@ Careful: This function expects the match-data to be still in place!"
(key (if prefix (concat prefix rawkey) rawkey))
(sortkey (downcase key))
- (showkey (mapconcat 'identity
+ (showkey (mapconcat #'identity
(split-string key reftex-index-level-re)
" ! ")))
(goto-char end-of-args)
@@ -756,7 +757,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 439c02f8089..19081825931 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -1,4 +1,4 @@
-;;; reftex-ref.el --- code to create labels and references with RefTeX
+;;; reftex-ref.el --- code to create labels and references with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -84,10 +84,12 @@ If optional BOUND is an integer, limit backward searches to that point."
(if (or (re-search-forward
(format reftex-find-label-regexp-format
- (regexp-quote label)) nil t)
+ (regexp-quote label))
+ nil t)
(re-search-forward
(format reftex-find-label-regexp-format2
- (regexp-quote label)) nil t))
+ (regexp-quote label))
+ nil t))
(progn
(backward-char 1)
@@ -248,13 +250,13 @@ This function is controlled by the settings of reftex-insert-label-flags."
""
"POSITION UNCERTAIN. RESCAN TO FIX."))
(file (buffer-file-name))
- (text nil)
+ ;; (text nil)
(tail (memq here-I-am (symbol-value reftex-docstruct-symbol))))
(or (cdr here-I-am-info) (setq rescan-is-useful t))
(when tail
- (push (list label typekey text file nil note) (cdr tail))
+ (push (list label typekey nil file nil note) (cdr tail))
(put reftex-docstruct-symbol 'modified t)))
;; Insert the label into the buffer
@@ -286,7 +288,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
(when (and reftex-translate-to-ascii-function
(fboundp reftex-translate-to-ascii-function))
(setq string (funcall reftex-translate-to-ascii-function string)))
- (apply 'reftex-convert-string string
+ (apply #'reftex-convert-string string
"[-~ \t\n\r,;]+" reftex-label-illegal-re nil nil
reftex-derive-label-parameters))
@@ -402,6 +404,8 @@ also applies `reftex-translate-to-ascii-function' to the string."
a / A Put all marked entries into one/many \\ref commands.
q / RET Quit without referencing / Accept current label (also on mouse-2).")
+(defvar reftex-refstyle)
+
;;;###autoload
(defun reftex-reference (&optional type no-insert cut)
"Make a LaTeX reference. Look only for labels of a certain TYPE.
@@ -473,7 +477,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
;; If the first entry is the symbol 'concat, concat all labels.
;; We keep the cdr of the first label for typekey etc information.
(if (eq (car labels) 'concat)
- (setq labels (list (list (mapconcat 'car (cdr labels) ",")
+ (setq labels (list (list (mapconcat #'car (cdr labels) ",")
(cdr (nth 1 labels))))))
(setq type (nth 1 (car labels))
form (or (cdr (assoc type reftex-typekey-to-format-alist))
@@ -502,7 +506,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
(setq form (substring form 1)))
;; do we have a special format?
(unless (string= reftex-refstyle "\\ref")
- (setq reftex-format-ref-function 'reftex-format-special))
+ (setq reftex-format-ref-function #'reftex-format-special))
;; ok, insert the reference
(if sep1 (insert sep1))
(insert
@@ -744,7 +748,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
;; Goto the file in another window
(setq buffer
(if no-revisit
- (reftex-get-buffer-visiting file)
+ (find-buffer-visiting file)
(reftex-get-file-buffer-force
file (not reftex-keep-temporary-buffers))))
(if buffer
@@ -794,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*")
@@ -826,14 +830,16 @@ When called with 2 C-u prefix args, disable magic word recognition."
(dolist (item (nth 2 elt))
(let ((macro (car item))
(package (nth 1 elt)))
- (eval `(defun ,(intern (format "reftex-%s-%s" package
- (substring macro 1 (length macro)))) ()
- ,(format "Insert a reference using the `%s' macro from the %s \
+ (defalias (intern (format "reftex-%s-%s" package
+ (substring macro 1 (length macro))))
+ (lambda ()
+ (:documentation
+ (format "Insert a reference using the `%s' macro from the %s \
package.\n\nThis is a generated function."
- macro package)
- (interactive)
- (let ((reftex-refstyle ,macro))
- (reftex-reference))))))))
+ macro package))
+ (interactive)
+ (let ((reftex-refstyle macro))
+ (reftex-reference))))))))
(defun reftex-format-special (label fmt refstyle)
"Apply selected reference style to format FMT and add LABEL.
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index d2e9974499b..b0a8ebf8ac0 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -1,4 +1,4 @@
-;;; reftex-sel.el --- the selection modes for RefTeX
+;;; reftex-sel.el --- the selection modes for RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -34,31 +34,29 @@
(let ((map (make-sparse-keymap)))
(set-keymap-parent map special-mode-map)
(substitute-key-definition
- 'next-line 'reftex-select-next map global-map)
+ #'next-line #'reftex-select-next map global-map)
(substitute-key-definition
- 'previous-line 'reftex-select-previous map global-map)
+ #'previous-line #'reftex-select-previous map global-map)
(substitute-key-definition
- 'keyboard-quit 'reftex-select-keyboard-quit map global-map)
+ #'keyboard-quit #'reftex-select-keyboard-quit map global-map)
(substitute-key-definition
- 'newline 'reftex-select-accept map global-map)
-
- (define-key map " " 'reftex-select-callback)
- (define-key map "n" 'reftex-select-next)
- (define-key map [(down)] 'reftex-select-next)
- (define-key map "p" 'reftex-select-previous)
- (define-key map [(up)] 'reftex-select-previous)
- (define-key map "f" 'reftex-select-toggle-follow)
- (define-key map "\C-m" 'reftex-select-accept)
- (define-key map [(return)] 'reftex-select-accept)
- (define-key map "q" 'reftex-select-quit)
- (define-key map "." 'reftex-select-show-insertion-point)
- (define-key map "?" 'reftex-select-help)
+ #'newline #'reftex-select-accept map global-map)
+
+ (define-key map " " #'reftex-select-callback)
+ (define-key map "n" #'reftex-select-next)
+ (define-key map [(down)] #'reftex-select-next)
+ (define-key map "p" #'reftex-select-previous)
+ (define-key map [(up)] #'reftex-select-previous)
+ (define-key map "f" #'reftex-select-toggle-follow)
+ (define-key map "\C-m" #'reftex-select-accept)
+ (define-key map [(return)] #'reftex-select-accept)
+ (define-key map "q" #'reftex-select-quit)
+ (define-key map "." #'reftex-select-show-insertion-point)
+ (define-key map "?" #'reftex-select-help)
;; The mouse-2 binding
- (if (featurep 'xemacs)
- (define-key map [(button2)] 'reftex-select-mouse-accept)
- (define-key map [(mouse-2)] 'reftex-select-mouse-accept)
- (define-key map [follow-link] 'mouse-face))
+ (define-key map [(mouse-2)] #'reftex-select-mouse-accept)
+ (define-key map [follow-link] 'mouse-face)
map))
(define-obsolete-variable-alias
@@ -67,25 +65,26 @@
(let ((map (make-sparse-keymap)))
(set-keymap-parent map reftex-select-shared-map)
- (cl-loop for key across "aAcgFlrRstx#%" do
- (define-key map (vector (list key))
- (list 'lambda '()
- "Press `?' during selection to find out about this key."
- '(interactive) (list 'throw '(quote myexit) key))))
-
- (define-key map "b" 'reftex-select-jump-to-previous)
- (define-key map "z" 'reftex-select-jump)
- (define-key map "v" 'reftex-select-cycle-ref-style-forward)
- (define-key map "V" 'reftex-select-cycle-ref-style-backward)
- (define-key map "m" 'reftex-select-mark)
- (define-key map "u" 'reftex-select-unmark)
- (define-key map "," 'reftex-select-mark-comma)
- (define-key map "-" 'reftex-select-mark-to)
- (define-key map "+" 'reftex-select-mark-and)
- (define-key map [(tab)] 'reftex-select-read-label)
- (define-key map "\C-i" 'reftex-select-read-label)
- (define-key map "\C-c\C-n" 'reftex-select-next-heading)
- (define-key map "\C-c\C-p" 'reftex-select-previous-heading)
+ (mapc (lambda (key)
+ (define-key map (vector (list key))
+ (lambda ()
+ "Press `?' during selection to find out about this key."
+ (interactive) (throw 'myexit key))))
+ "aAcgFlrRstx#%")
+
+ (define-key map "b" #'reftex-select-jump-to-previous)
+ (define-key map "z" #'reftex-select-jump)
+ (define-key map "v" #'reftex-select-cycle-ref-style-forward)
+ (define-key map "V" #'reftex-select-cycle-ref-style-backward)
+ (define-key map "m" #'reftex-select-mark)
+ (define-key map "u" #'reftex-select-unmark)
+ (define-key map "," #'reftex-select-mark-comma)
+ (define-key map "-" #'reftex-select-mark-to)
+ (define-key map "+" #'reftex-select-mark-and)
+ (define-key map [(tab)] #'reftex-select-read-label)
+ (define-key map "\C-i" #'reftex-select-read-label)
+ (define-key map "\C-c\C-n" #'reftex-select-next-heading)
+ (define-key map "\C-c\C-p" #'reftex-select-previous-heading)
map)
"Keymap used for *RefTeX Select* buffer, when selecting a label.
@@ -104,10 +103,6 @@ Press `?' for a summary of important key bindings.
During a selection process, these are the local bindings.
\\{reftex-select-label-mode-map}"
- (when (featurep 'xemacs)
- ;; XEmacs needs the call to make-local-hook
- (make-local-hook 'pre-command-hook)
- (make-local-hook 'post-command-hook))
(set (make-local-variable 'reftex-select-marked) nil)
(when (syntax-table-p reftex-latex-syntax-table)
(set-syntax-table reftex-latex-syntax-table))
@@ -120,16 +115,17 @@ During a selection process, these are the local bindings.
(let ((map (make-sparse-keymap)))
(set-keymap-parent map reftex-select-shared-map)
- (cl-loop for key across "grRaAeE" do
- (define-key map (vector (list key))
- (list 'lambda '()
- "Press `?' during selection to find out about this key."
- '(interactive) (list 'throw '(quote myexit) key))))
+ (mapc (lambda (key)
+ (define-key map (vector (list key))
+ (lambda ()
+ "Press `?' during selection to find out about this key."
+ (interactive) (throw 'myexit key))))
+ "grRaAeE")
- (define-key map "\C-i" 'reftex-select-read-cite)
- (define-key map [(tab)] 'reftex-select-read-cite)
- (define-key map "m" 'reftex-select-mark)
- (define-key map "u" 'reftex-select-unmark)
+ (define-key map "\C-i" #'reftex-select-read-cite)
+ (define-key map [(tab)] #'reftex-select-read-cite)
+ (define-key map "m" #'reftex-select-mark)
+ (define-key map "u" #'reftex-select-unmark)
map)
"Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry.
@@ -148,10 +144,6 @@ Press `?' for a summary of important key bindings.
During a selection process, these are the local bindings.
\\{reftex-select-label-mode-map}"
- (when (featurep 'xemacs)
- ;; XEmacs needs the call to make-local-hook
- (make-local-hook 'pre-command-hook)
- (make-local-hook 'post-command-hook))
(set (make-local-variable 'reftex-select-marked) nil)
;; We do not set a local map - reftex-select-item does this.
)
@@ -432,12 +424,21 @@ During a selection process, these are the local bindings.
(defvar reftex-last-data nil)
(defvar reftex-last-line nil)
(defvar reftex-select-marked nil)
+(defvar reftex-refstyle)
+
+;; The following variables are all bound dynamically in `reftex-select-item'.
+
+(defvar reftex-select-data)
+(defvar reftex-select-prompt)
+(defvar reftex--cb-flag)
+(defvar reftex--last-data)
+(defvar reftex--call-back)
+(defvar reftex--help-string)
;;;###autoload
-(defun reftex-select-item (reftex-select-prompt help-string keymap
- &optional offset
- call-back cb-flag)
- ;; Select an item, using REFTEX-SELECT-PROMPT.
+(defun reftex-select-item ( prompt help-string keymap
+ &optional offset call-back cb-flag)
+ ;; Select an item, using PROMPT.
;; The function returns a key indicating an exit status, along with a
;; data structure indicating which item was selected.
;; HELP-STRING contains help. KEYMAP is a keymap with the available
@@ -448,7 +449,12 @@ During a selection process, these are the local bindings.
;; When CALL-BACK is given, it is a function which is called with the index
;; of the element.
;; CB-FLAG is the initial value of that flag.
- (let (ev reftex-select-data last-data (selection-buffer (current-buffer)))
+ (let ((reftex-select-prompt prompt)
+ (reftex--help-string help-string)
+ (reftex--call-back call-back)
+ (reftex--cb-flag cb-flag)
+ ev reftex-select-data reftex--last-data
+ (selection-buffer (current-buffer)))
(setq reftex-select-marked nil)
@@ -466,43 +472,29 @@ During a selection process, these are the local bindings.
(unwind-protect
(progn
(use-local-map keymap)
- (add-hook 'pre-command-hook 'reftex-select-pre-command-hook nil t)
- (add-hook 'post-command-hook 'reftex-select-post-command-hook nil t)
+ (add-hook 'pre-command-hook #'reftex-select-pre-command-hook nil t)
+ (add-hook 'post-command-hook #'reftex-select-post-command-hook nil t)
(princ reftex-select-prompt)
(set-marker reftex-recursive-edit-marker (point))
- ;; XEmacs does not run post-command-hook here
- (and (featurep 'xemacs) (run-hooks 'post-command-hook))
(recursive-edit))
(set-marker reftex-recursive-edit-marker nil)
(with-current-buffer selection-buffer
(use-local-map nil)
- (remove-hook 'pre-command-hook 'reftex-select-pre-command-hook t)
+ (remove-hook 'pre-command-hook #'reftex-select-pre-command-hook t)
(remove-hook 'post-command-hook
- 'reftex-select-post-command-hook t))
+ #'reftex-select-post-command-hook t))
;; Kill the mark overlays
- (mapc (lambda (c) (reftex-delete-overlay (nth 1 c)))
+ (mapc (lambda (c) (delete-overlay (nth 1 c)))
reftex-select-marked)))))
(set (make-local-variable 'reftex-last-line)
(+ (count-lines (point-min) (point)) (if (bolp) 1 0)))
- (set (make-local-variable 'reftex-last-data) last-data)
+ (set (make-local-variable 'reftex-last-data) reftex--last-data)
(reftex-kill-buffer "*RefTeX Help*")
(setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-)))
(message "")
- (list ev reftex-select-data last-data)))
-
-;; The following variables are all bound dynamically in `reftex-select-item'.
-;; The defvars are here only to silence the byte compiler.
-
-(defvar found-list)
-(defvar cb-flag)
-(defvar reftex-select-data)
-(defvar reftex-select-prompt)
-(defvar last-data)
-(defvar call-back)
-(defvar help-string)
-(defvar reftex-refstyle)
+ (list ev reftex-select-data reftex--last-data)))
;; The selection commands
@@ -513,12 +505,12 @@ During a selection process, these are the local bindings.
(defun reftex-select-post-command-hook ()
(let (b e)
(setq reftex-select-data (get-text-property (point) :data))
- (setq last-data (or reftex-select-data last-data))
+ (setq reftex--last-data (or reftex-select-data reftex--last-data))
- (when (and reftex-select-data cb-flag
+ (when (and reftex-select-data reftex--cb-flag
(not (equal reftex-last-follow-point (point))))
(setq reftex-last-follow-point (point))
- (funcall call-back reftex-select-data reftex-callback-fwd
+ (funcall reftex--call-back reftex-select-data reftex-callback-fwd
(not reftex-revisit-to-follow)))
(if reftex-select-data
(setq b (or (previous-single-property-change
@@ -594,7 +586,7 @@ Useful for large TOC's."
"Toggle follow mode: Other window follows with full context."
(interactive)
(setq reftex-last-follow-point -1)
- (setq cb-flag (not cb-flag)))
+ (setq reftex--cb-flag (not reftex--cb-flag)))
(defun reftex-select-cycle-ref-style-internal (&optional reverse)
"Cycle through macros used for referencing.
@@ -632,7 +624,9 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
(defun reftex-select-callback ()
"Show full context in another window."
(interactive)
- (if reftex-select-data (funcall call-back reftex-select-data reftex-callback-fwd nil) (ding)))
+ (if reftex-select-data
+ (funcall reftex--call-back reftex-select-data reftex-callback-fwd nil)
+ (ding)))
(defun reftex-select-accept ()
"Accept the currently selected item."
(interactive)
@@ -642,7 +636,7 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
(interactive "e")
(mouse-set-point ev)
(setq reftex-select-data (get-text-property (point) :data))
- (setq last-data (or reftex-select-data last-data))
+ (setq reftex--last-data (or reftex-select-data reftex--last-data))
(throw 'myexit 'return))
(defun reftex-select-read-label ()
"Use minibuffer to read a label to reference, with completion."
@@ -652,16 +646,19 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
nil nil reftex-prefix)))
(unless (or (equal label "") (equal label reftex-prefix))
(throw 'myexit label))))
+
+(defvar reftex--found-list)
+
(defun reftex-select-read-cite ()
"Use minibuffer to read a citation key with completion."
(interactive)
- (let* ((key (completing-read "Citation key: " found-list))
- (entry (assoc key found-list)))
+ (let* ((key (completing-read "Citation key: " reftex--found-list))
+ (entry (assoc key reftex--found-list)))
(cond
((or (null key) (equal key "")))
(entry
(setq reftex-select-data entry)
- (setq last-data reftex-select-data)
+ (setq reftex--last-data reftex-select-data)
(throw 'myexit 'return))
(t (throw 'myexit key)))))
@@ -676,14 +673,14 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
(setq boe (or (previous-single-property-change (1+ (point)) :data)
(point-min))
eoe (or (next-single-property-change (point) :data) (point-max)))
- (setq ovl (reftex-make-overlay boe eoe))
+ (setq ovl (make-overlay boe eoe))
(push (list data ovl separator) reftex-select-marked)
- (reftex-overlay-put ovl 'font-lock-face reftex-select-mark-face)
- (reftex-overlay-put ovl 'before-string
- (if separator
- (format "*%c%d* " separator
- (length reftex-select-marked))
- (format "*%d* " (length reftex-select-marked))))
+ (overlay-put ovl 'font-lock-face reftex-select-mark-face)
+ (overlay-put ovl 'before-string
+ (if separator
+ (format "*%c%d* " separator
+ (length reftex-select-marked))
+ (format "*%d* " (length reftex-select-marked))))
(message "Entry has mark no. %d" (length reftex-select-marked))))
(defun reftex-select-mark-comma ()
@@ -709,15 +706,15 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
sep)
(unless cell
(error "No marked entry at point"))
- (and ovl (reftex-delete-overlay ovl))
+ (and ovl (delete-overlay ovl))
(setq reftex-select-marked (delq cell reftex-select-marked))
(setq cnt (1+ (length reftex-select-marked)))
(mapc (lambda (c)
(setq sep (nth 2 c))
- (reftex-overlay-put (nth 1 c) 'before-string
- (if sep
- (format "*%c%d* " sep (cl-decf cnt))
- (format "*%d* " (cl-decf cnt)))))
+ (overlay-put (nth 1 c) 'before-string
+ (if sep
+ (format "*%c%d* " sep (cl-decf cnt))
+ (format "*%d* " (cl-decf cnt)))))
reftex-select-marked)
(message "Entry no longer marked")))
@@ -725,7 +722,7 @@ Cycle in reverse order if optional argument REVERSE is non-nil."
"Display a summary of the special key bindings."
(interactive)
(with-output-to-temp-buffer "*RefTeX Help*"
- (princ help-string))
+ (princ reftex--help-string))
(reftex-enlarge-to-fit "*RefTeX Help*" t))
(provide 'reftex-sel)
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 3b9f970a3d2..b5643491338 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -1,4 +1,4 @@
-;;; reftex-toc.el --- RefTeX's table of contents mode
+;;; reftex-toc.el --- RefTeX's table of contents mode -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2000, 2003-2021 Free Software Foundation, Inc.
@@ -32,8 +32,7 @@
(defvar reftex-toc-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map (if (featurep 'xemacs) [(button2)] [(mouse-2)])
- 'reftex-toc-mouse-goto-line-and-hide)
+ (define-key map [(mouse-2)] #'reftex-toc-mouse-goto-line-and-hide)
(define-key map [follow-link] 'mouse-face)
(substitute-key-definition
@@ -41,34 +40,34 @@
(substitute-key-definition
'previous-line 'reftex-toc-previous map global-map)
- (define-key map "n" 'reftex-toc-next)
- (define-key map "p" 'reftex-toc-previous)
- (define-key map "?" 'reftex-toc-show-help)
- (define-key map " " 'reftex-toc-view-line)
- (define-key map "\C-m" 'reftex-toc-goto-line-and-hide)
- (define-key map "\C-i" 'reftex-toc-goto-line)
- (define-key map "\C-c>" 'reftex-toc-display-index)
- (define-key map "r" 'reftex-toc-rescan)
- (define-key map "R" 'reftex-toc-Rescan)
- (define-key map "q" 'reftex-toc-quit) ;
- (define-key map "k" 'reftex-toc-quit-and-kill)
- (define-key map "f" 'reftex-toc-toggle-follow) ;
- (define-key map "a" 'reftex-toggle-auto-toc-recenter)
- (define-key map "d" 'reftex-toc-toggle-dedicated-frame)
- (define-key map "F" 'reftex-toc-toggle-file-boundary)
- (define-key map "i" 'reftex-toc-toggle-index)
- (define-key map "l" 'reftex-toc-toggle-labels)
- (define-key map "t" 'reftex-toc-max-level)
- (define-key map "c" 'reftex-toc-toggle-context)
- ;; (define-key map "%" 'reftex-toc-toggle-commented)
- (define-key map "\M-%" 'reftex-toc-rename-label)
- (define-key map "x" 'reftex-toc-external)
- (define-key map "z" 'reftex-toc-jump)
- (define-key map "." 'reftex-toc-show-calling-point)
- (define-key map "\C-c\C-n" 'reftex-toc-next-heading)
- (define-key map "\C-c\C-p" 'reftex-toc-previous-heading)
- (define-key map ">" 'reftex-toc-demote)
- (define-key map "<" 'reftex-toc-promote)
+ (define-key map "n" #'reftex-toc-next)
+ (define-key map "p" #'reftex-toc-previous)
+ (define-key map "?" #'reftex-toc-show-help)
+ (define-key map " " #'reftex-toc-view-line)
+ (define-key map "\C-m" #'reftex-toc-goto-line-and-hide)
+ (define-key map "\C-i" #'reftex-toc-goto-line)
+ (define-key map "\C-c>" #'reftex-toc-display-index)
+ (define-key map "r" #'reftex-toc-rescan)
+ (define-key map "R" #'reftex-toc-Rescan)
+ (define-key map "q" #'reftex-toc-quit) ;
+ (define-key map "k" #'reftex-toc-quit-and-kill)
+ (define-key map "f" #'reftex-toc-toggle-follow) ;
+ (define-key map "a" #'reftex-toggle-auto-toc-recenter)
+ (define-key map "d" #'reftex-toc-toggle-dedicated-frame)
+ (define-key map "F" #'reftex-toc-toggle-file-boundary)
+ (define-key map "i" #'reftex-toc-toggle-index)
+ (define-key map "l" #'reftex-toc-toggle-labels)
+ (define-key map "t" #'reftex-toc-max-level)
+ (define-key map "c" #'reftex-toc-toggle-context)
+ ;; (define-key map "%" #'reftex-toc-toggle-commented)
+ (define-key map "\M-%" #'reftex-toc-rename-label)
+ (define-key map "x" #'reftex-toc-external)
+ (define-key map "z" #'reftex-toc-jump)
+ (define-key map "." #'reftex-toc-show-calling-point)
+ (define-key map "\C-c\C-n" #'reftex-toc-next-heading)
+ (define-key map "\C-c\C-p" #'reftex-toc-previous-heading)
+ (define-key map ">" #'reftex-toc-demote)
+ (define-key map "<" #'reftex-toc-promote)
(easy-menu-define
reftex-toc-menu map
@@ -130,9 +129,7 @@ Here are all local bindings.
\\{reftex-toc-mode-map}"
(set (make-local-variable 'transient-mark-mode) t)
- (when (featurep 'xemacs)
- (set (make-local-variable 'zmacs-regions) t))
- (set (make-local-variable 'revert-buffer-function) 'reftex-toc-revert)
+ (set (make-local-variable 'revert-buffer-function) #'reftex-toc-revert)
(set (make-local-variable 'reftex-toc-include-labels-indicator) "")
(set (make-local-variable 'reftex-toc-max-level-indicator)
(if (= reftex-toc-max-level 100)
@@ -146,15 +143,9 @@ Here are all local bindings.
" T<" 'reftex-toc-max-level-indicator ">"
" -%-"))
(setq truncate-lines t)
- (when (featurep 'xemacs)
- ;; XEmacs needs the call to make-local-hook
- (make-local-hook 'post-command-hook)
- (make-local-hook 'pre-command-hook))
(make-local-variable 'reftex-last-follow-point)
- (add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t)
- (add-hook 'pre-command-hook 'reftex-toc-pre-command-hook nil t)
- (when (featurep 'xemacs)
- (easy-menu-add reftex-toc-menu reftex-toc-mode-map)))
+ (add-hook 'post-command-hook #'reftex-toc-post-command-hook nil t)
+ (add-hook 'pre-command-hook #'reftex-toc-pre-command-hook nil t))
(defvar reftex-last-toc-file nil
"Stores the file name from which `reftex-toc' was called. For redo command.")
@@ -420,7 +411,6 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(defun reftex-toc-next (&optional _arg)
"Move to next selectable item."
(interactive)
- (when (featurep 'xemacs) (setq zmacs-region-stays t))
(setq reftex-callback-fwd t)
(or (eobp) (forward-char 1))
(goto-char (or (next-single-property-change (point) :data)
@@ -428,21 +418,18 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
(defun reftex-toc-previous (&optional _arg)
"Move to previous selectable item."
(interactive)
- (when (featurep 'xemacs) (setq zmacs-region-stays t))
(setq reftex-callback-fwd nil)
(goto-char (or (previous-single-property-change (point) :data)
(point))))
(defun reftex-toc-next-heading (&optional arg)
"Move to next table of contents line."
(interactive "p")
- (when (featurep 'xemacs) (setq zmacs-region-stays t))
(end-of-line)
(re-search-forward "^ " nil t arg)
(beginning-of-line))
(defun reftex-toc-previous-heading (&optional arg)
"Move to previous table of contents line."
(interactive "p")
- (when (featurep 'xemacs) (setq zmacs-region-stays t))
(re-search-backward "^ " nil t arg))
(defun reftex-toc-toggle-follow ()
"Toggle follow (other window follows with context)."
@@ -662,7 +649,7 @@ point."
(let* ((reftex--start-line (+ (count-lines (point-min) (point))
(if (bolp) 1 0)))
(reftex--mark-line
- (if (reftex-region-active-p)
+ (if (region-active-p)
(save-excursion (goto-char (mark))
(+ (count-lines (point-min) (point))
(if (bolp) 1 0)))))
@@ -671,7 +658,7 @@ point."
beg end entries data sections nsec msg)
(setq msg
(catch 'exit
- (if (reftex-region-active-p)
+ (if (region-active-p)
;; A region is dangerous, check if we have a brand new scan,
;; to make sure we are not missing any section statements.
(if (not (reftex-toc-check-docstruct))
@@ -712,7 +699,7 @@ point."
nil ; we have permission, do nothing
(error "Abort")) ; abort, we don't have permission
;; Do the changes
- (mapc 'reftex-toc-promote-action entries)
+ (mapc #'reftex-toc-promote-action entries)
;; Rescan the document and rebuilt the toc buffer
(save-window-excursion
(reftex-toc-Rescan))
@@ -734,10 +721,8 @@ point."
(forward-line (1- point-line)))
(when mpos
(set-mark mpos)
- (if (featurep 'xemacs)
- (zmacs-activate-region)
- (setq mark-active t
- deactivate-mark nil)))))
+ (setq mark-active t
+ deactivate-mark nil))))
(defun reftex-toc-promote-prepare (x delta)
"Look at a TOC entry and see if we could pro/demote it.
@@ -918,7 +903,7 @@ label prefix determines the wording of a reference."
(setq match
(let ((where (car toc))
(file (nth 1 toc)))
- (if (or (not no-revisit) (reftex-get-buffer-visiting file))
+ (if (or (not no-revisit) (find-buffer-visiting file))
(progn
(switch-to-buffer-other-window
(reftex-get-file-buffer-force file nil))
@@ -981,7 +966,7 @@ label prefix determines the wording of a reference."
reftex-section-levels-all)))
"[[{]?"))))
((or (not no-revisit)
- (reftex-get-buffer-visiting file))
+ (find-buffer-visiting file))
;; Marker is lost. Use the backup method.
(switch-to-buffer-other-window
(reftex-get-file-buffer-force file nil))
@@ -1035,18 +1020,12 @@ section."
(interactive)
(if reftex-toc-auto-recenter-timer
(progn
- (if (featurep 'xemacs)
- (delete-itimer reftex-toc-auto-recenter-timer)
- (cancel-timer reftex-toc-auto-recenter-timer))
+ (cancel-timer reftex-toc-auto-recenter-timer)
(setq reftex-toc-auto-recenter-timer nil)
(message "Automatic recentering of TOC window was turned off"))
(setq reftex-toc-auto-recenter-timer
- (if (featurep 'xemacs)
- (start-itimer "RefTeX Idle Timer for recenter"
- 'reftex-recenter-toc-when-idle
- reftex-idle-time reftex-idle-time t)
- (run-with-idle-timer
- reftex-idle-time t 'reftex-recenter-toc-when-idle)))
+ (run-with-idle-timer
+ reftex-idle-time t #'reftex-recenter-toc-when-idle))
(message "Automatic recentering of TOC window was turned on")))
(defun reftex-toc-toggle-dedicated-frame ()
@@ -1090,15 +1069,12 @@ always show the current section in connection with the option
(switch-to-buffer "*toc*")
(select-frame current-frame)
(cond ((fboundp 'x-focus-frame)
- (x-focus-frame current-frame))
- ((and (featurep 'xemacs) ; `focus-frame' is a nop in Emacs.
- (fboundp 'focus-frame))
- (focus-frame current-frame)))
+ (x-focus-frame current-frame)))
(select-window current-window)
(when (eq reftex-auto-recenter-toc 'frame)
(unless reftex-toc-auto-recenter-timer
(reftex-toggle-auto-toc-recenter))
- (add-hook 'delete-frame-functions 'reftex-toc-delete-frame-hook)))))
+ (add-hook 'delete-frame-functions #'reftex-toc-delete-frame-hook)))))
(defun reftex-toc-delete-frame-hook (frame)
(if (and reftex-toc-auto-recenter-timer
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index 1b29eafabf7..96065ee69e1 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1,4 +1,4 @@
-;;; reftex-vars.el --- configuration variables for RefTeX
+;;; reftex-vars.el --- configuration variables for RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-1999, 2001-2021 Free Software Foundation, Inc.
@@ -121,7 +121,7 @@
(regexp "tables?" "tab\\." "Tabellen?"))
("table*" ?t nil nil caption)
- ("\\footnote[]{}" ?n "fn:" "~\\ref{%s}" 2
+ ("\\footnote[]{}" ?n "fn:" "~\\footref{%s}" 2
(regexp "footnotes?" "Fussnoten?"))
("any" ?\ " " "~\\ref{%s}" nil)
@@ -282,7 +282,7 @@ distribution. Mixed-case symbols are convenience aliases.")
The file name is expected after the command, either in braces or separated
by whitespace."
:group 'reftex-table-of-contents-browser
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type '(repeat string))
(defcustom reftex-max-section-depth 12
@@ -319,7 +319,7 @@ commands, promotion only works correctly if this list is sorted first
by set, then within each set by level. The promotion commands always
select the nearest entry with the correct new level."
:group 'reftex-table-of-contents-browser
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type '(repeat
(cons (string :tag "sectioning macro" "")
(choice
@@ -463,7 +463,7 @@ The value of this variable is a list of symbols with associations in the
constant `reftex-label-alist-builtin'. Check that constant for a full list
of options."
:group 'reftex-defining-label-environments
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type `(set
:indent 4
:inline t
@@ -611,7 +611,7 @@ Any list entry may also be a symbol. If that has an association in
list. However, builtin defaults should normally be set with the variable
`reftex-default-label-alist-entries'."
:group 'reftex-defining-label-environments
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type
`(repeat
(choice :tag "Package or Detailed "
@@ -888,50 +888,46 @@ DOWNCASE t: Downcase words before using them."
(string :tag ""))
(option (boolean :tag "Downcase words "))))
-(if (featurep 'xemacs)
- ;; XEmacs 21.5 doesn't have explicitly numbered matching groups,
- ;; so this list mustn't get any more items.
- (defconst reftex-label-regexps '("\\\\label{\\([^}]*\\)}"))
- (defcustom reftex-label-regexps
- `(;; Normal \\label{foo} labels
- "\\\\label{\\(?1:[^}]*\\)}"
- ;; keyvals [..., label = {foo}, ...] forms used by ctable,
- ;; listings, breqn, ...
- ,(concat
- ;; Make sure we search only for optional arguments of
- ;; environments/macros and don't match any other [. ctable
- ;; provides a macro called \ctable, beamer/breqn/listings have
- ;; environments. Start with a backslash and a group for names
- "\\\\\\(?:"
- ;; begin, optional spaces and opening brace
- "begin[[:space:]]*{"
- ;; Build a regexp for env names
- (regexp-opt '("lstlisting" "dmath" "dseries" "dgroup"
- "darray" "frame"))
- ;; closing brace, optional spaces
- "}[[:space:]]*"
- ;; Now for macros
- "\\|"
- ;; Build a regexp for macro names; currently only \ctable
- (regexp-opt '("ctable"))
- ;; Close the group for names
- "\\)"
- ;; Match the opening [ and the following chars
- "\\[[^][]*"
- ;; Allow nested levels of chars enclosed in braces
- "\\(?:{[^}{]*"
- "\\(?:{[^}{]*"
- "\\(?:{[^}{]*}[^}{]*\\)*"
- "}[^}{]*\\)*"
- "}[^][]*\\)*"
- ;; Match the label key
- "\\<label[[:space:]]*=[[:space:]]*"
- ;; Match the label value; braces around the value are
- ;; optional.
- "{?\\(?1:[^] ,}\r\n\t%]+\\)"
- ;; We are done. Just search until the next closing bracket
- "[^]]*\\]"))
- "List of regexps matching \\label definitions.
+(defcustom reftex-label-regexps
+ `(;; Normal \\label{foo} labels
+ "\\\\label{\\(?1:[^}]*\\)}"
+ ;; keyvals [..., label = {foo}, ...] forms used by ctable,
+ ;; listings, breqn, ...
+ ,(concat
+ ;; Make sure we search only for optional arguments of
+ ;; environments/macros and don't match any other [. ctable
+ ;; provides a macro called \ctable, beamer/breqn/listings have
+ ;; environments. Start with a backslash and a group for names
+ "\\\\\\(?:"
+ ;; begin, optional spaces and opening brace
+ "begin[[:space:]]*{"
+ ;; Build a regexp for env names
+ (regexp-opt '("lstlisting" "dmath" "dseries" "dgroup"
+ "darray" "frame"))
+ ;; closing brace, optional spaces
+ "}[[:space:]]*"
+ ;; Now for macros
+ "\\|"
+ ;; Build a regexp for macro names; currently only \ctable
+ (regexp-opt '("ctable"))
+ ;; Close the group for names
+ "\\)"
+ ;; Match the opening [ and the following chars
+ "\\[[^][]*"
+ ;; Allow nested levels of chars enclosed in braces
+ "\\(?:{[^}{]*"
+ "\\(?:{[^}{]*"
+ "\\(?:{[^}{]*}[^}{]*\\)*"
+ "}[^}{]*\\)*"
+ "}[^][]*\\)*"
+ ;; Match the label key
+ "\\<label[[:space:]]*=[[:space:]]*"
+ ;; Match the label value; braces around the value are
+ ;; optional.
+ "{?\\(?1:[^] ,}\r\n\t%]+\\)"
+ ;; We are done. Just search until the next closing bracket
+ "[^]]*\\]"))
+ "List of regexps matching \\label definitions.
The default value matches usual \\label{...} definitions and
keyval style [..., label = {...}, ...] label definitions. The
regexp for keyval style explicitly looks for environments
@@ -946,13 +942,13 @@ you have to define it using \\(?1:...\\) when adding new regexps.
When changed from Lisp, make sure to call
`reftex-compile-variables' afterwards to make the change
effective."
- :version "28.1"
- :set (lambda (symbol value)
- (set symbol value)
- (when (fboundp 'reftex-compile-variables)
- (reftex-compile-variables)))
- :group 'reftex-defining-label-environments
- :type '(repeat (regexp :tag "Regular Expression"))))
+ :version "28.1"
+ :set (lambda (symbol value)
+ (set symbol value)
+ (when (fboundp 'reftex-compile-variables)
+ (reftex-compile-variables)))
+ :group 'reftex-defining-label-environments
+ :type '(repeat (regexp :tag "Regular Expression")))
(defcustom reftex-label-ignored-macros-and-environments nil
"List of macros and environments to be ignored when searching for labels.
@@ -1063,7 +1059,7 @@ This is used to string together whole reference sets, like
(defcustom reftex-ref-style-alist
'(("Default" t
- (("\\ref" ?\C-m) ("\\Ref" ?R) ("\\pageref" ?p)))
+ (("\\ref" ?\C-m) ("\\Ref" ?R) ("\\footref" ?n) ("\\pageref" ?p)))
("Varioref" "varioref"
(("\\vref" ?v) ("\\Vref" ?V) ("\\vpageref" ?g)))
("Fancyref" "fancyref"
@@ -1083,7 +1079,7 @@ the macro type is being prompted for. (See also
`reftex-ref-macro-prompt'.) The keys, represented as characters,
have to be unique."
:group 'reftex-referencing-labels
- :version "27.1"
+ :version "28.1"
:type '(alist :key-type (string :tag "Style name")
:value-type (group (choice :tag "Package"
(const :tag "Any package" t)
@@ -1198,7 +1194,7 @@ File names matched by these regexps will not be parsed by RefTeX.
Intended for files which contain only `@string' macro definitions and the
like, which are ignored by RefTeX anyway."
:group 'reftex-citation-support
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type '(repeat (regexp)))
(defcustom reftex-default-bibliography nil
@@ -1318,7 +1314,7 @@ macro before insertion. For example, it will change
\\cite[][Chapter 1]{Jones} -> \\cite[Chapter 1]{Jones}
\\cite[see][]{Jones} -> \\cite[see][]{Jones}
\\cite[see][Chapter 1]{Jones} -> \\cite{Jones}
-Is is possible that other packages have other conventions about which
+It is possible that other packages have other conventions about which
optional argument is interpreted how - that is why this cleaning up
can be turned off."
:group 'reftex-citation-support
@@ -1460,7 +1456,7 @@ Note that AUCTeX sets these things internally for RefTeX as well, so
with a sufficiently new version of AUCTeX, you should not set the
package here."
:group 'reftex-index-support
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type `(list
(repeat
:inline t
@@ -1728,7 +1724,7 @@ Multiple directories can be separated by the system dependent `path-separator'.
Directories ending in `//' or `!!' will be expanded recursively.
See also `reftex-use-external-file-finders'."
:group 'reftex-finding-files
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type '(repeat (string :tag "Specification")))
(defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB")
@@ -1744,7 +1740,7 @@ Directories ending in `//' or `!!' will be expanded recursively.
See also `reftex-use-external-file-finders'."
:group 'reftex-citation-support
:group 'reftex-finding-files
- :set 'reftex-set-dirty
+ :set #'reftex-set-dirty
:type '(repeat (string :tag "Specification")))
(defcustom reftex-file-extensions '(("tex" . (".tex" ".ltx"))
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index be9b23677cb..1cb2cf40c3b 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1,4 +1,4 @@
-;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
+;;; 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>
@@ -38,9 +38,8 @@
;;
;; https://www.gnu.org/software/auctex/manual/reftex.index.html
;;
-;; RefTeX is bundled with Emacs and available as a plug-in package for
-;; XEmacs 21.x. If you need to install it yourself, you can find a
-;; distribution at
+;; RefTeX is bundled with Emacs.
+;; If you need to install it yourself, you can find a distribution at
;;
;; https://www.gnu.org/software/auctex/reftex.html
;;
@@ -51,7 +50,8 @@
;;; Code:
(eval-when-compile (require 'cl-lib))
-(require 'easymenu)
+(when (< emacs-major-version 28) ; preloaded in Emacs 28
+ (require 'easymenu))
(defvar reftex-tables-dirty t
"Flag showing if tables need to be re-computed.")
@@ -99,37 +99,34 @@
(defvar reftex-mode-map
(let ((map (make-sparse-keymap)))
;; The default bindings in the mode map.
- (define-key map "\C-c=" 'reftex-toc)
- (define-key map "\C-c-" 'reftex-toc-recenter)
- (define-key map "\C-c(" 'reftex-label)
- (define-key map "\C-c)" 'reftex-reference)
- (define-key map "\C-c[" 'reftex-citation)
- (define-key map "\C-c<" 'reftex-index)
- (define-key map "\C-c>" 'reftex-display-index)
- (define-key map "\C-c/" 'reftex-index-selection-or-word)
- (define-key map "\C-c\\" 'reftex-index-phrase-selection-or-word)
- (define-key map "\C-c|" 'reftex-index-visit-phrases-buffer)
- (define-key map "\C-c&" 'reftex-view-crossref)
+ (define-key map "\C-c=" #'reftex-toc)
+ (define-key map "\C-c-" #'reftex-toc-recenter)
+ (define-key map "\C-c(" #'reftex-label)
+ (define-key map "\C-c)" #'reftex-reference)
+ (define-key map "\C-c[" #'reftex-citation)
+ (define-key map "\C-c<" #'reftex-index)
+ (define-key map "\C-c>" #'reftex-display-index)
+ (define-key map "\C-c/" #'reftex-index-selection-or-word)
+ (define-key map "\C-c\\" #'reftex-index-phrase-selection-or-word)
+ (define-key map "\C-c|" #'reftex-index-visit-phrases-buffer)
+ (define-key map "\C-c&" #'reftex-view-crossref)
;; Bind `reftex-mouse-view-crossref' only when the key is still free
- (if (featurep 'xemacs)
- (unless (key-binding [(shift button2)])
- (define-key map [(shift button2)] 'reftex-mouse-view-crossref))
- (unless (key-binding [(shift mouse-2)])
- (define-key map [(shift mouse-2)] 'reftex-mouse-view-crossref)))
+ (unless (key-binding [(shift mouse-2)])
+ (define-key map [(shift mouse-2)] #'reftex-mouse-view-crossref))
;; For most of these commands there are already bindings in place.
;; Setting `reftex-extra-bindings' really is only there to spare users
;; the hassle of defining bindings in the user space themselves. This
;; is why they violate the key binding recommendations.
(when reftex-extra-bindings
- (define-key map "\C-ct" 'reftex-toc)
- (define-key map "\C-cl" 'reftex-label)
- (define-key map "\C-cr" 'reftex-reference)
- (define-key map "\C-cc" 'reftex-citation)
- (define-key map "\C-cv" 'reftex-view-crossref)
- (define-key map "\C-cg" 'reftex-grep-document)
- (define-key map "\C-cs" 'reftex-search-document))
+ (define-key map "\C-ct" #'reftex-toc)
+ (define-key map "\C-cl" #'reftex-label)
+ (define-key map "\C-cr" #'reftex-reference)
+ (define-key map "\C-cc" #'reftex-citation)
+ (define-key map "\C-cv" #'reftex-view-crossref)
+ (define-key map "\C-cg" #'reftex-grep-document)
+ (define-key map "\C-cs" #'reftex-search-document))
map)
"Keymap for RefTeX mode.")
@@ -203,8 +200,6 @@ on the menu bar.
(if reftex-mode
(progn
;; Mode was turned on
- (when (featurep 'xemacs)
- (easy-menu-add reftex-mode-menu))
(and reftex-plug-into-AUCTeX
(reftex-plug-into-AUCTeX))
(unless (get 'reftex-auto-view-crossref 'initialized)
@@ -219,10 +214,7 @@ on the menu bar.
;; Prepare the special syntax tables.
(reftex--prepare-syntax-tables)
- (run-hooks 'reftex-mode-hook))
- ;; Mode was turned off
- (when (featurep 'xemacs)
- (easy-menu-remove reftex-mode-menu))))
+ (run-hooks 'reftex-mode-hook))))
(defvar reftex-docstruct-symbol)
(defun reftex-kill-buffer-hook ()
@@ -390,11 +382,11 @@ If the symbols for the current master file do not exist, they are created."
((null master)
(error "Need a filename for this buffer, please save it first"))
((or (file-exists-p (concat master ".tex"))
- (reftex-get-buffer-visiting (concat master ".tex")))
+ (find-buffer-visiting (concat master ".tex")))
;; Ahh, an extra .tex was missing...
(setq master (concat master ".tex")))
((or (file-exists-p master)
- (reftex-get-buffer-visiting master))
+ (find-buffer-visiting master))
;; We either see the file, or have a buffer on it. OK.
)
(t
@@ -821,7 +813,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)))
@@ -889,7 +881,7 @@ This enforces rescanning the buffer on next use."
;; Are the magic words regular expressions? Quote normal words.
(if (eq (car wordlist) 'regexp)
(setq wordlist (cdr wordlist))
- (setq wordlist (mapcar 'regexp-quote wordlist)))
+ (setq wordlist (mapcar #'regexp-quote wordlist)))
;; Remember the first association of each word.
(while (stringp (setq word (pop wordlist)))
(or (assoc word reftex-words-to-typekey-alist)
@@ -1016,11 +1008,11 @@ This enforces rescanning the buffer on next use."
(wbol "\\(^\\)%?[ \t]*") ; Need to keep the empty group because
; match numbers are hard coded
(label-re (concat "\\(?:"
- (mapconcat 'identity reftex-label-regexps "\\|")
+ (mapconcat #'identity reftex-label-regexps "\\|")
"\\)"))
(include-re (concat wbol
"\\\\\\("
- (mapconcat 'identity
+ (mapconcat #'identity
reftex-include-file-commands "\\|")
"\\)[{ \t]+\\([^} \t\n\r]+\\)"))
(section-re
@@ -1032,23 +1024,24 @@ This enforces rescanning the buffer on next use."
(macro-re
(if macros-with-labels
(concat "\\("
- (mapconcat 'regexp-quote macros-with-labels "\\|")
+ (mapconcat #'regexp-quote macros-with-labels "\\|")
"\\)[[{]")
""))
(index-re
(concat "\\("
- (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
+ (mapconcat #'regexp-quote reftex-macros-with-index "\\|")
"\\)[[{]"))
(find-index-re-format
(concat "\\("
- (mapconcat 'regexp-quote reftex-macros-with-index "\\|")
+ (mapconcat #'regexp-quote reftex-macros-with-index "\\|")
"\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
(find-label-re-format
(concat "\\("
"label[[:space:]]*=[[:space:]]*"
"\\|"
- (mapconcat 'regexp-quote (append '("\\label")
- macros-with-labels) "\\|")
+ (mapconcat #'regexp-quote (append '("\\label")
+ macros-with-labels)
+ "\\|")
"\\)\\([[{][^]}]*[]}]\\)*[[{]\\(%s\\)[]}]"))
(index-level-re
(regexp-quote (nth 0 reftex-index-special-chars)))
@@ -1080,7 +1073,7 @@ This enforces rescanning the buffer on next use."
"\\([]} \t\n\r]\\)\\([[{]\\)\\(%s\\)[]}]")
(message "Compiling label environment definitions...done")))
(put reftex-docstruct-symbol 'reftex-cache
- (mapcar 'symbol-value reftex-cache-variables)))
+ (mapcar #'symbol-value reftex-cache-variables)))
(defun reftex-parse-args (macro)
;; Return a list of macro name, nargs, arg-nr which is label and a list of
@@ -1276,8 +1269,8 @@ Valid actions are: readable, restore, read, kill, write."
(- 1 xr-index))
(t
(save-excursion
- (let* ((length (apply 'max (mapcar
- (lambda(x) (length (car x))) xr-alist)))
+ (let* ((length (apply #'max (mapcar
+ (lambda(x) (length (car x))) xr-alist)))
(fmt (format " [%%c] %%-%ds %%s\n" length))
(n (1- ?0)))
(setq key
@@ -1311,7 +1304,7 @@ When DIE is non-nil, throw an error if file not found."
(extensions (cdr (assoc type reftex-file-extensions)))
(def-ext (car extensions))
(ext-re (concat "\\("
- (mapconcat 'regexp-quote extensions "\\|")
+ (mapconcat #'regexp-quote extensions "\\|")
"\\)\\'"))
(files (if (string-match ext-re file)
(cons file nil)
@@ -1353,7 +1346,7 @@ When DIE is non-nil, throw an error if file not found."
out)
(if (string-match "%f" prg)
(setq prg (replace-match file t t prg)))
- (setq out (apply 'reftex-process-string (split-string prg)))
+ (setq out (apply #'reftex-process-string (split-string prg)))
(if (string-match "[ \t\n]+\\'" out) ; chomp
(setq out (replace-match "" nil nil out)))
(cond ((equal out "") nil)
@@ -1366,7 +1359,7 @@ When DIE is non-nil, throw an error if file not found."
(with-output-to-string
(with-current-buffer standard-output
(let ((default-directory calling-dir)) ; set default directory
- (apply 'call-process program nil '(t nil) nil args))))))
+ (apply #'call-process program nil '(t nil) nil args))))))
(defun reftex-access-search-path (type &optional recurse master-dir file)
;; Access path from environment variables. TYPE is either "tex" or "bib".
@@ -1385,7 +1378,7 @@ When DIE is non-nil, throw an error if file not found."
(mapconcat
(lambda(x)
(if (string-match "^!" x)
- (apply 'reftex-process-string
+ (apply #'reftex-process-string
(split-string (substring x 1)))
(or (getenv x) x)))
;; For consistency, the next line should look like this:
@@ -1530,12 +1523,7 @@ When DIE is non-nil, throw an error if file not found."
(when (match-beginning n)
(buffer-substring-no-properties (match-beginning n) (match-end n))))
-(defun reftex-region-active-p ()
- "Should we operate on an active region?"
- (if (fboundp 'use-region-p)
- (use-region-p)
- ;; For XEmacs.
- (region-active-p)))
+(define-obsolete-function-alias 'reftex-region-active-p #'use-region-p "28.1")
(defun reftex-kill-buffer (buffer)
;; Kill buffer if it exists.
@@ -1744,26 +1732,12 @@ When DIE is non-nil, throw an error if file not found."
(setq string (replace-match "[\n\r]" nil t string)))
string))
-(defun reftex-get-buffer-visiting (file)
- ;; return a buffer visiting FILE
- (cond
- ((boundp 'find-file-compare-truenames) ; XEmacs
- (let ((find-file-compare-truenames t))
- (get-file-buffer file)))
- ((fboundp 'find-buffer-visiting) ; Emacs
- (find-buffer-visiting file))
- (t (error "This should not happen (reftex-get-buffer-visiting)"))))
-
-;; Define `current-message' for compatibility with XEmacs prior to 20.4
-(defvar message-stack)
-(if (and (featurep 'xemacs)
- (not (fboundp 'current-message)))
- (defun current-message (&optional _frame)
- (cdr (car message-stack))))
+(define-obsolete-function-alias 'reftex-get-buffer-visiting
+ #'find-buffer-visiting "28.1")
(defun reftex-visited-files (list)
;; Takes a list of filenames and returns the buffers of those already visited
- (delq nil (mapcar (lambda (x) (if (reftex-get-buffer-visiting x) x nil))
+ (delq nil (mapcar (lambda (x) (if (find-buffer-visiting x) x nil))
list)))
(defun reftex-get-file-buffer-force (file &optional mark-to-kill)
@@ -1773,7 +1747,7 @@ When DIE is non-nil, throw an error if file not found."
;; initializations according to `reftex-initialize-temporary-buffers',
;; and mark the buffer to be killed after use.
- (let ((buf (reftex-get-buffer-visiting file)))
+ (let ((buf (find-buffer-visiting file)))
(cond (buf
;; We have it already as a buffer - just return it
@@ -1865,7 +1839,7 @@ When DIE is non-nil, throw an error if file not found."
(setq list (copy-sequence list))
(if sort
(progn
- (setq list (sort list 'string<))
+ (setq list (sort list #'string<))
(let ((p list))
(while (cdr p)
(if (string= (car p) (car (cdr p)))
@@ -2002,7 +1976,7 @@ IGNORE-WORDS List of words which should be removed from the string."
(setcdr (nthcdr (1- nwords) words) nil))
;; First, try to use all words
- (setq string (mapconcat 'identity words sep))
+ (setq string (mapconcat #'identity words sep))
;; Abbreviate words if enforced by user settings or string length
(if (or (eq t abbrev)
@@ -2016,7 +1990,7 @@ IGNORE-WORDS List of words which should be removed from the string."
(match-string 1 w))
w))
words)
- string (mapconcat 'identity words sep)))
+ string (mapconcat #'identity words sep)))
;; Shorten if still to long
(setq string
@@ -2080,24 +2054,11 @@ IGNORE-WORDS List of words which should be removed from the string."
(progn
;; Rename buffer temporarily to start w/o space (because of font-lock)
(rename-buffer newname t)
- (cond
- ((fboundp 'font-lock-default-fontify-region)
- ;; Good: we have the indirection functions
- (set (make-local-variable 'font-lock-fontify-region-function)
- 'reftex-select-font-lock-fontify-region)
- (let ((major-mode 'latex-mode))
- (font-lock-mode 1)))
- ((fboundp 'font-lock-set-defaults-1)
- ;; Looks like the XEmacs font-lock stuff.
- ;; FIXME: this is still kind of a hack, but it works.
- (set (make-local-variable 'font-lock-keywords) nil)
- (let ((major-mode 'latex-mode)
- (font-lock-defaults-computed nil))
- (font-lock-set-defaults-1)
- (reftex-select-font-lock-fontify-region (point-min) (point-max))))
- (t
- ;; Oops?
- (message "Sorry: cannot refontify RefTeX Select buffer."))))
+ ;; Good: we have the indirection functions
+ (set (make-local-variable 'font-lock-fontify-region-function)
+ #'reftex-select-font-lock-fontify-region)
+ (let ((major-mode 'latex-mode))
+ (font-lock-mode 1)))
(rename-buffer oldname))))
(defun reftex-select-font-lock-fontify-region (beg end &optional _loudly)
@@ -2122,46 +2083,39 @@ IGNORE-WORDS List of words which should be removed from the string."
(let (face)
(catch 'exit
(while (setq face (pop faces))
- (if (featurep 'xemacs)
- (if (find-face face) (throw 'exit face))
- (if (facep face) (throw 'exit face)))))))
-
-;; Highlighting uses overlays. For XEmacs, we use extends.
-(defalias 'reftex-make-overlay
- (if (featurep 'xemacs) 'make-extent 'make-overlay))
-(defalias 'reftex-overlay-put
- (if (featurep 'xemacs) 'set-extent-property 'overlay-put))
-(defalias 'reftex-move-overlay
- (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay))
-(defalias 'reftex-delete-overlay
- (if (featurep 'xemacs) 'detach-extent 'delete-overlay))
+ (if (facep face) (throw 'exit face))))))
+
+(define-obsolete-function-alias 'reftex-make-overlay #'make-overlay "28.1")
+(define-obsolete-function-alias 'reftex-overlay-put #'overlay-put "28.1")
+(define-obsolete-function-alias 'reftex-move-overlay #'move-overlay "28.1")
+(define-obsolete-function-alias 'reftex-delete-overlay #'delete-overlay "28.1")
;; We keep a vector with several different overlays to do our highlighting.
(defvar reftex-highlight-overlays [nil nil nil])
;; Initialize the overlays
-(aset reftex-highlight-overlays 0 (reftex-make-overlay 1 1))
-(reftex-overlay-put (aref reftex-highlight-overlays 0)
+(aset reftex-highlight-overlays 0 (make-overlay 1 1))
+(overlay-put (aref reftex-highlight-overlays 0)
'face 'highlight)
-(aset reftex-highlight-overlays 1 (reftex-make-overlay 1 1))
-(reftex-overlay-put (aref reftex-highlight-overlays 1)
+(aset reftex-highlight-overlays 1 (make-overlay 1 1))
+(overlay-put (aref reftex-highlight-overlays 1)
'face reftex-cursor-selected-face)
-(aset reftex-highlight-overlays 2 (reftex-make-overlay 1 1))
-(reftex-overlay-put (aref reftex-highlight-overlays 2)
+(aset reftex-highlight-overlays 2 (make-overlay 1 1))
+(overlay-put (aref reftex-highlight-overlays 2)
'face reftex-cursor-selected-face)
;; Two functions for activating and deactivation highlight overlays
(defun reftex-highlight (index begin end &optional buffer)
"Highlight a region with overlay INDEX."
- (reftex-move-overlay (aref reftex-highlight-overlays index)
+ (move-overlay (aref reftex-highlight-overlays index)
begin end (or buffer (current-buffer))))
(defun reftex-unhighlight (index)
"Detach overlay INDEX."
- (reftex-delete-overlay (aref reftex-highlight-overlays index)))
+ (delete-overlay (aref reftex-highlight-overlays index)))
(defun reftex-highlight-shall-die ()
;; Function used in pre-command-hook to remove highlights.
- (remove-hook 'pre-command-hook 'reftex-highlight-shall-die)
+ (remove-hook 'pre-command-hook #'reftex-highlight-shall-die)
(reftex-unhighlight 0))
;;; =========================================================================
@@ -2173,7 +2127,7 @@ IGNORE-WORDS List of words which should be removed from the string."
;; Bind `reftex-view-crossref-from-bibtex' in BibTeX mode map
(eval-after-load
"bibtex"
- '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex))
+ '(define-key bibtex-mode-map "\C-c&" #'reftex-view-crossref-from-bibtex))
;;; =========================================================================
;;;
@@ -2378,9 +2332,9 @@ Your bug report will be posted to the AUCTeX bug reporting list.
;;; Install the kill-buffer and kill-emacs hooks ------------------------------
-(add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook)
+(add-hook 'kill-buffer-hook #'reftex-kill-buffer-hook)
(unless noninteractive
- (add-hook 'kill-emacs-hook 'reftex-kill-emacs-hook))
+ (add-hook 'kill-emacs-hook #'reftex-kill-emacs-hook))
;;; Run Hook ------------------------------------------------------------------
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index 820ee38d101..fbb66fe40e9 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -1,4 +1,4 @@
-;;; remember --- a mode for quickly jotting down things to remember
+;;; remember.el --- a mode for quickly jotting down things to remember -*- lexical-binding: t; -*-
;; Copyright (C) 1999-2001, 2003-2021 Free Software Foundation, Inc.
@@ -176,14 +176,8 @@
;;
;; 2003.08.12 Sacha's birthday
-;;; History:
-
;;; Code:
-(defconst remember-version "2.0"
- "This version of remember.")
-(make-obsolete-variable 'remember-version nil "28.1")
-
(defgroup remember nil
"A mode to remember information."
:group 'data)
@@ -193,24 +187,20 @@
(defcustom remember-mode-hook nil
"Functions run upon entering `remember-mode'."
:type 'hook
- :options '(flyspell-mode turn-on-auto-fill org-remember-apply-template)
- :group 'remember)
+ :options '(flyspell-mode turn-on-auto-fill org-remember-apply-template))
(defcustom remember-in-new-frame nil
"Non-nil means use a separate frame for capturing remember data."
- :type 'boolean
- :group 'remember)
+ :type 'boolean)
(defcustom remember-register ?R
"The register in which the window configuration is stored."
- :type 'character
- :group 'remember)
+ :type 'character)
(defcustom remember-filter-functions nil
"Functions run to filter remember data.
All functions are run in the remember buffer."
- :type 'hook
- :group 'remember)
+ :type 'hook)
(defcustom remember-handler-functions '(remember-append-to-file)
"Functions run to process remember data.
@@ -223,54 +213,50 @@ recorded somewhere by that function."
remember-append-to-file
remember-store-in-files
remember-diary-extract-entries
- org-remember-handler)
- :group 'remember)
+ org-remember-handler))
(defcustom remember-all-handler-functions nil
"If non-nil every function in `remember-handler-functions' is called."
- :type 'boolean
- :group 'remember)
+ :type 'boolean)
;; See below for more user variables.
;;; Internal Variables:
-(defvar remember-buffer "*Remember*"
- "The name of the remember data entry buffer.")
+(defcustom remember-buffer "*Remember*"
+ "The name of the remember data entry buffer."
+ :version "28.1"
+ :type 'string)
(defcustom remember-save-after-remembering t
"Non-nil means automatically save after remembering."
- :type 'boolean
- :group 'remember)
+ :type 'boolean)
;;; User Functions:
(defcustom remember-annotation-functions '(buffer-file-name)
"Hook that returns an annotation to be inserted into the remember buffer."
:type 'hook
- :options '(org-remember-annotation buffer-file-name)
- :group 'remember)
+ :options '(org-remember-annotation buffer-file-name))
(defvar remember-annotation nil
"Current annotation.")
(defvar remember-initial-contents nil
- "Initial contents to place into *Remember* buffer.")
+ "Initial contents to place into `remember-buffer'.")
(defcustom remember-before-remember-hook nil
- "Functions run before switching to the *Remember* buffer."
- :type 'hook
- :group 'remember)
+ "Functions run before switching to the `remember-buffer'."
+ :type 'hook)
(defcustom remember-run-all-annotation-functions-flag nil
"Non-nil means use all annotations returned by `remember-annotation-functions'."
- :type 'boolean
- :group 'remember)
+ :type 'boolean)
;;;###autoload
(defun remember (&optional initial)
"Remember an arbitrary piece of data.
-INITIAL is the text to initially place in the *Remember* buffer,
-or nil to bring up a blank *Remember* buffer.
+INITIAL is the text to initially place in the `remember-buffer',
+or nil to bring up a blank `remember-buffer'.
With a prefix or a visible region, use the region as INITIAL."
(interactive
@@ -280,12 +266,13 @@ With a prefix or a visible region, use the region as INITIAL."
(buffer-substring (region-beginning) (region-end)))))
(funcall (if remember-in-new-frame
#'frameset-to-register
- #'window-configuration-to-register) remember-register)
+ #'window-configuration-to-register)
+ remember-register)
(let* ((annotation
(if remember-run-all-annotation-functions-flag
- (mapconcat 'identity
+ (mapconcat #'identity
(delq nil
- (mapcar 'funcall remember-annotation-functions))
+ (mapcar #'funcall remember-annotation-functions))
"\n")
(run-hook-with-args-until-success
'remember-annotation-functions)))
@@ -293,7 +280,8 @@ With a prefix or a visible region, use the region as INITIAL."
(run-hooks 'remember-before-remember-hook)
(funcall (if remember-in-new-frame
#'switch-to-buffer-other-frame
- #'switch-to-buffer-other-window) buf)
+ #'switch-to-buffer-other-window)
+ buf)
(if remember-in-new-frame
(set-window-dedicated-p
(get-buffer-window (current-buffer) (selected-frame)) t))
@@ -337,13 +325,11 @@ With a prefix or a visible region, use the region as INITIAL."
(defcustom remember-mailbox "~/Mail/remember"
"The file in which to store remember data as mail."
- :type 'file
- :group 'remember)
+ :type 'file)
(defcustom remember-default-priority "medium"
"The default priority for remembered mail messages."
- :type 'string
- :group 'remember)
+ :type 'string)
(defun remember-store-in-mailbox ()
"Store remember data as if it were incoming mail.
@@ -396,19 +382,16 @@ exists) might be changed."
(with-current-buffer buf
(set-visited-file-name
(expand-file-name remember-data-file))))))
- :initialize 'custom-initialize-default
- :group 'remember)
+ :initialize #'custom-initialize-default)
(defcustom remember-leader-text "** "
"The text used to begin each remember item."
- :type 'string
- :group 'remember)
+ :type 'string)
(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")
(defcustom remember-text-format-function nil
@@ -416,7 +399,6 @@ The default emulates `current-time-string' for backward compatibility."
The function receives the remembered text as argument and should
return the text to be remembered."
:type '(choice (const nil) function)
- :group 'remember
:version "28.1")
(defun remember-append-to-file ()
@@ -442,7 +424,7 @@ return the text to be remembered."
(defun remember-region (&optional beg end)
"Remember the data from BEG to END.
-It is called from within the *Remember* buffer to save the text
+It is called from within the `remember-buffer' to save the text
that was entered.
If BEG and END are nil, the entire buffer will be remembered.
@@ -465,16 +447,14 @@ If you want to remember a region, supply a universal prefix to
"The directory in which to store remember data as files.
Used by `remember-store-in-files'."
:type 'directory
- :version "24.4"
- :group 'remember)
+ :version "24.4")
(defcustom remember-directory-file-name-format "%Y-%m-%d_%T-%z"
"Format string for the file name in which to store unprocessed data.
This is passed to `format-time-string'.
Used by `remember-store-in-files'."
:type 'string
- :version "24.4"
- :group 'remember)
+ :version "24.4")
(defun remember-store-in-files ()
"Store remember data in a file in `remember-data-directory'.
@@ -500,7 +480,7 @@ Most useful for remembering things from other applications."
(remember-region (point-min) (point-max)))
(defun remember-destroy ()
- "Destroy the current *Remember* buffer."
+ "Destroy the current `remember-buffer'."
(interactive)
(when (equal remember-buffer (buffer-name))
(kill-buffer (current-buffer))
@@ -511,8 +491,7 @@ Most useful for remembering things from other applications."
(defcustom remember-diary-file nil
"File for extracted diary entries.
If this is nil, then `diary-file' will be used instead."
- :type '(choice (const :tag "diary-file" nil) file)
- :group 'remember)
+ :type '(choice (const :tag "diary-file" nil) file))
(defvar calendar-date-style) ; calendar.el
@@ -560,7 +539,7 @@ If this is nil, then `diary-file' will be used instead."
(while (re-search-forward remember-diary-regexp nil t)
(push (remember-diary-convert-entry (match-string 1)) list))
(when list
- (diary-make-entry (mapconcat 'identity list "\n")
+ (diary-make-entry (mapconcat #'identity list "\n")
nil remember-diary-file)
(when remember-save-after-remembering
(with-current-buffer (find-buffer-visiting (or remember-diary-file
@@ -572,9 +551,9 @@ If this is nil, then `diary-file' will be used instead."
(defvar remember-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-x\C-s" 'remember-finalize)
- (define-key map "\C-c\C-c" 'remember-finalize)
- (define-key map "\C-c\C-k" 'remember-destroy)
+ (define-key map "\C-x\C-s" #'remember-finalize)
+ (define-key map "\C-c\C-c" #'remember-finalize)
+ (define-key map "\C-c\C-k" #'remember-destroy)
map)
"Keymap used in `remember-mode'.")
@@ -620,7 +599,7 @@ If this is nil, use `initial-major-mode'."
(defvar remember-notes-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-c" 'remember-notes-save-and-bury-buffer)
+ (define-key map "\C-c\C-c" #'remember-notes-save-and-bury-buffer)
map)
"Keymap used in `remember-notes-mode'.")
@@ -630,7 +609,7 @@ This sets `buffer-save-without-query' so that `save-some-buffers' will
save the notes buffer without asking.
\\{remember-notes-mode-map}"
- nil nil nil
+ :lighter nil
(cond
(remember-notes-mode
(add-hook 'kill-buffer-query-functions
@@ -690,6 +669,11 @@ is non-nil, bury it and return nil; otherwise return t."
nil)
t))
+;; Obsolete
+
+(defconst remember-version "2.0" "This version of remember.")
+(make-obsolete-variable 'remember-version 'emacs-version "28.1")
+
(provide 'remember)
;;; remember.el ends here
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 2b31e7ed612..1471be0ecd6 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -105,10 +105,6 @@
;; Common Lisp stuff
(require 'cl-lib)
-;; Correct wrong declaration.
-(def-edebug-spec push
- (&or [form symbolp] [form gv-place]))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Support for `testcover'
@@ -558,30 +554,30 @@ After interpretation of ARGS the results are concatenated as for
`:seq'."
(apply #'concat
(mapcar
- #'(lambda (re)
- (cond
- ((stringp re)
- re)
- ((symbolp re)
- (cadr (assoc re rst-re-alist)))
- ((characterp re)
- (regexp-quote (char-to-string re)))
- ((listp re)
- (let ((nested
- (mapcar #'rst-re (cdr re))))
- (cond
- ((eq (car re) :seq)
- (mapconcat #'identity nested ""))
- ((eq (car re) :shy)
- (concat "\\(?:" (mapconcat #'identity nested "") "\\)"))
- ((eq (car re) :grp)
- (concat "\\(" (mapconcat #'identity nested "") "\\)"))
- ((eq (car re) :alt)
- (concat "\\(?:" (mapconcat #'identity nested "\\|") "\\)"))
- (t
- (error "Unknown list car: %s" (car re))))))
- (t
- (error "Unknown object type for building regex: %s" re))))
+ (lambda (re)
+ (cond
+ ((stringp re)
+ re)
+ ((symbolp re)
+ (cadr (assoc re rst-re-alist)))
+ ((characterp re)
+ (regexp-quote (char-to-string re)))
+ ((listp re)
+ (let ((nested
+ (mapcar #'rst-re (cdr re))))
+ (cond
+ ((eq (car re) :seq)
+ (mapconcat #'identity nested ""))
+ ((eq (car re) :shy)
+ (concat "\\(?:" (mapconcat #'identity nested "") "\\)"))
+ ((eq (car re) :grp)
+ (concat "\\(" (mapconcat #'identity nested "") "\\)"))
+ ((eq (car re) :alt)
+ (concat "\\(?:" (mapconcat #'identity nested "\\|") "\\)"))
+ (t
+ (error "Unknown list car: %s" (car re))))))
+ (t
+ (error "Unknown object type for building regex: %s" re))))
args)))
;; FIXME: Remove circular dependency between `rst-re' and `rst-re-alist'.
@@ -620,7 +616,7 @@ After interpretation of ARGS the results are concatenated as for
(:constructor
rst-Ado-new-transition
(&aux
- (char nil)
+ ;; (char nil)
(-style 'transition)))
;; Construct a simple section header.
(:constructor
@@ -713,8 +709,8 @@ Return CHAR if so or signal an error otherwise."
;; testcover: ok.
"Return position of SELF in ADOS or nil."
(cl-check-type self rst-Ado)
- (cl-position-if #'(lambda (e)
- (rst-Ado-equal self e))
+ (cl-position-if (lambda (e)
+ (rst-Ado-equal self e))
ados))
@@ -818,8 +814,8 @@ Return ADO if so or signal an error otherwise."
"Return sublist of HDRS whose car's adornment equals that of SELF or nil."
(cl-check-type self rst-Hdr)
(let ((ado (rst-Hdr-ado self)))
- (cl-member-if #'(lambda (hdr)
- (rst-Ado-equal ado (rst-Hdr-ado hdr)))
+ (cl-member-if (lambda (hdr)
+ (rst-Ado-equal ado (rst-Hdr-ado hdr)))
hdrs)))
(defun rst-Hdr-ado-map (selves)
@@ -1281,8 +1277,8 @@ This inherits from Text mode.")
;; Abbrevs.
(define-abbrev-table 'rst-mode-abbrev-table
- (mapcar #'(lambda (x)
- (append x '(nil 0 system)))
+ (mapcar (lambda (x)
+ (append x '(nil 0 system)))
'(("contents" ".. contents::\n..\n ")
("con" ".. contents::\n..\n ")
("cont" "[...]")
@@ -1412,13 +1408,11 @@ highlighting.
When ReST minor mode is enabled, the ReST mode keybindings
are installed on top of the major mode bindings. Use this
for modes derived from Text mode, like Mail mode."
- ;; The initial value.
- nil
- ;; The indicator for the mode line.
- " ReST"
- ;; The minor mode bindings.
- rst-mode-map
- :group 'rst)
+ ;; The indicator for the mode line.
+ :lighter " ReST"
+ ;; The minor mode bindings.
+ :keymap rst-mode-map
+ :group 'rst)
;; FIXME: can I somehow install these too?
;; :abbrev-table rst-mode-abbrev-table
@@ -1505,9 +1499,9 @@ file."
:type `(repeat
(group :tag "Adornment specification"
(choice :tag "Adornment character"
- ,@(mapcar #'(lambda (char)
- (list 'const
- :tag (char-to-string char) char))
+ ,@(mapcar (lambda (char)
+ (list 'const
+ :tag (char-to-string char) char))
rst-adornment-chars))
(radio :tag "Adornment type"
(const :tag "Overline and underline" over-and-under)
@@ -1544,8 +1538,8 @@ search starts after this entry. Return nil if no new preferred
;; Start searching after the level of the previous adornment.
(cdr (rst-Hdr-member-ado prev (rst-Hdr-preferred-adornments))))
(rst-Hdr-preferred-adornments))))
- (cl-find-if #'(lambda (cand)
- (not (rst-Hdr-member-ado cand seen)))
+ (cl-find-if (lambda (cand)
+ (not (rst-Hdr-member-ado cand seen)))
candidates)))
(defun rst-update-section (hdr)
@@ -1624,55 +1618,55 @@ returned."
(ttl-blw ; Title found below starting here.
(rst-forward-line-looking-at
+1 'ttl-beg-1
- #'(lambda (mtcd)
- (when mtcd
- (setq txt-blw (match-string-no-properties 1))
- (point)))))
+ (lambda (mtcd)
+ (when mtcd
+ (setq txt-blw (match-string-no-properties 1))
+ (point)))))
txt-abv
(ttl-abv ; Title found above starting here.
(rst-forward-line-looking-at
-1 'ttl-beg-1
- #'(lambda (mtcd)
- (when mtcd
- (setq txt-abv (match-string-no-properties 1))
- (point)))))
+ (lambda (mtcd)
+ (when mtcd
+ (setq txt-abv (match-string-no-properties 1))
+ (point)))))
(und-fnd ; Matching underline found starting here.
(and ttl-blw
(rst-forward-line-looking-at
+2 (list ado-re 'lin-end)
- #'(lambda (mtcd)
- (when mtcd
- (point))))))
+ (lambda (mtcd)
+ (when mtcd
+ (point))))))
(ovr-fnd ; Matching overline found starting here.
(and ttl-abv
(rst-forward-line-looking-at
-2 (list ado-re 'lin-end)
- #'(lambda (mtcd)
- (when mtcd
- (point))))))
+ (lambda (mtcd)
+ (when mtcd
+ (point))))))
(und-wng ; Wrong underline found starting here.
(and ttl-blw
(not und-fnd)
(rst-forward-line-looking-at
+2 'ado-beg-2-1
- #'(lambda (mtcd)
- (when mtcd
- (point))))))
+ (lambda (mtcd)
+ (when mtcd
+ (point))))))
(ovr-wng ; Wrong overline found starting here.
(and ttl-abv (not ovr-fnd)
(rst-forward-line-looking-at
-2 'ado-beg-2-1
- #'(lambda (mtcd)
- (when (and
- mtcd
- ;; An adornment above may be a legal
- ;; adornment for the line above - consider it
- ;; a wrong overline only when it is equally
- ;; long.
- (equal
- (length (match-string-no-properties 1))
- (length adornment)))
- (point)))))))
+ (lambda (mtcd)
+ (when (and
+ mtcd
+ ;; An adornment above may be a legal
+ ;; adornment for the line above - consider it
+ ;; a wrong overline only when it is equally
+ ;; long.
+ (equal
+ (length (match-string-no-properties 1))
+ (length adornment)))
+ (point)))))))
(cond
((and nxt-emp prv-emp)
;; A transition.
@@ -1712,11 +1706,11 @@ a section header or nil if no title line is found."
(rst-forward-line-strict 0))
(let* (cnd-beg ; Beginning of a title candidate.
cnd-txt ; Text of a title candidate.
- (cnd-fun #'(lambda (mtcd) ; Function setting title candidate data.
- (when mtcd
- (setq cnd-beg (match-beginning 0))
- (setq cnd-txt (match-string-no-properties 1))
- t)))
+ (cnd-fun (lambda (mtcd) ; Function setting title candidate data.
+ (when mtcd
+ (setq cnd-beg (match-beginning 0))
+ (setq cnd-txt (match-string-no-properties 1))
+ t)))
ttl)
(cond
((looking-at (rst-re 'ado-beg-2-1))
@@ -1732,10 +1726,10 @@ a section header or nil if no title line is found."
;; Title line found - check for a following underline.
(setq ttl (rst-forward-line-looking-at
1 'ado-beg-2-1
- #'(lambda (mtcd)
- (when mtcd
- (rst-classify-adornment
- (match-string-no-properties 0) (match-end 0))))))
+ (lambda (mtcd)
+ (when mtcd
+ (rst-classify-adornment
+ (match-string-no-properties 0) (match-end 0))))))
;; Title candidate found if no valid adornment found.
(funcall cnd-fun (not ttl))))
(cond
@@ -1831,15 +1825,15 @@ given."
(ignore-ttl
(if ignore-position
(cl-find-if
- #'(lambda (ttl)
- (equal (rst-Ttl-contains ttl ignore-position) 0))
+ (lambda (ttl)
+ (equal (rst-Ttl-contains ttl ignore-position) 0))
all-ttls)))
(really-ignore
(if ignore-ttl
(<= (cl-count-if
- #'(lambda (ttl)
- (rst-Ado-equal (rst-Ttl-ado ignore-ttl)
- (rst-Ttl-ado ttl)))
+ (lambda (ttl)
+ (rst-Ado-equal (rst-Ttl-ado ignore-ttl)
+ (rst-Ttl-ado ttl)))
all-ttls)
1)))
(real-ttls (delq (if really-ignore ignore-ttl) all-ttls)))
@@ -1863,14 +1857,14 @@ given."
Return a list of (`rst-Ttl' . LEVEL) with ascending line number."
(let ((hier (rst-Hdr-ado-map (rst-hdr-hierarchy))))
(mapcar
- #'(lambda (ttl)
- (cons ttl (rst-Ado-position (rst-Ttl-ado ttl) hier)))
+ (lambda (ttl)
+ (cons ttl (rst-Ado-position (rst-Ttl-ado ttl) hier)))
(rst-all-ttls))))
(defun rst-get-previous-hdr ()
"Return the `rst-Hdr' before point or nil if none."
- (let ((prev (cl-find-if #'(lambda (ttl)
- (< (rst-Ttl-contains ttl (point)) 0))
+ (let ((prev (cl-find-if (lambda (ttl)
+ (< (rst-Ttl-contains ttl (point)) 0))
(rst-all-ttls)
:from-end t)))
(and prev (rst-Ttl-hdr prev))))
@@ -2173,19 +2167,19 @@ hierarchy is similar to that used by `rst-adjust-section'."
(let* ((beg (region-beginning))
(end (region-end))
(ttls-reg (cl-remove-if-not
- #'(lambda (ttl)
- (and
- (>= (rst-Ttl-contains ttl beg) 0)
- (< (rst-Ttl-contains ttl end) 0)))
+ (lambda (ttl)
+ (and
+ (>= (rst-Ttl-contains ttl beg) 0)
+ (< (rst-Ttl-contains ttl end) 0)))
(rst-all-ttls))))
(save-excursion
;; Apply modifications.
(rst-destructuring-dolist
((marker &rest hdr
&aux (hier (rst-hdr-hierarchy)))
- (mapcar #'(lambda (ttl)
- (cons (copy-marker (rst-Ttl-get-title-beginning ttl))
- (rst-Ttl-hdr ttl)))
+ (mapcar (lambda (ttl)
+ (cons (copy-marker (rst-Ttl-get-title-beginning ttl))
+ (rst-Ttl-hdr ttl)))
ttls-reg))
(set-marker
(goto-char marker) nil)
@@ -2395,9 +2389,9 @@ also arranged by `rst-insert-list-new-tag'."
"List of favorite bullets."
:group 'rst
:type `(repeat
- (choice ,@(mapcar #'(lambda (char)
- (list 'const
- :tag (char-to-string char) char))
+ (choice ,@(mapcar (lambda (char)
+ (list 'const
+ :tag (char-to-string char) char))
rst-bullets)))
:package-version '(rst . "1.1.0"))
@@ -2521,13 +2515,13 @@ ordered by POINT."
(looking-at (rst-re rst-re-beg)) ; Start found
(not (rst-forward-line-looking-at
-1 'lin-end
- #'(lambda (mtcd) ; Previous line exists and is...
- (and
- (not mtcd) ; non-empty,
- (<= (current-indentation) clm) ; less indented
- (not (and (= (current-indentation) clm)
+ (lambda (mtcd) ; Previous line exists and is...
+ (and
+ (not mtcd) ; non-empty,
+ (<= (current-indentation) clm) ; less indented
+ (not (and (= (current-indentation) clm)
; not a beg at same level.
- (looking-at (rst-re rst-re-beg)))))))))
+ (looking-at (rst-re rst-re-beg)))))))))
(back-to-indentation)
(push (cons (point) clm) r)))
(1value ; At least one line is moved in this loop.
@@ -2557,8 +2551,8 @@ modified."
((bullet _clm &rest pnts)
;; Zip preferred bullets and sorted columns associating a bullet
;; with a column and all the points this column is found.
- (cl-mapcar #'(lambda (bullet clm2pnt)
- (cons bullet clm2pnt))
+ (cl-mapcar (lambda (bullet clm2pnt)
+ (cons bullet clm2pnt))
rst-preferred-bullets
(sort clm2pnts #'car-less-than-car)))
;; Replace the bullets by the preferred ones.
@@ -2618,8 +2612,8 @@ section headers at all."
(when (>= point (rst-Stn-get-title-beginning stn))
;; Point may be in this section or a child.
(let ((in-child (cl-find-if
- #'(lambda (child)
- (>= point (rst-Stn-get-title-beginning child)))
+ (lambda (child)
+ (>= point (rst-Stn-get-title-beginning child)))
(rst-Stn-children stn)
:from-end t)))
(if in-child
@@ -2833,18 +2827,18 @@ file-write hook to always make it up-to-date automatically."
(and beg
(rst-forward-line-looking-at
1 'lin-end
- #'(lambda (mtcd)
- (unless mtcd
- (rst-apply-indented-blocks
- (point) (point-max) (current-indentation)
- #'(lambda (count _in-first _in-sub in-super in-empty
- _relind)
- (cond
- ((or (> count 1) in-super))
- ((not in-empty)
- (setq fnd (line-end-position))
- nil)))))
- t)))
+ (lambda (mtcd)
+ (unless mtcd
+ (rst-apply-indented-blocks
+ (point) (point-max) (current-indentation)
+ (lambda (count _in-first _in-sub in-super in-empty
+ _relind)
+ (cond
+ ((or (> count 1) in-super))
+ ((not in-empty)
+ (setq fnd (line-end-position))
+ nil)))))
+ t)))
(when fnd
(delete-region beg fnd))
(goto-char beg)
@@ -3028,14 +3022,14 @@ direction."
(contained nil) ; Title contains point (or is after point otherwise).
(found (or (cl-position-if
;; Find a title containing or after point.
- #'(lambda (ttl)
- (let ((cmp (rst-Ttl-contains ttl pnt)))
- (cond
- ((= cmp 0) ; Title contains point.
- (setq contained t)
- t)
- ((> cmp 0) ; Title after point.
- t))))
+ (lambda (ttl)
+ (let ((cmp (rst-Ttl-contains ttl pnt)))
+ (cond
+ ((= cmp 0) ; Title contains point.
+ (setq contained t)
+ t)
+ ((> cmp 0) ; Title after point.
+ t))))
ttls)
;; Point after all titles.
count))
@@ -3294,8 +3288,8 @@ remove all indentation (CNT = 0). A tab is taken from the text
above. If no suitable tab is found `rst-indent-width' is used."
(interactive "r\np")
(let ((tabs (sort (rst-compute-tabs beg)
- #'(lambda (x y)
- (<= x y))))
+ (lambda (x y)
+ (<= x y))))
(leftmostcol (rst-find-leftmost-column beg end)))
(when (or (> leftmostcol 0) (> cnt 0))
;; Apply the indent.
@@ -3310,8 +3304,8 @@ above. If no suitable tab is found `rst-indent-width' is used."
(dir (cl-signum cnt)) ; Direction to take.
(abs (abs cnt)) ; Absolute number of steps to take.
;; Get the position of the first tab beyond leftmostcol.
- (fnd (cl-position-if #'(lambda (elt)
- (funcall cmp elt leftmostcol))
+ (fnd (cl-position-if (lambda (elt)
+ (funcall cmp elt leftmostcol))
tabs))
;; Virtual position of tab.
(pos (+ (or fnd len) (1- abs)))
@@ -3496,20 +3490,20 @@ do all lines instead of just paragraphs."
(indent ""))
(rst-apply-indented-blocks
beg end (rst-find-leftmost-column beg end)
- #'(lambda (count in-first in-sub in-super in-empty _relind)
- (cond
- (in-empty)
- (in-super)
- ((zerop count))
- (in-sub
- (insert indent))
- ((or in-first all)
- (let ((tag (format "%d. " (cl-incf enum))))
- (setq indent (make-string (length tag) ? ))
- (insert tag)))
- (t
- (insert indent)))
- nil))))
+ (lambda (count in-first in-sub in-super in-empty _relind)
+ (cond
+ (in-empty)
+ (in-super)
+ ((zerop count))
+ (in-sub
+ (insert indent))
+ ((or in-first all)
+ (let ((tag (format "%d. " (cl-incf enum))))
+ (setq indent (make-string (length tag) ? ))
+ (insert tag)))
+ (t
+ (insert indent)))
+ nil))))
;; FIXME: Does not deal with deeper indentation - although
;; `rst-apply-indented-blocks' could.
@@ -3524,18 +3518,18 @@ do all lines instead of just paragraphs."
(indent (make-string (length bul) ? )))
(rst-apply-indented-blocks
beg end (rst-find-leftmost-column beg end)
- #'(lambda (count in-first in-sub in-super in-empty _relind)
- (cond
- (in-empty)
- (in-super)
- ((zerop count))
- (in-sub
- (insert indent))
- ((or in-first all)
- (insert bul))
- (t
- (insert indent)))
- nil))))
+ (lambda (count in-first in-sub in-super in-empty _relind)
+ (cond
+ (in-empty)
+ (in-super)
+ ((zerop count))
+ (in-sub
+ (insert indent))
+ ((or in-first all)
+ (insert bul))
+ (t
+ (insert indent)))
+ nil))))
;; FIXME: Does not deal with a varying number of digits appropriately.
;; FIXME: Does not deal with multiple levels independently.
@@ -3565,11 +3559,11 @@ Region is from BEG to END. With WITH-EMPTY prefix empty lines too."
(let ((ind (rst-find-leftmost-column beg end)))
(rst-apply-indented-blocks
beg end ind
- #'(lambda (_count _in-first _in-sub in-super in-empty _relind)
- (when (and (not in-super) (or with-empty (not in-empty)))
- (move-to-column ind t)
- (insert "| "))
- nil))))
+ (lambda (_count _in-first _in-sub in-super in-empty _relind)
+ (when (and (not in-super) (or with-empty (not in-empty)))
+ (move-to-column ind t)
+ (insert "| "))
+ nil))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -4089,16 +4083,16 @@ end of the buffer) return nil and do not move point."
(setq fnd (rst-apply-indented-blocks
(line-beginning-position 2) ; Skip the current line
(or limit (point-max)) (or column (current-column))
- #'(lambda (_count _in-first _in-sub in-super in-empty _relind)
- (cond
- (in-empty
- (setq candidate (or candidate (line-beginning-position)))
- nil)
- (in-super
- (or candidate (line-beginning-position)))
- (t ; Non-empty, same or more indented line.
- (setq candidate nil)
- nil)))))
+ (lambda (_count _in-first _in-sub in-super in-empty _relind)
+ (cond
+ (in-empty
+ (setq candidate (or candidate (line-beginning-position)))
+ nil)
+ (in-super
+ (or candidate (line-beginning-position)))
+ (t ; Non-empty, same or more indented line.
+ (setq candidate nil)
+ nil)))))
(when fnd
(goto-char fnd))))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 7051f520b90..fda00ec367e 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -34,6 +34,7 @@
(require 'dom)
(require 'seq)
+(require 'facemenu)
(eval-when-compile (require 'subr-x))
(eval-when-compile
(require 'skeleton)
@@ -117,8 +118,7 @@ definitions. So we normally turn it off.")
This takes effect when first loading the `sgml-mode' library.")
(defvar sgml-mode-map
- (let ((map (make-keymap)) ;`sparse' doesn't allow binding to charsets.
- (menu-map (make-sparse-keymap "SGML")))
+ (let ((map (make-keymap))) ;`sparse' doesn't allow binding to charsets.
(define-key map "\C-c\C-i" 'sgml-tags-invisible)
(define-key map "/" 'sgml-slash)
(define-key map "\C-c\C-n" 'sgml-name-char)
@@ -153,26 +153,24 @@ This takes effect when first loading the `sgml-mode' library.")
(map (nth 1 map)))
(while (< (setq c (1+ c)) 256)
(aset map c 'sgml-maybe-name-self)))
- (define-key map [menu-bar sgml] (cons "SGML" menu-map))
- (define-key menu-map [sgml-validate] '("Validate" . sgml-validate))
- (define-key menu-map [sgml-name-8bit-mode]
- '("Toggle 8 Bit Insertion" . sgml-name-8bit-mode))
- (define-key menu-map [sgml-tags-invisible]
- '("Toggle Tag Visibility" . sgml-tags-invisible))
- (define-key menu-map [sgml-tag-help]
- '("Describe Tag" . sgml-tag-help))
- (define-key menu-map [sgml-delete-tag]
- '("Delete Tag" . sgml-delete-tag))
- (define-key menu-map [sgml-skip-tag-forward]
- '("Forward Tag" . sgml-skip-tag-forward))
- (define-key menu-map [sgml-skip-tag-backward]
- '("Backward Tag" . sgml-skip-tag-backward))
- (define-key menu-map [sgml-attributes]
- '("Insert Attributes" . sgml-attributes))
- (define-key menu-map [sgml-tag] '("Insert Tag" . sgml-tag))
map)
"Keymap for SGML mode. See also `sgml-specials'.")
+(easy-menu-define sgml-mode-menu sgml-mode-map
+ "Menu for SGML mode."
+ '("SGML"
+ ["Insert Tag" sgml-tag]
+ ["Insert Attributes" sgml-attributes]
+ ["Backward Tag" sgml-skip-tag-backward]
+ ["Forward Tag" sgml-skip-tag-forward]
+ ["Delete Tag" sgml-delete-tag]
+ ["Describe Tag" sgml-tag-help]
+ "---"
+ ["Toggle Tag Visibility" sgml-tags-invisible]
+ ["Toggle 8 Bit Insertion" sgml-name-8bit-mode]
+ "---"
+ ["Validate" sgml-validate]))
+
(defun sgml-make-syntax-table (specials)
(let ((table (make-syntax-table text-mode-syntax-table)))
(modify-syntax-entry ?< "(>" table)
@@ -192,8 +190,19 @@ This takes effect when first loading the `sgml-mode' library.")
"Syntax table used in SGML mode. See also `sgml-specials'.")
(defconst sgml-tag-syntax-table
- (let ((table (sgml-make-syntax-table sgml-specials)))
- (dolist (char '(?\( ?\) ?\{ ?\} ?\[ ?\] ?$ ?% ?& ?* ?+ ?/))
+ (let ((table (sgml-make-syntax-table sgml-specials))
+ brackets)
+ (map-char-table
+ (lambda (key value)
+ (setq brackets (cons (list
+ (if (consp key)
+ (list (car key) (cdr key))
+ key)
+ value)
+ brackets)))
+ (unicode-property-table-internal 'paired-bracket))
+ (setq brackets (delete-dups (flatten-tree brackets)))
+ (dolist (char (append brackets (list ?$ ?% ?& ?* ?+ ?/)))
(modify-syntax-entry char "." table))
(unless (memq ?' sgml-specials)
;; Avoid that skipping a tag backwards skips any "'" prefixing it.
@@ -625,7 +634,8 @@ Do \\[describe-key] on the following bindings to discover what they do.
(setq-local syntax-propertize-function #'sgml-syntax-propertize)
(setq-local syntax-ppss-table sgml-tag-syntax-table)
(setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
- (setq-local sgml-xml-mode (sgml-xml-guess))
+ (when (sgml-xml-guess)
+ (setq-local sgml-xml-mode t))
(unless sgml-xml-mode
(setq-local skeleton-transformation-function sgml-transformation-function))
;; This will allow existing comments within declarations to be
@@ -1788,8 +1798,7 @@ This defaults to `sgml-quick-keys'.
This takes effect when first loading the library.")
(defvar html-mode-map
- (let ((map (make-sparse-keymap))
- (menu-map (make-sparse-keymap "HTML")))
+ (let ((map (make-sparse-keymap)))
(set-keymap-parent map sgml-mode-map)
(define-key map "\C-c6" 'html-headline-6)
(define-key map "\C-c5" 'html-headline-5)
@@ -1826,34 +1835,35 @@ 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 [menu-bar html] (cons "HTML" menu-map))
- (define-key menu-map [html-autoview-mode]
- '("Toggle Autoviewing" . html-autoview-mode))
- (define-key menu-map [browse-url-of-buffer]
- '("View Buffer Contents" . browse-url-of-buffer))
- (define-key menu-map [nil] '("--"))
- ;;(define-key menu-map "6" '("Heading 6" . html-headline-6))
- ;;(define-key menu-map "5" '("Heading 5" . html-headline-5))
- ;;(define-key menu-map "4" '("Heading 4" . html-headline-4))
- (define-key menu-map "3" '("Heading 3" . html-headline-3))
- (define-key menu-map "2" '("Heading 2" . html-headline-2))
- (define-key menu-map "1" '("Heading 1" . html-headline-1))
- (define-key menu-map "l" '("Radio Buttons" . html-radio-buttons))
- (define-key menu-map "c" '("Checkboxes" . html-checkboxes))
- (define-key menu-map "l" '("List Item" . html-list-item))
- (define-key menu-map "u" '("Unordered List" . html-unordered-list))
- (define-key menu-map "o" '("Ordered List" . html-ordered-list))
- (define-key menu-map "-" '("Horizontal Rule" . html-horizontal-rule))
- (define-key menu-map "\n" '("Line Break" . html-line))
- (define-key menu-map "\r" '("Paragraph" . html-paragraph))
- (define-key menu-map "i" '("Image" . html-image))
- (define-key menu-map "h" '("Href Anchor URL" . html-href-anchor))
- (define-key menu-map "f" '("Href Anchor File" . html-href-anchor-file))
- (define-key menu-map "n" '("Name Anchor" . html-name-anchor))
- (define-key menu-map "#" '("ID Anchor" . html-id-anchor))
map)
"Keymap for commands for use in HTML mode.")
+(easy-menu-define html-mode-menu html-mode-map
+ "Menu for HTML mode."
+ '("HTML"
+ ["ID Anchor" html-id-anchor]
+ ["Name Anchor" html-name-anchor]
+ ["Href Anchor File" html-href-anchor-file]
+ ["Href Anchor URL" html-href-anchor]
+ ["Image" html-image]
+ ["Paragraph" html-paragraph]
+ ["Line Break" html-line]
+ ["Horizontal Rule" html-horizontal-rule]
+ ["Ordered List" html-ordered-list]
+ ["Unordered List" html-unordered-list]
+ ["List Item" html-list-item]
+ ["Checkboxes" html-checkboxes]
+ ["Radio Buttons" html-radio-buttons]
+ ["Heading 1" html-headline-1]
+ ["Heading 2" html-headline-2]
+ ["Heading 3" html-headline-3]
+ ;; ["Heading 4" html-headline-4]
+ ;; ["Heading 5" html-headline-5]
+ ;; ["Heading 6" html-headline-6]
+ "---"
+ ["View Buffer Contents" browse-url-of-buffer]
+ ["Toggle Autoviewing" html-autoview-mode]))
+
(defvar html-face-tag-alist
'((bold . "strong")
(italic . "em")
@@ -2370,7 +2380,7 @@ 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
href=\"URL\">see also URL</a> where URL is a filename relative to current
-directory, or absolute as in `http://www.cs.indiana.edu/elisp/w3/docs.html'.
+directory, or absolute as in `https://www.cs.indiana.edu/elisp/w3/docs.html'.
Images in many formats can be inlined with <img src=\"URL\">.
@@ -2442,7 +2452,7 @@ The third `match-string' will be the used in the menu.")
HTML Autoview mode is a buffer-local minor mode for use with
`html-mode'. If enabled, saving the file automatically runs
`browse-url-of-buffer' to view it."
- nil nil nil
+ :lighter nil
(if html-autoview-mode
(add-hook 'after-save-hook #'browse-url-of-buffer nil t)
(remove-hook 'after-save-hook #'browse-url-of-buffer t)))
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 06785e458b2..2dd52b87b79 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -383,7 +383,7 @@
;; There is no artificial-intelligence magic in this package. The
;; definition of a table and the cells inside the table is reasonably
;; limited in order to achieve acceptable performance in the
-;; interactive operation under Emacs lisp implementation. A valid
+;; interactive operation under Emacs Lisp implementation. A valid
;; table is a rectangular text area completely filled with valid
;; cells. A valid cell is a rectangle text area, which four borders
;; consist of valid border characters. Cells can not be nested one to
@@ -1306,17 +1306,16 @@ the last cache point coordinate."
(let ((func-symbol (intern (format "*table--cell-%s" command)))
(doc-string (format "Table remapped function for `%s'." command)))
(defalias func-symbol
- `(lambda
- (&rest args)
- ,doc-string
- (interactive)
- (let ((table-inhibit-update t)
- (deactivate-mark nil))
- (table--finish-delayed-tasks)
- (table-recognize-cell 'force)
- (table-with-cache-buffer
- (call-interactively ',command)
- (setq table-inhibit-auto-fill-paragraph t)))))
+ (lambda (&rest _args)
+ (:documentation doc-string)
+ (interactive)
+ (let ((table-inhibit-update t)
+ (deactivate-mark nil))
+ (table--finish-delayed-tasks)
+ (table-recognize-cell 'force)
+ (table-with-cache-buffer
+ (call-interactively command)
+ (setq table-inhibit-auto-fill-paragraph t)))))
(push (cons command func-symbol)
table-command-remap-alist)))
@@ -1338,17 +1337,16 @@ the last cache point coordinate."
(let ((func-symbol (intern (format "*table--cell-%s" command)))
(doc-string (format "Table remapped function for `%s'." command)))
(defalias func-symbol
- `(lambda
- (&rest args)
- ,doc-string
- (interactive)
- (table--finish-delayed-tasks)
- (table-recognize-cell 'force)
- (table-with-cache-buffer
- (table--remove-cell-properties (point-min) (point-max))
- (table--remove-eol-spaces (point-min) (point-max))
- (call-interactively ',command))
- (table--finish-delayed-tasks)))
+ (lambda (&rest _args)
+ (:documentation doc-string)
+ (interactive)
+ (table--finish-delayed-tasks)
+ (table-recognize-cell 'force)
+ (table-with-cache-buffer
+ (table--remove-cell-properties (point-min) (point-max))
+ (table--remove-eol-spaces (point-min) (point-max))
+ (call-interactively command))
+ (table--finish-delayed-tasks)))
(push (cons command func-symbol)
table-command-remap-alist)))
@@ -1360,19 +1358,18 @@ the last cache point coordinate."
insert))
(let ((func-symbol (intern (format "*table--cell-%s" command)))
(doc-string (format "Table remapped function for `%s'." command)))
- (fset func-symbol
- `(lambda
- (&rest args)
- ,doc-string
- (interactive)
- (table--finish-delayed-tasks)
- (table-recognize-cell 'force)
- (table-with-cache-buffer
- (call-interactively ',command)
- (table--untabify (point-min) (point-max))
- (table--fill-region (point-min) (point-max))
- (setq table-inhibit-auto-fill-paragraph t))
- (table--finish-delayed-tasks)))
+ (defalias func-symbol
+ (lambda (&rest _args)
+ (:documentation doc-string)
+ (interactive)
+ (table--finish-delayed-tasks)
+ (table-recognize-cell 'force)
+ (table-with-cache-buffer
+ (call-interactively command)
+ (table--untabify (point-min) (point-max))
+ (table--fill-region (point-min) (point-max))
+ (setq table-inhibit-auto-fill-paragraph t))
+ (table--finish-delayed-tasks)))
(push (cons command func-symbol)
table-command-remap-alist)))
@@ -1384,18 +1381,17 @@ the last cache point coordinate."
fill-paragraph))
(let ((func-symbol (intern (format "*table--cell-%s" command)))
(doc-string (format "Table remapped function for `%s'." command)))
- (fset func-symbol
- `(lambda
- (&rest args)
- ,doc-string
- (interactive)
- (table--finish-delayed-tasks)
- (table-recognize-cell 'force)
- (table-with-cache-buffer
- (let ((fill-column table-cell-info-width))
- (call-interactively ',command))
- (setq table-inhibit-auto-fill-paragraph t))
- (table--finish-delayed-tasks)))
+ (defalias func-symbol
+ (lambda (&rest _args)
+ (:documentation doc-string)
+ (interactive)
+ (table--finish-delayed-tasks)
+ (table-recognize-cell 'force)
+ (table-with-cache-buffer
+ (let ((fill-column table-cell-info-width))
+ (call-interactively command))
+ (setq table-inhibit-auto-fill-paragraph t))
+ (table--finish-delayed-tasks)))
(push (cons command func-symbol)
table-command-remap-alist)))
@@ -1492,7 +1488,7 @@ Move the point under the table as shown below.
+--------------+------+--------------------------------+
-!-
-Type M-x table-insert-row instead of \\[table-insert-row-column]. \\[table-insert-row-column] does not work
+Type \\[table-insert-row] instead of \\[table-insert-row-column]. \\[table-insert-row-column] does not work
when the point is outside of the table. This insertion at
outside of the table effectively appends a row at the end.
@@ -2915,11 +2911,11 @@ HTML:
URL `https://www.w3.org'
LaTeX:
- URL `http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Tables.html'
+ URL `https://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Tables.html'
CALS (DocBook DTD):
- URL `http://www.oasis-open.org/html/a502.htm'
- URL `http://www.oreilly.com/catalog/docbook/chapter/book/table.html#AEN114751'
+ URL `https://www.oasis-open.org/html/a502.htm'
+ URL `https://www.oreilly.com/catalog/docbook/chapter/book/table.html#AEN114751'
"
(interactive
(let* ((_ (unless (table--probe-cell) (error "Table not found here")))
@@ -2975,8 +2971,8 @@ CALS (DocBook DTD):
(setq col-list (cons (car lu-coordinate) col-list)))
(unless (memq (cdr lu-coordinate) row-list)
(setq row-list (cons (cdr lu-coordinate) row-list))))))
- (setq col-list (sort col-list '<))
- (setq row-list (sort row-list '<))
+ (setq col-list (sort col-list #'<))
+ (setq row-list (sort row-list #'<))
(message "Generating source...")
;; clear the source generation property list
(setplist 'table-source-info-plist nil)
@@ -3023,7 +3019,7 @@ CALS (DocBook DTD):
"")))
((eq language 'latex)
(insert (format "%% This LaTeX table template is generated by emacs %s\n" emacs-version)
- "\\begin{tabular}{|" (apply 'concat (make-list (length col-list) "l|")) "}\n"
+ "\\begin{tabular}{|" (apply #'concat (make-list (length col-list) "l|")) "}\n"
"\\hline\n"))
((eq language 'cals)
(insert (format "<!-- This CALS table template is generated by emacs %s -->\n" emacs-version)
@@ -3054,7 +3050,7 @@ CALS (DocBook DTD):
(set-marker-insertion-type (table-get-source-info 'colspec-marker) t) ;; insert before
(save-excursion
(goto-char (table-get-source-info 'colspec-marker))
- (dolist (col (sort (table-get-source-info 'colnum-list) '<))
+ (dolist (col (sort (table-get-source-info 'colnum-list) #'<))
(insert (format " <colspec colnum=\"%d\" colname=\"c%d\"/>\n" col col))))
(insert (format " </%s>\n </tgroup>\n</table>\n" (table-get-source-info 'row-type))))
((eq language 'mediawiki)
@@ -3852,7 +3848,7 @@ converts a table into plain text without frames. It is a companion to
;; Create the keymap after running the user init file so that the user
;; modification to the global-map is accounted.
-(add-hook 'after-init-hook 'table--make-cell-map t)
+(add-hook 'after-init-hook #'table--make-cell-map t)
(defun *table--cell-self-insert-command ()
"Table cell version of `self-insert-command'."
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index d5a79ad0ac5..c53acf53e7e 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -28,7 +28,6 @@
;;; Code:
-;; Pacify the byte-compiler
(eval-when-compile
(require 'compare-w)
(require 'cl-lib)
@@ -600,11 +599,13 @@ An alternative value is \" . \", if you use a font with a narrow period."
;; Citation args.
(list (concat slash citations opt arg) 3 'font-lock-constant-face)
;;
- ;; Text between `` quotes ''.
- (cons (concat (regexp-opt '("``" "\"<" "\"`" "<<" "«") t)
- "[^'\">{]+" ;a bit pessimistic
- (regexp-opt '("''" "\">" "\"'" ">>" "»") t))
- 'font-lock-string-face)
+ ;; Text between `` quotes ''.
+ (list (concat (regexp-opt '("``" "\"<" "\"`" "<<" "«") t)
+ "\\(\\(.\\|\n\\)+?\\)"
+ (regexp-opt `("''" "\">" "\"'" ">>" "»") t))
+ '(1 font-lock-keyword-face)
+ '(2 font-lock-string-face)
+ '(4 font-lock-keyword-face))
;;
;; Command names, special and general.
(cons (concat slash specials-1) 'font-lock-warning-face)
@@ -857,11 +858,11 @@ START is the position of the \\ and DELIM is the delimiter char."
(defun tex-define-common-keys (keymap)
"Define the keys that we want defined both in TeX mode and in the TeX shell."
- (define-key keymap "\C-c\C-k" 'tex-kill-job)
- (define-key keymap "\C-c\C-l" 'tex-recenter-output-buffer)
- (define-key keymap "\C-c\C-q" 'tex-show-print-queue)
- (define-key keymap "\C-c\C-p" 'tex-print)
- (define-key keymap "\C-c\C-v" 'tex-view)
+ (define-key keymap "\C-c\C-k" #'tex-kill-job)
+ (define-key keymap "\C-c\C-l" #'tex-recenter-output-buffer)
+ (define-key keymap "\C-c\C-q" #'tex-show-print-queue)
+ (define-key keymap "\C-c\C-p" #'tex-print)
+ (define-key keymap "\C-c\C-v" #'tex-view)
(define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX")))
@@ -884,27 +885,27 @@ START is the position of the \\ and DELIM is the delimiter char."
(let ((map (make-sparse-keymap)))
(set-keymap-parent map text-mode-map)
(tex-define-common-keys map)
- (define-key map "\"" 'tex-insert-quote)
- (define-key map "\n" 'tex-handle-newline)
- (define-key map "\M-\r" 'latex-insert-item)
- (define-key map "\C-c}" 'up-list)
- (define-key map "\C-c{" 'tex-insert-braces)
- (define-key map "\C-c\C-r" 'tex-region)
- (define-key map "\C-c\C-b" 'tex-buffer)
- (define-key map "\C-c\C-f" 'tex-file)
- (define-key map "\C-c\C-c" 'tex-compile)
- (define-key map "\C-c\C-i" 'tex-bibtex-file)
- (define-key map "\C-c\C-o" 'latex-insert-block)
+ (define-key map "\"" #'tex-insert-quote)
+ (define-key map "\n" #'tex-handle-newline)
+ (define-key map "\M-\r" #'latex-insert-item)
+ (define-key map "\C-c}" #'up-list)
+ (define-key map "\C-c{" #'tex-insert-braces)
+ (define-key map "\C-c\C-r" #'tex-region)
+ (define-key map "\C-c\C-b" #'tex-buffer)
+ (define-key map "\C-c\C-f" #'tex-file)
+ (define-key map "\C-c\C-c" #'tex-compile)
+ (define-key map "\C-c\C-i" #'tex-bibtex-file)
+ (define-key map "\C-c\C-o" #'latex-insert-block)
;; Redundant keybindings, for consistency with SGML mode.
- (define-key map "\C-c\C-t" 'latex-insert-block)
- (define-key map "\C-c]" 'latex-close-block)
- (define-key map "\C-c/" 'latex-close-block)
-
- (define-key map "\C-c\C-e" 'latex-close-block)
- (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block)
- (define-key map "\C-c\C-m" 'tex-feed-input)
- (define-key map [(control return)] 'tex-feed-input)
+ (define-key map "\C-c\C-t" #'latex-insert-block)
+ (define-key map "\C-c]" #'latex-close-block)
+ (define-key map "\C-c/" #'latex-close-block)
+
+ (define-key map "\C-c\C-e" #'latex-close-block)
+ (define-key map "\C-c\C-u" #'tex-goto-last-unclosed-latex-block)
+ (define-key map "\C-c\C-m" #'tex-feed-input)
+ (define-key map [(control return)] #'tex-feed-input)
(define-key map [menu-bar tex tex-bibtex-file]
'("BibTeX File" . tex-bibtex-file))
(define-key map [menu-bar tex tex-validate-region]
@@ -922,7 +923,7 @@ START is the position of the \\ and DELIM is the delimiter char."
(defvar latex-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map tex-mode-map)
- (define-key map "\C-c\C-s" 'latex-split-block)
+ (define-key map "\C-c\C-s" #'latex-split-block)
map)
"Keymap for `latex-mode'. See also `tex-mode-map'.")
@@ -1033,11 +1034,11 @@ says which mode to use."
;; received them from someone using AUCTeX).
;;;###autoload
-(defalias 'TeX-mode 'tex-mode)
+(defalias 'TeX-mode #'tex-mode)
;;;###autoload
-(defalias 'plain-TeX-mode 'plain-tex-mode)
+(defalias 'plain-TeX-mode #'plain-tex-mode)
;;;###autoload
-(defalias 'LaTeX-mode 'latex-mode)
+(defalias 'LaTeX-mode #'latex-mode)
;;;###autoload
(define-derived-mode plain-tex-mode tex-mode "TeX"
@@ -1425,20 +1426,25 @@ 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-beg (text-end (point-marker)))
- (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)))
+ (let ((no-matches (zerop num-matches))
+ (inhibit-read-only t))
(if no-matches
(insert "None!\n"))
(if (called-interactively-p 'interactive)
@@ -1560,7 +1566,7 @@ the name of the environment and SKEL-ELEM is an element to use in
a skeleton (see `skeleton-insert').")
;; Like tex-insert-braces, but for LaTeX.
-(defalias 'tex-latex-block 'latex-insert-block)
+(defalias 'tex-latex-block #'latex-insert-block)
(define-skeleton latex-insert-block
"Create a matching pair of lines \\begin{NAME} and \\end{NAME} at point.
Puts point on a blank line between them."
@@ -1866,7 +1872,7 @@ Mark is left at original location."
(with-syntax-table tex-mode-syntax-table
(forward-sexp))))))
-(defalias 'tex-close-latex-block 'latex-close-block)
+(defalias 'tex-close-latex-block #'latex-close-block)
(define-skeleton latex-close-block
"Create an \\end{...} to match the last unclosed \\begin{...}."
(save-excursion
@@ -2008,7 +2014,7 @@ Mark is left at original location."
;; Specify an interactive shell, to make sure it prompts.
"-i")
(let ((proc (get-process "tex-shell")))
- (set-process-sentinel proc 'tex-shell-sentinel)
+ (set-process-sentinel proc #'tex-shell-sentinel)
(set-process-query-on-exit-flag proc nil)
(tex-shell)
(while (zerop (buffer-size))
@@ -2063,10 +2069,10 @@ evaluates to a command string.
Return the process in which TeX is running."
(save-excursion
- (let* ((cmd (eval command))
+ (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)
@@ -2131,6 +2137,7 @@ If NOT-ALL is non-nil, save the `.dvi' file."
(defvar tex-compile-commands
`(,@(mapcar (lambda (prefix)
`((concat ,prefix tex-command
+ " " tex-start-options
" " (if (< 0 (length tex-start-commands))
(shell-quote-argument tex-start-commands))
" %f")
@@ -2313,7 +2320,7 @@ FILE is typically the output DVI or PDF file."
executable))))))
(defun tex-command-executable (cmd)
- (let ((s (if (stringp cmd) cmd (eval (car cmd)))))
+ (let ((s (if (stringp cmd) cmd (eval (car cmd) t))))
(substring s 0 (string-match "[ \t]\\|\\'" s))))
(defun tex-command-active-p (cmd fspec)
@@ -2400,7 +2407,7 @@ Only applies the FSPEC to the args part of FORMAT."
(setq latest (nth 1 cmd) cmds (list cmd)))))))
;; Expand the command spec into the actual text.
(dolist (cmd (prog1 cmds (setq cmds nil)))
- (push (cons (eval (car cmd)) (cdr cmd)) cmds))
+ (push (cons (eval (car cmd) t) (cdr cmd)) cmds))
;; Select the favorite command from the history.
(let ((hist tex-compile-history)
re hist-cmd)
@@ -2446,7 +2453,7 @@ Only applies the FSPEC to the args part of FORMAT."
(completing-read
(format "Command [%s]: " (tex-summarize-command default))
(mapcar (lambda (x)
- (list (tex-format-cmd (eval (car x)) fspec)))
+ (list (tex-format-cmd (eval (car x) t) fspec)))
tex-compile-commands)
nil nil nil 'tex-compile-history default))))
(save-some-buffers (not compilation-ask-about-save) nil)
@@ -2467,7 +2474,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)
@@ -2526,7 +2533,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.
@@ -2535,9 +2545,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
@@ -2740,7 +2752,7 @@ because there is no standard value that would generally work."
;; Restart the TeX shell if necessary.
(or (tex-shell-running)
(tex-start-shell))
- (let ((tex-dvi-print-command (eval tex-dvi-view-command)))
+ (let ((tex-dvi-print-command (eval tex-dvi-view-command t)))
(tex-print)))
(defun tex-append (file-name suffix)
@@ -2766,7 +2778,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)))
" "))
@@ -3330,7 +3342,6 @@ There might be text before point."
("\\oplus" . ?⊕)
("\\oslash" . ?⊘)
("\\otimes" . ?⊗)
- ("\\par" . ?
)
("\\parallel" . ?∥)
("\\partial" . ?∂)
("\\perp" . ?⊥)
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index ed0a367d01d..977f3bab6ce 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -1,4 +1,4 @@
-;;; texinfmt.el --- format Texinfo files into Info files
+;;; texinfmt.el --- format Texinfo files into Info files -*- lexical-binding: t; -*-
;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2021 Free Software
;; Foundation, Inc.
@@ -23,15 +23,17 @@
;;; Commentary:
-;;; Code:
+;;; Emacs Lisp functions to convert Texinfo files to Info files.
-;;; Emacs lisp functions to convert Texinfo files to Info files.
+;;; Code:
(defvar texinfmt-version "2.42 of 7 Jul 2006")
+(make-obsolete-variable 'texinfmt-version 'emacs-version "28.1")
(defun texinfmt-version (&optional here)
"Show the version of texinfmt.el in the minibuffer.
If optional argument HERE is non-nil, insert info at point."
+ (declare (obsolete emacs-version "28.1"))
(interactive "P")
(let ((version-string
(format-message "Version of `texinfmt.el': %s" texinfmt-version)))
@@ -184,6 +186,7 @@ containing the Texinfo file.")
;; These come from tex-mode.el.
(defvar tex-start-of-header)
(defvar tex-end-of-header)
+(defvar texinfo-example-start)
;;;###autoload
(defun texinfo-format-region (region-beginning region-end)
@@ -209,7 +212,7 @@ converted to Info is stored in a temporary buffer."
texinfo-last-node
texinfo-node-names
(texinfo-footnote-number 0)
- last-input-buffer
+ ;; last-input-buffer
(fill-column-for-info fill-column)
(input-buffer (current-buffer))
(input-directory default-directory)
@@ -345,8 +348,8 @@ converted to Info is stored in a temporary buffer."
(file-name-nondirectory
(buffer-file-name input-buffer))))
(format-message "buffer `%s'" (buffer-name input-buffer)))
- (format-message "\nusing `texinfmt.el' version ")
- texinfmt-version
+ (format-message "\nusing `texinfmt.el' on Emacs version ")
+ emacs-version
".\n\n")
;; Now convert for real.
@@ -403,7 +406,7 @@ if large. You can use `Info-split' to do this manually."
texinfo-stack
texinfo-node-names
(texinfo-footnote-number 0)
- last-input-buffer
+ ;; last-input-buffer
outfile
(fill-column-for-info fill-column)
(input-buffer (current-buffer))
@@ -489,8 +492,8 @@ if large. You can use `Info-split' to do this manually."
(file-name-nondirectory
(buffer-file-name input-buffer))))
(format-message "buffer `%s'" (buffer-name input-buffer)))
- (format-message "\nusing `texinfmt.el' version ")
- texinfmt-version
+ (format-message "\nusing `texinfmt.el' on Emacs version ")
+ emacs-version
".\n\n")
;; Return data for indices.
(list outfile
@@ -922,7 +925,7 @@ commands."
(error "Unterminated @%s" (car (car texinfo-stack)))))
;; Remove excess whitespace
- (let ((whitespace-silent t))
+ (dlet ((whitespace-silent t))
(whitespace-cleanup)))
(defvar texinfo-copying-text ""
@@ -1030,18 +1033,18 @@ Leave point after argument."
(defun texinfo-optional-braces-discard ()
"Discard braces following command, if any."
(goto-char texinfo-command-end)
- (let ((start (point)))
- (cond ((looking-at "[ \t]*\n")) ; do nothing
- ((looking-at "{") ; remove braces, if any
- (forward-list 1)
- (setq texinfo-command-end (point)))
- (t
- (error
- "Invalid `texinfo-optional-braces-discard' format (need braces?)")))
- (delete-region texinfo-command-start texinfo-command-end)))
+ ;; (let ((start (point)))
+ (cond ((looking-at "[ \t]*\n")) ; do nothing
+ ((looking-at "{") ; remove braces, if any
+ (forward-list 1)
+ (setq texinfo-command-end (point)))
+ (t
+ (error
+ "Invalid `texinfo-optional-braces-discard' format (need braces?)")))
+ (delete-region texinfo-command-start texinfo-command-end)) ;;)
(defun texinfo-format-parse-line-args ()
- (let ((start (1- (point)))
+ (let (;; (start (1- (point)))
next beg end
args)
(skip-chars-forward " ")
@@ -1062,7 +1065,7 @@ Leave point after argument."
(nreverse args)))
(defun texinfo-format-parse-args ()
- (let ((start (1- (point)))
+ (let (;; (start (1- (point)))
next beg end
args)
(search-forward "{")
@@ -2005,26 +2008,26 @@ commands that are defined in texinfo.tex for printed output.
;;
;; Case 2: {Column 1 template} {Column 2} {Column 3 example}
((looking-at "{")
- (let ((start-of-templates (point)))
- (while (not (eolp))
- (skip-chars-forward " \t")
- (let* ((start-of-template (1+ (point)))
- (end-of-template
- ;; forward-sexp works with braces in Texinfo mode
- (progn (forward-sexp 1) (1- (point)))))
- (push (- end-of-template start-of-template)
- texinfo-multitable-width-list)
- ;; Remove carriage return from within a template, if any.
- ;; This helps those who want to use more than
- ;; one line's worth of words in @multitable line.
- (narrow-to-region start-of-template end-of-template)
- (goto-char (point-min))
- (while (search-forward "
+ ;; (let ((start-of-templates (point)))
+ (while (not (eolp))
+ (skip-chars-forward " \t")
+ (let* ((start-of-template (1+ (point)))
+ (end-of-template
+ ;; forward-sexp works with braces in Texinfo mode
+ (progn (forward-sexp 1) (1- (point)))))
+ (push (- end-of-template start-of-template)
+ texinfo-multitable-width-list)
+ ;; Remove carriage return from within a template, if any.
+ ;; This helps those who want to use more than
+ ;; one line's worth of words in @multitable line.
+ (narrow-to-region start-of-template end-of-template)
+ (goto-char (point-min))
+ (while (search-forward "
" nil t)
- (delete-char -1))
- (goto-char (point-max))
- (widen)
- (forward-char 1)))))
+ (delete-char -1))
+ (goto-char (point-max))
+ (widen)
+ (forward-char 1)))) ;; )
;;
;; Case 3: Trouble
(t
@@ -2038,7 +2041,7 @@ commands that are defined in texinfo.tex for printed output.
;; additional between column spaces, if any
texinfo-extra-inter-column-width
;; sum of spaces for each entry
- (apply '+ texinfo-multitable-width-list))))
+ (apply #'+ texinfo-multitable-width-list))))
(if (> desired-columns fill-column)
(error
"Multi-column table width, %d chars, is greater than page width, %d chars."
@@ -2169,9 +2172,9 @@ This command is executed when texinfmt sees @item inside @multitable."
(while (< column-number total-number-of-columns)
(setq here (point))
(insert-rectangle
- (eval (intern
- (concat texinfo-multitable-rectangle-name
- (int-to-string column-number)))))
+ (symbol-value (intern
+ (concat texinfo-multitable-rectangle-name
+ (int-to-string column-number)))))
(goto-char here)
(end-of-line)
(setq column-number (1+ column-number))))
@@ -2394,8 +2397,8 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image."
(put 'alias 'texinfo-format 'texinfo-alias)
(defun texinfo-alias ()
- (let ((start (1- (point)))
- args)
+ (let (;; (start (1- (point))
+ ) ;; args
(skip-chars-forward " ")
(setq texinfo-command-end (line-end-position))
(if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
@@ -3408,7 +3411,7 @@ Default is to leave paragraph indentation as is."
(while args
(insert " "
(if (or (= ?& (aref (car args) 0))
- (eq (eval (car texinfo-defun-type)) 'deftp-type))
+ (eq (car texinfo-defun-type) 'deftp-type))
(car args)
(upcase (car args))))
(setq args (cdr args)))))
@@ -3773,80 +3776,80 @@ Default is to leave paragraph indentation as is."
(put 'deffn 'texinfo-format 'texinfo-format-defun)
(put 'deffnx 'texinfo-format 'texinfo-format-defunx)
(put 'deffn 'texinfo-end 'texinfo-end-defun)
-(put 'deffn 'texinfo-defun-type '('deffn-type nil))
-(put 'deffnx 'texinfo-defun-type '('deffn-type nil))
+(put 'deffn 'texinfo-defun-type '(deffn-type nil))
+(put 'deffnx 'texinfo-defun-type '(deffn-type nil))
(put 'deffn 'texinfo-defun-index 'texinfo-findex)
(put 'deffnx 'texinfo-defun-index 'texinfo-findex)
(put 'defun 'texinfo-format 'texinfo-format-defun)
(put 'defunx 'texinfo-format 'texinfo-format-defunx)
(put 'defun 'texinfo-end 'texinfo-end-defun)
-(put 'defun 'texinfo-defun-type '('defun-type "Function"))
-(put 'defunx 'texinfo-defun-type '('defun-type "Function"))
+(put 'defun 'texinfo-defun-type '(defun-type "Function"))
+(put 'defunx 'texinfo-defun-type '(defun-type "Function"))
(put 'defun 'texinfo-defun-index 'texinfo-findex)
(put 'defunx 'texinfo-defun-index 'texinfo-findex)
(put 'defmac 'texinfo-format 'texinfo-format-defun)
(put 'defmacx 'texinfo-format 'texinfo-format-defunx)
(put 'defmac 'texinfo-end 'texinfo-end-defun)
-(put 'defmac 'texinfo-defun-type '('defun-type "Macro"))
-(put 'defmacx 'texinfo-defun-type '('defun-type "Macro"))
+(put 'defmac 'texinfo-defun-type '(defun-type "Macro"))
+(put 'defmacx 'texinfo-defun-type '(defun-type "Macro"))
(put 'defmac 'texinfo-defun-index 'texinfo-findex)
(put 'defmacx 'texinfo-defun-index 'texinfo-findex)
(put 'defspec 'texinfo-format 'texinfo-format-defun)
(put 'defspecx 'texinfo-format 'texinfo-format-defunx)
(put 'defspec 'texinfo-end 'texinfo-end-defun)
-(put 'defspec 'texinfo-defun-type '('defun-type "Special form"))
-(put 'defspecx 'texinfo-defun-type '('defun-type "Special form"))
+(put 'defspec 'texinfo-defun-type '(defun-type "Special form"))
+(put 'defspecx 'texinfo-defun-type '(defun-type "Special form"))
(put 'defspec 'texinfo-defun-index 'texinfo-findex)
(put 'defspecx 'texinfo-defun-index 'texinfo-findex)
(put 'defvr 'texinfo-format 'texinfo-format-defun)
(put 'defvrx 'texinfo-format 'texinfo-format-defunx)
(put 'defvr 'texinfo-end 'texinfo-end-defun)
-(put 'defvr 'texinfo-defun-type '('deffn-type nil))
-(put 'defvrx 'texinfo-defun-type '('deffn-type nil))
+(put 'defvr 'texinfo-defun-type '(deffn-type nil))
+(put 'defvrx 'texinfo-defun-type '(deffn-type nil))
(put 'defvr 'texinfo-defun-index 'texinfo-vindex)
(put 'defvrx 'texinfo-defun-index 'texinfo-vindex)
(put 'defvar 'texinfo-format 'texinfo-format-defun)
(put 'defvarx 'texinfo-format 'texinfo-format-defunx)
(put 'defvar 'texinfo-end 'texinfo-end-defun)
-(put 'defvar 'texinfo-defun-type '('defun-type "Variable"))
-(put 'defvarx 'texinfo-defun-type '('defun-type "Variable"))
+(put 'defvar 'texinfo-defun-type '(defun-type "Variable"))
+(put 'defvarx 'texinfo-defun-type '(defun-type "Variable"))
(put 'defvar 'texinfo-defun-index 'texinfo-vindex)
(put 'defvarx 'texinfo-defun-index 'texinfo-vindex)
(put 'defconst 'texinfo-format 'texinfo-format-defun)
(put 'defconstx 'texinfo-format 'texinfo-format-defunx)
(put 'defconst 'texinfo-end 'texinfo-end-defun)
-(put 'defconst 'texinfo-defun-type '('defun-type "Constant"))
-(put 'defconstx 'texinfo-defun-type '('defun-type "Constant"))
+(put 'defconst 'texinfo-defun-type '(defun-type "Constant"))
+(put 'defconstx 'texinfo-defun-type '(defun-type "Constant"))
(put 'defconst 'texinfo-defun-index 'texinfo-vindex)
(put 'defconstx 'texinfo-defun-index 'texinfo-vindex)
(put 'defcmd 'texinfo-format 'texinfo-format-defun)
(put 'defcmdx 'texinfo-format 'texinfo-format-defunx)
(put 'defcmd 'texinfo-end 'texinfo-end-defun)
-(put 'defcmd 'texinfo-defun-type '('defun-type "Command"))
-(put 'defcmdx 'texinfo-defun-type '('defun-type "Command"))
+(put 'defcmd 'texinfo-defun-type '(defun-type "Command"))
+(put 'defcmdx 'texinfo-defun-type '(defun-type "Command"))
(put 'defcmd 'texinfo-defun-index 'texinfo-findex)
(put 'defcmdx 'texinfo-defun-index 'texinfo-findex)
(put 'defopt 'texinfo-format 'texinfo-format-defun)
(put 'defoptx 'texinfo-format 'texinfo-format-defunx)
(put 'defopt 'texinfo-end 'texinfo-end-defun)
-(put 'defopt 'texinfo-defun-type '('defun-type "User Option"))
-(put 'defoptx 'texinfo-defun-type '('defun-type "User Option"))
+(put 'defopt 'texinfo-defun-type '(defun-type "User Option"))
+(put 'defoptx 'texinfo-defun-type '(defun-type "User Option"))
(put 'defopt 'texinfo-defun-index 'texinfo-vindex)
(put 'defoptx 'texinfo-defun-index 'texinfo-vindex)
(put 'deftp 'texinfo-format 'texinfo-format-defun)
(put 'deftpx 'texinfo-format 'texinfo-format-defunx)
(put 'deftp 'texinfo-end 'texinfo-end-defun)
-(put 'deftp 'texinfo-defun-type '('deftp-type nil))
-(put 'deftpx 'texinfo-defun-type '('deftp-type nil))
+(put 'deftp 'texinfo-defun-type '(deftp-type nil))
+(put 'deftpx 'texinfo-defun-type '(deftp-type nil))
(put 'deftp 'texinfo-defun-index 'texinfo-tindex)
(put 'deftpx 'texinfo-defun-index 'texinfo-tindex)
@@ -3855,32 +3858,32 @@ Default is to leave paragraph indentation as is."
(put 'defop 'texinfo-format 'texinfo-format-defun)
(put 'defopx 'texinfo-format 'texinfo-format-defunx)
(put 'defop 'texinfo-end 'texinfo-end-defun)
-(put 'defop 'texinfo-defun-type '('defop-type nil))
-(put 'defopx 'texinfo-defun-type '('defop-type nil))
+(put 'defop 'texinfo-defun-type '(defop-type nil))
+(put 'defopx 'texinfo-defun-type '(defop-type nil))
(put 'defop 'texinfo-defun-index 'texinfo-findex)
(put 'defopx 'texinfo-defun-index 'texinfo-findex)
(put 'defmethod 'texinfo-format 'texinfo-format-defun)
(put 'defmethodx 'texinfo-format 'texinfo-format-defunx)
(put 'defmethod 'texinfo-end 'texinfo-end-defun)
-(put 'defmethod 'texinfo-defun-type '('defmethod-type "Method"))
-(put 'defmethodx 'texinfo-defun-type '('defmethod-type "Method"))
+(put 'defmethod 'texinfo-defun-type '(defmethod-type "Method"))
+(put 'defmethodx 'texinfo-defun-type '(defmethod-type "Method"))
(put 'defmethod 'texinfo-defun-index 'texinfo-findex)
(put 'defmethodx 'texinfo-defun-index 'texinfo-findex)
(put 'defcv 'texinfo-format 'texinfo-format-defun)
(put 'defcvx 'texinfo-format 'texinfo-format-defunx)
(put 'defcv 'texinfo-end 'texinfo-end-defun)
-(put 'defcv 'texinfo-defun-type '('defop-type nil))
-(put 'defcvx 'texinfo-defun-type '('defop-type nil))
+(put 'defcv 'texinfo-defun-type '(defop-type nil))
+(put 'defcvx 'texinfo-defun-type '(defop-type nil))
(put 'defcv 'texinfo-defun-index 'texinfo-vindex)
(put 'defcvx 'texinfo-defun-index 'texinfo-vindex)
(put 'defivar 'texinfo-format 'texinfo-format-defun)
(put 'defivarx 'texinfo-format 'texinfo-format-defunx)
(put 'defivar 'texinfo-end 'texinfo-end-defun)
-(put 'defivar 'texinfo-defun-type '('defmethod-type "Instance variable"))
-(put 'defivarx 'texinfo-defun-type '('defmethod-type "Instance variable"))
+(put 'defivar 'texinfo-defun-type '(defmethod-type "Instance variable"))
+(put 'defivarx 'texinfo-defun-type '(defmethod-type "Instance variable"))
(put 'defivar 'texinfo-defun-index 'texinfo-vindex)
(put 'defivarx 'texinfo-defun-index 'texinfo-vindex)
@@ -3889,32 +3892,32 @@ Default is to leave paragraph indentation as is."
(put 'deftypefn 'texinfo-format 'texinfo-format-defun)
(put 'deftypefnx 'texinfo-format 'texinfo-format-defunx)
(put 'deftypefn 'texinfo-end 'texinfo-end-defun)
-(put 'deftypefn 'texinfo-defun-type '('deftypefn-type nil))
-(put 'deftypefnx 'texinfo-defun-type '('deftypefn-type nil))
+(put 'deftypefn 'texinfo-defun-type '(deftypefn-type nil))
+(put 'deftypefnx 'texinfo-defun-type '(deftypefn-type nil))
(put 'deftypefn 'texinfo-defun-index 'texinfo-findex)
(put 'deftypefnx 'texinfo-defun-index 'texinfo-findex)
(put 'deftypefun 'texinfo-format 'texinfo-format-defun)
(put 'deftypefunx 'texinfo-format 'texinfo-format-defunx)
(put 'deftypefun 'texinfo-end 'texinfo-end-defun)
-(put 'deftypefun 'texinfo-defun-type '('deftypefun-type "Function"))
-(put 'deftypefunx 'texinfo-defun-type '('deftypefun-type "Function"))
+(put 'deftypefun 'texinfo-defun-type '(deftypefun-type "Function"))
+(put 'deftypefunx 'texinfo-defun-type '(deftypefun-type "Function"))
(put 'deftypefun 'texinfo-defun-index 'texinfo-findex)
(put 'deftypefunx 'texinfo-defun-index 'texinfo-findex)
(put 'deftypevr 'texinfo-format 'texinfo-format-defun)
(put 'deftypevrx 'texinfo-format 'texinfo-format-defunx)
(put 'deftypevr 'texinfo-end 'texinfo-end-defun)
-(put 'deftypevr 'texinfo-defun-type '('deftypefn-type nil))
-(put 'deftypevrx 'texinfo-defun-type '('deftypefn-type nil))
+(put 'deftypevr 'texinfo-defun-type '(deftypefn-type nil))
+(put 'deftypevrx 'texinfo-defun-type '(deftypefn-type nil))
(put 'deftypevr 'texinfo-defun-index 'texinfo-vindex)
(put 'deftypevrx 'texinfo-defun-index 'texinfo-vindex)
(put 'deftypevar 'texinfo-format 'texinfo-format-defun)
(put 'deftypevarx 'texinfo-format 'texinfo-format-defunx)
(put 'deftypevar 'texinfo-end 'texinfo-end-defun)
-(put 'deftypevar 'texinfo-defun-type '('deftypevar-type "Variable"))
-(put 'deftypevarx 'texinfo-defun-type '('deftypevar-type "Variable"))
+(put 'deftypevar 'texinfo-defun-type '(deftypevar-type "Variable"))
+(put 'deftypevarx 'texinfo-defun-type '(deftypevar-type "Variable"))
(put 'deftypevar 'texinfo-defun-index 'texinfo-vindex)
(put 'deftypevarx 'texinfo-defun-index 'texinfo-vindex)
@@ -3941,7 +3944,8 @@ Default is to leave paragraph indentation as is."
"Clear the value of the flag."
(let* ((arg (texinfo-parse-arg-discard))
(flag (car (read-from-string arg)))
- (value (substring arg (cdr (read-from-string arg)))))
+ ;; (value (substring arg (cdr (read-from-string arg))))
+ )
(put flag 'texinfo-whether-setp 'flag-cleared)
(put flag 'texinfo-set-value "")))
@@ -4041,7 +4045,7 @@ the @ifeq command."
(goto-char texinfo-command-end)
(let* ((case-fold-search t)
(stop (save-excursion (forward-sexp 1) (point)))
- start end
+ start ;; end
;; @ifeq{arg1, arg2, @command{optional-args}}
(arg1
(progn
@@ -4306,8 +4310,6 @@ For example, invoke
(setq error 1))))
(kill-emacs error))))
-
-;;; Place `provide' at end of file.
(provide 'texinfmt)
;;; texinfmt.el ends here
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 7799cdb5529..11d60e1eb03 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -1,4 +1,4 @@
-;;; texinfo.el --- major mode for editing Texinfo files
+;;; texinfo.el --- major mode for editing Texinfo files -*- lexical-binding: t; -*-
;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2021 Free Software
;; Foundation, Inc.
@@ -54,220 +54,27 @@
;;;###autoload
(defcustom texinfo-open-quote (purecopy "``")
"String inserted by typing \\[texinfo-insert-quote] to open a quotation."
- :type 'string
- :group 'texinfo)
+ :type 'string)
;;;###autoload
(defcustom texinfo-close-quote (purecopy "''")
"String inserted by typing \\[texinfo-insert-quote] to close a quotation."
- :type 'string
- :group 'texinfo)
+ :type 'string)
(defcustom texinfo-mode-hook nil
"Normal hook run when entering Texinfo mode."
:type 'hook
- :options '(turn-on-auto-fill flyspell-mode)
- :group 'texinfo)
+ :options '(turn-on-auto-fill flyspell-mode))
;;; Autoloads:
-(autoload 'makeinfo-region
- "makeinfo"
- "Make Info file from region of current Texinfo file, and switch to it.
-
-This command does not offer the `next-error' feature since it would
-apply to a temporary file, not the original; use the `makeinfo-buffer'
-command to gain use of `next-error'."
- t nil)
-
-(autoload 'makeinfo-buffer
- "makeinfo"
- "Make Info file from current buffer.
-
-Use the \\[next-error] command to move to the next error
-\(if there are errors)."
- t nil)
-
(autoload 'kill-compilation
"compile"
"Kill the process made by the \\[compile] command."
t nil)
-(autoload 'makeinfo-recenter-compilation-buffer
- "makeinfo"
- "Redisplay `*compilation*' buffer so most recent output can be seen.
-The last line of the buffer is displayed on
-line LINE of the window, or centered if LINE is nil."
- t nil)
-
-(autoload 'texinfo-update-node
- "texnfo-upd"
- "Without any prefix argument, update the node in which point is located.
-Non-nil argument (prefix, if interactive) means update the nodes in the
-marked region.
-
-The functions for creating or updating nodes and menus, and their
-keybindings, are:
-
- `texinfo-update-node' (&optional region-p) \\[texinfo-update-node]
- `texinfo-every-node-update' () \\[texinfo-every-node-update]
- `texinfo-sequential-node-update' (&optional region-p)
-
- `texinfo-make-menu' (&optional region-p) \\[texinfo-make-menu]
- `texinfo-all-menus-update' () \\[texinfo-all-menus-update]
- `texinfo-master-menu' ()
-
- `texinfo-indent-menu-description' (column &optional region-p)
-
-The `texinfo-column-for-description' variable specifies the column to
-which menu descriptions are indented. Its default value is 32."
- t nil)
-
-(autoload 'texinfo-every-node-update
- "texnfo-upd"
- "Update every node in a Texinfo file."
- t nil)
-
-(autoload 'texinfo-sequential-node-update
- "texnfo-upd"
- "Update one node (or many) in a Texinfo file with sequential pointers.
-
-This function causes the `Next' or `Previous' pointer to point to the
-immediately preceding or following node, even if it is at a higher or
-lower hierarchical level in the document. Continually pressing `n' or
-`p' takes you straight through the file.
-
-Without any prefix argument, update the node in which point is located.
-Non-nil argument (prefix, if interactive) means update the nodes in the
-marked region.
-
-This command makes it awkward to navigate among sections and
-subsections; it should be used only for those documents that are meant
-to be read like a novel rather than a reference, and for which the
-Info `g*' command is inadequate."
- t nil)
-
-(autoload 'texinfo-make-menu
- "texnfo-upd"
- "Without any prefix argument, make or update a menu.
-Make the menu for the section enclosing the node found following point.
-
-Non-nil argument (prefix, if interactive) means make or update menus
-for nodes within or part of the marked region.
-
-Whenever a menu exists, and is being updated, the descriptions that
-are associated with node names in the pre-existing menu are
-incorporated into the new menu. Otherwise, the nodes' section titles
-are inserted as descriptions."
- t nil)
-
-(autoload 'texinfo-all-menus-update
- "texnfo-upd"
- "Update every regular menu in a Texinfo file.
-Remove pre-existing master menu, if there is one.
-
-If called with a non-nil argument, this function first updates all the
-nodes in the buffer before updating the menus."
- t nil)
-
-(autoload 'texinfo-master-menu
- "texnfo-upd"
- "Make a master menu for a whole Texinfo file.
-Non-nil argument (prefix, if interactive) means first update all
-existing nodes and menus. Remove pre-existing master menu, if there is one.
-
-This function creates a master menu that follows the top node. The
-master menu includes every entry from all the other menus. It
-replaces any existing ordinary menu that follows the top node.
-
-If called with a non-nil argument, this function first updates all the
-menus in the buffer (incorporating descriptions from pre-existing
-menus) before it constructs the master menu.
-
-The function removes the detailed part of an already existing master
-menu. This action depends on the pre-existing master menu using the
-standard `texinfo-master-menu-header'.
-
-The master menu has the following format, which is adapted from the
-recommendation in the Texinfo Manual:
-
- * The first part contains the major nodes in the Texinfo file: the
- nodes for the chapters, chapter-like sections, and the major
- appendices. This includes the indices, so long as they are in
- chapter-like sections, such as unnumbered sections.
-
- * The second and subsequent parts contain a listing of the other,
- lower level menus, in order. This way, an inquirer can go
- directly to a particular node if he or she is searching for
- specific information.
-
-Each of the menus in the detailed node listing is introduced by the
-title of the section containing the menu."
- t nil)
-
-(autoload 'texinfo-indent-menu-description
- "texnfo-upd"
- "Indent every description in menu following point to COLUMN.
-Non-nil argument (prefix, if interactive) means indent every
-description in every menu in the region. Does not indent second and
-subsequent lines of a multi-line description."
- t nil)
-
-(autoload 'texinfo-insert-node-lines
- "texnfo-upd"
- "Insert missing `@node' lines in region of Texinfo file.
-Non-nil argument (prefix, if interactive) means also to insert the
-section titles as node names; and also to insert the section titles as
-node names in pre-existing @node lines that lack names."
- t nil)
-
-(autoload 'texinfo-start-menu-description
- "texnfo-upd"
- "In this menu entry, insert the node's section title as a description.
-Position point at beginning of description ready for editing.
-Do not insert a title if the line contains an existing description.
-
-You will need to edit the inserted text since a useful description
-complements the node name rather than repeats it as a title does."
- t nil)
-
-(autoload 'texinfo-multiple-files-update
- "texnfo-upd"
- "Update first node pointers in each file included in OUTER-FILE;
-create or update main menu in the outer file that refers to such nodes.
-This does not create or update menus or pointers within the included files.
-
-With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
-insert a master menu in OUTER-FILE. This does not create or update
-menus or pointers within the included files.
-
-With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
-interactive), update all the menus and all the `Next', `Previous', and
-`Up' pointers of all the files included in OUTER-FILE before inserting
-a master menu in OUTER-FILE.
-
-The command also updates the `Top' level node pointers of OUTER-FILE.
-
-Notes:
-
- * this command does NOT save any files--you must save the
- outer file and any modified, included files.
-
- * except for the `Top' node, this command does NOT handle any
- pre-existing nodes in the outer file; hence, indices must be
- enclosed in an included file.
-
-Requirements:
-
- * each of the included files must contain exactly one highest
- hierarchical level node,
- * this highest node must be the first node in the included file,
- * each highest hierarchical level node must be of the same type.
-
-Thus, normally, each included file contains one, and only one,
-chapter."
- t nil)
+(require 'texinfo-loaddefs)
;;; Code:
@@ -349,8 +156,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
(defface texinfo-heading
'((t (:inherit font-lock-function-name-face)))
- "Face used for section headings in `texinfo-mode'."
- :group 'texinfo)
+ "Face used for section headings in `texinfo-mode'.")
(defvar texinfo-font-lock-keywords
`(;; All but the first had an OVERRIDE of t.
@@ -377,7 +183,7 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep)
;; (,texinfo-environment-regexp
;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep)
- (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t)
+ (,(concat "^@" (regexp-opt (mapcar #'car texinfo-section-list) t)
".*\n")
0 'texinfo-heading t))
"Additional expressions to highlight in Texinfo mode.")
@@ -404,19 +210,21 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
;;; Keys common both to Texinfo mode and to TeX shell.
+(declare-function tex-show-print-queue "tex-mode" ())
+
(defun texinfo-define-common-keys (keymap)
"Define the keys both in Texinfo mode and in the texinfo-tex-shell."
- (define-key keymap "\C-c\C-t\C-k" 'tex-kill-job)
- (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job)
- (define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
- (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue)
- (define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue)
- (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
- (define-key keymap "\C-c\C-t\C-v" 'texinfo-tex-view)
- (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
-
- (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
- (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
+ (define-key keymap "\C-c\C-t\C-k" #'tex-kill-job)
+ (define-key keymap "\C-c\C-t\C-x" #'texinfo-quit-job)
+ (define-key keymap "\C-c\C-t\C-l" #'tex-recenter-output-buffer)
+ (define-key keymap "\C-c\C-t\C-d" #'texinfo-delete-from-print-queue)
+ (define-key keymap "\C-c\C-t\C-q" #'tex-show-print-queue)
+ (define-key keymap "\C-c\C-t\C-p" #'texinfo-tex-print)
+ (define-key keymap "\C-c\C-t\C-v" #'texinfo-tex-view)
+ (define-key keymap "\C-c\C-t\C-i" #'texinfo-texindex)
+
+ (define-key keymap "\C-c\C-t\C-r" #'texinfo-tex-region)
+ (define-key keymap "\C-c\C-t\C-b" #'texinfo-tex-buffer))
;; Mode documentation displays commands in reverse order
;; from how they are listed in the texinfo-mode-map.
@@ -427,68 +235,68 @@ Subexpression 1 is what goes into the corresponding `@end' statement.")
;; bindings for `texnfo-tex.el'
(texinfo-define-common-keys map)
- (define-key map "\"" 'texinfo-insert-quote)
+ (define-key map "\"" #'texinfo-insert-quote)
;; bindings for `makeinfo.el'
- (define-key map "\C-c\C-m\C-k" 'kill-compilation)
+ (define-key map "\C-c\C-m\C-k" #'kill-compilation)
(define-key map "\C-c\C-m\C-l"
- 'makeinfo-recenter-compilation-buffer)
- (define-key map "\C-c\C-m\C-r" 'makeinfo-region)
- (define-key map "\C-c\C-m\C-b" 'makeinfo-buffer)
+ #'makeinfo-recenter-compilation-buffer)
+ (define-key map "\C-c\C-m\C-r" #'makeinfo-region)
+ (define-key map "\C-c\C-m\C-b" #'makeinfo-buffer)
;; bindings for `texinfmt.el'
- (define-key map "\C-c\C-e\C-r" 'texinfo-format-region)
- (define-key map "\C-c\C-e\C-b" 'texinfo-format-buffer)
+ (define-key map "\C-c\C-e\C-r" #'texinfo-format-region)
+ (define-key map "\C-c\C-e\C-b" #'texinfo-format-buffer)
;; AUCTeX-like bindings
- (define-key map "\e\r" 'texinfo-insert-@item)
+ (define-key map "\e\r" #'texinfo-insert-@item)
;; bindings for updating nodes and menus
- (define-key map "\C-c\C-um" 'texinfo-master-menu)
+ (define-key map "\C-c\C-um" #'texinfo-master-menu)
- (define-key map "\C-c\C-u\C-m" 'texinfo-make-menu)
- (define-key map "\C-c\C-u\C-n" 'texinfo-update-node)
- (define-key map "\C-c\C-u\C-e" 'texinfo-every-node-update)
- (define-key map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
+ (define-key map "\C-c\C-u\C-m" #'texinfo-make-menu)
+ (define-key map "\C-c\C-u\C-n" #'texinfo-update-node)
+ (define-key map "\C-c\C-u\C-e" #'texinfo-every-node-update)
+ (define-key map "\C-c\C-u\C-a" #'texinfo-all-menus-update)
- (define-key map "\C-c\C-s" 'texinfo-show-structure)
+ (define-key map "\C-c\C-s" #'texinfo-show-structure)
- (define-key map "\C-c}" 'up-list)
+ (define-key map "\C-c}" #'up-list)
;; FIXME: This is often used for "close block" aka texinfo-insert-@end.
- (define-key map "\C-c]" 'up-list)
- (define-key map "\C-c/" 'texinfo-insert-@end)
- (define-key map "\C-c{" 'texinfo-insert-braces)
+ (define-key map "\C-c]" #'up-list)
+ (define-key map "\C-c/" #'texinfo-insert-@end)
+ (define-key map "\C-c{" #'texinfo-insert-braces)
;; bindings for inserting strings
- (define-key map "\C-c\C-o" 'texinfo-insert-block)
- (define-key map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
- (define-key map "\C-c\C-c\C-s" 'texinfo-insert-@strong)
- (define-key map "\C-c\C-c\C-e" 'texinfo-insert-@emph)
-
- (define-key map "\C-c\C-cv" 'texinfo-insert-@var)
- (define-key map "\C-c\C-cu" 'texinfo-insert-@uref)
- (define-key map "\C-c\C-ct" 'texinfo-insert-@table)
- (define-key map "\C-c\C-cs" 'texinfo-insert-@samp)
- (define-key map "\C-c\C-cr" 'texinfo-insert-dwim-@ref)
- (define-key map "\C-c\C-cq" 'texinfo-insert-@quotation)
- (define-key map "\C-c\C-co" 'texinfo-insert-@noindent)
- (define-key map "\C-c\C-cn" 'texinfo-insert-@node)
- (define-key map "\C-c\C-cm" 'texinfo-insert-@email)
- (define-key map "\C-c\C-ck" 'texinfo-insert-@kbd)
- (define-key map "\C-c\C-ci" 'texinfo-insert-@item)
- (define-key map "\C-c\C-cf" 'texinfo-insert-@file)
- (define-key map "\C-c\C-cx" 'texinfo-insert-@example)
- (define-key map "\C-c\C-ce" 'texinfo-insert-@end)
- (define-key map "\C-c\C-cd" 'texinfo-insert-@dfn)
- (define-key map "\C-c\C-cc" 'texinfo-insert-@code)
+ (define-key map "\C-c\C-o" #'texinfo-insert-block)
+ (define-key map "\C-c\C-c\C-d" #'texinfo-start-menu-description)
+ (define-key map "\C-c\C-c\C-s" #'texinfo-insert-@strong)
+ (define-key map "\C-c\C-c\C-e" #'texinfo-insert-@emph)
+
+ (define-key map "\C-c\C-cv" #'texinfo-insert-@var)
+ (define-key map "\C-c\C-cu" #'texinfo-insert-@uref)
+ (define-key map "\C-c\C-ct" #'texinfo-insert-@table)
+ (define-key map "\C-c\C-cs" #'texinfo-insert-@samp)
+ (define-key map "\C-c\C-cr" #'texinfo-insert-dwim-@ref)
+ (define-key map "\C-c\C-cq" #'texinfo-insert-@quotation)
+ (define-key map "\C-c\C-co" #'texinfo-insert-@noindent)
+ (define-key map "\C-c\C-cn" #'texinfo-insert-@node)
+ (define-key map "\C-c\C-cm" #'texinfo-insert-@email)
+ (define-key map "\C-c\C-ck" #'texinfo-insert-@kbd)
+ (define-key map "\C-c\C-ci" #'texinfo-insert-@item)
+ (define-key map "\C-c\C-cf" #'texinfo-insert-@file)
+ (define-key map "\C-c\C-cx" #'texinfo-insert-@example)
+ (define-key map "\C-c\C-ce" #'texinfo-insert-@end)
+ (define-key map "\C-c\C-cd" #'texinfo-insert-@dfn)
+ (define-key map "\C-c\C-cc" #'texinfo-insert-@code)
;; bindings for environment movement
- (define-key map "\C-c." 'texinfo-to-environment-bounds)
- (define-key map "\C-c\C-c\C-f" 'texinfo-next-environment-end)
- (define-key map "\C-c\C-c\C-b" 'texinfo-previous-environment-end)
- (define-key map "\C-c\C-c\C-n" 'texinfo-next-environment-start)
- (define-key map "\C-c\C-c\C-p" 'texinfo-previous-environment-start)
+ (define-key map "\C-c." #'texinfo-to-environment-bounds)
+ (define-key map "\C-c\C-c\C-f" #'texinfo-next-environment-end)
+ (define-key map "\C-c\C-c\C-b" #'texinfo-previous-environment-end)
+ (define-key map "\C-c\C-c\C-n" #'texinfo-next-environment-start)
+ (define-key map "\C-c\C-c\C-p" #'texinfo-previous-environment-start)
map))
(easy-menu-define texinfo-mode-menu
@@ -628,7 +436,7 @@ value of `texinfo-mode-hook'."
(mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
texinfo-section-list))
(setq-local outline-regexp
- (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
+ (concat (regexp-opt (mapcar #'car outline-heading-alist) t)
"\\>"))
(setq-local tex-start-of-header "%\\*\\*start")
@@ -897,7 +705,7 @@ A numeric argument says how many words the braces should surround.
The default is not to surround any existing words with the braces."
nil
"@uref{" _ "}")
-(defalias 'texinfo-insert-@url 'texinfo-insert-@uref)
+(defalias 'texinfo-insert-@url #'texinfo-insert-@uref)
;;; Texinfo file structure
@@ -962,32 +770,27 @@ to jump to the corresponding spot in the Texinfo source file."
(defcustom texinfo-texi2dvi-command "texi2dvi"
"Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer."
- :type 'string
- :group 'texinfo)
+ :type 'string)
(defcustom texinfo-texi2dvi-options ""
"Command line options for `texinfo-texi2dvi-command'."
:type 'string
- :group 'texinfo
:version "28.1")
(defcustom texinfo-tex-command "tex"
"Command used by `texinfo-tex-region' to run TeX on a region."
- :type 'string
- :group 'texinfo)
+ :type 'string)
(defcustom texinfo-texindex-command "texindex"
"Command used by `texinfo-texindex' to sort unsorted index files."
- :type 'string
- :group 'texinfo)
+ :type 'string)
(defcustom texinfo-delete-from-print-queue-command "lprm"
"Command string used to delete a job from the line printer queue.
Command is used by \\[texinfo-delete-from-print-queue] based on
number provided by a previous \\[tex-show-print-queue]
command."
- :type 'string
- :group 'texinfo)
+ :type 'string)
(defvar texinfo-tex-trailer "@bye"
"String appended after a region sent to TeX by `texinfo-tex-region'.")
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index ea35641a6c6..f56f197c502 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -1,4 +1,4 @@
-;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files
+;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files -*- lexical-binding: t; -*-
;; Copyright (C) 1989-1992, 2001-2021 Free Software Foundation, Inc.
@@ -275,6 +275,7 @@ The keys are strings specifying the general hierarchical level in the
document; the values are regular expressions.")
+;;;###autoload
(defun texinfo-make-menu (&optional beginning end)
"Without any prefix argument, make or update a menu.
Make the menu for the section enclosing the node found following point.
@@ -351,6 +352,7 @@ at the level specified by LEVEL. Point is left at the end of menu."
(texinfo-delete-old-menu beginning first))
(texinfo-insert-menu new-menu-list node-name)))
+;;;###autoload
(defun texinfo-all-menus-update (&optional update-all-nodes-p)
"Update every regular menu in a Texinfo file.
Update pre-existing master menu, if there is one.
@@ -420,7 +422,7 @@ of the node if one is found; else do not move point."
"\\|" ; or
"\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any
"\\)?" ; end of expression
- (eval (cdr (assoc level texinfo-update-menu-lower-regexps))))
+ (eval (cdr (assoc level texinfo-update-menu-lower-regexps)) t))
;; the next higher level node marks the end of this
;; section, and no lower level node will be found beyond
;; this position even if region-end is farther off
@@ -454,7 +456,7 @@ if the match is found there, the value is t and point does not move."
"\\|" ; or
"\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any
"\\)?" ; end of expression
- (eval (cdr (assoc level texinfo-update-menu-higher-regexps))))
+ (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t))
region-end t)
(beginning-of-line) t)))))
@@ -505,7 +507,7 @@ The function finds entries of the same type. Thus `subsections' and
"\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any
"\\)?" ; end of expression
(eval
- (cdr (assoc level texinfo-update-menu-same-level-regexps))))
+ (cdr (assoc level texinfo-update-menu-same-level-regexps)) t))
search-end
t)
(goto-char (match-beginning 1)))))
@@ -733,6 +735,7 @@ is the menu entry name, and the cdr of P is the node name."
;;; Starting menu descriptions by inserting titles
+;;;###autoload
(defun texinfo-start-menu-description ()
"In this menu entry, insert the node's section title as a description.
Position point at beginning of description ready for editing.
@@ -742,7 +745,7 @@ You will need to edit the inserted text since a useful description
complements the node name rather than repeats it as a title does."
(interactive)
- (let (beginning end node-name title)
+ (let (beginning node-name title) ;; end
(save-excursion
(beginning-of-line)
(if (search-forward "* " (line-end-position) t)
@@ -817,6 +820,7 @@ complements the node name rather than repeats it as a title does."
;; Since the make-menu functions indent descriptions, these functions
;; are useful primarily for indenting a single menu specially.
+;;;###autoload
(defun texinfo-indent-menu-description (column &optional region-p)
"Indent every description in menu following point to COLUMN.
Non-nil argument (prefix, if interactive) means indent every
@@ -872,6 +876,7 @@ second and subsequent lines of a multi-line description."
;;; Making the master menu
+;;;###autoload
(defun texinfo-master-menu (update-all-nodes-menus-p)
"Make a master menu for a whole Texinfo file.
Remove pre-existing master menu, if there is one.
@@ -1033,7 +1038,7 @@ However, there does not need to be a title field."
(save-excursion
;; `master-menu-inserted-p' is a kludge to tell
- ;; whether to insert @end detailmenu (see bleow)
+ ;; whether to insert @end detailmenu (see below)
(let (master-menu-inserted-p)
;; Handle top of menu
(insert "\n@menu\n")
@@ -1219,7 +1224,7 @@ Only argument is a string of the general type of section."
"\\(^@ifnottex[ ]*\n\\)" ; ifnottex line, if any
"\\)?" ; end of expression
(eval
- (cdr (assoc level texinfo-update-menu-higher-regexps))))
+ (cdr (assoc level texinfo-update-menu-higher-regexps)) t))
nil
'goto-beginning)
(point))))))
@@ -1243,7 +1248,7 @@ string of the general type of section."
"\\)?" ; end of expression
(eval
;; Never finds end of level above chapter so goes to end.
- (cdr (assoc level texinfo-update-menu-higher-regexps))))
+ (cdr (assoc level texinfo-update-menu-higher-regexps)) t))
nil
'goto-end)
(match-beginning 1)
@@ -1266,6 +1271,7 @@ end of that region; it limits the search."
;;; Updating a node
+;;;###autoload
(defun texinfo-update-node (&optional beginning end)
"Without any prefix argument, update the node in which point is located.
Interactively, a prefix argument means to operate on the region.
@@ -1313,6 +1319,7 @@ which menu descriptions are indented. Its default value is 32."
(goto-char (point-max))
(message "Done...nodes updated in region. You may save the buffer."))))))
+;;;###autoload
(defun texinfo-every-node-update ()
"Update every node in a Texinfo file.
@@ -1430,7 +1437,7 @@ will be at some level higher in the Texinfo file. The fourth argument
"\\(^@ifnottex[ ]*\n\\)"
"\\)?")
(eval
- (cdr (assoc level texinfo-update-menu-same-level-regexps))))
+ (cdr (assoc level texinfo-update-menu-same-level-regexps)) t))
end
t)
'normal
@@ -1451,7 +1458,7 @@ will be at some level higher in the Texinfo file. The fourth argument
"\\(^@ifnottex[ ]*\n\\)"
"\\)?")
(eval
- (cdr (assoc level texinfo-update-menu-same-level-regexps)))
+ (cdr (assoc level texinfo-update-menu-same-level-regexps)) t)
"\\|"
;; Match node line.
"\\(^@node\\).*\n"
@@ -1465,7 +1472,7 @@ will be at some level higher in the Texinfo file. The fourth argument
"\\(^@ifnottex[ ]*\n\\)"
"\\)?")
(eval
- (cdr (assoc level texinfo-update-menu-higher-regexps)))
+ (cdr (assoc level texinfo-update-menu-higher-regexps)) t)
"\\|"
;; Handle `Top' node specially.
"^@node [ \t]*top[ \t]*\\(,\\|$\\)"
@@ -1489,7 +1496,7 @@ will be at some level higher in the Texinfo file. The fourth argument
"\\|"
"\\(^@ifnottex[ ]*\n\\)"
"\\)?")
- (eval (cdr (assoc level texinfo-update-menu-higher-regexps)))
+ (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t)
"\\|"
;; Handle `Top' node specially.
"^@node [ \t]*top[ \t]*\\(,\\|$\\)"
@@ -1553,6 +1560,7 @@ towards which the pointer is directed, one of `next', `previous', or `up'."
;; (The subsection to which `Next' points will most likely be the first
;; item on the section's menu.)
+;;;###autoload
(defun texinfo-sequential-node-update (&optional region-p)
"Update one node (or many) in a Texinfo file with sequential pointers.
@@ -1662,7 +1670,7 @@ or `Up' pointer."
'no-pointer))
((eq direction 'up)
(if (re-search-backward
- (eval (cdr (assoc level texinfo-update-menu-higher-regexps)))
+ (eval (cdr (assoc level texinfo-update-menu-higher-regexps)) t)
(point-min)
t)
'normal
@@ -1676,6 +1684,7 @@ or `Up' pointer."
;; before the `@chapter', `@section', and such like lines of a region
;; in a Texinfo file.
+;;;###autoload
(defun texinfo-insert-node-lines (beginning end &optional title-p)
"Insert missing `@node' lines in region of Texinfo file.
Non-nil argument (prefix, if interactive) means also to insert the
@@ -1686,7 +1695,7 @@ node names in pre-existing `@node' lines that lack names."
;; Use marker; after inserting node lines, leave point at end of
;; region and mark at beginning.
- (let (beginning-marker end-marker title last-section-position)
+ (let (end-marker title last-section-position) ;; beginning-marker
;; Save current position on mark ring and set mark to end.
(push-mark end t)
@@ -1989,6 +1998,7 @@ be the files included within it. A main menu must already exist."
;;; The multiple-file update function
+;;;###autoload
(defun texinfo-multiple-files-update
(outer-file &optional make-master-menu update-everything)
"Update first node pointers in each file included in OUTER-FILE;
@@ -2043,8 +2053,8 @@ chapter."
(let* ((included-file-list (texinfo-multi-file-included-list outer-file))
(files included-file-list)
- next-node-name
- previous-node-name
+ ;; next-node-name
+ ;; previous-node-name
;; Update the pointers and collect the names of the nodes and titles
(main-menu-list (texinfo-multi-file-update files update-everything)))
@@ -2112,8 +2122,10 @@ chapter."
(message "Multiple files updated."))
-
-;; Place `provide' at end of file.
(provide 'texnfo-upd)
+;; Local Variables:
+;; generated-autoload-file: "texinfo-loaddefs.el"
+;; End:
+
;;; texnfo-upd.el ends here
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 1432ab6a300..74c6d412a65 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -49,7 +49,7 @@
(modify-syntax-entry ?' "w p" st)
;; UAX #29 says HEBREW PUNCTUATION GERESH behaves like a letter
;; for the purposes of finding word boundaries.
- (modify-syntax-entry #x5f3 "w ") ; GERESH
+ (modify-syntax-entry #x5f3 "w " st) ; GERESH
;; UAX #29 says HEBREW PUNCTUATION GERSHAYIM should not be a word
;; boundary when surrounded by letters. Our infrastructure for
;; finding a word boundary doesn't support 3-character
@@ -57,45 +57,44 @@
;; character. This leaves a problem of having GERSHAYIM at the
;; beginning or end of a word, where it should be a boundary;
;; FIXME.
- (modify-syntax-entry #x5f4 "w ") ; GERSHAYIM
+ (modify-syntax-entry #x5f4 "w " st) ; GERSHAYIM
;; These all should not be a word boundary when between letters,
;; according to UAX #29, so they again are prone to the same
;; problem as GERSHAYIM; FIXME.
- (modify-syntax-entry #xb7 "w ") ; MIDDLE DOT
- (modify-syntax-entry #x2027 "w ") ; HYPHENATION POINT
- (modify-syntax-entry #xff1a "w ") ; FULLWIDTH COLON
+ (modify-syntax-entry #xb7 "w " st) ; MIDDLE DOT
+ (modify-syntax-entry #x2027 "w " st) ; HYPHENATION POINT
+ (modify-syntax-entry #xff1a "w " st) ; FULLWIDTH COLON
st)
"Syntax table used while in `text-mode'.")
(defvar text-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "\e\t" 'ispell-complete-word)
- (define-key map [menu-bar text]
- (cons "Text" (make-sparse-keymap "Text")))
- (bindings--define-key map [menu-bar text toggle-text-mode-auto-fill]
- '(menu-item "Auto Fill" toggle-text-mode-auto-fill
- :button (:toggle . (memq 'turn-on-auto-fill text-mode-hook))
- :help "Automatically fill text while typing in text modes (Auto Fill mode)"))
- (bindings--define-key map [menu-bar text paragraph-indent-minor-mode]
- '(menu-item "Paragraph Indent" paragraph-indent-minor-mode
- :button (:toggle . (bound-and-true-p paragraph-indent-minor-mode))
- :help "Toggle paragraph indent minor mode"))
- (bindings--define-key map [menu-bar text sep] menu-bar-separator)
- (bindings--define-key map [menu-bar text center-region]
- '(menu-item "Center Region" center-region
- :help "Center the marked region"
- :enable (region-active-p)))
- (bindings--define-key map [menu-bar text center-paragraph]
- '(menu-item "Center Paragraph" center-paragraph
- :help "Center the current paragraph"))
- (bindings--define-key map [menu-bar text center-line]
- '(menu-item "Center Line" center-line
- :help "Center the current line"))
+ (define-key map "\e\t" #'ispell-complete-word)
map)
"Keymap for `text-mode'.
Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode',
inherit all the commands defined in this map.")
+(easy-menu-define text-mode-menu text-mode-map
+ "Menu for `text-mode'."
+ '("Text"
+ ["Center Line" center-line
+ :help "Center the current line"]
+ ["Center Paragraph" center-paragraph
+ :help "Center the current paragraph"]
+ ["Center Region" center-region
+ :help "Center the marked region"
+ :enable (region-active-p)]
+ "---"
+ ["Paragraph Indent" paragraph-indent-minor-mode
+ :help "Toggle paragraph indent minor mode"
+ :style toggle
+ :selected (bound-and-true-p paragraph-indent-minor-mode)]
+ ["Auto Fill" toggle-text-mode-auto-fill
+ :help "Automatically fill text while typing in text modes (Auto Fill mode)"
+ :style toggle
+ :selected (memq 'turn-on-auto-fill text-mode-hook)]))
+
(define-derived-mode text-mode nil "Text"
"Major mode for editing text written for humans to read.
@@ -142,7 +141,7 @@ Turning on Paragraph-Indent minor mode runs the normal hook
(remove-function (local 'indent-line-function)
#'indent-to-left-margin)))
-(defalias 'indented-text-mode 'text-mode)
+(defalias 'indented-text-mode #'text-mode)
;; This can be made a no-op once all modes that use text-mode-hook
;; are "derived" from text-mode. (As of 2015/04, and probably well before,
@@ -169,8 +168,6 @@ both existing buffers and buffers that you subsequently create."
(if enable-mode "enabled" "disabled"))))
-(define-key facemenu-keymap "\eS" 'center-paragraph)
-
(defun center-paragraph ()
"Center each nonblank line in the paragraph at or after point.
See `center-line' for more info."
@@ -198,8 +195,6 @@ See `center-line' for more info."
(center-line))
(forward-line 1)))))
-(define-key facemenu-keymap "\es" 'center-line)
-
(defun center-line (&optional nlines)
"Center the line point is on, within the width specified by `fill-column'.
This means adjusting the indentation so that it equals
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index 33a976aa7b0..01e2ad72d88 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -66,7 +66,6 @@ non-capturing groups can be used for grouping prior to the part of the regexp
matching the white space). The pattern is matched case-sensitive regardless of
the value of `case-fold-search' setting."
:version "25.1"
- :group 'tildify
:type 'regexp
:safe t)
@@ -90,7 +89,6 @@ by the hard space character.
The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE. For this
mode, the item for the mode SYMBOL is looked up in the alist instead."
- :group 'tildify
:type '(repeat (cons :tag "Entry for major mode"
(choice (const :tag "Default" t)
(symbol :tag "Major mode"))
@@ -110,7 +108,6 @@ might be used for other modes if compatible encoding is used.
If nil, current major mode has no way to represent a hard space."
:version "25.1"
- :group 'tildify
:type '(choice (const :tag "Space character (no hard-space representation)"
" ")
(const :tag "No-break space (U+00A0)" "\u00A0")
@@ -133,7 +130,6 @@ STRING defines the hard space, which is inserted at places defined by
The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE. For this
mode, the item for the mode SYMBOL is looked up in the alist instead."
- :group 'tildify
:type '(repeat (cons :tag "Entry for major mode"
(choice (const :tag "Default" t)
(symbol :tag "Major mode"))
@@ -164,7 +160,6 @@ or better still:
See `tildify-foreach-ignore-environments' function for other ways to use the
variable."
:version "25.1"
- :group 'tildify
:type 'function)
(defcustom tildify-ignored-environments-alist ()
@@ -183,7 +178,6 @@ MAJOR-MODE defines major mode, for which the item applies. It can be either:
See `tildify-foreach-ignore-environments' function for description of BEG-REGEX
and END-REGEX."
- :group 'tildify
:type '(repeat
(cons :tag "Entry for major mode"
(choice (const :tag "Default" t)
@@ -295,7 +289,7 @@ variable. For example, for an XML file one might use:
(setq-local tildify-foreach-region-function
(apply-partially \\='tildify-foreach-ignore-environments
\\='((\"<! *--\" . \"-- *>\") (\"<\" . \">\"))))"
- (let ((beg-re (concat "\\(?:" (mapconcat 'car pairs "\\)\\|\\(?:") "\\)"))
+ (let ((beg-re (concat "\\(?:" (mapconcat #'car pairs "\\)\\|\\(?:") "\\)"))
p end-re)
(save-excursion
(save-restriction
@@ -416,19 +410,16 @@ If the pattern matches `looking-back', a hard space needs to be inserted instead
of a space at point. The regexp is always case sensitive, regardless of the
current `case-fold-search' setting."
:version "25.1"
- :group 'tildify
:type 'regexp)
(defcustom tildify-space-predicates '(tildify-space-region-predicate)
"A list of predicate functions for `tildify-space' function."
:version "25.1"
- :group 'tildify
:type '(repeat function))
(defcustom tildify-double-space-undos t
"Weather `tildify-space' should undo hard space when space is typed again."
:version "25.1"
- :group 'tildify
:type 'boolean)
;;;###autoload
@@ -495,7 +486,7 @@ that space character is replaced by a hard space specified by
When `tildify-mode' is enabled, if `tildify-string-alist' specifies a hard space
representation for current major mode, the `tildify-space-string' buffer-local
variable will be set to the representation."
- nil " ~" nil
+ :lighter " ~"
(when tildify-mode
(let ((space (with-suppressed-warnings ((obsolete
tildify--pick-alist-entry))
@@ -508,12 +499,10 @@ variable will be set to the representation."
"mode won't have any effect, disabling.")))
(setq tildify-mode nil))))
(if tildify-mode
- (add-hook 'post-self-insert-hook 'tildify-space nil t)
- (remove-hook 'post-self-insert-hook 'tildify-space t)))
+ (add-hook 'post-self-insert-hook #'tildify-space nil t)
+ (remove-hook 'post-self-insert-hook #'tildify-space t)))
-;;; *** Announce ***
-
(provide 'tildify)
;;; tildify.el ends here
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index d072ab16c3c..5a3a64ad79f 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -1,4 +1,4 @@
-;;; two-column.el --- minor mode for editing of two-column text
+;;; two-column.el --- minor mode for editing of two-column text -*- lexical-binding: t; -*-
;; Copyright (C) 1992-1995, 2001-2021 Free Software Foundation, Inc.
@@ -133,26 +133,22 @@
'("-%*- %15b --" (-3 . "%p") "--%[(" mode-name
minor-mode-alist "%n" mode-line-process ")%]%-")
"Value of `mode-line-format' for a buffer in two-column minor mode."
- :type 'sexp
- :group 'two-column)
+ :type 'sexp)
(defcustom 2C-other-buffer-hook 'text-mode
"Hook run in new buffer when it is associated with current one."
- :type 'function
- :group 'two-column)
+ :type 'function)
(defcustom 2C-separator ""
"A string inserted between the two columns when merging.
This gets set locally by \\[2C-split]."
- :type 'string
- :group 'two-column)
+ :type 'string)
(put '2C-separator 'permanent-local t)
(defcustom 2C-window-width 40
"The width of the first column. (Must be at least `window-min-width'.)
This value is local for every buffer that sets it."
- :type 'integer
- :group 'two-column)
+ :type 'integer)
(make-variable-buffer-local '2C-window-width)
(put '2C-window-width 'permanent-local t)
@@ -160,21 +156,19 @@ This value is local for every buffer that sets it."
"Base for calculating `fill-column' for a buffer in two-column minor mode.
The value of `fill-column' becomes `2C-window-width' for this buffer
minus this value."
- :type 'integer
- :group 'two-column)
+ :type 'integer)
(defcustom 2C-autoscroll t
"If non-nil, Emacs attempts to keep the two column's buffers aligned."
- :type 'boolean
- :group 'two-column)
+ :type 'boolean)
(defvar 2C-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "2" '2C-two-columns)
- (define-key map [f2] '2C-two-columns)
- (define-key map "b" '2C-associate-buffer)
- (define-key map "s" '2C-split)
+ (define-key map "2" #'2C-two-columns)
+ (define-key map [f2] #'2C-two-columns)
+ (define-key map "b" #'2C-associate-buffer)
+ (define-key map "s" #'2C-split)
map)
"Keymap for commands for setting up two-column mode.")
@@ -184,19 +178,19 @@ minus this value."
;; This one is for historical reasons and simple keyboards, it is not
;; at all mnemonic. All usual sequences containing 2 were used, and
;; f2 could not be set up in a standard way under Emacs 18.
-;;;###autoload (global-set-key "\C-x6" '2C-command)
+;;;###autoload (global-set-key "\C-x6" #'2C-command)
-;;;###autoload (global-set-key [f2] '2C-command)
+;;;###autoload (global-set-key [f2] #'2C-command)
(defvar 2C-minor-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map "1" '2C-merge)
- (define-key map "d" '2C-dissociate)
- (define-key map "o" '2C-associated-buffer)
- (define-key map "\^m" '2C-newline)
- (define-key map "|" '2C-toggle-autoscroll)
- (define-key map "{" '2C-shrink-window-horizontally)
- (define-key map "}" '2C-enlarge-window-horizontally)
+ (define-key map "1" #'2C-merge)
+ (define-key map "d" #'2C-dissociate)
+ (define-key map "o" #'2C-associated-buffer)
+ (define-key map "\^m" #'2C-newline)
+ (define-key map "|" #'2C-toggle-autoscroll)
+ (define-key map "{" #'2C-shrink-window-horizontally)
+ (define-key map "}" #'2C-enlarge-window-horizontally)
map)
"Keymap for commands for use in two-column mode.")
@@ -281,7 +275,7 @@ some prefix.
The appearance of the screen can be customized by the variables
`2C-window-width', `2C-beyond-fill-column', `2C-mode-line-format' and
`truncate-partial-width-windows'."
- (add-hook 'post-command-hook '2C-autoscroll nil t)
+ (add-hook 'post-command-hook #'2C-autoscroll nil t)
(setq fill-column (- 2C-window-width
2C-beyond-fill-column)
mode-line-format 2C-mode-line-format
@@ -325,16 +319,17 @@ first and the associated buffer to its right."
;;;###autoload
-(defun 2C-associate-buffer ()
- "Associate another buffer with this one in two-column minor mode.
+(defun 2C-associate-buffer (buffer)
+ "Associate another BUFFER with this one in two-column minor mode.
Can also be used to associate a just previously visited file, by
accepting the proposed default buffer.
\(See \\[describe-mode] .)"
- (interactive)
+ (interactive
+ (list (or (2C-other)
+ (read-buffer "Associate buffer: " (other-buffer)))))
(let ((b1 (current-buffer))
- (b2 (or (2C-other)
- (read-buffer "Associate buffer: " (other-buffer)))))
+ (b2 buffer))
(setq 2C-mode nil)
(with-current-buffer b2
(and (2C-other)