all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 7260@debbugs.gnu.org, rms@gnu.org, emacs-devel@gnu.org
Subject: bug#7260: 24.0.50; DEL screwed up
Date: Thu, 21 Oct 2010 22:30:20 +0200	[thread overview]
Message-ID: <m3tykfwaoz.fsf__45236.8301609114$1287693792$gmane$org@quimbies.gnus.org> (raw)
In-Reply-To: <87k4lb9u8g.fsf@stupidchicken.com>

Chong Yidong <cyd@stupidchicken.com> writes:

> Ah yes, now I recall: the idea was to flip the meaning of ARG in
> exchange-point-and-mark, yes?

Yup.

> This is not a bad idea in principle.  But the effects may be strange.
> It would mean that, when the mark is active, you need to do C-u C-x
> C-x to exchange point and mark without deactivating the mark, which is
> inconvenient.  So this may need tweaking.

Ah, yes, true.  

> For this change, please post your proposed change as a patch to
> emacs-devel, for others to comment, instead of checking it in directly.

Sure.

I've spelled out all the cases instead of using the
(xor arg (not (region-active-p))) logic for clarity.

It seems to do the trick in all the use cases (transient with active
mark, without active mark, with and without prefix, and non-transient
with and without prefix).  Unless there was some combination I forgot to
check. 

