;;; cua-gmrk.el --- CUA unified global mark support
-;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2016 Free Software Foundation, Inc.
;; Author: Kim F. Storm <storm@cua.dk>
;; Keywords: keyboard emulations convenience cua mark
+;; Package: cua-base
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
-(eval-when-compile
- (require 'cua-base)
- (require 'cua-rect)
- )
+(require 'cua-base)
+(require 'cua-rect)
;;; Global Marker
global marker is in another buffer.
If the global marker isn't set, set the global marker at point in the current
buffer. Otherwise jump to the global marker position and cancel it.
-With prefix argument, don't jump to global mark when cancelling it."
+With prefix argument, don't jump to global mark when canceling it."
(interactive "P")
(unless cua--global-mark-initialized
(cua--init-global-mark))
(defun cua--insert-at-global-mark (str &optional msg)
;; Insert string at global marker and move marker
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(insert-for-yank str)
(cua--activate-global-mark))
(defun cua--delete-at-global-mark (arg &optional msg)
;; Delete chars at global marker
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(delete-char arg))
(if msg
(let ((src-buf (current-buffer)))
(save-excursion
(if (equal (marker-buffer cua--global-mark-marker) src-buf)
- (let ((text (filter-buffer-substring start end nil t)))
+ (let ((text (cua--filter-buffer-noprops start end)))
(goto-char (marker-position cua--global-mark-marker))
(insert text))
(set-buffer (marker-buffer cua--global-mark-marker))
(if (and (< start (marker-position cua--global-mark-marker))
(< (marker-position cua--global-mark-marker) end))
(message "Can't move region into itself")
- (let ((text (filter-buffer-substring start end nil t))
+ (let ((text (cua--filter-buffer-noprops start end))
(p1 (copy-marker start))
(p2 (copy-marker end)))
(goto-char (marker-position cua--global-mark-marker))
(if (cua--global-mark-active)
(let ((src-buf (current-buffer))
(text (cua--extract-rectangle)))
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(if as-text
(while text
(interactive "*")
(if (cua--global-mark-active)
(let (col)
- (save-excursion
- (set-buffer (marker-buffer cua--global-mark-marker))
+ (with-current-buffer (marker-buffer cua--global-mark-marker)
(goto-char (marker-position cua--global-mark-marker))
(setq col (current-column)))
(if cua--rectangle
(defun cua-cancel-global-mark ()
"Cancel the global mark."
(interactive)
- (if mark-active
+ (if (region-active-p)
(cua-cancel)
(if (cua--global-mark-active)
(cua--deactivate-global-mark t)))
(define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark)
(define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark)
(define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark)
- (define-key cua--global-mark-keymap [remap self-insert-iso] 'cua-insert-char-at-global-mark)
;; Catch self-inserting characters which are "stolen" by other modes
(define-key cua--global-mark-keymap [t]
(provide 'cua-gmrk)
-;;; arch-tag: 553d8076-a91d-48ae-825d-6cb962a5f67f
;;; cua-gmrk.el ends here