diff options
| author | Stefan Kangas | 2022-07-29 18:31:19 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-07-30 12:07:49 +0200 |
| commit | 454c06a22c8b2ddb177d2e613807fc206ba29da7 (patch) | |
| tree | 58633836c434a64af8de42adbe77068274564925 | |
| parent | 9bdcca553f89838c45006ef869a7a10d4ad41262 (diff) | |
| download | emacs-454c06a22c8b2ddb177d2e613807fc206ba29da7.tar.gz emacs-454c06a22c8b2ddb177d2e613807fc206ba29da7.zip | |
Fix namespace use in bib-mode.el
* lisp/textmodes/bib-mode.el (bib-unread-file, bib-add)
(bib-return-key, bib-mark, bib-unread): Rename from
'unread-bib-file', 'addbib', 'return-key-bib', 'mark-bib', and
'unread-bib' respectively. Maintain old names as obsolete aliases and
update uses.
(bib-mode-map): Prefer defvar-keymap.
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/textmodes/bib-mode.el | 68 |
2 files changed, 45 insertions, 33 deletions
| @@ -2182,6 +2182,16 @@ instead of also trying to ping it. Customize the user option | |||
| 2182 | *** The 'run-dig' command is now obsolete; use 'dig' instead. | 2182 | *** The 'run-dig' command is now obsolete; use 'dig' instead. |
| 2183 | 2183 | ||
| 2184 | --- | 2184 | --- |
| 2185 | *** Some `bib-mode' commands and variables have been renamed. | ||
| 2186 | To respect Emacs naming conventions, the variable 'unread-bib-file' | ||
| 2187 | has been renamed to 'bib-unread-file'. The following commands have | ||
| 2188 | also been renamed: | ||
| 2189 | 'addbib' to 'bib-add' | ||
| 2190 | 'return-key-bib' to 'bib-return-key' | ||
| 2191 | 'mark-bib' to 'bib-mark' | ||
| 2192 | 'unread-bib' to 'bib-unread' | ||
| 2193 | |||
| 2194 | --- | ||
| 2185 | ** The autoarg.el library is now marked obsolete. | 2195 | ** The autoarg.el library is now marked obsolete. |
| 2186 | This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor | 2196 | This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor |
| 2187 | modes to emulate the behavior of the historical editor Twenex Emacs. | 2197 | modes to emulate the behavior of the historical editor Twenex Emacs. |
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el index 6168fed6c8b..21a4dc751a0 100644 --- a/lisp/textmodes/bib-mode.el +++ b/lisp/textmodes/bib-mode.el | |||
| @@ -24,12 +24,10 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; GNU Emacs code to help maintain databases compatible with (troff) | 27 | ;; GNU Emacs code to help maintain databases compatible with (troff) |
| 28 | ;; refer and lookbib. The file bib-file should be set to your | 28 | ;; refer and lookbib. The file `bib-file' should be set to your |
| 29 | ;; bibliography file. Keys are automagically inserted as you type, | 29 | ;; bibliography file. Keys are automagically inserted as you type, |
| 30 | ;; and appropriate keys are presented for various kinds of entries. | 30 | ;; and appropriate keys are presented for various kinds of entries. |
| 31 | |||
| 32 | ;; FIXME: Fix the namespace use of this library. | ||
| 33 | 31 | ||
| 34 | ;;; Code: | 32 | ;;; Code: |
| 35 | 33 | ||
| @@ -40,23 +38,23 @@ | |||
| 40 | :group 'text) | 38 | :group 'text) |
| 41 | 39 | ||
| 42 | (defcustom bib-file "~/my-bibliography.bib" | 40 | (defcustom bib-file "~/my-bibliography.bib" |
| 43 | "Default name of file used by `addbib'." | 41 | "Default name of file used by `bib-add'." |
| 44 | :type 'file) | 42 | :type 'file) |
| 45 | 43 | ||
| 46 | (defcustom unread-bib-file "~/to-be-read.bib" | 44 | (define-obsolete-variable-alias 'unread-bib-file 'bib-unread-file "29.1") |
| 47 | "Default name of file used by `unread-bib' in Bib mode." | 45 | (defcustom bib-unread-file "~/to-be-read.bib" |
| 48 | :type 'file) | 46 | "Default name of file used by `bib-unread' in Bib mode." |
| 47 | :type 'file | ||
| 48 | :version "29.1") | ||
| 49 | 49 | ||
| 50 | (defvar bib-mode-map | 50 | (defvar-keymap bib-mode-map |
| 51 | (let ((map (make-sparse-keymap))) | 51 | :parent text-mode-map |
| 52 | (set-keymap-parent map text-mode-map) | 52 | "RET" #'bib-return-key |
| 53 | (define-key map "\C-M" #'return-key-bib) | 53 | "C-c C-u" #'bib-unread |
| 54 | (define-key map "\C-c\C-u" #'unread-bib) | 54 | "C-c C-@" #'bib-mark |
| 55 | (define-key map "\C-c\C-@" #'mark-bib) | 55 | "M-`" #'abbrev-mode) |
| 56 | (define-key map "\e`" #'abbrev-mode) | ||
| 57 | map)) | ||
| 58 | 56 | ||
| 59 | (defun addbib () | 57 | (defun bib-add () |
| 60 | "Set up editor to add to troff bibliography file specified | 58 | "Set up editor to add to troff bibliography file specified |
| 61 | by global variable `bib-file'. See description of `bib-mode'." | 59 | by global variable `bib-file'. See description of `bib-mode'." |
| 62 | (interactive) | 60 | (interactive) |
| @@ -87,10 +85,10 @@ R eport number or `phd thesis' or `masters thesis' or `draft' or | |||
| 87 | W here can be found locally (login name, or ailib, etc.) | 85 | W here can be found locally (login name, or ailib, etc.) |
| 88 | X comments (not used in indexing) | 86 | X comments (not used in indexing) |
| 89 | 87 | ||
| 90 | \\[unread-bib] appends current entry to a different file (for example, | 88 | \\[bib-unread] appends current entry to a different file (for example, |
| 91 | a file of papers to be read in the future), given by the value of the | 89 | a file of papers to be read in the future), given by the value of the |
| 92 | variable `unread-bib-file'. | 90 | variable `bib-unread-file'. |
| 93 | \\[mark-bib] marks current or previous entry. | 91 | \\[bib-mark] marks current or previous entry. |
| 94 | Abbreviations are saved in `bib-mode-abbrev-table'. | 92 | Abbreviations are saved in `bib-mode-abbrev-table'. |
| 95 | Hook can be stored in `bib-mode-hook'. | 93 | Hook can be stored in `bib-mode-hook'. |
| 96 | Field keys given by variable `bib-assoc'. | 94 | Field keys given by variable `bib-assoc'. |
| @@ -142,7 +140,7 @@ with the cdr.") | |||
| 142 | 140 | ||
| 143 | (defconst bib-capitalized-fields "%[AETCBIJR]") | 141 | (defconst bib-capitalized-fields "%[AETCBIJR]") |
| 144 | 142 | ||
| 145 | (defun return-key-bib () | 143 | (defun bib-return-key () |
| 146 | "Magic when user hits return, used by `bib-mode'." | 144 | "Magic when user hits return, used by `bib-mode'." |
| 147 | (interactive) | 145 | (interactive) |
| 148 | (if (eolp) | 146 | (if (eolp) |
| @@ -172,7 +170,7 @@ with the cdr.") | |||
| 172 | (insert new-key)) | 170 | (insert new-key)) |
| 173 | (newline))) | 171 | (newline))) |
| 174 | 172 | ||
| 175 | (defun mark-bib () | 173 | (defun bib-mark () |
| 176 | "Set mark at beginning of current or previous bib entry, point at end." | 174 | "Set mark at beginning of current or previous bib entry, point at end." |
| 177 | (interactive) | 175 | (interactive) |
| 178 | (beginning-of-line nil) | 176 | (beginning-of-line nil) |
| @@ -185,14 +183,14 @@ with the cdr.") | |||
| 185 | (forward-line 1) | 183 | (forward-line 1) |
| 186 | (beginning-of-line nil)) | 184 | (beginning-of-line nil)) |
| 187 | 185 | ||
| 188 | (defun unread-bib () | 186 | (defun bib-unread () |
| 189 | "Append current or previous entry to file of unread papers | 187 | "Append current or previous entry to file of unread papers |
| 190 | named by variable `unread-bib-file'." | 188 | named by variable `bib-unread-file'." |
| 191 | (interactive) | 189 | (interactive) |
| 192 | (mark-bib) | 190 | (bib-mark) |
| 193 | (if (get-file-buffer unread-bib-file) | 191 | (if (get-file-buffer bib-unread-file) |
| 194 | (append-to-buffer (get-file-buffer unread-bib-file) (mark) (point)) | 192 | (append-to-buffer (get-file-buffer bib-unread-file) (mark) (point)) |
| 195 | (append-to-file (mark) (point) unread-bib-file))) | 193 | (append-to-file (mark) (point) bib-unread-file))) |
| 196 | 194 | ||
| 197 | 195 | ||
| 198 | (defvar bib-capitalize-title-stop-words | 196 | (defvar bib-capitalize-title-stop-words |
| @@ -226,7 +224,6 @@ named by variable `unread-bib-file'." | |||
| 226 | )) | 224 | )) |
| 227 | (set-syntax-table orig-syntax-table)))) | 225 | (set-syntax-table orig-syntax-table)))) |
| 228 | 226 | ||
| 229 | |||
| 230 | (defun bib-capitalize-title (s) | 227 | (defun bib-capitalize-title (s) |
| 231 | "Like `capitalize', but don't capitalize stop words, except the first." | 228 | "Like `capitalize', but don't capitalize stop words, except the first." |
| 232 | (with-current-buffer (get-buffer-create "$$$Scratch$$$") | 229 | (with-current-buffer (get-buffer-create "$$$Scratch$$$") |
| @@ -235,6 +232,11 @@ named by variable `unread-bib-file'." | |||
| 235 | (bib-capitalize-title-region (point-min) (point-max)) | 232 | (bib-capitalize-title-region (point-min) (point-max)) |
| 236 | (buffer-string))) | 233 | (buffer-string))) |
| 237 | 234 | ||
| 235 | (define-obsolete-function-alias 'addbib #'bib-add "29.1") | ||
| 236 | (define-obsolete-function-alias 'return-key-bib #'bib-return-key "29.1") | ||
| 237 | (define-obsolete-function-alias 'mark-bib #'bib-mark "29.1") | ||
| 238 | (define-obsolete-function-alias 'unread-bib #'bib-unread "29.1") | ||
| 239 | |||
| 238 | (provide 'bib-mode) | 240 | (provide 'bib-mode) |
| 239 | 241 | ||
| 240 | ;;; bib-mode.el ends here | 242 | ;;; bib-mode.el ends here |