From 166812addb0a1b9b2258ef3ce76424cd7facfa8b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 12 Sep 2015 00:30:02 -0400 Subject: [PATCH] Bind inhibit-modification-hooks rather than a/b-c-f * lisp/wid-edit.el (widget-editable-list-insert-before) (widget-editable-list-delete-at): * lisp/progmodes/cperl-mode.el (cperl-find-pods-heres) (cperl-font-lock-unfontify-region-function): * lisp/progmodes/antlr-mode.el (save-buffer-state-x): * lisp/obsolete/longlines.el (longlines-mode): * lisp/obsolete/fast-lock.el (save-buffer-state): * lisp/mouse.el (mouse-save-then-kill-delete-region): * lisp/gnus/message.el (message-hide-headers): * lisp/eshell/esh-mode.el (eshell-send-input, eshell-output-filter): * lisp/ibuffer.el (ibuffer-update-title-and-summary) (ibuffer-redisplay-engine): Bind inhibit-modification-hooks to t rather than after/before-change-functions to nil. --- lisp/eshell/esh-mode.el | 7 ++++--- lisp/gnus/message.el | 2 +- lisp/ibuffer.el | 4 ++-- lisp/international/isearch-x.el | 1 + lisp/mouse.el | 4 ++-- lisp/obsolete/fast-lock.el | 2 +- lisp/obsolete/longlines.el | 4 ++-- lisp/progmodes/antlr-mode.el | 2 +- lisp/progmodes/cperl-mode.el | 4 ++-- lisp/wid-edit.el | 9 +++------ 10 files changed, 19 insertions(+), 20 deletions(-) diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 22ccf4e91f9..3df820d5956 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -627,10 +627,11 @@ newline." (let ((proc-running-p (and (eshell-interactive-process) (not queue-p))) (inhibit-point-motion-hooks t) - after-change-functions) + (inhibit-modification-hooks t)) (unless (and proc-running-p (not (eq (process-status - (eshell-interactive-process)) 'run))) + (eshell-interactive-process)) + 'run))) (if (or proc-running-p (>= (point) eshell-last-output-end)) (goto-char (point-max)) @@ -697,7 +698,7 @@ This is done after all necessary filtering has been done." (let ((oprocbuf (if process (process-buffer process) (current-buffer))) (inhibit-point-motion-hooks t) - after-change-functions) + (inhibit-modification-hooks t)) (let ((functions eshell-preoutput-filter-functions)) (while (and functions string) (setq string (funcall (car functions) string)) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 5ede15b0538..13ed8c05809 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8329,7 +8329,7 @@ From headers in the original article." (list message-hidden-headers) message-hidden-headers)) (inhibit-point-motion-hooks t) - (after-change-functions nil) + (inhibit-modification-hooks t) (end-of-headers (point-min))) (when regexps (save-excursion diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 718471b7993..dc34a63aba9 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2037,7 +2037,7 @@ the value of point at the beginning of the line for that buffer." (defun ibuffer-update-title-and-summary (format) (ibuffer-assert-ibuffer-mode) ;; Don't do funky font-lock stuff here - (let ((after-change-functions nil)) + (let ((inhibit-modification-hooks t)) (if (get-text-property (point-min) 'ibuffer-title) (delete-region (point-min) (next-single-property-change @@ -2244,7 +2244,7 @@ If optional arg SILENT is non-nil, do not display progress messages." (orig (count-lines (point-min) (point))) ;; Inhibit font-lock caching tricks, since we're modifying the ;; entire buffer at once - (after-change-functions nil) + (inhibit-modification-hooks t) (ext-loaded (featurep 'ibuf-ext)) (bgroups (if ext-loaded (ibuffer-generate-filter-groups bmarklist) diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el index 31f841d7b56..92e55220375 100644 --- a/lisp/international/isearch-x.el +++ b/lisp/international/isearch-x.el @@ -71,6 +71,7 @@ (defun isearch-with-keyboard-coding () (interactive) + ;; FIXME: What does this after-change-functions binding do here? (let ((after-change-functions '(isearch-exit-recursive-edit))) (recursive-edit)) (exit-minibuffer)) diff --git a/lisp/mouse.el b/lisp/mouse.el index 6584733a860..d6ce31a7a53 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1111,12 +1111,12 @@ This does not delete the region; it acts like \\[kill-ring-save]." ;; Delete, but make the undo-list entry share with the kill ring. ;; First, delete just one char, so in case buffer is being modified ;; for the first time, the undo list records that fact. - (let (before-change-functions after-change-functions) + (let ((inhibit-modification-hooks t)) (delete-region beg (+ beg (if (> end beg) 1 -1)))) (let ((buffer-undo-list buffer-undo-list)) ;; Undo that deletion--but don't change the undo list! - (let (before-change-functions after-change-functions) + (let ((inhibit-modification-hooks t)) (primitive-undo 1 buffer-undo-list)) ;; Now delete the rest of the specified region, ;; but don't record it. diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el index 7e3dd66a56a..3985d511eac 100644 --- a/lisp/obsolete/fast-lock.el +++ b/lisp/obsolete/fast-lock.el @@ -200,7 +200,7 @@ `(let* (,@(append varlist '((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-point-motion-hooks t) - before-change-functions after-change-functions + (inhibit-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename))) ,@body (when (and (not modified) (buffer-modified-p)) diff --git a/lisp/obsolete/longlines.el b/lisp/obsolete/longlines.el index 01939daa709..7cb13ce600f 100644 --- a/lisp/obsolete/longlines.el +++ b/lisp/obsolete/longlines.el @@ -143,7 +143,7 @@ newlines are indicated with a symbol." 'longlines-window-change-function nil t)) (let ((buffer-undo-list t) (inhibit-read-only t) - (after-change-functions nil) + (inhibit-modification-hooks t) (mod (buffer-modified-p)) buffer-file-name buffer-file-truename) ;; Turning off undo is OK since (spaces + newlines) is @@ -184,7 +184,7 @@ newlines are indicated with a symbol." (if longlines-showing (longlines-unshow-hard-newlines)) (let ((buffer-undo-list t) - (after-change-functions nil) + (inhibit-modification-hooks t) (inhibit-read-only t) buffer-file-name buffer-file-truename) (if longlines-decoded diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index d59948e6447..2d9bd487bb9 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -171,7 +171,7 @@ (let ((buffer-undo-list t) (inhibit-read-only t) ,@(unless (featurep 'xemacs) '((inhibit-point-motion-hooks t) deactivate-mark)) - before-change-functions after-change-functions + (inhibit-modification-hooks t) buffer-file-name buffer-file-truename) ,@body) (and (not ,modified) (buffer-modified-p) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index b8ba170a246..5da65084712 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -3672,7 +3672,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face', is-REx is-x-REx REx-subgr-start REx-subgr-end was-subgr i2 hairy-RE (case-fold-search nil) (inhibit-read-only t) (buffer-undo-list t) (modified (buffer-modified-p)) overshoot is-o-REx name - (after-change-functions nil) + (inhibit-modification-hooks t) (cperl-font-locking t) (use-syntax-state (and cperl-syntax-state (>= min (car cperl-syntax-state)))) @@ -8882,7 +8882,7 @@ Delay of auto-help controlled by `cperl-lazy-help-time'." (defun cperl-font-lock-unfontify-region-function (beg end) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-point-motion-hooks t) - before-change-functions after-change-functions + (inhibit-modification-hooks t) deactivate-mark buffer-file-name buffer-file-truename) (remove-text-properties beg end '(face nil)) (if (and (not modified) (buffer-modified-p)) diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index b64de4759d7..0d9157a5575 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -2654,8 +2654,7 @@ Return an alist of (TYPE MATCH)." (save-excursion (let ((children (widget-get widget :children)) (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (cond (before (goto-char (widget-get before :entry-from))) (t @@ -2679,8 +2678,7 @@ Return an alist of (TYPE MATCH)." (let ((buttons (copy-sequence (widget-get widget :buttons))) button (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (while buttons (setq button (car buttons) buttons (cdr buttons)) @@ -2691,8 +2689,7 @@ Return an alist of (TYPE MATCH)." (let ((entry-from (widget-get child :entry-from)) (entry-to (widget-get child :entry-to)) (inhibit-read-only t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t)) (widget-delete child) (delete-region entry-from entry-to) (set-marker entry-from nil) -- 2.11.4.GIT