From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: bug in forward-visible-line: Patch Date: Thu, 22 May 2003 17:51:53 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305222151.h4MLprRc014353@rum.cs.yale.edu> References: <200305220443.h4M4h4w10124@eel.dms.auburn.edu> <200305221256.h4MCuhjv003998@rum.cs.yale.edu> <200305222140.h4MLe9r10843@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053642449 26630 80.91.224.249 (22 May 2003 22:27:29 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 22 May 2003 22:27:29 +0000 (UTC) Cc: monnier+gnu/emacs@rum.cs.yale.edu Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri May 23 00:27:26 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19IyX0-0006uu-00 for ; Fri, 23 May 2003 00:27:26 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19IyiS-0001nQ-00 for ; Fri, 23 May 2003 00:39:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19IyPq-0002A9-7H for emacs-devel@quimby.gnus.org; Thu, 22 May 2003 18:20:02 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19IyPP-0001oi-K3 for emacs-devel@gnu.org; Thu, 22 May 2003 18:19:35 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19IyLa-0008V7-0A for emacs-devel@gnu.org; Thu, 22 May 2003 18:16:09 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Ixyc-0001pY-VZ for emacs-devel@gnu.org; Thu, 22 May 2003 17:51:55 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h4MLprx6014355; Thu, 22 May 2003 17:51:53 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4MLprRc014353; Thu, 22 May 2003 17:51:53 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Luc Teirlinck Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:14106 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:14106 > 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