=== modified file 'lisp/subr.el' *** lisp/subr.el 2013-02-03 16:13:36 +0000 --- lisp/subr.el 2013-02-07 14:45:09 +0000 *************** *** 2579,2585 **** (defun remove-overlays (&optional beg end name val) "Clear BEG and END of overlays whose property NAME has value VAL. Overlays might be moved and/or split. ! BEG and END default respectively to the beginning and end of buffer." ;; This speeds up the loops over overlays. (unless beg (setq beg (point-min))) (unless end (setq end (point-max))) --- 2579,2589 ---- (defun remove-overlays (&optional beg end name val) "Clear BEG and END of overlays whose property NAME has value VAL. Overlays might be moved and/or split. ! ! BEG and END default respectively to the beginning and end of ! buffer. If VAL is nil and NAME is non-nil, clear all NAME ! overlays regardless of their values. If both NAME and VAL are ! nil, clear all overlays from BEG to END." ;; This speeds up the loops over overlays. (unless beg (setq beg (point-min))) (unless end (setq end (point-max))) *************** *** 2588,2607 **** (setq beg (prog1 end (setq end beg)))) (save-excursion (dolist (o (overlays-in beg end)) ! (when (eq (overlay-get o name) val) ! ;; Either push this overlay outside beg...end ! ;; or split it to exclude beg...end ! ;; or delete it entirely (if it is contained in beg...end). ! (if (< (overlay-start o) beg) (if (> (overlay-end o) end) ! (progn ! (move-overlay (copy-overlay o) ! (overlay-start o) beg) ! (move-overlay o end (overlay-end o))) ! (move-overlay o (overlay-start o) beg)) ! (if (> (overlay-end o) end) ! (move-overlay o end (overlay-end o)) ! (delete-overlay o))))))) ;;;; Miscellanea. --- 2592,2614 ---- (setq beg (prog1 end (setq end beg)))) (save-excursion (dolist (o (overlays-in beg end)) ! (let ((v (overlay-get o name))) ! ;; An overlay property value can be not just a symbol, ! ;; but also a string or a list. ! (when (if val (or (eq v val) (equal v val)) name) ! ;; Either push this overlay outside beg...end ! ;; or split it to exclude beg...end ! ;; or delete it entirely (if it is contained in beg...end). ! (if (< (overlay-start o) beg) ! (if (> (overlay-end o) end) ! (progn ! (move-overlay (copy-overlay o) ! (overlay-start o) beg) ! (move-overlay o end (overlay-end o))) ! (move-overlay o (overlay-start o) beg)) (if (> (overlay-end o) end) ! (move-overlay o end (overlay-end o)) ! (delete-overlay o)))))))) ;;;; Miscellanea.