Lisp HUG Maillist Archive

Highlight active region

I found a few old emails in the archives w.r.t to "Transient Mark
Mode" and highlighting the active region.  The LW IDE basically does
what I want except for highlighting active regions that I've marked
with the keyboard (like with M-Space M-f).

There is a variable called "Highlight Active Region" that is NIL by
default and that can be set to T with the "Set Variable" command.  If
it's true the corresponding buffer does what I want.

However, this variable is buffer-local and I can't figure out how to
make sure it's always T in all buffers from my initialization file.

I tried

  (setf (editor:variable-value "Highlight Active Region") t)

and

  (setf (editor:variable-value "Highlight Active Region" :global) t)

but both don't seem to do it.  Besides, I couldn't find anywhere in
the docs what the difference between :CURRENT and :GLOBAL is.

My next idea was to set this variable when a buffer is created trying
forms like

  (setf (editor:variable-value "Make Buffer Hook" :global)
          (lambda (buffer)
            (setf (editor:variable-value "Highlight Active Region"
                                         :current buffer)
                  t)))

but the results were disastrous, to say the least.

So, how do I do it?

TIA,
Edi.


Re: Highlight active region

Edi Weitz wrote:
> I found a few old emails in the archives w.r.t to "Transient Mark
> Mode" and highlighting the active region.  The LW IDE basically does
> what I want except for highlighting active regions that I've marked
> with the keyboard (like with M-Space M-f).
> 
> There is a variable called "Highlight Active Region" that is NIL by
> default and that can be set to T with the "Set Variable" command.  If
> it's true the corresponding buffer does what I want.
> 
> However, this variable is buffer-local and I can't figure out how to
> make sure it's always T in all buffers from my initialization file.
> 
> I tried
> 
>   (setf (editor:variable-value "Highlight Active Region") t)
> 
> and
> 
>   (setf (editor:variable-value "Highlight Active Region" :global) t)
> 
> but both don't seem to do it.  Besides, I couldn't find anywhere in
> the docs what the difference between :CURRENT and :GLOBAL is.
> 
> My next idea was to set this variable when a buffer is created trying
> forms like
> 
>   (setf (editor:variable-value "Make Buffer Hook" :global)
>           (lambda (buffer)
>             (setf (editor:variable-value "Highlight Active Region"
>                                          :current buffer)
>                   t)))
> 
> but the results were disastrous, to say the least.
> 
> So, how do I do it?
> 
> TIA,
> Edi.
> 
What I have in my initialisation file is the following:

(defcommand "My Set Mark" (p)
      "Sets the mark and turns on highlighting"
      "Sets the mark and turns on highlighting"
   (set-mark-command p)
   (hl-on-command p))
(bind-key "My Set Mark" #\control-\@)
(bind-key "My Set Mark" #\control-space)

Works for me - I wasn't even aware of the variables you mention.  I 
guess there may be a 'nicer' way to do it, but hey.

Barry.



Updated at: 2020-12-10 08:51 UTC