1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 02:51:31 -08:00

[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.
This commit is contained in:
Katsumi Yamaoka 2015-08-19 09:06:40 +00:00
parent 62661fe759
commit a83be20b2f
10 changed files with 71 additions and 120 deletions

View file

@ -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,7 +5889,7 @@ all parts."
(1- (point))
(point)))
(when gnus-article-button-face
(gnus-overlay-put (gnus-make-overlay b e nil t)
(overlay-put (make-overlay b e nil t)
'face gnus-article-button-face))
(widget-convert-button
'link b e
@ -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,7 +8037,7 @@ 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)
(overlay-put (make-overlay (point-min) (point-max) nil t)
'face gnus-signature-face)
(widen)
(gnus-article-search-signature)
@ -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
(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,7 +8180,7 @@ 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)
(overlay-put (make-overlay from to nil t)
'face gnus-article-button-face))
(gnus-add-text-properties
from to
@ -8520,7 +8520,7 @@ 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)
(overlay-put (make-overlay b e nil t)
'face gnus-article-button-face))
(widget-convert-button
'link b e
@ -8556,7 +8556,7 @@ 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)
(overlay-put (make-overlay b e nil t)
'face gnus-article-button-face))
(widget-convert-button
'link b e
@ -8952,7 +8952,7 @@ For example:
(1- (point))
(point)))
(when gnus-article-button-face
(gnus-overlay-put (gnus-make-overlay b e nil t)
(overlay-put (make-overlay b e nil t)
'face gnus-article-button-face))
(widget-convert-button
'link b e

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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.

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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,9 +288,9 @@ 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)
(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"))))