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: Suggestion for hl-line.el Date: Thu, 15 May 2003 11:50:46 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305151550.h4FFokqA023107@rum.cs.yale.edu> References: <200305071446.h47EkSJw014780@rum.cs.yale.edu> <200305081448.h48EmnZd019230@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053014506 12048 80.91.224.249 (15 May 2003 16:01:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 15 May 2003 16:01:46 +0000 (UTC) Cc: Stefan Monnier Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu May 15 18:01:44 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 19GL6g-0002n5-00 for ; Thu, 15 May 2003 17:57:22 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19GLEc-0000KM-00 for ; Thu, 15 May 2003 18:05:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GL5S-0001Ag-08 for emacs-devel@quimby.gnus.org; Thu, 15 May 2003 11:56:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19GL3Y-0008EM-00 for emacs-devel@gnu.org; Thu, 15 May 2003 11:54:08 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19GL1s-0007Nx-00 for emacs-devel@gnu.org; Thu, 15 May 2003 11:52:25 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19GL0S-0007GZ-00 for emacs-devel@gnu.org; Thu, 15 May 2003 11:50:56 -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 h4FFolx6023109; Thu, 15 May 2003 11:50:47 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h4FFokqA023107; Thu, 15 May 2003 11:50:46 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Lute Kamstra 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:13901 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13901 > > Well, if it's up to me... I like the idea of one local mode that is > > governed by a hl-line-sticky-flag variable and one non-sticky global > > mode that is implemented directly. I guess nobody will want to use a > > sticky global mode. > > I committed this change. If you like, you could take a look and see > how bad I messed up. (I'd appreciate it.) Since you asked for it ;-) - Use present tense in the ChangeLog message (I've just changed it). - Replace (1+ (line-end-position)) with (line-beginning-position 2) (I know this was already in the code before, but I just noticed it). - I hate code duplication so I'd have kept a single highlight and a single unhighlight function. Basically, I'd have aimed for something like: (define-minor-mode global-hl-line-mode "foo" (setq-default hl-line-mode global-hl-line-mode) (if global-hl-line-mode (progn (add-hook 'pre-command-hook #'hl-line-unhighlight) (add-hook 'post-command-hook #'hl-line-highlight)) (global-hl-line-unhighlight) (remove-hook 'pre-command-hook #'hl-line-unhighlight) (remove-hook 'post-command-hook #'hl-line-highlight))) - Ideally, doing M-x global-hl-line-mode and then M-x hl-line-mode should give you hl-line in all buffers except the current one. Merging the global and local mode may not be as simple as I make it out to be, tho, especially w.r.t. the hl-line-overlay (which I wouldn't `make-variable-buffer-local' but would rather `make-local-variable' in hl-line-mode). This said, thank you for writing it, Stefan