unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Add a function to test for invisible characters?
@ 2008-06-23 15:33 Lennart Borgman (gmail)
  2008-06-23 18:50 ` Stefan Monnier
  2008-06-24 13:39 ` T. V. Raman
  0 siblings, 2 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-23 15:33 UTC (permalink / raw)
  To: Emacs Devel

I asked some time ago if a function to test if a character is invisible. 
I think nothing has been done to this, or am I mistaken?

I think some code in Emacs currently gets this wrong. Do for example 
reveal get this right?

Below is such a function that I use and that I think follow the 
specifications for this. Should not something like this be in Emacs?

(defun tabkey2-invisible-p (pos)
   "Return non-nil if the character after POS is currently invisible."
   (let ((prop (get-char-property pos 'invisible)))
     (if (eq buffer-invisibility-spec t)
         prop
       (if (listp prop)
           (catch 'invis
             (dolist (p prop)
               (when (or (memq p buffer-invisibility-spec)
                         (assq p buffer-invisibility-spec))
                 (throw 'invis t))))
         (or (memq prop buffer-invisibility-spec)
             (assq prop buffer-invisibility-spec))))))




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add a function to test for invisible characters?
  2008-06-23 15:33 Add a function to test for invisible characters? Lennart Borgman (gmail)
@ 2008-06-23 18:50 ` Stefan Monnier
  2008-06-23 18:54   ` Lennart Borgman (gmail)
  2008-06-24 13:39 ` T. V. Raman
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2008-06-23 18:50 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

> I asked some time ago if a function to test if a character is
> invisible. I think nothing has been done to this, or am I mistaken?

It's called `invisible-p'.



        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add a function to test for invisible characters?
  2008-06-23 18:50 ` Stefan Monnier
@ 2008-06-23 18:54   ` Lennart Borgman (gmail)
  2008-06-23 19:34     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-23 18:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Devel

Stefan Monnier wrote:
>> I asked some time ago if a function to test if a character is
>> invisible. I think nothing has been done to this, or am I mistaken?
> 
> It's called `invisible-p'.


Ah, thanks, there it is. Very nice.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add a function to test for invisible characters?
  2008-06-23 18:54   ` Lennart Borgman (gmail)
@ 2008-06-23 19:34     ` Lennart Borgman (gmail)
  2008-06-23 20:21       ` ken manheimer
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-23 19:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Carsten Dominik, Kenichi Handa, Emacs Devel

Lennart Borgman (gmail) wrote:
> Stefan Monnier wrote:
>>> I asked some time ago if a function to test if a character is
>>> invisible. I think nothing has been done to this, or am I mistaken?
>>
>> It's called `invisible-p'.
> 
> 
> Ah, thanks, there it is. Very nice.

I grepped for "'invisible" to see if there were any places where this 
should/could be used. In some cases I do not understand what should be 
done. For example allout.el has

   (defsubst allout-hidden-p (&optional pos)
     "Non-nil if the character after point is invisible."
     (eq (get-char-property (or pos (point)) 'invisible) 'allout))

However here are a some that I think maybe should use invisible-p or 
perhaps test a little bit more careful:

   isearch.el (isearch-range-invisible)
   nxml-outln.el (nxml-outline-pre-adjust-point,
       nxml-outline-adjust-point, nxml-back-to-section-start)
   org-exp.el (org-find-visible, org-find-invisible)
   org.el (org-cycle, org-cycle-show-empty-lines, org-invisible-p,
       org-invisible-p2)
   outline.el (outline-invisible-p)
   ps-def.el (ps-generate-postscript-with-faces1)
   reveal.el (reveal-open-new-overlays)
   simple.el (newline, forward-visible-line, end-of-visible-line,
        move-end-of-line)
   mac-win.el (mac-ts-update-active-input-area)
   reftex-ref.el (reftex-show-entry)

I have tried to cc the maintainers here.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add a function to test for invisible characters?
  2008-06-23 19:34     ` Lennart Borgman (gmail)
@ 2008-06-23 20:21       ` ken manheimer
  0 siblings, 0 replies; 6+ messages in thread
From: ken manheimer @ 2008-06-23 20:21 UTC (permalink / raw)
  To: Lennart Borgman (gmail)
  Cc: Kenichi Handa, Emacs Devel, Stefan Monnier, Carsten Dominik

On Mon, Jun 23, 2008 at 3:34 PM, Lennart Borgman (gmail)
<lennart.borgman@gmail.com> wrote:
> Lennart Borgman (gmail) wrote:
>>
>> Stefan Monnier wrote:
>>>>
>>>> I asked some time ago if a function to test if a character is
>>>> invisible. I think nothing has been done to this, or am I mistaken?
>>>
>>> It's called `invisible-p'.
>>
>>
>> Ah, thanks, there it is. Very nice.
>
> I grepped for "'invisible" to see if there were any places where this
> should/could be used. In some cases I do not understand what should be done.
> For example allout.el has
>
>  (defsubst allout-hidden-p (&optional pos)
>    "Non-nil if the character after point is invisible."
>    (eq (get-char-property (or pos (point)) 'invisible) 'allout))
>
> However here are a some that I think maybe should use invisible-p or perhaps
> test a little bit more careful:
> [...]

i think you inferred correctly that i deliberately didn't use
invisible-p.  that's because i needed to detect points that are hidden
specifically by allout, not for some other purpose.  i guess i the
docstring should be clearer about that.

-- 
ken
http://myriadicity.net




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add a function to test for invisible characters?
  2008-06-23 15:33 Add a function to test for invisible characters? Lennart Borgman (gmail)
  2008-06-23 18:50 ` Stefan Monnier
@ 2008-06-24 13:39 ` T. V. Raman
  1 sibling, 0 replies; 6+ messages in thread
From: T. V. Raman @ 2008-06-24 13:39 UTC (permalink / raw)
  To: lennart.borgman; +Cc: emacs-devel

I'd definitely find this useful in the emacspeak layer. I've
defined it myself in the emacspeak codebase in the past, and have
gotten it wrong  at times as well

>>>>> "Lennart" == Lennart Borgman (gmail) <lennart.borgman@gmail.com> writes:
    Lennart> I asked some time ago if a function to test if a
    Lennart> character is invisible.  I think nothing has been
    Lennart> done to this, or am I mistaken?
    Lennart> 
    Lennart> I think some code in Emacs currently gets this
    Lennart> wrong. Do for example reveal get this right?
    Lennart> 
    Lennart> Below is such a function that I use and that I think
    Lennart> follow the specifications for this. Should not
    Lennart> something like this be in Emacs?
    Lennart> 
    Lennart> (defun tabkey2-invisible-p (pos) "Return non-nil if
    Lennart> the character after POS is currently invisible."
    Lennart> (let ((prop (get-char-property pos 'invisible))) (if
    Lennart> (eq buffer-invisibility-spec t) prop (if (listp
    Lennart> prop) (catch 'invis (dolist (p prop) (when (or (memq
    Lennart> p buffer-invisibility-spec) (assq p
    Lennart> buffer-invisibility-spec)) (throw 'invis t)))) (or
    Lennart> (memq prop buffer-invisibility-spec) (assq prop
    Lennart> buffer-invisibility-spec))))))
    Lennart> 

-- 
Best Regards,
--raman

      
Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-24 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23 15:33 Add a function to test for invisible characters? Lennart Borgman (gmail)
2008-06-23 18:50 ` Stefan Monnier
2008-06-23 18:54   ` Lennart Borgman (gmail)
2008-06-23 19:34     ` Lennart Borgman (gmail)
2008-06-23 20:21       ` ken manheimer
2008-06-24 13:39 ` T. V. Raman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).