[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in forward-visible-line: Patch
From: |
Stefan Monnier |
Subject: |
Re: bug in forward-visible-line: Patch |
Date: |
Thu, 22 May 2003 17:51:53 -0400 |
> 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))))
Don't reinvent the wheel: implement it in C where it's
already available (and so you're sure it really works the
same). The C version return 0 1 or 2 so you can also tell
whether it's got an ellipsis or not.
Stefan
- bug in forward-visible-line: Patch, Luc Teirlinck, 2003/05/22
- Re: bug in forward-visible-line: Patch, David Kastrup, 2003/05/23
- Re: bug in forward-visible-line: Patch, Miles Bader, 2003/05/23
- Re: bug in forward-visible-line: Patch, Luc Teirlinck, 2003/05/23
- Re: bug in forward-visible-line: Patch, Richard Stallman, 2003/05/24
- Re: bug in forward-visible-line: Patch, Richard Stallman, 2003/05/23
- Re: bug in forward-visible-line: Patch, Luc Teirlinck, 2003/05/23