all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: change cursor type
       [not found] <f998fc25-7848-4ac4-8e47-ed4364c7c848@j27g2000vbp.googlegroups.com>
@ 2010-05-26 15:15 ` Lowell Gilbert
  2010-05-27 14:28   ` patrol
  2013-11-29 10:08 ` mohamedaslam785
  1 sibling, 1 reply; 9+ messages in thread
From: Lowell Gilbert @ 2010-05-26 15:15 UTC (permalink / raw
  To: help-gnu-emacs

patrol <patrol_boat@hotmail.com> writes:

> Hi,
> I want to change the cursor from box to bar style. Apparently, the
> variable cursor-type is not a "user-option" variable and so doesn't
> respond to M-x set-variable. I'm not clear on this distinction between
> user-option and "non-user-option" variables, and the manual doesn't
> seem to say anything about it (I could be mistaken but I didn't find
> anything). Can anyone tell me how to change the value of cursor-type
> to "bar"? I'd like the change to be global.
> Thanks so much.

Add to .emacs:
(setq-default cursor-type 'bar)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
  2010-05-26 15:15 ` change cursor type Lowell Gilbert
@ 2010-05-27 14:28   ` patrol
       [not found]     ` <44ocg1dqmd.fsf@be-well.ilk.org>
  0 siblings, 1 reply; 9+ messages in thread
