unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* No kill-ring-save region signalling in transient-mark-mode
@ 2004-04-30  7:47 Milan Zamazal
  2004-04-30  9:27 ` Juri Linkov
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Milan Zamazal @ 2004-04-30  7:47 UTC (permalink / raw)


In the current CVS version, the function kill-ring-save doesn't signal
visible region boundaries with moving cursor when transient-mark-mode is
enabled.  This is probably based on a false assumption that region
highlighting is always visible in transient-mark-mode.  But it may not
be so -- I use transient-mark-mode for its other effects and disable the
highlighting.  Thus when I apply `M-w', I can't see what region was
killed.

So I suggest to add a user option that can re-enable visible region
signalling in kill-ring-save.  What do you think about it?

Milan Zamazal

-- 
As is typical in civilized (i.e., non-corporate) email discussions, my
remarks *follow* (not precede) their context.
                                   -- Branden Robinson in debian-legal

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30  7:47 No kill-ring-save region signalling in transient-mark-mode Milan Zamazal
@ 2004-04-30  9:27 ` Juri Linkov
  2004-04-30 10:49 ` Kim F. Storm
  2004-05-01  9:44 ` Richard Stallman
  2 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2004-04-30  9:27 UTC (permalink / raw)
  Cc: emacs-devel

Milan Zamazal <pdm@zamazal.org> writes:
> So I suggest to add a user option that can re-enable visible region
> signalling in kill-ring-save.  What do you think about it?

A new option would be good.  The same option could be used also
to specify a delay after showing the region end.  I recently
replaced the constant 1 by `blink-matching-delay' for this purpose,
but a new special option would be useful for this and for your needs
as well.  When nil, it could disable showing the region end, and
when integer, to specify a delay.  However, I can't suggest a good
default value for backward compatibility.  And if this option is
relevant only for transient-mark-mode, then two separate options
will be needed.

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30 10:49 ` Kim F. Storm
@ 2004-04-30  9:44   ` Milan Zamazal
  2004-04-30 12:18     ` Kim F. Storm
  0 siblings, 1 reply; 9+ messages in thread
From: Milan Zamazal @ 2004-04-30  9:44 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "KFS" == Kim F Storm <storm@cua.dk> writes:

    KFS> How do you disable highlighting?

The simplest method is to customize the `region' face to become
invisible.  It has an important drawback that regions are invisible when
selecting them with mouse.  For this reason I use the following code to
disable the highlighting:

  (defvar mtmm-highlighted-background "blue3")

  (defun mtmm-reset-background ()
    (set-face-attribute 'region nil :background 'unspecified))

  (defun mtmm-highlight-background ()
    (add-hook 'pre-command-hook 'mtmm-reset-background)
    (set-face-attribute 'region (selected-frame)
                        :background mtmm-highlighted-background))

  (defmacro mtmm-advice (function)
    `(defadvice ,function (before mtmm-highlight-region activate)
       (mtmm-highlight-background)))

  (mtmm-advice mouse-drag-region)
  (mtmm-advice mouse-kill-ring-save)
  (mtmm-advice mouse-save-then-kill)
  (mtmm-advice mouse-set-region)

  (mtmm-reset-background)

    KFS> The proper fix would be to ammend the test for
    KFS> transient-mark-mode with a test to see if highlighting is
    KFS> enabled.

Sure, but I think there is currently no good way to detect that a user
has disabled region highlighting some way.

Milan Zamazal

-- 
When you're in a fight with an idiot, it's difficult for other people to tell
which one the idiot is.                       -- Bruce Perens in debian-devel

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30 12:18     ` Kim F. Storm
@ 2004-04-30 10:37       ` Milan Zamazal
  2004-04-30 19:59         ` Kim F. Storm
  2004-05-01 17:50       ` Richard Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Milan Zamazal @ 2004-04-30 10:37 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "KFS" == Kim F Storm <storm@cua.dk> writes:

    KFS> Looking at the region face does seem to be a "good way".

    KFS> Does the following patch give good results ?

It does for me.  I'm not sure it is general enough, but I think it would
be good to apply the patch anyway.  If anybody needs a more complex
solution (e.g. as Juri Linkov suggested), it can be implemented later.

Milan Zamazal

-- 
This mail contains a hashcash stamp.
See http://www.hashcash.org for more information.

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30  7:47 No kill-ring-save region signalling in transient-mark-mode Milan Zamazal
  2004-04-30  9:27 ` Juri Linkov
@ 2004-04-30 10:49 ` Kim F. Storm
  2004-04-30  9:44   ` Milan Zamazal
  2004-05-01  9:44 ` Richard Stallman
  2 siblings, 1 reply; 9+ messages in thread
From: Kim F. Storm @ 2004-04-30 10:49 UTC (permalink / raw)
  Cc: emacs-devel

Milan Zamazal <pdm@zamazal.org> writes:

> In the current CVS version, the function kill-ring-save doesn't signal
> visible region boundaries with moving cursor when transient-mark-mode is
> enabled.  This is probably based on a false assumption that region
> highlighting is always visible in transient-mark-mode.  But it may not
> be so -- I use transient-mark-mode for its other effects and disable the
> highlighting.  Thus when I apply `M-w', I can't see what region was
> killed.

How do you disable highlighting?

The proper fix would be to ammend the test for transient-mark-mode
with a test to see if highlighting is enabled.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30  9:44   ` Milan Zamazal
@ 2004-04-30 12:18     ` Kim F. Storm
  2004-04-30 10:37       ` Milan Zamazal
  2004-05-01 17:50       ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Kim F. Storm @ 2004-04-30 12:18 UTC (permalink / raw)
  Cc: emacs-devel

Milan Zamazal <pdm@zamazal.org> writes:

> Sure, but I think there is currently no good way to detect that a user
> has disabled region highlighting some way.

Looking at the region face does seem to be a "good way".

Does the following patch give good results ?

*** simple.el	27 Apr 2004 11:42:32 +0200	1.639
--- simple.el	30 Apr 2004 14:14:26 +0200	
***************
*** 2144,2150 ****
  	    ;; look like a C-g typed as a command.
  	    (inhibit-quit t))
  	(if (pos-visible-in-window-p other-end (selected-window))
! 	    (unless transient-mark-mode
  	      ;; Swap point and mark.
  	      (set-marker (mark-marker) (point) (current-buffer))
  	      (goto-char other-end)
--- 2144,2151 ----
  	    ;; look like a C-g typed as a command.
  	    (inhibit-quit t))
  	(if (pos-visible-in-window-p other-end (selected-window))
! 	    (unless (and transient-mark-mode
! 			 (face-background 'region))
  	      ;; Swap point and mark.
  	      (set-marker (mark-marker) (point) (current-buffer))
  	      (goto-char other-end)

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30 10:37       ` Milan Zamazal
@ 2004-04-30 19:59         ` Kim F. Storm
  0 siblings, 0 replies; 9+ messages in thread
From: Kim F. Storm @ 2004-04-30 19:59 UTC (permalink / raw)
  Cc: emacs-devel

Milan Zamazal <pdm@zamazal.org> writes:

> >>>>> "KFS" == Kim F Storm <storm@cua.dk> writes:
> 
>     KFS> Looking at the region face does seem to be a "good way".
> 
>     KFS> Does the following patch give good results ?
> 
> It does for me.  I'm not sure it is general enough, but I think it would
> be good to apply the patch anyway.  If anybody needs a more complex
> solution (e.g. as Juri Linkov suggested), it can be implemented later.

I installed the change.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30  7:47 No kill-ring-save region signalling in transient-mark-mode Milan Zamazal
  2004-04-30  9:27 ` Juri Linkov
  2004-04-30 10:49 ` Kim F. Storm
@ 2004-05-01  9:44 ` Richard Stallman
  2 siblings, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2004-05-01  9:44 UTC (permalink / raw)
  Cc: emacs-devel

    So I suggest to add a user option that can re-enable visible region
    signalling in kill-ring-save.  What do you think about it?

I think we should not add options for such obscure situations.  The
few users who want to do this can can change the function's definition
easily enough.

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

* Re: No kill-ring-save region signalling in transient-mark-mode
  2004-04-30 12:18     ` Kim F. Storm
  2004-04-30 10:37       ` Milan Zamazal
@ 2004-05-01 17:50       ` Richard Stallman
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2004-05-01 17:50 UTC (permalink / raw)
  Cc: pdm, emacs-devel

    Looking at the region face does seem to be a "good way".

    Does the following patch give good results ?

I don't object to this patch, since it avoids adding an option
that would make Emacs more complicated.  So the cost of it
is very small.

Thanks for thinking of this approach.

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

end of thread, other threads:[~2004-05-01 17:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-30  7:47 No kill-ring-save region signalling in transient-mark-mode Milan Zamazal
2004-04-30  9:27 ` Juri Linkov
2004-04-30 10:49 ` Kim F. Storm
2004-04-30  9:44   ` Milan Zamazal
2004-04-30 12:18     ` Kim F. Storm
2004-04-30 10:37       ` Milan Zamazal
2004-04-30 19:59         ` Kim F. Storm
2004-05-01 17:50       ` Richard Stallman
2004-05-01  9:44 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).