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: Lute Kamstra
Subject: Re: Suggestion for hl-line.el
Date: Fri, 16 May 2003 12:07:13 +0200
User-agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3 (gnu/linux)

"Stefan Monnier" <monnier+gnu/address@hidden> writes:

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

I love to learn.  :-)

> - Use present tense in the ChangeLog message (I've just changed it).

Got it.  Err...  Get 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).

Committed.

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

I planned to do this originally, but could not get it to work nicely.
If the global and local mode share an overlay, then the global mode
would make any local mode non-sticky.  Icky.  If the global and local
mode share the (un)highlighting functions, they have to use the same
overlay, as the (un)highlighting functions cannot tell for which mode
they are working.  Maybe I'm missing something?

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

Indeed.  I think it is best (more predictable, consistent behavior) to
let the global and local mode be completely independent.

> (which I wouldn't `make-variable-buffer-local' but would rather
> `make-local-variable' in hl-line-mode).

I thought a bit about this.  Both options would work similarly.  I
figured that using make-variable-buffer-local would make it
(automatically) clear that hl-line-overlay would be used
buffer-locally only.  Why do you prefer make-local-variable?

Lute.





reply via email to

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