From: Katsumi Yamaoka Date: Wed, 19 Aug 2015 09:06:40 +0000 (+0000) Subject: [Gnus]: Use overlay functions directly X-Git-Tag: emacs-25.0.90~1348 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a83be20b2f3b1ad499c7584caa08434cc66bb98f;p=emacs.git [Gnus]: Use overlay functions directly * lisp/gnus/gnus-art.el (gnus-mime-inline-part, gnus-mm-display-part) (gnus-insert-mime-button, gnus-mime-buttonize-attachments-in-header) (gnus-article-highlight-signature, gnus-article-extend-url-button) (gnus-article-add-button, gnus-insert-prev-page-button) (gnus-insert-next-page-button, gnus-insert-mime-security-button): * lisp/gnus/gnus-cite.el (gnus-cite-delete-overlays) (gnus-cite-add-face): * lisp/gnus/gnus-html.el (gnus-html-wash-tags): * lisp/gnus/gnus-salt.el (gnus-tree-read-summary-keys) (gnus-tree-recenter, gnus-highlight-selected-tree): * lisp/gnus/gnus-sum.el (gnus-summary-show-all-threads) (gnus-summary-show-thread, gnus-summary-hide-thread) (gnus-highlight-selected-summary): * lisp/gnus/gnus-util.el (gnus-put-overlay-excluding-newlines): * lisp/gnus/message.el (message-fix-before-sending) (message-toggle-image-thumbnails): * lisp/gnus/mm-decode.el (mm-convert-shr-links): * lisp/gnus/sieve.el (sieve-highlight, sieve-insert-scripts): Use overlay functions directly instead of using gnus-overlay-*, message-overlay-*, and sieve-overlay-*. * lisp/gnus/gnus-sum.el (gnus-remove-overlays): * lisp/gnus/gnus.el (gnus-make-overlay, gnus-copy-overlay) (gnus-delete-overlay, gnus-overlay-get, gnus-overlay-put) (gnus-move-overlay, gnus-overlay-buffer, gnus-overlay-start) (gnus-overlay-end, gnus-overlays-at, gnus-overlays-in): * lisp/gnus/message.el (message-delete-overlay, message-make-overlay) (message-overlay-get, message-overlay-put, message-overlays-in): * lisp/gnus/sieve.el (sieve-make-overlay, sieve-overlay-put) (sieve-overlays-at): Remove. --- diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index ffe9a211417..b26fe06735f 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -5403,9 +5403,9 @@ Compressed files like .gz and .bz2 are decompressed." 'gnus-undeletable t)))) ;; We're in the article header. (delete-char -1) - (dolist (ovl (gnus-overlays-in btn (point))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) + (dolist (ovl (overlays-in btn (point))) + (overlay-put ovl 'gnus-button-attachment-extra t) + (overlay-put ovl 'face nil)) (save-restriction (message-narrow-to-field) (let ((gnus-treatment-function-alist @@ -5798,9 +5798,9 @@ all parts." 'gnus-undeletable t)))) ;; We're in the article header. (delete-char -1) - (dolist (ovl (gnus-overlays-in point (point))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) + (dolist (ovl (overlays-in point (point))) + (overlay-put ovl 'gnus-button-attachment-extra t) + (overlay-put ovl 'face nil)) (save-restriction (message-narrow-to-field) (let ((gnus-treatment-function-alist @@ -5889,8 +5889,8 @@ all parts." (1- (point)) (point))) (when gnus-article-button-face - (gnus-overlay-put (gnus-make-overlay b e nil t) - 'face gnus-article-button-face)) + (overlay-put (make-overlay b e nil t) + 'face gnus-article-button-face)) (widget-convert-button 'link b e :mime-handle handle @@ -6452,9 +6452,9 @@ in the body. Use `gnus-header-face-alist' to highlight buttons." (insert "\n") (end-of-line))) (insert "\n") - (dolist (ovl (gnus-overlays-in (point-min) (point))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) + (dolist (ovl (overlays-in (point-min) (point))) + (overlay-put ovl 'gnus-button-attachment-extra t) + (overlay-put ovl 'face nil)) (let ((gnus-treatment-function-alist '((gnus-treat-highlight-headers gnus-article-highlight-headers)))) @@ -8037,8 +8037,8 @@ It does this by highlighting everything after (save-restriction (when (and gnus-signature-face (gnus-article-narrow-to-signature)) - (gnus-overlay-put (gnus-make-overlay (point-min) (point-max) nil t) - 'face gnus-signature-face) + (overlay-put (make-overlay (point-min) (point-max) nil t) + 'face gnus-signature-face) (widen) (gnus-article-search-signature) (let ((start (match-beginning 0)) @@ -8136,12 +8136,12 @@ url is put as the `gnus-button-url' overlay property on the button." 'gnus-button-push (list beg (assq 'gnus-button-url-regexp gnus-button-alist))))) - (let ((overlay (gnus-make-overlay start end))) - (gnus-overlay-put overlay 'evaporate t) - (gnus-overlay-put overlay 'gnus-button-url - (list (mapconcat 'identity (nreverse url) ""))) + (let ((overlay (make-overlay start end))) + (overlay-put overlay 'evaporate t) + (overlay-put overlay 'gnus-button-url + (list (mapconcat 'identity (nreverse url) ""))) (when gnus-article-mouse-face - (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face))) + (overlay-put overlay 'mouse-face gnus-article-mouse-face))) t) (goto-char opoint)))) @@ -8180,8 +8180,8 @@ url is put as the `gnus-button-url' overlay property on the button." (defun gnus-article-add-button (from to fun &optional data text) "Create a button between FROM and TO with callback FUN and data DATA." (when gnus-article-button-face - (gnus-overlay-put (gnus-make-overlay from to nil t) - 'face gnus-article-button-face)) + (overlay-put (make-overlay from to nil t) + 'face gnus-article-button-face)) (gnus-add-text-properties from to (nconc (and gnus-article-mouse-face @@ -8520,8 +8520,8 @@ url is put as the `gnus-button-url' overlay property on the button." (1- (point)) (point))) (when gnus-article-button-face - (gnus-overlay-put (gnus-make-overlay b e nil t) - 'face gnus-article-button-face)) + (overlay-put (make-overlay b e nil t) + 'face gnus-article-button-face)) (widget-convert-button 'link b e :action 'gnus-button-prev-page @@ -8556,8 +8556,8 @@ url is put as the `gnus-button-url' overlay property on the button." (1- (point)) (point))) (when gnus-article-button-face - (gnus-overlay-put (gnus-make-overlay b e nil t) - 'face gnus-article-button-face)) + (overlay-put (make-overlay b e nil t) + 'face gnus-article-button-face)) (widget-convert-button 'link b e :action 'gnus-button-next-page @@ -8952,8 +8952,8 @@ For example: (1- (point)) (point))) (when gnus-article-button-face - (gnus-overlay-put (gnus-make-overlay b e nil t) - 'face gnus-article-button-face)) + (overlay-put (make-overlay b e nil t) + 'face gnus-article-button-face)) (widget-convert-button 'link b e :mime-handle handle diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el index d8ee35d3e97..57fc2816155 100644 --- a/lisp/gnus/gnus-cite.el +++ b/lisp/gnus/gnus-cite.el @@ -786,12 +786,12 @@ See also the documentation for `gnus-article-highlight-citation'." (defun gnus-cite-delete-overlays () (dolist (overlay gnus-cite-overlay-list) (ignore-errors - (when (or (not (gnus-overlay-end overlay)) - (and (>= (gnus-overlay-end overlay) (point-min)) - (<= (gnus-overlay-end overlay) (point-max)))) + (when (or (not (overlay-end overlay)) + (and (>= (overlay-end overlay) (point-min)) + (<= (overlay-end overlay) (point-max)))) (setq gnus-cite-overlay-list (delete overlay gnus-cite-overlay-list)) (ignore-errors - (gnus-delete-overlay overlay)))))) + (delete-overlay overlay)))))) (defun gnus-cite-parse-wrapper () ;; Wrap chopped gnus-cite-parse. @@ -1096,10 +1096,10 @@ See also the documentation for `gnus-article-highlight-citation'." (skip-chars-backward " \t") (setq to (point)) (when (< from to) - (push (setq overlay (gnus-make-overlay from to nil t)) + (push (setq overlay (make-overlay from to nil t)) gnus-cite-overlay-list) - (gnus-overlay-put overlay 'evaporate t) - (gnus-overlay-put overlay 'face face)))))) + (overlay-put overlay 'evaporate t) + (overlay-put overlay 'face face)))))) (defun gnus-cite-toggle (prefix) (with-current-buffer gnus-article-buffer diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index b706de7430e..bedf7e40b10 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -307,12 +307,12 @@ Use ALT-TEXT for the image string." (gnus-article-add-button start end 'browse-url (mm-url-decode-entities-string url) url) - (let ((overlay (gnus-make-overlay start end))) - (gnus-overlay-put overlay 'evaporate t) - (gnus-overlay-put overlay 'gnus-button-url url) + (let ((overlay (make-overlay start end))) + (overlay-put overlay 'evaporate t) + (overlay-put overlay 'gnus-button-url url) (gnus-put-text-property start end 'gnus-string url) (when gnus-article-mouse-face - (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face))))) + (overlay-put overlay 'mouse-face gnus-article-mouse-face))))) ;; The upper-case IMG_ALT is apparently just an artifact that ;; should be deleted. ((equal tag "IMG_ALT") @@ -320,19 +320,19 @@ Use ALT-TEXT for the image string." ;; w3m does not normalize the case ((or (equal tag "b") (equal tag "B")) - (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-bold)) + (overlay-put (make-overlay start end) 'face 'gnus-emphasis-bold)) ((or (equal tag "u") (equal tag "U")) - (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-underline)) + (overlay-put (make-overlay start end) 'face 'gnus-emphasis-underline)) ((or (equal tag "i") (equal tag "I")) - (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-italic)) + (overlay-put (make-overlay start end) 'face 'gnus-emphasis-italic)) ((or (equal tag "s") (equal tag "S")) - (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-strikethru)) + (overlay-put (make-overlay start end) 'face 'gnus-emphasis-strikethru)) ((or (equal tag "ins") (equal tag "INS")) - (gnus-overlay-put (gnus-make-overlay start end) 'face 'gnus-emphasis-underline)) + (overlay-put (make-overlay start end) 'face 'gnus-emphasis-underline)) ;; Handle different UL types ((equal tag "_SYMBOL") (when (string-match "TYPE=\\(.+\\)" parameters) diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el index e071543f9e1..5776b0a569f 100644 --- a/lisp/gnus/gnus-salt.el +++ b/lisp/gnus/gnus-salt.el @@ -504,7 +504,7 @@ Two predefined functions are available: (when (setq win (get-buffer-window buf)) (select-window win) (when gnus-selected-tree-overlay - (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1))) + (goto-char (or (overlay-end gnus-selected-tree-overlay) 1))) (gnus-tree-minimize))))) (defun gnus-tree-show-summary () @@ -547,7 +547,7 @@ Two predefined functions are available: (when tree-window (select-window tree-window) (when gnus-selected-tree-overlay - (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1))) + (goto-char (or (overlay-end gnus-selected-tree-overlay) 1))) (let* ((top (cond ((< (window-height) 4) 0) ((< (window-height) 7) 1) (t 2))) @@ -858,12 +858,12 @@ it in the environment specified by BINDINGS." (when (or (not gnus-selected-tree-overlay) (gnus-extent-detached-p gnus-selected-tree-overlay)) ;; Create a new overlay. - (gnus-overlay-put + (overlay-put (setq gnus-selected-tree-overlay - (gnus-make-overlay (point-min) (1+ (point-min)))) + (make-overlay (point-min) (1+ (point-min)))) 'face gnus-selected-tree-face)) ;; Move the overlay to the article. - (gnus-move-overlay + (move-overlay gnus-selected-tree-overlay (goto-char (car region)) (cdr region)) (gnus-tree-minimize) (gnus-tree-recenter) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 37a707ebe64..f98f4851970 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -11695,20 +11695,10 @@ If ARG is positive number, turn showing conversation threads on." (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off")) (gnus-summary-position-point))) -(eval-and-compile - (if (fboundp 'remove-overlays) - (defalias 'gnus-remove-overlays 'remove-overlays) - (defun gnus-remove-overlays (beg end name val) - "Clear BEG and END of overlays whose property NAME has value VAL. -For compatibility with XEmacs." - (dolist (ov (gnus-overlays-in beg end)) - (when (eq (gnus-overlay-get ov name) val) - (gnus-delete-overlay ov)))))) - (defun gnus-summary-show-all-threads () "Show all threads." (interactive) - (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum) + (remove-overlays (point-min) (point-max) 'invisible 'gnus-sum) (gnus-summary-position-point)) (defsubst gnus-summary--inv (p) @@ -11735,7 +11725,7 @@ Returns nil if no thread was there to be shown." 'gnus-sum)))) (point))))) (when eoi - (gnus-remove-overlays beg eoi 'invisible 'gnus-sum) + (remove-overlays beg eoi 'invisible 'gnus-sum) (goto-char orig) (gnus-summary-position-point) eoi))) @@ -11804,10 +11794,10 @@ Returns nil if no threads were there to be hidden." (search-backward "\n" start t)) (progn (when (> (point) starteol) - (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum) - (let ((ol (gnus-make-overlay starteol (point) nil t nil))) - (gnus-overlay-put ol 'invisible 'gnus-sum) - (gnus-overlay-put ol 'evaporate t))) + (remove-overlays starteol (point) 'invisible 'gnus-sum) + (let ((ol (make-overlay starteol (point) nil t nil))) + (overlay-put ol 'invisible 'gnus-sum) + (overlay-put ol 'evaporate t))) (gnus-summary-goto-subject article) (when (> start (point)) (message "Hiding the thread moved us backwards, aborting!") @@ -12626,11 +12616,11 @@ If REVERSE, save parts that do not match TYPE." (setq to end)) (if gnus-newsgroup-selected-overlay ;; Move old overlay. - (gnus-move-overlay + (move-overlay gnus-newsgroup-selected-overlay from to (current-buffer)) ;; Create new overlay. - (gnus-overlay-put - (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to)) + (overlay-put + (setq gnus-newsgroup-selected-overlay (make-overlay from to)) 'face gnus-summary-selected-face)))))) (defvar gnus-summary-highlight-line-cached nil) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index b75d9efe5e5..12b319b0d09 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -853,10 +853,6 @@ If there's no subdirectory, delete DIRECTORY as well." (setq beg (point))) (gnus-put-text-property beg (point) prop val))))) -(declare-function gnus-overlay-put "gnus" (overlay prop value)) -(declare-function gnus-make-overlay "gnus" - (beg end &optional buffer front-advance rear-advance)) - (defsubst gnus-put-overlay-excluding-newlines (beg end prop val) "The same as `put-text-property', but don't put this prop on any newlines in the region." (save-match-data @@ -864,11 +860,9 @@ If there's no subdirectory, delete DIRECTORY as well." (save-restriction (goto-char beg) (while (re-search-forward gnus-emphasize-whitespace-regexp end 'move) - (gnus-overlay-put - (gnus-make-overlay beg (match-beginning 0)) - prop val) + (overlay-put (make-overlay beg (match-beginning 0)) prop val) (setq beg (point))) - (gnus-overlay-put (gnus-make-overlay beg (point)) prop val))))) + (overlay-put (make-overlay beg (point)) prop val))))) (defun gnus-put-text-property-excluding-characters-with-faces (beg end prop val) "The same as `put-text-property', except where `gnus-face' is set. diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 30c89f5906f..4545ed0e28a 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -304,17 +304,6 @@ be set in `.emacs' instead." :type 'boolean) (unless (featurep 'gnus-xmas) - (defalias 'gnus-make-overlay 'make-overlay) - (defalias 'gnus-copy-overlay 'copy-overlay) - (defalias 'gnus-delete-overlay 'delete-overlay) - (defalias 'gnus-overlay-get 'overlay-get) - (defalias 'gnus-overlay-put 'overlay-put) - (defalias 'gnus-move-overlay 'move-overlay) - (defalias 'gnus-overlay-buffer 'overlay-buffer) - (defalias 'gnus-overlay-start 'overlay-start) - (defalias 'gnus-overlay-end 'overlay-end) - (defalias 'gnus-overlays-at 'overlays-at) - (defalias 'gnus-overlays-in 'overlays-in) (defalias 'gnus-extent-detached-p 'ignore) (defalias 'gnus-extent-start-open 'ignore) (defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index a5196c8d1ea..0a11bf092d4 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2008,13 +2008,8 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (eval-and-compile (if (featurep 'emacs) (progn - (defalias 'message-delete-overlay 'delete-overlay) (defun message-kill-all-overlays () (mapcar #'delete-overlay (overlays-in (point-min) (point-max)))) - (defalias 'message-make-overlay 'make-overlay) - (defalias 'message-overlay-get 'overlay-get) - (defalias 'message-overlay-put 'overlay-put) - (defalias 'message-overlays-in 'overlays-in) (defalias 'message-window-inside-pixel-edges 'window-inside-pixel-edges)) (defun message-kill-all-overlays () @@ -4396,8 +4391,7 @@ conformance." to (cdar regions) regions (cdr regions)) (put-text-property from to 'invisible nil) - (message-overlay-put (message-make-overlay from to) - 'face 'highlight)) + (overlay-put (make-overlay from to) 'face 'highlight)) (unless (yes-or-no-p "Invisible text found and made visible; continue sending? ") (error "Invisible text found and made visible"))))) @@ -4424,8 +4418,7 @@ conformance." control-1)) (not (get-text-property (point) 'untranslated-utf-8)))) - (message-overlay-put (message-make-overlay (point) (1+ (point))) - 'face 'highlight) + (overlay-put (make-overlay (point) (1+ (point))) 'face 'highlight) (setq found t)) (forward-char)) (when found @@ -8567,12 +8560,12 @@ Used in `message-simplify-recipients'." (defun message-toggle-image-thumbnails () "For any included image files, insert a thumbnail of that image." (interactive) - (let ((overlays (message-overlays-in (point-min) (point-max))) + (let ((overlays (overlays-in (point-min) (point-max))) (displayed nil)) (while overlays (let ((overlay (car overlays))) - (when (message-overlay-get overlay 'put-image) - (message-delete-overlay overlay) + (when (overlay-get overlay 'put-image) + (delete-overlay overlay) (setq displayed t))) (setq overlays (cdr overlays))) (unless displayed diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index bce9abdcc8d..b0ec16ee03c 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -31,9 +31,6 @@ (autoload 'gnus-replace-in-string "gnus-util") (autoload 'gnus-read-shell-command "gnus-util") -(autoload 'gnus-overlays-at "gnus") -(autoload 'gnus-overlay-put "gnus") - (autoload 'mm-inline-partial "mm-partial") (autoload 'mm-inline-external-body "mm-extern") (autoload 'mm-extern-cache-contents "mm-extern") @@ -1915,8 +1912,8 @@ If RECURSIVE, search recursively." :keymap shr-map (get-text-property start 'shr-url)) (put-text-property start end 'local-map nil) - (dolist (overlay (gnus-overlays-at start)) - (gnus-overlay-put overlay 'face nil)) + (dolist (overlay (overlays-at start)) + (overlay-put overlay 'face nil)) (setq start end))))) (defun mm-handle-filename (handle) diff --git a/lisp/gnus/sieve.el b/lisp/gnus/sieve.el index 6eef569901d..8d40fa455bd 100644 --- a/lisp/gnus/sieve.el +++ b/lisp/gnus/sieve.el @@ -275,21 +275,9 @@ Used to bracket operations which move point in the sieve-buffer." (interactive "d") (get-char-property (or pos (point)) 'script-name)) -(eval-and-compile - (defalias 'sieve-make-overlay (if (featurep 'xemacs) - 'make-extent - 'make-overlay)) - (defalias 'sieve-overlay-put (if (featurep 'xemacs) - 'set-extent-property - 'overlay-put)) - (defalias 'sieve-overlays-at (if (featurep 'xemacs) - 'extents-at - 'overlays-at))) - (defun sieve-highlight (on) "Turn ON or off highlighting on the current language overlay." - (sieve-overlay-put (car (sieve-overlays-at (point))) - 'face (if on 'highlight 'default))) + (overlay-put (car (overlays-at (point))) 'face (if on 'highlight 'default))) (defun sieve-insert-scripts (scripts) "Format and insert LANGUAGE-LIST strings into current buffer at point." @@ -300,11 +288,11 @@ Used to bracket operations which move point in the sieve-buffer." (if (consp script) (insert (format " ACTIVE %s" (cdr script))) (insert (format " %s" script))) - (setq ext (sieve-make-overlay p (point))) - (sieve-overlay-put ext 'mouse-face 'highlight) - (sieve-overlay-put ext 'script-name (if (consp script) - (cdr script) - script)) + (setq ext (make-overlay p (point))) + (overlay-put ext 'mouse-face 'highlight) + (overlay-put ext 'script-name (if (consp script) + (cdr script) + script)) (insert "\n")))) (defun sieve-open-server (server &optional port)