[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1e9c9eb: Unbind `M-o' and add new `C-x x f' binding
From: |
Lars Ingebrigtsen |
Subject: |
master 1e9c9eb: Unbind `M-o' and add new `C-x x f' binding |
Date: |
Thu, 18 Mar 2021 00:10:43 -0400 (EDT) |
branch: master
commit 1e9c9ebee3e13773400fe93bf26db923a880be6d
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Unbind `M-o' and add new `C-x x f' binding
* doc/lispref/modes.texi (Other Font Lock Variables):
`font-lock-fontify-block' is no longer bound.
* lisp/bindings.el (ctl-x-x-map): Bind `font-lock-update'.
* lisp/font-lock.el (font-lock-update): New command written by
Gregory Heytings <gregory@heytings.org>.
* lisp/loadup.el: Remove transitional experimental code.
---
doc/lispref/modes.texi | 3 +--
etc/NEWS | 7 ++++++-
lisp/bindings.el | 1 +
lisp/font-lock.el | 12 ++++++++++++
lisp/loadup.el | 23 -----------------------
5 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index e1299b5..6cf4dd2 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3247,8 +3247,7 @@ set by means of @var{other-vars} in
@code{font-lock-defaults}
@defvar font-lock-mark-block-function
If this variable is non-@code{nil}, it should be a function that is
called with no arguments, to choose an enclosing range of text for
-refontification for the command @kbd{M-o M-o}
-(@code{font-lock-fontify-block}).
+refontification for the command @kbd{M-x font-lock-fontify-block}.
The function should report its choice by placing the region around it.
A good choice is a range of text large enough to give proper results,
diff --git a/etc/NEWS b/etc/NEWS
index 27a4766..ba82174 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,6 +93,10 @@ useful on systems such as FreeBSD which ships only with
"etc/termcap".
* Changes in Emacs 28.1
++++
+** New command 'font-lock-update', bound to 'C-x x f'.
+This command updates the syntax highlighting in this buffer.
+
** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA.
+++
@@ -2254,7 +2258,8 @@ first).
Use 'M-x center-line' and 'M-x center-paragraph' instead.
** The 'M-o M-o' global binding have been removed.
-Use 'M-x font-lock-fontify-block' instead.
+Use 'M-x font-lock-fontify-block' instead, or the new `C-x x f'
+command, which toggles fontification in the current buffer.
** In 'f90-mode', the backslash character ('\') no longer escapes.
For about a decade, the backslash character has no longer had a
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 7111ae6..a502373 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1432,6 +1432,7 @@ if `inhibit-field-text-motion' is non-nil."
(defvar ctl-x-x-map
(let ((map (make-sparse-keymap)))
+ (define-key map "f" #'font-lock-update)
(define-key map "g" #'revert-buffer)
(define-key map "r" #'rename-buffer)
(define-key map "u" #'rename-uniquely)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index c344a61..82915d8 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1120,6 +1120,18 @@ portion of the buffer."
(funcall font-lock-ensure-function
(or beg (point-min)) (or end (point-max)))))
+(defun font-lock-update (&optional arg)
+ "Updates the syntax highlighting in this buffer.
+Refontify the accessible portion of this buffer, or enable Font Lock mode
+in this buffer if it is currently disabled. With prefix ARG, toggle Font
+Lock mode."
+ (interactive "P")
+ (save-excursion
+ (if (and (not arg) font-lock-mode)
+ (font-lock-fontify-region (point-min) (point-max))
+ (font-lock-unfontify-region (point-min) (point-max))
+ (font-lock-mode 'toggle))))
+
(defun font-lock-default-fontify-buffer ()
"Fontify the whole buffer using `font-lock-fontify-region-function'."
(let ((verbose (if (numberp font-lock-verbose)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 1c385e3..863afe4 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -477,29 +477,6 @@ lost after dumping")))
(setq redisplay--inhibit-bidi nil)
-;; Experimental feature removal.
-(define-key global-map "\M-o" #'removed-facemenu-command)
-
-(defun removed-facemenu-command ()
- "Transition command during test period for facemenu removal."
- (interactive)
- (switch-to-buffer "*Facemenu Removal*")
- (let ((inhibit-read-only t))
- (erase-buffer)
- (insert-file-contents
- (expand-file-name "facemenu-removal.txt" data-directory)))
- (goto-char (point-min))
- (special-mode))
-
-(defun facemenu-keymap-restore ()
- "Restore the facemenu keymap."
- ;; Global bindings:
- (define-key global-map [C-down-mouse-2] 'facemenu-menu)
- (define-key global-map "\M-o" 'facemenu-keymap)
- (define-key facemenu-keymap "\eS" 'center-paragraph)
- (define-key facemenu-keymap "\es" 'center-line)
- (define-key facemenu-keymap "\M-o" 'font-lock-fontify-block))
-
(if dump-mode
(let ((output (cond ((equal dump-mode "pdump") "emacs.pdmp")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1e9c9eb: Unbind `M-o' and add new `C-x x f' binding,
Lars Ingebrigtsen <=