emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion for hl-line.el


From: Stefan Monnier
Subject: Re: Suggestion for hl-line.el
Date: Thu, 15 May 2003 11:50:46 -0400

> > 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]