Subject: bug#22873: Can we support multiple Cursors?

From: Keith David Bershatsky <[email-masked]>
Date: Tue, 29 Mar 2016 10:26:21 -0700

Thank you, Eli, for taking a look at the 7th working draft of mc.

Essentially, mc_calc is called at only one location depending on how Emacs was built:

* nsterm.m when built --with-ns.

* w32term.c when built for Windows.

* xterm.c when built --with-x.

All three of those files have similarities, and some of the functions in each file are either the same or similar.  I felt that tacking mc_calc onto the heels of a function from `xdisp.c` and putting in exceptions (to prevent it from always being called), is not as clean as putting it only where it was truly needed.  In a nutshell, I'm just following in the footsteps of my predecessors as to cursors for Emacs on Windows, OSX and X11.

I have made a note on my todo-list to add support for alternative methods for the end user to define colors:  [1.0 0.0 0.0]; "red"; "#FF0000"; (255, 0, 0); (65535, 0, 0) -- with some way to distinguish between the last two forms.  (1.0 is used by OSX; 255 is used by Windows; and 65535 is used by X11).

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

At Tue, 29 Mar 2016 17:58:21 +0300,
Eli Zaretskii wrote:
> 
> * * *
> > 
> > mc_calc now runs from the applicable nsterm.m/w32term.c/xterm.c, instead of xdisp.c.
> 
> Why is that a good idea?  You have 3 almost identical copies of the
> same code, which goes against our long-time trend to have terminal
> independent code only once, for easier maintenance.
> 
> >                         ((oddp current-column)
> >                           (list pos "bar" [1.0 0.0 0.0])) ;; red
> >                         ((evenp current-column)
> >                           (list pos "bar" [0.0 0.0 1.0])))))) ;; blue
> 
> That's not how we specify colors in Emacs, not on the user level,
> anyway.  I don't think I like this design.  Why not use the existing
> mechanisms for specifying the cursor color?