diff options
| author | Stefan Monnier | 2015-11-15 14:04:30 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2015-11-15 14:04:30 -0500 |
| commit | 353f5e76641c338dc4bfe0ac8e9aa84d23bac1fe (patch) | |
| tree | 38206b3d36de1899b691145563344194351cf881 | |
| parent | 70f1fda4ae6abb5e11dcf281738c25f6f5b06061 (diff) | |
| download | emacs-353f5e76641c338dc4bfe0ac8e9aa84d23bac1fe.tar.gz emacs-353f5e76641c338dc4bfe0ac8e9aa84d23bac1fe.zip | |
* lisp/progmodes/verilog-mode.el: Use with-silent-modifications
(verilog-save-buffer-state): Use with-silent-modifications when available.
(verilog-save-font-no-change-functions): Don't bind
before/after-change-functions if it's not needed.
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 5e03cf4dd6b..fa93633db12 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -3234,23 +3234,27 @@ A change is considered significant if it affects the buffer text | |||
| 3234 | in any way that isn't completely restored again. Any | 3234 | in any way that isn't completely restored again. Any |
| 3235 | user-visible changes to the buffer must not be within a | 3235 | user-visible changes to the buffer must not be within a |
| 3236 | `verilog-save-buffer-state'." | 3236 | `verilog-save-buffer-state'." |
| 3237 | ;; From c-save-buffer-state | 3237 | `(let ((inhibit-point-motion-hooks t) |
| 3238 | `(let* ((modified (buffer-modified-p)) | 3238 | (verilog-no-change-functions t)) |
| 3239 | (buffer-undo-list t) | 3239 | ,(if (fboundp 'with-silent-modifications) |
| 3240 | (inhibit-read-only t) | 3240 | (with-silent-modifications ,@body) |
| 3241 | (inhibit-point-motion-hooks t) | 3241 | ;; From c-save-buffer-state |
| 3242 | (inhibit-modification-hooks t) | 3242 | `(let* ((modified (buffer-modified-p)) |
| 3243 | (verilog-no-change-functions t) | 3243 | (buffer-undo-list t) |
| 3244 | before-change-functions ; XEmacs ignores inhibit-modification-hooks | 3244 | (inhibit-read-only t) |
| 3245 | after-change-functions ; XEmacs ignores inhibit-modification-hooks | 3245 | (inhibit-modification-hooks t) |
| 3246 | deactivate-mark | 3246 | ;; XEmacs ignores inhibit-modification-hooks. |
| 3247 | buffer-file-name ; Prevent primitives checking | 3247 | before-change-functions after-change-functions |
| 3248 | buffer-file-truename) ; for file modification | 3248 | deactivate-mark |
| 3249 | (unwind-protect | 3249 | buffer-file-name ; Prevent primitives checking |
| 3250 | (progn ,@body) | 3250 | buffer-file-truename) ; for file modification |
| 3251 | (and (not modified) | 3251 | (unwind-protect |
| 3252 | (buffer-modified-p) | 3252 | (progn ,@body) |
| 3253 | (verilog-restore-buffer-modified-p nil))))) | 3253 | (and (not modified) |
| 3254 | (buffer-modified-p) | ||
| 3255 | (if (fboundp 'restore-buffer-modified-p) | ||
| 3256 | (restore-buffer-modified-p nil) | ||
| 3257 | (set-buffer-modified-p nil)))))))) | ||
| 3254 | 3258 | ||
| 3255 | 3259 | ||
| 3256 | (defvar verilog-save-font-mod-hooked nil | 3260 | (defvar verilog-save-font-mod-hooked nil |
| @@ -3271,6 +3275,8 @@ For insignificant changes, see instead `verilog-save-buffer-state'." | |||
| 3271 | ;; Therefore we must remove and restore font-lock mode | 3275 | ;; Therefore we must remove and restore font-lock mode |
| 3272 | (verilog-run-hooks 'verilog-before-save-font-hook) | 3276 | (verilog-run-hooks 'verilog-before-save-font-hook) |
| 3273 | (let* ((verilog-save-font-mod-hooked (- (point-max) (point-min))) | 3277 | (let* ((verilog-save-font-mod-hooked (- (point-max) (point-min))) |
| 3278 | ;; FIXME: Doesn't the before/after-change-functions dance make this | ||
| 3279 | ;; font-lock-mode dance unnecessary? | ||
| 3274 | (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode) | 3280 | (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode) |
| 3275 | (font-lock-mode 0) | 3281 | (font-lock-mode 0) |
| 3276 | t))) | 3282 | t))) |
| @@ -3280,8 +3286,10 @@ For insignificant changes, see instead `verilog-save-buffer-state'." | |||
| 3280 | (let* ((inhibit-point-motion-hooks t) | 3286 | (let* ((inhibit-point-motion-hooks t) |
| 3281 | (inhibit-modification-hooks t) | 3287 | (inhibit-modification-hooks t) |
| 3282 | (verilog-no-change-functions t) | 3288 | (verilog-no-change-functions t) |
| 3283 | before-change-functions ; XEmacs ignores inhibit-modification-hooks | 3289 | ,@(when (featurep 'xemacs) |
| 3284 | after-change-functions) ; XEmacs ignores inhibit-modification-hooks | 3290 | ;; XEmacs ignores inhibit-modification-hooks. |
| 3291 | '(before-change-functions | ||
| 3292 | after-change-functions))) | ||
| 3285 | (progn ,@body)) | 3293 | (progn ,@body)) |
| 3286 | ;; Unwind forms | 3294 | ;; Unwind forms |
| 3287 | (run-hook-with-args 'after-change-functions (point-min) (point-max) | 3295 | (run-hook-with-args 'after-change-functions (point-min) (point-max) |