1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-06 20:49:33 +00:00

Add rudimentary font-locking to edit-abbrevs-mode

* lisp/abbrev.el (abbrev-table-name): New face.
(edit-abbrevs-mode-font-lock-keywords): New defvar.
(edit-abbrevs-mode): Support font-locking.
This commit is contained in:
Stefan Kangas 2022-09-15 11:27:57 +02:00
parent 824ae5faee
commit 6d61d6018c
2 changed files with 22 additions and 3 deletions

View File

@ -2444,6 +2444,11 @@ remote host are shown. Alternatively, the user option
*** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
The old name is still available as an obsolete function alias.
---
*** 'edit-abbrevs' now uses font-locking.
The new face 'abbrev-table-name' is used to display the abbrev table
name.
* New Modes and Packages in Emacs 29.1

View File

@ -1,7 +1,6 @@
;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
;; Copyright (C) 1985-1987, 1992, 2001-2022 Free Software Foundation,
;; Inc.
;; Copyright (C) 1985-2022 Free Software Foundation, Inc.
;; Maintainer: emacs-devel@gnu.org
;; Keywords: abbrev convenience
@ -1220,13 +1219,28 @@ SORTFUN is passed to `sort' to change the default ordering."
(sort entries (lambda (x y)
(funcall sortfun (nth 2 x) (nth 2 y)))))))
(defface abbrev-table-name
'((t :inherit font-lock-function-name-face))
"Face used for displaying the abbrev table name in `edit-abbrev-mode'."
:version "29.1")
(defvar edit-abbrevs-mode-font-lock-keywords
`((,(rx bol "("
;; lisp-mode-symbol-regexp
(regexp "\\(?:\\sw\\|\\s_\\|\\\\.\\)+")
")" eol)
0 'abbrev-table-name)))
;; Keep it after define-abbrev-table, since define-derived-mode uses
;; define-abbrev-table.
(define-derived-mode edit-abbrevs-mode fundamental-mode "Edit-Abbrevs"
"Major mode for editing the list of abbrev definitions.
This mode is for editing abbrevs in a buffer prepared by `edit-abbrevs',
which see."
:interactive nil)
:interactive nil
(setq-local font-lock-defaults
'(edit-abbrevs-mode-font-lock-keywords nil nil ((?_ . "w"))))
(setq font-lock-multiline nil))
(defun abbrev--possibly-save (query &optional arg)
;; Query mode.