GNU bug report logs -
#7260
24.0.50; DEL screwed up
Previous Next
Reported by: rms <at> gnu.org
Date: Thu, 21 Oct 2010 12:51:01 UTC
Severity: normal
Merged with 7235
Found in version 24.0.50
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #31 received at 7260 <at> debbugs.gnu.org (full text, mbox):
Chong Yidong <cyd <at> 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 <at> gnus.org * Lars Magne Ingebrigtsen
This bug report was last modified 13 years and 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.