[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Re: Proposal to change cursor appearance to indicate region acti
From: |
Kelly Dean |
Subject: |
[PATCH] Re: Proposal to change cursor appearance to indicate region activation |
Date: |
Thu, 22 Jan 2015 05:38:34 +0000 |
Stefan Monnier wrote on 23 Nov 2013:
>> (add-hook 'deactivate-mark-hook (lambda () (setq cursor-type t)))
>> (add-hook 'activate-mark-hook (lambda () (setq cursor-type 'bar)))
>
> I like the idea, but this collides with other uses of cursor-type.
> Could someone cook up a patch which only does the above if cursor-type
> has not been modified (and which lets users opt-out if they prefer).
> Also, the patch should directly modify deactivate-mark and activate-mark
> rather than using the hooks.
Ok. Patch attached below.
With dynamic-cursor-mode turned off, it won't interfere with other uses of
cursor-type.
And if you enable/disable dynamic-cursor-mode buffer-locally, it won't
interfere with other uses of cursor-type in other buffers. In fact I have a
couple of minor modes in my own packages that rely on this separation.
Third hunk adjusted to avoid conflict with current Emacs trunk.
--- emacs-24.4/lisp/simple.el
+++ emacs-24.4/lisp/simple.el
@@ -4391,6 +4391,12 @@
(declare-function x-selection-exists-p "xselect.c"
(&optional selection terminal))
+(defcustom dynamic-cursor-mode 't
+ "If non-nil, `cursor-type' is set dynamically to reflect `mark-active'."
+ :type 'boolean
+ :version "25.1"
+ :group 'editing-basics)
+
(defun deactivate-mark (&optional force)
"Deactivate the mark.
If Transient Mark mode is disabled, this function normally does
@@ -4430,6 +4436,7 @@
((eq transient-mark-mode 'lambda)
(setq transient-mark-mode nil)))
(setq mark-active nil)
+ (if dynamic-cursor-mode (setq cursor-type 't))
(run-hooks 'deactivate-mark-hook)
(redisplay--update-region-highlight (selected-window))))
@@ -4445,3 +4452,4 @@
+ (if dynamic-cursor-mode (setq cursor-type 'bar))
(run-hooks 'activate-mark-hook))))
(defun set-mark (pos)
- [PATCH] Re: Proposal to change cursor appearance to indicate region activation,
Kelly Dean <=
- Re: [PATCH] Re: Proposal to change cursor appearance to indicate region activation, Stefan Monnier, 2015/01/22
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Kelly Dean, 2015/01/22
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Stefan Monnier, 2015/01/22
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Kelly Dean, 2015/01/23
- RE: [PATCH] Proposal to change cursor appearance to indicate region activation, Drew Adams, 2015/01/23
- RE: [PATCH] Proposal to change cursor appearance to indicate region activation, Kelly Dean, 2015/01/23
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Stefan Monnier, 2015/01/23
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Kelly Dean, 2015/01/24
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Stefan Monnier, 2015/01/25
- Re: [PATCH] Proposal to change cursor appearance to indicate region activation, Stefan Monnier, 2015/01/23