From 2267110b6f00bbb0ad87f4621e6ecd9dc1bd8581 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Thu, 1 Aug 2019 15:59:46 +0300 Subject: [PATCH] Fix usage of remove-text-properties * lisp/allout-widgets.el (allout-decorate-item-icon): * lisp/emacs-lisp/chart.el (chart-goto-xy): * lisp/forms.el (forms--make-format) (forms--make-format-elt-using-text-properties): * lisp/htmlfontify.el (hfy-unmark-trailing-whitespace): * lisp/net/newst-plainview.el (newsticker-hide-entry) (newsticker-show-entry): * lisp/nxml/nxml-mode.el (nxml-cleanup): * lisp/obsolete/longlines.el (longlines-unshow-hard-newlines) (longlines-encode-region): * lisp/org/ob-exp.el (org-babel-exp-process-buffer): * lisp/org/org-agenda.el (org-agenda-show-new-time): * lisp/progmodes/cc-defs.el (c-clear-char-property-with-value-function) (c-clear-char-property-with-value-on-char-function): * lisp/progmodes/ebrowse.el (ebrowse--hide): * lisp/progmodes/gdb-mi.el (gdb-send): * lisp/progmodes/idlw-shell.el (idlwave-retrieve-expression-from-level): * lisp/progmodes/make-mode.el (makefile-fill-paragraph): * lisp/progmodes/prog-mode.el (prettify-symbols--post-command-hook): * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize): * lisp/tmm.el (tmm-remove-inactive-mouse-face): Always pass an explicit plist to remove-text-properties. * lisp/dired.el (dired--unhide): * lisp/facemenu.el (facemenu-add-face): * lisp/htmlfontify.el (hfy-fontify-buffer): * lisp/iimage.el (iimage-mode-buffer): * lisp/image-file.el (image-file-yank-handler): * lisp/progmodes/prog-mode.el (prettify-symbols--compose-symbol): * lisp/textmodes/tex-mode.el (latex-env-before-change): * test/src/undo-tests.el (undo-test0): Use remove-list-of-text-properties in place of remove-text-properties where appropriate. --- lisp/allout-widgets.el | 2 +- lisp/dired.el | 2 +- lisp/emacs-lisp/chart.el | 2 +- lisp/facemenu.el | 2 +- lisp/forms.el | 4 ++-- lisp/htmlfontify.el | 5 +++-- lisp/iimage.el | 5 +++-- lisp/image-file.el | 2 +- lisp/net/newst-plainview.el | 4 ++-- lisp/nxml/nxml-mode.el | 2 +- lisp/obsolete/longlines.el | 4 ++-- lisp/org/ob-exp.el | 3 ++- lisp/org/org-agenda.el | 2 +- lisp/progmodes/cc-defs.el | 4 ++-- lisp/progmodes/ebrowse.el | 2 +- lisp/progmodes/gdb-mi.el | 2 +- lisp/progmodes/idlw-shell.el | 2 +- lisp/progmodes/make-mode.el | 2 +- lisp/progmodes/prog-mode.el | 9 +++++---- lisp/progmodes/ruby-mode.el | 2 +- lisp/textmodes/tex-mode.el | 2 +- lisp/tmm.el | 2 +- test/src/undo-tests.el | 2 +- 23 files changed, 36 insertions(+), 32 deletions(-) diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index e7da08d44e7..e4a8db8a628 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -1966,7 +1966,7 @@ reapplying this method will rectify the glyphs." ;; XXX we strip the prior properties without even checking if ;; the prior bullet was distinctive, because the widget ;; provisions to convey that info is disappearing, sigh. - (remove-text-properties icon-end (1+ icon-end) '(display)) + (remove-text-properties icon-end (1+ icon-end) '(display nil)) (setq distinctive-start icon-end distinctive-end icon-end) (widget-put item-widget :distinctive-start distinctive-start) (widget-put item-widget :distinctive-end distinctive-end)) diff --git a/lisp/dired.el b/lisp/dired.el index d47393b1349..331e95a6cc4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2560,7 +2560,7 @@ See options: `dired-hide-details-hide-symlink-targets' and ;; approximate ("anywhere on the line is fine"). ;; FIXME: This also removes other invisible properties! (save-excursion - (remove-text-properties + (remove-list-of-text-properties (progn (goto-char start) (line-end-position)) (progn (goto-char end) (line-end-position)) '(invisible)))) diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 354830d9112..124ede17fd3 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -518,7 +518,7 @@ cons cells of the form (NAME . NUM). See `sort' for more details." (or (= (move-to-column x) x) (let ((p (point))) (indent-to x) - (remove-text-properties p (point) '(face)))))) + (remove-text-properties p (point) '(face nil)))))) (defun chart-zap-chars (n) "Zap up to N chars without deleting EOLs." diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 44b3941b24d..c582fc8b28f 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -732,7 +732,7 @@ effect. See `facemenu-remove-face-function'." (if facemenu-remove-face-function (funcall facemenu-remove-face-function start end) (if (and start (< start end)) - (remove-text-properties start end '(face default)) + (remove-list-of-text-properties start end '(face)) (facemenu-set-self-insert-face 'default)))) (facemenu-add-face-function (save-excursion diff --git a/lisp/forms.el b/lisp/forms.el index a85ee94c1a2..149b9675730 100644 --- a/lisp/forms.el +++ b/lisp/forms.el @@ -933,7 +933,7 @@ Commands: Equivalent keys in read-only mode: '(front-sticky (read-only cursor-intangible))))) ;; Prevent insertion after the last text. (remove-text-properties (1- (point)) (point) - '(rear-nonsticky))) + '(rear-nonsticky nil))) (setq forms--iif-start nil)) `(lambda (arg) ,@(apply 'append @@ -998,7 +998,7 @@ Commands: Equivalent keys in read-only mode: ;; '(front-sticky (read-only)))))) ;; ;; Prevent insertion after the last text. ;; (remove-text-properties (1- (point)) (point) - ;; '(rear-nonsticky))) + ;; '(rear-nonsticky nil))) ;; ;; ;; wrap up ;; (setq forms--iif-start nil) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index dfba025742a..b8442be1e89 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1589,7 +1589,7 @@ Do not record undo information during evaluation of BODY." (when show-trailing-whitespace (hfy-save-buffer-state nil (remove-text-properties (point-min) (point-max) - '(hfy-show-trailing-whitespace))))) + '(hfy-show-trailing-whitespace nil))))) (defun hfy-begin-span (style text-block text-id text-begins-block-p) "Default handler to begin a span of text. @@ -1677,7 +1677,8 @@ FILE, if set, is the file name." (copy-to-buffer html-buffer (point-min) (point-max)) (set-buffer html-buffer) ;; rip out props that could interfere with our htmlization of the buffer: - (remove-text-properties (point-min) (point-max) hfy-ignored-properties) + (remove-list-of-text-properties (point-min) (point-max) + hfy-ignored-properties) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; at this point, html-buffer retains the fontification of the parent: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/lisp/iimage.el b/lisp/iimage.el index 3b5006491aa..b2ee3da7838 100644 --- a/lisp/iimage.el +++ b/lisp/iimage.el @@ -138,8 +138,9 @@ Examples of image filename patterns to match: keymap ,image-map modification-hooks (iimage-modification-hook))) - (remove-text-properties (match-beginning 0) (match-end 0) - '(display modification-hooks)))))))))) + (remove-list-of-text-properties + (match-beginning 0) (match-end 0) + '(display modification-hooks)))))))))) ;;;###autoload (define-minor-mode iimage-mode nil diff --git a/lisp/image-file.el b/lisp/image-file.el index 6cadc42110f..26f16d1ed25 100644 --- a/lisp/image-file.el +++ b/lisp/image-file.el @@ -140,7 +140,7 @@ absolute file name and number of characters inserted." "Yank handler for inserting an image into a buffer." (let ((len (length string)) (image (get-text-property 0 'display string))) - (remove-text-properties 0 len yank-excluded-properties string) + (remove-list-of-text-properties 0 len yank-excluded-properties string) (if (consp image) (add-text-properties 0 (or (next-single-property-change 0 'image-counter string) diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el index 4f5c729dd00..58bca31aba4 100644 --- a/lisp/net/newst-plainview.el +++ b/lisp/net/newst-plainview.el @@ -1002,7 +1002,7 @@ not get changed." ;; toggle (add-text-properties pos1 pos2 (list 'invisible org-inv-prop)) - (remove-text-properties pos1 pos2 '(org-invisible)))))) + (remove-text-properties pos1 pos2 '(org-invisible nil)))))) (newsticker--buffer-redraw)) (defun newsticker-show-entry () @@ -1028,7 +1028,7 @@ not get changed." ;; toggle (add-text-properties pos1 pos2 (list 'invisible org-inv-prop)) - (remove-text-properties pos1 pos2 '(org-invisible)))))) + (remove-text-properties pos1 pos2 '(org-invisible nil)))))) (newsticker--buffer-redraw)) (defun newsticker-toggle-auto-narrow-to-feed () diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 623a6666627..7d770e61639 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -561,7 +561,7 @@ Many aspects this mode can be customized using (widen) (with-silent-modifications (nxml-with-invisible-motion - (remove-text-properties (point-min) (point-max) '(face))))) + (remove-text-properties (point-min) (point-max) '(face nil))))) (remove-hook 'change-major-mode-hook #'nxml-cleanup t)) (defun nxml-degrade (context err) diff --git a/lisp/obsolete/longlines.el b/lisp/obsolete/longlines.el index 30c6f35e7b1..5ad7f668997 100644 --- a/lisp/obsolete/longlines.el +++ b/lisp/obsolete/longlines.el @@ -248,7 +248,7 @@ With optional argument ARG, make the hard newlines invisible again." (inhibit-modification-hooks t) buffer-file-name buffer-file-truename) (while pos - (remove-text-properties pos (1+ pos) '(display)) + (remove-text-properties pos (1+ pos) '(display nil)) (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil))) (restore-buffer-modified-p mod))) @@ -387,7 +387,7 @@ compatibility with `format-alist', and is ignored." (goto-char (1+ pos)) (insert-and-inherit " ") (delete-region pos (1+ pos)) - (remove-text-properties pos (1+ pos) 'hard)))) + (remove-text-properties pos (1+ pos) '(hard nil))))) (set-buffer-modified-p mod) end))) diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index bf5796405fe..4a5bff82aef 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el @@ -282,7 +282,8 @@ this template." (set-marker begin nil) (set-marker end nil))))) (kill-buffer org-babel-exp-reference-buffer) - (remove-text-properties (point-min) (point-max) '(org-reference))))))) + (remove-text-properties (point-min) (point-max) + '(org-reference nil))))))) (defun org-babel-exp-do-export (info type &optional hash) "Return a string with the exported content of a code block. diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 23ee8d71e66..a6195cfb2a5 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -9230,7 +9230,7 @@ Called with a universal prefix arg, show the priority instead of setting it." (goto-char (point-max)) (while (not (bobp)) (when (equal marker (org-get-at-bol 'org-marker)) - (remove-text-properties (point-at-bol) (point-at-eol) '(display)) + (remove-text-properties (point-at-bol) (point-at-eol) '(display nil)) (org-move-to-column (- (window-width) (length stamp)) t) (add-text-properties (1- (point)) (point-at-eol) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index ab3e25b226f..34f47debb16 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1291,7 +1291,7 @@ been put there by c-put-char-property. POINT remains unchanged." (when (and (fboundp 'syntax-ppss) (eq property 'syntax-table)) (setq c-syntax-table-hwm (min c-syntax-table-hwm place))) (setq end-place (c-next-single-property-change place property nil to)) - (remove-text-properties place end-place (cons property nil)) + (remove-text-properties place end-place (list property nil)) ;; Do we have to do anything with stickiness here? (setq place end-place)))) @@ -1375,7 +1375,7 @@ property, or nil." (setq place (c-next-single-property-change place property nil to))) (< place to)) (when (eq (char-after place) char) - (remove-text-properties place (1+ place) (cons property nil)) + (remove-text-properties place (1+ place) (list property nil)) (or first (progn (setq first place) (when (eq property 'syntax-table) diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 3faec4959bc..733e3735821 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -1383,7 +1383,7 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise." (defun ebrowse--unhide (start end) ;; FIXME: This also removes other invisible properties! - (remove-text-properties start end '(invisible))) + (remove-text-properties start end '(invisible nil))) ;;; Misc tree buffer commands diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 15d47575c78..439e0dfc620 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1794,7 +1794,7 @@ commands to be prefixed by \"-interpreter-exec console\".") "A comint send filter for gdb." (with-current-buffer gud-comint-buffer (let ((inhibit-read-only t)) - (remove-text-properties (point-min) (point-max) '(face)))) + (remove-text-properties (point-min) (point-max) '(face nil)))) ;; mimic key to repeat previous command in GDB (when (= gdb-control-level 0) (if (not (string= "" string)) diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index 3bd99620d04..188ec012cf7 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -3120,7 +3120,7 @@ versions of IDL." fetch-start start) (setq fetch-end (next-single-property-change fetch-start 'fetch expr))) (unless fetch-end (setq fetch-end (length expr))) - (remove-text-properties fetch-start fetch-end '(fetch) expr) + (remove-text-properties fetch-start fetch-end '(fetch nil) expr) (setq expr (concat (substring expr 0 fetch-start) (format "(routine_names('%s',fetch=%d))" (substring expr fetch-start fetch-end) diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index cffb749c3e8..54292b5d393 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -1313,7 +1313,7 @@ Fill comments, backslashed lines, and variable definitions specially." ;; which back-to-indentation (called via fill-newline -> ;; fill-indent-to-left-margin -> indent-line-to) thinks are real code ;; (bug#13179). - (remove-text-properties (point-min) (point-max) '(syntax-table)) + (remove-text-properties (point-min) (point-max) '(syntax-table nil)) (let ((fill-paragraph-function nil) ;; Adjust fill-column to allow space for the backslash. (fill-column (- fill-column 1))) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 79fe56aebbf..cb39e62265d 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -138,9 +138,10 @@ Regexp match data 0 specifies the characters to be composed." ;; No composition for you. Let's actually remove any ;; composition we may have added earlier and which is now ;; incorrect. - (remove-text-properties start end '(composition - prettify-symbols-start - prettify-symbols-end)))) + (remove-list-of-text-properties start end + '(composition + prettify-symbols-start + prettify-symbols-end)))) ;; Return nil because we're not adding any face property. nil) @@ -191,7 +192,7 @@ on the symbol." (e (apply #'max e))) (with-silent-modifications (setq prettify-symbols--current-symbol-bounds (list s e)) - (remove-text-properties s e '(composition)))))) + (remove-text-properties s e '(composition nil)))))) ;;;###autoload (define-minor-mode prettify-symbols-mode diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 340c689f02e..69acc7a3944 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1858,7 +1858,7 @@ It will be properly highlighted even when the call omits parens.") "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." (let (case-fold-search) (goto-char start) - (remove-text-properties start end '(ruby-expansion-match-data)) + (remove-text-properties start end '(ruby-expansion-match-data nil)) (ruby-syntax-propertize-heredoc end) (ruby-syntax-enclosing-percent-literal end) (funcall diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 91c580adec4..f277defecfd 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -729,7 +729,7 @@ automatically inserts its partner." (condition-case err (with-silent-modifications ;; Remove properties even if don't find a pair. - (remove-text-properties + (remove-list-of-text-properties (previous-single-property-change (1+ start) 'latex-env-pair) (next-single-property-change start 'latex-env-pair) '(latex-env-pair)) diff --git a/lisp/tmm.el b/lisp/tmm.el index 44f04eab87b..bf76652f401 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -378,7 +378,7 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'." (while (not (eobp)) (setq next (next-single-char-property-change (point) 'mouse-face)) (when (looking-at inactive-string) - (remove-text-properties (point) next '(mouse-face)) + (remove-text-properties (point) next '(mouse-face nil)) (add-text-properties (point) next '(face tmm-inactive))) (goto-char next))) (set-buffer-modified-p nil))) diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el index b84f5a58471..8395ba99099 100644 --- a/test/src/undo-tests.el +++ b/test/src/undo-tests.el @@ -72,7 +72,7 @@ (undo-boundary) (put-text-property (point-min) (point-max) 'face 'bold) (undo-boundary) - (remove-text-properties (point-min) (point-max) '(face default)) + (remove-list-of-text-properties (point-min) (point-max) '(face)) (undo-boundary) (set-buffer-multibyte (not enable-multibyte-characters)) (undo-boundary) -- 2.39.2