=== modified file 'lisp/simple.el'
*** lisp/simple.el	2010-10-19 15:43:27 +0000
--- lisp/simple.el	2010-10-21 20:27:22 +0000
***************
*** 3966,3993 ****
    'exchange-dot-and-mark 'exchange-point-and-mark "23.3")
  (defun exchange-point-and-mark (&optional arg)
    "Put the mark where point is now, and point where the mark is now.
- This command works even when the mark is not active,
- and it reactivates the mark.
  
! If Transient Mark mode is on, a prefix ARG deactivates the mark
! if it is active, and otherwise avoids reactivating it.  If
! Transient Mark mode is off, a prefix ARG enables Transient Mark
! mode temporarily."
    (interactive "P")
    (let ((omark (mark t))
  	(temp-highlight (eq (car-safe transient-mark-mode) 'only)))
      (if (null omark)
          (error "No mark set in this buffer"))
      (deactivate-mark)
!     (set-mark (point))
      (goto-char omark)
      (if set-mark-default-inactive (deactivate-mark))
      (cond (temp-highlight
  	   (setq transient-mark-mode (cons 'only transient-mark-mode)))
! 	  ((or (and arg (region-active-p)) ; (xor arg (not (region-active-p)))
! 	       (not (or arg (region-active-p))))
! 	   (deactivate-mark))
! 	  (t (activate-mark)))
      nil))
  
  (defcustom shift-select-mode t
--- 3966,3999 ----
    'exchange-dot-and-mark 'exchange-point-and-mark "23.3")
  (defun exchange-point-and-mark (&optional arg)
    "Put the mark where point is now, and point where the mark is now.
  
! If Transient Mark mode is on, a prefix ARG activates the mark if
! it is inactive.  If Transient Mark mode is off, a prefix ARG
! enables Transient Mark mode temporarily."
    (interactive "P")
    (let ((omark (mark t))
+ 	(active (region-active-p))
  	(temp-highlight (eq (car-safe transient-mark-mode) 'only)))
      (if (null omark)
          (error "No mark set in this buffer"))
      (deactivate-mark)
!     (push-mark (point))
      (goto-char omark)
      (if set-mark-default-inactive (deactivate-mark))
      (cond (temp-highlight
  	   (setq transient-mark-mode (cons 'only transient-mark-mode)))
! 	  ;; Transient mode and active region -- activate.
! 	  ((and active
! 		(not arg))
! 	   (activate-mark))
! 	  ;; Transient mode and no prefix -- leave deactivated.
! 	  ((and (not active)
! 		(not arg))
! 	   )
! 	  ;; Non-transient mode, but prefix -- activate.
! 	  ((and (not transient-mark-mode)
! 		arg)
! 	   (activate-mark)))
      nil))
  
  (defcustom shift-select-mode t


-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen





  reply	other threads:[~2010-10-21 20:30 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4.1287666765.3734.bug-gnu-emacs@gnu.org>
2010-10-21 17:21 ` bug#7260: 24.0.50; DEL screwed up Lars Magne Ingebrigtsen
2010-10-21 18:19   ` Lennart Borgman
2010-10-21 18:26     ` Lars Magne Ingebrigtsen
2010-10-21 18:45   ` Drew Adams
2010-10-21 18:45   ` Drew Adams
2010-10-22 12:22     ` Richard Stallman
2010-10-22 13:52       ` Lars Magne Ingebrigtsen
2010-10-22 15:04         ` Andreas Schwab
2010-10-22 15:49           ` Miles Bader
2010-10-22 16:45             ` David Kastrup
2010-10-22 15:49           ` Miles Bader
2010-10-22 15:04         ` Andreas Schwab
2010-10-22 15:47         ` Miles Bader
2010-10-22 15:47         ` Miles Bader
2010-10-22 16:10           ` Lars Magne Ingebrigtsen
2010-10-21 12:53             ` Richard Stallman
2010-10-22 16:44               ` David Kastrup
2012-02-19  6:09               ` Chong Yidong
2010-10-22 16:42             ` Andreas Schwab
2010-10-22 16:42             ` Andreas Schwab
2010-10-22 16:45               ` Lars Magne Ingebrigtsen
2010-10-22 18:24                 ` Eli Zaretskii
2010-10-22 18:32                   ` Lars Magne Ingebrigtsen
2010-10-22 18:55                     ` Andreas Röhler
2010-10-22 19:01                     ` Eli Zaretskii
2010-10-23  4:36                     ` Stephen J. Turnbull
2010-10-23  7:05                       ` David Kastrup
2010-10-23 12:53                         ` Stephen J. Turnbull
2010-10-22 18:24                 ` Eli Zaretskii
2010-10-22 16:45               ` Lars Magne Ingebrigtsen
2010-10-23  7:46         ` Richard Stallman
2010-10-23  7:46         ` Richard Stallman
2010-10-23  7:46         ` Richard Stallman
2010-10-23  9:38           ` Jan Djärv
2010-10-23  9:38           ` Jan Djärv
2010-10-23 17:26             ` James Cloos
2010-10-23 17:54               ` James Cloos
2010-10-24  7:04                 ` David Kastrup
2010-10-23 17:54               ` James Cloos
2010-10-23 17:26             ` James Cloos
2010-10-24 16:30           ` Chong Yidong
2010-10-24 16:30           ` Chong Yidong
2010-10-25 12:08             ` Richard Stallman
2010-10-25 12:08             ` Richard Stallman
2010-10-23  7:46         ` Richard Stallman
2010-10-23 11:18         ` Bastien
2010-10-23 14:21           ` David Kastrup
2010-10-23 16:09             ` Lars Magne Ingebrigtsen
2010-10-23 16:09             ` Lars Magne Ingebrigtsen
2010-10-23 11:18         ` Bastien
2010-10-22 13:52       ` Lars Magne Ingebrigtsen
2010-10-22 14:31       ` Helmut Eller
2010-10-22 15:17         ` Jason Rumney
2010-10-22 17:06           ` Andreas Röhler
2010-10-23  4:25             ` Stephen J. Turnbull
2010-10-22 12:22     ` Richard Stallman
2010-10-21 19:39   ` Chong Yidong
     [not found]   ` <mailman.8.1287690197.32629.bug-gnu-emacs@gnu.org>
2010-10-21 20:01     ` Lars Magne Ingebrigtsen
2010-10-21 20:16       ` Chong Yidong
2010-10-21 20:30         ` Lars Magne Ingebrigtsen [this message]
2010-10-21 20:30         ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='m3tykfwaoz.fsf__45236.8301609114$1287693792$gmane$org@quimbies.gnus.org' \
    --to=larsi@gnus.org \
    --cc=7260@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.