How to get rid of text attributes?

Stephen J. Turnbull stephen at xemacs.org
Sat Dec 27 00:27:22 EST 2008


skip at pobox.com writes:
 > Thanks for the functions.  I get an error when executing
 > remove-all-highlighting:
 > 
 >     Wrong type argument: number-char-or-marker-p, help-echo
 > 
 > I tried setting debug-on-error but didn't get a backtrace.  "help-echo"
 > doesn't exist as a function or variable.  What's a fella to do?

Oops, my bad.  I guess you already fixed the typo (missing close
parenthesis) in rationalize-interval-start-end?  The problem with
remove-all-highlighting was also a typo of "=" for "eq".  And there's
yet another error in make-highlighting-unsticky (missing EXTENT
argument to `set-extent-property'.)  Here are those three functions
again:

(defun make-highlighting-unsticky (&optional start end)
  (interactive "r")
  (rationalize-interval-start-end)
  (iterate-over-extents (lambda (e) (set-extent-property e 'duplicable nil))
                        start end))
(defun iterate-over-extents (function start end)
  (let ((here start))
    (while (< here end)
      (mapc (lambda (e)
              (when (and (>= (extent-start-position e) start)
                         (<= (extent-end-position e) end)
                         (eq (extent-property e 'text-prop) 'face))
                (funcall function e)))
            (extents-at here))
      (setq here (1+ here)))))

(defsubst rationalize-interval-start-end ()
  (setq start (or start (point-min))
        end (or end (point-max)))
  (psetq start (min start end)
         end (max start end)))

These work in brief testing for me (ie, deleting or making non-sticky
the highlight property in an occur buffer).  I don't know if that is
going to give you the effect you want, though.




More information about the XEmacs-Beta mailing list