From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Hl-line and visual-line Date: Fri, 21 May 2010 00:02:34 +0300 Message-ID: <8339xmqob9.fsf@gnu.org> References: <45790724-63FC-4B80-A70D-8CD49A92FEE3@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1274389427 466 80.91.229.12 (20 May 2010 21:03:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 20 May 2010 21:03:47 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Reitter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 20 23:03:46 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OFCu9-0008SM-WD for ged-emacs-devel@m.gmane.org; Thu, 20 May 2010 23:03:46 +0200 Original-Received: from localhost ([127.0.0.1]:54419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFCu9-00036I-8P for ged-emacs-devel@m.gmane.org; Thu, 20 May 2010 17:03:45 -0400 Original-Received: from [140.186.70.92] (port=49357 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFCtv-00034d-Qj for emacs-devel@gnu.org; Thu, 20 May 2010 17:03:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OFCtu-0003Kv-6L for emacs-devel@gnu.org; Thu, 20 May 2010 17:03:31 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:63473) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFCtt-0003Ko-UF for emacs-devel@gnu.org; Thu, 20 May 2010 17:03:30 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0L2Q00J00KJS4S00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Fri, 21 May 2010 00:02:27 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.33.125]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L2Q00ITKL42K640@a-mtaout21.012.net.il>; Fri, 21 May 2010 00:02:27 +0300 (IDT) In-reply-to: <45790724-63FC-4B80-A70D-8CD49A92FEE3@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:124972 Archived-At: > From: David Reitter > Date: Thu, 20 May 2010 16:30:59 -0400 > > +(defun visual-line-line-range () > + (save-excursion > + (cons (progn (vertical-motion 0) (point)) > + (progn (vertical-motion 1) (point))))) This will do The Wrong Thing with bidirectional text, because vertical-motion puts you on column zero, which is not necessarily the first character after a newline, in buffer's order of increasing character positions (a.k.a. "logical order"). The net effect will be that only part of the screen line will be highlighted. I just yesterday fixed a similar problem in move-end-of-line (see revno 100369). You need to proactively get to the line's first character, with either skip-chars-backward or (per Stefan's suggestion) `(forward-line 0)'. Morale: in Emacs 24, we need to unlearn the seemingly obvious assumption that the first character at the window margin always follows the newline of the previous line. It is no longer true.