From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#36361: 'hl-line-range-function' as list of choice Date: Tue, 26 Oct 2021 22:11:28 +0300 Message-ID: <831r47y527.fsf@gnu.org> References: <57613049-fca3-ba0e-82b1-3ff2e1995da8@gmail.com> <1EAD3D6A-620E-4863-A0CB-4A7977FE0842@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17650"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 36361@debbugs.gnu.org To: Howard Melman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 26 21:12:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mfRrn-0004Md-Bl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 21:12:11 +0200 Original-Received: from localhost ([::1]:48616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfRrl-0005bj-QO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 15:12:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfRre-0005Z8-M2 for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 15:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfRre-0001y5-D4 for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 15:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfRre-0000vZ-8S for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 15:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Oct 2021 19:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36361 X-GNU-PR-Package: emacs Original-Received: via spool by 36361-submit@debbugs.gnu.org id=B36361.16352755003534 (code B ref 36361); Tue, 26 Oct 2021 19:12:02 +0000 Original-Received: (at 36361) by debbugs.gnu.org; 26 Oct 2021 19:11:40 +0000 Original-Received: from localhost ([127.0.0.1]:47568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfRrH-0000uw-RC for submit@debbugs.gnu.org; Tue, 26 Oct 2021 15:11:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfRrF-0000uf-NF for 36361@debbugs.gnu.org; Tue, 26 Oct 2021 15:11:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:38304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfRrA-0001vB-Cm; Tue, 26 Oct 2021 15:11:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=My57kzGsP05iAy9x5hPsZVFDglsyffWtEflwWWjlBSA=; b=paf2hnhvcyy5 QSvtdgVYy0RMlKmX87GrNucctztYSZYBkK4DoK5lK0bnMxyBxvF4zZKMogosNmc5apDtR+t/uMc/k eaihUUtls7s1h+ZycwN6z+hxbh+moPzOQFkGpQ8XrOhIVoefGGUE42xmuHfo+7lmkYEWC/sfkUhxK xataa56lDsjD8+Qb5F3RH5jBm7kDJTv4AfSma/MxOMr4pAzyQiTCRCndu9hnTobU8nbvDfmQ7xvx2 4Ah/+SFCxETWovQgYXh7nm/T1RzWcrAsAiwkGXpn3bHdaPtZ31K7g1HWymnczU/OdjxeRbCWrJcnd qxUKY4CgIcMylN2wrr+PlA==; Original-Received: from [87.69.77.57] (port=4819 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfRr9-0001qj-Rl; Tue, 26 Oct 2021 15:11:32 -0400 In-Reply-To: <1EAD3D6A-620E-4863-A0CB-4A7977FE0842@gmail.com> (message from Howard Melman on Tue, 26 Oct 2021 14:48:53 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:218401 Archived-At: > From: Howard Melman > Date: Tue, 26 Oct 2021 14:48:53 -0400 > > FWIW, I've been using the following in Emacs 27.2: > > #+begin_src elisp > (defun visual-line-range-function () > "Return a cons cell of positions of begining and end > of the current line in `visual-line-mode`. Meant to be used > as the value of `hl-line-range-function`." > (save-excursion > (cons (progn (beginning-of-visual-line) (point)) > (progn (beginning-of-visual-line 2) (point))))) > > (defun set-visual-line-range-function () > (setq-local hl-line-range-function > (if visual-line-mode 'visual-line-range-function nil))) > > (add-hook 'visual-line-mode-hook 'set-visual-line-range-function) > #+end_src > > but it seems to conflict with the temporary-goal-column in > line-move-visual. If I have a buffer: > > - foo > - bar > - zot > > With point just before foo and do C-n twice, the first one moves point > to just before bar, but the second moves point to the beginning of the > 3rd line. > > Suggestions for an improved version are welcome. Try this: (defun visual-line-range-function () "Return a cons cell of positions of begining and end of the current line in `visual-line-mode`. Meant to be used as the value of `hl-line-range-function`." (save-excursion (cons (progn (vertical-motion 0) (point)) (progn (vertical-motion 1) (point)))))