emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in forward-visible-line: Patch


From: Luc Teirlinck
Subject: Re: bug in forward-visible-line: Patch
Date: Thu, 22 May 2003 16:40:09 -0500 (CDT)

Stefan Monnier wrote:

   BTW, how about a `invisible-p' function that does above ?

I believe visiblep would be slightly more useful (does not make any
real difference though).  I believe the usual convention is to only
use -p if the function name is already multi-word, although this
convention is not universally followed.

What about the following function?  I should still double-check it
more carefully, but on first testing in a reasonably complex
situation, it seems to work OK.  I believe that I could use the
function not only to make forward-visible-line behave correctly (even
after my patch, a problem remains, as I pointed out earlier), but
probably in other situations as well.

===File ~/invp.el===========================================
(defun visiblep (&optional pos)
  "Return t if character at POS is currently visible.
POS defaults to point."
  (unless pos (setq pos (point)))
  (let ((prop (get-text-property pos 'invisible)))
    (cond
     ((null prop))
     ((eq buffer-invisibility-spec t) nil)
     ((memq prop buffer-invisibility-spec) nil)
     ((assq prop buffer-invisibility-spec) nil)
     ((listp prop)
      (catch 'found
        (dolist (var prop)
          (if (or (memq var buffer-invisibility-spec)
                  (assq var buffer-invisibility-spec))
              (throw 'found nil)))))
     (t))))
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]