;;; (or MAC GUI or MS-windoze (bah)) look-and-feel
;;; including key bindings.
-;; Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
;; Keywords: convenience emulation
;; 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 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; Eli Barzilay (eli@cs.bgu.ac.il) suggested the sexps functions and
;; keybindings.
;;
-;; Ok, some details about the idea of pc-selection-mode:
+;; Ok, some details about the idea of PC Selection mode:
;;
;; o The standard keys for moving around (right, left, up, down, home, end,
;; prior, next, called "move-keys" from now on) will always de-activate
(defcustom pc-select-selection-keys-only nil
"*Non-nil means only bind the basic selection keys when started.
Other keys that emulate pc-behavior will be untouched.
-This gives mostly Emacs-like behaviour with only the selection keys enabled."
+This gives mostly Emacs-like behavior with only the selection keys enabled."
:type 'boolean
:group 'pc-select)
:group 'pc-select)
(defvar pc-select-saved-settings-alist nil
- "The values of the variables before `pc-selection-mode' was toggled on.
-When `pc-selection-mode' is toggled on, it sets quite a few variables
+ "The values of the variables before PC Selection mode was toggled on.
+When PC Selection mode is toggled on, it sets quite a few variables
for its own purposes. This alist holds the original values of the
-variables `pc-selection-mode' had set, so that these variables can be
-restored to their original values when `pc-selection-mode' is toggled off.")
+variables PC Selection mode had set, so that these variables can be
+restored to their original values when PC Selection mode is toggled off.")
(defvar pc-select-map nil
- "The keymap used as the global map when `pc-selection-mode' is on." )
+ "The keymap used as the global map when PC Selection mode is on." )
(defvar pc-select-saved-global-map nil
- "The global map that was in effect when `pc-selection-mode' was toggled on.")
+ "The global map that was in effect when PC Selection mode was toggled on.")
(defvar pc-select-key-bindings-alist nil
- "This alist holds all the key bindings `pc-selection-mode' sets.")
+ "This alist holds all the key bindings PC Selection mode sets.")
(defvar pc-select-default-key-bindings nil
- "These key bindings always get set by `pc-selection-mode'.")
+ "These key bindings always get set by PC Selection mode.")
(unless pc-select-default-key-bindings
(let ((lst
([C-up] . backward-paragraph-nomark) ; KPrevPara cUp
([S-C-down] . forward-paragraph-mark)
([S-C-up] . backward-paragraph-mark))))
-
+
(setq pc-select-default-key-bindings lst)))
(defvar pc-select-extra-key-bindings nil
([C-M-delete] . kill-sexp)
;; Next line proposed by Eli Barzilay
([C-escape] . electric-buffer-list))))
-
+
(setq pc-select-extra-key-bindings lst)))
(defvar pc-select-meta-moves-sexps-key-bindings
(defvar pc-select-old-M-delete-binding nil
"Holds the old mapping of [M-delete] in the `function-key-map'.
This variable holds the value associated with [M-delete] in the
-`function-key-map' before `pc-selection-mode' had changed that
+`function-key-map' before PC Selection mode had changed that
association.")
;;;;
in `goal-column', which is nil when there is none."
(interactive "p")
(ensure-mark)
- (next-line arg)
+ (with-no-warnings (next-line arg))
(setq this-command 'next-line))
(defun end-of-line-mark (&optional arg)
in `goal-column', which is nil when there is none."
(interactive "p")
(setq mark-active nil)
- (next-line arg)
+ (with-no-warnings (next-line arg))
(setq this-command 'next-line))
(defun end-of-line-nomark (&optional arg)
to use and more reliable (no dependence on goal column, etc.)."
(interactive "p")
(ensure-mark)
- (previous-line arg)
+ (with-no-warnings (previous-line arg))
(setq this-command 'previous-line))
(defun beginning-of-line-mark (&optional arg)
Then it does not try to move vertically."
(interactive "p")
(setq mark-active nil)
- (previous-line arg)
+ (with-no-warnings (previous-line arg))
(setq this-command 'previous-line))
(defun beginning-of-line-nomark (&optional arg)
(defmacro pc-select-add-to-alist (alist var val)
"Ensure that ALIST contains the cons cell (VAR . VAL).
If a cons cell whose car is VAR is already on the ALIST, update the
-cdr of that cell with VAL. Otherwise, make a new cons cell
+cdr of that cell with VAL. Otherwise, make a new cons cell
\(VAR . VAL), and prepend it onto ALIST."
(let ((elt (make-symbol "elt")))
`(let ((,elt (assq ',var ,alist)))
(,mode ,arg)))
(defmacro pc-select-restore-var (var)
- "Restore the previous value of the variable VAR.
+ "Restore the previous value of the variable VAR.
Look up VAR's previous value in `pc-select-saved-settings-alist', and,
if the value is found, set VAR to that value."
(let ((elt (make-symbol "elt")))
;;;###autoload
(define-minor-mode pc-selection-mode
- "Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style.
+ "Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style.
This mode enables Delete Selection mode and Transient Mark mode.
S-M-LEFT and S-M-RIGHT move back or forward one word or sexp, leaving the mark
behind. To control whether these keys move word-wise or sexp-wise set the
variable `pc-select-meta-moves-sexps' after loading pc-select.el but before
-turning `pc-selection-mode' on.
+turning PC Selection mode on.
C-DOWN and C-UP move back or forward a paragraph, disabling the mark.
S-C-DOWN and S-C-UP move back or forward a paragraph, leaving the mark behind.
In addition, certain other PC bindings are imitated (to avoid this, set
the variable `pc-select-selection-keys-only' to t after loading pc-select.el
-but before calling `pc-selection-mode'):
+but before calling PC Selection mode):
F6 other-window
DELETE delete-char
(if pc-selection-mode
(if (null pc-select-key-bindings-alist)
(progn
- (setq pc-select-map (copy-keymap (current-global-map))
- pc-select-saved-global-map (copy-keymap (current-global-map)))
-
+ (setq pc-select-saved-global-map (copy-keymap (current-global-map)))
(setq pc-select-key-bindings-alist
(append pc-select-default-key-bindings
(if pc-select-selection-keys-only
nil
pc-select-tty-key-bindings)))
- (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
- (use-global-map pc-select-map)
+ (pc-select-define-keys pc-select-key-bindings-alist
+ (current-global-map))
(unless (or pc-select-selection-keys-only
(eq window-system 'x)
(memq system-name '(ms-dos windows-nt)))
;; it is not clear that we need the following line
- ;; I hope it doesn't do too much harm to leave it in, though...
+ ;; I hope it doesn't do too much harm to leave it in, though...
(setq pc-select-old-M-delete-binding
(lookup-key function-key-map [M-delete]))
(define-key function-key-map [M-delete] [?\M-d]))
;; the original author also had this above:
;; (setq-default normal-erase-is-backspace t)
;; However, the documentation for the variable says that
- ;; "setting it with setq has no effect", so I'm removing it.
-
+ ;; "setting it with setq has no effect", so I'm removing it.
+
(pc-select-save-and-set-var highlight-nonselected-windows nil)
(pc-select-save-and-set-var transient-mark-mode t)
(pc-select-save-and-set-var mark-even-if-inactive t)
;; do not clobber the values of the variables that were
;; saved from before pc-selection mode was activated --
;; just make sure the values are the way we like them.
- (setq pc-select-map (copy-keymap (current-global-map)))
- (pc-select-define-keys pc-select-key-bindings-alist pc-select-map)
- (use-global-map pc-select-map)
+ (pc-select-define-keys pc-select-key-bindings-alist
+ (current-global-map))
(unless (or pc-select-selection-keys-only
(eq window-system 'x)
(memq system-name '(ms-dos windows-nt)))
;; it is not clear that we need the following line
- ;; I hope it doesn't do too much harm to leave it in, though...
+ ;; I hope it doesn't do too much harm to leave it in, though...
(define-key function-key-map [M-delete] [?\M-d]))
(when (and (not pc-select-selection-keys-only)
(or (eq window-system 'x)
(memq system-name '(ms-dos windows-nt))))
(pc-select-restore-mode normal-erase-is-backspace-mode))
- (setq pc-select-map (copy-keymap (current-global-map)))
(pc-select-restore-keys
- pc-select-key-bindings-alist pc-select-map pc-select-saved-global-map)
- (use-global-map pc-select-map)
+ pc-select-key-bindings-alist (current-global-map)
+ pc-select-saved-global-map)
(pc-select-restore-var highlight-nonselected-windows)
(pc-select-restore-var transient-mark-mode)
pc-select-old-M-delete-binding))
(setq pc-select-key-bindings-alist nil
pc-select-saved-settings-alist nil))))
-
+
;;;###autoload
(defcustom pc-selection-mode nil
"Toggle PC Selection mode.
-Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style,
+Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style,
and cursor movement commands.
This mode enables Delete Selection mode and Transient Mark mode.
-You must modify via \\[customize] for this variable to have an effect."
+Setting this variable directly does not take effect;
+you must modify it using \\[customize] or \\[pc-selection-mode]."
:set (lambda (symbol value)
(pc-selection-mode (if value 1 -1)))
:initialize 'custom-initialize-default
:group 'pc-select
:require 'pc-select)
+;;; arch-tag: 10697b70-ae07-4f3e-ad23-7814a3f418c2
;;; pc-select.el ends here