From: patrol @ 2010-05-27 14:28 UTC (permalink / raw
  To: help-gnu-emacs

On May 26, 11:15 am, Lowell Gilbert <lguse...@be-well.ilk.org> wrote:

> Add to .emacs:
> (setq-default cursor-type 'bar)

I see. So these variables assignments must be done using Lisp. The
Emacs manual is great, but it doesn't make that point clear. Thanks.

But why can't you just change the value of any variable using the set-
variable command? Why make some variables "user-option" and others
not? What's wrong with allowing:

M-x set-variable RET cursor-type RET "bar"



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
       [not found]     ` <44ocg1dqmd.fsf@be-well.ilk.org>
@ 2010-05-28 20:03       ` patrol
  0 siblings, 0 replies; 9+ messages in thread
From: patrol @ 2010-05-28 20:03 UTC (permalink / raw
  To: help-gnu-emacs

On May 27, 4:41 pm, Lowell Gilbert <lguse...@be-well.ilk.org> wrote:
> patrol <patrol_b...@hotmail.com> writes:
> > On May 26, 11:15 am, Lowell Gilbert <lguse...@be-well.ilk.org> wrote:
>
> >> Add to .emacs:
> >> (setq-default cursor-type 'bar)
>
> > I see. So these variables assignments must be done using Lisp. The
> > Emacs manual is great, but it doesn't make that point clear. Thanks.
>
> I don't actually know that that is true.  
> There may be more than one way to do it;
> in fact, there often is with emacs.
>
> > But why can't you just change the value of any variable using the set-
> > variable command? Why make some variables "user-option" and others
> > not? What's wrong with allowing:
>
> > M-x set-variable RET cursor-type RET "bar"
>
> This is a special case, because when you do M-x, you are no longer in
> the same buffer.  Because that variable is buffer-local, changing it
> interactively would never set it in the buffer that you actually wanted
> to change it in.
>
> Does that make sense?

I think so. You seem to be saying that, because cursor-type is a
buffer-local variable, setting it in the minibuffer would only change
the cursor in the minibuffer itself, correct? Do you know this for a
fact, or would you say it's more of an "educated guess" on your part.
If you're right, you wouldn't be able to change *any* buffer-local
variable using M-x set-variable.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
       [not found] <f998fc25-7848-4ac4-8e47-ed4364c7c848@j27g2000vbp.googlegroups.com>
  2010-05-26 15:15 ` change cursor type Lowell Gilbert
@ 2013-11-29 10:08 ` mohamedaslam785
  2013-11-29 15:50   ` Drew Adams
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: mohamedaslam785 @ 2013-11-29 10:08 UTC (permalink / raw
  To: help-gnu-emacs

On Tuesday, 25 May 2010 23:34:56 UTC+5:30, patrol  wrote:
> Hi,
> I want to change the cursor from box to bar style. Apparently, the
> variable cursor-type is not a "user-option" variable and so doesn't
> respond to M-x set-variable. I'm not clear on this distinction between
> user-option and "non-user-option" variables, and the manual doesn't
> seem to say anything about it (I could be mistaken but I didn't find
> anything). Can anyone tell me how to change the value of cursor-type
> to "bar"? I'd like the change to be global.
> Thanks so much.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: change cursor type
  2013-11-29 10:08 ` mohamedaslam785
@ 2013-11-29 15:50   ` Drew Adams
  2013-11-29 16:43   ` Dan Espen
  2013-12-06 13:38   ` Daniel E. Doherty
  2 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2013-11-29 15:50 UTC (permalink / raw
  To: mohamedaslam785, help-gnu-emacs

> > I want to change the cursor from box to bar style. Apparently, the
> > variable cursor-type is not a "user-option" variable and so doesn't
> > respond to M-x set-variable. I'm not clear on this distinction between
> > user-option and "non-user-option" variables, and the manual doesn't
> > seem to say anything about it (I could be mistaken but I didn't find
> > anything). Can anyone tell me how to change the value of cursor-type
> > to "bar"? I'd like the change to be global.

A user option is a variable defined using `defcustom', not `defvar'.
A user option is intended to be changed by users.  It can be customized
easily, using `M-x customize-option'.  It can also be set using
`set-variable'.

Any variable can be set by a user, using
`M-: (setq THE-VAR THE-NEW-VALUE)'.  Users can change any variable
they like, but it is not necessarily a good idea to do so.

Some variables that are not user options could be, arguably.
In older versions of Emacs, `cursor-type' was not even a variable;
it was only a frame parameter.  In Emacs 22 (it might have been 21)
`cursor-type' became a variable (it is still a frame-parameter also).
As of Emacs 24.3, `cursor-type' is not an option, but you can change
it without problems.

In Emacs 24.4 (not yet released) `cursor-type' will be a user option.

See the Emacs manual, node `Easy Customization' for information about
options vs other variables.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
  2013-11-29 10:08 ` mohamedaslam785
  2013-11-29 15:50   ` Drew Adams
@ 2013-11-29 16:43   ` Dan Espen
  2013-11-29 19:30     ` Emanuel Berg
  2013-12-06 13:38   ` Daniel E. Doherty
  2 siblings, 1 reply; 9+ messages in thread
From: Dan Espen @ 2013-11-29 16:43 UTC (permalink / raw
  To: help-gnu-emacs

mohamedaslam785@gmail.com writes:

> On Tuesday, 25 May 2010 23:34:56 UTC+5:30, patrol  wrote:
>> Hi,
>> I want to change the cursor from box to bar style. Apparently, the
>> variable cursor-type is not a "user-option" variable and so doesn't
>> respond to M-x set-variable. I'm not clear on this distinction between
>> user-option and "non-user-option" variables, and the manual doesn't
>> seem to say anything about it (I could be mistaken but I didn't find
>> anything). Can anyone tell me how to change the value of cursor-type
>> to "bar"? I'd like the change to be global.
>> Thanks so much.

Can't tell what this is, except that the original post date is May 2010.

-- 
Dan Espen


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
  2013-11-29 16:43   ` Dan Espen
@ 2013-11-29 19:30     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2013-11-29 19:30 UTC (permalink / raw
  To: help-gnu-emacs

Dan Espen <despen@verizon.net> writes:

>>> I want to change the cursor from box to bar
>>> style. Apparently, the variable cursor-type is not
>>> a "user-option" variable and so doesn't respond to
>>> M-x set-variable. I'm not clear on this distinction
>>> between user-option and "non-user-option"
>>> variables, and the manual doesn't seem to say
>>> anything about it (I could be mistaken but I didn't
>>> find anything). Can anyone tell me how to change
>>> the value of cursor-type to "bar"? I'd like the
>>> change to be global.  Thanks so much.
>
> Can't tell what this is, except that the original
> post date is May 2010.

OK, well, it is interesting nonetheless. Isn't this
something that has to be setup in the terminal
emulator?

In a Linux VT, which is what I use, I get a block
cursor the same color as the face below (which is
great). But if I run 'emacs -nw' in X, in urxvt, and on
top of tmux, I get the underscore.

I know you can disable cursor blink like this:

(blink-cursor-mode -1)

Although it is probably just as good (better) to do
that in the terminal emulator as well, as in

echo 0 > /sys/class/graphics/fbcon/cursor_blink

in /etc/rc.local (on Debian at least) and...

funny, I can't find either getting the block cursor for
the VTs *or* the X terminals, nor the nonblink. But I
remember I did that. Of course, there has been so much
configuration...

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
  2013-11-29 10:08 ` mohamedaslam785
  2013-11-29 15:50   ` Drew Adams
  2013-11-29 16:43   ` Dan Espen
@ 2013-12-06 13:38   ` Daniel E. Doherty
  2013-12-07  2:42     ` Emanuel Berg
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel E. Doherty @ 2013-12-06 13:38 UTC (permalink / raw
  To: help-gnu-emacs


Here is what I have in my init file to change cursor type and color based on
the mode.  This is an org-mode init, so just the SRC blocks.  It's all cribbed
from Dirk-Jan C. Binnema, but the link to Emacs Wiki is broken.

** Cursor Change cursor color according to mode; inspired by
   [[http://www.emacswiki.orgemacs/ChangingCursorDynamically][Wiki Article]].
   Valid values for "cursor type" are explained at
   [[info:emacs#Cursor%20Display][Cursor Display]] in the manual.

#+BEGIN_SRC emacs-lisp :tangle yes
  (setq djcb-read-only-color       "red")
  (setq djcb-read-only-cursor-type '(hbar . 5))
  (setq djcb-overwrite-color       "yellow")
  (setq djcb-overwrite-cursor-type 'box)
  (setq djcb-normal-color          "green")
  (setq djcb-normal-cursor-type    '(bar . 5))
  (blink-cursor-mode 1)
#+END_SRC

Define function to change the cursor type according to the current
mode.
#+BEGIN_SRC emacs-lisp :tangle yes
  (defun djcb-set-cursor-according-to-mode ()
    "Change cursor color and type according to some minor modes."
    (cond
     (buffer-read-only
      (set-cursor-color djcb-read-only-color)
      (setq cursor-type djcb-read-only-cursor-type))
     (overwrite-mode
      (set-cursor-color djcb-overwrite-color)
      (setq cursor-type djcb-overwrite-cursor-type))
     (t
      (set-cursor-color djcb-normal-color)
      (setq cursor-type djcb-normal-cursor-type))))
#+END_SRC

And call it after each command is run.
#+BEGIN_SRC emacs-lisp :tangle yes
  (add-hook 'post-command-hook 'djcb-set-cursor-according-to-mode)
#+END_SRC

-- 
====================================================
Daniel E. Doherty


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change cursor type
  2013-12-06 13:38   ` Daniel E. Doherty
@ 2013-12-07  2:42     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2013-12-07  2:42 UTC (permalink / raw
  To: help-gnu-emacs

"Daniel E. Doherty" <ded-law@ddoherty.net> writes:

> Here is what I have in my init file to change cursor
> type and color based on the mode.  This is an
> org-mode init, so just the SRC blocks.

What?

None of it works for me. But never mind, I don't want
it. I don't want the cursor to be based on the mode,
because in one mode there could be (should be) many
colors, and the cursor should reflect that (depending
on what is being typed at the moment).

But I can share one interesting thing. I set faces like
this:

(custom-set-faces
 '(default ((t (:foreground "cyan" :background "black" :bold nil))))
 ;; ...

It is a clear way to setup colors, and fast (just
eval-defun, and you'll see the changes) - anyway, to
get a cyan cursor where there is no face, and no text,
that :background "black" does it. Without it, I get a
white cursor in those cases. I don't know why, but it
took me some time before I got it right (by intuition)
so I thought I'd mention it here.

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-12-07  2:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <f998fc25-7848-4ac4-8e47-ed4364c7c848@j27g2000vbp.googlegroups.com>
2010-05-26 15:15 ` change cursor type Lowell Gilbert
2010-05-27 14:28   ` patrol
     [not found]     ` <44ocg1dqmd.fsf@be-well.ilk.org>
2010-05-28 20:03       ` patrol
2013-11-29 10:08 ` mohamedaslam785
2013-11-29 15:50   ` Drew Adams
2013-11-29 16:43   ` Dan Espen
2013-11-29 19:30     ` Emanuel Berg
2013-12-06 13:38   ` Daniel E. Doherty
2013-12-07  2:42     ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.