mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08: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:
parent
824ae5faee
commit
6d61d6018c
2 changed files with 22 additions and 3 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -2444,6 +2444,11 @@ remote host are shown. Alternatively, the user option
|
||||||
*** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
|
*** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'.
|
||||||
The old name is still available as an obsolete function alias.
|
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
|
* New Modes and Packages in Emacs 29.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
|
;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 1985-1987, 1992, 2001-2022 Free Software Foundation,
|
;; Copyright (C) 1985-2022 Free Software Foundation, Inc.
|
||||||
;; Inc.
|
|
||||||
|
|
||||||
;; Maintainer: emacs-devel@gnu.org
|
;; Maintainer: emacs-devel@gnu.org
|
||||||
;; Keywords: abbrev convenience
|
;; Keywords: abbrev convenience
|
||||||
|
|
@ -1220,13 +1219,28 @@ SORTFUN is passed to `sort' to change the default ordering."
|
||||||
(sort entries (lambda (x y)
|
(sort entries (lambda (x y)
|
||||||
(funcall sortfun (nth 2 x) (nth 2 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
|
;; Keep it after define-abbrev-table, since define-derived-mode uses
|
||||||
;; define-abbrev-table.
|
;; define-abbrev-table.
|
||||||
(define-derived-mode edit-abbrevs-mode fundamental-mode "Edit-Abbrevs"
|
(define-derived-mode edit-abbrevs-mode fundamental-mode "Edit-Abbrevs"
|
||||||
"Major mode for editing the list of abbrev definitions.
|
"Major mode for editing the list of abbrev definitions.
|
||||||
This mode is for editing abbrevs in a buffer prepared by `edit-abbrevs',
|
This mode is for editing abbrevs in a buffer prepared by `edit-abbrevs',
|
||||||
which see."
|
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)
|
(defun abbrev--possibly-save (query &optional arg)
|
||||||
;; Query mode.
|
;; Query mode.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue